<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/1698/">https://reviewboard.asterisk.org/r/1698/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers.</div>
<div>By Terry Wilson.</div>
<p style="color: grey;"><i>Updated Feb. 8, 2012, 11:34 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</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;">Implement changes proposed by Kevin Fleming here: http://lists.digium.com/pipermail/asterisk-dev/2012-February/053586.html
The nat= setting is now a comma separated list of combinable options. nat=yes, while handled, is now an undocumented option replaced by nat=force_rport,comedia. That nat=auto option has been split into nat=auto_force_rport,auto_comedia. When parsing that nat= line, the first 'yes' or 'no' will cause parsing to stop and override any previous options. If an auto_ option is set at the same time its non-auto_ counterpart is set, the auto setting is honored.
I added some helper functions for displaying the textual output of the force_rport and comedia options for CLI use. They are declared in the existing channels/sip/include/sip_utils.h file, but implemented in a new file channels/sip/utils.c. There are several other functions in that header that should probably be moved over from chan_sip.c later.
The parser function for the nat= setting was added to channels/sip/config_parser.c. I added a unit test for it as well.</pre>
</td>
</tr>
</table>
<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;">First, this patch as originally posted is from JIRA user pedro-garcia. It has been in JIRA for a long while, and has finally come up to be considered. There were some changes that I wanted to made to the original patch, so I tried contacting the author to get them to put the patch on reviewboard, but after a week I got no response. So, I'm putting the original patch up, then will immediately add a review with my changes. Many thanks to pedro-garcia for his contribution.
>From the JIRA issue:
I have some devices in the following scenario:
Asterisk server with public IP address
Mobile devices (clients):
When in internal network, no NAT between the client and the server
When in "roaming" (i.e. a Hotel with WiFi), the client is behing a NAT
When in 3G, operator transparent sip proxy so it looks as no NAT, but does not support symmetric RTP.
Sometime, the device gets a public IP with no NAT at all.
No NAT setting available in asterisk works for all these scenarios at the same time, and I can not request the user to activate different accounts depending on its location.
I have added a new NAT setting (nat=auto) to the current ones. When set, chan_sip auto detects from the Via header, the recv sockaddr, and the rport setting if the client is behind a NAT.
It also adds to cli interface results (sip show peer/s) info on this (so now you could see "N" for NAT and nothing for no NAT as before, "a" for auto detect no NAT, and "A" for autodetect NAT.</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;">Lots of reloads with changing values, and registry natted and un-natted phones. I also set the nat_supertest in testsuite to run with nat=auto to make sure that it responded the same with existing and non-existing peers.</pre>
</td>
</tr>
</table>
<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-17860">ASTERISK-17860</a>
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> (updated)</h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/configs/sip.conf.sample <span style="color: grey">(354465)</span></li>
<li>/trunk/channels/sip/config_parser.c <span style="color: grey">(354465)</span></li>
<li>/trunk/channels/sip/include/config_parser.h <span style="color: grey">(354465)</span></li>
<li>/trunk/channels/sip/include/sip.h <span style="color: grey">(354465)</span></li>
<li>/trunk/channels/sip/include/sip_utils.h <span style="color: grey">(354465)</span></li>
<li>/trunk/channels/sip/utils.c <span style="color: grey">(PRE-CREATION)</span></li>
<li>/trunk/CHANGES <span style="color: grey">(354465)</span></li>
<li>/trunk/channels/chan_sip.c <span style="color: grey">(354465)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/1698/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>