Load Balance Trunks

Home » Asterisk Users » Load Balance Trunks
Asterisk Users 3 Comments

On Wed, 29 Jun 2011, Abid Saleem wrote:

> 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.

The arrangement sounds ‘sketchy’ to me 🙂

You will need to use a database (MySQL, ASTDB, etc) of some sort to keep
persistent (surviving a crash or restart) track of the usage. You will
also need some sort of lock mechanism (usually a feature of a ‘real’
database) to prevent race conditions with
regard to simultaneous calls.

While you can code up database access in dialplan, my personal preference
is to wrap database code up in an AGI because you have better control,
robustness and maintainability. Also, database access in dialplan is just
plain ugly.

Is your intent to ‘load balance’ between 100 trunks or will you fill up
one before moving on to the next? Can unused capacity be ‘rolled over’ to
the next day?

What happens if you ‘go over?’ Will the call in flight be terminated? Will
the next origination fail? Will you get a nasty rate spike?

3 thoughts on - Load Balance Trunks

  • Dear AJS,
    Thank you for your response with good idea. Unfortunately I am not good at programming. Can you please write this AGI script for me. Please help if you can.

  • Sure I can help.

    But you’ll need to contact me off-list, as the rules here forbid the
    discussion of services in respect of which money is going to be changing