VoIPTek
(VoIPTek)
December 12, 2020, 4:24am
1
Hello All,
I used to use the following command to display all the phones, brand, extension and firmware version.
for ext in $(rasterisk -x ‘sip show peers’|grep -E ""|grep OK|cut -d "/" -f1);do rasterisk -x "sip show peer $ext";done|grep -E "Useragent|Username"
It would result in:
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
As you can see pretty handy when you have a bunch of phones and see firmware and model info.
How can I gather the same type of information with pjsip?
Thanks!
jcolp
(Joshua Colp)
December 12, 2020, 10:40am
2
The PJSIP module doesn’t currently present that information, but it’s certainly something we’ve heard that people want.
1 Like
sorvani
(Jared Busch)
December 13, 2020, 12:32am
4
japple
(japple)
December 13, 2020, 5:54pm
5
You can still do something similar to gather that information.
asterisk -rx “database show registrar” | cut -d, -f7,12
Results will be the endpoint and user_agent info.
“endpoint”:“103”,“user_agent”:“Yealink SIP-T53W 96.85.0.5”
2 Likes
danielf
(danielf)
December 14, 2020, 9:41am
6
Hello @VoIPTek ,
Here is a bash script that I wrote to pull the contact data from the AMI directly. It could help you as well. Make sure that you installed the telnet command before using it.
It will output a list of your AORs something like this:
===========================================
AOR: 5956
UserAgent: Yealink SIP-T22P 7.72.18.5
===========================================
This is the bash script:
#!/bin/bash
#This script will pull the contact status details of the PJSIP stack from the Manager interface
TEMPFILE='/tmp/pjsipcontact.txt'
#Connect to AMI
{
sleep 1;
echo -e "ACTION: LOGIN";
echo -e "USERNAME: cxpanel";
echo -e "SECRET: cxmanager*con";
echo -e "EVENTS: ON";
echo -e "";
echo -e "";
sleep 1;
echo -e "Action: Filter";
echo -e "ActionID: 1";
echo -e "Operation: Add";
echo -e "Filter: "Event: ContactStatusDetail*"";
echo -e "";
sleep 1;
echo -e "Action: PJSIPShowRegistrationInboundContactStatuses";
echo -e "";
echo -e "";
sleep 1;
echo -e "ACTION: LOGOFF";
echo -e "";
echo -e "";
} | telnet localhost 5038 > $TEMPFILE 2>&1
cat $TEMPFILE | grep -E 'AOR|UserAgent' | sed 's/AOR/\n===========================================\nAOR/g' | sed '/UserAgent/a==========================================='
rm -f $TEMPFILE
Thank you,
Daniel Friedman
Trixton LTD
1 Like
jlizzotte04
(Jeremy Lizzottr)
December 14, 2020, 6:52pm
7
How would you implement this? I saw the GIT where you have it listed but i am not familiar enough to know how i’d install it given it doesnt appear to be a module. Thanks
sorvani
(Jared Busch)
December 14, 2020, 10:07pm
8
Because it is not a module. It was something I was toying with to get more information from the registered phones. especially pjisp
extensions with multiple registrations.
sorvani
(Jared Busch)
December 14, 2020, 10:12pm
9
Log in to the console.
sudo -u asterisk mkdir -p /var/www/html/custom/templates
cd /var/www/html/custom
sudo -u asterisk wget https://github.com/sorvani/freepbx-helper-scripts/raw/extensions_status/Extension_Status/extensionstatus.php
cd /var/www/html/custom/templates
sudo -u asterisk wget https://raw.githubusercontent.com/sorvani/freepbx-helper-scripts/extensions_status/Extension_Status/templates/contactfoot.php
sudo -u asterisk wget https://raw.githubusercontent.com/sorvani/freepbx-helper-scripts/extensions_status/Extension_Status/templates/contacthead.php
Go to https://pbx.domain.com/custom/extensionstatus.php
1 Like
jlizzotte04
(Jeremy Lizzottr)
December 14, 2020, 10:48pm
10
Super cool thanks, I like how it has both internal and external ip.
sorvani
(Jared Busch)
December 15, 2020, 6:27am
11
Not always internal and external.
That depends. That is one of the things I have on my list to clarify.
VoIPTek
(VoIPTek)
December 17, 2020, 6:54pm
12
Hello @japple thank you, but for some reason when I execute this command I get "No such command ‘“database’ (type ‘core show help “database’ for other possible commands)
"
VoIPTek
(VoIPTek)
December 17, 2020, 6:56pm
13
Hi @danielf This worked great, thank you!
Hopefully others can benefit from it as well.
1 Like
lgaetz
(Lorne Gaetz)
December 17, 2020, 6:57pm
14
with copy/paste from forum, the quote characters got mangled. Try this
asterisk -rx "database show registrar" | cut -d, -f7,12
2 Likes
VoIPTek
(VoIPTek)
December 17, 2020, 7:08pm
15
Thanks everyone, the 2 options work great!
1 Like
system
(system)
Closed
June 3, 2021, 10:59pm
16
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.