About a week ago my ISP implemented a new Failover system, this system has not been working properly and causes me to lose connectivity for about 4 seconds every 6 hours, the cable modem itself never goes offline, it all happens on their end on their servers.
Every time it happens I end up with a new IP address.
4 seconds later once I have my internet back, all the computer on my network are able to access websites etc as if it was just really bad lag.
My Asterisk phone system uses Google Voice and Sipgate, for just my family as a Free phone, This has been working great for over a year now, until this little hangup.
The asterisk server never re-registers with sipgate.
The only way I have found to restore functionality is to restart the asterisk machine.
Using the web interface: http://192.168.1.130/maint/index.php?astInfo
I can see:
Sip Peers
Name/username Host Dyn Nat ACL Port Status
sipgate 204.155.28.10 N 5060 UNREACHABLE
702/702 192.168.1.127 D N A 5061 OK (19 ms)
701/701 192.168.1.127 D N A 5060 OK (12 ms)
3 sip peers [Monitored: 2 online, 1 offline Unmonitored: 0 online, 0 offline]
701 and 702 are the two phone lines that go through my Linksys PAP2T ATA.
Is there a way to write a script, that every minute or so checks for the sipgate line, and if it says “UNREACHABLE” then restart the machine?
To clarify I am not asking anyone to write the script for me, I know thats asking a to much, I have done coding on plenty of projects in various coding languages but I am pretty unfamiliar with asterisk. So I just need some pointers or references.
Like use X command to check X file for unreachable/offline status, then issue X command to restart asterisk machine. Place script in X location and add X Line to this file to initiate the script.