FreeSWITCH: High call volume alert script

I was tasked to come up with a way to monitor for high call volume in FreeSWITCH. I came up with this here is a simple script that will check the channel count and email me if it’s greater than $MAX_CALLS

 

#!/bin/bash

MAX_CALLS=100
CHANNEL_COUNT=$(/usr/bin/fs_cli -x "show channels count" | awk '/total/ {print $1}')

if [ $CHANNEL_COUNT -gt $MAX_CALLS ]; then
        # From
        FROM="alert@voipxswitch.com"
        # Subject
        SUBJECT="High Call Volume"
        # To
        TOEMAIL="admin@voipxswitch.com"

        /usr/bin/mailx "-aFrom:$FROM" -s "$SUBJECT" "$TOEMAIL"<<END
This is an email alert to notify you that the server has reached $CHANNEL_COUNT calls.
END

fi

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.