<div dir="ltr"><div dir="ltr">Hello! I had a similar problem some time ago, when I moved from 2.2 to 2.4 version.<div>In my case Opensips is acting as a "register proxy", it validates IP/port from the outside world using permissions module  and it maps to a username/password to a UAS in the internal network. I use it for UAC's that cannot register (or cannot have credentials) but have a public fixed IP address, in this way I simulate a registration from the enduser and opensips responds to the INVITE challenge using uac_auth/uac modules as a client. </div><div><br></div><div>So, an INVITE arrives to opensips, then opensips relays it to internal Registrar Server. Registrar server replies a "SIP 407 Proxy Authentication", opensips catch it in failure_route and generates the auth response using uac_auth().</div><div><br></div><div>This was working fine in version 2.2 using fix_nated_contact() and topology_hiding(). When I moved to 2.4, the fix_nated_contact() seems to change contact twice: in the first INVITE relayed to de Registrar Server (that's ok!), but also when it generates the self generated authenticated INVITE.</div><div><br></div><div><br></div><div>I searched in my old emails and I founded some debug logs in the first INVITE (contact changed from private to public)</div><div><pre class="gmail-code gmail-highlight" lang="plaintext"><span id="gmail-LC1" class="gmail-line" lang="plaintext">18:15:22.245403-03:00 DBG:dialog:dlg_update_contact: Replacing old contact <<a href="http://sip:3304@192.168.20.70:6060">sip:3304@192.168.20.70:6060</a>> for dialog 0x7f8ab6a8c808 on leg 0</span>
<span id="gmail-LC2" class="gmail-line" lang="plaintext">18:15:22.245409-03:00 DBG:dialog:dlg_update_contact: Updated contact to <<a href="http://sip:3304@143.208.44.38:6060">sip:3304@143.208.44.38:6060</a>> for dialog 0x7f8ab6a8c808 on leg 0</span>
</pre></div><div><br></div><div>but on the self generated INVITE, contact is changed again (from public to private)</div><div><pre class="gmail-code gmail-highlight" lang="plaintext"><span id="gmail-LC1" class="gmail-line" lang="plaintext">18:15:22.252208-03:00 /home/gc/local/regproxy/sbin/opensips[335]: DBG:dialog:dlg_update_contact: Replacing old contact <<a href="http://sip:3304@143.208.44.38:6060">sip:3304@143.208.44.38:6060</a>> for dialog 0x7f8ab6a8c808 on leg 0</span>
<span id="gmail-LC2" class="gmail-line" lang="plaintext">18:15:22.252212-03:00 /home/gc/local/regproxy/sbin/opensips[335]: DBG:dialog:dlg_update_contact: Updated contact to <<a href="http://sip:3304@192.168.20.70:6060">sip:3304@192.168.20.70:6060</a>> for dialog 0x7f8ab6a8c808 on leg 0</span>
</pre></div><div><br></div><div>Turning off topology_hiding(), solves the issue and contact is only changed once. I tried to look into the code following the dlg_update_contact function, what I'd noticed comparing 2.2 and 2.4 version is that in 2.2 something is saved in th_sent_contact field, so that decided me to turn topology_hiding off as a workaround.</div><div><br></div><div><a href="https://github.com/OpenSIPS/opensips/blob/2.2/modules/dialog/dlg_handlers.c#L1148-L1164">https://github.com/OpenSIPS/opensips/blob/2.2/modules/dialog/dlg_handlers.c#L1148-L1164</a><br></div><div><a href="https://github.com/OpenSIPS/opensips/blob/2.4/modules/dialog/dlg_handlers.c#L1177-L1188">https://github.com/OpenSIPS/opensips/blob/2.4/modules/dialog/dlg_handlers.c#L1177-L1188</a><br></div><div><br></div><div><br></div><div>Hope it helps, hope I didn't make you waste time :)</div><div><br></div><div>Federico</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 29, 2020 at 10:43 AM Jeff Pyle <<a href="mailto:jeff@ugnd.org">jeff@ugnd.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Yes, and only when topology_hiding() is called later.  No t_newtran().<div><br></div><div>How can one see the fixed Contact in the script?  I've tried xlog with $ct, but that always shows the original one.  I know it's being lost (or not) only by looking at callee_contact from dlg_list.  If I can see the updated one I can be more precise about where I'm losing it.<br><div><br></div><div><br></div><div>- Jeff</div><div><br></div><div><div><br></div><div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 29, 2020 at 5:45 AM Răzvan Crainea <<a href="mailto:razvan@opensips.org" target="_blank">razvan@opensips.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi, Jeff!<br>
<br>
So you're claiming that the updated contact is lost even if you call <br>
fix_nated_contact() before topology_hiding(), but only for the second <br>
branch? Are you calling t_newtran() anywhere in your script?<br>
<br>
Best regards,<br>
<br>
Răzvan Crainea<br>
OpenSIPS Core Developer<br>
<a href="http://www.opensips-solutions.com" rel="noreferrer" target="_blank">http://www.opensips-solutions.com</a><br>
<br>
On 10/28/20 8:30 PM, Jeff Pyle wrote:<br>
> Liviu,<br>
> <br>
> It looks like the fixed/update contact is lost only when <br>
> topology_hiding() is involved.  Would you prefer a separate issue, or <br>
> shall I append the issue you referenced before?<br>
> <br>
> <br>
> - Jeff<br>
> <br>
> <br>
> On Wed, Oct 28, 2020 at 2:15 PM Jeff Pyle <<a href="mailto:jeff@ugnd.org" target="_blank">jeff@ugnd.org</a> <br>
> <mailto:<a href="mailto:jeff@ugnd.org" target="_blank">jeff@ugnd.org</a>>> wrote:<br>
> <br>
>     Hey Liviu,<br>
> <br>
>     fix_nated_contact() before topology_hiding().  Got it.  As far as<br>
>     losing the fixed contact during a serial fork, I'll do more testing<br>
>     to localize exactly which combination of circumstances causes this<br>
>     to surface and open a bug report.<br>
> <br>
> <br>
>     - Jeff<br>
> <br>
> <br>
>     On Wed, Oct 28, 2020 at 1:28 PM Liviu Chircu <<a href="mailto:liviu@opensips.org" target="_blank">liviu@opensips.org</a><br>
>     <mailto:<a href="mailto:liviu@opensips.org" target="_blank">liviu@opensips.org</a>>> wrote:<br>
> <br>
>         Hi!<br>
> <br>
>         On 28.10.2020 18:49, Jeff Pyle wrote:<br>
>>         First, I lose the updated Contact from fix_nated_contact()<br>
>>         after a serial fork.  Is this expected?<br>
>         I would assume the `fix_nated_contact()` lump changes get backed<br>
>         up into shared memory, then made available during the<br>
>         failure_route. Anything else and IMHO it looks like a bug. <br>
>         Opinions welcome.<br>
>><br>
>>         Second, I've determined that if the Contact URI is not wrapped<br>
>>         in <>, that's when I get the "second attempt to change URI<br>
>>         Contact" error when running fix_nated_contact() in the<br>
>>         branch_route[]. This feels like a bug.<br>
> <br>
>         This one is a known, documented issue.  Long story short: you<br>
>         should always call fix_nated_contact() _before_<br>
>         topology_hiding().  See this truth table for more info [1].<br>
> <br>
>         [1]: <a href="https://github.com/OpenSIPS/opensips/issues/2172" rel="noreferrer" target="_blank">https://github.com/OpenSIPS/opensips/issues/2172</a><br>
> <br>
>         -- <br>
>         Liviu Chircu<br>
>         <a href="http://www.twitter.com/liviuchircu" rel="noreferrer" target="_blank">www.twitter.com/liviuchircu</a>  <<a href="http://www.twitter.com/liviuchircu" rel="noreferrer" target="_blank">http://www.twitter.com/liviuchircu</a>>  |<a href="http://www.opensips-solutions.com" rel="noreferrer" target="_blank">www.opensips-solutions.com</a>  <<a href="http://www.opensips-solutions.com" rel="noreferrer" target="_blank">http://www.opensips-solutions.com</a>><br>
> <br>
>         _______________________________________________<br>
>         Users mailing list<br>
>         <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a> <mailto:<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a>><br>
>         <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
> <br>
> <br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
> <br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div></div>