Installing Elastix VOIP PBX Phone System



Download Elastix from website – 

Install Elastix like any normal CentOS iso (which is what it is derived from) and follow the prompts.



Elastix Server 

I created a virtual machine with two NICS one and one for new VLAN –


Create a new VLAN for phones – in my case,

On our Core Cisco switch:

Create VLAN 6 and assign to gigabit port 3. This is where our POE switch will go into. POE is needed to power the phones and the whole switch’s VLAN is set to be 6.

interface GigabitEthernet0/3
switchport access vlan 6
switchport mode access
priority-queue out
mls qos trust cos
macro description cisco-desktop | cisco-switch | cisco-switch | cisco-desktop
auto qos voip trust
spanning-tree portfast

Normal ports have:

spanning-tree bpduguard enable

You must remove this line from the config (and make sure spanning tree is enabled on the POE switch and the root ID is higher than the core switch) or it will disable the port as it thinks it is a looped NIC rather than a switch.

interface Vlan6
ip address
spanning-tree link-type point-to-point

New DHCP server and scope based on VLAN

You can and should do this on the Elastix server as it is very easy.

GUI > System > Network > DHCP Server

Install Codec g729

We use g729 codec for lower bandwidth to avoid jittering so you need to install the correct codec from here


Find out by rpm -q asterisk

We are asterisk-11.14.1-0

Download to /usr/lib64/asterisk/modules/

chmod 755




to /etc/asterisk/sip_general_custom.conf

Then do the same for the trunks (see below for config). You need to keep ulaw and alaw so Faxing continues to work as IAX2 faxes DO NOT FUNCTION with g729 only. 

Specify g729 as the top line or first to force g729 over the other codes.

service asterisk stop

amportal stop

amportal start

Access the GUI:

And login with the username and password you used during setup


Read and follow Elastix without Tears – this is great for most of the setup.

I will deal with specifics to our setup below.


Stuff specific to our Engin installation:

GUI > PBX > PBX Configuration > Trunks > Add SIP Trunk

Trunk Details – VERY Important:

Trunk Name: CMCRC (not important)

Outbound Caller ID: “CMCRC” <0285663301> (can be left blank)

Maximum Channels – leave blank

Dialed Number Manipulation Rules – leave blank.


Outgoing Settings:

Trunk Name – Engin (can be called anything)

Peer Details – username and password will be provided by VOIP supplier – nat=auto as it is behind firewall. allow=ulaw,alaw – the most popular type of codecs. Check with your host as to what they accept. If the codecs are wrong it will disconnect the call when you answer it.

Host and outgoing (fromdomain) proxy can be different – check with host.


* the actual password I have not listed

Incoming Settings:

User Context: Same as username

Apparently there is sometimes an issue with DNS resolution hence the ip address instead of

context=from-trunk-sip-engin specifies that the total maximum calls out must be balanced by incoming calls (total simultaneous calls) as per what you have bought from your supplier.


Outbound Routes:

I setup separate ones for Local / National / Mobile and International.


prepend – 02

prefix – nothing

match pattern – NXXXXXXX

Caller ID – nothing

Trunk sequence – 0 = CMCRC as we only have one trunk.

You can setup different outgoing trunks to save money – ie some may have cheaper international calls so you would force all international calls through this trunk.


prepend – nothing

prefix – nothing

match pattern – XXXXXXXXXX

Caller ID – nothing

Trunk sequence – 0 = CMCRC


prepend – 04

prefix – nothing

match pattern – XXXXXXXX

Caller ID – nothing

Trunk sequence – 0 = CMCRC


prepend – 0011

prefix – nothing

match pattern – XXXXXXXXX

Caller ID – nothing

Trunk sequence – 0 = CMCRC


Extensions and Inbound Routes:

For Inbound routes and Extensions you can follow the Guide as it is quite concise and helpful. I won’t be going into more details in this guide.


Nat rules for server:

Cisco ASA Rules;

Add to the config for ASA – ASDM doesn’t support a range of protocols.

access-list outside_access_in remark Elastix SIP Access Rule
access-list outside_access_in extended permit udp any host eq sip

access-list outside_access_in remark Elastix 10000 to 20000 Access Rule
access-list outside_access_in extended permit udp any host range 10000 20000

static (inside,outside) netmask

This is a direct NAT for the whole IP address not just Ports (PAT).

Elastix / Asterisk Configuration:

Edit /etc/asterisk/sip_nat.conf (or from the website GUI > PBX > Tools > Asterisk File Editor being Phones VLAN and being VLAN that has Elastix server on.



Create DNS for internal and External Resolution:

Internally sip.cmcrc,com =

Externally =


Registering a new Phone with an Extension:

GUI > PBX > Batch Configurations > Select as the network to discover. Then enter.

The new phone’s MAC address should now appear, then select it with the checkbox, assign the extension to it from the drop down box and then press Set.


Installing Digium Fax Module:

First get a free fax license here:

1) Download and execute the ‘register’ utility to generate a valid

2) Download and execute the ‘benchfax’ utility to determine the optimum

3) Use the ‘Fax Selector’ web utility to determine the recommended
Fax For Asterisk download packages.

4) Download and install the ‘res_fax_digium’ module for your platform.

The steps to complete these tasks are described in the Installation
Procedures section.

The register utility may be downloaded from:

The benchfax utility may be downloaded from:

The Fax Selector may be viewed from:

The Fax For Asterisk binaries may be downloaded from:



Command-line Example:

# chmod 500 /root/register

1.3) Run the register utility and follow the interactive instructions.
Internet access is required from your Asterisk server in order to
register your Fax For Asterisk key for licensed use. Outgoing network
traffic to TCP port 443 (SSL) must be allowed in order for the register
utility to successfully communicate with Digium’s license server and
complete the registration process. The registration utility will
prompt you for your Fax For Asterisk license key.

Command-line Example:

# /root/register

2) Download Benchfax in the same way as register and repeat the instructions copying register.

3) Use the ‘Fax Selector’ web utility to determine your required components.

Depending upon your version of Asterisk and processor architecture,
different components are required for the use of Fax For Asterisk. Digium
provides a Fax Selector web utility in order to assist with choosing the
correct components. The Fax Selector web utility should be viewed with a
standard web browser and may be accessed via the following URL:

The files that the Fax Selector utility informs you are required for your
platform should be the files that you use in place of the examples
provided in steps 4 and 5 of this section.

4) Download res_fax_digium to the root home directory of your
Asterisk server, Command-line Example:

# wget

We need: res_fax_digium-11.0_1.3.1-generic_64

4.1) Expand the res_fax_digium archive and copy the file
to the /usr/lib64/asterisk/modules directory

4.2) change res_fax_digium.conf to say:

#include res_fax_digium_custom.conf

Copy to /etc/asterisk

4.3) Asterisk must be restarted in order to load your new Fax For Asterisk
licensed channels. (See General Notes to use multiple licenses on one

# asterisk -rx “restart when convenient”


Configure Jitter Buffer:

This helps with static / poor call quality and can be fixed or adaptive – add these directives into /etc/asterisk/sip_general_custom.conf

;Enable Jitter Settings

You can also use:


In this case you don’t need 


Details for X-Lite soft phone:

Account Name – whatever you like

User ID – whatever is setup on Elastix for the extension you are using

Password – whatever is setup on Elastix for the extension you are using

Domain –

Domain Proxy – Send outbound via Proxy –

This should work inside and outside of our network.

NOTE – go to Settings > Preferences and Select “Allow VOIP Calls”


Reset lost GUI admin password and Mysql Password:

elastix-admin-passwords –change