Show extensions, phones and firmware:
asterisk -rx "database show registrar" | cut -d, -f7,12
Show PJSIP extensions:
asterisk -rx "pjsip show endpoints"
Get MAC for phone:
arp -a |grep 192.168.110.xxx
Sometimes, with some firewalls, with IP routed trunks, the outbound trunk can become Unavailable
. It seems this can happen after an Internet outage or trunk provider maintenance window.
Adjusting the PJSIP trunk advanced settings can definitely help.
May bring trunk back online immeddiately:
Trunk name is vitel-outbound
.
/usr/sbin/asterisk -rx 'pjsip qualify vitel-outbound'
May save you a reboot:
/usr/sbin/asterisk -rx 'core reload' # no down time /usr/sbin/asterisk -rx 'core restart now' # some down time /usr/sbin/asterisk -rx "core restart when convenient" # safer
This one-liner can be used in cron to check the trunk status, restart Asterisk and notify you:
Not well tested
/usr/sbin/asterisk -rx "pjsip show endpoint vitel-outbound" | if grep -q Unvailable; then /usr/sbin/asterisk -rx "core restart when convenient" && echo "Detected Offline and Asterisk Restarted" | mail -s "XXXXXX Outbound Trunk" your@yourdomain.tld; fi