[asterisk-users] Load Balance Trunks

A J Stiles asterisk_list at earthshod.co.uk
Wed Jun 29 10:07:25 CDT 2011


On Wednesday 29 Jun 2011, Abid Saleem wrote:
> Hi All,
> I have 100 Trunks from my Provider. My Provider is restricting me to make
> only 120 minutes Call duration / trunk / day. So I want to load balance my
> calls to these 100 trunks. Please advise in this regard ASAP. Thanks in
> advance. Regards-----------Abid SaleemTechnical Manager NGNTerminus
> Technologies

What you will have to do is, set up a database keeping track of how much time 
has been used on each trunk; and create two AGI scripts.  One, which you run 
immediately before your Dial() statement, sets a channel variable indicating 
which trunk to use.  (Inside a loop, pick a trunk at random; and if there are 
minutes to spare on that trunk, and it's not in use, exit the loop.  Then set 
a channel variable, and mark the trunk as in use.)  Another, which you run in 
your h extensions, updates the database; subtracting the duration of the call 
just finished from the time allotted to that trunk, and marking it available.

If you were pathologically dishonest, this technique probably would also work 
for leeching other people's bandwidth in doses small enough to go 
unnoticed .....  ;)

-- 
AJS

Answers come *after* questions.



More information about the asterisk-users mailing list