After internet outage asterisk lost SIP provider does not reconnect by itself

Hello there,
Since I change of ISP. I encounter several very little outages. The outage lasts 2, 3 - 10 seconds max. But, when this happen my SIP provider disconnect from Asterisk then it does not reconnect by itself, is there is a way to reconnect itself automatically like a timeout parameter to prevent timeout it?
PS: I always need to connect to Asterisk and do a sip reload in the console.
Here is my conf:

register => 0033183*******:**************@sip5.ovh.fr

;Ligne privee
[homesip]
disallow=all
type=peer
secret=*********************
host=sip5.ovh.fr
allowguest=yes
fromdomain=sip5.ovh.fr
fromuser=0033183******
username=0033183******
context=homesip
insecure=invite
qualify=5000
canreinvite=no
dtmfmode=inband
allow=gsm
allow=ilbc
allow=alaw
allow=ulaw
directmedia=no

Thanks!

Can you post the SIP debug messages when that happens? You qualify interval has a large value and I guess that the interval for re-registrations is also a couple of minutes, so I don’t see why a couple of seconds should normally matter.

Of course I can. But I don’t know when that will happen again, I’ll try to find out old SIP debug messages but don’t know where I can find them. I’m a beginner with Asterisk sorry for my mistakes. For the value of qualify which value do you recommend me? The connection drops for 10-15 seconds and come back this is only the internet connection not the network.

Do you mean that you internet connection gets lost now and then?

Some people use values as low as 30 seconds, but I prefer to disable all OPTION requests for service providers (but that generally requires that you know what you router is doing).

Yes exactly due to my ISP that is very unstable like problems of peering something like that I heard.

As this is UDP, it cannot actually disconnect.

Assuming that your internet connection after the outage is the same as before, there might be a provider policy to mark your end point down if it fails to get certain replies. If so, that will be controlled entirely at the provider end.

If you have come back on a different internet connection, basically dynamic IP is an unsuitable environment for running servers, and ISPs that change IPs without a large down time first, are unsuitable for running servers.

Also noted. allowguest is a security risk and can only go in the general section. dtmfmode=inband is unusual, and is definitely incompatible with your first choice codec, and possibly your second choice one. Your directmedia setting will override your canreinvite setting, as they are the current and deprecated names for the same option, and directmedia comes second.

Hmmm ok. But which parameters you’re telling about by “OPTION”?

Thanks for your very detailed answer. My ISP IP is static full-stack. I’m gonna do all the changes in the provider conf as you told me. What do you advise me to do?

Nothing we’ve suggested refers to your problem.

As far as the basic concepts and elementary techniques are concerned: http://www.asteriskdocs.org/

Once you what is going on, I’d recommend to switch to the new PJSIP stack.

Here is my entire sip conf now.


[general]
language=fr
bindport=5456
bindaddr=0.0.0.0
transport=udp
externip=82.64.*******
localnet=192.168.9.0/24
localnet=127.0.0.1/32
srvlookup=yes
directrtpsetup=no
nat=force_rport,rtp_symetric,rewrite_contract
defaultexpiry=3600
registertimeout=10
registerattempts=2
alwaysauthreject=yes
disallow=all
qualify=5000
allow=gsm
allow=ilbc
allow=alaw
match_auth_username=yes
allow=ulaw
allowguest=no
callcounter=yes
directmedia=no

register => 0033183*******:*******@sip5.ovh.fr

;Ligne privee
[homesip]
disallow=all
type=peer
secret=*******
host=sip5.ovh.fr
fromdomain=sip5.ovh.fr
fromuser=0033183*******
username=0033183*******
context=homesip
insecure=invite
qualify=30
canreinvite=no
allow=gsm
allow=ilbc
allow=alaw
allow=ulaw

Thanks for your help, I already tried to switch to PJSIP but my Cisco 7960 phones does not register well with it.

5 seconds seems to be a very large value for the acceptable round trip time. Note that qualify is not the frequency of sending, but how bad a round trip time is acceptable.

The only thing I think might help at your end, would be to use a short re-registration period. The default is 2 minutes, and the provider may limit how low it can be set.

Wrong configuration?

You might want to have a look at this as well: Collecting Debug Information - Asterisk Project - Asterisk Project Wiki

1 Like

Ok. How can I define a short-registration period by setting qualify low I guess?

I tried everything during 1 week by searching on forums, debugging etc. Nothing worked so I decided to go back to SIP unfortunately.

Qualify has nothing to do with Registration. Sometimes a very short qualify value is used to keep the NAT ports open for replies, but I prefer to configure the router in cases like that.

1 Like

Cisco phones don’t support rport, so the “force_rport” option has to be set to “no” to allow them to work.

Ok I did not know that. With SIP and with this option they work but I don’t remember if with pjsip I had this option set on. I just turn this option off maybe it causes problems with my phones.