From: Sebastian Kemper Date: Sat, 20 Aug 2022 09:28:34 +0000 (+0200) Subject: asterisk: bump to 18.14.0 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=994eb6e4ac25ebdb80ba33783a28c19433ba442e;p=feed%2Ftelephony.git asterisk: bump to 18.14.0 - add new modules - res-geolocation depends on asterisk being built with libxlt support, but to make libxslt a general dependency is probably not a good idea for small devices, so this adds a config option ASTERISK_LIBXSLT_SUPPORT that is off by default except on x86_64 builds - correct some module titles by removing the extraneous "support" string - refresh patches - 170-time-add-support-for-time64-libcs.patch, 180_build-fix-bininstall-launchd-issue-on-cross-platfrom.patch and 190-logger-workaround-woefully-small-BUFSIZ-in-MUSL.patch removed as included in upstream release - added 170-menuselect-force-use-of-xml2-config.patch as upstream switched to use pkg-config for libxml2 detection, which would be fine, except OpenWrt's host libxml2 is static and Asterisk can't handle that Signed-off-by: Sebastian Kemper (cherry picked from commit aa3bc352e787768fbf5f1f806a9b2b06a74b19fc) --- diff --git a/net/asterisk/Makefile b/net/asterisk/Makefile index be621d6..2546db0 100644 --- a/net/asterisk/Makefile +++ b/net/asterisk/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=asterisk -PKG_VERSION:=18.11.2 +PKG_VERSION:=18.14.0 PKG_RELEASE:=$(AUTORELEASE) PKG_SOURCE:=asterisk-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://downloads.asterisk.org/pub/telephony/asterisk/releases -PKG_HASH:=b456d19610e53789446e097bb9773a82a04088922de0cfaff2b818326b67296b +PKG_HASH:=c79a728688e1d8faaf3915be81b88b6e324f314dd377de791e37dfa6d081a246 PKG_BUILD_DEPENDS:=libxml2/host @@ -184,6 +184,7 @@ MODULES_AVAILABLE:= \ func-dialplan \ func-enum \ func-env \ + func-evalexten \ func-extstate \ func-frame-drop \ func-frame-trace \ @@ -227,6 +228,7 @@ MODULES_AVAILABLE:= \ pgsql \ pjsip \ res-adsi \ + res-aeap \ res-ael-share \ res-agi \ res-ari \ @@ -250,6 +252,7 @@ MODULES_AVAILABLE:= \ res-calendar-icalendar \ res-chan-stats \ res-clialiases \ + res-cliexec \ res-clioriginate \ res-config-ldap \ res-config-mysql \ @@ -271,6 +274,7 @@ MODULES_AVAILABLE:= \ res-format-attr-siren14 \ res-format-attr-siren7 \ res-format-attr-vp8 \ + res-geolocation \ res-http-media-cache \ res-http-websocket \ res-limit \ @@ -284,6 +288,7 @@ MODULES_AVAILABLE:= \ res-mwi-external-ami \ res-parking \ res-phoneprov \ + res-pjsip-geolocation \ res-pjsip-phoneprov \ res-pjsip-stir-shaken \ res-pjproject \ @@ -300,6 +305,7 @@ MODULES_AVAILABLE:= \ res-sorcery \ res-sorcery-memory-cache \ res-speech \ + res-speech-aeap \ res-srtp \ res-stasis \ res-stasis-answer \ @@ -334,6 +340,7 @@ AST_ENABLE:= PKG_CONFIG_DEPENDS:= \ $(patsubst %,CONFIG_PACKAGE_$(PKG_NAME)-%,$(MODULES_AVAILABLE)) \ $(patsubst %,CONFIG_PACKAGE_$(PKG_NAME)-util-%,$(subst _,-,$(UTILS_AVAILABLE))) \ + CONFIG_ASTERISK_LIBXSLT_SUPPORT \ CONFIG_ASTERISK_LOW_MEMORY include $(INCLUDE_DIR)/package.mk @@ -375,6 +382,13 @@ define Package/$(PKG_NAME)/config menu "Advanced configuration" depends on PACKAGE_asterisk + config ASTERISK_LIBXSLT_SUPPORT + bool "Link Asterisk against libxslt" + default y if x86_64 + help + Build Asterisk with libxslt support. This is required for + res-geolocation. + config ASTERISK_LOW_MEMORY bool "Optimize Asterisk for low memory usage" default n @@ -457,7 +471,7 @@ define Package/$(PKG_NAME) $(call Package/$(PKG_NAME)/Default) TITLE:=Complete open source PBX, v$(PKG_VERSION) MENU:=1 - DEPENDS:=+libstdcpp +jansson +libcap +libedit +libopenssl +libsqlite3 +libuuid +libxml2 +zlib + DEPENDS:=+ASTERISK_LIBXSLT_SUPPORT:libxslt +libstdcpp +jansson +libcap +libedit +libopenssl +libsqlite3 +libuuid +libxml2 +zlib USERID:=asterisk=385:asterisk=385 endef @@ -573,7 +587,7 @@ CONFIGURE_ARGS+= \ --without-pjproject-bundled \ --with-libedit="$(STAGING_DIR)/usr" \ --with-libxml2 \ - --without-libxslt \ + $(if $(CONFIG_ASTERISK_LIBXSLT_SUPPORT),--with-libxslt,--without-libxslt) \ $(if $(CONFIG_PACKAGE_$(PKG_NAME)-res-snmp),--with-netsnmp="$(STAGING_DIR)/usr",--without-netsnmp) \ --without-newt \ --without-osptk \ @@ -885,7 +899,7 @@ $(eval $(call BuildAsteriskModule,codec-lpc10,Linear to LPC10 translation,LPC10 $(eval $(call BuildAsteriskModule,codec-resample,resample sLinear audio,SLIN resampling codec.,,,codec_resample,,)) $(eval $(call BuildAsteriskModule,codec-speex,Speex Coder/Decoder,Speex coder/decoder.,@!SOFT_FLOAT +libspeex +libspeexdsp,,codec_speex,,)) $(eval $(call BuildAsteriskModule,codec-ulaw,Signed linear to ulaw translation,Ulaw coder/decoder.,,,codec_ulaw,,)) -$(eval $(call BuildAsteriskModule,curl,CURL,cURL support,+libcurl,,func_curl res_config_curl res_curl,,)) +$(eval $(call BuildAsteriskModule,curl,CURL,cURL,+libcurl,,func_curl res_config_curl res_curl,,)) $(eval $(call BuildAsteriskModule,format-g719,G.719,ITU G.719.,,,format_g719,,)) $(eval $(call BuildAsteriskModule,format-g723,G.723.1,G.723.1 simple timestamp file format.,,,format_g723,,)) $(eval $(call BuildAsteriskModule,format-g726,G.726,Raw G.726 data.,,,format_g726,,)) @@ -905,7 +919,7 @@ $(eval $(call BuildAsteriskModule,format-vox,VOX format,Dialogic VOX file format $(eval $(call BuildAsteriskModule,format-wav,WAV format (8000hz Signed Linear),Microsoft WAV/WAV16 format.,,,format_wav,,)) $(eval $(call BuildAsteriskModule,format-wav-gsm,WAV format (Proprietary GSM),Microsoft WAV format.,,,format_wav_gsm,,)) $(eval $(call BuildAsteriskModule,func-aes,AES dialplan functions,AES dialplan functions.,,,func_aes,,)) -$(eval $(call BuildAsteriskModule,func-base64,base64 support,Base64 encode/decode dialplan functions.,,,func_base64,,)) +$(eval $(call BuildAsteriskModule,func-base64,base64,Base64 encode/decode dialplan functions.,,,func_base64,,)) $(eval $(call BuildAsteriskModule,func-blacklist,Blacklist on callerid,Look up Caller ID name/number from blacklist database.,,,func_blacklist,,)) $(eval $(call BuildAsteriskModule,func-callcompletion,Call control configuration function,Call control configuration function.,,,func_callcompletion,,)) $(eval $(call BuildAsteriskModule,func-channel,Channel info,Channel information dialplan functions.,,,func_channel,,)) @@ -917,6 +931,7 @@ $(eval $(call BuildAsteriskModule,func-dialgroup,Dialgroup dialplan function,Dia $(eval $(call BuildAsteriskModule,func-dialplan,Dialplan context/extension/priority checking functions,Dialplan context/extension/priority checking functions.,,,func_dialplan,,)) $(eval $(call BuildAsteriskModule,func-enum,ENUM,ENUM related dialplan functions.,,enum.conf,func_enum,,)) $(eval $(call BuildAsteriskModule,func-env,Environment functions,Environment/filesystem dialplan functions.,,,func_env,,)) +$(eval $(call BuildAsteriskModule,func-evalexten,Extension evaluation,Extension evaluation functions.,,,func_evalexten,,)) $(eval $(call BuildAsteriskModule,func-extstate,Hinted extension state,Gets the state of an extension in the dialplan.,,,func_extstate,,)) $(eval $(call BuildAsteriskModule,func-frame-drop,Frame drop,Function to drop frames on a channel.,,,func_frame_drop,,)) $(eval $(call BuildAsteriskModule,func-frame-trace,Frame trace for internal ast_frame debugging,Frame trace for internal ast_frame debugging.,,,func_frame_trace,,)) @@ -960,6 +975,7 @@ $(eval $(call BuildAsteriskModule,pbx-spool,Call Spool,Outgoing spool support.,, $(eval $(call BuildAsteriskModule,pgsql,PostgreSQL,PostgreSQL support.,+libpq,cel_pgsql.conf cdr_pgsql.conf res_pgsql.conf,cel_pgsql cdr_pgsql res_config_pgsql,,)) $(eval $(call BuildAsteriskModule,pjsip,pjsip channel,PJSIP SIP stack.,+$(PKG_NAME)-res-http-websocket +$(PKG_NAME)-res-pjproject +$(PKG_NAME)-res-sorcery +libpjsip +libpjmedia +libpjnath +libpjsip-simple +libpjsip-ua +libpjsua +libpjsua2,pjsip.conf pjsip_notify.conf pjsip_wizard.conf,chan_pjsip func_pjsip_aor func_pjsip_contact func_pjsip_endpoint res_pjsip res_pjsip_acl res_pjsip_authenticator_digest res_pjsip_caller_id res_pjsip_config_wizard res_pjsip_dialog_info_body_generator res_pjsip_diversion res_pjsip_dlg_options res_pjsip_dtmf_info res_pjsip_empty_info res_pjsip_endpoint_identifier_anonymous res_pjsip_endpoint_identifier_ip res_pjsip_endpoint_identifier_user res_pjsip_exten_state res_pjsip_header_funcs res_pjsip_history res_pjsip_logger res_pjsip_messaging res_pjsip_mwi res_pjsip_mwi_body_generator res_pjsip_nat res_pjsip_notify res_pjsip_one_touch_record_info res_pjsip_outbound_authenticator_digest res_pjsip_outbound_publish res_pjsip_outbound_registration res_pjsip_path res_pjsip_pidf_body_generator res_pjsip_pidf_digium_body_supplement res_pjsip_pidf_eyebeam_body_supplement res_pjsip_publish_asterisk res_pjsip_pubsub res_pjsip_refer res_pjsip_registrar res_pjsip_rfc3326 res_pjsip_sdp_rtp res_pjsip_send_to_voicemail res_pjsip_session res_pjsip_sips_contact res_pjsip_t38 res_pjsip_transport_websocket res_pjsip_xpidf_body_generator,,)) $(eval $(call BuildAsteriskModule,res-adsi,Provide ADSI,ADSI resource.,,,res_adsi,,)) +$(eval $(call BuildAsteriskModule,res-aeap,Provide AEAP,AEAP resource.,+asterisk-res-http-websocket,aeap.conf,res_aeap,,)) $(eval $(call BuildAsteriskModule,res-ael-share,Shareable AEL code,Shareable code for AEL.,,,res_ael_share,,)) $(eval $(call BuildAsteriskModule,res-agi,Asterisk Gateway Interface,Asterisk Gateway Interface.,+$(PKG_NAME)-res-speech,,res_agi,,)) $(eval $(call BuildAsteriskModule,res-ari,Asterisk RESTful interface,Asterisk RESTful Interface.,+$(PKG_NAME)-res-http-websocket,ari.conf,res_ari,,)) @@ -983,6 +999,7 @@ $(eval $(call BuildAsteriskModule,res-calendar-exchange,Exchange calendar,Asteri $(eval $(call BuildAsteriskModule,res-calendar-icalendar,iCalendar calendar,Asterisk iCalendar .ics file integration.,+$(PKG_NAME)-res-calendar +libical +libneon,,res_calendar_icalendar,,)) $(eval $(call BuildAsteriskModule,res-chan-stats,statsd channel stats,Example of how to use Stasis.,+$(PKG_NAME)-res-statsd,,res_chan_stats,,)) $(eval $(call BuildAsteriskModule,res-clialiases,CLI aliases,CLI aliases.,,cli_aliases.conf,res_clialiases,,)) +$(eval $(call BuildAsteriskModule,res-cliexec,Execute from CLI,Simple dialplan execution from the CLI.,,,res_cliexec,,)) $(eval $(call BuildAsteriskModule,res-clioriginate,Calls via CLI,Call origination and redirection from the CLI.,,,res_clioriginate,,)) $(eval $(call BuildAsteriskModule,res-config-ldap,LDAP realtime interface,LDAP realtime interface.,+libopenldap,res_ldap.conf,res_config_ldap,,)) $(eval $(call BuildAsteriskModule,res-config-mysql,MySQL CDR backend,MySQL realtime configuration driver.,+libmysqlclient,,res_config_mysql,,)) @@ -1004,8 +1021,9 @@ $(eval $(call BuildAsteriskModule,res-format-attr-silk,SILK format attribute mod $(eval $(call BuildAsteriskModule,res-format-attr-siren14,Siren14 format attribute module,Siren14 format attribute module.,,,res_format_attr_siren14,,)) $(eval $(call BuildAsteriskModule,res-format-attr-siren7,Siren7 format attribute module,Siren7 format attribute module.,,,res_format_attr_siren7,,)) $(eval $(call BuildAsteriskModule,res-format-attr-vp8,VP8 format attribute module,VP8 format attribute module.,,,res_format_attr_vp8,,)) +$(eval $(call BuildAsteriskModule,res-geolocation,Geolocation,Geolocation support.,@ASTERISK_LIBXSLT_SUPPORT,geolocation.conf,res_geolocation,,)) $(eval $(call BuildAsteriskModule,res-http-media-cache,HTTP media cache backend,HTTP media cache backend.,+$(PKG_NAME)-curl,,res_http_media_cache,,)) -$(eval $(call BuildAsteriskModule,res-http-websocket,HTTP websocket support,HTTP WebSocket support.,,,res_http_websocket,,)) +$(eval $(call BuildAsteriskModule,res-http-websocket,HTTP websocket,HTTP WebSocket support.,,,res_http_websocket,,)) $(eval $(call BuildAsteriskModule,res-limit,Resource limits,Resource limits.,,,res_limit,,)) $(eval $(call BuildAsteriskModule,res-manager-devicestate,Device state topic forwarder,Manager device state topic forwarder.,,,res_manager_devicestate,,)) $(eval $(call BuildAsteriskModule,res-manager-presencestate,Presence state topic forwarder,Manager presence state topic forwarder.,,,res_manager_presencestate,,)) @@ -1017,6 +1035,7 @@ $(eval $(call BuildAsteriskModule,res-mwi-external,Core external MWI resource,Co $(eval $(call BuildAsteriskModule,res-mwi-external-ami,AMI for external MWI,AMI support for external MWI.,+$(PKG_NAME)-res-mwi-external,,res_mwi_external_ami,,)) $(eval $(call BuildAsteriskModule,res-parking,Phone Parking,Call parking resource.,+$(PKG_NAME)-bridge-holding,res_parking.conf,res_parking,,)) $(eval $(call BuildAsteriskModule,res-phoneprov,Phone Provisioning,HTTP phone provisioning.,,phoneprov.conf,res_phoneprov,,)) +$(eval $(call BuildAsteriskModule,res-pjsip-geolocation,PJSIP Geolocation,PJSIP Geolocation support.,+asterisk-pjsip +asterisk-res-geolocation,,res_pjsip_geolocation,,)) $(eval $(call BuildAsteriskModule,res-pjsip-phoneprov,PJSIP Phone Provisioning,PJSIP phone provisioning.,+$(PKG_NAME)-pjsip +$(PKG_NAME)-res-phoneprov,,res_pjsip_phoneprov_provider,,)) $(eval $(call BuildAsteriskModule,res-pjsip-stir-shaken,PJSIP STIR/SHAKEN resource module,PJSIP STIR/SHAKEN resource module.,+$(PKG_NAME)-pjsip +$(PKG_NAME)-res-stir-shaken,,res_pjsip_stir_shaken,,)) $(eval $(call BuildAsteriskModule,res-pjproject,Bridge PJPROJECT to Asterisk logging,PJProject log and utility support.,+asterisk-res-sorcery +libpj +libpjlib-util +libpjmedia +libpjmedia +libpjnath +libpjsip-simple +libpjsip-ua +libpjsip +libpjsua +libpjsua2 +libsrtp2,pjproject.conf,res_pjproject,,)) @@ -1033,6 +1052,7 @@ $(eval $(call BuildAsteriskModule,res-snmp,SNMP [Sub]Agent for Asterisk,SNMP age $(eval $(call BuildAsteriskModule,res-sorcery,Sorcery data layer,Sorcery backend modules for data access intended for using realtime as\nbackend.,,sorcery.conf,res_sorcery_astdb res_sorcery_config res_sorcery_memory res_sorcery_realtime,,)) $(eval $(call BuildAsteriskModule,res-sorcery-memory-cache,Sorcery memory cache object wizard,Sorcery memory cache object wizard.,,,res_sorcery_memory_cache,,)) $(eval $(call BuildAsteriskModule,res-speech,Speech Recognition API,Generic speech recognition API.,,,res_speech,,)) +$(eval $(call BuildAsteriskModule,res-speech-aeap,AEAP Speech Engine,AEAP Speech Engine support.,+asterisk-res-aeap +asterisk-res-speech,,res_speech_aeap,,)) $(eval $(call BuildAsteriskModule,res-srtp,SRTP Support,Secure RTP.,+libsrtp2,,res_srtp,,)) $(eval $(call BuildAsteriskModule,res-stasis,Stasis application,Stasis application support.,,,res_stasis,,)) $(eval $(call BuildAsteriskModule,res-stasis-answer,Stasis application answer,Stasis application answer support.,+$(PKG_NAME)-res-stasis,,res_stasis_answer,,)) diff --git a/net/asterisk/patches/130-eventfd.patch b/net/asterisk/patches/130-eventfd.patch index af6fa99..c5530e3 100644 --- a/net/asterisk/patches/130-eventfd.patch +++ b/net/asterisk/patches/130-eventfd.patch @@ -1,6 +1,6 @@ --- a/configure.ac +++ b/configure.ac -@@ -1260,7 +1260,7 @@ if test "${ac_cv_have_variable_fdset}x" +@@ -1261,7 +1261,7 @@ if test "${ac_cv_have_variable_fdset}x" fi AC_MSG_CHECKING([if we have usable eventfd support]) diff --git a/net/asterisk/patches/140-use-default-lua.patch b/net/asterisk/patches/140-use-default-lua.patch index 5f723cc..4a3717d 100644 --- a/net/asterisk/patches/140-use-default-lua.patch +++ b/net/asterisk/patches/140-use-default-lua.patch @@ -1,6 +1,6 @@ --- a/configure.ac +++ b/configure.ac -@@ -2612,7 +2612,7 @@ if test -z "$__opus_include" -o x"$__opu +@@ -2613,7 +2613,7 @@ if test -z "$__opus_include" -o x"$__opu fi AST_EXT_LIB_CHECK([OPUSFILE], [opusfile], [op_open_callbacks], [opus/opusfile.h], [], [$__opus_include]) diff --git a/net/asterisk/patches/170-menuselect-force-use-of-xml2-config.patch b/net/asterisk/patches/170-menuselect-force-use-of-xml2-config.patch new file mode 100644 index 0000000..486a1a5 --- /dev/null +++ b/net/asterisk/patches/170-menuselect-force-use-of-xml2-config.patch @@ -0,0 +1,17 @@ +Since commit dc701d6 in the OpenWrt packages repo the host libxml2 package +provides a static lib only. But Asterisk does not check that and calls +pkg-config without "--static". The result is that menuselect doesn't build. + +So don't use pkg-config for the libxml2 detection. Asterisk will resort to +use xml2-config, which outputs all the flags needed. + +--- a/menuselect/configure.ac ++++ b/menuselect/configure.ac +@@ -91,7 +91,6 @@ else + AST_EXT_LIB_CHECK([TINFO], [tinfo], [keypad], [curses.h]) + fi + +-AST_PKG_CONFIG_CHECK([LIBXML2], [libxml-2.0]) + AST_EXT_TOOL_CHECK([LIBXML2], [xml2-config], , , + [#include + #include ], diff --git a/net/asterisk/patches/170-time-add-support-for-time64-libcs.patch b/net/asterisk/patches/170-time-add-support-for-time64-libcs.patch deleted file mode 100644 index 6aa4354..0000000 --- a/net/asterisk/patches/170-time-add-support-for-time64-libcs.patch +++ /dev/null @@ -1,366 +0,0 @@ -From f50e793665ea66b5cea7c612cc95ca27bf45afb8 Mon Sep 17 00:00:00 2001 -From: Philip Prindeville -Date: Sun, 13 Feb 2022 12:06:37 -0700 -Subject: [PATCH] time: add support for time64 libcs - -Treat time_t's as entirely unique and use the POSIX API's for -converting to/from strings. - -Lastly, a 64-bit integer formats as 20 digits at most in base10. -Don't need to have any 100 byte buffers to hold that. - -ASTERISK-29674 #close - -Signed-off-by: Philip Prindeville -Change-Id: Id7b25bdca8f92e34229f6454f6c3e500f2cd6f56 ---- - include/asterisk/time.h | 20 ++++++++++++++++++++ - main/Makefile | 1 + - main/time.c | 29 +++++++++++++++++++++++++++++ - res/res_calendar_caldav.c | 4 ++-- - res/res_calendar_icalendar.c | 4 ++-- - res/res_http_media_cache.c | 7 ++++--- - res/res_odbc.c | 4 +++- - res/res_pjsip/location.c | 5 ++++- - res/res_pjsip/pjsip_options.c | 4 +++- - res/res_pjsip_history.c | 25 ++++++++++++++----------- - res/res_pjsip_pubsub.c | 6 +++++- - res/res_pjsip_registrar.c | 5 +++-- - res/res_stir_shaken.c | 6 ++++-- - 13 files changed, 94 insertions(+), 26 deletions(-) - ---- a/include/asterisk/time.h -+++ b/include/asterisk/time.h -@@ -35,6 +35,13 @@ - - #include "asterisk/inline_api.h" - -+/* A time_t can be represented as an unsigned long long (or uint64_t). -+ * Formatted in base 10, UINT64_MAX is 20 digits long, plus one for NUL. -+ * This should be the size of the receiving char buffer for calls to -+ * ast_time_t_to_string(). -+ */ -+#define AST_TIME_T_LEN 21 -+ - /* We have to let the compiler learn what types to use for the elements of a - struct timeval since on linux, it's time_t and suseconds_t, but on *BSD, - they are just a long. -@@ -316,4 +323,17 @@ struct timeval ast_time_create_by_unit(u - */ - struct timeval ast_time_create_by_unit_str(unsigned long val, const char *unit); - -+/*! -+ * \brief Converts to a string representation of a time_t as decimal -+ * seconds since the epoch. Returns -1 on failure, zero otherwise. -+ * -+ * The buffer should be at least 22 bytes long. -+ */ -+int ast_time_t_to_string(time_t time, char *buf, size_t length); -+ -+/*! -+ * \brief Returns a time_t from a string containing seconds since the epoch. -+ */ -+time_t ast_string_to_time_t(const char *str); -+ - #endif /* _ASTERISK_TIME_H */ ---- a/main/Makefile -+++ b/main/Makefile -@@ -169,6 +169,7 @@ sched.o: _ASTCFLAGS+=$(call get_menusele - tcptls.o: _ASTCFLAGS+=$(OPENSSL_INCLUDE) -Wno-deprecated-declarations - uuid.o: _ASTCFLAGS+=$(UUID_INCLUDE) - stasis.o: _ASTCFLAGS+=$(call get_menuselect_cflags,AO2_DEBUG) -+time.o: _ASTCFLAGS+=-D_XOPEN_SOURCE=700 - - - OBJS:=$(sort $(OBJS)) ---- a/main/time.c -+++ b/main/time.c -@@ -25,6 +25,7 @@ - - #include - #include -+#include - #include - - #include "asterisk/time.h" -@@ -143,3 +144,31 @@ struct timeval ast_time_create_by_unit_s - { - return ast_time_create_by_unit(val, ast_time_str_to_unit(unit)); - } -+ -+/*! -+ * \brief Returns a string representation of a time_t as decimal seconds -+ * since the epoch. -+ */ -+int ast_time_t_to_string(time_t time, char *buf, size_t length) -+{ -+ struct tm tm; -+ -+ localtime_r(&time, &tm); -+ return (strftime(buf, length, "%s", &tm) == 0) ? -1 : 0; -+} -+ -+/*! -+ * \brief Returns a time_t from a string containing seconds since the epoch. -+ */ -+time_t ast_string_to_time_t(const char *str) -+{ -+ struct tm tm = { 0, }; -+ -+ /* handle leading spaces */ -+ if (strptime(str, " %s", &tm) == NULL) { -+ return (time_t)-1; -+ } -+ tm.tm_isdst = -1; -+ return mktime(&tm); -+} -+ ---- a/res/res_calendar_caldav.c -+++ b/res/res_calendar_caldav.c -@@ -404,8 +404,8 @@ static void caldav_add_event(icalcompone - if (!ast_strlen_zero(event->summary)) { - ast_string_field_set(event, uid, event->summary); - } else { -- char tmp[100]; -- snprintf(tmp, sizeof(tmp), "%ld", event->start); -+ char tmp[AST_TIME_T_LEN]; -+ ast_time_t_to_string(event->start, tmp, sizeof(tmp)); - ast_string_field_set(event, uid, tmp); - } - } ---- a/res/res_calendar_icalendar.c -+++ b/res/res_calendar_icalendar.c -@@ -245,8 +245,8 @@ static void icalendar_add_event(icalcomp - if (!ast_strlen_zero(event->summary)) { - ast_string_field_set(event, uid, event->summary); - } else { -- char tmp[100]; -- snprintf(tmp, sizeof(tmp), "%ld", event->start); -+ char tmp[AST_TIME_T_LEN]; -+ ast_time_t_to_string(event->start, tmp, sizeof(tmp)); - ast_string_field_set(event, uid, tmp); - } - } ---- a/res/res_http_media_cache.c -+++ b/res/res_http_media_cache.c -@@ -116,7 +116,7 @@ static size_t curl_body_callback(void *p - static void bucket_file_set_expiration(struct ast_bucket_file *bucket_file) - { - struct ast_bucket_metadata *metadata; -- char time_buf[32]; -+ char time_buf[32], secs[AST_TIME_T_LEN]; - struct timeval actual_expires = ast_tvnow(); - - metadata = ast_bucket_file_metadata_get(bucket_file, "cache-control"); -@@ -150,7 +150,8 @@ static void bucket_file_set_expiration(s - } - - /* Use 'now' if we didn't get an expiration time */ -- snprintf(time_buf, sizeof(time_buf), "%30lu", actual_expires.tv_sec); -+ ast_time_t_to_string(actual_expires.tv_sec, secs, sizeof(secs)); -+ snprintf(time_buf, sizeof(time_buf), "%30s", secs); - - ast_bucket_file_metadata_set(bucket_file, "__actual_expires", time_buf); - } -@@ -314,7 +315,7 @@ static int bucket_file_expired(struct as - return 1; - } - -- if (sscanf(metadata->value, "%lu", &expires.tv_sec) != 1) { -+ if ((expires.tv_sec = ast_string_to_time_t(metadata->value)) == -1) { - return 1; - } - ---- a/res/res_odbc.c -+++ b/res/res_odbc.c -@@ -1029,7 +1029,9 @@ static odbc_status odbc_obj_connect(stru - /* Dont connect while server is marked as unreachable via negative_connection_cache */ - negative_cache_expiration = obj->parent->last_negative_connect.tv_sec + obj->parent->negative_connection_cache.tv_sec; - if (time(NULL) < negative_cache_expiration) { -- ast_log(LOG_WARNING, "Not connecting to %s. Negative connection cache for %ld seconds\n", obj->parent->name, negative_cache_expiration - time(NULL)); -+ char secs[AST_TIME_T_LEN]; -+ ast_time_t_to_string(negative_cache_expiration - time(NULL), secs, sizeof(secs)); -+ ast_log(LOG_WARNING, "Not connecting to %s. Negative connection cache for %s seconds\n", obj->parent->name, secs); - return ODBC_FAIL; - } - ---- a/res/res_pjsip/location.c -+++ b/res/res_pjsip/location.c -@@ -489,7 +489,10 @@ static int expiration_str2struct(const s - static int expiration_struct2str(const void *obj, const intptr_t *args, char **buf) - { - const struct ast_sip_contact *contact = obj; -- return (ast_asprintf(buf, "%ld", contact->expiration_time.tv_sec) < 0) ? -1 : 0; -+ char secs[AST_TIME_T_LEN]; -+ -+ ast_time_t_to_string(contact->expiration_time.tv_sec, secs, sizeof(secs)); -+ return (ast_asprintf(buf, "%s", secs) < 0) ? -1 : 0; - } - - static int permanent_uri_sort_fn(const void *obj_left, const void *obj_right, int flags) ---- a/res/res_pjsip/pjsip_options.c -+++ b/res/res_pjsip/pjsip_options.c -@@ -2722,6 +2722,7 @@ int ast_sip_format_contact_ami(void *obj - struct ast_sip_contact_status *status; - struct ast_str *buf; - const struct ast_sip_endpoint *endpoint = ami->arg; -+ char secs[AST_TIME_T_LEN]; - - buf = ast_sip_create_ami_event("ContactStatusDetail", ami); - if (!buf) { -@@ -2733,7 +2734,8 @@ int ast_sip_format_contact_ami(void *obj - ast_str_append(&buf, 0, "AOR: %s\r\n", wrapper->aor_id); - ast_str_append(&buf, 0, "URI: %s\r\n", contact->uri); - ast_str_append(&buf, 0, "UserAgent: %s\r\n", contact->user_agent); -- ast_str_append(&buf, 0, "RegExpire: %ld\r\n", contact->expiration_time.tv_sec); -+ ast_time_t_to_string(contact->expiration_time.tv_sec, secs, sizeof(secs)); -+ ast_str_append(&buf, 0, "RegExpire: %s\r\n", secs); - if (!ast_strlen_zero(contact->via_addr)) { - ast_str_append(&buf, 0, "ViaAddress: %s", contact->via_addr); - if (contact->via_port) { ---- a/res/res_pjsip_history.c -+++ b/res/res_pjsip_history.c -@@ -199,7 +199,7 @@ static int evaluate_equal(struct operato - { - struct timeval right = { 0, }; - -- if (sscanf(op_right->field, "%ld", &right.tv_sec) != 1) { -+ if ((right.tv_sec = ast_string_to_time_t(op_right->field)) == -1) { - ast_log(LOG_WARNING, "Unable to extract field '%s': not a timestamp\n", op_right->field); - return -1; - } -@@ -270,7 +270,7 @@ static int evaluate_less_than(struct ope - { - struct timeval right = { 0, }; - -- if (sscanf(op_right->field, "%ld", &right.tv_sec) != 1) { -+ if ((right.tv_sec = ast_string_to_time_t(op_right->field)) == -1) { - ast_log(LOG_WARNING, "Unable to extract field '%s': not a timestamp\n", op_right->field); - return -1; - } -@@ -319,7 +319,7 @@ static int evaluate_greater_than(struct - { - struct timeval right = { 0, }; - -- if (sscanf(op_right->field, "%ld", &right.tv_sec) != 1) { -+ if ((right.tv_sec = ast_string_to_time_t(op_right->field)) == -1) { - ast_log(LOG_WARNING, "Unable to extract field '%s': not a timestamp\n", op_right->field); - return -1; - } -@@ -656,7 +656,7 @@ static struct pjsip_history_entry *pjsip - /*! \brief Format single line history entry */ - static void sprint_list_entry(struct pjsip_history_entry *entry, char *line, int len) - { -- char addr[64]; -+ char addr[64], secs[AST_TIME_T_LEN]; - - if (entry->transmitted) { - pj_sockaddr_print(&entry->dst, addr, sizeof(addr), 3); -@@ -664,22 +664,24 @@ static void sprint_list_entry(struct pjs - pj_sockaddr_print(&entry->src, addr, sizeof(addr), 3); - } - -+ ast_time_t_to_string(entry->timestamp.tv_sec, secs, sizeof(secs)); -+ - if (entry->msg->type == PJSIP_REQUEST_MSG) { - char uri[128]; - - pjsip_uri_print(PJSIP_URI_IN_REQ_URI, entry->msg->line.req.uri, uri, sizeof(uri)); -- snprintf(line, len, "%-5.5d %-10.10ld %-5.5s %-24.24s %.*s %s SIP/2.0", -+ snprintf(line, len, "%-5.5d %-10.10s %-5.5s %-24.24s %.*s %s SIP/2.0", - entry->number, -- entry->timestamp.tv_sec, -+ secs, - entry->transmitted ? "* ==>" : "* <==", - addr, - (int)pj_strlen(&entry->msg->line.req.method.name), - pj_strbuf(&entry->msg->line.req.method.name), - uri); - } else { -- snprintf(line, len, "%-5.5d %-10.10ld %-5.5s %-24.24s SIP/2.0 %u %.*s", -+ snprintf(line, len, "%-5.5d %-10.10s %-5.5s %-24.24s SIP/2.0 %u %.*s", - entry->number, -- entry->timestamp.tv_sec, -+ secs, - entry->transmitted ? "* ==>" : "* <==", - addr, - entry->msg->line.status.code, -@@ -1149,7 +1151,7 @@ static struct vector_history_t *filter_h - /*! \brief Print a detailed view of a single entry in the history to the CLI */ - static void display_single_entry(struct ast_cli_args *a, struct pjsip_history_entry *entry) - { -- char addr[64]; -+ char addr[64], secs[AST_TIME_T_LEN]; - char *buf; - - buf = ast_calloc(1, PJSIP_MAX_PKT_LEN * sizeof(char)); -@@ -1169,11 +1171,12 @@ static void display_single_entry(struct - pj_sockaddr_print(&entry->src, addr, sizeof(addr), 3); - } - -- ast_cli(a->fd, "<--- History Entry %d %s %s at %-10.10ld --->\n", -+ ast_time_t_to_string(entry->timestamp.tv_sec, secs, sizeof(secs)); -+ ast_cli(a->fd, "<--- History Entry %d %s %s at %-10.10s --->\n", - entry->number, - entry->transmitted ? "Sent to" : "Received from", - addr, -- entry->timestamp.tv_sec); -+ secs); - ast_cli(a->fd, "%s\n", buf); - - ast_free(buf); ---- a/res/res_pjsip_pubsub.c -+++ b/res/res_pjsip_pubsub.c -@@ -4872,7 +4872,11 @@ static int persistence_expires_str2struc - static int persistence_expires_struct2str(const void *obj, const intptr_t *args, char **buf) - { - const struct subscription_persistence *persistence = obj; -- return (ast_asprintf(buf, "%ld", persistence->expires.tv_sec) < 0) ? -1 : 0; -+ char secs[AST_TIME_T_LEN]; -+ -+ ast_time_t_to_string(persistence->expires.tv_sec, secs, sizeof(secs)); -+ -+ return (ast_asprintf(buf, "%s", secs) < 0) ? -1 : 0; - } - - #define RESOURCE_LIST_INIT_SIZE 4 ---- a/res/res_pjsip_registrar.c -+++ b/res/res_pjsip_registrar.c -@@ -1365,12 +1365,13 @@ static void *check_expiration_thread(voi - { - struct ao2_container *contacts; - struct ast_variable *var; -- char *time = alloca(64); -+ char time[AST_TIME_T_LEN]; - - while (check_interval) { - sleep(check_interval); - -- sprintf(time, "%ld", ast_tvnow().tv_sec); -+ ast_time_t_to_string(ast_tvnow().tv_sec, time, sizeof(time)); -+ - var = ast_variable_new("expiration_time <=", time, ""); - - ast_debug(4, "Woke up at %s Interval: %d\n", time, check_interval); ---- a/res/res_stir_shaken.c -+++ b/res/res_stir_shaken.c -@@ -403,7 +403,7 @@ int ast_stir_shaken_add_verification(str - */ - static void set_public_key_expiration(const char *public_cert_url, const struct curl_cb_data *data) - { -- char time_buf[32]; -+ char time_buf[32], secs[AST_TIME_T_LEN]; - char *value; - struct timeval actual_expires = ast_tvnow(); - char hash[41]; -@@ -441,7 +441,9 @@ static void set_public_key_expiration(co - actual_expires.tv_sec += EXPIRATION_BUFFER; - } - -- snprintf(time_buf, sizeof(time_buf), "%30lu", actual_expires.tv_sec); -+ ast_time_t_to_string(actual_expires.tv_sec, secs, sizeof(secs)); -+ -+ snprintf(time_buf, sizeof(time_buf), "%30s", secs); - - ast_db_put(hash, "expiration", time_buf); - } diff --git a/net/asterisk/patches/180_build-fix-bininstall-launchd-issue-on-cross-platfrom.patch b/net/asterisk/patches/180_build-fix-bininstall-launchd-issue-on-cross-platfrom.patch deleted file mode 100644 index cebaee6..0000000 --- a/net/asterisk/patches/180_build-fix-bininstall-launchd-issue-on-cross-platfrom.patch +++ /dev/null @@ -1,55 +0,0 @@ -From: https://issues.asterisk.org/jira/browse/ASTERISK-29905 - -From d27d75ad8058f6ed35197737b949bac57202dd54 Mon Sep 17 00:00:00 2001 -From: "Sergey V. Lobanov" -Date: Wed, 9 Feb 2022 01:29:46 +0300 -Subject: [PATCH] build: fix bininstall launchd issue on cross-platfrom build - -configure script detects /sbin/launchd, but the result of this -check is not used in Makefile (bininstall). Makefile also detects -/sbin/launchd file to decide if it is required to install -safe_asterisk. - -configure script correctly detects cross compile build and sets -PBX_LAUNCHD=0 - -In case of building asterisk on MacOS host for Linux target using -external toolchain (e.g. OpenWrt toolchain), bininstall does not -install safe_asterisk (due to /sbin/launchd detection in Makefile), -but it is required on target (Linux). - -This patch adds HAVE_SBIN_LAUNCHD=@PBX_LAUNCHD@ to makeopts.in to -use the result of /sbin/launchd detection from configure script in -Makefile. -Also this patch uses HAVE_SBIN_LAUNCHD in Makefile (bininstall) to -decide if it is required to install safe_asterisk. - -Signed-off-by: Sergey V. Lobanov ---- - Makefile | 6 +++--- - makeopts.in | 2 ++ - 2 files changed, 5 insertions(+), 3 deletions(-) - ---- a/Makefile -+++ b/Makefile -@@ -558,9 +558,9 @@ bininstall: _all installdirs $(SUBDIRS_I - $(INSTALL) -m 755 contrib/scripts/astversion "$(DESTDIR)$(ASTSBINDIR)/" - $(INSTALL) -m 755 contrib/scripts/astgenkey "$(DESTDIR)$(ASTSBINDIR)/" - $(INSTALL) -m 755 contrib/scripts/autosupport "$(DESTDIR)$(ASTSBINDIR)/" -- if [ ! -f /sbin/launchd ]; then \ -- ./build_tools/install_subst contrib/scripts/safe_asterisk "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk"; \ -- fi -+ifneq ($(HAVE_SBIN_LAUNCHD),1) -+ ./build_tools/install_subst contrib/scripts/safe_asterisk "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk"; -+endif - - ifneq ($(DISABLE_XMLDOC),yes) - $(INSTALL) -m 644 doc/core-*.xml "$(DESTDIR)$(ASTDATADIR)/documentation" ---- a/makeopts.in -+++ b/makeopts.in -@@ -373,3 +373,5 @@ SNDFILE_LIB=@SNDFILE_LIB@ - - BEANSTALK_INCLUDE=@BEANSTALK_INCLUDE@ - BEANSTALK_LIB=@BEANSTALK_LIB@ -+ -+HAVE_SBIN_LAUNCHD=@PBX_LAUNCHD@ diff --git a/net/asterisk/patches/190-logger-workaround-woefully-small-BUFSIZ-in-MUSL.patch b/net/asterisk/patches/190-logger-workaround-woefully-small-BUFSIZ-in-MUSL.patch deleted file mode 100644 index f99da90..0000000 --- a/net/asterisk/patches/190-logger-workaround-woefully-small-BUFSIZ-in-MUSL.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 140c19c2067a5e2dcedfbb4dfa08c57758b822cb Mon Sep 17 00:00:00 2001 -From: Philip Prindeville -Date: Mon, 21 Feb 2022 18:05:49 -0700 -Subject: [PATCH] logger: workaround woefully small BUFSIZ in MUSL - -MUSL defines BUFSIZ as 1024 which is not reasonable for log messages. - -More broadly, BUFSIZ is the amount of buffering stdio.h does, which -is arbitrary and largely orthogonal to what logging should accept -as the maximum message size. - -ASTERISK-29928 - -Signed-off-by: Philip Prindeville -Change-Id: Iaa49fbbab029c64ae3d95e4b18270e0442cce170 ---- - main/logger.c | 15 ++++++++++----- - 1 file changed, 10 insertions(+), 5 deletions(-) - ---- a/main/logger.c -+++ b/main/logger.c -@@ -97,6 +97,11 @@ static int logger_queue_limit = 1000; - static int logger_messages_discarded; - static unsigned int high_water_alert; - -+/* On some platforms, like those with MUSL as the runtime, BUFSIZ is -+ * unreasonably small (1024). Use a larger value in those environments. -+ */ -+#define LOGMSG_SIZE MAX(BUFSIZ, 8192) -+ - static enum rotatestrategy { - NONE = 0, /* Do not rotate log files at all, instead rely on external mechanisms */ - SEQUENTIAL = 1 << 0, /* Original method - create a new file, in order */ -@@ -1665,7 +1670,7 @@ static struct sigaction handle_SIGXFSZ = - static void logger_print_normal(struct logmsg *logmsg) - { - struct logchannel *chan = NULL; -- char buf[BUFSIZ]; -+ char buf[LOGMSG_SIZE]; - int level = 0; - - AST_RWLIST_RDLOCK(&logchannels); -@@ -1698,13 +1703,13 @@ static void logger_print_normal(struct l - - /* Don't use LOG_MAKEPRI because it's broken in glibc<2.17 */ - syslog_level = chan->facility | syslog_level; /* LOG_MAKEPRI(chan->facility, syslog_level); */ -- if (!chan->formatter.format_log(chan, logmsg, buf, BUFSIZ)) { -+ if (!chan->formatter.format_log(chan, logmsg, buf, sizeof(buf))) { - syslog(syslog_level, "%s", buf); - } - } - break; - case LOGTYPE_CONSOLE: -- if (!chan->formatter.format_log(chan, logmsg, buf, BUFSIZ)) { -+ if (!chan->formatter.format_log(chan, logmsg, buf, sizeof(buf))) { - ast_console_puts_mutable_full(buf, logmsg->level, logmsg->sublevel); - } - break; -@@ -1716,7 +1721,7 @@ static void logger_print_normal(struct l - continue; - } - -- if (chan->formatter.format_log(chan, logmsg, buf, BUFSIZ)) { -+ if (chan->formatter.format_log(chan, logmsg, buf, sizeof(buf))) { - continue; - } - -@@ -1780,7 +1785,7 @@ static struct logmsg * __attribute__((fo - } - - /* Build string */ -- res = ast_str_set_va(&buf, BUFSIZ, fmt, ap); -+ res = ast_str_set_va(&buf, LOGMSG_SIZE, fmt, ap); - - /* If the build failed, then abort and free this structure */ - if (res == AST_DYNSTR_BUILD_FAILED) {