Wednesday, 26 December 2018

sip unreachable alerts

If sip unreachable then send auto mail

vim /home/UNREACHABLE.sh


#!/bin/bash
COUNTER=0
DATE=`date "+%d.%m.%Y. %H:%M"`
Status=`/usr/sbin/asterisk -rx "sip show peers" |grep UNREACHABLE`
SIP=`/usr/sbin/asterisk -rx "sip show peers" |grep UNREACHABLE |wc -l`

if [ $SIP -gt 1 ]
then
echo -e "$Status" | mail -s "SIP Peer Unreachable `hostname` $DATE" example@mail.com
echo $Status
else
   echo "None of the condition met"
fi


Then set in crontab

crontab -e


* * * * * /bin/sh /home/UNREACHABLE.sh


thanks

No comments:

How to install asterisk secure fail2ban

1)  rpm -Uvh  http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm If this is already installed, skip this step. 2)  y...