<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi Liviu.</p>
<p><br>
</p>
<p>Thank you very much.</p>
<p>By the way, do you know if it is possible to discovery what is the IP address from where the OpenSIPS is running?</p>
<p>For example, the node can have an ethernet IP or a WLAN IP. It depends on if the node is connected to the DHCP server via wireless or cabe.</p>
<p><br>
</p>
<p>Can the OpenSIPS script tells me, by some way, what is the private IP address?</p>
<p><br>
</p>
<p>Best regards.<br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div class="BodyFragment"><font size="2">
<div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
Inatel Competence Center<br>
Software<br>
Ph: &#43;55 35 3471 9200 RAMAL 979<br>
</div>
</font></div>
</div>
</div>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>De:</b> users-bounces@lists.opensips.org &lt;users-bounces@lists.opensips.org&gt; em nome de Liviu Chircu &lt;liviu@opensips.org&gt;<br>
<b>Enviado:</b> quinta-feira, 4 de agosto de 2016 11:10<br>
<b>Para:</b> users@lists.opensips.org<br>
<b>Assunto:</b> Re: [OpenSIPS-Users] How to discover if OpenSIPS is connected to Internet, from the script.</font>
<div>&nbsp;</div>
</div>
<div>
<p><tt>Hi, Rodrigo!</tt></p>
<p><tt><br>
</tt></p>
<p><tt>That's quite a fun question. Off the top of my head, here are 3 possible ways in which you can achieve this:
</tt></p>
<p><tt><br>
</tt></p>
<p><tt>* relay over TCP: not sure if's relevant to your needs, but if you arm a failure route and t_relay(&quot;0x02&quot;) out to the internet, you will be able to properly tell if connectivity was down should you hit the failure route.<br>
</tt></p>
<p><tt>* ICMP test: you </tt><tt><tt>can</tt> do an exec(&quot;/bin/ping -w1 -c1 &lt;ICMP-enabled public IP&gt;&quot;) and decide from the return code</tt></p>
<p><tt>* HTTP GET: you </tt><tt><tt>can</tt> use the rest_client module, attempt to fetch some page, and decide from the return code. Be sure to set a proper TCP connect timeout!</tt></p>
<p><tt><br>
</tt></p>
<p><tt>Best regards,</tt><br>
</p>
<pre class="moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a id="LPlnk294417" class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
<div style="margin-bottom: 20px; overflow: auto; width: 100%; text-indent: 0px;" id="LPBorder_GT_14703101695580.4822305909773532">
<table style="width: 90%; background-color: rgb(255, 255, 255); position: relative; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top: 1px dotted rgb(200, 200, 200); border-bottom: 1px dotted rgb(200, 200, 200);" id="LPContainer_14703101695330.5966069788789836" cellspacing="0">
<tbody>
<tr style="border-spacing: 0px;" valign="top">
<td colspan="2" style="vertical-align: top; position: relative; padding: 0px; display: table-cell;" id="TextCell_14703101695340.8090144749564444">
<div id="LPRemovePreviewContainer_14703101695340.2545617528659324"></div>
<div style="top: 0px; color: rgb(0, 120, 215); font-weight: 400; font-size: 21px; font-family: &quot;wf_segoe-ui_light&quot;,&quot;Segoe UI Light&quot;,&quot;Segoe WP Light&quot;,&quot;Segoe UI&quot;,&quot;Segoe WP&quot;,Tahoma,Arial,sans-serif; line-height: 21px;" id="LPTitle_14703101695340.6469428086458638">
<a target="_blank" href="http://www.opensips-solutions.com/" style="text-decoration: none;" id="LPUrlAnchor_14703101695350.1504970812824007">Home &#8212; OpenSIPS Solutions</a></div>
<div style="margin: 10px 0px 16px; color: rgb(102, 102, 102); font-weight: 400; font-family: &quot;wf_segoe-ui_normal&quot;,&quot;Segoe UI&quot;,&quot;Segoe WP&quot;,Tahoma,Arial,sans-serif; font-size: 14px; line-height: 14px;" id="LPMetadata_14703101695550.13582806406180592">
www.opensips-solutions.com</div>
<div style="display: block; color: rgb(102, 102, 102); font-weight: 400; font-family: &quot;wf_segoe-ui_normal&quot;,&quot;Segoe UI&quot;,&quot;Segoe WP&quot;,Tahoma,Arial,sans-serif; font-size: 14px; line-height: 20px; max-height: 100px; overflow: hidden;" id="LPDescription_14703101695560.9663829521731804">
OpenSIPS is a mature Open Source implementation of a SIP server. OpenSIPS is more than a SIP proxy/router as it includes application-level functionalities.</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="moz-cite-prefix">On 04.08.2016 16:21, Rodrigo Pimenta Carvalho wrote:<br>
</div>
<blockquote type="cite">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi.</p>
<p><br>
</p>
<p>How to discover if OpenSIPS is connected do Internet, from its configuration script?</p>
<p><br>
</p>
<p>Sometimes the Internet Link is down and then just local calls will work. If I can discover if OpenSIPS is &quot;online&quot; on Internet, I will use this information to implement some specific logic in my script.<br>
</p>
<p><br>
</p>
<p>Best regards.<br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div class="BodyFragment"><font size="2">
<div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
Inatel Competence Center<br>
Software<br>
Ph: &#43;55 35 3471 9200 RAMAL 979<br>
</div>
</font></div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset> <br>
<pre>_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</div>
</div>
</div>
</body>
</html>