set_advertised_address usage

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

set_advertised_address usage

OpenSIPS - Users mailing list
Hi list

I'm trying to use set_advertised_address(); function
in onreply_route

but I see that nothing changes.

[VoIP ISP] <--- [NAT box x.x.116.2] <--- [OpenSIPS 10.45.144.77] <--- [other VoIP server 10.1.30.12]


This is a sip debug, 180 Ringing, leaving OpenSIPS towards Internet:
http://rgho.st/private/7lxQHLFgz/c0af9edb35c175a8dba80228f31ba7a2

I think some addresses should be re-written here, but they are not,
as we see 10.1.30.12 in some headers.

By the way, the next 200 OK with SDP has correct IP address in SDP (as I set it
using rtpengine_answer(... media-address=x.x.116.2). So, I'm sure that I use
set_advertised_address() in the right place. But why it does not change the message?

onreply_route {
    set_advertised_address(x.x.116.2);

    if (has_body("application/sdp")) {
        # rewrite SDP for replies within calls from PBX
        if ($fd=="pbx. ... .ru") {
            rtpengine_answer("RTP/AVP replace-origin replace-session-connection ICE=remove to-tag");
        } else {
            # fix external address and rewrite SDP for replies within calls from VoIP ISP
        rtpengine_answer("RTP/AVP media-address=x.x.116.2 replace-origin replace-session-connection ICE=remove");
        }
    }
}

 



-----------------------------------------------
BR, Alexey
http://alexeyka.zantsev.com/
_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: set_advertised_address usage

OpenSIPS - Users mailing list
Just added some lines to route[relay].
Thanks to Kirill Galinurov.

Not ideal in some cases but mostly what I need.

route[relay] {
  # for INVITEs enable some additional helper routes
  if (is_method("INVITE")) {
    t_on_branch("per_branch_ops");
    t_on_reply("handle_nat");
    t_on_failure("missed_call");
  }

  # fix address in Record-Route if this is a 100/200 reply to Multifon // this is only until OpenSIPS is behind NAT!
  if($td=="multifon.ru") {
    set_advertised_address("x.X.116.2");
  }

  if (!t_relay()) {
    send_reply("500","Internal Error");
  };
  exit;
}




-----------------------------------------------
BR, Alexey
http://alexeyka.zantsev.com/
_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: set_advertised_address usage

Ben Newlin
In reply to this post by OpenSIPS - Users mailing list

I don’t believe you can do that in a reply route because all the headers are already in the message. No new headers or addresses are being inserted. You need to use set_advertised_address() on the original request so that the addresses are inserted in the request properly.

 

Ben Newlin

 

From: Users <[hidden email]> on behalf of Alexey Kazantsev via Users <[hidden email]>
Reply-To: Alexey Kazantsev <[hidden email]>, OpenSIPS users mailling list <[hidden email]>
Date: Thursday, January 17, 2019 at 6:20 AM
To: "[hidden email]" <[hidden email]>
Subject: [OpenSIPS-Users] set_advertised_address usage

 

Hi list

I'm trying to use set_advertised_address(); function
in onreply_route

but I see that nothing changes.

[VoIP ISP] <--- [NAT box x.x.116.2] <--- [OpenSIPS 10.45.144.77] <--- [other VoIP server 10.1.30.12]


This is a sip debug, 180 Ringing, leaving OpenSIPS towards Internet:
http://rgho.st/private/7lxQHLFgz/c0af9edb35c175a8dba80228f31ba7a2

I think some addresses should be re-written here, but they are not,
as we see 10.1.30.12 in some headers.

By the way, the next 200 OK with SDP has correct IP address in SDP (as I set it
using rtpengine_answer(... media-address=x.x.116.2). So, I'm sure that I use
set_advertised_address() in the right place. But why it does not change the message?

onreply_route {
    set_advertised_address(x.x.116.2);

    if (has_body("application/sdp")) {
        # rewrite SDP for replies within calls from PBX
        if ($fd=="pbx. ... .ru") {
            rtpengine_answer("RTP/AVP replace-origin replace-session-connection ICE=remove to-tag");
        } else {
            # fix external address and rewrite SDP for replies within calls from VoIP ISP
        rtpengine_answer("RTP/AVP media-address=x.x.116.2 replace-origin replace-session-connection ICE=remove");
        }
    }
}

 



-----------------------------------------------
BR, Alexey
http://alexeyka.zantsev.com/


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