Tap here to compare the top VoIP providersTap here to hide the top VoIP Providers
Asterisk Dialplan Introduction
Introducing Contexts and ExtensionsThe Dialplan consists of a collection of contexts. These context definitions are the most important part of the extensions.conf file and are the most important part of Asterisk configuration.
A context is just a collection of extensions. Here is a diagrammatic representation (i.e. not something you'd type into your extensions.conf file!) of a simple example context:
101 Mark Spencer
102 Wil Meadows
103 Greg Vance
104 Check voicemail
105 Conference Room
In this example context, which has been given the name "default", the first three extensions (101 to 103) all would be associated with ringing phones belonging to various employees. The fourth extension (104) would be associated with allowing someone to check their voicemail. The fifth extension (105) would be associated with a conference room. Finally, the "0" extension would be associated with the operator.
Here is another simple example of a context:
s Welcome message and instructions
This example context, given the name "mainmenu", has only single-digit extensions. The "s" extension is the start extension, where the caller begins. This extension would play a message along the lines of "Thank you for calling OurCompany. Press 1 for sales, 2 for support, 3 for accounting, 9 for a company directory, or # to hangup." Each menu option is, in fact, an extension and could either dial someone's real extension or could do something like sending the caller to another menu.
Contexts can be used to implement a number of important features including:
- Security: Permit long distance calls from certain phones only
- Routing: Route calls based on extension
- Autoattendant: Greet callers and ask them to enter extensions
- Multilevel menus: Menus for sales, support, etc.
- Authentication: Ask for passwords for certain extensions
- Callback: Reduce long distance charges
- Privacy: Blacklist annoying callers from contacting you
- PBX Multihosting: Yes, you can have "virtual hosts" on your PBX
- Daytime/Nighttime: You can vary behavior after hours
- Macros: Create scripts for commonly used functions
How Are Contexts Used?When Asterisk receives a call connection, whether an incoming call from outside, or from an internal extension, that call belongs to a context. Which context the call belongs to depends on what channel the call came in on. When you configured the channels that you have on your Asterisk PBX, one of the things you had to do was to define what context an incoming connection on that channel would be put into, using a definition like:
So the first way contexts are used is to make Asterisk do different things depending on where a call is coming from. You most likely will have at least one context defined for how Asterisk handles an incoming call on your telephone line: it might ring some of your extensions or play an announcement and record a voicemail message. You want Asterisk to handle connections from your internal extensions differently — they will be permitted to dial a different extension, or make an outgoing call — so you define that calls from those different channels go into different contexts.
Asterisk | Configuration | The Dialplan - extensions.conf
If you are not so familiar with Asterisk dialplan syntax, dialplan priorities, or you simply do not prefer coding using text editors, you may find Visual Dialplan for Asterisk useful tool for your dialplan development. Visual Dialplan for Asterisk is modern rapid application development platform for Asterisk dialplan development, it provides similar interface and approach like Visual Basic provides for rapid application development and comes with real world dialplan examples (extensions.conf files that can be used without visual dialplan) .
Download Visual Dialplan for Asterisk
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+