Asterisk zaphfc install26

Two ZAPHFC cards and Kernel 2.6


I've been struggling for hours,days,days,days.... to get my Asterisk work with 2x HFC-S BRI cards. One card for use in NT-mode for connecting my ISDN DECT phone,and one card as gateway to PSTN. Now it'works,and I just want to share some of the experience with others. I'd guess there must be 'Somebody Out There' having some difficulty with this just like me.

Anyway, find below my findings.
(you might want to try the new bootable iso (14MB) at http://spblinux.sf.net (development branch version 2.1b12 on download page; kernel 2.6.7bk14) to study a working system as an example to these instructions; spblinux)

System

Running Slackware 9.1 installed from ISO
Compiled new kernel 2.6.6 (compile kernel with module unloading as well as loading)

Make sure you have the symlinks in /usr/src :

linux -> linux-2.6.6
linux-2.6 -> linux-2.6.6 //to get compile script work with kernel 2.6.x

To make symbolic link linux-2.6 -> linux-2.6.6:

cd /usr/src
ln -s linux-2.6.6 linux-2.6

bri-stuff

Get bri-stuff.0.0.2 (stable)
After unpacking the bri-stuff.0.0.2, edit the download.sh file concerning
CVS download to:

cvs -z9 co -r v1-0_stable asterisk
cvs -z9 co -D "2004/05/05" zaptel
cvs -z9 co -D "2004/04/17" libpri

These versions of zaptel,libpri will work with the 2.6.x kernel, ref. "Arne" at Wiki.

Edit compile.sh file and uncomment the next line to install sample asterisk configuration files #make samples

Header files

Edit some file references in some header files:
(Eleminating compile errors)

/usr/src/linux/include/asm/irq.h
In line 16 change: #include "irq-vectors.h" to: #include
"mach-default/irq-vectors.h"

/usr/src/linux/include/asm/mpspec.h
In line 6 change: <mach_mpspec.h> to: <asm/mach-default/mach_mpspec.h>

/usr/src/linux/include/asm/smp.h
In line 71 change: <mach_apicdef.h> to: <asm/mach-default/mach_apicdef.h>

I've googled around and it looks like this is a quite common problem introduced with kernel 2.6 due to some of the !noobs disagreeing about how the source tree should be organized. Different suggestions were came up like symlinks or just "dirty" edit the header files.

I guess there are some other ways to do this, but not at my knowledge disposal at that point.

Installation and setup

run: ./install.sh
which just runs download.sh and compile.sh.

copy /usr/src/bri-stuff.0.0.2/zaphfc/zapata.conf to /etc/asterisk/

Edit /usr/src/bri-stuff.0.0.2/zaphfc/zaptel.conf (this usually resides in /etc/zaptel.con, but read on and see below):

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

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


Edit /etc/asterisk/zapata.conf:

signalling = bri_net_ptmp ;p2mp NT mode port1/(card1)
group = 1
context=default
channel => 1-2

signalling = bri_cpe_ptmp ;p2mp TE mode port2/(card2)
group = 2
context=default
channel => 4-5


Edit /usr/src/bri-stuff.0.0.2/zaphfc/Makefile
part of Makefile:

loadNT: all
modprobe zaptel
insmod ./zaphfc.ko modes=1
ztcfg -v -c ./zaptel.conf

Changed lines:
zaphfc.o to .ko
modes=1

modes=1 makes BRI-port1/card1 operate in NT-mode and second port/card in TE-mode (modes=3 would have put both ports in NT-mode)

binary: 1 = Port in NT-mode 0 = Port in TE-mode
Port 1 = lsb

Loading

Loading the drivers (zaphfc):

make loadNT

Note:
this makes ztcfg use the zaptel.conf file in directory /usr/src/bri-stuff.0.0.2/zaphfc/
Note:
if you have problems with zaphfc and buffer overruns try the florz patch

Start and configure Asterisk


asterisk -vvvvgc

Use a texteditor like gedit and open your config files:

extensions.conf //for dialplan
sip.conf //defining SIP phones etc
zapata.conf
zaptel.conf
etc..

In order to connect a telephone directly to a card, you need to:
  • terminate the S0-bus by using resistors, no matter how short the cable is.
  • provide power feeding to the telephone, if it does not supply it's own power.
  • cross link the ports, because the card receives what the telephone sends and vice versa.
All this can be done easily by using an old NT1. Here is an easy way on doing it:
  • Take an ISDN cable and cut it in the middle. On each side of the cabe there is an RJ-45 plug. The middle pair (4 and 5) must be connected with the surrounding wire pair on the other side (3 and 6) and vice versa.
  • Add 2 100 ohm resistors to the wires. One to the first pair (connected to 4 and 5) and one to the second (connected to 3 and 6).
  • Use an old NT1 if you don't have an own power supply. U could even use a somehow broken NT1, as long as the power feeding function is still working.
NOTE: Ethernet cross link cables don't work, because they use different pairs than ISDN S0 does.

Plug one end of your new cross link cable to your ISDN card that should run in NT-Mode, and one to your telephone. If your telephone set needs external power, connect an old NT1 to your ISDN card using the cross link cable, and your telephone with a NORMAL ISDN (or Ethernet/straightthrough wired) cable to your NT, using the second plug.

For a "cleaner" method please consult chapter 2.2 of this guide from http://isdn.jolly.de.

Now: PLAY AROUND!
Do changes,save,and use command:restart now, in CLI to restart Asterisk server to activate the changes:

CLI>restart now


Thats my box running!! :)
Good Luck !

Regards
Petter Ween

Debian Sarge

The zaptel-source package contains zaphfc. To install it, you must have the kernel source for your current kernel (I am not sure whether kernel-headers are enough), and module-assistant.

After you install zaptel-source, in any directory and as any user, you can run

m-a -k /full/path/to/kernel/dir -u . -i -t build zaptel

That will give you a .deb-file, you can install with dpkg as root.

I had some trouble building the zaptel-source package from the official Debian Sarge repository, but I was adviced by a member of the Debian VoIP team to try the newest package from http://rapid.dotsrc.org/unstable/ or http://rapid.tzafrir.org.il/rapid unstable main

For loading of the modules, I recommend using modconf. It asks you for arguments to the module, and there you can put
modes=1
to instruct it to make the first card run in NT mode and the second in TE mode.
If you want to do it manually (instead of using modconf), you can create the file /etc/modprobe.d/zaphfc to contain the line
options zaphfc modes=1
and then use modprobe to load the modules.

(This section was by Jørgen Elgaard Larsen)



See also



Go back to Asterisk zaphfc

Two ZAPHFC cards and Kernel 2.6


I've been struggling for hours,days,days,days.... to get my Asterisk work with 2x HFC-S BRI cards. One card for use in NT-mode for connecting my ISDN DECT phone,and one card as gateway to PSTN. Now it'works,and I just want to share some of the experience with others. I'd guess there must be 'Somebody Out There' having some difficulty with this just like me.

Anyway, find below my findings.
(you might want to try the new bootable iso (14MB) at http://spblinux.sf.net (development branch version 2.1b12 on download page; kernel 2.6.7bk14) to study a working system as an example to these instructions; spblinux)

System

Running Slackware 9.1 installed from ISO
Compiled new kernel 2.6.6 (compile kernel with module unloading as well as loading)

Make sure you have the symlinks in /usr/src :

linux -> linux-2.6.6
linux-2.6 -> linux-2.6.6 //to get compile script work with kernel 2.6.x

To make symbolic link linux-2.6 -> linux-2.6.6:

cd /usr/src
ln -s linux-2.6.6 linux-2.6

bri-stuff

Get bri-stuff.0.0.2 (stable)
After unpacking the bri-stuff.0.0.2, edit the download.sh file concerning
CVS download to:

cvs -z9 co -r v1-0_stable asterisk
cvs -z9 co -D "2004/05/05" zaptel
cvs -z9 co -D "2004/04/17" libpri

These versions of zaptel,libpri will work with the 2.6.x kernel, ref. "Arne" at Wiki.

Edit compile.sh file and uncomment the next line to install sample asterisk configuration files #make samples

Header files

Edit some file references in some header files:
(Eleminating compile errors)

/usr/src/linux/include/asm/irq.h
In line 16 change: #include "irq-vectors.h" to: #include
"mach-default/irq-vectors.h"

/usr/src/linux/include/asm/mpspec.h
In line 6 change: <mach_mpspec.h> to: <asm/mach-default/mach_mpspec.h>

/usr/src/linux/include/asm/smp.h
In line 71 change: <mach_apicdef.h> to: <asm/mach-default/mach_apicdef.h>

I've googled around and it looks like this is a quite common problem introduced with kernel 2.6 due to some of the !noobs disagreeing about how the source tree should be organized. Different suggestions were came up like symlinks or just "dirty" edit the header files.

I guess there are some other ways to do this, but not at my knowledge disposal at that point.

Installation and setup

run: ./install.sh
which just runs download.sh and compile.sh.

copy /usr/src/bri-stuff.0.0.2/zaphfc/zapata.conf to /etc/asterisk/

Edit /usr/src/bri-stuff.0.0.2/zaphfc/zaptel.conf (this usually resides in /etc/zaptel.con, but read on and see below):

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

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


Edit /etc/asterisk/zapata.conf:

signalling = bri_net_ptmp ;p2mp NT mode port1/(card1)
group = 1
context=default
channel => 1-2

signalling = bri_cpe_ptmp ;p2mp TE mode port2/(card2)
group = 2
context=default
channel => 4-5


Edit /usr/src/bri-stuff.0.0.2/zaphfc/Makefile
part of Makefile:

loadNT: all
modprobe zaptel
insmod ./zaphfc.ko modes=1
ztcfg -v -c ./zaptel.conf

Changed lines:
zaphfc.o to .ko
modes=1

modes=1 makes BRI-port1/card1 operate in NT-mode and second port/card in TE-mode (modes=3 would have put both ports in NT-mode)

binary: 1 = Port in NT-mode 0 = Port in TE-mode
Port 1 = lsb

Loading

Loading the drivers (zaphfc):

make loadNT

Note:
this makes ztcfg use the zaptel.conf file in directory /usr/src/bri-stuff.0.0.2/zaphfc/
Note:
if you have problems with zaphfc and buffer overruns try the florz patch

Start and configure Asterisk


asterisk -vvvvgc

Use a texteditor like gedit and open your config files:

extensions.conf //for dialplan
sip.conf //defining SIP phones etc
zapata.conf
zaptel.conf
etc..

In order to connect a telephone directly to a card, you need to:
  • terminate the S0-bus by using resistors, no matter how short the cable is.
  • provide power feeding to the telephone, if it does not supply it's own power.
  • cross link the ports, because the card receives what the telephone sends and vice versa.
All this can be done easily by using an old NT1. Here is an easy way on doing it:
  • Take an ISDN cable and cut it in the middle. On each side of the cabe there is an RJ-45 plug. The middle pair (4 and 5) must be connected with the surrounding wire pair on the other side (3 and 6) and vice versa.
  • Add 2 100 ohm resistors to the wires. One to the first pair (connected to 4 and 5) and one to the second (connected to 3 and 6).
  • Use an old NT1 if you don't have an own power supply. U could even use a somehow broken NT1, as long as the power feeding function is still working.
NOTE: Ethernet cross link cables don't work, because they use different pairs than ISDN S0 does.

Plug one end of your new cross link cable to your ISDN card that should run in NT-Mode, and one to your telephone. If your telephone set needs external power, connect an old NT1 to your ISDN card using the cross link cable, and your telephone with a NORMAL ISDN (or Ethernet/straightthrough wired) cable to your NT, using the second plug.

For a "cleaner" method please consult chapter 2.2 of this guide from http://isdn.jolly.de.

Now: PLAY AROUND!
Do changes,save,and use command:restart now, in CLI to restart Asterisk server to activate the changes:

CLI>restart now


Thats my box running!! :)
Good Luck !

Regards
Petter Ween

Debian Sarge

The zaptel-source package contains zaphfc. To install it, you must have the kernel source for your current kernel (I am not sure whether kernel-headers are enough), and module-assistant.

After you install zaptel-source, in any directory and as any user, you can run

m-a -k /full/path/to/kernel/dir -u . -i -t build zaptel

That will give you a .deb-file, you can install with dpkg as root.

I had some trouble building the zaptel-source package from the official Debian Sarge repository, but I was adviced by a member of the Debian VoIP team to try the newest package from http://rapid.dotsrc.org/unstable/ or http://rapid.tzafrir.org.il/rapid unstable main

For loading of the modules, I recommend using modconf. It asks you for arguments to the module, and there you can put
modes=1
to instruct it to make the first card run in NT mode and the second in TE mode.
If you want to do it manually (instead of using modconf), you can create the file /etc/modprobe.d/zaphfc to contain the line
options zaphfc modes=1
and then use modprobe to load the modules.

(This section was by Jørgen Elgaard Larsen)



See also



Go back to Asterisk zaphfc

Created by: JustRumours, Last modification: Tue 23 of May, 2006 (17:45 UTC) by elhaard
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+