<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.</p>
<p><br>
</p>
<p>Forget the questions from my previous message, please.</p>
<p><br>
</p>
<p>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: +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 <users-bounces@lists.opensips.org> em nome de Rodrigo Pimenta Carvalho <pimenta@inatel.br><br>
<b>Enviado:</b> quinta-feira, 4 de agosto de 2016 11:35<br>
<b>Para:</b> OpenSIPS users mailling list<br>
<b>Assunto:</b> Re: [OpenSIPS-Users] How to discover if OpenSIPS is connected to Internet, from the script.</font>
<div> </div>
</div>
<div>
<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: +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 <users-bounces@lists.opensips.org> em nome de Liviu Chircu <liviu@opensips.org><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> </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("0x02") 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("/bin/ping -w1 -c1 <ICMP-enabled public IP>") 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 id="LPBorder_GT_14703101695580.4822305909773532" style="margin-bottom:20px; overflow:auto; width:100%; text-indent:0px">
<table id="LPContainer_14703101695330.5966069788789836" style="width:90%; background-color:rgb(255,255,255); 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)" cellspacing="0">
<tbody>
<tr style="border-spacing:0px" valign="top">
<td colspan="2" id="TextCell_14703101695340.8090144749564444" style="vertical-align: top; padding: 0px; display: table-cell; position: relative;">
<div id="LPRemovePreviewContainer_14703101695340.2545617528659324"></div>
<div id="LPTitle_14703101695340.6469428086458638" style="top:0px; color:rgb(0,120,215); font-weight:400; font-size:21px; font-family:"wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; line-height:21px">
<a target="_blank" href="http://www.opensips-solutions.com/" id="LPUrlAnchor_14703101695350.1504970812824007" style="text-decoration:none">Home — OpenSIPS Solutions</a></div>
<div id="LPMetadata_14703101695550.13582806406180592" style="margin:10px 0px 16px; color:rgb(102,102,102); font-weight:400; font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size:14px; line-height:14px">
www.opensips-solutions.com</div>
<div id="LPDescription_14703101695560.9663829521731804" style="display:block; color:rgb(102,102,102); font-weight:400; font-family:"wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size:14px; line-height:20px; max-height:100px; overflow:hidden">
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 "online" 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: +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>
</div>
</div>
</div>
</body>
</html>