Asterisk Linux Debian
Asterisk on Debian GNU/Linux
Debian GNU/Linux is a very nice Linux distribution and can be found at http://www.debian.org/.
If you are not familiar with Debian, check it out. It is a fantastic server platform, specifically for it’s ability to be remotely upgraded – even between versions.
Asterisk from source for Debian Etch
Related installation guides:
- http://planet.zakotel.com/wiki/index.php?page_id=18 – OUTDATED, see packages section below
- http://www.itinfusion.ca/asterisk/howto-installing-asterisk-on-debian-etch/, including running asterisk as non-root user
Or if you just want to install plain Asterisk 1.4, you can first do:
“php-cli” is here for PHP-AGI implementations, “mysql-common” and “libmysqlclient15-dev” are the dependencies needed to build mysql support, “libnewt-dev” is needed by zaptel to compile zttool. NONE of those are required to build asterisk but are needed for full blown installation.
After doing ‘make menuselect’ in the Asterisk directory (see below) you might find one or more options to be greyed out. Here’s a list of packages that can fix this – don’t forget to run another ‘./configure’ before doing another ‘make menuselect’!
- libspeex1 (possibly also libspeex-dev and speex) for the speex codec and translations from/to it
- libvorbis-dev for Ogg Vorbis sound file support
- libcurl3-dev for the CURL() function
- unixodbc (possibly also unixodbc-devel and e.g. libmyodbc) for CDRs, ODBC functions and ODBC voicemail
- SQLite if you’d like to use that instead of MySQL or Postgres
- mysql-server if you’d like to run a MySQL server on the same box
- php5-mysql: PHP package to allow it to interface with MySQL (since we already started out with php-cli and mysql …)
- jabber/XMPP/jingle/gtalk: Research the current requirements (for chan_gtalk etc)
Entirely unnecessary but useful tools
- vim (replaces vim.tiny and therefore gives you full syntax highlighting of Asterisk .conf files when you do “:syntax on” in vim)
- sox (tool for the codec conversion of audio files)
- nmap (scan your network for hosts and ports)
- ngrep (grep for network traffic)
- iftop (displays bandwidth usage information on an network interface)
- iptraf (Interactive Colorful IP LAN Monitor)
- elinks (text web browser)
- lynx (text web browser)
Then get the latest sources of zaptel, libpri, asterisk and asterisk-addons from digium, untar them (tar zxvf packagename.tar.gz) and install them in the order:
Now start Asterisk the first time with asterisk -vvvgc and look for error messages in the CLI that you might want to attack. Note that you might have to change your putty settings (a Windows SSH client) such that your ‘lines of scrollback’ is set to 2000 or higher in order to be able to see all warnings and errors. Terminate Asterisk with stop now.
In case of error concerning realtime you could consider to disable it at least temporarily by editing /etc/asterisk/modules.conf and adding the two following lines:
There are several Debian packages (installable with dpkg or apt-get) available:
- Current Packages – Debian Officialzaptel – Debian experimental zaptel-source – Debian experimental libpri – Debian experimental Look for the rest soon Debian source for experimental: deb http://ftp.us.debian.org/debian/ ../project/experimental main
- Current Packages – OtherXorcom’s : deb http://rapid.dotsrc.org/ experimental/ These are based on debian code
peen.net’s : deb http://debian.peen.net asterisk/ These are backports from Unstable to Sarge
(proformatique) xivo.fr’s : deb http://xivo.fr debian/ Backports from Unstable to Sarge with Asterisk1.2.16
ZaKoTel Etch Packages (asterisk v220.127.116.11, x86) debhttp://packages.zakotel.com/debianetchmain
ZaKoTel provides Asterisk & ZapTel 1.4 (+ kernel drivers for original x86 Debian kernels) packages for Debian Etch inside their repository, their packages include the recent BriStuff patches as well as app_rxfax and app_txfax for fax handling. A HowTo for integrating the repository into apt can be found here.
- Sarge Packages (asterisk v1.0.7)
in Debian. Note that they include the bristuff patches.
Note that your system MUST meet these requirements:
You must have openssl and the respective development package (libssl-dev?).
You must be running Linux 2.4.x (or 2.6.x)
You must have the Linux Kernel Sources package installed on your system.(or Kernel Headers)
Alternatively, use the command: apt-get build-dep asterisk
Note that Debian tends to break packages into smaller pieces than other distributions, so there are more ‘required’ packages here than with RedHat or others.
Some package names are also tied to particular versions of the software, especially libraries. This allows you to install multiple versions of the same libraries, and to have different packages use their prefferred verision. That said ‘apt-cache search’ is your friend.
Finally, this is what worked for me… Your system may be configured differently, and I may have installed more than I needed to. YMMV -JP (:biggrin:)
Here are the packages under Debian (as of 2003-11-22):
- kernel-headers-`uname -r` (NOTE: newer versions may require linux-headers-`uname -r`)
- libssl0.9.7: (Note that version may change – do: apt-cache search libssl)
- (libreadline4 – not required anymore, asterisk brings “editline” along)
- (libreadline4-dev – not required anymore, see above)
- zlib1g-dev (Note: needed for cvs head)
- svn: To download the newest cvs source, or course…
- Outdated! cvs: To download the newest cvs source, or course…
- minicom: to configure your channelbank via serial
- festival: To speek text programatically
- doxygen, graphviz: to build the html Asterisk API documentation with ‘make progdocs’
Just a quick note –
if you upgrade your kernel, copy the config file that comes with the .deb file, (it gets placed in /boot) to /usr/src/linux or /usr/src/linux-2.4 (cp /boot/config-2.4.25-1-686-smp /usr/src/linux/.config) then do a “make oldconfig; make dep” zaptel will compile just fine if everything else is ok..
The kernel-headers Package
There is no need to install the complete kernel-source package. Simply install the appropriate kernel-headers package for your current kernel, and make sure that /usr/src/linux links to them.
Zaptel unresolved symbols problems
While trying to install the zaptel module with ‘make install’ I have gotten error messages of the form
To solve this problem, do not download the kernel-source as suggested above, instead download the correct kernel-headers package (type uname -a to find out which one) and create a softlink with
ln -s /usr/src/kernel-headers-… /usr/src/linux (e.g. ln -s /usr/src/kernel-headers-2.4.27-2-686 /usr/src/linux)
Now compile the zaptel driver and ‘make install’ to install it.
Help With Compiling Zaptel: Debian with a custom kernel
If you are using Debian and a custom Debian kernel, note that the kernel Makefile in (/usr/src/linux/Makefile) may not have the correct EXTRAVERSION variable.
If you still get a kernel-version mismatch error after following the Zatptel Installation Instructions, try looking in the Makefile to make sure that the version information there matches what is returned by ‘uname -r’. If not, edit the Makefile and try the process again.
Alternatively, you could use the zaptel-source debian package and the wonderful module-assistant:
Some tips for working with Asterisk on Debian 3.1/Sarge with Kernel 2.6:
- Check that your TDM400 is not sharing any IRQs – use cat /proc/interrupts to check (you’ll need to have the wctdm driver loaded).
- You’ll need the zaptel-source package to compile the (wctdm, wcfxo, wcfxs) drivers for your running kernel. As long as you’re running a stock Debian kernel, this should be quite easy. Hint: you need the EXACT kernel-headers-* package to match your current running kernel. If you get “wrong magic” errors when trying to insmod the wctdm driver, then you’re compiling with the wrong kernel-headers directory symlinked to /usr/src/linux.
- If you run ‘make linux26’ (as instructed for those running 2.6 kernels) to build the zaptel drivers in /usr/src/modules/zaptel, ‘make install’, and then try to insmod them only to find that Asterisk cannot open the zap channels anyway – try doing ‘make’ instead (without the ‘linux26’ bit). I’m running kernel-image-2.6.8-1-386 and for some reason a dist-upgrade/kernel-upgrade/reboot the other day now makes my zaptel modules useless if I do ‘make linux26’. Odd. ( Note that this shouldnt make any difference as the makefile will automatically detect the kernel version and adapt )
- Don’t forget to insmod wcfxo and wcfxs. If you have only FXO modules you’ll need FXS signalling and hence the wcfxs module; and vice versa. It’s harmless to just do both even if you only have one type of module installed on your card.
- Don’t forget to install the zaptel package for the userland tools, which includes the ztcfg utility.
- It seems that, there is an issue where Asterisk can’t open the zaptel channels when launched through the init.d scripts as the asterisk user because the asterisk user doesnt have permission to access the device… so make sure you add asterisk user to the dialout group using ‘adduser asterisk dialout’.
- Don’t forget to use signalling=fxs_ks in your zapata.conf so that your FXO module can detect remote end hangup reliably.
- Want to be able to pickup a line even if it isn’t ringing? Perhaps it’s just me but I got confused thinking that the zapbarge Asterisk command would be what I wanted. Of course, the solution is much simpler.
Below are some lines out of my extensions.conf that allow anyone on a SIP phone (or other) to pickup a PSTN line by dialing *X, where X is the line number (1-3). This is useful for when you still have analogue phones sharing the same lines that are going into your TDM400 card, and you want to be able to pickup a line that has already been answered with an analogue phone.
Step by step TDM400P on Debian 3.1/Sarge with Kernel 2.6:
- Install Debian 3.1/Sarge with Kernel 2.6 ( well DUH )
- apt-get install zaptel-source
- apt-get install kernel-headers-`uname -r`
- apt-get build-dep asterisk
- m-a a-i zaptel
- you need to set an opermode if you live outside of the us so edit /etc/modprobe.d/zaptel (Australia used as example)install wcfxo /sbin/modprobe –ignore-install wcfxo opermode=AUSTRALIA && /sbin/ztcfg
install wcfxs /sbin/modprobe –ignore-install wcfxs opermode=AUSTRALIA && /sbin/ztcfg
- and edit /etc/zaptel.conf (Australia with Module 1-2 FXO and 3-4 FXS used as example)loadzone = au
- modprobe zaptel
- modprobe wcfxs (to support the FXO modules)
- modprobe wcfxo (to support the FXS modules)
-NOTE: If modprobe does not see your new modules, claiming the are not found, run ‘depmod’
and your done… (:wink:)
IVR Audio problems (kind of robotic voice) on TDM400P PSTN channels with Debian 3.1/Etch (testing) on Intel P4 based cpu/s:
(Assuming that you already followed the steps above)
Since kernel 2.6 uses an internal timer, this could be related to the “wrong” kernel image for the CPU installed in the system.
The default Debian 3.1/Etch kernel image is linux-image-2.6.12-1-386 (now its 2.6.18-4)
So, if you are using P4 based cpu/s try to:
- apt-get update
- apt-get install linux-image-2.6.x-x-686 (in my case “linux-image-2.6.12-1-686”)
- apt-get install kernel-headers-2.6.x-x-686 (do this after the image installation)
- reboot. The new kernel will be automatically loaded (check if it is present in the grub/lilo list anyway)
- ignore the asterisk errors, if present
- login to a secondary console (eg: alt+F2)
- m-a a-i zaptel (which rebuilds the zaptel driver, not started after the reboot)
and that’s it.
You don’t need to modprobe again nor reconfigure anything.
Zaptel /dev permissions
I finally figured out what was wrong with ztdummy after compiling it 2 or 3 times. I read on a thread (http://asterisk.linkx.net/asteriskusers/200409/msg03834.html) that Debian runs as a different user or something, so I chown’d /dev/zap/pseudo to asterisk:root and viola everything started working.
- Tony Wasson’s Installing Asterisk on Debian Stable
- Boris von Loesch’s Installation der Asterisk PBX unter Debain Sarge mit Digium TE110p PRI Card
- Martin List-Petersen’s Building the zaptel modules Debian style
- MikeOverIP’s Asterisk Compilation and Installation on Debian Etch (from sources)