Get help with installing, upgrading and running a PBX such as Asterisk.

Advertisement

By Sponsor
User avatar
By WelshPaul
#1808
As mentioned elsewhere I have FreePBX running on an Raspberry pi. (RasPBX)

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! :P

Type:
Code: Select all
nano /home/pi/scripts/asterisk-reload-watchdog.sh
Copy and paste into above:
Code: Select all
#!/bin/bash

asterisk -rx "sip show registry" | grep -q "No Authentication"

if [ $? == 0 ]; then
  amportal a r
fi
Now press CTRL X then Y to save the and exit the file.

Next we need to set the permissions of the file we just created, to do this type:
Code: Select all
chmod +x /home/pi/scripts/asterisk-reload-watchdog.sh
Now that we have our script we just need to setup a cronjob to run it every 60 seconds. To do this type:
Code: Select all
sudo crontab -e
Copy and paste into above:
Code: Select all
*/1 * * * * /usr/bin/sudo /home/pi/scripts/asterisk-reload-watchdog.sh >> /home/pi/scripts/asterisk-reload-watchdog.log
Now press CTRL X then Y to save the and exit the file.

Advertisement

By Sponsor
User avatar
By WelshPaul
#1809
For anyone running Asterisk use the following:

Type:
Code: Select all
nano /root/scripts/asterisk-reload-watchdog.sh
Copy and paste into above:
Code: Select all
#!/bin/bash

/usr/sbin/asterisk -rx "sip show registry" | grep -q "No Authentication"

if [ $? == 0 ]; then
  /etc/init.d/asterisk reload
fi
Now press CTRL X then Y to save the and exit the file.

Next we need to set the permissions of the file we just created, to do this type:
Code: Select all
chmod +x /root/scripts/asterisk-reload-watchdog.sh
Now that we have our script we just need to setup a cronjob to run it every 60 seconds. To do this type:
Code: Select all
env EDITOR=nano crontab -e
Copy and paste into above:
Code: Select all
*/1 * * * * /root/scripts/asterisk-reload-watchdog.sh >> /root/scripts/asterisk-reload-watchdog.log
Now press CTRL X then Y to save the and exit the file.
#4688
I've also been experiencing 'No Authentication' with voipfone more and more often this year. I also have another trunk draytel and another non credential (ip authenticated) trunk on the same freepbx server without issues.

I will try your script!

Hello Paul, Thank you for your response. Much app…

If you're experiencing issues making outgoing call…

Just leave all the files in the TFTP directory and…

VoIP on the move via wifi

Great! I have been looking for a similar solution.…

Sign up for full membership