From 8e0055e03f5eca02efecca369fdc70cf1304f1e6 Mon Sep 17 00:00:00 2001 From: guidosarducci Date: Sun, 18 Jun 2017 16:04:15 -0700 Subject: [PATCH 01/13] siproxd: use standard interface names by default Support using standard interface names and make "lan"/"wan" the defaults for inbound/outbound SIP traffic. This change makes siproxd more portable but preserves backwards compatibility for upgrades. Signed-off-by: Tony Ambardar --- net/siproxd/files/siproxd.config | 4 ++-- net/siproxd/files/siproxd.init | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/net/siproxd/files/siproxd.config b/net/siproxd/files/siproxd.config index b65148c..be953eb 100644 --- a/net/siproxd/files/siproxd.config +++ b/net/siproxd/files/siproxd.config @@ -1,3 +1,3 @@ config siproxd general - option if_inbound lan - option if_outbound wan + option interface_inbound lan + option interface_outbound wan diff --git a/net/siproxd/files/siproxd.init b/net/siproxd/files/siproxd.init index 1ad6e0f..0dbdeb0 100644 --- a/net/siproxd/files/siproxd.init +++ b/net/siproxd/files/siproxd.init @@ -18,9 +18,22 @@ deal_with_lists () { start_instance() { local cfg="$1" + local _int_inbound + local _int_outbound + local _dev_inbound + local _dev_outbound + + config_get _int_inbound "$cfg" interface_inbound + config_get _int_outbound "$cfg" interface_outbound + + scan_interfaces + network_get_physdev _dev_inbound $_int_inbound + network_get_physdev _dev_outbound $_int_outbound + + config_load 'siproxd' + config_get if_inbound "$cfg" if_inbound $_dev_inbound + config_get if_outbound "$cfg" if_outbound $_dev_outbound - config_get if_inbound "$cfg" if_inbound - config_get if_outbound "$cfg" if_outbound config_get host_outbound "$cfg" host_outbound config_get hosts_allow_reg "$cfg" hosts_allow_reg config_get hosts_allow_sip "$cfg" hosts_allow_sip @@ -225,6 +238,8 @@ start() { chown nobody:nogroup "$siproxd_pid_dir" } + include /lib/network + . /lib/functions/network.sh config_load 'siproxd' config_foreach start_instance 'siproxd' } From 82ce0817b52039c0ee7357dc8f0c7cf88d640888 Mon Sep 17 00:00:00 2001 From: guidosarducci Date: Sun, 18 Jun 2017 16:35:21 -0700 Subject: [PATCH 02/13] siproxd: use reasonable logging level by default The previous default logging level is completely silent, making normal monitoring or troubleshooting impossible. Use the sane upstream default for logging which captures basic startup, shutdown and error messages. Signed-off-by: Tony Ambardar --- net/siproxd/files/siproxd.init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/siproxd/files/siproxd.init b/net/siproxd/files/siproxd.init index 0dbdeb0..46c0119 100644 --- a/net/siproxd/files/siproxd.init +++ b/net/siproxd/files/siproxd.init @@ -40,7 +40,7 @@ start_instance() { config_get hosts_deny_sip "$cfg" hosts_deny_sip config_get sip_listen_port "$cfg" sip_listen_port 5060 config_get_bool daemonize "$cfg" daemonize 1 - config_get silence_log "$cfg" silence_log 4 + config_get silence_log "$cfg" silence_log 1 config_get user "$cfg" user nobody config_get chrootjail "$cfg" chrootjail config_get registration_file "$cfg" registration_file "$siproxd_registration_dir/siproxd_registrations-$cfg" From 9ff846270246e07602afab708eb9819b8d984f8d Mon Sep 17 00:00:00 2001 From: guidosarducci Date: Sun, 18 Jun 2017 16:53:21 -0700 Subject: [PATCH 03/13] siproxd: clean up directory permissions, ownership Signed-off-by: Tony Ambardar --- net/siproxd/files/siproxd.init | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/net/siproxd/files/siproxd.init b/net/siproxd/files/siproxd.init index 46c0119..b175598 100644 --- a/net/siproxd/files/siproxd.init +++ b/net/siproxd/files/siproxd.init @@ -230,13 +230,16 @@ stop_instance() { } start() { - mkdir -m 0755 -p "$siproxd_conf_dir" - mkdir -m 0755 -p "$siproxd_registration_dir" - [ -d "$siproxd_pid_dir" ] || { - mkdir -m 0755 -p "$siproxd_pid_dir" - chmod 0750 "$siproxd_pid_dir" - chown nobody:nogroup "$siproxd_pid_dir" - } + mkdir -p "$siproxd_conf_dir" + chmod 755 "$siproxd_conf_dir" + + mkdir -p "$siproxd_registration_dir" + chmod 700 "$siproxd_registration_dir" + chown nobody:nogroup "$siproxd_registration_dir" + + mkdir -p "$siproxd_pid_dir" + chmod 700 "$siproxd_pid_dir" + chown nobody:nogroup "$siproxd_pid_dir" include /lib/network . /lib/functions/network.sh From 00a66d16fa2523b2af0caed8fa826d695c11193f Mon Sep 17 00:00:00 2001 From: guidosarducci Date: Sun, 18 Jun 2017 18:55:19 -0700 Subject: [PATCH 04/13] siproxd: add shell helper function to build config file Using the append_conf_if_set() function removes much repetitive and error-prone code, reduces the source size by ~30%, and fixes a typo previously uncaught. Signed-off-by: Tony Ambardar --- net/siproxd/files/siproxd.init | 158 ++++++++++++--------------------- 1 file changed, 58 insertions(+), 100 deletions(-) diff --git a/net/siproxd/files/siproxd.init b/net/siproxd/files/siproxd.init index b175598..a5d2850 100644 --- a/net/siproxd/files/siproxd.init +++ b/net/siproxd/files/siproxd.init @@ -12,6 +12,12 @@ siproxd_conf_prefix="$siproxd_conf_dir/siproxd-" siproxd_registration_dir="/var/lib/siproxd" siproxd_pid_dir="/var/run/siproxd" +append_conf_if_set() { + local _val=$(eval "echo \$`echo $1`") + [ -n "$_val" ] && + echo "$1" = "$_val" >> "$siproxd_conf_prefix$cfg" +} + deal_with_lists () { echo "$2" = "$1" >> "$siproxd_conf_prefix$cfg" } @@ -76,140 +82,92 @@ start_instance() { if [ -f "$siproxd_conf_prefix$cfg" ]; then rm "$siproxd_conf_prefix$cfg" fi - if [ -n "$if_inbound" ]; then - echo if_inbound = "$if_inbound" >> "$siproxd_conf_prefix$cfg" - fi - if [ -n "$if_outbound" ]; then - echo if_outbound = "$if_outbound" >> "$siproxd_conf_prefix$cfg" - fi - if [ -n "$host_outbound" ]; then - echo host_outbound = "$host_outbound" >> "$siproxd_conf_prefix$cfg" - fi - if [ -n "$hosts_allow_reg" ]; then - echo hosts_allow_reg = "$hosts_allow_reg" >> "$siproxd_conf_prefix$cfg" - fi - if [ -n "$hosts_allow_sip" ]; then - echo hosts_allow_sip = "$hosts_allow_sip" >> "$siproxd_conf_prefix$cfg" - fi - if [ -n "$hosts_deny_sip" ]; then - echo hosts_deny_sip = "$hosts_deny_sip" >> "$siproxd_conf_prefix$cfg" - fi - echo sip_listen_port = "$sip_listen_port" >> "$siproxd_conf_prefix$cfg" - echo daemonize = "$daemonize" >> "$siproxd_conf_prefix$cfg" - echo silence_log = "$silence_log" >> "$siproxd_conf_prefix$cfg" - echo user = "$user" >> "$siproxd_conf_prefix$cfg" + echo "# auto-generated config file from /etc/config/siproxd" > "$siproxd_conf_prefix$cfg" + + append_conf_if_set if_inbound + append_conf_if_set if_outbound + append_conf_if_set host_outbound + append_conf_if_set hosts_allow_reg + append_conf_if_set hosts_allow_sip + append_conf_if_set hosts_deny_sip + append_conf_if_set sip_listen_port + append_conf_if_set daemonize + append_conf_if_set silence_log + append_conf_if_set user if [ -n "$chrootjail" ]; then if [ ! -d "$chrootjail" ]; then mkdir -p "$chrootjail" chmod 0755 "$chrootjail" fi - echo chrootjail = "$chrootjail" >> "$siproxd_conf_prefix$cfg" + append_conf_if_set chrootjail fi - echo registration_file = "$registration_file" >> "$siproxd_conf_prefix$cfg" - echo autosave_registrations = "$autosave_registrations" >> "$siproxd_conf_prefix$cfg" + append_conf_if_set registration_file + append_conf_if_set autosave_registrations - echo pid_file = "$pid_file" >> "$siproxd_conf_prefix$cfg" - echo rtp_proxy_enable = "$rtp_proxy_enable" >> "$siproxd_conf_prefix$cfg" - echo rtp_port_low = "$rtp_port_low" >> "$siproxd_conf_prefix$cfg" - echo rtp_port_high = "$rtp_port_high" >> "$siproxd_conf_prefix$cfg" - echo rtp_timeout = "$rtp_timeout" >> "$siproxd_conf_prefix$cfg" - echo rtp_dscp = "$rtp_dscp" >> "$siproxd_conf_prefix$cfg" - echo sip_dscp = "$sip_dscp" >> "$siproxd_conf_prefix$cfg" - echo rtp_input_dejitter = "$rtp_input_dejitter" >> "$siproxd_conf_prefix$cfg" - echo rtp_output_dejitter = "$rtp_output_dejitter" >> "$siproxd_conf_prefix$cfg" - echo tcp_timeout = "$tcp_timeout" >> "$siproxd_conf_prefix$cfg" - echo tcp_connect_timeout = "$tcp_connect_timeout" >> "$siproxd_conf_prefix$cfg" - echo tcp_keepalive = "$tcp_keepalive" >> "$siproxd_conf_prefix$cfg" - echo default_expires = "$default_expires" >> "$siproxd_conf_prefix$cfg" - if [ -n "$proxy_auth_realm" ]; then - echo proxy_auth_realm = "$proxy_auth_realm" >> "$siproxd_conf_prefix$cfg" - fi - if [ -n "$proxy_auth_passwd" ]; then - echo proxy_auth_passwd = "$proxy_auth_passwd" >> "$siproxd_conf_prefix$cfg" - fi - if [ -n "$proxy_auth_pwfile" ]; then - echo proxy_auth_pwfile = "$proxy_auth_pwfile" >> "$siproxd_conf_prefix$cfg" - fi - echo debug_level = "$debug_level" >> "$siproxd_conf_prefix$cfg" - echo debug_port = "$debug_port" >> "$siproxd_conf_prefix$cfg" - if [ -n "$mask_host" ]; then - echo mask_host = "$mask_host" >> "$siproxd_conf_prefix$cfg" - fi - if [ -n "$masked_host" ]; then - echo masked_host = "$masked_host" >> "$siproxd_conf_prefix$cfg" - fi - echo ua_string = "$ua_string" >> "$siproxd_conf_prefix$cfg" - echo use_rport = "$use_rport" >> "$siproxd_conf_prefix$cfg" - if [ -n "$outbound_proxy_host" ]; then - echo outbound_proxy_host = "$outbound_proxy_host" >> "$siproxd_conf_prefix$cfg" - fi - if [ -n "$outbound_proxy_port" ]; then - echo outbound_proxy_port = "$outbound_proxy_port" >> "$siproxd_conf_prefix$cfg" - fi - if [ -n "$outbound_domain_name" ]; then - echo outbound_domain_name = "$outbound_domain_name" >> "$siproxd_conf_prefix$cfg" - fi - if [ -n "$outbound_domain_host" ]; then - echo outbound_domain_host = "$outbound_domain_host" >> "$siproxd_conf_prefix$cfg" - fi - if [ -n "$outbound_domain_port" ]; then - echo outbound_domain_port = "$outbound_domain_port" >> "$siproxd_conf_prefix$cfg" - fi + append_conf_if_set pid_file + append_conf_if_set rtp_proxy_enable + append_conf_if_set rtp_port_low + append_conf_if_set rtp_port_high + append_conf_if_set rtp_timeout + append_conf_if_set rtp_dscp + append_conf_if_set sip_dscp + append_conf_if_set rtp_input_dejitter + append_conf_if_set rtp_output_dejitter + append_conf_if_set tcp_timeout + append_conf_if_set tcp_connect_timeout + append_conf_if_set tcp_keepalive + append_conf_if_set default_expires + append_conf_if_set proxy_auth_realm + append_conf_if_set proxy_auth_passwd + append_conf_if_set proxy_auth_pwfile + append_conf_if_set debug_level + append_conf_if_set debug_port + append_conf_if_set mask_host + append_conf_if_set masked_host + append_conf_if_set ua_string + append_conf_if_set use_rport + append_conf_if_set outbound_proxy_host + append_conf_if_set outbound_proxy_port + append_conf_if_set outbound_domain_name + append_conf_if_set outbound_domain_host + append_conf_if_set outbound_domain_port # handle plugins config_get plugindir "$cfg" plugindir "/usr/lib/siproxd/" - echo plugindir = "$plugindir" >> "$siproxd_conf_prefix$cfg" + append_conf_if_set plugindir config_list_foreach "$cfg" 'load_plugin' deal_with_lists "load_plugin" # plugin_demo.so config_get plugin_demo_string "$cfg" plugin_demo_string - if [ -n "$plugin_demo_string" ]; then - echo plugin_demo_string = "$plugin_demo_string" >> "$siproxd_conf_prefix$cfg" - fi + append_conf_if_set plugin_demo_string # plugin_shortdial.so config_get plugin_shortdial_akey "$cfg" plugin_shortdial_akey - if [ -n "$plugin_shortdial_akey" ]; then - echo plugin_shortdial_akey = "$plugin_shortdial_akey" >> "$siproxd_conf_prefix$cfg" - fi + append_conf_if_set plugin_shortdial_akey config_list_foreach "$cfg" 'plugin_shortdial_entry' deal_with_lists "plugin_shortdial_entry" # plugin_defaulttarget.so config_get_bool plugin_defaulttarget_log "$cfg" plugin_defaulttarget_log - if [ -n "$plugin_defaulttarget_log" ]; then - echo plugin_defaulttarget_log = "$plugin_defaulttarget_log" >> "$siproxd_conf_prefix$cfg" - fi + append_conf_if_set plugin_defaulttarget_log config_get plugin_defaulttarget_target "$cfg" plugin_defaulttarget_target - if [ -n "$plugin_defaulttarget_target" ]; then - echo plugin_defaulttarget_target = "$plugin_defaulttarget_target" >> "$siproxd_conf_prefix$cfg" - fi + append_conf_if_set plugin_defaulttarget_target # plugin_fix_bogus_via.so config_get plugin_fix_bogus_via_networks "$cfg" plugin_fix_bogus_via_networks - if [ -n "$plugin_fix_bogus_via_networks" ]; then - echo plugin_fix_bogus_via_networks = "$plugin_fix_bogus_via_networks" >> "$siproxd_conf_prefix$cfg" - fi + append_conf_if_set plugin_fix_bogus_via_networks # plugin_stun.so config_get plugin_stun_server "$cfg" plugin_stun_server - if [ -n "$plugin_stun_server" ]; then - echo plugin_stun_server = "$plugin_stun_server" >> "$siproxd_conf_prefix$cfg" - fi + append_conf_if_set plugin_stun_server config_get plugin_stun_port "$cfg" plugin_stun_port - if [ -n "$plugin_stun_port" ]; then - echo plugin_stun_port = "$plugin_stun_port" >> "$siproxd_conf_prefix$cfg" - fi + append_conf_if_set plugin_stun_port config_get plugin_stun_period "$cfg" plugin_stun_period - if [ -n "$plugin_stun_period" ]; then - echo plugin_stun_period = "$plugin_stun_period" >> "$siproxd_conf_prefix$cfg" - fi + append_conf_if_set plugin_stun_period # plugin_prefix.so config_get plugin_prefix_akey "$cfg" plugin_prefix_akey - if [ -n "$plugin_prefix_akey" ]; then - echo plugin_prefix_akey = "$plugin_prefix_akey" >> "$siproxd_conf_prefix$cfg" - fi + append_conf_if_set plugin_prefix_akey # plugin_regex.so config_list_foreach "$cfg" 'plugin_regex_desc' deal_with_lists "plugin_regex_desc" From 9863ac939c9c996592c030e47700b8c65b45e1ec Mon Sep 17 00:00:00 2001 From: guidosarducci Date: Sun, 18 Jun 2017 19:21:57 -0700 Subject: [PATCH 05/13] siproxd: use clearer runtime file and directory names Use more conventional, clearer naming for config and registration files. This includes having distinct directories and specific file suffixes. Signed-off-by: Tony Ambardar --- net/siproxd/files/siproxd.init | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/net/siproxd/files/siproxd.init b/net/siproxd/files/siproxd.init index a5d2850..da7859c 100644 --- a/net/siproxd/files/siproxd.init +++ b/net/siproxd/files/siproxd.init @@ -7,19 +7,20 @@ START=50 SERVICE_USE_PID=1 siproxd_bin="/usr/sbin/siproxd" -siproxd_conf_dir="/var/etc" +siproxd_conf_dir="/var/etc/siproxd" siproxd_conf_prefix="$siproxd_conf_dir/siproxd-" siproxd_registration_dir="/var/lib/siproxd" +siproxd_registration_prefix="$siproxd_registration_dir/siproxd-" siproxd_pid_dir="/var/run/siproxd" append_conf_if_set() { local _val=$(eval "echo \$`echo $1`") [ -n "$_val" ] && - echo "$1" = "$_val" >> "$siproxd_conf_prefix$cfg" + echo "$1" = "$_val" >> "$siproxd_conf_prefix$cfg.conf" } deal_with_lists () { - echo "$2" = "$1" >> "$siproxd_conf_prefix$cfg" + echo "$2" = "$1" >> "$siproxd_conf_prefix$cfg.conf" } start_instance() { @@ -49,7 +50,7 @@ start_instance() { config_get silence_log "$cfg" silence_log 1 config_get user "$cfg" user nobody config_get chrootjail "$cfg" chrootjail - config_get registration_file "$cfg" registration_file "$siproxd_registration_dir/siproxd_registrations-$cfg" + config_get registration_file "$cfg" registration_file "$siproxd_registration_prefix$cfg.reg" config_get autosave_registrations "$cfg" autosave_registrations 300 config_get pid_file "$cfg" pid_file "$siproxd_pid_dir/siproxd-$cfg.pid" config_get_bool rtp_proxy_enable "$cfg" rtp_proxy_enable 1 @@ -79,10 +80,10 @@ start_instance() { config_get outbound_domain_host "$cfg" outbound_domain_host config_get outbound_domain_port "$cfg" outbound_domain_port - if [ -f "$siproxd_conf_prefix$cfg" ]; then - rm "$siproxd_conf_prefix$cfg" + if [ -f "$siproxd_conf_prefix$cfg.conf" ]; then + rm "$siproxd_conf_prefix$cfg.conf" fi - echo "# auto-generated config file from /etc/config/siproxd" > "$siproxd_conf_prefix$cfg" + echo "# auto-generated config file from /etc/config/siproxd" > "$siproxd_conf_prefix$cfg.conf" append_conf_if_set if_inbound append_conf_if_set if_outbound @@ -175,7 +176,7 @@ start_instance() { config_list_foreach "$cfg" 'plugin_regex_replace' deal_with_lists "plugin_regex_replace" SERVICE_PID_FILE="$pid_file" \ - service_start $siproxd_bin --config "$siproxd_conf_prefix$cfg" + service_start $siproxd_bin --config "$siproxd_conf_prefix$cfg.conf" } stop_instance() { From 61923739e0cc3d1ea9bfd5732fa374f6294e7f75 Mon Sep 17 00:00:00 2001 From: guidosarducci Date: Sun, 18 Jun 2017 20:37:16 -0700 Subject: [PATCH 06/13] siproxd: update to version 0.8.2 An upstream siproxd update was released after ~5 years, with bugfixes and new features. This package supports the new plugins and their config options, and updates required patches. Signed-off-by: Tony Ambardar --- net/siproxd/Makefile | 11 +++++--- net/siproxd/files/siproxd.init | 19 ++++++++++++++ .../010-fix-bogus-libltdl-dependency.patch | 8 +++--- .../patches/011-include-sys-time.patch | 10 ------- net/siproxd/patches/100-musl-compat.patch | 26 +++---------------- 5 files changed, 35 insertions(+), 39 deletions(-) delete mode 100644 net/siproxd/patches/011-include-sys-time.patch diff --git a/net/siproxd/Makefile b/net/siproxd/Makefile index a2d58a8..66d9130 100644 --- a/net/siproxd/Makefile +++ b/net/siproxd/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=siproxd -PKG_VERSION:=0.8.1 -PKG_RELEASE:=5 +PKG_VERSION:=0.8.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/siproxd -PKG_MD5SUM:=1a6f9d13aeb2d650375c9a346ac6cbaf +PKG_MD5SUM:=e3ec83f66ac880717c98512d89613f42 PKG_FIXUP:=autoreconf PKG_INSTALL:=1 @@ -79,11 +79,16 @@ define BuildPlugin endef $(eval $(call BuildPackage,siproxd)) +$(eval $(call BuildPlugin,codecfilter)) $(eval $(call BuildPlugin,defaulttarget)) $(eval $(call BuildPlugin,demo)) $(eval $(call BuildPlugin,fix_bogus_via)) +$(eval $(call BuildPlugin,fix_DTAG)) +$(eval $(call BuildPlugin,fix_fbox_anoncall)) $(eval $(call BuildPlugin,logcall)) $(eval $(call BuildPlugin,prefix)) $(eval $(call BuildPlugin,regex)) $(eval $(call BuildPlugin,shortdial)) +$(eval $(call BuildPlugin,stripheader)) $(eval $(call BuildPlugin,stun)) +$(eval $(call BuildPlugin,siptrunk)) diff --git a/net/siproxd/files/siproxd.init b/net/siproxd/files/siproxd.init index da7859c..5054f3c 100644 --- a/net/siproxd/files/siproxd.init +++ b/net/siproxd/files/siproxd.init @@ -175,6 +175,25 @@ start_instance() { config_list_foreach "$cfg" 'plugin_regex_pattern' deal_with_lists "plugin_regex_pattern" config_list_foreach "$cfg" 'plugin_regex_replace' deal_with_lists "plugin_regex_replace" + # plugin_stripheader.so + config_list_foreach "$cfg" 'plugin_stripheader_remove' deal_with_lists "plugin_stripheader_remove" + + # plugin_codecfilter.so + config_list_foreach "$cfg" 'plugin_codecfilter_blacklist' deal_with_lists "plugin_codecfilter_blacklist" + + # plugin_siptrunk.so + config_list_foreach "$cfg" 'plugin_siptrunk_name' deal_with_lists "plugin_siptrunk_name" + config_list_foreach "$cfg" 'plugin_siptrunk_account' deal_with_lists "plugin_siptrunk_account" + config_list_foreach "$cfg" 'plugin_siptrunk_numbers_regex' deal_with_lists "plugin_siptrunk_numbers_regex" + + # plugin_fix_DTAG.so + config_get plugin_fix_DTAG_networks "$cfg" plugin_fix_DTAG_networks + append_conf_if_set plugin_fix_DTAG_networks + + # plugin_fix_fbox_anoncall.so + config_get plugin_fix_fbox_anoncall_networks "$cfg" plugin_fix_fbox_anoncall_networks + append_conf_if_set plugin_fix_fbox_anoncall_networks + SERVICE_PID_FILE="$pid_file" \ service_start $siproxd_bin --config "$siproxd_conf_prefix$cfg.conf" } diff --git a/net/siproxd/patches/010-fix-bogus-libltdl-dependency.patch b/net/siproxd/patches/010-fix-bogus-libltdl-dependency.patch index 20f3b6b..d457eb4 100644 --- a/net/siproxd/patches/010-fix-bogus-libltdl-dependency.patch +++ b/net/siproxd/patches/010-fix-bogus-libltdl-dependency.patch @@ -1,6 +1,6 @@ --- a/src/Makefile.am +++ b/src/Makefile.am -@@ -77,8 +77,8 @@ plugin_regex_la_LDFLAGS = -module -avoid +@@ -103,8 +103,8 @@ # else Cygwin goes beserk when building...) # sbin_PROGRAMS = siproxd @@ -13,10 +13,10 @@ rtpproxy_relay.c accessctl.c route_processing.c \ --- a/src/Makefile.in +++ b/src/Makefile.in -@@ -326,8 +326,8 @@ plugin_prefix_la_LDFLAGS = -module -avoi +@@ -377,8 +377,8 @@ # - plugin_regex_la_SOURCES = plugin_regex.c - plugin_regex_la_LDFLAGS = -module -avoid-version -shrext '.so' + plugin_fix_fbox_anoncall_la_SOURCES = plugin_fix_fbox_anoncall.c + plugin_fix_fbox_anoncall_la_LDFLAGS = -module -avoid-version -shrext '.so' -siproxd_LDFLAGS = -export-dynamic -siproxd_LDADD = $(LIBLTDL) $(DLOPENPLUGINS) +siproxd_LDFLAGS = -export-dynamic -lltdl diff --git a/net/siproxd/patches/011-include-sys-time.patch b/net/siproxd/patches/011-include-sys-time.patch deleted file mode 100644 index 81fabda..0000000 --- a/net/siproxd/patches/011-include-sys-time.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- siproxd-0.8.1/src/dejitter.c -+++ siproxd-0.8.1/src/dejitter.c -@@ -24,6 +24,7 @@ - - #include - #include -+#include - #include - - #include diff --git a/net/siproxd/patches/100-musl-compat.patch b/net/siproxd/patches/100-musl-compat.patch index 5e0c1da..8d7bf8e 100644 --- a/net/siproxd/patches/100-musl-compat.patch +++ b/net/siproxd/patches/100-musl-compat.patch @@ -1,31 +1,13 @@ --- a/src/resolve.c +++ b/src/resolve.c -@@ -30,6 +30,7 @@ +@@ -28,8 +28,10 @@ + #include + #endif ++#include #include #include +#include #include "log.h" ---- a/src/dejitter.c -+++ b/src/dejitter.c -@@ -21,6 +21,7 @@ - #include "config.h" - - #include -+#include - - #include - #include ---- a/src/plugins.c -+++ b/src/plugins.c -@@ -20,6 +20,8 @@ - - #include "config.h" - -+#include -+ - #include - #include - #include From afb87c66bb05634b446950461b2ca7a5a71ab62b Mon Sep 17 00:00:00 2001 From: guidosarducci Date: Sun, 2 Jul 2017 19:56:53 -0700 Subject: [PATCH 07/13] siproxd: fix support for domain-specific proxies Use lists for the config entries outbound_domain_{name,host,port}. This permits multiple outbound proxies and fixes: https://github.com/openwrt/telephony/issues/127 Signed-off-by: Tony Ambardar --- net/siproxd/files/siproxd.init | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/net/siproxd/files/siproxd.init b/net/siproxd/files/siproxd.init index 5054f3c..d122ad1 100644 --- a/net/siproxd/files/siproxd.init +++ b/net/siproxd/files/siproxd.init @@ -76,9 +76,6 @@ start_instance() { config_get use_rport "$cfg" use_rport 0 config_get outbound_proxy_host "$cfg" outbound_proxy_host config_get outbound_proxy_port "$cfg" outbound_proxy_port - config_get outbound_domain_name "$cfg" outbound_domain_name - config_get outbound_domain_host "$cfg" outbound_domain_host - config_get outbound_domain_port "$cfg" outbound_domain_port if [ -f "$siproxd_conf_prefix$cfg.conf" ]; then rm "$siproxd_conf_prefix$cfg.conf" @@ -129,9 +126,9 @@ start_instance() { append_conf_if_set use_rport append_conf_if_set outbound_proxy_host append_conf_if_set outbound_proxy_port - append_conf_if_set outbound_domain_name - append_conf_if_set outbound_domain_host - append_conf_if_set outbound_domain_port + config_list_foreach "$cfg" 'outbound_domain_name' deal_with_lists "outbound_domain_name" + config_list_foreach "$cfg" 'outbound_domain_host' deal_with_lists "outbound_domain_host" + config_list_foreach "$cfg" 'outbound_domain_port' deal_with_lists "outbound_domain_port" # handle plugins config_get plugindir "$cfg" plugindir "/usr/lib/siproxd/" From 7ee1ccd198cb64a2c1b7cbb3fce6be9ad3b2d10f Mon Sep 17 00:00:00 2001 From: guidosarducci Date: Mon, 10 Jul 2017 02:50:44 -0700 Subject: [PATCH 08/13] siproxd: use PKG_HASH and update copyright date Signed-off-by: Tony Ambardar --- net/siproxd/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/siproxd/Makefile b/net/siproxd/Makefile index 66d9130..5b9ad8f 100644 --- a/net/siproxd/Makefile +++ b/net/siproxd/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2014-2015 OpenWrt.org +# Copyright (C) 2014-2017 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -13,7 +13,7 @@ PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/siproxd -PKG_MD5SUM:=e3ec83f66ac880717c98512d89613f42 +PKG_HASH:=526ce491b0cc189e2766c62432aff3ebb995e551d7261ea32c02a90c7bf7ccd0 PKG_FIXUP:=autoreconf PKG_INSTALL:=1 From fea8879c3ed83e07ba2ce756f6cba074d7c7545c Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Sat, 24 Feb 2018 11:22:36 +0100 Subject: [PATCH 09/13] siproxd: update libltdl handling Remove LIBLTDL from the Makefile as well as a patch related to LTDL. Both have in common that they accomplish absolutely nothing. Also explicitly disable the use of the internal libltdl. Signed-off-by: Sebastian Kemper --- net/siproxd/Makefile | 6 ++--- .../010-fix-bogus-libltdl-dependency.patch | 26 ------------------- 2 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 net/siproxd/patches/010-fix-bogus-libltdl-dependency.patch diff --git a/net/siproxd/Makefile b/net/siproxd/Makefile index 5b9ad8f..a39b5fc 100644 --- a/net/siproxd/Makefile +++ b/net/siproxd/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2014-2017 OpenWrt.org +# Copyright (C) 2014-2018 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -48,11 +48,11 @@ endef CONFIGURE_ARGS+= \ --with-libosip-prefix="$(STAGING_DIR)/usr" \ + --disable-ltdl-convenience \ --disable-doc MAKE_FLAGS+= \ - SUBDIRS="src scripts contrib" \ - LIBLTDL="$(STAGING_DIR)/usr/lib/libltdl.la" \ + SUBDIRS="src scripts contrib" define Package/siproxd/install $(INSTALL_DIR) $(1)/usr/sbin diff --git a/net/siproxd/patches/010-fix-bogus-libltdl-dependency.patch b/net/siproxd/patches/010-fix-bogus-libltdl-dependency.patch deleted file mode 100644 index d457eb4..0000000 --- a/net/siproxd/patches/010-fix-bogus-libltdl-dependency.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -103,8 +103,8 @@ - # else Cygwin goes beserk when building...) - # - sbin_PROGRAMS = siproxd --siproxd_LDFLAGS=-export-dynamic --siproxd_LDADD = $(LIBLTDL) $(DLOPENPLUGINS) -+siproxd_LDFLAGS=-export-dynamic -lltdl -+siproxd_LDADD = $(DLOPENPLUGINS) - siproxd_SOURCES = siproxd.c proxy.c register.c sock.c utils.c \ - sip_utils.c sip_layer.c log.c readconf.c rtpproxy.c \ - rtpproxy_relay.c accessctl.c route_processing.c \ ---- a/src/Makefile.in -+++ b/src/Makefile.in -@@ -377,8 +377,8 @@ - # - plugin_fix_fbox_anoncall_la_SOURCES = plugin_fix_fbox_anoncall.c - plugin_fix_fbox_anoncall_la_LDFLAGS = -module -avoid-version -shrext '.so' --siproxd_LDFLAGS = -export-dynamic --siproxd_LDADD = $(LIBLTDL) $(DLOPENPLUGINS) -+siproxd_LDFLAGS = -export-dynamic -lltdl -+siproxd_LDADD = $(DLOPENPLUGINS) - siproxd_SOURCES = siproxd.c proxy.c register.c sock.c utils.c \ - sip_utils.c sip_layer.c log.c readconf.c rtpproxy.c \ - rtpproxy_relay.c accessctl.c route_processing.c \ From 1b6e890b835adc39f3581461efc88115b6ed3337 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Sat, 24 Feb 2018 11:25:07 +0100 Subject: [PATCH 10/13] siproxd: update module install define Use $(INSTALL_BIN) as the modules are installed by siproxd as executables. Remove the wildcards from this line as they're not needed. Signed-off-by: Sebastian Kemper --- net/siproxd/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/siproxd/Makefile b/net/siproxd/Makefile index a39b5fc..489e36f 100644 --- a/net/siproxd/Makefile +++ b/net/siproxd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=siproxd PKG_VERSION:=0.8.2 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@SF/siproxd @@ -72,7 +72,7 @@ define BuildPlugin define Package/siproxd-mod-$(1)/install $(INSTALL_DIR) $$(1)/usr/lib/siproxd - $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/siproxd/plugin_$(1)*.so* $$(1)/usr/lib/siproxd + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/siproxd/plugin_$(1).so $$(1)/usr/lib/siproxd endef $$(eval $$(call BuildPackage,siproxd-mod-$(1))) From 5dcf61c0813702ea0df65695c65749191b9996d7 Mon Sep 17 00:00:00 2001 From: guidosarducci Date: Sat, 3 Mar 2018 14:15:41 -0800 Subject: [PATCH 11/13] siproxd: use UCI callback processing, reduce code size Switch to using callback functions for UCI config processing, and remove the unnecessary scan_interfaces() call together with related code. Instead of explicitly handling every possible siproxd config option, use callbacks to deal with those defined in the UCI config file, and directly handle only selected options with desired default values. This shrinks the init code by ~3.5 KB and simplifies updating to future siproxd versions with new options. (Note: this change exposed some long-standing, broken aspects of UCI callback handling, fixed in https://github.com/openwrt/openwrt/pull/805.) Signed-off-by: Tony Ambardar --- net/siproxd/files/siproxd.init | 269 +++++++++++++-------------------- 1 file changed, 108 insertions(+), 161 deletions(-) diff --git a/net/siproxd/files/siproxd.init b/net/siproxd/files/siproxd.init index d122ad1..deb61cf 100644 --- a/net/siproxd/files/siproxd.init +++ b/net/siproxd/files/siproxd.init @@ -13,192 +13,140 @@ siproxd_registration_dir="/var/lib/siproxd" siproxd_registration_prefix="$siproxd_registration_dir/siproxd-" siproxd_pid_dir="/var/run/siproxd" -append_conf_if_set() { - local _val=$(eval "echo \$`echo $1`") - [ -n "$_val" ] && - echo "$1" = "$_val" >> "$siproxd_conf_prefix$cfg.conf" + +# Check if a UCI option is set, or else apply a provided default. + +default_conf() { + local opt="$1" + local default="$2" + local val + + config_get "$opt" "$sec" "$opt" + eval "val=\"\${$opt}\"" + + [ -z "$val" ] || return 0 + [ -n "$default" ] || return 0 + echo "$opt" = "$default" >> "$siproxd_conf_prefix$sec.conf" } -deal_with_lists () { - echo "$2" = "$1" >> "$siproxd_conf_prefix$cfg.conf" -} +# Use user-friendly network names (e.g. "wan", "lan") from options +# 'interface_inbound' and 'interface_outbound', but use standard siproxd +# parameters 'if_inbound' and 'if_outbound' if explicitly set. -start_instance() { - local cfg="$1" +setup_networks() { + local sec="$1" local _int_inbound local _int_outbound local _dev_inbound local _dev_outbound - config_get _int_inbound "$cfg" interface_inbound - config_get _int_outbound "$cfg" interface_outbound + config_get _int_inbound "$sec" interface_inbound + config_get _int_outbound "$sec" interface_outbound - scan_interfaces network_get_physdev _dev_inbound $_int_inbound network_get_physdev _dev_outbound $_int_outbound - config_load 'siproxd' - config_get if_inbound "$cfg" if_inbound $_dev_inbound - config_get if_outbound "$cfg" if_outbound $_dev_outbound + default_conf if_inbound $_dev_inbound + default_conf if_outbound $_dev_outbound +} - config_get host_outbound "$cfg" host_outbound - config_get hosts_allow_reg "$cfg" hosts_allow_reg - config_get hosts_allow_sip "$cfg" hosts_allow_sip - config_get hosts_deny_sip "$cfg" hosts_deny_sip - config_get sip_listen_port "$cfg" sip_listen_port 5060 - config_get_bool daemonize "$cfg" daemonize 1 - config_get silence_log "$cfg" silence_log 1 - config_get user "$cfg" user nobody - config_get chrootjail "$cfg" chrootjail - config_get registration_file "$cfg" registration_file "$siproxd_registration_prefix$cfg.reg" - config_get autosave_registrations "$cfg" autosave_registrations 300 - config_get pid_file "$cfg" pid_file "$siproxd_pid_dir/siproxd-$cfg.pid" - config_get_bool rtp_proxy_enable "$cfg" rtp_proxy_enable 1 - config_get rtp_port_low "$cfg" rtp_port_low 7070 - config_get rtp_port_high "$cfg" rtp_port_high 7089 - config_get rtp_timeout "$cfg" rtp_timeout 300 - config_get rtp_dscp "$cfg" rtp_dscp 46 - config_get sip_dscp "$cfg" sip_dscp 0 - config_get rtp_input_dejitter "$cfg" rtp_input_dejitter 0 - config_get rtp_output_dejitter "$cfg" rtp_output_dejitter 0 - config_get tcp_timeout "$cfg" tcp_timeout 600 - config_get tcp_connect_timeout "$cfg" tcp_connect_timeout 500 - config_get tcp_keepalive "$cfg" tcp_keepalive 20 - config_get default_expires "$cfg" default_expires 600 - config_get proxy_auth_realm "$cfg" proxy_auth_realm - config_get proxy_auth_passwd "$cfg" proxy_auth_passwd - config_get proxy_auth_pwfile "$cfg" proxy_auth_pwfile - config_get debug_level "$cfg" debug_level 0x00000000 - config_get debug_port "$cfg" debug_port 0 - config_get mask_host "$cfg" mask_host - config_get masked_host "$cfg" masked_host - config_get ua_string "$cfg" ua_string Siproxd-UA - config_get use_rport "$cfg" use_rport 0 - config_get outbound_proxy_host "$cfg" outbound_proxy_host - config_get outbound_proxy_port "$cfg" outbound_proxy_port +# Apply default values to key options if unset in user's UCI config. - if [ -f "$siproxd_conf_prefix$cfg.conf" ]; then - rm "$siproxd_conf_prefix$cfg.conf" - fi - echo "# auto-generated config file from /etc/config/siproxd" > "$siproxd_conf_prefix$cfg.conf" +apply_defaults() { + local sec="$1" - append_conf_if_set if_inbound - append_conf_if_set if_outbound - append_conf_if_set host_outbound - append_conf_if_set hosts_allow_reg - append_conf_if_set hosts_allow_sip - append_conf_if_set hosts_deny_sip - append_conf_if_set sip_listen_port - append_conf_if_set daemonize - append_conf_if_set silence_log - append_conf_if_set user - if [ -n "$chrootjail" ]; then - if [ ! -d "$chrootjail" ]; then - mkdir -p "$chrootjail" - chmod 0755 "$chrootjail" - fi - append_conf_if_set chrootjail - fi - append_conf_if_set registration_file - append_conf_if_set autosave_registrations + default_conf sip_listen_port 5060 + default_conf daemonize 1 + default_conf silence_log 1 + default_conf user nobody + default_conf registration_file "$siproxd_registration_prefix$sec.reg" + default_conf autosave_registrations 300 + default_conf pid_file "$siproxd_pid_dir/siproxd-$sec.pid" + default_conf rtp_proxy_enable 1 + default_conf rtp_port_low 7070 + default_conf rtp_port_high 7089 + default_conf rtp_timeout 300 + default_conf rtp_dscp 46 + default_conf sip_dscp 0 + default_conf rtp_input_dejitter 0 + default_conf rtp_output_dejitter 0 + default_conf tcp_timeout 600 + default_conf tcp_connect_timeout 500 + default_conf tcp_keepalive 20 + default_conf default_expires 600 + default_conf debug_level 0x00000000 + default_conf debug_port 0 + default_conf ua_string Siproxd-UA + default_conf use_rport 0 + default_conf plugindir "/usr/lib/siproxd/" +} - append_conf_if_set pid_file - append_conf_if_set rtp_proxy_enable - append_conf_if_set rtp_port_low - append_conf_if_set rtp_port_high - append_conf_if_set rtp_timeout - append_conf_if_set rtp_dscp - append_conf_if_set sip_dscp - append_conf_if_set rtp_input_dejitter - append_conf_if_set rtp_output_dejitter - append_conf_if_set tcp_timeout - append_conf_if_set tcp_connect_timeout - append_conf_if_set tcp_keepalive - append_conf_if_set default_expires - append_conf_if_set proxy_auth_realm - append_conf_if_set proxy_auth_passwd - append_conf_if_set proxy_auth_pwfile - append_conf_if_set debug_level - append_conf_if_set debug_port - append_conf_if_set mask_host - append_conf_if_set masked_host - append_conf_if_set ua_string - append_conf_if_set use_rport - append_conf_if_set outbound_proxy_host - append_conf_if_set outbound_proxy_port - config_list_foreach "$cfg" 'outbound_domain_name' deal_with_lists "outbound_domain_name" - config_list_foreach "$cfg" 'outbound_domain_host' deal_with_lists "outbound_domain_host" - config_list_foreach "$cfg" 'outbound_domain_port' deal_with_lists "outbound_domain_port" +# Setup callbacks for parsing siproxd sections, options, and lists. +# This avoids hardcoding all supported siproxd configuration parameters. - # handle plugins - config_get plugindir "$cfg" plugindir "/usr/lib/siproxd/" - append_conf_if_set plugindir +siproxd_cb() { + config_cb() { + local _int_inbound + local _int_outbound + local _dev_inbound + local _dev_outbound - config_list_foreach "$cfg" 'load_plugin' deal_with_lists "load_plugin" + case "$1" in + # Initialize section processing and save section name. + "siproxd") + sec="$2" + if [ -f "$siproxd_conf_prefix$sec.conf" ]; then + rm "$siproxd_conf_prefix$sec.conf" + fi + echo "# auto-generated config file from /etc/config/siproxd" > \ + "$siproxd_conf_prefix$sec.conf" + ;; + # Parse OpenWRT interface names (e.g. "wan") and apply defaults, + # using saved section name. + "") + local chrootjail + local pid_file - # plugin_demo.so - config_get plugin_demo_string "$cfg" plugin_demo_string - append_conf_if_set plugin_demo_string + setup_networks "$sec" + apply_defaults "$sec" - # plugin_shortdial.so - config_get plugin_shortdial_akey "$cfg" plugin_shortdial_akey - append_conf_if_set plugin_shortdial_akey - config_list_foreach "$cfg" 'plugin_shortdial_entry' deal_with_lists "plugin_shortdial_entry" + config_get chrootjail "$sec" chrootjail + if [ -n "$chrootjail" ]; then + if [ ! -d "$chrootjail" ]; then + mkdir -p "$chrootjail" + chmod 0755 "$chrootjail" + fi + fi - # plugin_defaulttarget.so - config_get_bool plugin_defaulttarget_log "$cfg" plugin_defaulttarget_log - append_conf_if_set plugin_defaulttarget_log - config_get plugin_defaulttarget_target "$cfg" plugin_defaulttarget_target - append_conf_if_set plugin_defaulttarget_target + config_get pid_file "$sec" pid_file + SERVICE_PID_FILE="$pid_file" service_start \ + $siproxd_bin --config "$siproxd_conf_prefix$sec.conf" + ;; + esac + return 0 + } - # plugin_fix_bogus_via.so - config_get plugin_fix_bogus_via_networks "$cfg" plugin_fix_bogus_via_networks - append_conf_if_set plugin_fix_bogus_via_networks + option_cb() { + # These 2 OpenWRT-specific options are handled in post-processing. + case "$1" in + "interface_inbound"|"interface_outbound") return 0 ;; + esac + # Other options match siproxd docs, so write directly to config. + [ -n "$2" ] && echo "$1" = "$2" >> "$siproxd_conf_prefix$sec.conf" + return 0 + } - # plugin_stun.so - config_get plugin_stun_server "$cfg" plugin_stun_server - append_conf_if_set plugin_stun_server - config_get plugin_stun_port "$cfg" plugin_stun_port - append_conf_if_set plugin_stun_port - config_get plugin_stun_period "$cfg" plugin_stun_period - append_conf_if_set plugin_stun_period - - # plugin_prefix.so - config_get plugin_prefix_akey "$cfg" plugin_prefix_akey - append_conf_if_set plugin_prefix_akey - - # plugin_regex.so - config_list_foreach "$cfg" 'plugin_regex_desc' deal_with_lists "plugin_regex_desc" - config_list_foreach "$cfg" 'plugin_regex_pattern' deal_with_lists "plugin_regex_pattern" - config_list_foreach "$cfg" 'plugin_regex_replace' deal_with_lists "plugin_regex_replace" - - # plugin_stripheader.so - config_list_foreach "$cfg" 'plugin_stripheader_remove' deal_with_lists "plugin_stripheader_remove" - - # plugin_codecfilter.so - config_list_foreach "$cfg" 'plugin_codecfilter_blacklist' deal_with_lists "plugin_codecfilter_blacklist" - - # plugin_siptrunk.so - config_list_foreach "$cfg" 'plugin_siptrunk_name' deal_with_lists "plugin_siptrunk_name" - config_list_foreach "$cfg" 'plugin_siptrunk_account' deal_with_lists "plugin_siptrunk_account" - config_list_foreach "$cfg" 'plugin_siptrunk_numbers_regex' deal_with_lists "plugin_siptrunk_numbers_regex" - - # plugin_fix_DTAG.so - config_get plugin_fix_DTAG_networks "$cfg" plugin_fix_DTAG_networks - append_conf_if_set plugin_fix_DTAG_networks - - # plugin_fix_fbox_anoncall.so - config_get plugin_fix_fbox_anoncall_networks "$cfg" plugin_fix_fbox_anoncall_networks - append_conf_if_set plugin_fix_fbox_anoncall_networks - - SERVICE_PID_FILE="$pid_file" \ - service_start $siproxd_bin --config "$siproxd_conf_prefix$cfg.conf" + list_cb() { + # All list items match siproxd docs, so write directly to config. + [ -n "$2" ] && echo "$1" = "$2" >> "$siproxd_conf_prefix$sec.conf" + return 0 + } } stop_instance() { - local cfg="$1" + local sec="$1" - config_get pid_file "$cfg" pid_file "$siproxd_pid_dir/siproxd-$cfg.pid" + config_get pid_file "$sec" pid_file "$siproxd_pid_dir/siproxd-$sec.pid" SERVICE_PID_FILE="$pid_file" \ service_stop $siproxd_bin @@ -216,10 +164,9 @@ start() { chmod 700 "$siproxd_pid_dir" chown nobody:nogroup "$siproxd_pid_dir" - include /lib/network . /lib/functions/network.sh + siproxd_cb config_load 'siproxd' - config_foreach start_instance 'siproxd' } stop() { From 74b1368b9883478261592cd5792e3d4b2a9f22f8 Mon Sep 17 00:00:00 2001 From: guidosarducci Date: Thu, 8 Mar 2018 23:17:30 -0800 Subject: [PATCH 12/13] siproxd: add usage comments, examples to default UCI config Explain default configuration options and potential firewall settings. Provide examples of using documented siproxd configuration directives. Signed-off-by: Tony Ambardar --- net/siproxd/files/siproxd.config | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/net/siproxd/files/siproxd.config b/net/siproxd/files/siproxd.config index be953eb..49b16ad 100644 --- a/net/siproxd/files/siproxd.config +++ b/net/siproxd/files/siproxd.config @@ -1,3 +1,25 @@ config siproxd general + # Custom options allow using OpenWRT network names, and defaults should + # work out-of-the-box. If your SIP devices do not REGISTER externally, + # you may also need to open firewall ports: tcp/udp 5060, udp 7070-7089. option interface_inbound lan option interface_outbound wan + +# All other documented siproxd configuration directives are supported. Use +# a UCI 'option' for single-instance directives, and UCI 'list' entries for +# directives that allow multiple instances, per the examples below. + + # Define low-level network devices, overriding interface_in/outbound: +# option if_inbound eth0 +# option if_outbound ppp0 + + # Enable DEBUG logging for configuration messages: +# option debug_level 0x00000100 +# option silence_log 0 + + # Load two plugins: one that logs SIP call details to syslog, and one + # that strips out G.729, GSM codecs: +# list load_plugin 'plugin_logcall.so' +# list load_plugin 'plugin_codecfilter.so' +# list plugin_codecfilter_blacklist G729 +# list plugin_codecfilter_blacklist GSM From 88f20a715926dec75b2076a939011c460face20a Mon Sep 17 00:00:00 2001 From: guidosarducci Date: Tue, 17 Oct 2017 23:39:01 -0700 Subject: [PATCH 13/13] siproxd: improve syslog messages Use explicit ident string ("siproxd") instead of NULL, as the latter is not guaranteed to prepend the program name (e.g. unspecified in POSIX), and may result in syslog messages identified only by PID. Use consistent facility (LOG_DAEMON) across openlog() and syslog() calls. Signed-off-by: Tony Ambardar --- net/siproxd/patches/010-syslog-msg.patch | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 net/siproxd/patches/010-syslog-msg.patch diff --git a/net/siproxd/patches/010-syslog-msg.patch b/net/siproxd/patches/010-syslog-msg.patch new file mode 100644 index 0000000..0e00e0b --- /dev/null +++ b/net/siproxd/patches/010-syslog-msg.patch @@ -0,0 +1,20 @@ +--- a/src/log.c ++++ b/src/log.c +@@ -77,7 +77,7 @@ + static pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER; + + void log_init(void) { +- openlog(NULL,LOG_NDELAY|LOG_PID,LOG_DAEMON); ++ openlog("siproxd",LOG_NDELAY|LOG_PID,LOG_DAEMON); + } + + void log_end(void) { +@@ -257,7 +257,7 @@ + va_copy(ap_copy, ap); + vsnprintf(outbuf, sizeof(outbuf), format, ap_copy); + va_end(ap_copy); +- syslog(LOG_USER|level, "%s:%i %s%s", file, line, label, outbuf); ++ syslog(LOG_DAEMON|level, "%s:%i %s%s", file, line, label, outbuf); + return; + } +