Page 1 of 1

Loadbalancing dialplan

PostPosted: Mon Jan 16, 2017 7:03 am
by siva.ssk7
Hi,
Need dialplan for grouping multiple carriers with equal call distribution not asking for failover like "CHANUNAVAIL" or something the calls should equally distribute into multiple carriers. Pl help me on this

Re: Loadbalancing dialplan

PostPosted: Fri Jan 20, 2017 3:36 pm
by covarrubiasgg
This has been discussed before, you may try something like this

XXXXXXXXX[0-3], Dial (Carrier1)
XXXXXXXXX[4-6], Dial (Carrier2)
XXXXXXXXX[7-9], Dial (Carrier3)

Very simple, but fairly work :P

Re: Loadbalancing dialplan

PostPosted: Sun Jan 22, 2017 4:33 am
by williamconley
1) Welcome to the Party! 8-)

2) As you are obviously new here, I have some suggestions to help us all help you:

When you post, please post your entire configuration including (but not limited to) your installation method (7.X.X?) and vicidial version with build (VERSION: 2.X-XXXx ... BUILD: #####-####).

This IS a requirement for posting along with reading the stickies (at the top of each forum) and the manager's manual (available on EFLO.net, both free and paid versions)

You should also post: Asterisk version, telephony hardware (model number is helpful here), cluster information if you have one, and whether any other software is installed in the box. If your installation method is "manual/from scratch" you must post your operating system with version (and the .iso version from which you installed your original operating system) plus a link to the installation instructions you used. If your installation is "Hosted" list the site name of the host.

If this is a "Cloud" or "Virtual" server, please note the technology involved along with the version of that techology (ie: VMware Server Version 2.0.2). If it is not, merely stating the Motherboard model # and CPU would be helpful.

Similar to This:

Vicibox X.X from .iso | Vicidial X.X.X-XXX Build XXXXXX-XXXX | Asterisk X.X.X | Single Server | No Digium/Sangoma Hardware | No Extra Software After Installation | Intel DG35EC | Core2Quad Q6600

3) This has been posted several times, but is actually an asterisk concept and outside the Vicidial realm. What you want to do is make a call and record it as being part of a "Group". Then you check all the groups using if statements to see which has the least live calls right now, and send the call to an extension that will link it to that group, and send it through the associated carrier. It'll be a search, but it's in here. There are also examples in various Asterisk forums. Just remember that the AGI line and the Hangup line is absolutely required on every call. Either include them in each group, or execute them before/after the logic for switching between carriers.

[edit - i found a very old one from a notepad - far from perfect, but may contain the keywords that will help you find one that works for you, or just play with it]

Code: Select all
; ViciDial Outbound FailOver Dialing
exten => _91NXXNXXXXXX,1,NoOp("CG1: ${GROUP_COUNT(cg1)}") ; For debug/testing
exten => _91NXXNXXXXXX,n,NoOp("CG2: ${GROUP_COUNT(cg2)}") ; For debug/testing
exten => _91NXXNXXXXXX,n,NoOp("CG3: ${GROUP_COUNT(cg3)}") ; For debug/testing
exten => _91NXXNXXXXXX,n,NoOp("CG4: ${GROUP_COUNT(cg4)}") ; For debug/testing
exten => _91NXXNXXXXXX,n,NoOp("CG5: ${GROUP_COUNT(cg5)}") ; For debug/testing
exten => _91NXXNXXXXXX,n,AGI(agi://127.0.0.1:4577/call_log)
exten => _91NXXNXXXXXX,n,GotoIf($[${GROUP_COUNT(cg1)}<3]?110)
exten => _91NXXNXXXXXX,n,GotoIf($[${GROUP_COUNT(cg2)}<3]?120)
exten => _91NXXNXXXXXX,n,GotoIf($[${GROUP_COUNT(cg2)}<3]?130)
exten => _91NXXNXXXXXX,n,GotoIf($[${GROUP_COUNT(cg2)}<3]?140)
exten => _91NXXNXXXXXX,n,GotoIf($[${GROUP_COUNT(cg2)}<3]?150)
exten => _91NXXNXXXXXX,n,NoOp("Max Trunks Exceeded")
exten => _91NXXNXXXXXX,n,Congestion

exten => _91NXXNXXXXXX,110,Set(GROUP()=cg1)
exten => _91NXXNXXXXXX,n,NoOp("CG1: ${GROUP_COUNT(CG1)}") ; For debug/testing
exten => _91NXXNXXXXXX,n,Dial(${VICITRUNK1}/${EXTEN:1},,To)
exten => _91NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?120)
exten => _91NXXNXXXXXX,n,Hangup

exten => _91NXXNXXXXXX,120,Set(GROUP()=cg2)
exten => _91NXXNXXXXXX,n,NoOp("CG1: ${GROUP_COUNT(CG2)}") ; For debug/testing
exten => _91NXXNXXXXXX,n,Dial(${VICITRUNK2}/${EXTEN:1},,To)
exten => _91NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?130)
exten => _91NXXNXXXXXX,n,Hangup

exten => _91NXXNXXXXXX,130,Set(GROUP()=cg3)
exten => _91NXXNXXXXXX,n,NoOp("CG1: ${GROUP_COUNT(CG3)}") ; For debug/testing
exten => _91NXXNXXXXXX,n,Dial(${VICITRUNK3}/${EXTEN:1},,To)
exten => _91NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?140)
exten => _91NXXNXXXXXX,n,Hangup

exten => _91NXXNXXXXXX,140,Set(GROUP()=cg4)
exten => _91NXXNXXXXXX,n,NoOp("CG1: ${GROUP_COUNT(CG4)}") ; For debug/testing
exten => _91NXXNXXXXXX,n,Dial(${VICITRUNK4}/${EXTEN:1},,To)
exten => _91NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?150)
exten => _91NXXNXXXXXX,n,Hangup

exten => _91NXXNXXXXXX,150,Set(GROUP()=cg5)
exten => _91NXXNXXXXXX,n,NoOp("CG1: ${GROUP_COUNT(CG5)}") ; For debug/testing
exten => _91NXXNXXXXXX,n,Dial(${VICITRUNK5}/${EXTEN:1},,To)
exten => _91NXXNXXXXXX,n,GotoIf($["${DIALSTATUS}" = "CHANUNAVAIL"]?900)
exten => _91NXXNXXXXXX,n,Hangup

exten => _91NXXNXXXXXX,900,NoOp("Max Trunks Exceeded")
exten => _91NXXNXXXXXX,n,Congestion


This version is for a specific number of calls with each carrier before jumping to the next one, and also has failover built in. But it could be modified for balancing by comparing them to each other instead of a static number.

Re: Loadbalancing dialplan

PostPosted: Sun Jan 29, 2017 9:31 am
by siva.ssk7
I have tried this dial plan it's hitting to first span (cg1) and it's goes to cg2 only if gets dialstatus as "CHANUNAVAIL" i need loadbalance dialplan all the spans grouped should equally share. i'm using gsm gateway and if all the channels goes to first gateway it's getting hanged.

Re: Loadbalancing dialplan

PostPosted: Sat Feb 11, 2017 8:29 pm
by williamconley
In that case, you'll need a version that checks for live calls in each group, and goes to the next group if the limit is reached (or if one is higher than another, depending on your goal). There have been several posted both here an on asterisk forums.

Also: This isn't General Discussion. It's a Support Request. Moving to Support board.