[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 631
  • Last Modified:

Asterisk noop callers IP required

Say, Using this on hangup
http://www.voip-info.org/wiki/view/Asterisk+variables
Below is my output.
How do I get the callers IP?


 Executing [h@OutboundWS:1] NoOp("SIP/41.x.x.x-03bfd750", "EXTEN : h") in new stack
[2011-10-08 23:55:15] VERBOSE[14670] logger.c:     -- Executing [h@OutboundWS:2] NoOp("SIP/41.x.x.x-03bfd750", "SIPDOMAIN : 41.x.x.x") in new stack
[2011-10-08 23:55:15] VERBOSE[14670] logger.c:     -- Executing [h@OutboundWS:3] NoOp("SIP/41.x.x.x-03bfd750", "SIPCALLID : b212484d2e3ca45d") in new stack
0
shaunwingin
Asked:
shaunwingin
  • 2
  • 2
2 Solutions
 
grbladesCommented:
You will need to use the sip_header function to read the address directly out of the sip header. See http://www.voip-info.org/wiki/view/Asterisk+func+sip_header
The example given on that page looks like it will do what you want.
0
 
feptiasCommented:
I don't like to contradict another expert, especially one as wise as grblades. However, on this occasion there is a strong case for saying that the IP address in the From header is quite likely not to be the same as the source IP address of the request. It may not even be an IP address, but a host name/sip domain.

Since there is actually a channel variable that returns the source IP address it would seem a much better choice becuause (a) it does nto require text manipulation with CUT and (b) it will always contain the actual source IP address.

exten => _X.,n,noop(SOURCEIP: ${CHANNEL(recvip)})

Details here:
http://www.voip-info.org/wiki/view/Asterisk+func+channel
0
 
grbladesCommented:
Good find feptias.
I use opensips sitting infront of asterisk and use it to add custom headers for the received IP etc... so I know exactly what information I am getting and dont run into issues with formatting.
0
 
shaunwinginAuthor Commented:
Look fwd to testing it...tx
0
 
shaunwinginAuthor Commented:
Still to test
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now