Yes sure you can use 2 (or more) carriers at same time with setting to "Y". But it's bad practice to use exactly the same dialplan without putting a prefix in front of the dialplan for both carriers, because then you are not able to control which carrier will be used for dialing. Please read "asterisk pattern matching" (particularly: Order of Pattern Matching) here:
https://wiki.asterisk.org/wiki/display/AST/Pattern+MatchingAsterisk uses a simple set of rules to sort the extensions and patterns so that the best match is found first. The best match is simply the most specific pattern
For example in your case:
- Code: Select all
;Carrier 1 dialplan:
exten => _91999NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _91999NXXXXXX,2,Dial(${TESTSIPTRUNK}/${EXTEN:2},,To)
exten => _91999NXXXXXX,3,Hangup
;Carrier 2 dialplan exactly same (but different dial string):
exten => _91999NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _91999NXXXXXX,2,Dial(${TESTSIPTRUNK2}/${EXTEN:2},,To)
exten => _91999NXXXXXX,3,Hangup
Now Asterisk looks for the best matching pattern, but this is not possible, because "_91999NXXXXXX" is for both dialplans the same and equivalent. So what happens? You think Asterisk will randomly use both carriers. No this won't happen. Asterisk takes the matching one, which is previously/above defined "extensions-vicidial.conf", and this is always the same one.
That's why you should put different prefixes in front of both carrier dialplans like here:
Carrier1: exten => _91999NXXXXXX
Carrier2: exten => _81999NXXXXXX
And now you change in campaign settings the dial prefix to "8" or "9" (or different). So every call from this campaign gets this prefix dialed in front of your called number. Now Asterisk knows, which dialplan to use because of matching 9 or 8 in front.
But if you want to use both in parallel then use this dialplan with random order (as described before):
1. Define carrier1 with dial prefix "8" with global string "TESTSIPTRUNK"
2. Define carrier2 with dial prefix "9" with global string "TESTSIPTRUNK2" and put in dialplan entry of carrier2 this:
- Code: Select all
exten => _91999NXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _91999NXXXXXX,n,Set(Trunk=${RAND(1|2)})
exten => _91999NXXXXXX,n,GoToIf($[${Trunk} = 1]?trunkA)
exten => _91999NXXXXXX,n,GoToIf($[${Trunk} = 2]?trunkB)
exten => _91999NXXXXXX,n(trunkA),Dial(${TESTSIPTRUNK}/${EXTEN:2},,To)
exten => _91999NXXXXXX,n(trunkB),Dial(${TESTSIPTRUNK2}/${EXTEN:2},,To)
exten => _91999NXXXXXX,n,Hangup