how to check sip channels connected for a long period
If you want to verify if there are sip channels that are connected for a long period, use this script
#!/bin/bash
###########################################################
# this script chech if channel has reached limit duration
###########################################################
COUNT=`asterisk -rx "show channels verbose" |grep -v "hannel|active" |grep ^SIP |awk '{print $1" "$9}' |wc -l`
`asterisk -rx "show channels verbose" |grep -v "hannel|active" |grep ^SIP |awk '{print $1" "$9}' > /tmp/list_channel`
XLIMIT=50
IFS=$'n'
#echo "Total active calls: " $COUNT
for LINE in $( cat /tmp/list_channel ); do
CHAN=`echo $LINE | awk '{print $1}' `
TIME=`echo $LINE | awk '{print $2}' `
XTIME=`echo $LINE | awk '{print $2}' | awk -F: '{print $2}' `
if [ $XTIME -gt $XLIMIT ]
then
echo "limit reached: " $TIME
echo "CHAN: " $CHAN;
echo "TIME: " $TIME;
#echo "Hangupping call ..."
#asterisk -rx "soft hangup $CHAN"
fi
done
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.