[asterisk-dev] [Code Review] 3781: Retrieve the source port of an incoming (chan_sip) SIP invite

dtryba reviewboard at asterisk.org
Wed Aug 6 04:58:44 CDT 2014



> On Aug. 5, 2014, 10:58 a.m., wdoekes wrote:
> > http://lists.digium.com/pipermail/asterisk-commits/2014-August/069629.html
> > 
> > It'd be nice if the documentation got updated too...
> > 
> > I know it's in an illogical place, in funcs/func_channel.c, but it should be updated nevertheless.
> > 
> > /w
> >

func_channel.c.diff contains the necessary patch for the new option:

core show function CHANNEL
...
    *chan_sip* provides the following additional options:
    peerip - R/O Get the IP address of the peer.
    recvip - R/O Get the source IP address of the peer.
    recvport - R/O Get the source port of the peer.
...


- dtryba


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3781/#review12979
-----------------------------------------------------------


On Aug. 4, 2014, 8:25 p.m., dtryba wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/3781/
> -----------------------------------------------------------
> 
> (Updated Aug. 4, 2014, 8:25 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Bugs: ASTERISK-24040
>     https://issues.asterisk.org/jira/browse/ASTERISK-24040
> 
> 
> Repository: Asterisk
> 
> 
> Description
> -------
> 
> Retrieve the source port of an incoming (chan_sip) SIP invite in the dialplan with ${CHANNEL(recvport)}
> To complement ${CHANNEL(recvip)} and enable me to make dialplan decisions based on source port (in a peerless setup, handle everything as guests using AGI to lookup source ip/port for routing/handling).
> 
> pjsip appears to have this capability through the CHANNEL function (pjsip,local_addr/remote_addr).
> 
> Simple 2 line patch using ast_sockaddr_stringify_fmt(const struct ast_sockaddr *sa, int format)
> to return the port as a string.
> 
> 
> Diffs
> -----
> 
>   /trunk/channels/sip/dialplan_functions.c 418610 
> 
> Diff: https://reviewboard.asterisk.org/r/3781/diff/
> 
> 
> Testing
> -------
> 
> Tested on 11.10.2 (Debian Jessie) and trunk (418610) using IPv4. Having a few SIP endpoints connect from different address/ports combinations 
> Logged ${CHANNEL(recvip)}:${CHANNEL(recvport)} corresponds with source ip:port in packetdumps on the asterisk machine.
> 
> 
> Thanks,
> 
> dtryba
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140806/bb916ae1/attachment-0001.html>


More information about the asterisk-dev mailing list