Asterisk Installation & Configuration

Posted on Updated on

 

Asterisk installation can be done in any of a *nix operating system. Here I use the mandriva 2005. this documentation is the guidance to asterisk installation & configuration which cover the following:1.        user authentication along with telephone number & password2.        Dial Plan 3.        ENUM, so that Asterisk can recognize no +62XXX

Equipment needed as follows:

1. A linux PC2. LAN connection3. Internet connection

 Asterisk Installation

1. Download all asterisk software, sound, and interface software from http://www.asterisk.org. here  I use asterisk 1-4.3.tar.gz , asterisk-addons-1.4.1.tar.gz, zaptel-1.4.2.1.tar.gz 2. copy the files to your linux directory. I prefer to put them in /usr/local/src directory # cp  asterisk-1.4.3.tar.gz /usr/local/src/
# cp asterisk-addons-1.4.1.tar.gz /usr/local/src/
# cp zaptel-1.4.2.1.tar.gz /usr/local/src/


3. Go to /usr/local/src/ and uncompress all the distribution software
 # cd /usr/local/src# tar xfvz zaptel-XX.tar.gz# tar xfvz asterisk-1.4.3.tar.gz# tar xfvz asteterisk-addon-1.4.1.tar.gz 4.        Compile & install the sources:  Installing zaptel # cd zaptel-1.4.2.1# make# make install#make install-udev (this is needed to get the ztdummy modules installed)# modprobe ztdummy  (this is if you use the virtual interface for zaptel device /need virtual interface to trunk to PBX).         You might need zaptel for audio conferencing if you don’t have any PCI-device as voip interface in your server. If you are using a Linux 2.4 kernel you will need a USB controller to use ztdummy.
There are two types of USB controller chips used on motherboards:
USB OHCI and USB UHCI. To use ztdummy, you need an USB UHCI type controller on the motherboard, as the OHCI chips work very differently. If you do not have an appropriate USB controller as a timing source, then you should use Asterisk zaprtc. It was originally written by Klaus-Peter Junghanns and is distributed at http://www.junghanns.net/asterisk/.
1.        To check if you have the usb_uhci module, do lsmod 2.        Check out the zaptel module from the Asterisk CVS repository 3.        Make sure you have the Linux Kernel source files installed 4.        Edit the Makefile and remove the ‘#’ in front of ztdummy in the top 5.        Do a make all 6.        Do make install 7.        To load the ztdummy, do modprobe ztdummy
You will probably want to include ‘modprobe ztdummy’ in your /etc/rc.d/rc.local to make sure it is present at startup before Asterisk is launched.
 Edit /etc/modprobe.conf so that ztdummy will be loaded at startup alias char-major-196 ztdummy install ztdummy  #/sbin/modprobe --ignore-install ztdummy && /sbin/ztcfg Installing the asterisk

# cd /usr/local/src/asterisk-1.4.3

# ./configure –zaptel-dir=/usr/share/zaptel

# make

# make install

# make samples Installing the asterisk addons# cd /usr/local/src/asterisk-addon-1.4.1# ./configure#make#make install#make samples  That’s all for the asterisk installation. Next step is the asterisk configuration.

Asterisk Configuration The minimal asterisk configuration chatter the following:

  1. user authentication
  2. dialplan configuration
  3. ENUM configuration

all configuration process is done by editing files in the /etc/asterisk folder, they are:  sip.confextensions.confenum.conf

Configuration of  ENUM.CONF

Not much changes in the /etc/asterisk/enum.conf, just make sure that there are the following entries:

search => e164.arpa

search => e164.org

search => e164.id

by adding those lines, we can make sure the ENUM information those are available in e164.arpa, e164.org and e164.id will be recognized by the asterisk.

Configuration of SIP.CONFOn /etc/asterisk/sip.conf, for an account with no. telephone 2099, password 123456, Dynamic addressing (using DHCP), so the entry is as follow:

[2099]
context=default
type=friend
username=2099
secret=123456
host=dynamic
dtmfmode=rfc2833
mailbox=2099@default
rfc2833compensate=yes

Do the same entry for all other users. Until this step, all user can be registered to the asterisk pbx and can call each other (as long as they have been registered). In order to have capability to transfer our VOIP call to third party provider like voiptalk.org, voiprakyat, etc, etc we just need to register to the SIP proxy with the correct username & password as the following example:

register => 45602:password@voiptalk.org/1234 which mean that user 1234 in our asterisk pbx is the same user in the voiptalk with account 45602 which login by using password of ”password”. For example we have an account in voiptalk.org with account 78987 and password secret, so the format would be:register => 78987:secret@voiptalk.org/1234

using this way, so if there is any call to 78987 at voiptalk.org will be forwarded directly to extension 1234 in our SIP server.


Configuration of EXTENSIONS.CONF

in the /etc/asterisk/extensions.conf we can manage what should be done if asterisk receive a call to an extension, which frequently use as follow:
exten => _20XX,1,Dial(SIP/${EXTEN},20,rt)

exten => _20XX,2,HangUp

to read them as follow:if someone call to extension 20XX so the first 1 must be done is DIAL EXTENtions using SIP technology, wait for 20 seconds, if there’s no one answering, then timeout (rt). Second step must be done is Hangup.

If we plan to dial the PSTN number, so the command would be as follow: exten => _08X.,1,Dial(SIP/${EXTEN}@8888,20.rt)exten => _08X.,2,Hangupexten => _021X.,1,Dial(SIP/${EXTEN:3}@8888,30.rt)exten => _021X.,2,Hangup  if we use PBX between ATA & telco, and we should firstly press 9 before making a call, so the command would be:

exten => _021X.,1,Dial(SIP/9${EXTEN:3}@8888,20.rt)

How to read:If someone call to 021X. pay attention to the dot (.) after X, it means whatever number dialed after 021 would be dialed. Dial using SIP technology to extension 8888. let’s see the code 9{exten:3}, this must be read: eliminate 3 (three) digit in front of EXTENtion number dialed, then add 9, so if we dial 02152902255 would become 952902255. 

 Codecs configurationCodecs is used along with the bandwidth you want to use. The following is codecs used by asterisk: G.711 ulaw = ulaw (US standard)
G.711 alaw = alaw (European standard)
G.723.1 = g723.1 (pass-thru only)
G.726 = g726
G.729 = g729
GSM = gsm
iLBC = ilbc
LPC10 = lpc10
Speex = speex
ADPCM = adpcm
 If you have adequate bandwidth, you’d better use G.711u. but if bandwidth is your consideration, then you can use G.729 or G.723 (need licenses for the codec algorithm), there’s a free version for linux. As you can download from http://asterisk.hosting.lv/ I download then http://asterisk.hosting.lv/built-for-asterisk-1.4/codec_g723-gcc4-pentium4.so    for g723 and  http://asterisk.hosting.lv/built-for-asterisk-1.4/codec_g729-gcc4-pentium4.so    for g729 codecs. 

  1. download the above files to your whatever directory, here I use /usr/local/src/codecs

$ wget http://asterisk.hosting.lv/built-for-asterisk-1.4/codec_g723-gcc4-pentium4.so$ wget  http://asterisk.hosting.lv/built-for-asterisk-1.4/codec_g729-gcc4-pentium4.so

  1. copy the codecs to /usr/lib/asterisk/modules

$ cp codec_g723-gcc4-pentium4.so /usr/lib/asterisk/modules/codec_g732.so$ cp codec_g729-gcc4-pentium4.so /usr/lib/asterisk/modules/codec_g729.so

  1. restart the asterisk

$ asterisk –r>  reload  

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s