Asterisk Documentation
Asterisk Documentation
cd /usr/src
wget downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz
6-Next we unpack it.
tar zxvf asterisk-13-current.tar.gz
7-Now we need to cd into the newly unpacked directory, but we don't really know
what the directory is called. It starts with asterisk-13 and then there is minor
version which is at the time of writing this article is 13.10.0 but might change
down the road because wget command we have further up
So we use * (yes, asterisk) to make this guide future proof:
cd asterisk-13*
cd /usr/src
tar xvfz dahdi-linux-complete-current.tar.gz
cd dahdi-linux-complete-*
make all
make install
make config
This will install mp3 tones and satisfy additional dependencies which might take
some time and ask you for your country code.
13-cd /usr/src
tar xvfz asterisk-12-current.tar.gz
14-compile and install asterisk
cd asterisk-*
./configure
15-menuselect
You will be prompted at the point to pick which modules to build. Most of them
will be enabled, but if you want to have MP3 support, you need to manually turn
on 'format_mp3' on the first page.
After selecting 'Save & Exit' you can then continue
16-insall asterisk
make
make install
make config
1.5.5Comments
We can (and often do) add comments to the Asterisk configuration files.
Comments help make the configuration files easier to read, and can also be
used to temporarily disable certain settings.
1.5.5.1Comments on a Single Line
Single-line comments begin with the semicolon (;) character. The Asterisk
configuration parser treats everything following the semicolon as a comment.
To expand on our previous example: ; this entire line is a comment
sip.conf
extensions.conf
voicemail.conf
Go to the bottom of your extensions.conf file, and add a new context named
[users].
1.8.2Creating a new extensions.conf and configuring it
Type the following to create a new extensions.conf
sudo vi /etc/asterisk/extensions.conf
You can save this file by first pressing ESC then letting go.
Followed by holding Shif and : then letting go again.
Now type wq! followed by pressing enter.
Your file is now saved.
fter adding that section to extensions.conf , go to the Asterisk command-line
interface and tell Asterisk to reload the dialplan by typing the command dial
plan reload . You can verify that Asterisk successfully read the configuration file by
typing dialplan show users at the CLI
tala-SATELLITE-C50-B*CLI> dialplan show
the messages coming from Asterisk, which should be similar to the ones below:
As you can see, 7001 called extension 7001 in the [users] context, which in turn
used the Dial application to call 7001 phone. 7001 phone rang, and then
answered the call. Asterisk then bridged the two calls (one call from 7002 to
Asterisk, and the other from Asterisk to 7001), until Alice hung up the phone.
Contexts, Extensions, and Priorities
The dialplan is organized into various sections, called contexts. Contexts are the
basic organizational unit within the dialplan, and as such, they keep
different sections of the dialplan independent from each other. We'll use contexts
to enforce security boundaries between the various parts of our dialplan,
as well as to provide different classes of service to groups of users.
Within each context, we can define one or more extensions . As explained in the
previous module, an extension is simply a named set of actions. Asterisk
will perform each action, in sequence, when that extension number is dialed. The
syntax for an extension is:
exten => number,priority,application([parameter[,parameter2…]])
exten => 6001,1,Dial(SIP/demo-alice,20)
In this case, the extension number is 6001 , the priority number is 1 , the
application is Dial() , and the two parameters to the application are SIP/demo-alice
and 20 .
Within each extension, there must be one or more priorities . A priority is simply a
sequence number. The first priority on an extension is executed first.
When it finishes, the second priority is executed, and so forth.
Priority number can also be simplied by using the letter n in place of the priority numbers greater
than one. The letter n stands for next , and when Asterisk
sees priority n it replaces it in memory with the previous priority number plus one. Note that you
must still explicitly declare priority number one.
exten => 6123,1,do something
exten => 6123,n,do something else
exten => 6123,n,do something different
Answer, Playback, and Hangup Applications
As its name suggests, the Answer() application answers an incoming call. The Answer()
application takes a delay (in milliseconds) as its first parameter.
Adding a short delay is often useful for ensuring that the remote endpoing has time to begin
processing audio before you play a sound prompt. Otherwise,
you may not hear the very beginning of the prompt.
Knowing When to Answer a Call
When you're first learning your way around the Asterisk dialplan, it may be a bit confusing
knowing when to use the Answer() application, and when not to.
If Asterisk is simply going to pass the call off to another device using the Dial() application, you
probably don't want to call the answer the call first. If, on the
other hand, you want Asterisk to play sound prompts or gather input from the caller, it's probably
a good idea to call the Answer() application before doing
anything else.
The Playback() application loads a sound prompt from disk and plays it to the caller, ignoring
any touch tone input from the caller. The first parameter to
the dialplan application is the filename of the sound prompt you wish to play, without a file
extension. If the channel has not already been answered, Playba
ck() will answer the call before playing back the sound prompt, unless you pass noanswer as the
second parameter.
To avoid the first few milliseconds of a prompt from being cut off you can play a second of
silence. For example, if the prompt you wanted to play was
hello-world which would look like this in the dialplan:
exten => 1234,1,Playback(hello-world)
You could avoid the first few seconds of the prompt from being cut off by playing the silence/1
file:
exten => 1234,1,Playback(silence/1)
exten => 1234,n,Playback(hello-world)
Alternatively this could all be done on the same line by separating the filenames with an
ampersand (&):
exten => 1234,1,Playback(silence/1&hello-world)
VoiceMail Application
1. Mailbox
2. Options
One or more options for controlling the mailbox greetings. The
most popular options include the u option to play the
unavailable
VoiceMailMain Application
omitted, the system will prompt the caller for the mailbox
number.
PIN number
and dates are announced relative to their local time. The time
zones specified in this section also control the way in which
times and dates are announced,
Reload the dialplan by typing dialplan reload at the Asterisk CLI. You can then test the voice
mail system by dialing from one phone to the other and
waiting twenty seconds. You should then be connected to the voicemail system, where you can
leave a message. You should also be able to dial extension
6500 to retrieve the voicemail message. When prompted, enter the mailbox number and PIN
number of the mailbox.
While in the VoiceMainMain() application, you can also record the mailbox owner's name,
unavailable greeting, and busy greeting by pressing 0 at the
voicemail menu. Please record at least the name greeting for both Alice and Bob before
continuing on to the next section.
recored voice mail