text stringlengths 0 152 |
|---|
[services] ; Special services such as conferencing could be defined here |
When you define a channel (which is not done in the extensions.conf file), one of the |
required parameters in each channel definition is context. The context is the point in |
the dialplan where connections coming from that channel will arrive. So the way you |
plug a channel into the dialplan is through the context (see Figure 6-2). |
Figure 6-2. Relation between channel configuration (on the left) and contexts in the |
dialplan (on the right) |
This is one of the most important concepts to understand when |
dealing with channels and dialplans. Troubleshooting call flow is |
much easier once you understand the relationship between the |
channel context (which tells the channel where to plug into the |
dialplan) and the dialplan context (which is where we create the |
call flow that happens when the call arrives). |
An important (perhaps the most important) use of contexts is to provide privacy and |
security. By using contexts correctly, you can give some channels access to features |
2 The default context used to be a popular way to whip up simple configurations, but this proved to be some‐ |
what problematic for security. Best practice these days is to avoid all use of it. |
80 |
| |
Chapter 6: Dialplan Basics |
(such as long-distance calling) that aren’t made available to others. If you do not |
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; there are |
many bots on the internet that were specifically written to identify and exploit poorly |
secured Asterisk systems. |
The Asterisk wiki outlines several steps you should take to keep |
your Asterisk system secure. It is vitally important that you read |
and understand this page. If you ignore the security precautions |
outlined there, you may end up allowing anyone and everyone to |
make long-distance or toll calls at your expense! |
If you don’t take the security of your Asterisk system seriously, you |
may end up paying—literally. Please take the time and effort to |
secure your system from toll fraud. |
Extensions |
In the telecommunications industry the word extension typically has referred to a |
numeric identifier that, when dialed, will ring a phone (or system resource such as |
voicemail or a queue). In Asterisk, an extension is far more powerful, as it defines the |
unique series of steps (each step containing an application) through which Asterisk |
will take that call. |
Within each context, we can define as many (or few) extensions as required. When a |
particular extension is triggered (by an incoming channel), Asterisk will follow the |
steps defined for that extension. It is the extensions, therefore, that specify what hap‐ |
pens to calls as they make their way through the dialplan. Although extensions can, of |
course, be used to specify phone extensions in the traditional sense (i.e., extension |
153 will cause the SIP telephone set on John’s desk to ring), in an Asterisk dialplan, |
they can be used for much more. |
The syntax for an extension is the word exten, followed by an arrow formed by the |
equals sign and the greater-than sign, like this: |
exten => |
This is followed by the name (or number) of the extension. |
When dealing with traditional telephone systems, we tend to think of extensions as |
the numbers you would dial to make another phone ring. In Asterisk, extension |
names can be any combination of numbers and letters. Over the course of this chap‐ |
ter and the next, we’ll use both numeric and alphanumeric extensions. |
Dialplan Syntax |
| |
81 |
Assigning names to extensions may seem like an unusual concept, |
but when you realize that SIP supports dialing by all sorts of char‐ |
acter combinations (anything that is a valid URI, strictly speaking), |
it makes perfect sense. This is one of the features that makes Aster‐ |
isk so flexible and powerful. |
Each step in an extension has three components: |
• The name (or number) of the extension |
• The priority (each extension can include multiple steps; the step number is called |
the “priority”) |
• The application (or command) that will take place at that step |
These three components are separated by commas, like this: |
exten => name,priority,application() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.