How to use multiple carriers/Trunks in Vicidial

Topic: Multiple carriers or trunk in vicidial

    This article is all about using multiple carriers or trunks in vicidial to dial either in Random or Round Robin or as failover to another trunk/carrier.

    In simple using multiple carriers/trunks to dial from a single campaign either dial in random or use it as failover trunk


how to use multiple trunk in vicidial campaign

Vicidial Multiple Carriers Dialplan

    In Vicidial you may need to dial over multiple carriers either in random mode or as a failover trunk (Dial over other trunk if primary trunk fails to dial out).
    Using the Asterisk dialplan and RAND function, dialing over multiple carriers is achieved.

Dialplan to Dial over multiple carriers in random

    Create all three carriers in the vicidial as usual way you create a new carrier or in sip.conf and give a proper name like voip1 voip2 voip3.

ADMIN > Carrier > Add a new carrier

Example you have created three carriers with below Global String in each carrier.

TRUNKA=SIP/voip1
TRUNKB=SIP/voip2
TRUNKC=SIP/voip3

Now in any one of the carriers use the below dialplan.

exten => _9X.,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _9X.,n,Set(Trunk=${RAND(1|3)})
exten => _9X.,n,GoToIf($[${Trunk} = 1]?trunkA)
exten => _9X.,n,GoToIf($[${Trunk} = 2]?trunkB)
exten => _9X.,n,GoToIf($[${Trunk} = 3]?trunkC)
exten => _9X.,n,Hangup
exten => _9X.,n(trunkA),Dial(${TRUNKA}/${EXTEN:1},,tTo)
exten => _9X.,n(trunkB),Dial(${TRUNKB}/${EXTEN:1},,tTo)
exten => _9X.,n(trunkC),Dial(${TRUNKC}/${EXTEN:1},,tTo)
exten => _9X.,n,Hangup()

The above dialplan will dial between the trunks in random mode also failover to voip2 and voip3 

Dialplan to Failover to another trunk

    If you want to use the secondary trunk as a failover, that is in case primary trunk failed to dial due to trunk down, or congestion use the below dialplan
In this dialplan we will using the DIALSTATUS to decide to failover to secondary trunk
example 
Primary trunk name: TRUNKA
Secondary trunk name: TRUNKB
exten => _9X.,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _9X.,n(fail),Dial(${TRUNKA}/${EXTEN:1},,tTo)
exten => _9X.,n,GotoIf($["${DIALSTATUS}"="CHANUNAVAIL"|"${DIALSTATUS}"="CONGESTION"]?failover)
exten => _9X.,n,Hangup()
exten => _9X.,n(failover),Dial(${TRUNKB}/${EXTEN:1},,tTo)
exten => _9X.,n,Hangup()

Conclusion:

    Hope the article is helpful, for more details on dialplan checkout by blog archives. for professional support reach me on skype: striker24x7
2 Comments
  • Anonymous
    Anonymous October 2, 2021 at 12:32 AM

    Is the same value for trunkA and TRUNKA
    I difine this --> TRUNKA=SIP/sipA, but can not undastant where I need to define trunkA

    Or we just difine this just for dial plan above --> here (exten => _9X.,n,GoToIf($[${Trunk} = 1]?trunkA)
    Thanks in advance.

    • Ajit Kumar
      Ajit Kumar October 2, 2021 at 6:58 PM

      TRUNKA = SIP/sipA this is global variable set for your carrier

      and TRUNKA name i used as lable name to goto app

      exten => _9X.,n(lablename),

      exten => _9X.,n(trunkA),DialSIP/sipa/${EXTEN:1},,tToR)
      exten => _9X.,n(trunkB),Dial(SIP/sipb/${EXTEN:1},,tToR)
      exten => _9X.,n(trunkC),DialSIP/sipc/${EXTEN:1},,tToR)

Add Comment
comment url