<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<font face="monospace">Hi,<br>
<br>
I see, you start listening on an interface (enp2s0), which
translates into the DHCP IP, but you can not use the
socket/listener to do a force send socket ....as there is no way
to reference it. Unfortunately something like that is not possible
right now, but I see it as a valuable addition.<br>
<br>
For the moment, what you can do is to use some pre-processing
(see [1]) in order to fill in your CFG the actual IP - and do an
IP detection from the opensips init.d / startup script.<br>
<br>
<br>
[1]
<a class="moz-txt-link-freetext" href="https://www.opensips.org/Documentation/Templating-Config-Files-3-0">https://www.opensips.org/Documentation/Templating-Config-Files-3-0</a><br>
<br>
Best regards,<br>
<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>
OpenSIPS eBootcamp 2021
<a class="moz-txt-link-freetext" href="https://opensips.org/training/OpenSIPS_eBootcamp_2021/">https://opensips.org/training/OpenSIPS_eBootcamp_2021/</a></pre>
<div class="moz-cite-prefix">On 11/18/21 4:50 AM, Muhamad Putra
Abdullah wrote:<br>
</div>
<blockquote type="cite"
cite="mid:SI2PR03MB556159D004A15DC829E7D2EBFD9B9@SI2PR03MB5561.apcprd03.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
<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;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
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",serif;}span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}span.EmailStyle22
{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"><span style="mso-fareast-language:EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Ok.
I’m totally in learning process.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Let
me explain my test deployment. I have 2 separate network
that connected via opensips server.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Internal
SIP Server Opensips
Server (2 NIC)
External SIP Server<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">(User
634) 192.168.1.1 - - - - - - - - 192.168.1.2 |
(EXTERNAL_IP) DHCP IP - - - - - - - - 172.16.16.1 (User 605)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">What
my intension is to relay calls between Internal and External
SIP server via Opensips server.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">I
use this method to achieve this:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
<o:p>
</o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
socket=udp:enp1s0:5060 # INTERNAL_INTERFACE (192.168.1.2)<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span
style="mso-fareast-language:EN-US">socket=udp:enp2s0:5060
# EXTERNAL_INTERFACE (DHCP)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
# From Internal to External<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
# Testing one number only first 634 to 605<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
if ($rU=~"^605") {
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
sethostport("EXTERNAL_IP:5060");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
$socket_out = "udp:EXTERNAL_IP:5060";<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
rtpproxy_engage("ier");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
route(relay);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
exit;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
# From External to internal<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
# Testing one number only first 605 to 634<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span
style="mso-fareast-language:EN-US">if ($rU=~"^634"){
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
sethostport("192.168.1.2:5060");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
$socket_out = "udp:192.168.1.2:5060";<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
rtpproxy_engage("eir");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
route(relay);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
exit;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">
}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Is
there better solutions than this?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Regards
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1
1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span
lang="EN-US"> Bogdan-Andrei Iancu
<a class="moz-txt-link-rfc2396E" href="mailto:bogdan@opensips.org"><bogdan@opensips.org></a>
<br>
<b>Sent:</b> Wednesday, 17 November, 2021 8:24 PM<br>
<b>To:</b> Muhamad Putra Abdullah
<a class="moz-txt-link-rfc2396E" href="mailto:m.putra77@outlook.com"><m.putra77@outlook.com></a>; OpenSIPS users mailling
list <a class="moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org"><users@lists.opensips.org></a><br>
<b>Subject:</b> Re: [OpenSIPS-Users] How to get all
listening socket IP address as variable<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></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><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">https://www.opensips-solutions.com</a><o:p></o:p></pre>
<pre>OpenSIPS eBootcamp 2021 <o:p></o:p></pre>
<pre> <a href="https://opensips.org/training/OpenSIPS_eBootcamp_2021/" moz-do-not-send="true">https://opensips.org/training/OpenSIPS_eBootcamp_2021/</a><o:p></o:p></pre>
<div>
<p class="MsoNormal">On 11/17/21 10:21 AM, Muhamad Putra
Abdullah wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hi,</span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">socket=udp:enp1s0:5060
tag INTERNAL_IP # CUSTOMIZE ME</span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">socket=udp:enp2s0:5060
tag EXTERNAL_IP # CUSTOMIZE ME</span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">My
INTERNAL_IP is set to static and EXTERNAL_IP set to DHCP.
I just use tag to test something.</span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Regards</span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"> </span><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><span lang="EN-US">From:</span></b><span
lang="EN-US"> Bogdan-Andrei Iancu
<a href="mailto:bogdan@opensips.org"
moz-do-not-send="true"><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"
moz-do-not-send="true"><m.putra77@outlook.com></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] How to get all
listening socket IP address as variable</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></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><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">https://www.opensips-solutions.com</a><o:p></o:p></pre>
<pre>OpenSIPS eBootcamp 2021 <o:p></o:p></pre>
<pre> <a href="https://opensips.org/training/OpenSIPS_eBootcamp_2021/" moz-do-not-send="true">https://opensips.org/training/OpenSIPS_eBootcamp_2021/</a><o:p></o:p></pre>
<div>
<p class="MsoNormal">On 11/17/21 2:19 AM, Muhamad Putra
Abdullah wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span style="color:#212121">Hi,</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#212121"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#212121">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><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#212121"> </span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#212121">Regards</span><o:p></o:p></p>
</div>
<div id="ms-outlook-mobile-signature">
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<p class="MsoNormal">Get <a href="https://aka.ms/AAb9ysg"
moz-do-not-send="true">Outlook for Android</a><o:p></o:p></p>
</div>
<div id="id-7c8cb1de-0d49-4aee-8134-d15557d98ca5">
<div>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Arial",sans-serif;color:black"> </span><o:p></o:p></p>
</div>
<div class="MsoNormal" style="text-align:center"
align="center">
<hr width="98%" size="1" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><strong><span
style="font-family:"Calibri",sans-serif">From:</span></strong>
Bogdan-Andrei Iancu
<a href="mailto:bogdan@opensips.org"
moz-do-not-send="true"><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<o:p></o:p></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><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">https://www.opensips-solutions.com</a><o:p></o:p></pre>
<pre>OpenSIPS eBootcamp 2021 <o:p></o:p></pre>
<pre> <a href="https://opensips.org/training/OpenSIPS_eBootcamp_2021/" moz-do-not-send="true">https://opensips.org/training/OpenSIPS_eBootcamp_2021/</a><o:p></o:p></pre>
<div>
<p class="MsoNormal">On 11/15/21 9:39 AM, Muhamad Putra
Abdullah wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><span lang="EN-US">Hi, </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></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><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US"> </span><o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-US">Thanks </span><o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Sent from <a
href="https://go.microsoft.com/fwlink/?LinkId=550986"
moz-do-not-send="true">
Mail</a> for Windows<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<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">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">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal" style="margin-bottom:12.0pt"> <o:p></o:p></p>
</div>
</blockquote>
<p class="MsoNormal"> <o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</blockquote>
<br>
</body>
</html>