Ticket #3199 (new Feature Requests)

Opened 3 years ago

Last modified 2 years ago

Add "tool" module to automatically disable SIP trunks if Internet connectivity is lost, and monitor "outside" IP address for change (if not static IP)

Reported by: wiseoldowl Assigned to: p_lindheimer
Priority: minor Milestone: Undetermined
Component: Core - Trunks/Routing Version:
Keywords: Cc:
Confirmation: Need Feedback SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

I'm filing this as a bug report rather than a feature request because although it is a bug in Asterisk and not FreePBX, it appears that it's not going to be fixed anytime soon (I hope I am wrong about that!) and FreePBX could easily(?) work around it.

There is apparently an ongoing issue where Asterisk freezes up for INTERNAL sip calling if you have one or more SIP trunks that connect to outside providers via the public Internet, and your Internet connection goes down. In that case you not only lose the ability to make outside calls, you also lose the ability to make SIP calls between internal extensions. IAX2 devices are unaffected, but relatively few endpoints use IAX2.

Many commenters have been of the opinion that this is due to a bug in chan_sip or some similar part of Asterisk. However this bug existed in Asterisk 1.2 and apparently still exists in Asterisk 1.4. There has been a discussion of this issue in these threads (and possibly others):

http://forums.whirlpool.net.au/forum-replies.cfm?t=960451

http://www.elastix.org/index.php?option=com_fireboard&Itemid=55&func=view&catid=3&id=10405#10405

My specific request is that FreePBX would have a new "tool" module that would do at least one, and possibly two things:

1) At a minimum, detect when Internet connectivity is lost, by attempting to connect to some outside server at one-minute or five-minute intervals. This could be ANY outside server, though obviously you'd probably want something that exchanges a minimal amount of data. However, if you go to a server that returns your outside IP address, then you could also...

2) Attempt to determine the current "outside" IP address of the Asterisk server and detect whether it has changed since the last time you checked.

In the case of #1, it should disable all SIP trunks (maybe there should be a check box in the SIP trunk configuration to indicate whether that trunk should be disabled if outside connectivity is lost.

In the case of #2, it should (if this function is enabled, which should only be the case if the server does not have a static IP address) rewrite the line in sip_nat.conf that starts with externip=, replacing the part on the right side of the = with the new external IP address. This would help with another apparent Asterisk bug, where using externhost= doesn't always work, and you have to fall back to externip= to avoid one-way audio issues.

These could be part of a module under "Tools" called "Internet connectivity monitor" or something similar. The goal would be that if the Internet goes down completely, disable any SIP trunks that might keep the system from functioning. If the "outside" IP address changes, change it accordingly in sip_nat.conf so users don't have issues with one-way audio or similar. It just seems logical that these very similar functions could be combined in one "tool" module, which could then be installed only by users who need the functions it provides.

Of course the better way would be to get the Asterisk folks to fix these bugs (and backport the fixes!) but as long as they have persisted, I am not holding my breath.

Change History

09/15/08 11:34:52 changed by p_lindheimer

  • type changed from Bugs to Feature Requests.
  • confirmation changed from Unreviewed to Need Feedback.
  • component changed from - choose - to Core - Trunks/Routing.
  • milestone changed from 2.5 to 3.0.

well this is clearly a feature request, not a bug. And to a strong extent, really not something that should be in the control of FreePBX although that is open to discussion.

My understanding was that if you don't have an fqdn anywhere in your configurations, then you were immune to the issue. That is easily tested to confirm. Most providers have static IP address that can be used to overcome this issue.

Beyond that - it is really something that may be better handled at the ISO level. A local DNS cache that can insulate Asterisk from the internet so it does not hang trying to get to a remote DNS server seems like it would do the trick, as long as it's behavior is such that it can do things like return stale data back to Asterisk in the event that it's DNS source is not reachable.

So for now moving this off to the next milestone to allow for further discussion, but I would seriously consider the DNS cache approach and it would well be worth some testing to see if a simple solution like that may easily overcome the problem.

(Take a look at something like dnsmasq and see if the problem goes away)

09/15/08 12:20:58 changed by wiseoldowl

The only problem with using a static IP for a provider is that it might change without notice, thereby leaving you in somewhat the same situation you are trying to avoid, where you lose connectivity unexpectedly (although at least you'd still have internal calling). Were that the only solution, I'd probably be asking for a tool to rewrite the static IP address in trunk configs when the address pointed to by the FQDN changes. :-)

As for getting into the guts of Linux to resolve the problem, that's definitely beyond my abilities (unless someone can come up with a step-by-step "cookbook" for the procedure) and that's why I was hoping that perhaps there could be a FreePBX "tool" that would take care of the issues. Anyway, it was just a suggestion, given that it seems to be affecting a number of users (especially the chan_sip bug, if that's where it is).

09/15/08 12:25:59 changed by p_lindheimer

adding a package like dnsmasq should not be getting in the guts of Linux, although it does mean understanding Linux administration. That is why I suggest it is an ISO level thing. If it is a good solution, then folks like PIAF, Elastix and others could consider making it part of the build.

However, I suspect any reasonable SIP providers will have static IP addresses that remain constant. There are cases where providers will change the DNS entry to push a user to a fail over destination when they are having problems but you can likely get the address of those static IPs as well and create alternate trunks.

08/16/09 11:12:22 changed by p_lindheimer

  • version deleted.
  • milestone changed from 2.6 to 2.7.