No internal calls when connection to the Internet fails

My Asterisk is connected to a router towards the Internet via NAT (hereinafter external) that also connects it to some SIP extensions internally (and optionally externally). My Asterisk has SIP trunks that are naturally external - i.e. on the Internet. I also have analog trunks to the PSTN and analog lines via zaptel DTM400.
I noticed that when there is a failure of the cable operator’s connection to the Internet, I cannot make internal calls between my extensions, and not even between the analog trunks and lines, although my router is still connecting computers on my LAN to each other with no problem.
The log I get is:
"WARNING[2659] chan_sip.c: Maximum retries exceeded on transmission b860d4bb-16b6f15@192.168.1.104 for seqno 101 (Critical Response)"
Why is that happening?
Can I change anything to avoid it?
I was hoping to use the analog trunks for backup when the Internet connection fails, and this kind of undermines it.

I also noticed that the registration of my SIP subscribers also fail (maybe doesn’t go through) when the Internet is down. I would suspect something in their setup, but these are different models and even various makes. I see nothing the requires the consulting of a DNS or STUN (unless this is the default). The registration server is configured as a simple IP address on my LAN.
So, what can be the reason?
Please help.

It is a known issue that you have a local DNS (you can do a cache only if you wish) server running and use it

It is a known issue that you need to have a local DNS (you can do a cache only if you wish) running and use it

Thank you for bringing this to my attention.
I am trying to follow your advice, and I must be missing something.
I have activated Dnsmasq (“Dnsmasq is a lightweight, easy to configure DNS forwarder”) . It looks like it works only for one more call after the Internet is down.
Do I need to add anything to /etc/hosts?

May sure you have it caching the requests and that all the systems (server / phones) are using it for their DNS

Hi

You might want to set registerattempts= to a suitable value in sip.conf this will stop the system stalling because it cant look up the dns address.

Ian

Thank you Bubba and Ianplain for following up on my issue.
I have placed the internal DNS server as the first DNS in my router configuration, and increased the cache size and time, but I still can’t make internal calls when the Internet is down.
As for registerattempts - this is a parameter that affects the outbound registrations. i.e. registrations my Asterisk is attempting at the SIP trunk providers. I wouldn’t like that to stop.

How about a snippet of the log file when the calls fail

Thanks for the continued support.
There are no logs when the SIP call attempts fail.
When the Interner comes back, the users (ZAP and SIP) ring with the last call attempted to them, and I get the following log:

[quote][May 11 17:59:40] WARNING[25107] app_dial.c: Unable to create channel of type ‘SIP’ (cause 3 - No route to destination)
[May 11 17:59:48] WARNING[2696] chan_sip.c: Remote host can’t match request CANCEL to call ‘195f4fde12024fb333d57795039ddb62@192.168.1.122’. Giving up.[/quote]
I also get several messages like this:

[quote][May 11 18:00:00] WARNING[2696] chan_sip.c: Maximum retries exceeded on transmission 561c4e3a-71ec4d21@192.168.1.104 for seqno 101 (Critical Response)
[/quote]
Which are probably for calls attempted by the internal users.

Eventually, after a lot of investigation I found out that bubba wad right. It is the DNS “known issue”.
It just takes a little more configuration to get around it. I found the details in trixbox.org/forums/trixbox-f … extensions
I am surprised that such an old know issue that is super critical to the survivability of Asterisk is not taken care of in code, and is known to so few Asterisk experts.

Hi

This is why you cant make calls though, your server is spending all its time trying to register, by making it give up means SIP doesnt “lock” up

Ian

I’ve trield all solutions suggested in this posts but without any result…
At this point I think that the only way to resolve the problem is to have a script that automatically, when Internet goes down, disable all sip accounts and than re-enalble this accounts when ADSL connection is newly available.
Is posssible this solution ?
Any other ideas ?
Thank in advance.
Ing. Cosimo MERCURO
Mercuro for Business

[quote=“ianplain”]Hi

This is why you cant make calls though, your server is spending all its time trying to register, by making it give up means SIP doesnt “lock” up

Ian[/quote]
Apparently, it can keep on doing this forever as long as it has a local DNS it can query.
I do believe there is a smarter way to design it.