Professional Documents
Culture Documents
Practical Guide: How To Setup Voip Infrastructure Using Asterisknow
Practical Guide: How To Setup Voip Infrastructure Using Asterisknow
How to setup VoIP
Infrastructure using
AsteriskNOW
Table of Contents
1. Background...........................................................................................................................1
2. The VoIP scenarios...............................................................................................................2
3. Before getting started...........................................................................................................3
3.1 Training Kits...................................................................................................................3
3.2 Software requirements.....................................................................................................3
3.3 Conventions....................................................................................................................4
3.4 Known issues...................................................................................................................4
4. Virtualization versus dedicated hardware..............................................................................5
5. Installing AsteriskNOW........................................................................................................5
5.1 Installation Screenshots discussed...................................................................................7
6. Configuring AsteriskNOW for Scenario 1 2 3.................................................................10
6.1 Configuration though the Asterisk GUI Setup Wizard ................................................11
6.1.1 Step 1: Hardware detection...................................................................................11
6.1.2 Step 2: Local extensions settings...........................................................................13
6.1.3 Step 3: Configuring service providers....................................................................14
6.1.4 Step 4: Outbound calling rules..............................................................................17
6.1.5 Step 5: Voicemail settings.....................................................................................19
6.1.6 Step 6: User extensions.........................................................................................20
6.1.7 Step 7: Incoming calls rules...................................................................................23
6.1.8 Advanced options: Asterisk GUI...........................................................................24
7. Configuration of ATAs........................................................................................................24
8. Quick Installation Guide.....................................................................................................26
8.1 Scenario 1......................................................................................................................26
8.2 Scenario 2......................................................................................................................27
8.3 Scenario 3......................................................................................................................28
9. Verify your results...............................................................................................................29
9.1 Scenario 1......................................................................................................................29
9.2 Scenario 2......................................................................................................................29
9.3 Scenario 3......................................................................................................................29
1. Background
The first edition of the “VoIP4D Primer, Building voice infrastructure in developing regions”
released in December 2006 covered the basic aspects of IP Telephony and provided
configuration guidelines for the Asterisk PBX for three basic scenarios. This document aims
to make the installation of such scenarios even easier. While in the first version of the Guide
we configured Asterisk by editing the configuration files, in this guide we are going to use a
graphical user interface (GUI). We have reviewed several initiatives that provide a graphical
interface to Asterisk and decided to prepare this practical tutorial based on the AsteriskGUI
available in Asterisk 1.4.x series.
A new distribution known as AsteriskNOW, includes a straightforward installer and all the
software packages for Asterisk production and development. Although the distribution is still
in beta stage (beta5 in November 2007), it has been designed with a very clean interface and
a very intuitive “wizard”.
1
An analysis of other initiatives is available in the document: “Making IP telephony knowledge
accessible” (prestudy1).
2. The VoIP scenarios
The three scenarios described in this document are similar to the ones described in detailed in
the VoIP4D Primer.
Scenario 1
Creating a local private telephony network
in a rural community
This scenario consists of a single PBX with
a set of clients. Clients can be either
softphones, VoIP phones or ATAs.
Scenario 2
Interconnecting communities
In this scenario we interconnect two PBXs.
Local extensions of one PBX are made
available to the other and vice versa.
Scenario 3
Connecting communities to the PSTN
In this final scenario, we have
interconnected two PBXs and allow the
possibility of reaching the PSTN from any
of them.
1 Can be downloaded from www.voip4d.org, under Documentation
2
3. Before getting started
If you have not read the VoIP4D Primer (www.voip4d.org) have a look to the first chapter
as it will provide you with the necessary background to understand the basic concepts of IP
Telephony.
The very minimum hardware requirements for Scenario 1 and 2 is a single PC running
Windows and hosting two “virtualized” installations of Asterisk. You can test the calls using a
softphone and the voicemail service.
For Scenario 3, you will need two computers, one of them with a dedicated communication
card TDM400p. Alternatively, you can use two Asterisk appliances such as the IP04s2.
3.1 Training Kits
If you want to run a VoIP training session based on this material, consider at least having
one training kit per group as follows:
● 2 PCs with network cards
● 24 ATAs or (24 VoIP Phones)
● 24 analogue phones (if using ATAs)
● 1 TDM400p card with 1 FXS and 1 FXO ports
● 1 4port switch (better a hub, if you can find one!)
● Access to a PSTN line
Alternatively you can use the following training kit
● 2 IP04 (3 FXS, 1 FX0)
● 24 analogue phones
● 1 4port switch
● Access to a PSTN line
3.2 Software requirements
● ISO Image of AsteriskNOW
● VMware Image of Asterisk NOW
http://www.asterisknow.org/downloads
● VMware Player
http://www.vmware.com/products/player/
● Softphones ; XLite, Kiax, etc
http://www.voipinfo.org/wikiAsterisk+IAX+clients
● Wireshark (for debugging, advance users)
● DHCP Server
2 http://www.rowetel.com/ucasterisk/
3
● Latest Firefox version >= 2.0.0.9
● Documentation
○ AsteriskNOW quickstart guide
○ VoIP4D Primer
● This document (“Setting up VoIP Infrastructure using AsteriskNOW”)
3.3 Conventions
This documentation has used the IP address 192.168.46.135 for the majority of the
screenshots. Be aware that you need to use your own IP addresses for your setup.
1. We will create four local extensions in each PBX, with the names 1000, 2000, 3000,
4000.
2. We will use the same number as username, callerid and password, i.e. username =
callerid = password = 1000 (or 2000, 3000, 4000) ).
3. The voicemail extension is 8500.
4. Scenario 2 and 3 include two different PBXs that should have different IP addresses.
5. Each of the PBXs sees the other PBX as a VoIP Service Provider.
6. The account username: 4646 password: 4646 is created in each of the PBXs for the
purpose of routing calls between them
3.4 Known issues
These are some of the issues found during the preparation of this tutorial:
1. If you have problems during authentication, consider using the latest Firefox version
and/or removing the cache and the cookies of your browser.
2. VMplayer can not boot your image if you have a Windows machine with FAT16
filesystem with a size bigger than 2 GB.
Include the line diskLib.sparseMaxFileSizeCheck= "false" at the end of the VMX file
to overcome the problem.
3. AsteriskNOW is still in beta stage. In some cases it is not possible to edit entries after
running the wizard. Consider deleting and recreating the entry instead of editing it.
4
4. Virtualization versus dedicated hardware
There are several ways to install AsteriskNOW on a
computer. The method to use depends on your
answers to the following two questions:
1. Does you VoIP setup need to be connected
to the PSTN (TDM support)?
2. Do you have a dedicated machine for the
VoIP setup?
If you answer is Yes to the first question, you need
to install AsteriskNOW in a dedicated machine.
If you do not need to be connected to the PSTN,
you have two options depending on if you have a
machine available for the implementation
(Dedicated machine).
If you do not have a dedicated machine you need to
install VMware player in your machine and the
boot the VMware AsteriskNOW ISO. Thereafter
you can install AsteriskNOW virtually, using your
VMware installation.
If you have a dedicated machine, boot from a CD
that contains the AsteriskNOW ISO.
5. Installing AsteriskNOW
● Install AsteriskNOW
The distribution is available in three main flavours:
1. A version that runs on the x86, 32bit/64 bit processors such as Intel P4 and AMD
Athlon XP.
2. A version that runs on the Xen virtual machine.
3. A version that runs on the VMware Player.
If you do not have a dedicated machine available or you want to test the software
distribution, you should consider using the VMware ISO image. Please note that using
the VMware image will not allow you to use any specialized hardware as the PCI
TDM400p card.
Although, it is not mandatory, consider having a DHCP server available on the
network.
● Log into the web interface
Open a browser and go to:
https://192.168.46.135
5
The web interface provides you access to three main configuration areas:
1. Asterisk GUI configuration wizard
A stepbystep configuration wizard that guide you through 7 steps to get your PBX
up and running
https://192.168.46.135/static/config/setup/install.html
2. The AsteriskGUI
Once you have run the wizard for the first time you can edit and modify the
parameters using the URL
https://192.168.46.135
https://192.168.46.135/static/config/cfgbasic.html
3. The Appliance Platform Configuration Wizard
This wizard allows to configure parameters that are not Asterisk specific, for example
the root password of the system, the IP address, backup schedule, etc.
https://192.168.46.135 :8003/rAA/
Important notice! This tutorial covers only how to use the Asterisk GUI configuration
wizard to set up the scenarios presented. For a complete description of all options available
in the other graphical interfaces, consult the Asterisk Quickstart Guide3.
3 http://www.asterisknow.com/files/downloads/quickstart_asterisknow.pdf
6
5.1 Installation Screenshots discussed
Areas with a grey background are advanced tips. If you are not familiar with Asterisk, simply
ignore them.
GETTING STARTED Installing a VMware image
DESCRIPTION
If you install AsteriskNOW using a
ISO image:
If during the process of booting the Configuration file starts by
VMware player complains about the #!/usr/bin/vmplayer
size of your FAT filesystem (> 2
GB):
Append this line:
Locate the configuration file of the diskLib.sparseMaxFileSizeCheck= "false"
guest application, a file that finishes
with VMX.
Use a text editor like Wordpad, and
append an extra line.
7
GETTING STARTED – Make sure AsteriskNOW has an IP address
DESCRIPTION
Accessing the box via SSH CONFIGURATION FILES
(1) The admin user that let you log into the box via
SSH.
(2) The admin user that have access to the
AsteriskGUI via HTTPS and
(3) The admin user that can configure the appliance
settings (rPath).
Yes, three different passwords!
8
GETTING STARTED – Log into AsteriskNOW web interface
DESCRIPTION
In our example
http://192.168.46.134
Log into the interface using the user
“admin” and the default password
“password”.
/etc/asterisk/manager.conf CONFIGURATION FILES
[general]
AsteriskGUI uses Asterisk manager displaysystemname = yes
commands (Asterisk Manager API) enabled = yes
to communicate with Asterisk. webenabled = yes
port = 5038
bindaddr = 0.0.0.0
The user and password of the [admin]
AsteriskGUI is available in the secret = password
manager.conf configuration file read = system,call,log,verbose,
command,agent,user,config
write = system,call,log,verbose,command,
agent,user,config
9
6. Configuring AsteriskNOW for Scenario 1 2 3
In a nutshell, the process of configuring each of the PBXs can be summarized in 7 basic steps:
● (Step 1) Verify if any zaptel card has been detected.
Any zaptel compatible card should be detected. Cards supported by zaptel include:
Digium, Sangoma, Xorcom Astribank (in beta 6.5), Rhino and Openvox cards.
This step will report no hardware detected if you are configuring a PBX without
zapata compatible hardware or running the VMware version of AsteriskNOW.
Only Scenario 3 will use and detect a zaptel card.
● (Step 2) Indicate the first extension number and the length of the local
extensions.
Here you indicate the number of digits that your local extensions have and what the
first extension number is. In our scenario we will use 4 digits and extension 1000 as
the first one.
● (Step 3) Create Service Providers
In this step we specify who the service providers of “outgoing” calls are.
○ Scenario 1: the PBX is standalone and has no external service providers.
○ Scenario 2: each PBX sees the other PBX as VoIP service provider.
○ Scenario 3: the PBX with a TDM card needs to be configured with two different
service providers. The first provider is the other PBX (VoIP) and the second
provider is the Analogue Port of the TDM Card.
● (Step 4) Configure (Outbound) Calling Rules
In this step we specify what the calling rules are to reach the different service
providers.
○ Scenario 1: does not need any outbound calling rules.
○ Scenario 2: need to indicate that to reach the other PBX's local extensions we need
to dial 9 + <local extension #>.
○ Scenario 3: Same calling rule as in Scenario 2 to reach the other PBX. Also, we
need to add an outgoing calling rule that indicates how to reach the PSTN. To
reach the PSTN, we need to append a 0 to the PSTN number ( 0 + <PSTN #>).
● (Step 5) Voicemail extension
In this step we will configure the extension number used to reach the voicemail. The
default number for all three scenarios is 8500.
● (Step 6) Users extensions
Here we configure all local extensions associated to each of the PBXs. We need to
create four local extensions in all three scenarios (1000, 2000, 3000 and 4000).
The local extensions can be either VoIP clients running IAX or SIP, or analogue ports
if available.
For scenario 2 and 3, we will add the special extension 4646 that is used to route calls
between the PBXs.
10
● (Step 7) Configure (Inbound) Calling Rules
In Scenario 1 and 2, we do not need to create any special rules for incoming calls as all
calls will be generated locally.
In Scenario 3, we will need to indicate which local extension will ring when there is an
incoming call from the PSTN.
6.1 Configuration though the Asterisk GUI Setup Wizard
This section guides you though the graphical configuration setup wizard provided by
AsteriskNOW. If it is the first time that you log into the AsteriskGUI, you will be redirected
straight to the setup wizard. The setup wizard will guide you through seven (7) steps to
configure your VoIP setup.
This guide includes both basic and advanced configuration tips. Areas with grey background
are advanced tips. If you are not familiar with Asterisk, please ignore them.
6.1.1 Step 1: Hardware detection
STEP 1 – HARDWARE DETECTION
(Scenario 1 and 2)
DESCRIPTION
CONFIGURATION FILES
It is possible to run the wizard
again by accessing the following All the static web pages of the wizard are available in
URL: the following path:
http://<IP>/static/config/ /var/lib/asterisk/statichttp
setup/install.html
11
STEP 1 – HARDWARE DETECTION (2/2)
(Scenario 3)
DESCRIPTION
If you have a PCI card as the
TDM400, the wizard will detect the
modules automatically.
In the example, we have 1 FXO and
1 FXS port with the following
functionality:
FXO port: we can attach an external
PSTN line.
FXS port: we can attach a “phone”.
/sbin/zapscan CONFIGURATION FILES
The zapscan utility detects the ports #grep v "#" /etc/zaptel.conf
and generates the /etc/zaptel.conf loadzone = us
configuration file. defaultzone=us
fxsks=1
fxoks=2
The configuration files shows the
type of signalling needed for each of
the ports.
fxsks=1 means that port #1 is a
FXO that needs FXS Kewlstart
signalling.
12
6.1.2 Step 2: Local extensions settings
STEP 2 – LOCAL EXTENSIONS SETTINGS
(Scenario 1, 2 and 3)
DESCRIPTION
In the second step of the
configuration we indicate the length
of the local extensions. In our setup
we are going to use four digits and
the extension number “1000” as the
first extension.
This configuration is common to all
three Scenarios.
/etc/asterisk/users.conf CONFIGURATION FILES
[general]
This parameter that we set up in
the wizard can be found in the userbase = 1000
users.conf with the name userbase localextenlength = 4
inside of the section [general]
13
6.1.3 Step 3: Configuring service providers
STEP 3 – CONFIGURING SERVICE PROVIDERS (1/3)
(Scenario 2 and 3)
DESCRIPTION
the dialplan /etc/asterisk/extensions.conf
[DID_trunk_1]
include = default
14
STEP 3 – CONFIGURING SERVICE PROVIDERS (2/3)
(Scenario 3)
DESCRIPTION
If your PBX contains a TDM card
with a FXO port (Scenario 3) we
can communicate with the
telephone network (PSTN).
/etc/asterisk/extensions.conf
[DID_trunk_2]
include = default
15
STEP 3 – CONFIGURING SERVICE PROVIDERS (3/3)
(Scenario 3)
DESCRIPTION
One of the PBX of the Scenario 3,
has two different Service Providers.
One provider is the other PBX that
can be reached via a VoIP
connection (Custom VoIP) and the
second provider is reachable via the
Analog (TDM400) expansion card.
/etc/asterisk/users.conf CONFIGURATION FILES
16
6.1.4 Step 4: Outbound calling rules
STEP 4 – OUTBOUND CALLING RULES (1/2)
(Scenario 2 and 3)
DESCRIPTION
In Scenario 2 and 3, we need to create a
rule to be able route calls between the
PBXs. In the example, we create a
calling rule with the name “InterIAX
Calls”. In this menu, we describe the
dialing rules that need to be applied
when we want to reach the extensions of
the VoIP provider (the other PBX) that
we peer with.
/etc/asterisk/extensions.conf
AsteriskNOW allows you to create
different dialplans. The default DialPlan [numberplancustom1]
associated to the context of local plancomment = DialPlan1
extensions is include = default
exten=_9XXXX.,1,Macro(trunkdial,${trunk_1}/
numberplancustom1. ${EXTEN:1})
comment = _9XXXX.,1,InterIAX Calls,standard
Outgoing calls between the PBX are
routed using the trundial Macro, that
places a call using:
Dial(IAX2/4646:4646@192.168.46.136
/${EXTEN:1})
17
STEP 4 – OUTBOUND CALLING RULES (2/2)
(Scenario 3)
DESCRIPTION
In this example we have two service [numberplancustom1]
plancomment = DialPlan1
providers. The first service provider include = default
is a VoIP provider (another PBX) ;Calls between PBXs. 9 + <local extension #>
and the second provider is the exten =
_9XXXX!,1,Macro(trunkdial,${trunk_1}/${EXTEN:1})
analog PSTN line. comment = _9XXXX!,1,InterIAX Calls,standard
;Calls to the PSTN. 0 + <PSTN #>
To reach the VoIP provider: 9 + exten =
extension # _0XXXXXX.,1,Macro(trunkdial,${trunk_2}/${EXTEN:1})
comment = _0XXXXXX.,1,outgoing PSTN,standard
To reach the PSTN via analogue
port: 0 + PSTN #
18
6.1.5 Step 5: Voicemail settings
STEP 5 – VOICEMAIL SETTINGS
(Scenario 1, 2 and 3)
DESCRIPTION
The default extension for voicemail
is 8500.
The default password for voicemail
is the password of the extension it is
associated with.
When the configuration wizard is
completed, you can change the
password of your voicemail to any
sequence of digits. You will find the
option VW password under Users in
the main menu.
/etc/asterisk/voicemail.conf CONFIGURATION FILES
/etc/asterisk/users.conf
[3000]
callwaiting = yes
When voicemail is activated in a cid_number = 3000
local extension the setting context = numberplancustom1
email =
hasvoicemail is set to “yes”.
fullname = 3000
group =
By settings the voicemail we also hasagent = yes
modified the way that extensions hasdirectory = no
hasiax = yes
are called. Instead of a normal hasmanager = no
Dial(), Asterisk 1.4.x will call macro hassip = yes
the [macrostdexten]. hasvoicemail = yes
host = dynamic
mailbox = 3000
If not other value is specified the secret = 3000
default the Voicemail password is threewaycalling = yes
the same that your account secret. vmsecret = 1234
zapchan =
The vmsecret option allows you to registeriax = yes
set a different password for your registersip = yes
voicemail. canreinvite = no
nat = no
dtmfmode = rfc2833
In the example extension 3000 uses disallow =
the secret 3000 for authentication of allow =
calls and the password 1234 to
reach the mailbox.
19
6.1.6 Step 6: User extensions
STEP 6 – USER EXTENSIONS (1/3)
(Scenario 1, 2 and 3)
DESCRIPTION
In this step we will create the four local
user extensions. The extensions can be
associated to an IAX or SIP device such
as an ATA or VoIP Phone, or associated
to a analogue port available in the PBX.
/etc/asterisk/users.conf CONFIGURATION FILES
hassip = yes
hasiax = yes
20
STEP 6 – USER EXTENSIONS (2/3)
(Scenario 2 and 3)
DESCRIPTION
In Scenario 2 and 3 we need to create
extension 4646, which needs to be
available in both PBXs.
This extension is created to accept
incoming calls from the other PBX.
/etc/asterisk/users.conf CONFIGURATION FILES
21
STEP 6 – USER EXTENSIONS (3/3)
(Scenario 3)
DESCRIPTION
/etc/asterisk/users.conf CONFIGURATION FILES
Although it might look surprising, it [1000]
callwaiting = yes
is possible to have an extension cid_number = 1000
associated to more than one context = numberplancustom1
communication technology. email =
fullname = 1000
group =
In the example, extension 1000 is hasagent = no
reachable in the Analogue Port #2 hasdirectory = no
and via SIP and IAX. hasiax = yes
hasmanager = no
hassip = yes
hasiax = yes hasvoicemail = yes
hassip = yes host = dynamic
zapchan = 2 mailbox = 1000
secret = 1000
This allows us to have as many as threewaycalling = yes
three devices associated to the same zapchan = 2
registeriax = yes
extension number. The three registersip = yes
devices will ring simultaneously. canreinvite = no
nat = no
dtmfmode = rfc2833
22
6.1.7 Step 7: Incoming calls rules
STEP 7 INCOMING CALLS RULES
(Scenario 3)
DESCRIPTION
/etc/asterisk/users.conf CONFIGURATION FILES
/etc/asterisk/extensions.conf
[trunk_2]
disallow =
allow =
Port #1 is a FXO port connected to callerid = asreceived
the PSTN (zapchan = 1). contact =
context = DID_trunk_2
dialformat =
Incoming calls fall in the context fromdomain =
DID_trunk_2. fromuser =
group = 1
hasexten = no
In the dialplan, under the context hasiax = no
[DID_trunk_2] we see that by hassip = no
default all calls (_X.,s) are forward host = dynamic
insecure =
to extension 1000 port =
provider =
Goto(default|1000|1) registeriax =
registersip =
secret =
trunkname = Port 1
trunkstyle = analog
username =
zapchan = 1
[DID_trunk_2]
include = default
exten = _X.,1,Goto(default|1000|1)
exten = s,1,Goto(default|1000|1)
23
6.1.8 Advanced options: Asterisk GUI
ADVANCED OPTIONS – ASTERISK GUI
DESCRIPTION
After completing the seven steps you
can have a look to the AsteriskGUI
interface.
This interface allows to modify your
entries via the wizard and create
more advance services.
When you have made changes to the
configuration, do not forget to press
the button Active Changes, in order
apply the changes.
7. Configuration of ATAs
No matter which ATA or IP Phone you need to configure, you will find that they can be
configured in a similar manner. This example shows the configuration process of a Linksys
PAP2 Internet Phone Adapter. The configuration is the same for a Sipura (SPA3000).
IP settings
The ATA needs to have an IP address in order to be able to communicate with other devices
on the LAN or the Internet. The IP address can be static or dynamic. In this example, we
have chosen to obtain an IP address through DHCP.
All IP settings of the ATA are configured using the handset.
1. Attach an analog phone to the ATA
2. Connect the ATA to the LAN where the DHCP is running
3. Enter the configuration menu of the ATA by pressing **** on the phone.
4. Enable DHCP by pressing 101# followed by 1.
5. Make sure that the ATA has obtained an IP address by pressing 110#.
Extension number
The extension number of the ATA is configured through its web interface. Direct your browser
to http://<IP address of your ATA>/admin/advanced
Go to the tab Line 1, and fill in the following fields:
24
Proxy and Registration
Proxy: 192.168.46.135 (the IP address of the PBX you want to register)
Register: Yes
Subscriber Information
Display Name: 1000
User ID: 1000
Password: 1000
Use Auth ID:yes
Auth ID: 1000
You can verify from the web based Asterisk Configuration Panel that the ATA is registered in
the PBX.
1. Go to Asterisk CLI in the left menu
2. On the bottom of the page (in the pink text field), write
sip show peers
3. All registered phones and ATAs will be listed with IP address and extension number.
25
8. Quick Installation Guide
This section includes a 7step quick installation guide for Scenario 1, 2 and 3. Please note that
the red crosses in the table indicate steps in the configuration procedure that are not needed
for that specific scenario.
8.1 Scenario 1
26
8.2 Scenario 2
27
8.3 Scenario 3
28
9. Verify your results
This section includes a set of Checkpoints for each Scenario that you should be able to do
with your current VoIP setup. If you successfully manage all checkpoints listed for your
Scenario, your Asterisk based VoIP setup has been configured correctly.
9.1 Scenario 1
Checkpoint 1: Place local phone calls from one extension to another within the same PBX.
Checkpoint 2: Call a local extension and leave a voice messages (don't pick up the phone!).
Use the voicemail to fetch the voice message you just left.
9.2 Scenario 2
Checkpoint 1: Place local phone calls from one extension to another within the same PBX.
Checkpoint 2: Place phone calls between the two PBX's by using the prefix 9 before the
extension number.
Checkpoint 3: Call a local extension and leave a voice messages (don't pick up the phone!).
Use the voicemail to fetch the voice message you just left.
9.3 Scenario 3
Checkpoint 1: Place local phone calls from one extension to another within the same PBX.
Checkpoint 2: Place phone calls between the two PBX's by using the prefix 9 before the
extension number.
Checkpoint 3: Call a local extension and leave a voice messages (don't pick up the phone!).
Use the voicemail to fetch the voice message you just left.
Checkpoint 4: Call to the PSTN from any of the PBXs (try both).
Checkpoint 5: Call in to the PBX from the PSTN.
29