Friday, August 15, 2014

Asterisk(Bash): watching agents on call/waiting in color

#!/bin/bash
clear
while true
do
buffer=$(
clear
/usr/sbin/asterisk -rx "show queue <My_Queue>" \
| grep Agent \
| grep -v \(Unavailable\) \
| sort -t"(" -k 2 \
| GREP_COLOR='01;31' egrep -i --color=always '^.*[0-9] \(Not in use.*$|$' \
| GREP_COLOR='01;32' egrep -i --color=always '^.*[0-9] \(Busy.*$|$' \
| GREP_COLOR='01;34' egrep -i --color=always '^.*\(paused.*$|$' )

echo "$buffer"
sleep 2
done

exit 0

No comments:

Post a Comment