HOWTO install Asterisk with hlc (isdn-cards) on Gentoo Linux

From RADION OpenLab

what are we going to do (build):
instaling a asterisk 1.2.1 with hfc driver (bristuff) on gentoo kernel 2.6.14-r5

what we need:
kernel sources, and
http://www.junghanns.net/downloads/bristuff-0.3.0-PRE-1d.tar.gz
or a newer version

make sure that:
you do have a link to your kernel sources like:

 
speechserver ~ # ls -al /usr/src/
 
lrwxrwxrwx   1 root root   22 Dec 25 21:56 linux -> linux-2.6.14-gentoo-r5
lrwxrwxrwx   1 root root   22 Dec 28 12:02 linux-2.6 -> linux-2.6.14-gentoo-r5
drwxr-xr-x  19 root root 4096 Jan  2 14:38 linux-2.6.14-gentoo-r5


you need to insert/change "CONFIG_CRC_CCITT=y" in your "/usr/src/linux/.config"
and rebuild your kernel.

get the "bristuff" and extract it

 
speechserver ~ # cd /usr/local/src/
speechserver src # wget http://www.junghanns.net/downloads/bristuff-0.3.0-PRE-1d.tar.gz
speechserver src # tar -xzvf bristuff-0.3.0-PRE-1d.tar.gz

now start to get and patch the rest we need to install ASTERISK on our computer

 
speechserver src # cd bristuff-0.3.0-PRE-1d
speechserver bristuff-0.3.0-PRE-1d # ./download.sh

next we need to compile all wee need

cd zaptel-1.2.1
make clean all
make install
cd ..

cd libpri-1.2.1
make clean all
make install
cd ..

cd zaphfc
make clean all
make linux26
cd ..

cd asterisk-1.2.1
make clean
make all
make install
make samples
cd ..


it should now all be ok. it doesn't matter if you did get any warnings like:

zaptel: Unknown symbol crc_ccitt_table
zaptel: Unknown symbol crc_ccitt_table
zaphfc: Unknown symbol zt_receive
zaphfc: Unknown symbol zt_ec_chunk
zaphfc: Unknown symbol zt_transmit
zaphfc: Unknown symbol zt_unregister
zaphfc: Unknown symbol zt_register

the first two should disapear when you have started your computer with the new build kernel.

inserting the basic configs into the sample ones:

 
speechserver ~# vi /etc/zaptel.conf
loadzone=nl
defaultzone=nl
# notice: nl zone is identical with de zone

span=1,1,3,ccs,ami
bchan=1-2
dchan=3

span=2,1,3,ccs,ami
bchan=4-5
dchan=6

you can test your configuration on the console:
if you do have two ISDN cards, you need to configure them:

 
modprobe zaphfc modes=1                  #(first card is set to TE and the second to NT)
#if you need to change NT<->TE:
modprobe zaphfc modes=2                  #(first card is set to NT and the second to TE)
#if you want to use both cards in NT mode
modprobe zaphfc modes=3                  #(both cards are set to NT)

and start the driver with:

 
ztcfg -vv

let's have a look if it's working:

 
speechserver ~ # cat /proc/zaptel/1
Span 1: ZTHFC1 "HFC-S PCI A ISDN card 0 [TE] layer 1 ACTIVATED (F7)" AMI/CCS
 
           1 ZTHFC1/0/1 Clear
           2 ZTHFC1/0/2 Clear
           3 ZTHFC1/0/3 HDLCFCS
speechserver ~ # cat /proc/zaptel/2
Span 2: ZTHFC2 "HFC-S PCI A ISDN card 1 [NT] layer 1 DEACTIVATED (G2)" AMI/CCS
 
           4 ZTHFC2/0/1 Clear
           5 ZTHFC2/0/2 Clear
           6 ZTHFC2/0/3 HDLCFCS

note: it is just ACTIVATED when you have connected your cards to the Phone/NT.

if all works, you should write a small shell-script "zapreload.sh"

 
#!/bin/sh
rmmod zaphfc
rmmod zaptel
modprobe zaphfc modes=2
ztcfg -vv
RADION OpenLAB