[asterisk-users] Phone Inventory

Muro, Sam research at businesstz.com
Thu Feb 23 09:24:22 CST 2012


Thank you all

You are a life saver

Sam

Dale Noll wrote:
> On 02/23/2012 08:49 AM, Danny Nicholas wrote:
>> Here is a snippet that somebody smarter than I am can improve upon
>> for a in `asterisk -rx "sip show peers"|cut -f1 -d/` ;do asterisk -rx
>> "sip
>> show peer $a";done|grep Useragent
>> for a in `asterisk -rx "sip show peers"|cut -f1 -d/` ;do asterisk -rx
>> "sip
>> show peer $a";done|grep Contact
>>
>
> Thanks for the inspiration!!
>
> Here is my version, done with a single loop and gets Useragent and
> Contact together with a visual separation between peers.
>
>
> 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 ${PEER}" |
>     grep -P "(Useragent|Contact)"
>     echo "===="
> done
>
> I hope others find it useful.
>
> Dale
>
> PS. I by no means claim to be smarter than thou.  I just happen to
> really like grep and the -P option  ;-)
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>                http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>




More information about the asterisk-users mailing list