User Tools

Site Tools


voice:pbx:freepbx:freepbx_cli

FreePBX CLI Tips and Troubleshooting

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

Outbound Trunk Unavailable

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. FreePBX PJSIP Trunk Advanced Settings

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:

FIXME 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
voice/pbx/freepbx/freepbx_cli.txt · Last modified: 2024/04/18 13:32 by gcooper