Asterisk zaphfc install

Installing zaphfc (Kernel 2.4)


  • a PC with PCI slots for ISDN cards
  • a HFC-S PCI ISDN card.
  • Knowledge. It's amazing how much you can learn by doing this type of installation, but you should at least have installed and configured a kernel or two before starting.

The Kernel

The zaphfc is known to work with vanilla kernel source 2.4.24. Please make a note if you have successfully installed with another kernel.

For Gentoo:
emerge -p vanilla-sources
emerge vanilla-sources

If you already have the right kernel installed you do not need to recocmpile it. You only need to make sure that it is configured. You can do this by "make menuconfig" (save kernel configuration) and then "make dep".

If you have completely new kernel you will need to compile and install it. You don't have to compile any extra modules( like isdn, HiSax, Capi, etc.) in order to make zaphfc work.

For Gentoo:
Remember to add all the Gentoo specific stuff. look at the Gentoo install doc's for details


Download the latest bri-stuff-x.x.xrcxx.tar.gz from One of the installation scripts downloads Asterisk, so remember to install the cvs and wget packages if you didn't install already. BRI-stuff patches the Asterisk code before compiling it so make sure that you have the patch package installed.

Unpack the file:

cd /usr/src
tar -zxvf /path/to/bri-stuff-x.x.xrcxx.tar.gz
cd bri-stuff.x.x.xrcxx

Read the Install file:


To install the sample configuration files edit "" and change

  1. make samples


make samples

WARNING! By doing so you will overwrite any existing Asterisk .conf files in /etc/asterisk, so make sure you really want to do this.
HINT: If you'd like to add the the 'asterisk-addons' package (e.g. for mySQL CDR support) then download it manually and don't forget to adjust the makefile so that it points to the Asterisk source directory within your bristuff directory (e.g. change ../asterisk to something like ../asterisk-1.0.1)
HINT: Since the FTP server if Digium is often slow and/or overloaded you might see the bristuff installation/download process stall. It might be a better idea to first manually download the required files, or to get them from a mirror site
HINT: You should probably look at the asterisk Makefile and the zaptel Makefile (e.g. if you want ztdummy) as well as the zaptel zconfig.h file and apply any changes before you run the ./ script.

Start the installation:


If the install script has problems downloading the asterisk tar.gz file then download it manually and comment out this line in "". Change



  1. wget


Copy zaphfc/zapata.conf to /etc/asterisk. Then edit it. Mine looks something like this:

; Default language
; Default context
switchtype = euroisdn
signalling = bri_net_ptmp ;this is for a peer to multipeer network
group = 1
channel => 1-2

Finally don't forget to copy zaphfc/zaptel.conf to /etc/ and then check it. Mine looks something like this:

; hfc-s pci a span definition
; most of the values should be bogus because we are not really zaptel


Installing the driver

cd zaphfc
make load

or to use it in NT mode

cd zaphfc
make loadNT

To load this module at boot you have to look at your distro's doc's on loading modules.

For Gentoo:
Add the module in your /etc/modules.d/autoconfig/kernel-2-4

For Mandrake 8.2:
Add these lines to /etc/modules.conf:
pre-install zaphfc /sbin/modprobe zaptel
post-install zaphfc /sbin/ztcfg
And this to /etc/modules:

For Fedora Core 2:
Add these three lines to /etc/modprobe.conf:

install zaphfc { modprobe zaptel; } ; /sbin/modprobe --first-time --ignore-install zaphfc
install zaphfc /sbin/modprobe --first-time --ignore-install zaphfc && { /sbin/ztcfg -v; }
alias char-major-196 zaphfc


Be aware that you cannot load ztdummy and zaphfc together - it is either one or the other. If you see an error like

ZT_SPANCONFIG failed on span 1: Invalid argument (22

then check with 'lsmod' if ztdummy is present.

Installing zaphfc with CVS-Head

Holger Schurig, June 17, 2004

zaphfc is in bri-stuff from --- or in a patched version at I downloaded the latter and let the ./ and ./ scripts run normally.

Then I install zaptel.o and zaphfc.o to /lib/modules/<kernelversion>/misc and do the usual mambo in /etc/modules to run ztcfg after loading zaphfc and to load zaptel before zaphfc:

pre-install zaphfc /sbin/modprobe zaptel
post-install zaphfc /sbin/ztcfg -v

Now I go to a different directory and do a CVS checkout of Asterisk head. Just before compiling, I replace channels/chan_zap.c with bri-stuff-0.0.2a-pp/asterisk/channels/chan.zap.c.

I then change the lines of the form

static ast_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;



and compile & install. And voila, now I have an Asterisk from (almost) CVS HEAD working with zaphfc.

The real solution would have been to apply all the patches from bri-stuff*/libpri.patch to libpri in CVS. After looking at how much has been changed and considering that I don't have a clue about q.921 and q.931 I decided to not doing it that way :-)

Also, I'd thing it would be better if KaPeJod put's his software into some CVS so that more than one person can add changes and keep things up-to-date.

(:arrow:) Note: with this workaround, it isn't possible to detect fax tones and other things that involve advanced features from chan_zap & dsp (probably even busy detect) with x100p x101p.

Greetings, Holger

References and sources:

See also

Go back to Asterisk zaphfc

Created by: worktoomuch, Last modification: Tue 12 of Jun, 2012 (03:00 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+