Query the IP address of a registered phone

Discussion in 'General' started by asepulveda, Aug 20, 2009.

  1. asepulveda

    Joined:
    Jun 23, 2008
    Messages:
    400
    Likes Received:
    0
    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
     
  2. donhwyo

    Joined:
    Aug 8, 2008
    Messages:
    293
    Likes Received:
    0
    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
     
  3. asepulveda

    Joined:
    Jun 23, 2008
    Messages:
    400
    Likes Received:
    0
    But what happends if im using softphones?? there should be somewere this info is store, well thats what i think
     
  4. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    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 "
     
  5. asepulveda

    Joined:
    Jun 23, 2008
    Messages:
    400
    Likes Received:
    0
    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?
     
  6. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    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);
     

Share This Page