VoIPTek
(VoIPTek)
July 26, 2022, 3:47pm
1
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…
billsimon
(Bill Simon)
July 26, 2022, 3:57pm
2
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"
VoIPTek
(VoIPTek)
July 26, 2022, 4:03pm
3
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
billsimon
(Bill Simon)
July 26, 2022, 4:05pm
4
On what version of asterisk?
VoIPTek
(VoIPTek)
July 26, 2022, 4:12pm
5
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.
jcolp
(Joshua Colp)
July 26, 2022, 4:14pm
6
The output you provided is from chan_sip, not from chan_pjsip.
PitzKey
(Itzik)
July 26, 2022, 4:28pm
7
You can pull the UA info from the Asterisk DB.
billsimon
(Bill Simon)
July 26, 2022, 5:36pm
8
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
system
(system)
Closed
August 26, 2022, 5:37pm
9
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.