<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/3781/">https://reviewboard.asterisk.org/r/3781/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On August 5th, 2014, 10:58 a.m. UTC, <b>wdoekes</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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
</pre>
</blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.
...</pre>
<br />
<p>- dtryba</p>
<br />
<p>On August 4th, 2014, 8:25 p.m. UTC, dtryba wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers.</div>
<div>By dtryba.</div>
<p style="color: grey;"><i>Updated Aug. 4, 2014, 8:25 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://issues.asterisk.org/jira/browse/ASTERISK-24040">ASTERISK-24040</a>
</div>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">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.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/channels/sip/dialplan_functions.c <span style="color: grey">(418610)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/3781/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>