Asterisk Install & config

Asterisk Server Installation:

Asterisk is one of the best telephony solutions which is free to use. There are others such as yate that provide same type of solutions and even more custom ones. Due to the easy of implementation Asterisk has become more popular than anything else. Asterisk is very easy to use and lots of open source and closed source panels provide a GUI for it.

Pre-requisites for asterisk installation:

Asterisk requires a system running with kernel 2.6 and the header files must be present to compile asterisk on your system. Complete Asterisk is written in C so we require gcc compiler with the supporting libraries such as termcap, and openssl. Asterisk add-ons require the mysql header files so please install mysql lib, mysql client and the headers to compile asterisk-addons.

Download files:

Download below mentioned files as pre-requisites steps for the asterisk installation.

a. Zaptel (http://downloads.asterisk.org/pub/telephony/zaptel/zaptel-1.4.12.1.tar.gz)

b. libpri (http://downloads.digium.com/pub/libpri/libpri-1.4-current.tar.gz)

c. asterisk (http://downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-1.8.30.0.tar.gz)

d. asterisk-sounds ( http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-sounds-1.2.1.tar.gz)

e. asterisk-addones (http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-addons-1.4.7.tar.gz)


Creating first sip extension:

Please add the following lines to sip.conf (/etc/asterisk/sip.conf)


[common](!) ; this is template.
type=friend
context=internal
host=dynamic
disallow=all
allow=ulaw
allow=alaw
allow=g723
allow=g729
dtmfmode=rfc2833

[1000](common)
username=1000
secret=1000

[1001](common)
username=1001
secret=1001

[1002](common)
username=1002
secret=1002

[1003](common)
username=1003
secret=1003

[1004](common)
username=1004
secret=1004


Above we have created 5 extensions that can be used any sip client (xlite,cisco sip phone, ATA). All users will get registered. If it does not work then check out the firwall settings. Please disable those settings until setup is completed.

Creating first Dialplan:

No extension can talk to each other unless we configure its dial plan. We have to open extension.conf (/etc/asterisk/extension.conf). Add the following lines: [internal] exten=> _XXXX,1,Dial(SIP/${EXTEN})
Now all configured phones can talk. This makes asterisk a simple platform in PBX; not many skills are required to develop an office PBX.

Creating first Sip trunk:

Asterisk can make outbound and inbound calls, for outbound we require a provider to terminate our calls and to get calls routed to our system so for that we need a public IP.
Add following code to sip.conf:


[trunk]
type=friend
context=internal
host=
disallow=all
allow=ulaw
allow=alaw
allow=g723
allow=g729
dtmfmode=rfc2833

After the update our sip.conf looks as follows:

[common](!) ; this is template.
type=friend
context=internal
host=dynamic
disallow=all
allow=ulaw
allow=alaw
allow=g723
allow=g729
dtmfmode=rfc2833

[1000](common)
username=1000
secret=1000

[1001](common)
username=1001
secret=1001

[1002](common)
username=1002
secret=1002

[1003](common)
username=1003
secret=1003

[1004](common)
username=1004
secret=1004

[trunk]
type=friend
context=internal
host=
disallow=all
allow=ulaw
allow=alaw
allow=g723
allow=g729
dtmfmode=rfc2833

Now you have to add one line to extension.conf:

exten => _XXXXXXX.,1,Dial(SIP/trunk1/${EXTEN})

So our extension.conf looks like:

[internal]
exten=> _XXXX,1,Dial(SIP/${EXTEN})
exten => _XXXXXXX.,1,Dial(SIP/trunk1/${EXTEN})



With the above settings it is simple to create an IP-PBX with outbound trunk.