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

Rodrigo Pimenta Carvalho pimenta at inatel.br
Mon Aug 8 13:51:27 CEST 2016


Thank all of you.

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 Adrian Fretwell <adrian.fretwell at topgreen.co.uk>
Enviado: segunda-feira, 8 de agosto de 2016 04:27
Para: OpenSIPS users mailling list
Assunto: Re: [OpenSIPS-Users] How to discover if OpenSIPS is connected to Internet, from the script.


Johan,

If your internet connection is going up and down regularly, you may be better off executing your test from a timer route:

timer_route[internet_check, 300] {
    # -----------------------------------------------------------------
    # Timer Route every 5 minutes
    # -----------------------------------------------------------------

   exec("/usr/local/bin/some_check _script");
}


There are many different ways to check if you have an internet connection, the way you do it will depend on your environment and application, but here is a very simple shell script as an example:

#!/bin/bash
ping -c 2 8.8.8.8 > /dev/null
if [ $? -eq 0 ]; then
echo "Internet Alive $(date)";
else
echo "Internet Dead $(date)";
fi

Kind regards,

Adrian Fretwell

On 08/08/16 07:58, Johan De Clercq wrote:
create a start up route startup_route, the use module exec to f.e. get your pub ip with curl.

2016-08-04 15:21 GMT+02:00 Rodrigo Pimenta Carvalho <pimenta at inatel.br<mailto:pimenta at inatel.br>>:

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<tel:%2B55%2035%203471%209200> 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





_______________________________________________
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/20160808/162244f5/attachment.htm>


More information about the Users mailing list