SIP.conf peer down alert

Any thing in the sip.conf to add so that if peer goes down I can have it send email alert?

thx

There is no such option. I made this simple bash script , It checks the status of a SIP peer based on the qualify option result, If is not “OK”, it make a call to the Sysadmin.

Just change the value of the B variable for an email command.

#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
export DISPLAY=:0.0
A=asterisk -x " sip show peer 1018" | grep -i status | cut -d' ' -f11

if [ “$A” != “OK” ]; then

B=asterisk -x "originate dahdi/g0/13297145874 extension 923@emergency"

echo “server not available $(date)” >> /root/lg.log
else

echo "Server up"
fi

echo $A

Thank you very much for the script!

I guess I am new to using the command line via linux CLI.

So I typed “asterisk -x sip show peer xxx” or
asterisk -x sip show peers

It keep saying "no such command ‘sip’ (type ‘core show ehlp sip’ blah)

But I know sip show peers works within the asterisk CLI, so why not with linux (I am using CentOS 6.4) ?

I am running asterisk 11.

Thx!

Your issue is the double quote

the right way is this

asterisk -x “sip show peers”

Nevermind, figured out, i need to have “single quote” before and after the command.

Thx!