From 11d81723bc2467e2879b27205ebdf0c1a88fa22e Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Thu, 4 Nov 2021 09:16:09 +0100 Subject: [PATCH] asterisk: add an 'interface' option to trigger reregister events If set this now automatically re-registers all outbound registrations when the interface is becoming available. This ensures that no stale IPs are registered at the SIP trunk. Fixes #681 Signed-off-by: Andre Heider --- net/asterisk/files/asterisk.conf | 1 + net/asterisk/files/asterisk.init | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/net/asterisk/files/asterisk.conf b/net/asterisk/files/asterisk.conf index d6d461c4..dc75bc07 100644 --- a/net/asterisk/files/asterisk.conf +++ b/net/asterisk/files/asterisk.conf @@ -11,6 +11,7 @@ config asterisk 'general' option enabled '0' + option interface 'wan' option log_stderr '1' option log_stdout '0' option options '' diff --git a/net/asterisk/files/asterisk.init b/net/asterisk/files/asterisk.init index fec6548c..f2d45ded 100644 --- a/net/asterisk/files/asterisk.init +++ b/net/asterisk/files/asterisk.init @@ -76,3 +76,11 @@ reregister() { $COMMAND -x 'pjsip send unregister *all' -x 'pjsip send register *all' } } + +service_triggers() { + config_load $NAME + config_get_bool enabled general enabled 0 + config_get interface general interface "" + + [ $enabled -eq 1 -a -n "$interface" ] && procd_add_interface_trigger "interface.*.up" "$interface" /etc/init.d/$NAME reregister +}