[asterisk-users] user-agent access from pjsip

Matthew Jordan mjordan at digium.com
Mon Oct 23 13:07:13 CDT 2017

On Wed, Oct 18, 2017 at 11:00 AM, Bryant Zimmerman <BryantZ at zktech.com> wrote:
> I am trying to get the user-agent from extensions registered via pjsip.
> With sip we could do a sip show peer peername and it would list the user-agent string.
> In a pjsip deployment it looks like this info is likely in the contact. I know we can access it from the dialplan, but this is only works when a call occurs. How can we get the user-agent for extensions from the console. We need this for firmware version checking of extensions as many providers include that in the user-agent.  Any ideas as the pjsip show contact contactname does not return any real helpful info to the command line.
> Please advise if you are able.

For a long time, the project has discouraged (although not necessarily
prevented) using/abusing the CLI for interactions with external
systems. The CLI is intended for human interaction, not intersystem
interaction. Doesn't mean you can't build a system that interacts with
Asterisk through the CLI - just means you probably shouldn't.

If you need the UserAgent string for your registered endpoints, you
can get that off of the Contact. You can get the Contact via AMI by
listening for events and by querying for the status of the contacts

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+ManagerAction_PJSIPShowRegistrationInboundContactStatuses

Matthew Jordan
Digium, Inc. | CTO
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org

More information about the asterisk-users mailing list