Skip to content

Commit

Permalink
asterisk: add an 'interface' option to trigger reregister events
Browse files Browse the repository at this point in the history
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 openwrt#681

Signed-off-by: Andre Heider <a.heider@gmail.com>
  • Loading branch information
dhewg committed May 31, 2022
1 parent 7fda4e3 commit 04cc1ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions net/asterisk/files/asterisk.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

config asterisk 'general'
option enabled '0'
option interface 'wan'
option log_stderr '1'
option log_stdout '0'
option options ''
8 changes: 8 additions & 0 deletions net/asterisk/files/asterisk.init
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 04cc1ca

Please sign in to comment.