Asterisk software install
The latest stable release branch of Asterisk as of this writing is 1.2. To download the lastest stable release of Asterisk 1.2 do the following.
# cd /usr/src
# svn checkout http://svn.digium.com/svn/asterisk/branches/1.2 asterisk-1.2
# svn checkout http://svn.digium.com/svn/asterisk/branches/1.2 asterisk-sounds-1.2
# svn checkout http://svn.digium.com/svn/zaptel/branches/1.2 zaptel-1.2
# svn checkout http://svn.digium.com/svn/libpri/branches/1.2 libpri-1.2
The libpri code is only needed if you plan to use a T1/E1 card
Now install everything
# cd /usr/src/libpri-1.2
# make
# make install
# cd /usr/src/zaptel-1.2
# make linux26
# make install
# modprobe ztdummy
# vi /etc/modules
Add the word “ztdummy” at the bottom of the modules file
# update-modules
What we just did in the lines after “make install” was configure ztdummy to load automatically each time we boot. If you have a zaptel card installed then you do not need to do this. I believe you will need to run “ztcfg –v” instead but I did not have a card at the time of this writing so I cannot provide any step by step information for that part. You will have to do a search for installing zaptel cards with asterisk.
Edit Makefile for Asterisk to add a few optimizations for your processor. You may need to do search to find out what optimizations are for what processor. For example, if you have a Pentium processor you would want to find and uncomment the following lines.
# cd /usr/src/asterisk-1.2
# vi Makefile
Edit the following lines to remove the ‘#’
PROC=i686
K6OPT = -DK6OPT
Now compile and install Asterisk:
# make mpg123
# make install
# make samples
# make config (should install startup script but fails so cp contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk)
# update-rc.d asterisk defaults 99
This updates the init scripts and sets Asterisk to start after all other processes have been started.
# cd /usr/src/asterisk-sounds-1.2 && make install
At this point DO NOT START ASTERISK!!! It is not a very good idea to run Asterisk as root so we’ll create a non-priviledged user and run under it.
# echo “asterisk:x:104:Asterisk PBX daemon,,,:/var/lib/asterisk:bin/false” >> /etc/passwd
# echo “asterisk:x:104:” >> /etc/group
Now edit /etc/init.d/asterisk and uncomment:
#AST_USER=”asterisk”
#AST_GROUP=”asterisk”
Since the asterisk user can’t write to /var/run (and we don’t want it to) we’ll create a place for it’s process id file. Edit /etc/asterisk/asterisk.conf and change
astrundir => /var/run
To
astrundir => /var/run/asterisk
Create the new directory and change the owner to the asterisk users:
# mkdir /var/run/asterisk && chown asterisk:asterisk /var/run/asterisk
We also have to fix the file ownership on the rest of the places that asterisk users needs to write to:
# chown –R asterisk:asterisk /var/log/asterisk
# chown –R asterisk:asterisk /var/spool/asterisk
# chown –R asterisk:asterisk /var/lib/asterisk/
# chown –R asterisk:asterisk /dev/zap/pseudo
You’ll also need to add asterisk to the audio group:
# adduser asterisk audio
Now see if it all runs
# asterisk –U asterisk –G asterisk –cvv
Now it’s time to customize Asterisk to your particular setup by editing the Asterisk *.conf files. I used a program called IPManager which automagically generates the *.conf files for me. Configuring Asterisk *.conf files manually are a whole other subject and beyond the scope of this document.