As an admin for a telephone system, possibly one of the most useful things you can do is monitoring your peers and trunks. There are 2 great reasons you should do so:
1. You can respond to and resolve issues with your system before your users know about it, and you can be in the know if someone reports “none of the phones are working” when in fact only 1 or 2 are not working
2. You can actually know when there is a problem with the system – where you otherwise might not know there is a problem until someone calls on your mobile to say your office number is not working
I have 2 scripts running every 15 minutes to email me with the details of any down extensions and trunks. This is done in Crontab with the line:
and similar for Trunkmonitor.sh. This line says to run every 15 minutes between 08:00 and 18:00 every Monday-Friday
DISCLAIMER: I cannot claim ownership of the code here, it was most likely found on the web, maybe tweaked, I can’t remember it was a long time ago.
Here is Peermonitor.sh – It is based on you having qualify=60 or similar in your extensions definitions, IE not qualify=no otherwise it will be ignored. You may wish to qualify=no for eg a remote extension or softphone so you don’t get alerts when it isn’t online.
And here is a link to a discussion about what I call Trunkmonitor.sh:
I do remember I had to tweak it so here is my script, and we register SIP trunks but using IAX trunks is also discussed in the script:
Remember that to get it working you need to create the file as specified in /etc/asterisk either trunkalerts_sip.conf and/or trunkalerts_iax2.conf
*Note: I am pretty sure that if you don’t register your trunks this script won’t work; at the very least you’ll want to qualify=60 your trunks. If you have incoming numbers delivered directly to you via SIP URI (eg firstname.lastname@example.org) then you still won’t know if incoming calls stop working! I have an idea to setup an automated test system which dials out to your PSTN number, waits for your system to answer and then plays a DTMF tone sequence, at which point your system returns a confirmation or even a status DTMF tone, and the test system logs this as a successful test. Anyone fancy helping with that, please feel free to leave a comment – Thanks!