ARTICLES

INSTALLING ELASTIX VOIP PBX PHONE SYSTEM

 

Download Elastix from elastix.org website - 

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

 

Prerequisites

Elastix Server 

I created a virtual machine with two NICS one 192.168.16.60 and one for new VLAN - 192.168.18.253

New VLAN

Create a new VLAN for phones - in my case, 192.168.18.0.

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 192.168.18.250 255.255.255.0
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

wget http://asterisk.hosting.lv/bin/codec_g729-ast110-gcc4-glibc-x86_64-core2.so

Find out by rpm -q asterisk

We are asterisk-11.14.1-0

Download to /usr/lib64/asterisk/modules/

chmod 755 codec_g729-ast110-gcc4-glibc-x86_64-core2.so

add 

allow=g729
allow=alaw
allow=ulaw

 

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:

https://192.168.30.60

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. 

http://elx.ec/ewt

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.

username=0285663301
secret=yourpassword*
type=peer
disallow=all
insecure=very
nat=auto
allow=g729&ulaw&alaw
canreinvite=no
dtmfmode=auto
host=apollo.engin.com.au
fromdomain=apollo.engin.com.au

* the actual password I have not listed

Incoming Settings:

User Context: Same as username

host=apollo.engin.com.au
secret=yourpassword*
username=0285663301
dtmfmode=rfc2833
disallow=all
allow=g729&ulaw&alaw
context=from-trunk-sip-engin

Apparently there is sometimes an issue with DNS resolution hence the ip address instead of apollo.engin.com.au.

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.

Local:

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.

National:

prepend - nothing

prefix - nothing

match pattern - XXXXXXXXXX

Caller ID - nothing

Trunk sequence - 0 = CMCRC

Mobile:

prepend - 04

prefix - nothing

match pattern - XXXXXXXX

Caller ID - nothing

Trunk sequence - 0 = CMCRC

International:

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 220.245.207.66 eq sip

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

static (inside,outside) 220.245.207.66 192.168.30.60 netmask 255.255.255.255

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

192.168.18.0 being Phones VLAN and 192.168.30.0 being VLAN that has Elastix server on.

externip=220.245.207.66
localnet=192.168.30.0/255.255.255.0,192.168.18.0/255.255.255.0

 

Create DNS for internal and External Resolution:

Internally sip.cmcrc,com = 192.168.30.60

Externally sip.cmcrc.com = 220.245.207.66

 

Registering a new Phone with an Extension:

GUI > PBX > Batch Configurations > Select 192.168.18.0/24 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:

https://www.digium.com/products/software/fax-for-asterisk

1) Download and execute the 'register' utility to generate a valid
license.

2) Download and execute the 'benchfax' utility to determine the optimum
build.

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:
http://downloads.digium.com/pub/register

The benchfax utility may be downloaded from:
http://downloads.digium.com/pub/telephony/fax/benchfax

The Fax Selector may be viewed from:
http://www.digium.com/en/docs/FAX/faa-download.php

The Fax For Asterisk binaries may be downloaded from:
http://downloads.digium.com/pub/telephony/fax

 

1) 

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:

http://www.digium.com/en/docs/FAX/faa-download.php

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 http://downloads.digium.com/pub/telephony/fax/res_fax_digium/

We need: res_fax_digium-11.0_1.3.1-generic_64

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

4.2) change res_fax_digium.conf to say:

[general]
#include res_fax_digium_custom.conf
ecm=yes

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

# 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
jbenable=yes
jbforce=yes
jbimpl=fixed
jbmaxsize=200
jbresyncthreshold=1000
jblog=yes

You can also use:

jbimpl=adaptive

In this case you don't need 

jbmaxsize=200
jbresyncthreshold=1000

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 - sip.cmcrc.com

Domain Proxy - Send outbound via Proxy - sip.cmcrc.com

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