PJSIP CLI Information

Is there a command in asterisk CLI to expose a Useragent for a PJSIP contact? For reference, the chan_sip equivalent would be something like the Useragent line when running sip show peer 100

This is not currently available from the CLI commands themselves, but it has been frequently requested and may appear in the future. Looking directly at astdb using “database show registrar/contact” in the CLI will show the stored information if you really would like to see it in the CLI.

1 Like

There is a function within AMI to get everything for an extension.

// Load AMI
global $astman;

$results = $astman->PJSIPShowRegistrationInboundContactStatuses();

I use it for this tool I am slowly working on.
https://github.com/sorvani/freepbx-helper-scripts/tree/extensions_status/Extension_Status

This is what the raw data looks like
image

1 Like

Is there a way to have it return information for a specific contact, or will it always return all?

I don’t have an example at hand, but the database stuff allows individual retrieval - but note it’s directly accessing the database, it’s not meant to be as friendly as the normal pjsip CLI commands.

The result is basically json, given a little "jq’ness (yum/apt install jq) " then

 rasterisk -x 'database show registrar' |head-1|sed 's/^.*\({.*}\).*$/\1/g'|jq '.' 

might help you on your way.

1 Like

You guys are awesome. While exposing it in the CLI would definitely be convenient, I’ve figured out a workable solution. Thanks :slight_smile:

1 Like

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