<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<font face="monospace">Hi,<br>
<br>
You can have a socket on the private interface (behind NAT) which
is advertising in the outbound SIP packages a different IP address
(the public IP of the NAT , for example) than the one of the
socket.<br>
<br>
Isn't this what you were asking for?<br>
<br>
Regards,<br>
</font>
<pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
<a class="moz-txt-link-freetext" href="https://www.siphub.com">https://www.siphub.com</a></pre>
<div class="moz-cite-prefix">On 02.04.2025 15:32, Antonios Psaras
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:264401dba3cb$5b332a50$11997ef0$@microbase.gr">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator"
content="Microsoft Word 15 (filtered medium)">
<style>@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;}@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
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;}pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}div.WordSection1
{page:WordSection1;}</style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">Thank you Bogdan.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I can not see how advertise option will be
use in that case.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">We use the socket option and my question is
if I can handle that within the script.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Ie.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">socket = udp:10.0.0.10:5060 as 1.2.3.4:5060<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">if source_ip=~”^10.”<o:p></o:p></p>
<p class="MsoNormal"> Do not use NAT IP on header<o:p></o:p></p>
<p class="MsoNormal">else<o:p></o:p></p>
<p class="MsoNormal"> User it.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div
style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b>From:</b> Bogdan-Andrei Iancu
<a class="moz-txt-link-rfc2396E" href="mailto:bogdan@opensips.org"><bogdan@opensips.org></a> <br>
<b>Sent:</b> Τετάρτη, 2 Απριλίου 2025 15:03<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:apsaras@microbase.gr">apsaras@microbase.gr</a>; OpenSIPS users mailling
list <a class="moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org"><users@lists.opensips.org></a>; 'Johan De Clercq'
<a class="moz-txt-link-rfc2396E" href="mailto:Johan@democon.be"><Johan@democon.be></a><br>
<b>Subject:</b> Re: [OpenSIPS-Users] mhomed OpenSIPs
behind NAT - How to control NAT IP<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span
style="font-family:"Courier New"">Hi Antonioss,<br>
<br>
See the "advertise" option - there is a global one, or a
per-socket on:<br>
<a
href="https://www.opensips.org/Documentation/Script-CoreParameters-3-5#advertised_address"
moz-do-not-send="true" class="moz-txt-link-freetext">https://www.opensips.org/Documentation/Script-CoreParameters-3-5#advertised_address</a><br>
<a
href="https://www.opensips.org/Documentation/Script-CoreParameters-3-5#socket"
moz-do-not-send="true" class="moz-txt-link-freetext">https://www.opensips.org/Documentation/Script-CoreParameters-3-5#socket</a>
(the AS option)<br>
<br>
Regards,<br>
<br>
</span><o:p></o:p></p>
<pre>Bogdan-Andrei Iancu<o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre>OpenSIPS Founder and Developer<o:p></o:p></pre>
<pre> <a href="https://www.opensips-solutions.com"
moz-do-not-send="true" class="moz-txt-link-freetext">https://www.opensips-solutions.com</a><o:p></o:p></pre>
<pre> <a href="https://www.siphub.com" moz-do-not-send="true"
class="moz-txt-link-freetext">https://www.siphub.com</a><o:p></o:p></pre>
<div>
<p class="MsoNormal">On 02.04.2025 15:00, Antonios Psaras
wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">Hello Johan<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Thank you for your prompt reply.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">My question is how do I force opensips
not to use NAT IP which is defined on socket level?<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">As you mention rtpengine as well, what
flags should I pass in order not to use the NAT IP which is
also defined as configuration on “external” interface.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Thank you once more for your support.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"
style="mso-margin-top-alt:0cm;margin-right:1.0pt;margin-bottom:5.0pt;margin-left:1.0pt"><b><span
style="color:#5F5F5F">Antonis Psaras</span></b><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"><b>From:</b> Johan De Clercq <a
href="mailto:Johan@democon.be" moz-do-not-send="true"><Johan@democon.be></a>
<br>
<b>Sent:</b> Τετάρτη, 2 Απριλίου 2025 13:23<br>
<b>To:</b> <a href="mailto:apsaras@microbase.gr"
moz-do-not-send="true" class="moz-txt-link-freetext">apsaras@microbase.gr</a>;
OpenSIPS users mailling list <a
href="mailto:users@lists.opensips.org"
moz-do-not-send="true"><users@lists.opensips.org></a><br>
<b>Subject:</b> Re: [OpenSIPS-Users] mhomed OpenSIPs behind
NAT - How to control NAT IP<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<p class="MsoNormal">Antonias, <o:p></o:p></p>
<div>
<p class="MsoNormal">yes you can. You need to if then
else the stuff. if $si==1.2.34 then use nat <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">
else don't use nat.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Note, not only for opensips headers,
but you will also need different flags for rtpengine. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal">Op wo 2 apr 2025 om 11:35 schreef
Antonios Psaras <<a
href="mailto:apsaras@microbase.gr"
moz-do-not-send="true" class="moz-txt-link-freetext">apsaras@microbase.gr</a>>:<o:p></o:p></p>
</div>
<blockquote
style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
<div>
<div>
<div>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Dear all.<o:p></o:p></p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I have the
following setup.<o:p></o:p></p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">OpenSIPs
Server has two interfaces (DMZ / LAN). DMZ is
behind NAT. RTP Engines is also configured.<o:p></o:p></p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Everything
was fine until an end point with in DMZ asked for
SIP Trunking. The issue here is that if DMZ Client
tries to connect to OpenSIPs DMZ interface,
OpenSIPs will reply with NAT IP on SIP body as
well as NAT IP on SDP.<o:p></o:p></p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">My thought is
to create an other socket on DMZ interface with a
different port without NAT configuration and ask
the DMZ Client to connect on that interface. That
will required extra configuration per peer as I
will need to specify the preferred communication
socket ie on load balancing configuration.
Moreover I should configure a new RTPEngine
Service without NAT configuration and route those
calls to that one. <o:p></o:p></p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Most probably
the above scenario will work but I am looking for
any alternatives to minimize configuration and
complexity. <o:p></o:p></p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Is there any
way to control the usage of NAT IP on OpenSIPs
script. Ie if source IP is with in DMZ do not send
NAT IP in SIP Headers.<o:p></o:p></p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Regards<o:p></o:p></p>
<p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">Users@lists.opensips.org</a><br>
<a
href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><br>
<br>
<o:p></o:p></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>Users mailing list<o:p></o:p></pre>
<pre><a href="mailto:Users@lists.opensips.org"
moz-do-not-send="true" class="moz-txt-link-freetext">Users@lists.opensips.org</a><o:p></o:p></pre>
<pre><a
href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
moz-do-not-send="true" class="moz-txt-link-freetext">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</blockquote>
<br>
</body>
</html>