Installing and configuring Zaptel

From SaruWiki
Revision as of 20:23, 5 October 2008 by Saruman! (talk | contribs) (added libpri)
Jump to navigation Jump to search

Zaptel driver

To compile the Zaptel driver, we first install support for certain functions (a.o. deflate compression method):

sudo apt-get install zlib1g-dev libssl-dev bison debhelper

Specifically the last one (debhelper) can bring a whole slew of extra packages with it, a.o. build-essential, po-debconf, liburi-perl and patch, just to name a few. Next up is to get the zaptel source code, as is delivered with Debian Lenny:

sudo apt-get install zaptel-source

If there are any dependencies not yet satisfied, you'll see those packages come with the source code (e.g. module-assistant).

Once the zaptel source code is on our system, it is up to us to create the driver. Debian can't handle this for us, as the zaptel driver has to precisely match both our hardware platform and the linux kernel we're using. So we're going to compile our own driver - yippee!
Debian has placed the source file package in /usr/src, and it's named zaptel.tar.bz2. Normally you would think about unpacking it with sudo tar xjvf and get going with the code that's in it. HOWEVER Debian has a really cool utility called the module-assistant. This program is the command-line tool for handling module-source packages that have been prepared for the Debian distribution. It helps users to build and install module packages easily for one or more kernels, even custom ones.

We start from the beginning:

  • boot your system under the kernel for which you want to create the Zaptel drivers, if you haven't already done so
  • as root, run module-assistant prepare. This checks the availability of your kernel source header files, creates a symlink /usr/src/linux that points to your kernel source files, and checks if you have all Debian packages you're going to need (e.g. build-essentials). After a while (may be multiple minutes) the command completes. The output hopefully ends with something like "Setting up zaptel-modules-2.6.26.3 (1:1.4.11~dfsg-2) ..."
  • Some howto's now instruct you to run update-modules, but with modern Debian distributions like 4.0 "Etch" or 5.0 "Lenny" this is not the case; running it won't harm you, because there's a pseudo-command installed, but it won't do a single thing either...
  • If you have hardware installed, you now run genzaptelconf -svdM. It will stop any Asterisk you might have running, be verbose, detect any modules on your hardware, update /etc/modules, and finally create your hardware config file /etc/zaptel.conf; it probably will give you a nice error message too about not being able to write in the /etc/asterisk directory - that's simply because we haven't installed asterisk itself yet! Note: if you live outside the U.S.A., you might want to specify which country you live in, to get the correct dialing tones etcetera. It is as simple as specifying your country (two-letter code): genzaptelconf -svdM -c nl. The output is pretty clear in what the command finds, and what it does with that information.
  • You may want to now edit the configuration file that's created for the channels. The configuration file should be /etc/zaptel.conf, and its contents could look like the file given below. However, you rarely need to edit this file by hand: genzaptelconf can handle this bit usually better than we can.
# Span 1: WCTDM/0 "Wildcard TDM410P Board 1" (MASTER)
fxols=1
fxols=2
fxsks=3
# channel 4, WCTDM/0/3, no module.

# Global data

loadzone        = us
defaultzone     = us
  • If you wish, you can create directory /etc/asterisk, and run the genzaptelconf again; that way you can see the zapata-channels.conf file that is created as well.
  • If you now reboot (into the same kernel), then the dmesg command should confirm the presence of your Zaptel drivers with a short section like this:
Zapata Telephony Interface Registered on major 196
Zaptel Version: 1.4.11
Zaptel Echo Canceller: MG2

Furthermore, you can find lines like these, if you have hardware installed:

ACPI: PCI Interrupt 0000:03:07.0[A] -> GSI 21 (level, low) -> IRQ 21
Port 1: Installed -- AUTO FXS/DPO
Port 2: Installed -- AUTO FXS/DPO
Port 3: Installed -- AUTO FXO (FCC mode)
Port 4: Not installed
VPM100: Not Present
Found a Wildcard TDM: Wildcard TDM410P (4 modules)

Zaptel tools

Next up, if youhaven't yet done so during the preceding step, you now need to install the zaptel userland tools (v1.4.11 under Debian 5.0), which will in turn require fxload and libtonezone1. Installation is simply performed by

sudo apt-get install zaptel fxload libtonezone1

After installation, the zaptel driver checks for the existance of /etc/zaptel.conf. When you've never before had Zaptel on your system, or haven't finished configuration in the preceding step, then you probably get the message

zaptel : /etc/zaptel.conf fails test for exists and readable

This is in fact a friendly reminder that you first have to create this file, before you try to load the driver.

libpri installation

Asterisk needs the libpri package; not only to handle ISDN-cards, but also for some other functions (although currently I don't know which ones :-). Before installing Asterisk, you could start by installing this package. In Debian 5.0 "Lenny", the packages is named libpri1.0:

apt-get install libpri1.0