Pjsip options on how to display firmware and device info?


#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 “^[0-9]”|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!


(Joshua C. Colp) #2

The PJSIP module doesn’t currently present that information, but it’s certainly something we’ve heard that people want.


(Itzik) #3

https://community.freepbx.org/t/seeing-useragent-info-that-displays-make-model-firmware/65364/4?u=pitzkey


(Jared Busch) #4

I put this together back in the late spring. Have not had time to come back to it.


image


#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”


(Daniel Friedman) #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


(Jeremy Lizzotte) #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


(Jared Busch) #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.


(Jared Busch) #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


(Jeremy Lizzotte) #10

Super cool thanks, I like how it has both internal and external ip.


(Jared Busch) #11

Not always internal and external.

That depends. That is one of the things I have on my list to clarify.


#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)
"


#13

Hi @danielf This worked great, thank you!
Hopefully others can benefit from it as well.


(Lorne Gaetz) #14

with copy/paste from forum, the quote characters got mangled. Try this

asterisk -rx "database show registrar" | cut -d, -f7,12

#15

Thanks everyone, the 2 options work great!