Find a particular device model in a Asterisk PBX

Hello there,

I’ve lately started to work with Asterisk PBX, still learning as it is a great open source VoIP environment.
For a last few days I’ve been trying to find a way to determine the model of the phones used in our Asterisk PBX but I failed.

Is there any way to find what devices are used at this moment?
I need to find how many devices of a particular VENDOR are used by the users at the moment.
Is there any command that can help me with that which will provide IP of all phones and the VENDOR?

Looking forward for your help.
Thank you in advance.

In principle, yes.

Asterisk is typically working at a higher level of abstraction than a SIP proxy. There’s nothing that would directly tell you what you want. Indirectly you can get the information by scanning the some SIP dialogs. For example, you could look at the REGISTER packets of local phones. You would get something like

REGISTER sip:phone01.localdomain SIP/2.0
Via:  SIP/2.0/UDP;branch=z9hG4bK960236821;rport
From:  <sip:phone01-4726@phone01.localdomain>;tag=515323372
To:  <sip:phone01-4726@phone01.localdomain>
Call-ID: 1175706595-5060-1@BJC.BGI.JJ.BCI
CSeq:  3761 REGISTER
Contact:  <sip:phone01-4726@>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-1000-8000-000B82A74932>"
Authorization:  Digest username="phone01-4726", realm="asterisk", nonce="1653088504/fb411d608ce884469adaf66bf8b95297", uri="sip:phone01.localdomain", response="0b5ffa00480e74b12ab5a6098c4512d6", algorithm=MD5, cnonce="01320856", opaque="3544924565c933ad", qop=auth, nc=00000002
Max-Forwards:  70
User-Agent:  Grandstream GXV3275
Supported:  path
Expires:  3600
Content-Length:  0

You can associate the Request URI/From header/To header with the User-Agent header.

‘pjsip show contacts’ will give you some of what you’re asking for.

For those who will have the same problem,

BASH Script that will solve it:

#! /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


asterisk -rx “sip show peer $(getUserName ${PEER})” |

grep -P “(Username|Useragent|Contact)”

echo “;”


That would, of cause, not work if pjsip is being used.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.