support

how to reboot automatically when internet connection is back on?

Mayoor
Posts: 136
Member Since:
2006-06-01

When I loose internet connection , all sip voip trunk connection is lost. Only way to be connected again is to restart trixbox machine.

How to write a cron job or some other way to check if the internet goes out and comes back to restart the computer. In Asterisk info you can see the lost connection (telasip and vitel)

I am a linux idiot so please help with that in mind.

Thanks in Advance



playyas4u
Posts: 44
Member Since:
2006-09-26
Re: how to reboot when internet connection is back on?

Just restart asterisk from the command line. You should be able to do a search on the internet for the command. I am also a linux idiot and don't know the actual command for it.



Mayoor
Posts: 136
Member Since:
2006-06-01
Re: how to reboot when internet connection is back on?

I mean able to do this without human intervention .... I can always restart using web ..... I am using @home 2.8 and that part works.

I am hoping that a cron job checks if the internet connection is lost and when it comes back it reboot the computer.

Thanks again



Mayoor
Posts: 136
Member Since:
2006-06-01
Re: how to reboot when internet connection is back on?

Sorry I was not clear in my question. I meant automatically have @home or trixbox computer intiate a reboot when the lost internet is restored again.

It would be nice if it restarts gracefully--- meaining only when no calls are active.

Thanks once more



truescot
Posts: 23
Member Since:
2006-10-24
Re: how to reboot when internet connection is back on?

are you sure you have to reboot the computer? there are 2 other things that might sort you out without rebooting.
First of all you should log into your asterisk CLI and check if simlpy running the command
sip reload

if this works then its easy enough to wrte a script that runns it when the internet is back up

if that doesnt work at the linux command line
run the command
service asterisk restart

again if this works it is easy enough to write a script to run this when the internet restarts

you can use IPTRAF to monitor the internet connection and run a script based on it

Jamie Ferguson
www.syconith.nl

from the command line and see if that sorts your problem, if it does then it is easy enough to write a script that gracefully ends asterisk,

also you should log into your asterisk CLI and check if simlpy running the command sip reload, it is a little bit dodgy to reboot the machine every time the internet is down for a bit, much better if you can run a script to do one of these 2 things

Jamie Ferguson
www.syconith.nl



kerryg
Posts: 6401
Member Since:
2006-05-31
Re: how to reboot when internet connection is back on?

I have never seen this type of behavoir before. When the net goes "down" are you losing the ip to the box? Once the system loses connection it begins retrying. So it should only have an issue if "something changes" when the internet goes down.

--

Kerry Garrison
trixbox Community Director
VoipSpeak.net - Asterisk Tutorials



Mayoor
Posts: 136
Member Since:
2006-06-01
Re: how to reboot when internet connection is back on?

it happens every time.

I have ipcop and than switch (HUB).

Every time I loose internet and internet is back up all my sip trunks loose connection meaning I cannot receive a call from telasip or vitel.

My remote phone and connection to another remote asterisk machine will be connected again.

I tried reload and restarted amp and has not helped.

I have to restart the box again. (I have not tried restart service network)

And my ability to write anything as a cron job is nil

Thanks again



Mayoor
Posts: 136
Member Since:
2006-06-01
Re: how to reboot when internet connection is back on?

Thanks Jamie

I have not tried using service asterisk restart and I wouldn't know how to use IPTRAF

Enlighten me and I would try

an example of a script might get me to be able to write one

thanks



UncleWard
Posts: 305
Member Since:
2006-05-31
Re: how to reboot when internet connection is back on?

See if this gets things going again:

service network restart



agit8or
Posts: 261
Member Since:
2006-05-31
Re: how to reboot when internet connection is back on?

I can confirm this too. When we or a client loses Internet connectivity, SIP stops. I haven't really taken the time to troubleshoot the EXACT service that is the issue, but ALL SIP stops functioning with Asterisk. Maybe because it can't find the NTP peers? If DNS is disabled, it will work regardless, however if it can resolve DNS records but does not have Internet, SIP stops working.



tommy13v
Posts: 90
Member Since:
2006-05-31
Re: how to reboot when internet connection is back on?
Quote:
UncleWard wrote:
See if this gets things going again:

service network restart

Thats how I've been fixing it.



Mayoor
Posts: 136
Member Since:
2006-06-01
Re: how to reboot when internet connection is back on?

Last time I stopped network service and I had been connected using putty ...(like cutting the branch you are seating On ...lol)

I had thought that was the problem network services needed to be restarted.

Now the hard part is how can we do this without having to do it manually.

Are there any linux experts that can write a script to check and monitor internet connection and once gone and is back to restart network service?

I should be able to check if this fixes the problem I have been loosing internet about once a week for last few weeks. Or I suppose I can disconnect the dsl modem and reconnect after 5 to 10 minutes and check if "service network restart" fixes the problem



UncleWard
Posts: 305
Member Since:
2006-05-31
Re: how to reboot when internet connection is back on?

Here's a simple solution. From another Linux box, use SCP to copy a dummy file to /tmp on the problem box as /tmp/dummy once every 5 minutes using crontab. On the box with the problem, use a cron job starting a minute or two later to search for the dummy file once every 5 minutes. If it's found, delete the dummy file. If it's not found, execute a service network restart. That should keep your downtime to a minimum.



yesmat
Posts: 98
Member Since:
2006-06-08
Re: how to reboot when internet connection is back on?

There are many ways to skin a cat.

It seems that you are using your TB server as a router/firewall at the same time, meaning connecting the server directely to the DSL modem. This in my opinion is not best practice.

I suggest using a separate hardware DSL router with 4 port switch where you connect your server. In this case even if you lose the Internet for a while the server will not be affected and will straight away work when the Interenet comes live again.

Many routers these days are cheap enough and provide DMZ settings where you don't even need to open and forward ports manually (if you don't want to do that).

It works well.

Good luck.



Mayoor
Posts: 136
Member Since:
2006-06-01
Re: how to reboot when internet connection is back on?

I have ipcop which works as a firewall ---- between the asterisk and dsl modem.

Ipcop does the pppoe to get authentication from isp and have a wirespeed modem.

Ipcop has to ethernet cards 1 for wan(red) and 1 for lan(green)

Asterisk machine is always connected to the ipcop it is ipcop that would loose connection.

And I wish I knew how to do the scripting.

Thanks once more for the help



Mayoor
Posts: 136
Member Since:
2006-06-01
Re: how to reboot when internet connection is back on?

my Isp is really bad and have lost internet atleast 5 times in two days and service network restart doesn't get the sip trunks back (from voip providers)

My iax2 trunk with my other asterisk box is up when internet is back on and also all my remote extension are reconnected to the asterisk box once internet is back.

I have done both service network restart and amportal stop and amportal start

Hope we can find the reasons sooooonnnn

Thanks for all your help



wal
Posts: 13
Member Since:
2006-10-03
Re: how to reboot automatically when internet connection is back

Hi
Your problem is a bug in asterisk with sip registration.
Seems that the iax registration do not have this problem.
You don't need to reload linux.

Go to http://www.trixbox.org/modules/newbb/viewtopic.php?topic_id=6453&...
real all and you wil find the answer.
Or go directly to Wal and Fabrizio answers.

I think that this link can help you too
http://www.voipuser.org/index.php?name=PNphpBB2&file=viewtopic&t=...
I did not use this last solution but I think that work.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.