Hi guys
Is there way to create random trunks for outbound call?
For example, I have 3 trunks. When i dial 1XXXXXXXXXX to call out, the freepbx will be supposed to choose one of those 3 trunks randomly.
Thanks
Hi guys
Is there way to create random trunks for outbound call?
For example, I have 3 trunks. When i dial 1XXXXXXXXXX to call out, the freepbx will be supposed to choose one of those 3 trunks randomly.
Thanks
You might want to look at using RAND() function in your dialplan.
http://www.voip-info.org/wiki/view/Asterisk+func+rand
You could use it in conjunction with GoToIf function:
[code][to-random-trunk]
_NXXXXXXXXX,1,Answer
_NXXXXXXXXX,n,SetVar(TrunkNumber=RAND(1,3))
_NXXXXXXXXX,n,GoToIf($[TrunkNumber = 1]?GoTo(trunk1,s,1))
_NXXXXXXXXX,n,GoToIf($[TrunkNumber = 2]?GoTo(trunk2,s,1):GoTo(trunk3,s,1))
[trunk1]
s,1,Dial(…)
s,n,HangUp
[trunk2]
s,1,Dial(…)
s,n,HangUp
[trunk3]
s,1,Dial(…)
s,n,HangUp[/code]
This is just a code snippet and I hope I can be of help.
Update: I made a lot of edits in my post.
If you are using FreePBX 2.6 you can use the trunkbalance module.
You can then choose the ratio between each trunk.
Have a look there:
http://projects.colsolgrp.net/wiki/trunkbalance/User_Manual