Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


VOIP / Asterisk Fail-Over Possibilities?

Posted on 2009-05-20
Medium Priority
Last Modified: 2013-11-12
I am wondering about fail-over capability with VOIP, in an asterisk environment and SIP peers or UA devices, across the WAN or internet.

I want to eventually have fail-over in case the main internet connection that my asterisk server is on, goes down.

I was hoping to do this through some sort of dynamic DNS with my domain through Godaddy but apparently they do not support dynamic DNS.

I have my domain setup through godaddy, and I created an A record for, pointed it to my asterisk WAN IP and thought about using that address in my UA or sip peers, instead of the IP address.

Is there a way to have a solid fail-over with sip peers in an asterisk environment?  I think the solution has something to do with DNS SRV, but I am not too familiar with how it works.  Does using DNS SRV cause more problems with things like, 1 way audio etc?  

Question by:jkockler
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
LVL 25

Expert Comment

by:Ron Malmstead
ID: 24434073
Asterisk supports failover in a simple way...and others have taken it further, with load balancing techniques that i've never tried myself...

Use multiple dial statements in order of preference.


exten => _NXXNXXXXXX,1,Dial(zap/g2/${EXTEN},30)
exten => _NXXNXXXXXX,1,Dial(${EXTEN}@tosipprovider,30)

If the voice circuit was down, then the first dial command would fail and the second dial command would be tried, sending the call to a sip provider (your other asterisk box used for failover).
LVL 25

Expert Comment

by:Ron Malmstead
ID: 24434081
Priority typo corrected...

exten => _NXXNXXXXXX,1,Dial(zap/g2/${EXTEN},30)
exten => _NXXNXXXXXX,n,Dial(${EXTEN}@tosipprovider,30)

Author Comment

ID: 24434991
Okay thanks for that side of it, but I am wondering about the other side of it.

You explained how asterisk could go to a different service provider if possibly the service provider went down.

My question pertains more to how the sip peers can always find the asterisk server.  So for example, I have a Linksys ip phone at a remote site.  It connects to asterisk at Public IP address  If the ISP hosting the ip address goes down, I am looking for a way for the linksys phone to still be able to contact the asterisk box.  The Asterisk box stays online, because I can have a dual WAN port firewall, that rolls over to a secondary ISP.  In the event that it rolls over to the secondary ISP, the PUBLIC IP of asterisk would change to for example 33.333.33.333.  

How can I make sure the Linksys IP phone will always find the asterisk server, even on the alternate IP address??
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

LVL 19

Accepted Solution

feptias earned 1000 total points
ID: 24435311
If you want to protect against the possibility of your main Internet connection failing, then you must consider the following:
a) which elements of your service will be affected
b) what options are available to you to provide an alternative solution
c) what level of service you want to be able to provide under those circumstances.

Any remote IP phones that were registered with your Asterisk PBX will lose service, but any IP phones being used as extensions on the LAN will be ok; Any SIP trunks or similar VoIP based PSTN connections will be out, but any analogue or ISDN connections will still work.

The only direct alternative to a broken Internet connection is to a second Internet connection through a different provider and on different cables. Many business grade firewalls/routers can accommodate dual WAN connections and the failover would be transparent for outbound connections but for inbound all your IP addresses will change (unless you are using some serious commercial equipment with BGP). To overcome the problem of your IP addresses changing, remote IP phones would need to use DNS-SRV or failover DNS. GoDaddy don't do failover DNS, but DNSMadeEasy and Netriplex do. However, there will be latency in the phones detecting that the old registration has failed before they re-register using the new addresses. DNS-SRV does not cause problems of 1-way audio.

What is the minimum level of service that must be maintained? Perhaps remote users would be ok provided they can still make calls to the PSTN, in which case a prepay VoIP account configured on one of the spare line keys might be adequate. If they need to maintain connectivity with the Asterisk PBX then you'll need the backup Internet route and the DNS-SRV or failover DNS.

What about incoming calls to the PBX? If they are all delivered over VoIP then you will have problems. If Asterisk registers with the service provider then it may not re-register itself (using the new IP address) until the normal registration expire time is reached - that can be half an hour or more. If your VoIP service provider connects to you by IP address then they will have to operate some kind of failover to reach you on the alternative IP address. Some VoIP service providers will be able to offer failover routing for your inbound calls, provided you have an alternative path that they can deliver to - that could be via conventional ISDN or analogue trunks.

What I've mentioned there just relates to failure of your Internet connection. Have you also considered failure of the Asterisk server, your router, firewall or LAN switch?
LVL 25

Assisted Solution

by:Ron Malmstead
Ron Malmstead earned 1000 total points
ID: 24435384
In this case, you have a few options...all of which require having two internet connections.

1, get your DNS hosted with someone who supports dns failover and server monitoring, so if your server shows offline it will update the host record to the failover ip address connection.  In this case you would have clients registering to a hostname... for example, rather than having them register to an IP address.  There could potentially be a short outage in service however...which is always the case when you are dealing with dns record changes.

2, you could put the voip traffic through a vpn,....and on many firewalls/routers you can use a vpn failover IP address.  In this case your clients wouldn't be registering to a public ip, but rather the internal , local ip address of your asterisk server and they would have to have vpn capability.

3, On the Linksys phones you have the ability to assign multiple extensions to different sip proxies.  In this case you would create identical settings for extensions 3 and 4 as you would 1 and 2, but with the failover address as the IP address.  You could also use 3 extensions on the main IP and one extension as a backup if you chose.  In this case I would leave the secondary failover connection in a down state, and it would be a manual intervention to restore service by bringing it up.  This would eliminate 1 or 2 extensions however on phones that support 4, also the phones would experience a delay in re-registering, depending on how fast your response time is and the registration interval you setup..
LVL 25

Expert Comment

by:Ron Malmstead
ID: 24435449
Worth noting, is that calls that were in progress at the time of the failover would be terminated immediately, no matter which option you choose.  These are options to failover the registration of the phones and the connection path.
LVL 19

Expert Comment

ID: 24439109
Another note - you will not be able to use the externip parameter in sip.conf. Instead you must use externhost and externrefresh. Set externhost to the host name used in your failover DNS A record and set externrefresh to something greater than the default 10 which is too low. I think 120 is ok for the refresh interval.

Author Closing Comment

ID: 31583575
Thanks for all the information !!! Very helpful.

Featured Post

Enhanced Intelligibility Without Cable Clutter

Challenge: The ESA office in Brussels wanted a reliable audio conference system for video conferences. Their requirement - No participant must be left out from the conference and the audio quality must not be compromised.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
I recently purchased a Bluetooth headset called the Music Jogger (model BSH10). The control buttons on it look like this: One of my goals is to use it as the microphone and speakers for Skype calls. In that respect, it works well. However, I …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question