Distribute calls between two internet connections

Hi all,

I have a customer who would require two internet connections in order to handle the volume of outbound calls they plan to make.

Connecting the two ADSL routers to the network is no problem, but how do I tell asterisk to either:

  1. alternate outbound calls between the two routers or
  2. use one router for half the staff, and the other for the remaining half

Inbound calls is not a problem as they are primarily an outbound-only business.

Thanks for any input

  1. manipulate a global variable, with appropriate locking (I have no experience of locking in dialplans);

  2. hash the callerid to compute the outgoing trunk.

Hi David,

Thanks for the reply (again) :smile:

I can understand how to do it at dialplan level, but at IAX.conf level how do I specify that one channel should use one router, and the other channel the other router?

For example in my IAX.conf I would have two outbound trunks (both from the same provider):



How do I tell * that one trunk should route over gateway and the other over


You didn’t say they were the same address.

The easiest solution is not to do anything in Asterisk, but to use one router with multiple physical level connections (well, actually, the easiest is to use one fast link), all load sharing traffic for the same address. If you are likely to saturate an ADSL connection with VoIP, you need to be talking to your ISP, anyway.

Otherwise, you may be able to bind the two trunks to different local virtual interfaces. The solution is likely to require detailed OS knowledge and router knowledge, rather more than Asterisk knowledge.


I dont think you are going to easily do what you want, what you can do is instead of using the loadbalancer user the indevidual server blade addresses , contact gtadwell suport for them or check the recent post on the gradwell rss feed for voip support too do with LB issues.

this will mean you can then create a route for each server.


:smiley: Excellent :smiley:

The individual IAX servers are:

So I can pick two of them and setup static routes for each one, with the third one as a failover. I’ll contact Gradwell to see if there’s any problem with me doing so, just to be sure.

David, your comment “If you are likely to saturate an ADSL connection with VoIP, you need to be talking to your ISP” - can you elaborate please?

They’ll be making approximately 6 simultaneous IAX g711a calls per circuit, upstream is 850k, downstream 10000k on each line. The ISP has a peering arrangement with gradwell.


You might want to look at g729 as you will be running at over 50% of the uplink capacity and may suffer with collisions latency and jitter.


When ADSL+ was introduced, the minimum guaranteed network capacity, provided by BT, amounted to 100kbps for the average business user averaged over the peak period. Whilst this figure may have increased, it probably has not reached 850kbps (although I was forgetting that VoIP is symmetric and therefore thinking about the downstream limits).

ISPs rely on some users under using during peak periods, or only using off peak, and others overusing, and may have price breaks to encourage under users. Because you are only saturating 850k, rather than 10,000k, you won’t be at the very heaviest user end of the spectrum.

However, you also want guaranteed bandwidth, whereas IP networks are based on the idea that, over the long term you may get predictable bandwidth, but in the short term, you may have to compete with a lot of other users making high demands, so you need to be discussing what proportion of the time the ISP believes they can realistically meet your bandwidth demands.

Actually, even if you were to generate 850k for 8 hours a day, you would be in the range were many ISPs would impose fair usage limits.