[OpenSIPS-Users] SUBSCRIBE & NOTIFY - NAT Problems

Samuel Anderson sanderson at ArnoldMagnetics.com
Thu Jun 25 23:58:55 EST 2020

Hi Everyone,

I figured it out. I needed to add fix_nated_contact() on the reply route for the notify messages. The 200 OK messages were overwriting the contact from the corrected SUBSCRIBE request. After doing this, OpenSIPS now sends the NOTIFY messages to the correct address.

        if (has_totag()) {
                if (topology_hiding_match()) {
                        xlog("Successfully matched this request to a topology hiding dialog. \n");
                        xlog("Calller side callid is $ci \n");
                        xlog("Callee side callid  is $TH_callee_callid \n");
                        if (is_method("NOTIFY")){

onreply_route[NOTIFYReply] {

        #NAT for 200 OK replys
        if (t_check_status("(200)")) {

Thank you,

-Sam Anderson

-----Original Message-----
From: Samuel Anderson 
Sent: Thursday, June 25, 2020 5:29 PM
To: 'users at lists.opensips.org' <users at lists.opensips.org>
Subject: SUBSCRIBE & NOTIFY - NAT Problems

Hi Everyone,

I use OpenSIPS as an SBC for an Asterisk server. The OpenSIPS server is multi-homed and has an interface on the WAN and DMZ. I'm able to make calls and send sequential requests in a dialog, such as INVITEs and BYEs, from endpoints behind NAT without any issues. My problem is when the endpoints try to  SUBSCRIBE, and Asterisk sends a NOTIFY message back. OpenSIPS is sending the NOTIFY to the original contact header specified in the SUBSCRIBE request. It is not sending the NOTIFY to the address it received it from. It does rewrite the contact header when the SUBSCRIBE message is sent to Asterisk, and OpenSIPS also sends the 200 OK reply to the correct address.

How can I configure OpenSIPS to send the additional NOTIFY messages within the dialog to the address it received it from? I've tried to create a dialog for SUBSCRIBE requests, but it looks like that only works for INVITEs. Any help would be appreciated. It currently works fine with INVITEs and BYEs.

I use double record routes, topology hiding, and the dialog module. I also set "fix_nated_contact" when the SUBSCRIBE is received.

Thank you for your assistance.


This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this message
immediately if this is an electronic communication.

Thank you.

More information about the Users mailing list