› VitalPBX Community Support › General Discussion › Send email if Trunk fails to register or is not registered › Reply To: RE: Send email if Trunk fails to register or is not registered
-
- November 14, 2018 at 9:25 pm
This is how I do it. I make no warranties about its suitability, but people are free to have a look and try it if they want. It can be downloaded from this folder:
https://mega.nz/#F!UHZmGQKR!KsC0lhZ11ttm95ZpUOWxSg
The relevant script is called trunkcheck.sh
In the section “User-defined variables and arrays” you need to specify the email address to which messages will be sent, and the “username” of each SIP account (usually a numeric value), plus a “friendly” string for each SIP account so your email is more informative. You then set up a cron job on the asterisk box to check the trunks, say every 10 minutes.
If a trunk is down when the cron job runs, you get an email message:
Trunk 1234567 is now down DIDLOGIC 0787878787 failed to register with a sip server
and if it has changed back to being up when the next cron jobs runs then you get another email to tell you that:
Trunk 1234567 is now up DIDLOGIC 0787878787 has registered with server sip.au.didlogic.net
I make no guarantees for this script, but it works well for me.
1