I have several trunks registered, Voipfone, Voicehost and Sipgate to name a few. I have had issues with the Voipfone trunk where everything appears to work ok for a few days then out of nowhere inbound calls fail. The caller will hear one ring then the engaged tone.
I have setup the following script to run as a cron job every minute - it will watch for the failure and reload asterisk to resolve it. Just follow the instructions!
#!/bin/bash asterisk -rx "sip show registry" | grep -q "No Authentication" if [ $? == 0 ]; then amportal a r fi
Next we need to set the permissions of the file we just created, to do this type:
chmod +x /home/pi/scripts/asterisk-reload-watchdog.sh
sudo crontab -e
*/1 * * * * /usr/bin/sudo /home/pi/scripts/asterisk-reload-watchdog.sh >> /home/pi/scripts/asterisk-reload-watchdog.log