Phone Inventory

From KlavoWiki
Jump to navigationJump to search

To show a list of connected phones' IP addresses and Useragent. The Useragent will display the phone model number and firmware version.

#!/bin/sh
asterisk -rx "sip show peers"|
grep -vP '(UNKNOWN|Unmonitored)' |
cut -f1 -d/ | grep -P '\d\d\d.*' |
while read PEER
do
    echo "  "$PEER
    asterisk -rx "sip show peer ${PEER}" |
    grep -P "(Useragent|Contact)"
    echo "===="
done