<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="color:black">Ben Newlin </span><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">Users <users-bounces@lists.opensips.org> on behalf of Alexey Kazantsev via Users <users@lists.opensips.org><br>
<b>Reply-To: </b>Alexey Kazantsev <kurgan-rus@inbox.ru>, OpenSIPS users mailling list <users@lists.opensips.org><br>
<b>Date: </b>Thursday, January 17, 2019 at 6:20 AM<br>
<b>To: </b>"users@lists.opensips.org" <users@lists.opensips.org><br>
<b>Subject: </b>[OpenSIPS-Users] set_advertised_address usage<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Hi list<br>
<br>
I'm trying to use set_advertised_address(); function<br>
in onreply_route<br>
<br>
but I see that nothing changes.<br>
<br>
[VoIP ISP] <--- [NAT box x.x.116.2] <--- [OpenSIPS 10.45.144.77] <--- [other VoIP server 10.1.30.12]<br>
<br>
<br>
This is a sip debug, 180 Ringing, leaving OpenSIPS towards Internet:<br>
<a href="http://rgho.st/private/7lxQHLFgz/c0af9edb35c175a8dba80228f31ba7a2">http://rgho.st/private/7lxQHLFgz/c0af9edb35c175a8dba80228f31ba7a2</a><br>
<br>
I think some addresses should be re-written here, but they are not,<br>
as we see 10.1.30.12 in some headers.<br>
<br>
By the way, the next 200 OK with SDP has correct IP address in SDP (as I set it<br>
using rtpengine_answer(... media-address=x.x.116.2). So, I'm sure that I use<br>
set_advertised_address() in the right place. But why it does not change the message?<o:p></o:p></p>
<p>onreply_route {<br>
set_advertised_address(x.x.116.2);<o:p></o:p></p>
<p> if (has_body("application/sdp")) {<br>
# rewrite SDP for replies within calls from PBX<br>
if ($fd=="pbx. ... .ru") {<br>
rtpengine_answer("RTP/AVP replace-origin replace-session-connection ICE=remove to-tag");<br>
} else {<br>
# fix external address and rewrite SDP for replies within calls from VoIP ISP<br>
rtpengine_answer("RTP/AVP media-address=x.x.116.2 replace-origin replace-session-connection ICE=remove");<br>
}<br>
}<br>
}<o:p></o:p></p>
<p> <o:p></o:p></p>
<p class="MsoNormal"><br>
<br>
-----------------------------------------------<br>
<span style="font-size:11.5pt">BR, Alexey<br>
<a href="http://alexeyka.zantsev.com/">http://alexeyka.zantsev.com/</a></span>
<o:p></o:p></p>
</div>
</body>
</html>