[OpenSIPS-Users] nathelper and mid_register

Liviu Chircu liviu at opensips.org
Fri Oct 27 04:40:08 EDT 2017

Hi Jim,

Both functions attempt to rewrite the Contact - the former with 
SOURCE_IP:SOURCE_PORT, while the latter attempts to do it with 
ADV_IP:ADV_PORT. Due to the "lazy changes" optimization of the OpenSIPS 
stack, you cannot serialize these two function calls, rather you are 
forced to pick one of them.

Fortunately, there is another way around the above: you can have the 
mid-registrar insert itself through a Path header, rather than rewriting 
the Contact to point to its interface. So just switch the mid_registrar 
to "insertion_mode = 1" and you should be good.

PS: can you elaborate on what you are trying to achieve? IIRC, 
fix_nated_contact() should not be called on a REGISTER, rather you 
should use the fix_nated_register() which forces a ";received=" param 
into the Contact. Conceptually, at least - I'm pretty sure this also 
won't work well with mid_registrar_save().

Best regards,

Liviu Chircu
OpenSIPS Developer

On 26.10.2017 17:08, Jim DeVito wrote:
> Hi All,
> So if I call fix_nated_contact(); before mid_registrar_save(); It will 
> correctly rewrite the Contact URI with the recived IP:PORT however it 
> mid_register is then not able to append the contact_match_param to the 
> new Contact URI.
> The script looks like this...
> if (is_method("REGISTER")) {
>                 fix_nated_contact();
>                 mid_registrar_save("location");
> It fails with this error.
> ERROR:mid_registrar:overwrite_all_contact_hostports: SCRIPT BUG - 
> second attempt to change URI Contact
> ERROR:mid_registrar:mid_reg_req_fwded: failed to overwrite Contact URI
> Thoughts? And Thanks!!
> -------------
> Jim DeVito
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20171027/3bb9ac82/attachment.html>

More information about the Users mailing list