[OpenSIPS-Users] How to discover if OpenSIPS is connected to Internet, from the script.

Rodrigo Pimenta Carvalho pimenta at inatel.br
Thu Aug 4 16:35:01 CEST 2016


Hi Liviu.


Thank you very much.

By the way, do you know if it is possible to discovery what is the IP address from where the OpenSIPS is running?

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.


Can the OpenSIPS script tells me, by some way, what is the private IP address?


Best regards.


RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9200 RAMAL 979


________________________________
De: users-bounces at lists.opensips.org <users-bounces at lists.opensips.org> em nome de Liviu Chircu <liviu at opensips.org>
Enviado: quinta-feira, 4 de agosto de 2016 11:10
Para: users at lists.opensips.org
Assunto: Re: [OpenSIPS-Users] How to discover if OpenSIPS is connected to Internet, from the script.


Hi, Rodrigo!


That's quite a fun question. Off the top of my head, here are 3 possible ways in which you can achieve this:


* 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.

* ICMP test: you can do an exec("/bin/ping -w1 -c1 <ICMP-enabled public IP>") and decide from the return code

* HTTP GET: you can 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!


Best regards,

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

Home - OpenSIPS Solutions<http://www.opensips-solutions.com/>
www.opensips-solutions.com
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.

On 04.08.2016 16:21, Rodrigo Pimenta Carvalho wrote:

Hi.


How to discover if OpenSIPS is connected do Internet, from its configuration script?


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.


Best regards.


RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9200 RAMAL 979



_______________________________________________
Users mailing list
Users at lists.opensips.org<mailto:Users at lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20160804/a42d639d/attachment.htm>


More information about the Users mailing list