<div dir="ltr">I am not sure, but seems you are sending calls to the same IP that you have on Opensips? like SIP -> IP_A (opensips) -> IP_B(OPensips).<div>if you want to send a call through an external interface just send call to some external IP (like sethost("ANY EXTERNAL IP");) and opensips will do that with an interface like unix do. <br><p class="MsoNormal"><br>socket=udp:enp1s0:5060 # INTERNAL_INTERFACE (192.168.1.2)</p><p class="MsoNormal"><span style="text-indent:36pt">socket=udp:enp2s0:5060 # EXTERNAL_INTERFACE (DHCP)</span></p><p class="MsoNormal" style="text-indent:36pt"><u></u></p><p class="MsoNormal"> .<u></u><u></u></p><p class="MsoNormal"> .<u></u><u></u></p><p class="MsoNormal"> # From Internal to External<u></u><u></u></p><p class="MsoNormal"> # Testing one number only first 634 to 605<u></u><u></u></p><p class="MsoNormal"> if ($rU=~"^605") {<u></u><u></u></p><p class="MsoNormal"> sethostport("EXTERNAL_IP:5060");<u></u><u></u></p><p class="MsoNormal"> $socket_out = "udp:EXTERNAL_IP:5060";<u></u><u></u></p><p class="MsoNormal">...</p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"> # From External to internal<u></u><u></u></p><p class="MsoNormal"> # Testing one number only first 605 to 634<u></u><u></u></p><p class="MsoNormal" style="text-indent:36pt">if ($rU=~"^634"){<u></u><u></u></p><p class="MsoNormal"> sethostport("<a href="http://192.168.1.2:5060/" target="_blank">192.168.1.2:5060</a>");<u></u><u></u></p><p class="MsoNormal"> $socket_out = "udp:<a href="http://192.168.1.2:5060/" target="_blank">192.168.1.2:5060</a>";</p><p class="MsoNormal">...</p></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">чт, 18 нояб. 2021 г. в 07:53, Muhamad Putra Abdullah <<a href="mailto:m.putra77@outlook.com">m.putra77@outlook.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-MY" style="overflow-wrap: break-word;">
<div class="gmail-m_-5649458197337902443WordSection1">
<p class="MsoNormal"><span>Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>Ok. I’m totally in learning process.
<u></u><u></u></span></p>
<p class="MsoNormal"><span>Let me explain my test deployment. I have 2 separate network that connected via opensips server.<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>Internal SIP Server Opensips Server (2 NIC) External SIP Server<u></u><u></u></span></p>
<p class="MsoNormal"><span>(User 634) 192.168.1.1 - - - - - - - - 192.168.1.2 | (EXTERNAL_IP) DHCP IP - - - - - - - - 172.16.16.1 (User 605)<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>What my intension is to relay calls between Internal and External SIP server via Opensips server.<u></u><u></u></span></p>
<p class="MsoNormal"><span>I use this method to achieve this:<u></u><u></u></span></p>
<p class="MsoNormal"><span> <u></u>
<u></u></span></p>
<p class="MsoNormal"><span> socket=udp:enp1s0:5060 # INTERNAL_INTERFACE (192.168.1.2)<u></u><u></u></span></p>
<p class="MsoNormal" style="text-indent:36pt"><span>socket=udp:enp2s0:5060 # EXTERNAL_INTERFACE (DHCP)<u></u><u></u></span></p>
<p class="MsoNormal"><span> .<u></u><u></u></span></p>
<p class="MsoNormal"><span> .<u></u><u></u></span></p>
<p class="MsoNormal"><span> # From Internal to External<u></u><u></u></span></p>
<p class="MsoNormal"><span> # Testing one number only first 634 to 605<u></u><u></u></span></p>
<p class="MsoNormal"><span> if ($rU=~"^605") {
<u></u><u></u></span></p>
<p class="MsoNormal"><span> sethostport("EXTERNAL_IP:5060");<u></u><u></u></span></p>
<p class="MsoNormal"><span> $socket_out = "udp:EXTERNAL_IP:5060";<u></u><u></u></span></p>
<p class="MsoNormal"><span> rtpproxy_engage("ier");<u></u><u></u></span></p>
<p class="MsoNormal"><span> route(relay);<u></u><u></u></span></p>
<p class="MsoNormal"><span> exit;<u></u><u></u></span></p>
<p class="MsoNormal"><span> }<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span> # From External to internal<u></u><u></u></span></p>
<p class="MsoNormal"><span> # Testing one number only first 605 to 634<u></u><u></u></span></p>
<p class="MsoNormal" style="text-indent:36pt"><span>if ($rU=~"^634"){
<u></u><u></u></span></p>
<p class="MsoNormal"><span> sethostport("<a href="http://192.168.1.2:5060" target="_blank">192.168.1.2:5060</a>");<u></u><u></u></span></p>
<p class="MsoNormal"><span> $socket_out = "udp:<a href="http://192.168.1.2:5060" target="_blank">192.168.1.2:5060</a>";<u></u><u></u></span></p>
<p class="MsoNormal"><span> rtpproxy_engage("eir");<u></u><u></u></span></p>
<p class="MsoNormal"><span> route(relay);<u></u><u></u></span></p>
<p class="MsoNormal"><span> exit;<u></u><u></u></span></p>
<p class="MsoNormal"><span> }<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>I have no problem on call from external to internal because I know the IP address of internal opensips server, the problem is call from internal to external.<u></u><u></u></span></p>
<p class="MsoNormal"><span>Is there better solutions than this?<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>Regards
<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Bogdan-Andrei Iancu <<a href="mailto:bogdan@opensips.org" target="_blank">bogdan@opensips.org</a>>
<br>
<b>Sent:</b> Wednesday, 17 November, 2021 8:24 PM<br>
<b>To:</b> Muhamad Putra Abdullah <<a href="mailto:m.putra77@outlook.com" target="_blank">m.putra77@outlook.com</a>>; OpenSIPS users mailling list <<a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a>><br>
<b>Subject:</b> Re: [OpenSIPS-Users] How to get all listening socket IP address as variable<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="font-family:"Courier New",serif">If so, when you receive a request on the external IP, the $socket_in(ip) should return the actual DHCP IP.<br>
<br>
Regards,<br>
<br>
</span><u></u><u></u></p>
<pre>Bogdan-Andrei Iancu<u></u><u></u></pre>
<pre><u></u> <u></u></pre>
<pre>OpenSIPS Founder and Developer<u></u><u></u></pre>
<pre> <a href="https://www.opensips-solutions.com" target="_blank">https://www.opensips-solutions.com</a><u></u><u></u></pre>
<pre>OpenSIPS eBootcamp 2021 <u></u><u></u></pre>
<pre> <a href="https://opensips.org/training/OpenSIPS_eBootcamp_2021/" target="_blank">https://opensips.org/training/OpenSIPS_eBootcamp_2021/</a><u></u><u></u></pre>
<div>
<p class="MsoNormal">On 11/17/21 10:21 AM, Muhamad Putra Abdullah wrote:<u></u><u></u></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<p class="MsoNormal"><span>Hi,</span><u></u><u></u></p>
<p class="MsoNormal"><span> </span><u></u><u></u></p>
<p class="MsoNormal"><span>socket=udp:enp1s0:5060 tag INTERNAL_IP # CUSTOMIZE ME</span><u></u><u></u></p>
<p class="MsoNormal"><span>socket=udp:enp2s0:5060 tag EXTERNAL_IP # CUSTOMIZE ME</span><u></u><u></u></p>
<p class="MsoNormal"><span> </span><u></u><u></u></p>
<p class="MsoNormal"><span>My INTERNAL_IP is set to static and EXTERNAL_IP set to DHCP. I just use tag to test something.</span><u></u><u></u></p>
<p class="MsoNormal"><span> </span><u></u><u></u></p>
<p class="MsoNormal"><span>Regards</span><u></u><u></u></p>
<p class="MsoNormal"><span> </span><u></u><u></u></p>
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Bogdan-Andrei Iancu
<a href="mailto:bogdan@opensips.org" target="_blank"><bogdan@opensips.org></a> <br>
<b>Sent:</b> Wednesday, 17 November, 2021 3:55 PM<br>
<b>To:</b> Muhamad Putra Abdullah <a href="mailto:m.putra77@outlook.com" target="_blank"><m.putra77@outlook.com></a>; OpenSIPS users mailling list
<a href="mailto:users@lists.opensips.org" target="_blank"><users@lists.opensips.org></a><br>
<b>Subject:</b> Re: [OpenSIPS-Users] How to get all listening socket IP address as variable</span><u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal"><span style="font-family:"Courier New",serif">Hi,<br>
<br>
How do you define the listening socket in OpenSIPs cfg ? (the one related to the DHCP interface)<br>
<br>
Regards,<br>
<br>
<br>
</span><u></u><u></u></p>
<pre>Bogdan-Andrei Iancu<u></u><u></u></pre>
<pre> <u></u><u></u></pre>
<pre>OpenSIPS Founder and Developer<u></u><u></u></pre>
<pre> <a href="https://www.opensips-solutions.com" target="_blank">https://www.opensips-solutions.com</a><u></u><u></u></pre>
<pre>OpenSIPS eBootcamp 2021 <u></u><u></u></pre>
<pre> <a href="https://opensips.org/training/OpenSIPS_eBootcamp_2021/" target="_blank">https://opensips.org/training/OpenSIPS_eBootcamp_2021/</a><u></u><u></u></pre>
<div>
<p class="MsoNormal">On 11/17/21 2:19 AM, Muhamad Putra Abdullah wrote:<u></u><u></u></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<p class="MsoNormal"><span style="color:rgb(33,33,33)">Hi,</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="color:rgb(33,33,33)"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="color:rgb(33,33,33)">Is there a way to get the IP address of DHCP interface to use in the script? I can get the call go through if I set both the interface as static.</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="color:rgb(33,33,33)"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="color:rgb(33,33,33)">Regards</span><u></u><u></u></p>
</div>
<div id="gmail-m_-5649458197337902443ms-outlook-mobile-signature">
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<p class="MsoNormal">Get <a href="https://aka.ms/AAb9ysg" target="_blank">Outlook for Android</a><u></u><u></u></p>
</div>
<div id="gmail-m_-5649458197337902443id-7c8cb1de-0d49-4aee-8134-d15557d98ca5">
<div>
<p class="MsoNormal"><span style="font-size:12pt;font-family:Arial,sans-serif;color:black"> </span><u></u><u></u></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="1" width="98%" align="center">
</div>
<div id="gmail-m_-5649458197337902443divRplyFwdMsg">
<p class="MsoNormal"><strong><span style="font-family:Calibri,sans-serif">From:</span></strong> Bogdan-Andrei Iancu
<a href="mailto:bogdan@opensips.org" target="_blank"><bogdan@opensips.org></a><br>
<strong><span style="font-family:Calibri,sans-serif">Sent:</span></strong> Tuesday, November 16, 2021, 6:45 PM<br>
<strong><span style="font-family:Calibri,sans-serif">To:</span></strong> OpenSIPS users mailling list; Muhamad Putra Abdullah<br>
<strong><span style="font-family:Calibri,sans-serif">Subject:</span></strong> Re: [OpenSIPS-Users] How to get all listening socket IP address as variable<u></u><u></u></p>
</div>
<p class="MsoNormal"><br>
<span style="font-family:"Courier New",serif">Hi,<br>
<br>
via the socket_xx() vars you can get only the sockets relative to/used by that call, you cannot iterate thru the listening sockets.<br>
<br>
Regards,<br>
<br>
<br>
</span><u></u><u></u></p>
<pre>Bogdan-Andrei Iancu<u></u><u></u></pre>
<pre> <u></u><u></u></pre>
<pre>OpenSIPS Founder and Developer<u></u><u></u></pre>
<pre> <a href="https://www.opensips-solutions.com" target="_blank">https://www.opensips-solutions.com</a><u></u><u></u></pre>
<pre>OpenSIPS eBootcamp 2021 <u></u><u></u></pre>
<pre> <a href="https://opensips.org/training/OpenSIPS_eBootcamp_2021/" target="_blank">https://opensips.org/training/OpenSIPS_eBootcamp_2021/</a><u></u><u></u></pre>
<div>
<p class="MsoNormal">On 11/15/21 9:39 AM, Muhamad Putra Abdullah wrote:<u></u><u></u></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<p class="MsoNormal"><span lang="EN-US">Hi, </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">I have 2 listening interface for opensips 3.2. How do I get both IP address to be used as variable in opensips config file? I try to use socket_in/ socket_out but failed to get the other interface IP address.</span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US"> </span><u></u><u></u></p>
<p class="MsoNormal"><span lang="EN-US">Thanks </span><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Sent from <a href="https://go.microsoft.com/fwlink/?LinkId=550986" target="_blank">
Mail</a> for Windows<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<p class="MsoNormal"><br>
<br>
<br>
<u></u><u></u></p>
<pre>_______________________________________________<u></u><u></u></pre>
<pre>Users mailing list<u></u><u></u></pre>
<pre><a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><u></u><u></u></pre>
<pre><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><u></u><u></u></pre>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12pt"> <u></u><u></u></p>
</div>
</blockquote>
<p class="MsoNormal"> <u></u><u></u></p>
</blockquote>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>