Hardware Reference
In-Depth Information
exten => 100,2,Playback(hello-world)
exten => 100,3,Playback(tt-weasels)
exten => 100,4,Hangup()
Let's walk through each line quickly, and then try it out. The first line (in square brack-
ets) is the name of the context, which is an independent section of the dialplan. Ex-
tension 100 in the [raspi-demo] context is independent from extension 100 in another
context, such as [not-my-demo] . Contexts are often used to keep different clients iso-
lated from parts of the dialplan, or to provide different features to different clients.
The second line defines an extension ( 100 , in this case) and a priority (or step number,
which is 1 in this case) and says that the first thing extension 100 should do is to call
the Answer() application. This application, as its name implies, answers the call.
Note that the priority numbers must be in numerical order, and should not skip
any numbers. For example, if Asterisk executes priority number three and can't
find a priority number four, it will simply hang up the call for security reasons.
The next line (priority 2), calls the Playback() application, which plays a prerecorded
sound file in which you'll hear a female voice say “Hello, World.” The next line (priority
3) also plays a sound file, which tells you that “Weasels have eaten our phone system.”
The last line calls the Hangup() application, which ends the call.
The parameter to the Playback() application is the name of the sound file to play,
without the extension. Asterisk is smart enough to choose the best sound prompt
format to play if there are multiple files with the same name but in different formats.
It chooses the format that requires the least amount of CPU power to transcode
(or convert) to the current audio format of the call.
Once you've added those five lines to the end of your extensions.conf configuration
file, you'll need to tell Asterisk to reload the dialplan. To do this, go to the Asterisk CLI
and type dialplan reload .
To test that your new [raspi-demo] context has been successfully read and parsed,
type:
hockey*CLI> dialplan show raspi-demo
[ Context 'raspi-demo' created by 'pbx_config' ]
'100' => 1. Answer()
[pbx_config]
2. Playback(hello-world)
[pbx_config]
3. Playback(tt-weasels)
 
Search WWH ::




Custom Search