[OpenSIPS-Users] How to discover if OpenSIPS is connected to Internet, from the script.
Liviu Chircu
liviu at opensips.org
Thu Aug 4 16:10:06 CEST 2016
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
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
> 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/aedc51a7/attachment-0001.htm>
More information about the Users
mailing list