For that to work, you should do fix_nated_register() instead of fix_nated_contact(), while switching mid_registrar to "insertion_mode = 1".

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 27.10.2017 17:23, Jim DeVito wrote:
HI Liviu,
I am trying to deal with NAT while OpenSIPS is acting as the mid-register. The problem is that unless I use fix_nated_contact() mid_register saves the private IP address in the location "table" so when an INVITE comes from the main registrar OpenSIPS is unable to route it. Still trying to figure out how to make that work.
Thanks!!

On Fri, Oct 27, 2017 at 4:40 AM, Liviu Chircu <[email protected] <mailto:[email protected]>> wrote:

    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
    http://www.opensips-solutions.com <http://www.opensips-solutions.com>

    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
    [email protected] <mailto:[email protected]>
    http://lists.opensips.org/cgi-bin/mailman/listinfo/users
    <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>


    _______________________________________________
    Users mailing list
    [email protected] <mailto:[email protected]>
    http://lists.opensips.org/cgi-bin/mailman/listinfo/users
    <http://lists.opensips.org/cgi-bin/mailman/listinfo/users>




--
-------------
Jim DeVito
Mobile 216.507.9497


_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to