I need to find out whether all Cisco phones in organization use the latest firmware. As SPA series phones show firmware version in “Useragent” string it would be great to display all useragents in Asterisk. In order to get this string from all Asterisk peers we need to go through each peer and display the property we are interested in. Here is the useragents.sh
Bash script:
1 2 3 4 5 6 7 8 9 10 11 12 |
#! /bin/bash getUserName() { echo $1 | cut -d : -f 1 | xargs basename } asterisk -rx 'sip show peers' | cut -f1 -d/ | grep -P '\d\d\d\d' | grep -vP '(UNKNOWN|Unmonitored)' | while read PEER do asterisk -rx "sip show peer $(getUserName ${PEER})" | grep -P "(Username|Useragent|Contact)" echo ";" done |
Good luck!