Alternating outgoing calls between two trunks

Hi guys,
I have two trunks on pbx and I need to send outgoing calls alternating
between those two trunks, lets say: call1 is going to trunk1, call2 is going
to trunk2, call3 is going to trunk1, call4 is going to trunk2, call5 is going to trunk1…
and so on. Any idea?

Hey lun,

I would use a global variable or an AstDB entry which I would switch between 0 and 1 for each call, and depending on the value, use trunk1 or trunk2.

In your outgoing context:
If var == 0
var = 1
outgoing through trunk1
If var == 1
var = 0
outgoing through trunk2

If you wanna get some more randomness, you could use the RAND() function.



Yes, at the end I used similar solution from this forum:
Thx for your replay!