Page 150 - Asterisk™: The Future of Telephony
P. 150
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 tradi-
tional telephone systems, we tend to think of extensions as the numbers you would
dial to make another phone ring. In Asterisk, you get a whole lot more; for example,
extension names can be any combination of numbers and letters. Over the course of
this chapter and the next, we’ll use both numeric and alphanumeric extensions.
Assigning names to extensions may seem like a revolutionary concept,
but when you realize that many VoIP transports support (or even ac-
tively encourage) dialing by name or email address instead of only
dialing by number, it makes perfect sense. This is one of the features
that makes Asterisk so flexible and powerful.
A complete extension is composed of 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 performs some action on the call
These three components are separated by commas, like this:
exten => name,priority,application()
Here’s a simple example of what a real extension might look like:
exten => 123,1,Answer()
In this example, the extension name is 123, the priority is 1, and the application is
Answer(). Now, let’s move ahead and explain priorities and applications.
Priorities
Each extension can have multiple steps, called priorities. Each priority is numbered
sequentially, starting with 1, and executes one specific application. As an example, the
following extension would answer the phone (in priority number 1), and then hang it
up (in priority number 2):
exten => 123,1,Answer()
exten => 123,2,Hangup()
122 | Chapter 5: Dialplan Basics