How to install Asterisk 1.6 on Ubuntu
1. Required Packages
Install all the required packages:
$ apt-get install cvs build-essential automake autoconf bison flex libtool libncurses5-dev libssl-dev php5 php5-cli php5-curl php5-gd php5-mysql mysql-server php-pear php-db curl sox apache2 subversion libssl-dev libmysqlclient15-dev libxml2-dev
2. Compile and Install DAHDI Driver
Since we are going to use Digium TDM400 board, then we need to install DAHDI driver. First, get the system kernel name:
$ uname –r
This will results your kernel version number.
Install the kernel header according to your system kernel
$ apt-get install linux-headers-<version>
Create a symbolic link to /usr/src/linux-2.6
$ ln -s /usr/src/linux-headers-<version> /usr/src/linux-2.6
Download and extract the DAHDI driver to /usr/src
$ cd /usr/src/
$ wget http://downloads.digium.com/pub/telephony/dahdi-linux-complete/dahdi-linux-completecurrent.tar.gz
$ tar -zxvf dahdi-linux-complete-current.tar.gz
$ cd dahdi-linux-complete-X.X.X+X.X.X
Compile the driver
$ make
$ make install
$ make config
Note: Executing ‘make config’ will install an init script and symlinks which will allow you to start and stop DAHDI as a service.
3. Install asterisk
Download asterisk source distribution and put it on /usr/src. In this article I used asterisk version 1.6.2.9, you can download the newest version as you wish.
$ cd /usr/src
$ wget http://www.asterisk.org/downloads/asterisk/releases/asterisk-1.6.2.9.tar.gz
$ tar xvfpz asterisk-1.6.2.9.tar.gz
$ cd asterisk-1.6.2.9.tar.gz
Compile the source code
$ ./configure
$ make menuselect
Make sure that you are able to select chan_dahdi under the Channel Drivers menu. If not, then you need to check the installation step of DAHDI driver.
$ make
$ make install
4. Configure /etc/dahdi/system.conf and start the driver
In this example, FXO module is at Port 4 and FXS module is at Port 2 on the Digium TDM400 card. So the board arrangements are:
- FXS Green board = to be connected to a telephone handset, plug it into the bank #2 on the main board
- FXO Orange board = to be connected to telephone line, plug it into the bank #4 on the main board
- Power Supply = to be connected to PC power connector, for supplying FXS line
After plugging the FXO and FXS boards, then:
- Connect a normal telephone handset to port #2.
- Connect a telephone / PSTN analog line to port #4.
Note: Plugging an FXS port (the green module, port #2) into the PSTN may destroy the module and the card due to voltage being introduced into a system that wants to produce voltage, not receive it!
Note: Be sure to connect your computer’s power supply to the Molex connector on the TDM400 if you have FXS modules, as it is used to supply the voltage needed to drive the ring generator on the FXS ports
Next, Edit file /etc/dahdi/system.conf add the following lines:
fxoks=2
fxsks=4
loadzone=us
defaultzone=us
echocanceller=mg2,1-4
DAHDI uses modular echo cancellers that are configured per channel. The echo cancellers are compiled and installed as part of the dahdilinux package. You can specify the echo canceller to be used for each channel. The default behavior is for there to be no echo canceller on any channel. So, it is very important that you specify one in the system.conf file if you do not have hardware echo cancellers and need echo cancellation.
Then start the driver using this command
$ /etc/init.d/dahdi start
After loading the drivers for your hardware, you can verify their state with the use of
$ /sbin/dahdi_cfg -vv
Check the module loading using dmesg command:
$ dmesg
[ 1604.956854] dahdi: Telephony Interface Registered on major 196
[ 1604.956861] dahdi: Version: 2.3.0.1
[ 1604.979673] ACPI: PCI Interrupt 0000:00:05.0[A] -> GSI 16 (level, low) -> IRQ 20
[ 1604.979778] PCI: Setting latency timer of device 0000:00:05.0 to 64
[ 1604.979796] Freshmaker version: 73
[ 1604.980163] Freshmaker passed register test
[ 1605.476297] Module 0: Not installed
[ 1606.357479] Module 1: Installed — AUTO FXS/DPO
[ 1606.357567] Module 2: Not installed
[ 1606.555044] Module 3: Installed — AUTO FXO (FCC mode)
[ 1606.564781] Found a Wildcard TDM: Wildcard TDM400P REV I (2 modules)
[ 1606.757915] dahdi: Registered tone zone 0 (United States / North America)
[ 1606.801141] dahdi_echocan_mg2: Registered echo canceler ‘MG2′
5. Configure chan_dahdi.conf
Edit file /etc/asterisk/chan_dahdi.conf. This will instruct Asterisk to use the TDM400 card configured previously.
The following is a sample configuration for a TDM422E card. You can place this at the bottom of your chan_dahdi.conf file.
;General options
usecallerid = yes
hidecallerid = no
callwaiting = yes
threewaycalling = yes
transfer = yes
echocancel = yes
echocancelwhenbridged = yes
rxgain = 0.0
txgain = 0.0
;FXS Modules
group = 1
signalling = fxo_ks
context = Internal
channel = 1-2
;FXO Modules
group = 2
echocancel = yes
signalling = fxs_ks
context = Incoming
channel = 3-4
6. Setting up Voicemail and a basic dial plan
Open and edit voicemail.conf and find the following line at the bottom:
[default]
1234 => 4242,Mark Spencer,root@localhost
In this example, 1234 is the mailbox number, 4242 is the password, Mark Spencer is the person’s name, and root@localhost is his email address.
You can add extensions by adding the following:
1000 => 12345,Ujang,ujang@abc.com
2000 => 12345,Bayu,bayu@xyz.com
Next, open and edit /etc/asterisk/extensions.conf, which contains a large, complex sample dial plan. In this step, you will configure a basic dial plan to enable you to
send and receive calls. Go to the bottom of the file and add the following lines:
[Internal]
exten => 1000,1,Dial(DAHDI/1,20,rt)
exten => 1000,2,Voicemail(1000,u)
exten => 1000,102,Voicemail(1000,b)
exten => 2000,1,Dial(DAHDI/2,20,rt)
exten => 2000,2,Voicemail(2000,u)
exten => 2000,102,Voicemail(2000,b)
exten => 8500,1,VoiceMailMain
exten => 8501,1,MusicOnHold
exten => _9.,1,Dial(DAHDI/g2/www${EXTEN:1})
exten => _9.,2,Congestion
[Incoming]
exten => s,1,Answer
exten => s,2,Dial(DAHDI/g1,20,rt)
exten => s,3,Voicemail(1000,u)
exten => s,103,Voicemail(1000,b)
In this example there are two internal extensions (1000 and 2000), a number to check voicemail (8500), a number to listen to music-on-hold, (8501), and a prefix to dial to get an outside line (9). It is also configured to accept incoming calls over the FXO, rings phones 1 and 2, and route to voicemail box 1000.
7. Testing
Start asterisk as standalone application first:
$ asterisk –cvvvv
This will run asterisk in console mode and a lot of debugging messages for you to find out if something going wrong.
Dial tone should be present on phones connected to the FXS ports. Test your configuration by placing an outgoing call, placing a call from extension 1 to 2, or receiving an incoming call. Successful completion of these tasks indicates your configuration is working properly.
Quit asterisk using CTRL-C. If everything Ok, then you can start asterisk as a service.
$ /etc/init.d/asterisk start
If you need any further information or consultation, please contact me directly:
Akhmad Daniel Sembiring
vitraining.com – CEO, akhmad.daniel[at]gmail.com, 6281320379277



Recent Comments