Shaun Wingrin
asked on
Asterisk network interface selection to load balance accross 2 or more ADSL lines
Hi,
I have a bandwidth limitation and need to carry 8 simultaneous calls. Each of the ADSL lines available can carry a maximum of 4 simultanous calls.Any idea how to setup Asterisk so that the IAX2/SIP calls are sent down two seperate network interfaces (connected to ADSL) and thereby allowing agregating the bandwidth. There is only one ip to send the calls to as the Asterisk sends all calls to the central Asterisk server and they are then forwarded from there. I was thinking of setting up two IAX2 trunks with different ports and then natting the IAX2 port on the linux server and forcing the traffic down an ip interface based on the port. Not that I know how to do this.
However the one problem I have is how to ensure that Asterisk splits the calls over the two IAX trunks?
Any suggestions welcome.
I have a bandwidth limitation and need to carry 8 simultaneous calls. Each of the ADSL lines available can carry a maximum of 4 simultanous calls.Any idea how to setup Asterisk so that the IAX2/SIP calls are sent down two seperate network interfaces (connected to ADSL) and thereby allowing agregating the bandwidth. There is only one ip to send the calls to as the Asterisk sends all calls to the central Asterisk server and they are then forwarded from there. I was thinking of setting up two IAX2 trunks with different ports and then natting the IAX2 port on the linux server and forcing the traffic down an ip interface based on the port. Not that I know how to do this.
However the one problem I have is how to ensure that Asterisk splits the calls over the two IAX trunks?
Any suggestions welcome.
ASKER
This is a valuable answer. How can I limit the number of simultaneous calls to say four? The ADSL line can only carry 4 simultaneous calls and with the dialling as above if there are a number of long calls then one of the channels may have too many calls on it... How can I see how many calls are going to a particular host? Based on this how can I choose where to send the next call? With this setup I can place the call to a particular host so as to properly load balance...
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thank you for the informative advice. In my case its not so much an issue of load balancing as just ensuring that no more than 4 calls are carried by one adsl line at any one time. It seems ti me the easiest way is to count how many calls are active on an IAX2 trunk and based on this descide where to send the next call. Is there any way to get a count of the calls on each trunk?
I'm using IAX2. Am I correct in saying that there is no way to limit the number of iax2 calls allowed on a trunk?
I'm using IAX2. Am I correct in saying that there is no way to limit the number of iax2 calls allowed on a trunk?
ASKER
However the one problem I have is how to ensure that Asterisk splits the calls over the two IAX trunks. This solution assumes SIP. Will it work for IAX?
You can do a kind of load balancing in asterisk by using a global variable that increments each time a new call arrives, then using gotoif to select a different path depending whether the variable is odd or even (perhaps using the modulus math operand):
http://www.voip-info.org/wiki-Asterisk+Dialplan+Globals
http://www.voip-info.org/wiki/view/Asterisk+cmd+GotoIf
http://www.voip-info.org/wiki/view/Asterisk+func+math
Another solution might be to randomly select the outbound route:
http://www.voip-info.org/wiki/view/Asterisk+cmd+Random