Query the IP address of a registered phone

asepulveda

Joined
Jun 23, 2008
Messages
400
Likes
0
Points
0
#1
Hi,
I want to query the ip of the registered peers with an AGI , the idea is to have an AGI that can obtain the extension number that answer a call (this i already have it) and the ip of that extension, there is any place were this info is store?

thanks
 

donhwyo

Joined
Aug 8, 2008
Messages
293
Likes
0
Points
0
#2
Not sure how to get it but the extension and ip address are in the end point panel so the info is available some where. They are also probably in the tftp config files if you are using those. Guess not but you can see the mac address from the file name and the extension.

Don
 

asepulveda

Joined
Jun 23, 2008
Messages
400
Likes
0
Points
0
#3
But what happends if im using softphones?? there should be somewere this info is store, well thats what i think
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#4
Perhaps a Quick and Dirty system call:

rasterisk -x 'sip show peers'|grep OK|awk '{print $1,$2}'

or a more specific (if you have $EXT already):

rasterisk -x 'sip show peers'|grep $EXT |awk '{print $2}'

for more info about $EXT
rasterisk -x "database showkey $EXT "
 

asepulveda

Joined
Jun 23, 2008
Messages
400
Likes
0
Points
0
#5
Great!
But what if i want to obtain the ip of an especific ext i can use this:

rasterisk -x 'sip show peer 469'|grep Addr|awk '{print $3}'

That way i obstain the ip of that extension, now , i can send this command from my agi, but can i obstain the resultant ip to use it to the rest of my AGI process?
 

dicko

Joined
Oct 24, 2008
Messages
4,099
Likes
0
Points
0
#6
just use the syntax of the language you're writing in

basically

EXT=1234

VALUE = systemcall("rasterisk -x 'sip show peer $EXT'|grep Addr|awk '{print $3}'" ) ;

yourfunction($EXT,$VALUE);
 

Members online

No members online now.

Latest posts

Forum statistics

Threads
30,902
Messages
130,887
Members
17,565
Latest member
omarmenichetti
Top