What is Asterisk ?
Asterisk is an Open Source telephony server. Asterisk affords creating telephony applications and services. It handles VoiP, but can also handle analog telephones and lines with additional hardware. It affords defining a dialplan and services around, like voice mails, interactive voice response, conferences and more.
Dahdi-linux is a set of Asterisk linux modules one of which dahdi.ko is required to use the MeetMe() conference application. Download Dahdi-Linux then untar and install.
# tar -C /usr/local -xvf dahdi-linux-x.y.z.tar.gz # cd /usr/local/dahdi-linux-x.y.z # make # make install # make clean
That's it. Note : the other package Dahdi-tools is not required. Other note : Dahdi requires a kernel compiled with CONFIG_CRC_CCITT=y.
Download Asterisk then untar and install. Make menuselect affords choosing which components to use. If using mysql, be sure to read the next paragraph before invoking make. Otherwise proceed. make samples affords creating the configuration files in /usr/local/etc/asterisk.
# tar -C /usr/local --no-same-permissions --no-same-owner -xvf asterisk-x.y.z.t.tar.gz # cd /usr/local/asterisk-x.y.z.t # ./configure --prefix=/usr/local --libdir=/usr/local/lib64 --mandir=/usr/local/man \ --with-asound --with-crypto --with-iconv --with-imap=/usr/local/imap-2007f \ --with-ldap --with-speex --with-ssl --with-mysqlclient=/usr/local/mysql # make menuselect # make # make install # make install-logrotate # make samples # make clean
If using mysql modules, there might be a glitch with the mysql include path. Replace in the files below the lines with "#include <mysql/mysql.h>" by lines with "#include <mysql.h>" (removing the directory) :
addons/app_mysql.c addons/cdr_mysql.c addons/res_config_mysql.c
It is then possible to launch asterisk in the foreground with various levels of verbosity (depending on the number of v's). However the default configuration files include a number of options that we don't want, so we'll rename them first and start with empty files. Asterisk includes a console and then proposes a shell :
# cd /usr/local/etc/asterisk # mv extensions.conf extensions.conf.sample # mv extensions.ael extensions.ael.sample # mv sip.conf sip.conf.sample # asterisk -vvvc . . . *CLI>
Type help to view the available commands, however before doing anything useful we'll need to modify the configuration files so let's just core stop gracefully here.
Asterisk runs as a daemon so must be launched at startup and stopped at shutdown. Update /etc/rc.d/rc.local and /etc/rc.d/rc.local_shutdown accordingly :
# vi /etc/rc.d/rc.local . . . # start asterisk if [ -x /usr/local/sbin/safe_asterisk ]; then echo "Starting asterisk: /usr/local/sbin/safe_asterisk -pI" /sbin/modprobe dahdi /usr/local/sbin/safe_asterisk -pI fi <esc> :x # vi /etc/rc.d/rc.local_shutdown . . . # stop asterisk if [ -r /usr/local/var/run/asterisk/asterisk.pid ]; then echo "Stopping asterisk: kill -INT `cat /usr/local/var/run/asterisk/asterisk.pid`" kill -INT `cat /usr/local/var/run/asterisk/asterisk.pid` fi <esc> :x
Asterisk running in the backgroung, it's possible to attach to the process using asterisk -r and to exit the asterisk shell by typing exit. Most of the configuration files can be modified externally then reloaded using commands such as dialplan reload, sip reload, or voicemail reload. A few files however cannot (example meetme.conf), and require restarting using core restart now. Type help to get a complete list of commands.
The configuration files are created under EPREFIX/etc and there are many of them (97 in version 220.127.116.11!) however modifying only a few will afford getting a working system with a set of quite reasonnable features :
|sip.conf||to configure a sip account|
|meetme.conf||to configure conferences|
|voicemail.conf||to configure voicemail boxes|
|extensions.conf||to configure the dialplan|