extensions.conf
are
called extensions. Extensions are interpreted by
Asterisk every time a call is initiated, but extensions.conf is only read
into Asterisk at start time.[9]You can also refresh the dialplan during operation from the
CLI (Command Line Interface) by entering the command reload
now
(which reloads all the configurations) or
extensions reload
(which reloads only the
dialplan).exten =>e.g.Extension
,Priority,Application
exten => 123,1,Answer()
Answer()
Answer()
application does just that - it
answers a call. When a channel rings,
Answer()
tells Asterisk to "lift the
virtual receiver." (See also Section B.9, “Answer()
”.)Hangup()
Hangup()
is the opposite of
Answer()
. An active connection is
terminated, and Asterisk "hangs up" the virtual receiver (see also
Section B.52, “Hangup()
”).Playback(soundfile
)
/var/lib/asterisk/sounds/
, but you can also
specify another source directory. No file extension is specified
because the directory may contain the same sound in different
formats. Asterisk will select the most appropriate format -- more on
that later (see also Section B.84, “Playback()
”).Wait(number
)
Wait()
defines a pause;
Number
indicates the number of seconds to pause (see
also Section B.134, “Wait()
”).NoOp(string
)
NoOp(string
)
is executed, Asterisk prints string
on
the CLI, though only if the verbosity level is set to 3 (you can do
this easily by entering the command set verbose 3
in the CLI). (See also Section B.74, “NoOp()
”.)VoiceMail(mailbox
,u)
VoiceMail()
”).VoiceMailMain()
VoiceMailMain()
”).widgets
dials 8888. Asterisk picks up the
line, plays the hello-world
sound file (which is
installed with Asterisk) and hangs up.[widgets] exten => 8888,1,Answer() exten => 8888,2,Playback(hello-world) exten => 8888,3,Hangup()
n
priority. The
n
priority is like automatic line numbering; when
Asterisk is running through the dialplan and encounters an entry with
priority n
, it simply executes it as though it were
equivalent to the previous priority, plus 1. This is useful when you
have extensions with many entries and you need to add or remove an
entry, because it saves you having to renumber the entire extension.
The example below illustrates what we mean. A standard extension would
look like this:exten => 1234,1,Answer() exten => 1234,2,Wait(2) exten => 1234,3,Playback(hello-world) exten => 1234,4,Wait(2) exten => 1234,5,Hangup()
n
priority:exten => 1234,1,Answer() exten => 1234,n,Wait(2) exten => 1234,n,Play(hello-world) exten => 1234,n,Wait(2) exten => 1234,n,Hangup()
n
priority at any point in
the extension, as long as all the subsequent entries also use
it:exten => 1234,1,Answer() exten => 1234,2,Wait(2) exten => 1234,3,Play(hello-world) exten => 1234,n,Wait(2) exten => 1234,n,Hangup()
[9] An exception is the Asterisk RealTime Architecture (ARA). In an ARA system, the dialplan is stored in a database (e.g. MySQL) and read into Asterisk for each call, not simply when Asterisk is started. This allows an administrator to make dialplan changes on a running Asterisk server which take effect immediately. Nevertheless, this approach is not without significant disadvantages. You can learn more about realtime Asterisk at http://www.voip-info.org/wiki/view/Asterisk+RealTime .
[10] A typical "chicken or egg" problem. One can only understand an application if one understands the dialplan, and vice versa.