text
stringlengths
0
152
—Doctor Who
Asterisk is very different from other, more traditional, PBXs in that the dialplan in
Asterisk treats all incoming channels in essentially the same manner, rather than sep‐
arating them into stations, trunks, peripheral modules, and so forth.
In a traditional PBX, there is a logical difference between stations (telephone sets)
and trunks (resources that connect to the outside world). This limitation makes crea‐
tive routing in traditional PBXs very difficult or impossible.
Asterisk, on the other hand, does not have an internal concept of trunks or stations.
In Asterisk, everything that comes into or goes out of the system passes through a
channel of some sort. There are many different kinds of channels; however, the Aster‐
isk dialplan handles all channels in a similar manner, which means that, for example,
an internal user can exist on the end of an external trunk (e.g., a cell phone) and be
treated by the dialplan in exactly the same manner as that user would be if they were
on an internal extension. Unless you have worked with a traditional PBX,1 it may not
be immediately obvious how powerful and liberating this is. Figure 2-1 illustrates the
differences between the two architectures.
1 A good indicator that you’ve worked with traditional PBXs is the presence of a large callus on your forehead,
obtained from smashing your head against a brick wall too many times to count.
9
Figure 2-1. Asterisk versus PBX architecture
Modules
Asterisk is built on modules. A module is a loadable component that provides a spe‐
cific functionality, such as a channel driver (for example, chan_pjsip.so), or a resource
that allows connection to an external technology (such as func_odbc.so). Asterisk
modules are loaded based on the parameters defined in the /etc/asterisk/modules.conf
file. We will discuss the use of many modules in this book, but at this point we just
want to introduce the concept of modules, and give you a feel for the types of mod‐
ules that are available.
It is actually possible to start Asterisk without any modules at all, although in this
state it will not be capable of doing anything. It is useful to understand the modular
nature of Asterisk in order to appreciate the architecture.
You can start Asterisk with no modules loaded by default and load
each desired module manually from the console, but this is not
something that you’d want to put into production; it would only be
useful if you were performance-tuning a system where you wanted
to eliminate everything not required by your specific application of
Asterisk.
The types of modules in Asterisk include the following:
• Applications—The workhorses of the dialplan, such as Dial(), Voicemail(),
Playback(), Queue(), and so forth
• Bridging modules—Mechanisms that connect channels (calls) to each other
10
|
Chapter 2: Asterisk Architecture
• Call detail recording (CDR) modules
• Channel event logging (CEL) modules
• Channel drivers—Various connections into and out of the system; SIP (Session
Initiation Protocol)messaging uses the PJSIP channel drivers
• Codec translators—Convert various codecs such as G729, G711, G722, Speex,
and so forth
• Format interpreters—As above, but relating to files stored in the filesystem
• Dialplan functions—Enhance the capabilities of the dialplan
• PBX modules
• Resource modules
• Add-on modules
• Test modules
In the following sections we have curated a list of modules we feel are important
enough to be discussed in this book. You’ll find many other modules in the Asterisk
download, but many older modules are either deprecated or have little or no support,
and are therefore not recommended for production unless you have access to devel‐
opers who can maintain them for you.
There is an official list of support status types included within menuselect.2
Applications
Dialplan applications are used in extensions.conf to define the various actions that can
be applied to a call. The Dial() application, for example, is responsible for making
outgoing connections to external resources and is arguably the most important
dialplan application. The available applications are listed in Table 2-1.