Updated dir and install script

This commit is contained in:
AlexK 2022-11-10 11:10:44 +05:00
parent 674b6cd43e
commit 9f06448018
3 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,11 @@
#!/bin/bash
#aster=$(/etc/init.d/asterisk 'status' | /bin/grep -P 'dead|inactive')
asterctl=$(/usr/bin/sudo /usr/sbin/asterisk -rx 'module show' | grep -P 'res_rtp_asterisk.so')
if [ -z "$asterctl" ] # if [ -n "$aster" ]
then
echo 0
else
echo 1
fi

View File

@ -0,0 +1,10 @@
#!/bin/bash
notok=`/usr/bin/sudo /usr/sbin/asterisk -rx 'sip show peers' | grep -E "^\<[0-9]{3}\>" | grep -vc OK`
if [ $notok == "0" ]
then
echo 0
else
peer_down=`/usr/bin/sudo /usr/sbin/asterisk -rx 'sip show peers' | grep UN | grep -oE "^\<[0-9]{3}\>"`
echo -e "\n$peer_down" | sed 's/$/::/g' #| head -c 3
#echo ""
fi

View File

@ -0,0 +1,24 @@
#!/bin/bash
# Get all pjsip trunks
number_trunks=`/usr/bin/sudo /usr/sbin/asterisk -rx "pjsip show registrations" | grep "Objects found" | awk '{print $3}'`
# Get registered pjsip trunks
reg_tranks=`/usr/bin/sudo /usr/sbin/asterisk -rx "pjsip show registrations" | grep Registered | wc -l`
# Calculate diff
let result=($number_trunks-$reg_tranks)
# Echo result
#echo $result
if [ $result == "0" ]
then
echo 0
else
trunks_rej=`/usr/bin/sudo /usr/sbin/asterisk -rx 'pjsip show registrations' | grep Rejec | grep -oE "^.{12}"`
trunks_unreg=`/usr/bin/sudo /usr/sbin/asterisk -rx 'pjsip show registrations' | grep Unregi | grep -oE "^.{12}"`
#echo "$peer_down" | head -c 3
trunks_down="$trunks_rej$trunks_unreg"
echo -e "\n$trunks_down" | sed 's/$/::/g'
#echo ""
fi