Skip to content

Commit

Permalink
asterisk: add a reregister extra command
Browse files Browse the repository at this point in the history
`/etc/init.d/asterisk reregister` will re-register all outbound registrations.

Currently only pjsip is supported, but, if required, this can be easily
extended in the future.

Signed-off-by: Andre Heider <[email protected]>
  • Loading branch information
dhewg committed Mar 24, 2023
1 parent 6e28ddd commit e66399a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions net/asterisk/files/asterisk.init
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,13 @@ start_service() {
reload_service() {
procd_send_signal $NAME
}

extra_command "reregister" "Re-register all outbound registrations"
reregister() {
MODULES=`$COMMAND -x 'module show'` || exit 1

echo "$MODULES" | grep -q -s '^res_pjsip.so' && {
log info "re-registering all outbound pjsip registrations"
$COMMAND -x 'pjsip send unregister *all' -x 'pjsip send register *all'
}
}

0 comments on commit e66399a

Please sign in to comment.