Get help with installing, upgrading and running a PBX such as Asterisk.
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.
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.
Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests

Supported Products: OBi504vs OBi508vs Firm…

Supported Products: OBi200 OBi202 OBi300 OB…

Enter your email address here: https://haveibeenpw…

Well, with VoiceHost you can! I needed to report …