Email notification

Just looking to see if there was a script that I can implement that will email me if AORs get deleted / phones lose registration. Maybe to one extension, or a range. Thanks guys

Works with SIP trunks and extensions…

Great, thanks!

Any best way to implement this for PJSIP?

Read all postings…
I mentioned it “The script works with IAX2 or PJSIP too…you just have to adapt it, e.g. instead of “sip show peers” use “pjsip show aors”…”

You have to find a way, where you get a characteristic output, which triggers the alarm…

Since I once had stability problems with my pjsip trunk, I have been using sip instead…and will do so for the foreseeable future…

For anyone looking to something similar, here is my script that runs every 5 minutes for PJSIP related extensions:

#!/bin/bash
email=“InsertYourEmail”
/usr/sbin/asterisk -rx ‘pjsip show endpoint 5301’ > /tmp/allExtensions.txt
offlineExtensions=cat /tmp/allExtensions.txt| grep -e 'Unavailable'
if [ -z “$offlineExtensions” ]; then
exit
else
(
echo “Subject: Location Down”
printf ‘Customer - SIP Extensions are down…\n’’\n’"${offlineExtensions}"
) | /usr/sbin/sendmail ${email}
fi

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.