<div dir="ltr">Hi,<div><br></div><div>I noticed that it was impossible to set nat=force_rport in the general section. It actually has no effect when issuing cli command "sip show settings" (result is Force rport: Auto (No).</div>
<div><br></div><div>So I digged into the code and found this:<br clear="all"><div><br></div><div><font face="courier new, monospace">channels/sip/config_parser.c:818</font></div><div><font face="courier new, monospace"><br>
</font></div><div><div><font face="courier new, monospace">} else if (!strcasecmp(this, "force_rport") && !ast_test_flag(&flags[2], SIP_PAGE3_NAT_AUTO_RPORT)) {</font></div></div><div><font face="courier new, monospace"> </font>ast_set_flag(&flags[0], SIP_NAT_FORCE_RPORT);</div>
<div><br></div><div><br></div><div style>Set I guess this will set the force_rport only if auto_force_rport is not already set.</div><div><br></div><div style>Digging a little deeper, I found this:</div><div><br></div><div style>
<font face="courier new, monospace">channels/chan_sip.c:31144</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">ast_set_flag(&global_flags[2], SIP_PAGE3_NAT_AUTO_RPORT); /*!< Default to nat=auto_force_rport */</font><br>
</div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">...<br></font></div><div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">/* Read the [general] config section of sip.conf (or from realtime config) */</font></div>
<div><font face="courier new, monospace"> for (v = ast_variable_browse(cfg, "general"); v; v = v->next) {</font></div><div><font face="courier new, monospace"> if (handle_common_options(&global_flags[0], &dummy[0], v)) {</font></div>
</div><div><br></div><div style>and then handle_common_options calls sip_parse_nat_option (which near line 818 of config_parser.c) if it finds the "nat" variable.</div><div><br></div><div></div>
</div><div style>So, considering that config_parser is doing it's job in the [general] context, it gets impossible for a user (e.g. me) to raise the flag SIP_NAT_FORCE_RPORT since the global flag SIP_PAGE3_NAT_AUTO_RPORT was set at the beginning of the reload am I right? And if I am, is it the behavior you guys wanted?</div>
<div style><br></div><div style>I'm on Asterisk 11.2.1. I also checked out the trunk and the SIP_PAGE3_NAT_AUTO_RPORT flag is still set in global_flags.</div><div><br></div><div style>Thanks</div></div>