How to use multiple carriers/Trunks in Vicidial

Asterisk dialplan to dial over multiple carriers

Topic: How to use multiple carriers/Trunks in Vicidial
vicidial dialover multiple trunk

  Overview: Vicidial Multiple Carriers

    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
ADMIN > Carrier > Add a new carrier

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


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

exten => _9X.,1,AGI(agi://
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()

  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
Primary trunk name: TRUNKA
Secondary trunk name: TRUNKB

exten => _9X.,1,AGI(agi://
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()


    Hope the article is helpful, for professional support reach me on skype: striker24x7
Next Post Previous Post
  • 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.

    • striker king
      striker king 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