FreePBX | Register | Issues | Wiki | Portal | Support

RTP Monitoring Script


(Mike Waldron) #1

I created this script to assist with constant monitoring of RTP streams in Asterisk/FreePBX. It basically runs the following commands every two seconds and displays it in a formatted fashion.

asterisk -rx ‘sip show peers’
asterisk -rx ‘sip show channelstats’
asterisk -rx ‘pjsip show contacts’
asterisk -rx ‘pjsip show channelstats’

#!/bin/bash

while true
do
    clear
    echo -e "\e[33mCurrent Chan_SIP Peers:\e[39m"
    echo "-----------------------"
    asterisk -rx 'sip show peers'
    echo "--------------------------------------------------------------------------------------------------------------------------------------------"
    echo ""
    echo -e "\e[33mCurrent Chan_SIP RTP Statistics / Active Calls:\e[39m"
    echo "-----------------------------------------------"
    asterisk -rx 'sip show channelstats'
    echo "--------------------------------------------------------------------------------------------------------------------------------------------"
    echo ""
    echo -e "\e[33mCurrent PJSIP Peers / Contacts:\e[39m"
    echo "-----------------------------"
    asterisk -rx 'pjsip show contacts'
    echo "--------------------------------------------------------------------------------------------------------------------------------------------"
    echo ""
    echo -e "\e[33mCurrent PJSIP Statistics / Active Calls:\e[39m"
    echo "----------------------------------------"
    asterisk -rx 'pjsip show channelstats'
    echo "--------------------------------------------------------------------------------------------------------------------------------------------"
    sleep 2
done

It looks like this when you run it.