Beruflich Dokumente
Kultur Dokumente
Team :
Safaa Shaaban hasan
Email :safaa.shaaban00@gmail.com
TebyanFadl Allah Sheikh
Aya Ismail Yousif
Esraa Mohamed Abdel Rahman
FadwaAzhari
Asterisk Documentation
Content:
1.1.Introduction
1.2.Concept:
1.3.Who Uses Asterisk?
1.4.Installing Asterisk
1.5Intro to Asterisk Configuration Files
2.Creating SIP Accounts
2.1Registering Phones to Asterisk
2.2.Creating Dialplan Extensions
2.4.Answer, Playback, and Hangup Applications
3. Voice Mail
3.1.Adding Voice Mail to Dialplan Extensions
3.2.Configuring Voice Mail Boxes
4.Call Queue
4.1Asterisk Queues
5.MusicOnHold
5.1Description
5.2Syntax
6.Asterisk GUI Installation
1.1.Introduction
This the documentation installing and configuring .
AsteriskIntermediate level - assumes basic knowledge of networking,linux
systems,and VoIPWe’ll be building a real live Asterisk box as we progress
through this documentationIt also attempts to provide primers on the key
technicaldisciplines that are required to successfully create and manage
Asterisk solutions.
1.2.Concept:
Asterisk is…
• An open source software development project
• written in the C Programming Language.
• running on Linux (or other types of Unix)
• powering Business Telephone Systems
• connecting many different Telephony protocols
• a toolkit for building many things:
o an IP PBX with many powerful features and applications
o VoIP Gateways
o Conferencing systems
o and much, much more
• supporting VoIP Phones as well as PSTN and POTS
• speaking SIP , the most common VoIP protocol, among others
5-Now when we are root and dependencies are satisfied, we can move to /usr/src/
dir and download asterisk there
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*
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
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.
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
2.Creating SIP Accounts:
In order for our two phones to communicate with each other, we need to configure
an account for each phone in the channel driver which corresponds to the protocol
they'll be using. Since both the phones are using the SIP protocol, we'll configure
accounts in the SIP channel driver configuration file, called sip.conf . (This file
resides in the Asterisk configuration directory, which is typically /etc/asterisk .)
Let's name your phones Alice and Bob , so that we can easily differentiate between
them. Open sip.conf with your favorite text editor, and spend a minute or two
looking at the file. (Don't let it overwhelm you — the sample sip.conf has a lot of
data in it, and can be overwhelming at first glance.) Notice that there are a couple of
sections at the top of the configuration, such as [general] and [authentication], which
control the overall functionality of the channel driver. Below those sections, there
are sections which correspond to SIP accounts on the system. Scroll to the bottom
of the file, and add a section for 7001 and 7002. You'll need to choose your own
unique password for each account, and change the permit line to match the settings
for your local network. After completing this guide your Asterisk will be able to :
• Host calls locally
• Access mail boxes
We will be editing the following files:
• sip.conf
• extensions.conf
• voicemail.conf
Go to the bottom of your extensions.conf file, and add a new context named
[users].
-Creating 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 Shift 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
Now we're ready to make a test call!
Making a Phone Call:
At this point, you should be able to pick up 7001 phone and dial extension 7001 to
call 7002, and dial 7002 from 7002 phone to call 7001.
As you make a few test calls, be sure to watch the Asterisk command-line interface
(and ensure that your verbosity is set to a value three or higher) so that you can
seethe 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 7002 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 7001 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 => 7001,1,Dial(SIP/7001,20)
In this case, the extension number is 7001 , the priority number is 1 , the
application is Dial() , and the two parameters to the application are SIP/7001
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 => 7001,1,do something
exten => 7002,n,do something else
3. Voice Mail
3.1.Adding Voice Mail to Dialplan Extensions
Adding voicemail to the extensions is quite simple. The Asterisk voicemail module
provides two key applications for dealing with voice mail. The first, named
VoiceMail() , allows a caller to leave a voice mail message in the specified mailbox.
The second, called VoiceMailMain() , allows the mailbox owner to retrieve their
messages and change their greetings. VoiceMail Application
The VoiceMail() applications takes two parameters:
1. Mailbox
This parameter specifies the mailbox in which the voice mail message should be
left. It should be a mailbox number and a voice
mail context concatenated with an at-sign ( @ ), like 7001@default . (Voice mail
boxes are divided out into various voice mail context, similar to the way that
extensions are broken up into dialplan contexts.) If the voice mail context is
omitted, it will default to the default voice mail context.
2. Options
One or more options for controlling the mailbox greetings. The most popular
options include the u option to play the unavailable message, the b option to play
the busy message, and the s option to skip the system-generated instructions.
3.2.Configuring Voice Mail Boxes
let's look at the voicemail configuration. Voice mail options and mailboxes are
configured in the voicemail.conf configuration file. This file has three major
sections:
The [general] section Near the top of voicemail.conf , you'll find the [general]
section. This section of the configuration file controls the general aspects of the
voicemail system, such as the maximum number of messages per mailbox, the
maximum length of a voicemail message, and so forth. Feel free to look at the
sample voicemail.conf file for more details about the various settings.
Voice Mail Contexts
After the [general] and [zonemessages] sections, any other bracketed section is a
voice mail context. Within each context, you can define one or more mailbox. To
define a mailbox, we set a mailbox number, a PIN, the mailbox owner's name, the
primary email address, a secondary email address, and a list of mailbox options
(separated by the pipe character), as shown below:
mailbox=>pin,full name,email address,short email address,mailbox options
You can save this file by first pressing ESC then letting go.
Followed by holding Shift and : then letting go again.
Now type wq! followed by pressing enter.
Your file is now saved.
Reloading Asterisk to apply the configuration
You can restart asterisk by any of the following ways:
sudo /etc/init.d/asterisk restart
and then call
Now that we've defined the mailboxes, we can go into the Asterisk CLI and type
voicemail reload to get Asterisk to reload the voicemail.conf file. We can
also verify that the new mailboxes have been created by typing voicemail show
users Now that we have mailboxes defined, let's add a priority to extensions 7001
and 7002 which will allow callers to leave voice mail in their respective mailboxes.
We'll also add an extension 8001 to allow 7002 and 7001 to check their voicemail
messages. Please modify your [users] context in extensions.
conf to look like the following:
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 8001 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 7001 and 7002
before continuing on to the next section.
in cli
record voice Mail in CLI
4.Call Queue
4.1Asterisk Queues
Using queues.conf
First of all, set up call queues in queue.conf
Here is an example:
queues.conf
add an extension to our dialplan in order to permit people to dial into our queues
so calls can be delivered to our queue members.
Then reload the dialplan
*CLI> dialplan reload
when we call
5.MusicOnHold
5.1Description
Plays hold music specified by class. If omitted, the default music source for the
channel will be used. Change the default class with Set(CHANNEL(musicclass)=...). If
duration is given, hold music will be played specified number of seconds. If
duration is ommited, music plays indefinitely. Returns 0 when done, -1 on hangup.
This application does not automatically answer and should be preceeded by an
application such as Answer() or Progress().
5.2Syntax
MusicOnHold(class,[duration])
root@tala-SATELLITE-C50-B:/etc/asterisk# vi musiconhold.conf
and in
root@tala-SATELLITE-C50-B:/etc/asterisk# vi extensions.conf
exten => 7001,1,set(CHANNEL(musicclass)=support)
cd /usr/src/
svn checkout http://svn.digium.com/svn/asterisk-gui/branches/2.0/ gui
The Asterisk GUI source files will be downloaded to /usr/src/gui folder
Instructions
make
make install
Edit /etc/asterisk/http.conf file and make following changes.
enabled = yes
bindaddr = 0.0.0.0 ; Means you can access it from any ip.
bindport = 80 ; Makesure apache is not running on port 80 otherwise change the
port.
enablestatic = yes
redirect = / /static/config/cfgbasic.html ; This is needed else you have to type the
wholes line to get access
Edit /etc/asterisk/manager.conf file and make following changes.
[general]
enabled = yes
webenabled = yes
port = 5038
bindaddr = 0.0.0.0 ; Can be accessed from anywhere
[admin]
secret = password ; Asterisk GUI Username =admin and Password = password
read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
write = system,call,agent,user,config,command,reporting,originate
Goto the same folder from where you installed Asterisk GUI,and check the
configuration.
cd /usr/src/gui
make checkconfig