Compiling Asterisk from Source on Ubuntu
Ubuntu includes packages for Asterisk and Zaptel, but they may not be up to date, or the newer packages may only be available in newer Ubuntu releases.
With this procedure, you can install the latest version of Asterisk by compiling from source. Please keep in mind when compiling from source your installation will include experimental, preliminary and unreleased features and will be based on source code that may not be ready for a production environment.
Note: This doesn’t include everything that you need, but it may help. The important part is the section on getting the kernel headers and udev rules right.
1. Install build packages
2. Install kernel headers matching the current kernel version.
Linux santo 2.6.8.1-5-686-smp #1 SMP Mon Mar 14 21:59:14 UTC 2005 i686 GNU/Linux
root@santo:~ # apt-cache search inux-headers 2.6.8.1-5-686-smp
linux-headers-2.6.8.1-5-686-smp – Linux kernel headers 2.6.8.1 on PPro/Celeron/PII/PIII/PIV SMP
root@santo:~ # apt-get install linux-headers-2.6.8.1-5-686-smp
3. Create a link to the current headers so that the Asterisk makefiles can find them.
4. Set up udev rules to create zaptel devices if necessary
Check /etc/udev/rules.d/udev.rules to see if the necessary
rules are present:
KERNEL=”zaptimer”, NAME=”zap/timer”
KERNEL=”zapchannel”, NAME=”zap/channel”
KERNEL=”zappseudo”, NAME=”zap/pseudo”
KERNEL=”zap[0-9]*”, NAME=”zap/%n”
If not, you can create a new file with the rules and put it in
/etc/udev/rules.d/51-zaptel.rules
5. Get latest zaptel source from CVS
export CVSROOT=:pserver:[email protected]:/usr/cvsroot
cvs login (password anonvcs)
cvs checkout zaptel asterisk
6. Compile zaptel drivers
make clean
make linux26
make install
Using checkinstall (apt-get install checkinstall) will allow you to remove the driver if necessary. To do this, after the ‘make linux26’, run checkinstall (as the root user, or sudo checkinstall). This will ask some questions about the description of the package, the name, version, etc. Give the name not as zaptel, but as ‘local-zaptel’, and the version number as ‘cvs-date’. There will be a package created with name ‘local-zaptel-cvs-date.deb’. You can use this to install on other machines, and use ‘apt-get remove local-zaptel’ to remove the package, if necessary.
7. Load kernel modules
(At this step using dapper drake to load the kernel modules I had to do a restart. After the restart when using the following insmod commands I received an error saying they were already loaded. So somehow they automatically loaded. The dmesg command further below confirmed this for me.)
root@santo:~ # insmod /lib/modules/2.6.8.1-5-686-smp/misc/wcfxo.ko
Verify that the modules were loaded correctly by running dmesg.
You should see lines like this (assuming that you actually have an X101P
card installed):
ACPI: PCI interrupt 0000:01:02.0[A] -> GSI 17 (level, low) -> IRQ 201
wcfxo: DAA mode is ‘FCC’
Found a Wildcard FXO: Wildcard X101P
zaptel: Unknown symbol crc_ccitt_table -> modprobe crc_ccitt first
Unknown symbol request_firmware -> modprobe firmware_class first
Unknown symbol release_firmware -> modprobe firmware_class first
Add the following lines to /etc/modules so that the modules will be loaded
automatically when the machine is rebooted:
wcfxo
8. Compile Asterisk. You may need to install the libncurses5-dev package if configure complains about ‘termcap’.
make clean;make;
make install;
make samples
Again, using checkinstall can make life simpler, in case you are going to upgrade to an ubuntu version of asterisk. In this case it is a little more complicated, as checkinstall by default puts the generic README/INSTALL/BUGS documents to the same place for both make install and make samples. Also there are some ‘sounds/demo-*’ files which are copied in *both* installs.
To avoid this,
1. After the checkinstall (first make install), remove the doc-pak directory.
2. Remove the sounds/demo-sounds*
3. Remove references to demo-sounds* in the Makefile
Run ‘checkinstall make samples’. Give the package name as ‘local-asterisk-samples’, etc.
Enjoy!
Original Spanish Version
Con este mini-procedimeinto no es necesario revolver las versiones de ubuntu
Si bien la nueva version de Ubuntu contendra los paquetes de Zaptel y Asterisk otra manera es hacerlo a meno.
1.-Instalar los paquetes
apt-get install cvs openssh-server build-essential automake autoconf bison flex libtool
2.- Instalar los headers del kernel segun la version que estas ejecutando.
root@santo:~ # uname -a
Linux santo 2.6.8.1-5-686-smp #1 SMP Mon Mar 14 21:59:14 UTC 2005 i686 GNU/Linux
root@santo:~ # apt-cache search inux-headers 2.6.8.1-5-686-smp
linux-headers-2.6.8.1-5-686-smp – Linux kernel headers 2.6.8.1 on PPro/Celeron/PII/PIII/PIV SMP
root@santo:~ # apt-get install linux-headers-2.6.8.1-5-686-smp
3.-Crear el link
root@santo:~ # ln -s /usr/src/linux-headers-2.6.8.1-5-686-smp /usr/src/linux-2.6
3.1
Crear las reglas para el UDEV
- dispositivos zaptel
KERNEL=”zapctl”, NAME=”zap/ctl”
KERNEL=”zaptimer”, NAME=”zap/timer”
KERNEL=”zapchannel”, NAME=”zap/channel”
KERNEL=”zappseudo”, NAME=”zap/pseudo”
KERNEL=”zap[0-9]*”, NAME=”zap/%n”
4.-Descargar Zaptel desde el CVS (apt-get install cvs)
cd /usr/src
export CVSROOT=:pserver:[email protected]:/usr/cvsroot
cvs login (password anonvcs)
cvs checkout zaptel
5.-Compilar los drivers de zaptel
cd /usr/src/zaptel
make clean
make linux26
make install
6.-Instalar a mano los modulos
root@santo:~ # insmod /lib/modules/2.6.8.1-5-686-smp/misc/zaptel.ko
root@santo:~ # insmod /lib/modules/2.6.8.1-5-686-smp/misc/wcfxo.ko
7.-Para el proximo reboot agregar a:
/etc/modules
zaptel
wcfxo
Resoluci n de problemas
A)
Al insertar los modulos puedes verificar con dmesg las ultimas lines debes de tener algo asi:
Zapata Telephony Interface Registered on major 196
ACPI: PCI interrupt 0000:01:02.0[A] -> GSI 17 (level, low) -> IRQ 201
wcfxo: DAA mode is ‘FCC’
Found a Wildcard FXO: Wildcard X101P
Update
Asterisk 16 Compilation and Installation on Ubuntu 18.04