You are on page 1of 31

Practical Guide 

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 “VoIP­4D 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 VoIP­4D 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 VoIP­4D 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
● 2­4  ATAs or (2­4 VoIP Phones)
● 2­4 analogue phones (if using ATAs)
● 1 TDM400p card with 1 FXS and 1 FXO ports
● 1 4­port 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)
● 2­4 analogue phones
● 1 4­port 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 ; X­Lite, Kiax, etc 
http://www.voip­info.org/wiki­Asterisk+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
○ VoIP­4D 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, 32­bit/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 step­by­step 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:

Install  VMware   player  and     make 


sure   that   your   Ethernet   is   in 
“bridge” mode.
By  putting  the  interface in  Bridge 
Mode, your AsteriskNOW will fetch 
and   IP   address   via   DHCP   after 
booting.

Important:   You   need   to   have   a 


DHCP   server   available   in   your 
network.
asterisk­0.9.6.5­x86.vmx CONFIGURATION FILES

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

If   your   DHCP   is   working,   your 


AsteriskNOW will inform you of the 
IP   address   that   your   box   has 
obtained.

The   AsteriskNOW   Console   allows 


you   to   update,   restart   and 
shutdown the system.

Using   the   Console   you   can   also 


operate   a   command   line   interface 
(the asterisk CLI>).

Accessing the box via SSH CONFIGURATION FILES

You   can   access   the   AsteriskNOW  If you log into the box using SSH, please have a look 


box at any time via SSH. at the /etc/password and /etc/sudores files. You 
can  see  that  the  user  admin  can  get  administrative 
The   account   is   “admin”   with   the  privileges. Consider changing the default password of 
default password “password”.  the user “admin”.

You can get admin privileges using  It   is   important   to   notice   that   there   are   3   different 


sudo. “admin” users in each installation:

(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

Open  a  browser  and go  to  the  IP 


address   that   AsteriskNOW   has 
obtained.

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

This   screenshoot   shows   Step   1   of 


the   wizard   for   Scenario   1   and   2, 
where   our   PBX   does   not   include 
any PCI expansion cards.

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/static­http
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

In  Scenario  2  and 3,  we  want our 


PBX   to   be   able   to   communicate 
with   another   PBX  and  vice   versa. 
To do that, we need to create a new 
Service Provider.
In   this   example,   we   add   a   new 
service provider that is reachable at 
the IP address 192.168.46.136. 
We   indicate   that   we   want   to 
communicate   using   the   protocol 
IAX  using   an   account   with 
username  4646  and password  4646. 
This account will be used between 
the   PBXs   for   authentication   and 
routing calls.
/etc/asterisk/users.conf CONFIGURATION FILES
/etc/asterisk/extensions.conf
/etc/asterisk/users.conf
[trunk_1]
disallow =
The creation of new service provider  allow = all
callerid =
involves:  contact =
(1) A new section in the users.conf  context = DID_trunk_1
dialformat = ${EXTEN:1}
file and fromdomain =
(2)A   new   entry   point   in   the  fromuser =
group =
extensions.conf (dialplan) hasexten = no
hasiax = yes
In   our   example   we   are   creating   a  hassip = no
host = 192.168.46.136
service provider [trunk_1] reachable  insecure =
at 192.168.46.136. port = 4569
provider =
registeriax = yes
We are using the account user: 4646  registersip = no
secret = 4646
password: 4646.   trunkname = Custom ­ InterIAX Calls
Incoming   calls   from   this   provider  trunkstyle = customvoip
fall in the section [DID_trunk_1] of  username = 4646

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).

In  the  third   scenario,  you  need  to 


create   a   new   Service   Provider 
associated to the Analog Port.

In   our   example,   the   TDM   card 


contains a FXO port in slot #1. 
/etc/asterisk/users.conf CONFIGURATION FILES
/etc/asterisk/extensions.conf
/etc/asterisk/users.conf
[trunk_2]
The creation of new service provider  disallow =
via   the   PSTN   also   modifies   two  allow =
files:  callerid = asreceived
contact =
(1) a new section in the  users.conf  context = DID_trunk_2
file and  dialformat =
(2)   a   new   entry   point   in   the  fromdomain =
fromuser =
dialplan. group = 1
hasexten = no
In   our   example   the   AsteriskGUI  hasiax = no
hassip = no
creates a new service provider with  host = dynamic
the   name  [trunk_2]  reachable   via  insecure =
the analog port #1 port =
provider =
registeriax =
Incoming calls from this provider  registersip =
fall in the section [DID_trunk_2] of  secret =
the dialplan trunkname = Port 1
trunkstyle = analog
username =
zapchan = 1

/etc/asterisk/extensions.conf
[DID_trunk_2]
include = default

15
STEP 3 – CONFIGURING SERVICE PROVIDERS (3/3)
(Scenario 3)
DESCRIPTION

You   can   create   as   many   service 


providers as you wish.  

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

The   configuration   file  users.conf  The users.conf contains three types of sections


was introduced in the Asterisk  1.4 
series.  [general]
This section includes default values.
In the 1.2.x series, each user or peer 
[trunk_#]
was defined in sip.conf   or iax.conf. 
These sections include the configuration of the 
The entity was classified depending 
different service providers.
on   the   protocol.   The  users.conf 
merges  iax.conf, sip.conf  and  some  [XXXX]
of   the   options   of  zapata.conf  into  These sections include the configuration of the local 
one single file. extensions (1000, 2000, 3000, 4000). They can be 
analog ports or IAX or SIP users.

16
6.1.4   Step 4: Outbound calling rules

STEP 4 – OUTBOUND CALLING RULES (1/2)
(Scenario 2 and 3)
DESCRIPTION

Once   we   have   configured   the   service 


providers   we   can   configure   our 
“dialplan”. 

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.

We   indicate   that   to   reach   the   other 


PBX,   we   need   to   dial   9   before   the 
extension   number.   To   reach   the 
extension   1000   in   the   other   PBX,   we 
need to dial 9+1000.
/etc/asterisk/extensions.conf CONFIGURATION FILES

/etc/asterisk/extensions.conf
AsteriskNOW   allows   you   to   create 
different dialplans. The default DialPlan  [numberplan­custom­1]
associated   to   the   context   of   local  plancomment = DialPlan1
extensions is  include = default
exten=_9XXXX.,1,Macro(trunkdial,${trunk_1}/
numberplan­custom­1. ${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}) 

and   uses   the   account   4646   data   for 


authentication.

17
STEP 4 – OUTBOUND CALLING RULES (2/2)
(Scenario 3)
DESCRIPTION

In   Scenario   3,   we   need   to   create 


another   calling   rule   that   indicates 
that any local extensions can reach 
the PSTN by Port #1 (the analog 
service provider).
Select  Define a custom pattern  and 
fill   in   your   outbound   calling   rule 
according   to  the  screenshot   to   the 
right.
In the example, a call is placed by 
appending   a   0   to   a   valid   PSTN 
number,  which is defined to be   6 
or more digits.
/etc/asterisk/extensions.conf CONFIGURATION FILES

In this example we have two service  [numberplan­custom­1]
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 = numberplan­custom­1
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 [macro­stdexten]. 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

Each   of   the   new   extensions   will   have 


entry of the type [1000], [2000], [3000], 
etc.
If the local extension is a SIP or IAX 
device   it   will   be   indicated   with   the 
values:

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

This   extension   is   not   “visible”   to   the  [4646]


callwaiting = yes
users and it is used for the purpose of  cid_number = 4646
routing and authenticating calls between  context = numberplan­custom­1
the PBXs. email =
fullname = 4646
group =
In Scenario 3 we are using IAX as the  hasagent = yes
protocol for  interconnecting  the PBXs.  hasdirectory = no
IAX is more NAT friendly and efficient  hasiax = yes
hasmanager = no
in terms of bandwidth. hassip = yes
hasvoicemail = yes
host = dynamic
mailbox = 4646
secret = 4646
threewaycalling = yes
vmsecret =
zapchan =
registeriax = yes
registersip = yes
canreinvite = no
nat = no
dtmfmode = rfc2833
disallow =
allow = 

21
STEP 6 – USER EXTENSIONS (3/3)
(Scenario 3)
DESCRIPTION

In   Scenario   3,   we   need   to   define 


which local extension that should be 
associated with the Analog Port #2 
(the   phone).   In   this   example,   we 
have chosen Extension 1000 for that 
task. 
We define the association by editing 
the   existing   User   Extension   for 
Extension   1000   and   select   Analog 
Port #2 as Analog Phone.

/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 = numberplan­custom­1
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

In   Scenario   3,   we   need   to   decide 


what to do with the calls originated 
in the PSTN.
In the example, we indicate that all 
calls   from   the   PSTN   should   be 
forward to the local extension 1000.

/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 (SPA­3000).

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 7­step 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

You might also like