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

FacebookTechnotiziePlaxo PulseLinkedInTwitterWordPressGoogle BookmarksGoogle ReaderStumbleUponTechnorati FavoritesShare

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.

If you found this page useful, consider linking to it.
Simply copy and paste the code below into your web site (Ctrl+C to copy)
It will look like this: how to check sip channels connected for a long period

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera