Asterisk dialpaln [context] : context in asterisk dialpaln

Contexts

Dialplans are broken into sections called contexts. Contexts are named groups of extensions, which serve several purposes.

1. Contexts keep different parts of the dialplan from interacting with one another.

2. An extension that is defined in one context is completely isolated from extensions in any other context, unless interaction is specifically allowed.

3. As a simple example, let’s imagine we have two companies sharing an Asterisk server.If we place     each company’s voice menu in its own context, they are effectively separated from each other.           This allows us to independently define what happens when, say, extension 0 is dialed: people             pressing 0 at Company A’s voice menu will get Company A’s receptionist, and callers pressing 0 at     Company B’s voice menu will get Company B’s receptionist. (This example assumes, of course,         that we’ve told Asterisk to transfer the calls to the receptionists when callers press 0.)

Contexts are denoted by placing the name of the context inside square brackets ([ ]).

The name can be made up of the letters A through Z (upper- and lowercase), the numbers 0 through 9, and the hyphen and underscore.* For example, a context for incoming calls looks like this:

[incoming]

Please not New things about context

  •  Space is conspicuously absent from the list of allowed characters. Don’t use spaces in your context names
  •  Context names have a maximum length of 79 characters (80 characters –1 terminating null)
  •  All of the instructions placed after a context definition are part of that context, until the next context is defined. At the beginning of the dialplan, there are two special contexts named [general] and [globals]. The [general] section contains a list of general dialplan settings
  • you may name your contexts anything you like.

When you define a channel (which is how you connect things to the system), one of the parameters that is defined in the channel definition is the context. In other words, the context is the point in the dialplan where connections from that channel will begin.

Another important use of contexts (perhaps the most important) is to provide security.

By using contexts correctly, you can give certain callers access to features (such as longdistance calling) that aren’t made available to others. If you don’t design your dialplan carefully, you may inadvertently allow others to fraudulently use your system. Please keep this in mind as you build your Asterisk system.

Related Posts

  • 55
    Dialplan Introduction:  
    Tags: dialplan, asterisk
  • 42
    In Asterisk, a macro is a special kind of context which can be expanded within the definition of another context. Its name must begin with “macro-”. A macro is expanded by using the Macro command. All the lines of the macro definition should only use the s extension; the actual extension will come from the line in the calling context on…
    Tags: context, asterisk
  • 35
    Pre-dial handlers allow you to execute a dialplan subroutine on a channel before a call is placed but after the application performing a dial action is invoked. This means that the handlers are executed after the creation of the caller/callee channels, but before any actions have been taken to actually…
    Tags: dialplan, asterisk
  • 31
    What is Asterisk? Asterisk is an open source framework for building communications applications. Asterisk turns an ordinary computer into a communications server. Asterisk powers IP PBX systems, VoIP gateways, conference servers and other custom solutions. It is used by small businesses, large businesses, call centers, carriers and government agencies, worldwide.…
    Tags: asterisk
  • 30
    Dial() is perhaps the most important application in Asterisk. Dial() accepts every valid channel type (e.g. SIP, IAX2, H.323, MGCP, Local, Zap, Dahdi), The allowable parameters are channel-specific; i.e., what parameters a channel requires or will accept depends on the nature of the channel technology. For example, a SIP channel will require an IP address…
    Tags: asterisk, context

Satya Prakash

VOIP Expert: More than 8 years of experience in Asterisk Development and Call Center operation Management. Unique Combination of Skill Set as IT, Analytics and operation management.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: