Skip to contentSkip to conversation

package/asterisk: update to 22.3.0

PATCH Superseded Waldemar Brodkorb 2 participants 3 messages Apr 1, 2025 – Apr 3, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/asterisk: update to 22.3.0

For a changelog see here:
https://downloads.asterisk.org/pub/telephony/asterisk/ChangeLog-22.3.0.md

Changes made by the package maintainer:
- add systemd service file
- run asterisk as non-root user asterisk
- build pjsip as bundled source code, but download it like sound files
- remove unused configure options

See here for the reason behind using the bundled pjsip:
https://github.com/asterisk/asterisk/issues/671

---
 package/asterisk/asterisk.hash    |  4 +++-
 package/asterisk/asterisk.mk      | 28 +++++++++++++------------
 package/asterisk/asterisk.service | 34 +++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+), 14 deletions(-)
 create mode 100644 package/asterisk/asterisk.service
package/asterisk/asterisk.hash +3 -1
index 8c8ebddc47..7b28624921 100644
@@ -1,6 +1,8 @@
 # Locally computed
-sha256  94647b3f887f7dc91df51a4f88dfc3a07cc279bef86b8d05aa72f0c49d187571  asterisk-20.11.1.tar.gz
+sha256  4cc403c8885d4aed3956dfb75d315d3e5bcc129eb9cd47c156d3b12ecceed1ba  asterisk-22.3.0.tar.gz
 
+# Locally computed
+sha256  58bb83cec4d431f48d006e455d821668450f8cf6b6c95f090def47062fa3a60c  pjproject-2.15.1.tar.bz2
 # sha1 from: http://downloads.asterisk.org/pub/telephony/sounds/releases
 # sha256 locally computed
 sha1  721c512feaea102700d5bdce952fdc0bb29dc640  asterisk-core-sounds-en-gsm-1.6.1.tar.gz
package/asterisk/asterisk.mk +15 -13
index ec67632ef4..88bb6902a6 100644
@@ -4,15 +4,17 @@
 #
 ################################################################################
 
-ASTERISK_VERSION = 20.11.1
+ASTERISK_VERSION = 22.3.0
 # Use the github mirror: it's an official mirror maintained by Digium, and
 # provides tarballs, which the main Asterisk git tree (behind Gerrit) does not.
 ASTERISK_SITE = $(call github,asterisk,asterisk,$(ASTERISK_VERSION))
 
+ASTERISK_PJSIP_URL = https://raw.githubusercontent.com/asterisk/third-party/master/pjproject/2.15.1/
 ASTERISK_SOUNDS_BASE_URL = http://downloads.asterisk.org/pub/telephony/sounds/releases
 ASTERISK_EXTRA_DOWNLOADS = \
 	$(ASTERISK_SOUNDS_BASE_URL)/asterisk-core-sounds-en-gsm-1.6.1.tar.gz \
-	$(ASTERISK_SOUNDS_BASE_URL)/asterisk-moh-opsound-wav-2.03.tar.gz
+	$(ASTERISK_SOUNDS_BASE_URL)/asterisk-moh-opsound-wav-2.03.tar.gz \
+	$(ASTERISK_PJSIP_URL)/pjproject-2.15.1.tar.bz2
 
 ASTERISK_LICENSE = GPL-2.0, BSD-3-Clause (SHA1, resample), BSD-4-Clause (db1-ast)
 ASTERISK_LICENSE_FILES = \
@@ -76,7 +78,6 @@ ASTERISK_CONF_OPTS = \
 	--without-neon29 \
 	--without-newt \
 	--without-openr2 \
-	--without-osptk \
 	--without-postgres \
 	--without-popt \
 	--without-resample \
@@ -94,10 +95,9 @@ ASTERISK_CONF_OPTS = \
 	--with-libjwt="$(STAGING_DIR)/usr" \
 	--with-libxml2 \
 	--with-libedit="$(STAGING_DIR)/usr" \
-	--without-pjproject-bundled \
-	--with-pjproject="$(STAGING_DIR)/usr" \
+	--with-pjproject-bundled \
 	--with-sqlite3="$(STAGING_DIR)/usr" \
-	--with-sounds-cache=$(ASTERISK_DL_DIR)
+	--with-download-cache=$(ASTERISK_DL_DIR)
 
 # avcodec are from ffmpeg. There is virtually zero chance this could
 # even work; asterisk is looking for ffmpeg/avcodec.h which has not
@@ -135,13 +135,6 @@ else
 ASTERISK_CONF_OPTS += --without-gsm
 endif
 
-ifeq ($(BR2_PACKAGE_ALSA_LIB),y)
-ASTERISK_DEPENDENCIES += alsa-lib
-ASTERISK_CONF_OPTS += --with-asound
-else
-ASTERISK_CONF_OPTS += --without-asound
-endif
-
 ifeq ($(BR2_PACKAGE_BLUEZ5_UTILS),y)
 ASTERISK_DEPENDENCIES += bluez5_utils
 ASTERISK_CONF_OPTS += --with-bluetooth
@@ -299,6 +292,15 @@ ASTERISK_INSTALL_TARGET_OPTS = \
 	LDCONFIG=true \
 	install samples
 
+define ASTERISK_USERS
+	asterisk -1 asterisk -1 * /usr/lib/asterisk - - asterisk user
+endef
+
+define ASTERISK_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 644 package/asterisk/asterisk.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/asterisk.service
+endef
+
 $(eval $(autotools-package))
 
 #-------------------------------------------------------------------------------
package/asterisk/asterisk.service new file +34 -0
new file mode 100644
index 0000000000..aeb01703ac
@@ -0,0 +1,34 @@
+[Unit]
+Description=Asterisk PBX and telephony daemon.
+After=network.target
+#include these if asterisk need to bind to a specific IP (other than 0.0.0.0)
+#Wants=network-online.target
+#After=network-online.target network.target
+
+[Service]
+Type=simple
+Environment=HOME=/usr/lib/asterisk
+#if systemd do not provide hostname and you need to use ${ENV(HOSTNAME)}
+#Environment=HOSTNAME=%H
+WorkingDirectory=/usr/lib/asterisk
+User=asterisk
+Group=asterisk
+ExecStart=/usr/sbin/asterisk -mqf -C /etc/asterisk/asterisk.conf
+ExecReload=/usr/sbin/asterisk -rx 'core reload'
+#if /var/run is a tmpfs, this will create /var/run/asterisk on start
+RuntimeDirectory=asterisk
+
+#Nice=0
+#UMask=0002
+LimitCORE=infinity
+#LimitNOFILE=
+Restart=always
+RestartSec=4
+
+# Prevent duplication of logs with color codes to /var/log/messages
+StandardOutput=null
+
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target
Signature · 6 lines
2.39.5

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 10 lines · Waldemar Brodkorb

For a changelog see here:
https://downloads.asterisk.org/pub/telephony/asterisk/ChangeLog-22.3.0.md

Changes made by the package maintainer:
- add systemd service file
- run asterisk as non-root user asterisk
- build pjsip as bundled source code, but download it like sound files
- remove unused configure options

Quoted 2 lines

See here for the reason behind using the bundled pjsip:
https://github.com/asterisk/asterisk/issues/671

 It remains super weird that the same source works fine if built within asterisk, but not if it's built externally...

 It's not clear to me from the information in the ticket if you tried finding what is different about the two cases. They suggested that asterisk uses a different config file, could that be what happens? It could also be different compiler options. Or it could be that we build libpjsip itself incorrectly. It could be a matter of a different struct alignment or something like that, because of different compilation options. But then I don't understand that other libraries don't have the same issue...

Quoted 27 lines
---
  package/asterisk/asterisk.hash    |  4 +++-
  package/asterisk/asterisk.mk      | 28 +++++++++++++------------
  package/asterisk/asterisk.service | 34 +++++++++++++++++++++++++++++++
  3 files changed, 52 insertions(+), 14 deletions(-)

create mode 100644 package/asterisk/asterisk.service

package/asterisk/asterisk.hash +3 -1
index 8c8ebddc47..7b28624921 100644
@@ -1,6 +1,8 @@
  # Locally computed
-sha256  94647b3f887f7dc91df51a4f88dfc3a07cc279bef86b8d05aa72f0c49d187571  asterisk-20.11.1.tar.gz
+sha256  4cc403c8885d4aed3956dfb75d315d3e5bcc129eb9cd47c156d3b12ecceed1ba  asterisk-22.3.0.tar.gz
 
+# Locally computed
+sha256  58bb83cec4d431f48d006e455d821668450f8cf6b6c95f090def47062fa3a60c  pjproject-2.15.1.tar.bz2
  # sha1 from: http://downloads.asterisk.org/pub/telephony/sounds/releases
  # sha256 locally computed
  sha1  721c512feaea102700d5bdce952fdc0bb29dc640  asterisk-core-sounds-en-gsm-1.6.1.tar.gz
package/asterisk/asterisk.mk +0 -0
index ec67632ef4..88bb6902a6 100644

package/asterisk/asterisk.mk line 12

Quoted 10 lines
package/asterisk/asterisk.mk +2 -1
@@ -4,15 +4,17 @@
  #
  ################################################################################
 
-ASTERISK_VERSION = 20.11.1
+ASTERISK_VERSION = 22.3.0
  # Use the github mirror: it's an official mirror maintained by Digium, and
  # provides tarballs, which the main Asterisk git tree (behind Gerrit) does not.
  ASTERISK_SITE = $(call github,asterisk,asterisk,$(ASTERISK_VERSION))
 
+ASTERISK_PJSIP_URL = https://raw.githubusercontent.com/asterisk/third-party/master/pjproject/2.15.1/

 Could we use LIBPJSIP_SITE and LIBPJSIP_SOURCE instead?

Quoted 18 lines
package/asterisk/asterisk.mk +2 -2
  ASTERISK_SOUNDS_BASE_URL = http://downloads.asterisk.org/pub/telephony/sounds/releases
  ASTERISK_EXTRA_DOWNLOADS = \
  	$(ASTERISK_SOUNDS_BASE_URL)/asterisk-core-sounds-en-gsm-1.6.1.tar.gz \
-	$(ASTERISK_SOUNDS_BASE_URL)/asterisk-moh-opsound-wav-2.03.tar.gz
+	$(ASTERISK_SOUNDS_BASE_URL)/asterisk-moh-opsound-wav-2.03.tar.gz \
+	$(ASTERISK_PJSIP_URL)/pjproject-2.15.1.tar.bz2
 
  ASTERISK_LICENSE = GPL-2.0, BSD-3-Clause (SHA1, resample), BSD-4-Clause (db1-ast)
  ASTERISK_LICENSE_FILES = \
@@ -76,7 +78,6 @@ ASTERISK_CONF_OPTS = \
  	--without-neon29 \
  	--without-newt \
  	--without-openr2 \
-	--without-osptk \
  	--without-postgres \
  	--without-popt \
  	--without-resample \

package/asterisk/asterisk.mk ASTERISK_CONF_OPTS = \ · line 100

Quoted 9 lines
package/asterisk/asterisk.mk +2 -3
@@ -94,10 +95,9 @@ ASTERISK_CONF_OPTS = \
  	--with-libjwt="$(STAGING_DIR)/usr" \
  	--with-libxml2 \
  	--with-libedit="$(STAGING_DIR)/usr" \
-	--without-pjproject-bundled \
-	--with-pjproject="$(STAGING_DIR)/usr" \
+	--with-pjproject-bundled \
  	--with-sqlite3="$(STAGING_DIR)/usr" \
-	--with-sounds-cache=$(ASTERISK_DL_DIR)
+	--with-download-cache=$(ASTERISK_DL_DIR)

 Actually, we could use LIBPJSIP_DL_DIR here... But then we have a problem with the sounds cache of course...

 I think we should have a comment here to explain that we're using the exact same source as our libpjsip package, but just rebuild it. With a reference to the bug report.

package/asterisk/asterisk.mk else · line 142

Quoted 12 lines
package/asterisk/asterisk.mk +0 -5
  # avcodec are from ffmpeg. There is virtually zero chance this could
  # even work; asterisk is looking for ffmpeg/avcodec.h which has not
@@ -135,13 +135,6 @@ else
  ASTERISK_CONF_OPTS += --without-gsm
  endif
 
-ifeq ($(BR2_PACKAGE_ALSA_LIB),y)
-ASTERISK_DEPENDENCIES += alsa-lib
-ASTERISK_CONF_OPTS += --with-asound
-else
-ASTERISK_CONF_OPTS += --without-asound

 Commit message doesn't explain why this is removed (ALSA no longer supported? Is a bit surprising...)

Quoted 41 lines
package/asterisk/asterisk.mk +9 -2
-endif
-
  ifeq ($(BR2_PACKAGE_BLUEZ5_UTILS),y)
  ASTERISK_DEPENDENCIES += bluez5_utils
  ASTERISK_CONF_OPTS += --with-bluetooth
@@ -299,6 +292,15 @@ ASTERISK_INSTALL_TARGET_OPTS = \
  	LDCONFIG=true \
  	install samples
 
+define ASTERISK_USERS
+	asterisk -1 asterisk -1 * /usr/lib/asterisk - - asterisk user
+endef
+
+define ASTERISK_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 644 package/asterisk/asterisk.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/asterisk.service
+endef
+
  $(eval $(autotools-package))
 
  #-------------------------------------------------------------------------------
package/asterisk/asterisk.service new file +14 -0
new file mode 100644
index 0000000000..aeb01703ac
@@ -0,0 +1,34 @@
+[Unit]
+Description=Asterisk PBX and telephony daemon.
+After=network.target
+#include these if asterisk need to bind to a specific IP (other than 0.0.0.0)
+#Wants=network-online.target
+#After=network-online.target network.target
+
+[Service]
+Type=simple
+Environment=HOME=/usr/lib/asterisk
+#if systemd do not provide hostname and you need to use ${ENV(HOSTNAME)}
+#Environment=HOSTNAME=%H
+WorkingDirectory=/usr/lib/asterisk
+User=asterisk

package/asterisk/asterisk.service line 24

Quoted 10 lines
package/asterisk/asterisk.service new file +10 -0
+Group=asterisk
+ExecStart=/usr/sbin/asterisk -mqf -C /etc/asterisk/asterisk.conf
+ExecReload=/usr/sbin/asterisk -rx 'core reload'
+#if /var/run is a tmpfs, this will create /var/run/asterisk on start
+RuntimeDirectory=asterisk
+
+#Nice=0
+#UMask=0002
+LimitCORE=infinity
+#LimitNOFILE=

 Why are all those things commented out?

 Hang on, is this identical to contrib/systemd/asterisk.service? The you should just use that. Or if it is modified, then make sure you refer where it originally came from and what is changed. Actually, it should probably have a license header.

 Regards,
 Arnout

package/asterisk/asterisk.service line 34

Quoted 10 lines
package/asterisk/asterisk.service new file +10 -0
+Restart=always
+RestartSec=4
+
+# Prevent duplication of logs with color codes to /var/log/messages
+StandardOutput=null
+
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Hi Arnout,

thanks for the review.

Arnout Vandecappelle wrote,

Quoted 18 lines · Waldemar Brodkorb
Quoted 10 lines

For a changelog see here:
https://downloads.asterisk.org/pub/telephony/asterisk/ChangeLog-22.3.0.md

Changes made by the package maintainer:
- add systemd service file
- run asterisk as non-root user asterisk
- build pjsip as bundled source code, but download it like sound files
- remove unused configure options

Quoted 2 lines

See here for the reason behind using the bundled pjsip:
https://github.com/asterisk/asterisk/issues/671

 It remains super weird that the same source works fine if built within asterisk, but not if it's built externally...

Quoted 7 lines

 It's not clear to me from the information in the ticket if you tried finding what is different about the two cases. They suggested that asterisk uses a different config file, could that be what happens? It could also be different compiler options. Or it could be that we build libpjsip itself incorrectly. It could be a matter of a different struct alignment or something like that, because of different compilation options. But then I don't understand that other libraries don't have the same issue...

I tried different things, but none worked. I tried the site config thing and added the patches from asterisk to pjsip, but that didn't worked. It is weird, you are right.

Quoted 69 lines
Quoted 26 lines
---
  package/asterisk/asterisk.hash    |  4 +++-
  package/asterisk/asterisk.mk      | 28 +++++++++++++------------
  package/asterisk/asterisk.service | 34 +++++++++++++++++++++++++++++++
  3 files changed, 52 insertions(+), 14 deletions(-)

create mode 100644 package/asterisk/asterisk.service

package/asterisk/asterisk.hash +3 -1
index 8c8ebddc47..7b28624921 100644
@@ -1,6 +1,8 @@
  # Locally computed
-sha256  94647b3f887f7dc91df51a4f88dfc3a07cc279bef86b8d05aa72f0c49d187571  asterisk-20.11.1.tar.gz
+sha256  4cc403c8885d4aed3956dfb75d315d3e5bcc129eb9cd47c156d3b12ecceed1ba  asterisk-22.3.0.tar.gz
+# Locally computed
+sha256  58bb83cec4d431f48d006e455d821668450f8cf6b6c95f090def47062fa3a60c  pjproject-2.15.1.tar.bz2
  # sha1 from: http://downloads.asterisk.org/pub/telephony/sounds/releases
  # sha256 locally computed
  sha1  721c512feaea102700d5bdce952fdc0bb29dc640  asterisk-core-sounds-en-gsm-1.6.1.tar.gz
package/asterisk/asterisk.mk +0 -0
index ec67632ef4..88bb6902a6 100644

package/asterisk/asterisk.mk line 10

Quoted 8 lines
package/asterisk/asterisk.mk +2 -1
@@ -4,15 +4,17 @@
  #
  ################################################################################
-ASTERISK_VERSION = 20.11.1
+ASTERISK_VERSION = 22.3.0
  # Use the github mirror: it's an official mirror maintained by Digium, and
  # provides tarballs, which the main Asterisk git tree (behind Gerrit) does not.
  ASTERISK_SITE = $(call github,asterisk,asterisk,$(ASTERISK_VERSION))
+ASTERISK_PJSIP_URL = https://raw.githubusercontent.com/asterisk/third-party/master/pjproject/2.15.1/

 Could we use LIBPJSIP_SITE and LIBPJSIP_SOURCE instead?

Quoted 17 lines
package/asterisk/asterisk.mk +2 -2
  ASTERISK_SOUNDS_BASE_URL = http://downloads.asterisk.org/pub/telephony/sounds/releases
  ASTERISK_EXTRA_DOWNLOADS = \
  	$(ASTERISK_SOUNDS_BASE_URL)/asterisk-core-sounds-en-gsm-1.6.1.tar.gz \
-	$(ASTERISK_SOUNDS_BASE_URL)/asterisk-moh-opsound-wav-2.03.tar.gz
+	$(ASTERISK_SOUNDS_BASE_URL)/asterisk-moh-opsound-wav-2.03.tar.gz \
+	$(ASTERISK_PJSIP_URL)/pjproject-2.15.1.tar.bz2
  ASTERISK_LICENSE = GPL-2.0, BSD-3-Clause (SHA1, resample), BSD-4-Clause (db1-ast)
  ASTERISK_LICENSE_FILES = \
@@ -76,7 +78,6 @@ ASTERISK_CONF_OPTS = \
  	--without-neon29 \
  	--without-newt \
  	--without-openr2 \
-	--without-osptk \
  	--without-postgres \
  	--without-popt \
  	--without-resample \

package/asterisk/asterisk.mk ASTERISK_CONF_OPTS = \ · line 100

Quoted 9 lines
package/asterisk/asterisk.mk +2 -3
@@ -94,10 +95,9 @@ ASTERISK_CONF_OPTS = \
  	--with-libjwt="$(STAGING_DIR)/usr" \
  	--with-libxml2 \
  	--with-libedit="$(STAGING_DIR)/usr" \
-	--without-pjproject-bundled \
-	--with-pjproject="$(STAGING_DIR)/usr" \
+	--with-pjproject-bundled \
  	--with-sqlite3="$(STAGING_DIR)/usr" \
-	--with-sounds-cache=$(ASTERISK_DL_DIR)
+	--with-download-cache=$(ASTERISK_DL_DIR)

 Actually, we could use LIBPJSIP_DL_DIR here... But then we have a problem with the sounds cache of course...

Quoted 3 lines

 I think we should have a comment here to explain that we're using the exact same source as our libpjsip package, but just rebuild it. With a reference to the bug report.

Added in v2.

Quoted 5 lines
Quoted 5 lines
package/asterisk/asterisk.mk +0 -0
  # avcodec are from ffmpeg. There is virtually zero chance this could
  # even work; asterisk is looking for ffmpeg/avcodec.h which has not
@@ -135,13 +135,6 @@ else
  ASTERISK_CONF_OPTS += --without-gsm
  endif
Quoted 8 lines

package/asterisk/asterisk.mk else · line 142

Quoted 5 lines
package/asterisk/asterisk.mk +0 -5
-ifeq ($(BR2_PACKAGE_ALSA_LIB),y)
-ASTERISK_DEPENDENCIES += alsa-lib
-ASTERISK_CONF_OPTS += --with-asound
-else
-ASTERISK_CONF_OPTS += --without-asound

 Commit message doesn't explain why this is removed (ALSA no longer supported? Is a bit surprising...)

Added in v2. They removed chan_alsa upstream.

Quoted 52 lines
Quoted 39 lines
package/asterisk/asterisk.mk +9 -2
-endif
-
  ifeq ($(BR2_PACKAGE_BLUEZ5_UTILS),y)
  ASTERISK_DEPENDENCIES += bluez5_utils
  ASTERISK_CONF_OPTS += --with-bluetooth
@@ -299,6 +292,15 @@ ASTERISK_INSTALL_TARGET_OPTS = \
  	LDCONFIG=true \
  	install samples
+define ASTERISK_USERS
+	asterisk -1 asterisk -1 * /usr/lib/asterisk - - asterisk user
+endef
+
+define ASTERISK_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 644 package/asterisk/asterisk.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/asterisk.service
+endef
+
  $(eval $(autotools-package))
  #-------------------------------------------------------------------------------
package/asterisk/asterisk.service new file +14 -0
new file mode 100644
index 0000000000..aeb01703ac
@@ -0,0 +1,34 @@
+[Unit]
+Description=Asterisk PBX and telephony daemon.
+After=network.target
+#include these if asterisk need to bind to a specific IP (other than 0.0.0.0)
+#Wants=network-online.target
+#After=network-online.target network.target
+
+[Service]
+Type=simple
+Environment=HOME=/usr/lib/asterisk
+#if systemd do not provide hostname and you need to use ${ENV(HOSTNAME)}
+#Environment=HOSTNAME=%H
+WorkingDirectory=/usr/lib/asterisk
+User=asterisk

package/asterisk/asterisk.service line 24

Quoted 10 lines
package/asterisk/asterisk.service new file +10 -0
+Group=asterisk
+ExecStart=/usr/sbin/asterisk -mqf -C /etc/asterisk/asterisk.conf
+ExecReload=/usr/sbin/asterisk -rx 'core reload'
+#if /var/run is a tmpfs, this will create /var/run/asterisk on start
+RuntimeDirectory=asterisk
+
+#Nice=0
+#UMask=0002
+LimitCORE=infinity
+#LimitNOFILE=

 Why are all those things commented out?

Quoted 4 lines

 Hang on, is this identical to contrib/systemd/asterisk.service? The you should just use that. Or if it is modified, then make sure you refer where it originally came from and what is changed. Actually, it should probably have a license header.

It is based on contrib/systemd/asterisk.service, but I needed to change Type from notify to simple, as the former didn't worked for me on my target.

best regards
Waldemar
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot