Sunday, June 12, 2016

vicidial or goautodial dialplan entry tutorial

Asterisk / Vicidial /goautodial dialplan guide

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

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 / goautodial  we will defining the dialplan in dialplan entry field under Carrier settings.
     

The Dialplan Syntax

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

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


Example dialplan for understanding

example 1
exten => 123,1,Answer

In this example the name is 123 , priority is 1 and Application is Answer
example 2
exten => 123,1,Answer
exten => 123,2,Hangup

Is this example the name is 123, and priorities 1 followed 2 ,  Applications  Answer followed by Hangup 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
[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 example dialplan with pattern matching

example 1:
if you want to dial  US no  ie 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


Vairables.

As of this tutorial we are not going deep into variable, only we will consider ${EXTEN} Variable
For more detail about the variable check this link
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

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()

NOTE : FOR THE DIGIUM OR SANGOM CARD INSTALLATION CLICK THE BELOW LINKS

No comments:

Post a Comment