vicidial dialplan entry tutorial -asterisk dialplan basic

    A Step by step guide to write and understand the asterisk Dialplan in vicidial Dialplan entry tab. Once the carrier is configured in vicidial you may confused what to write in the Dialplan entry tab so that you can use the carrier in campaign to dial out. This Post is also used as asterisk Dialplan basic guide.

    The Following Tutorial will help you how to write a dialplan in asterisk / vicidial / goautodial for making Outbound calls via the trunk or carrier configured.

vicidial dialplan entry
vicidial asterisk dialplan entry

What is Asterisk Dialplan

              The Dialplan defines how Asterisk handles inbound and outbound calls. It is specified in the configuration file named  extensions.conf. The extensions.conf file usually resides in the /etc/asterisk/ directory
                 But in vicidial or Goautodial  we will defining the Dialplan in Dialplan entry field under Carrier settings.

The Dialplan Syntax

Before writing the Dialplan , we need to understand the Asterisk Dialplan syntax , the syntax is similar to other coding languages like HTML, PHP etc.

The Syntax for the Asterisk dialplan is

exten => name,priority,application

name - the name or number of the extension ie: 123 ,abcd, or pattern matching X

Priority - The priority (each extension can include multiple steps; the step number is called - the "priority") ie 1, 2, 3

Application - The application (or command) that performs some action on the call
like Playback, Dial, Hangup, AGI, Answer etc.

Sample dialplan for understanding

Let's see few Dialplan examples or better understanding of basics.

example 1

exten => 123,1,Answer

In this example the name is 123 , priority is 1 and Application is Answer, Which means if someone dials 123 this Dialplan will be executed and get answered.

example 2
exten => 123,1,Answer
exten => 123,2,Hangup

Is this example the name is 123, and priorities 1 followed by 2 , Applications Answer followed by Hangup's the call which is the second priority.

Dialplan Pattern Matching

Before getting into the advance Dialplan we need to understand the pattern matching

Pattern Matching tells asterisk that we are matching on a pattern and not a explicit number

The dialplan syntax with pattern matching is

exten => _XZN,priority,Application

below are the Patterns options value

X Matches any single digit from 0 to 9
Z Matches any single digit from 1 to 9
N Matches any single digit from 2 to 9
.(period or dot) Matches any digits or any value with one or more characters 

[147-9] Matches a single digit from the range of digits specified. In this case, the pattern matches a single 1, 4, 7 8 or 9

. (period) Wildcard match; matches one or more characters, no matter what they are. If you're not careful, wildcard matches can make your dialplans do things you're not expecting (like matching built-in extensions such as i or h). You should use the wildcard match in a pattern only after you've matched as many other digits as possible. For example, the following pattern match should probably never be used: _. In fact, Asterisk will warn you if you try to use it. Instead, use this one, if at all possible: _X.

! (bang) Wildcard match; matches zero or more characters, no matter what they are.

Some dialplan with pattern matching

Lets see few sample Dialplan with Pattern matching.

example 1:
if you want to dial US no that is starting with code 1 and followed by 10 digits

exten => _1XXXXXXXXXX,1,Answer

example 2:
Dialling UK no ie code 44 followed by 10 digit

exten => _44XXXXXXXXXX,1,Answer

example 3;
US no 7 digits followed by 1
exten => _1XXXXXXX,1,Answer

example 4:

first digits should be 1,2,4 and 9 rest 10 digits many any no

exten => _[1249]XXXXXXXXXX,1,Answer()

example 5:
if you are not sure about digits you can use period . ie(dot)

exten => _1X.,1,Answer()

this dialplan accept any number followed by 1 ie above 2 digit

Asterisk dialplan Vairables

In this topic we are not going deep into variables, only we will consider ${EXTEN} Variable

A variable is just predefined value set by a program and defined as ${somename}
He we are going use ${EXTEN} which is nothing but the number which we dial
For eg if we dial 1234567890 in above example dialplan the value of ${EXTEN} IS 1234567890

VICIDIAL OR Goautodial Dialplan entry

Below is the sample Dialplan to used for vicidial Dialplan entry, The Priority 1 with AGI application is must in vicidial to log and maintain the session of the calls dialed in each servers.

For sip trunks

exten => _1XXXXXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _1XXXXXXXXXX,2,Dial(SIP/siptrunkname/${EXTEN},,tTo)
exten => _1XXXXXXXXXX,3,Hangup()

For PSTN(PRI/E1/T1/FXO) trunks

exten => _1XXXXXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _1XXXXXXXXXX,2,Dial(DAHDI/G0/${EXTEN},,tTo)
exten => _1XXXXXXXXXX,3,Hangup()

Conclusion

    Hope this tutorial is helpful, I personally recommend to have a prefix based dialing for security aspect  check out by vicidial security tutorial for securing or hardening the vicidial servers. For professional help reach out to me on skype or telegram : striker24x7

Next Post Previous Post
1 Comments
  • gopi baskar
    gopi baskar April 4, 2022 at 11:15 AM

    vicidial dialplan entry tutorial

Add Comment
comment url