Did something change in newer versions of asterisk that could break pjsip show endpoints?

Hello All,

I have used for some time commands such as:

for ext in $(rasterisk -x 'pjsip show endpoints'|grep -E "^[0-9]"|grep OK|cut -d "/" -f1);do rasterisk -x " $ext";done|grep -E "Useragent|Username"

I keep getting empty results, so I started breaking down the command into smaller pieces and it seems like something has changed.

Any direction appreciated…

I don’t see any “OK” that would match a grep. (Asterisk 18.11.1)

Scraping CLI output carries this particular risk.

If I understand what you are trying to do, you should be able to get the info you want from the “registrar” key family in astdb.

asterisk -rx "database show registrar"

I used to be able to clean up the results to show phone information like so, which helped easily spot ext and firmware info.

Useragent : Sangoma S705 V3.0.4.79
Def. Username: 1080
Useragent : Sangoma S705 V3.0.4.79
Def. Username: 700
Useragent : Cisco/SPA514G-7.6.2
Def. Username: 7001
Useragent : snomMP/8.7.3.25
Def. Username: 7002
Useragent : Grandstream WP820 1.0.5.5
Def. Username: 701
Useragent : Cisco/SPA525G2-7.6.2
Def. Username: 702
Useragent : Cisco/SPA525G2-7.6.2

On what version of asterisk?

I’m guessing 17 and back, I even shared that command on a post not that long ago to help someone find the same info I would get, thats literally the command I would type to get the shown results.

The output you provided is from chan_sip, not from chan_pjsip.

You can pull the UA info from the Asterisk DB.

Example (install jq with yum install jq if you want to do this):

# asterisk -rx "database show registrar/contact" | cut -f 2- -d ' ' | grep -v "results found" | jq  '{ ext: .endpoint, ua: .user_agent}'
{
  "ext": "1101",
  "ua": "OBIHAI/OBi110-1.3.0.2886"
}
{
  "ext": "1102",
  "ua": "Acrobits SIPIS"
}
{
  "ext": "1105",
  "ua": "OBIHAI/OBi1062-5.1.11.5312"
}
1 Like

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