Asterisk OpenSource PBX 1.4 - Installation Guide
This tutorial guides you through the installation and setup process of an Asterisk OpenSource PBX 1.4 system based on a Debian Etch Linux system.
You should be aware of the basics of Asterisk OpenSource PBX and VoIP,
http://www.voip-info.org/wiki/index.php?page=Asterisk is a good point to start.
Our packages of Asterisk PBX will support you to be able to use the following features nearly out-of-the-box:
- handle phones and extensions
- receive SIP inbound calls from the internet
- send outbound calls via SIP or IAX over the internet
- an inbound and fallback call queue for the operator
- receive faxes and forward them via email (fax2email gateway)
- send voicemails via email
- set and reset call diversions for extensions
- an overnight switch (forward to voicemail if out of office)
- using MySQL database tables to store user definition data (extensions, voicemail & call queues)
- call detail records (CDRs) available in a MySQL table
I strongly suggest you read the following tutorials to ensure everything we do in this tutorial works well for you:
All actions in this tutorial have to be done as the root user.
There are several things we need to prepare before we can start with the installation:
A computer (real server machine recommended) running Debian Etch...
- ...that is running the original Debian kernel 2.6.18-6-686
- ...that is connected and configured to access the internet
- ...that is secured through a firewall
- ...whose apt is configured to access the ZaKoTel repository (tutorial)
We are going to install all software packages to ensure everything is available at configuration time:
apt-get update
apt-get install \
asterisk1.4 \
zaptel1.4-modules-2.6.18-6-686 \
libtiff-tools \
mysql-server \
phpmyadmin \
php5-cli \
postfix \
mailx
During installation of the packages you will be asked for the type, postfix is to be configured. Please select "Internet Site" there and choose a suitable mail name (this is the part right to the @-sign of the sender's email address, when local users send mails from this machine without specifying an email address).
4. Configuring the MySQL server
By default, the MySQL server on a Debian Etch system is configured to use binary logs for replication and has innodb enabled. We should disable both as we will not use them. Inside the MySQL server's configuration file /etc/mysql/my.cnf ensure the following parameters are commented out or in:
...
#log_bin = /var/log/mysql/mysql-bin.log
...
#expire_logs_days = 10
#max_binlog_size = 100M
...
skip-innodb
...
As MySQL uses another character set than UTF-8 by default, we want to change this too. Add the following lines to section [mysqld] in the MySQL server's configuration file /etc/mysql/my.cnf:
...
[mysqld]
...
default-character-set = utf8
default-collation = utf8_general_ci
...
Finally we restart to MySQL server and delete the existing binary logs with the following commands called from the command line:
# /etc/init.d/mysql restart
# rm -f /var/log/mysql/*
After installation of the MySQL server, MySQL's root user has an empty password. You should really change this with the following command:
# mysqladmin -u root password 'astrongpasswordyoucanremember'
Now let's check, if there are other users without password. We can do this by using the mysql command line client:
# mysql -u root -p
mysql> use mysql;
Database changed
mysql> select user, host, password from user;
+------------------+-----------+-------------------------------------------+
| user | host | password |
+------------------+-----------+-------------------------------------------+
| root | localhost | *0F553A6A044AB8DE698F1AFA6707C1120AE3667C |
| debian-sys-maint | localhost | *C6C5978FF3658BFA7B56D8223497716FFA4BB973 |
| root | debian | |
+------------------+-----------+-------------------------------------------+
3 rows in set (0.00 sec)
we can see there is a root user without a password, which we are going to delete now (the host will display the hostname of your machine without the domainname):
mysql> delete from user where user='root' and host='debian' limit 1;
Query OK, 1 row affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 row affected (0.00 sec)
mysql> exit;
The next thing we are going to do is to create a database with all the tables needed and a user for asterisk. There is an SQL file and a simple shell script located in /usr/share/asterisk that does all the work for us:
# cd /usr/share/asterisk
# ./create_db.sh
When asked for a password, specify the password for MySQL's root user you just set.
5. Configuring the postfix mail server
We are going to use postfix for sending out mails with faxes and voicemail files and we do not want it to listen to other interfaces than localhost. Therefor adjust the file /etc/postfix/main.cf to the following settings (replace the value of myhostname with the fully qualified hostname of your machine):
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
myhostname = debian.domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = 127.0.0.1
Finally, restart postfix:
# /etc/init.d/postfix restart
6. Configuring Zaptel hardware
If you use telephony hardware with Asterisk, ensure that in case this is PCI based hardware, the PCI slot it is inserted in does not use shared interrupts. Refer to your motherboard's manual. Just one hint: on most of Asus and MSI desktop motherboards the PCI slot next to the graphics card slot shares it's interrupt with the graphics card.
If you use HFC based ISDN PCI cards (like those from junghanns.NET) or Digium E1/T1 cards, you can find some sample configurations inside the config files that come with our packages.
You have to load the appropriate driver for your card on startup of the zaptel system service. You can find the drivers and many samples inside the configuration file for the drivers /etc/default/zaptel. Please do not forget to set the top most entry named START_ZAPTEL to yes, otherwise zaptel is not started and the drivers will not be loaded.
If you need to specify startup parameters for the drivers, specify them in /etc/modprobe.d/zaptel.
The configuration of the card is done in /etc/zaptel.conf, please refer to your card's users manual or the website http://www.voip-info.org/wiki/index.php?page=Asterisk+config+zaptel.conf for information about this.
IMPORTANT: If you do not use any telephony hardware at all, please ensure the ztdummy is configured in /etc/default/zaptel to be loaded, it is needed for correct timing inside Asterisk when using conferences, etc.:
START_ZAPTEL=yes
...
MODULES="$MODULES ztdummy"
...
Once you have comleted the configuration of the zaptel drivers, you can go ahead and start zaptel to load your configured drivers. While sitting in front of the console of the server, you can see kernel messages that indicate, which drivers have been loaded or if there are any problems. Start the zaptel service with the following command:
# /etc/init.d/zaptel start
Back to Tutorials
Submitted by Roland on 5 May, 2008 - 00:11.