Excellent post okli
Another method using globals strings:
Carrier A:
- Code: Select all
Globals String: TRUNKA=SIP/carriera
Account Entry: [carriera] (with all sip context info beneath)
Dialplan Entry:
exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _91NXXNXXXXXX,n,Dial(${TRUNKA}/${EXTEN:1},,tTor)
exten => _91NXXNXXXXXX,n,Hangup
Dial Prefix in Campaign: 9
Carrier B:
- Code: Select all
Globals String: TRUNKB=SIP/carrierb
Account Entry: [carrierb] (with all sip context info beneath)
Dialplan Entry:
exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _91NXXNXXXXXX,n,Dial(${TRUNKB}/${EXTEN:1},,tTor)
exten => _91NXXNXXXXXX,n,Hangup
Dial Prefix in Campaign: 8
Now you can switch between carrier a and carrier b in the campaign by changing "9" to "8" in the dial prefix. You can also route one to another (without changing the prefix!) by modifying the dialplan's TRUNKA to TRUNKB (which will have the effect of sending the dial 8 service out through the dial 9 carrier during an outage or for testing WITHOUT having to change 12 campaign's dial prefixes!)
You will also note that your dialplan entry in all cases is virtually identical. One digit different in the "exten" (first digit) and the carrier variable is different.
This also allows pointing to SIP or IAX or even DAHDI/ZAP without having to remember to change the protocol. Handy for those of us who use them all and often forget (that information is stored in the global string variable, and choosing another gets the PROTOCOL and carrier as a matched pair).