3.4. Compiling Zaptel

Figure 3-3 shows the layers of interaction between Asterisk and the Linux kernel with respect to hardware control. On the Asterisk side is the Zapata channel module, chan_zap. Asterisk uses this interface to communicate with the Linux kernel, where the drivers for the hardware are loaded.

Layers of device interaction with Asterisk

Figure 3.4. Layers of device interaction with Asterisk


The Zaptel interface is a kernel loadable module that presents an abstraction layer between the hardware drivers and the Zapata module in Asterisk. It is this concept that allows the device drivers to be modified without any changes being made to the Asterisk source itself. The device drivers are used to communicate with the hardware directly and to pass the information between Zaptel and the hardware.

[Tip] Tip

While Asterisk itself compiles on a variety of platforms, the Zaptel drivers are Linux-specific—they are written to interface directly with the Linux kernel. There is a project at http://www.solarisvoip.com/ that provides Zaptel support for Solaris. There is also a project that is working to provide Zapata drivers for BSD located at http://www.voip-info.org/tiki-index.php?page=FreeBSD+zaptel.

First we will discuss the ztdummy driver, used on systems that require a timing interface but which do not have hardware, then we will look at compiling and installing the drivers. (The configuration of Zaptel drivers will be discussed in the next chapter.)

[Tip] Tip

Before compiling the Zaptel drivers on a system running a Linux 2.4 kernel , you should verify that /usr/src/ contains a symbolic link named linux-2.4 pointing to your kernel source. If the symbolic link doesn't exist, you can create it with the following command (assuming you've installed the source in /usr/src/):

    # ln -s /usr/src/'uname -r' /usr/src/linux-2.4

Computers running Linux 2.6 kernel-based distributions do not usually require the use of the symbolic link, as these distributions will search for the kernel build directory automatically. However, if you've placed the build directory in a nonstandard place (i.e., somewhere other than /lib/modules/<kernel version>/build/), you will require the use of the symbolic link.

[Note] Note

While Asterisk and the other related packages run on Linux 2.4.x kernels, development is done first and foremost on 2.6.x kernels and support for 2.4.x kernels is not guarenteed in the future.

3.4.1. The ztdummy Driver

In Asterisk, certain applications and features require a timing device in order to operate (Asterisk won't even compile them if no timing device is found). All Digium PCI hardware provides a 1-kHz timing interface which satisfies this requirement. If you lack the PCI hardware required to provide timing, the ztdummy driver can be used as a timing device. On Linux 2.4 kernel-based distributions, ztdummy must use the clocking provided by the UHCI USB controller .

[Note] Note

Many older systems (and some newer ones) use an OHCI USB controller chip, which is incompatible with ztdummy. However, if you're using a 2.6 kernel there is no need to worry about which USB controller chip your system has.

The driver looks to see that the usb-uhci module is loaded and that the kernel version is at least 2.4.5. Older kernel versions are incompatible with ztdummy.

On a 2.6 kernel-based distribution, ztdummy does not require the use of the USB controller. (As of v2.6.0, the kernel now provides 1-kHz timing[48] with which the driver can interface; thus, the USB controller hardware requirement is no longer necessary.)



[48] Note that this is configurable in the kernel, so it is possible certain distributions may not have this set to 1000Hz; CentOS however does have this set at the correct frequency.