How-To Fritz!Card Usb 2.0 and 2.X

Babyporch
Posts: 10
Member Since:
2006-09-13

Download the asterisk source in /usr/src for your revision:
Download the Frizt!Card usb driver from ftp://ftp.avm.de/cardware/fritzcrdusb.v20/linux/suse.93/fcusb2-suse93-3.... in /usr/src
# tar zxvf suse93-3.11-07.tar.gz
# cd fritz/src
modify the Makefile: # nano Makefile
Change from:
EXTRA_CFLAGS += -D__$(CARD)__ -DTARGET=\"$(CARD)\"
to
EXTRA_CFLAGS += -O0 -D__$(CARD)__ -DTARGET=\"$(CARD)\"

Now:
# cd ..
# make
# make install
# depmod-ae
If you have Fritz!Card 2.0 copy the file fus2base.frm in /lib/firmware
otherwise copy the file fus3base.frm in the same location.
now: # nano /etc/capi.conf
If you have a Fritz!Card 2.0 write this:
fcusb2 /lib/firmware/fus2base.frm DSS1 - - - - P2P
otherwise
fcusb2 /lib/firmware/fus3base.frm DSS1 - - - - P2P

Now: # cd /usr/src

download the latest capi4linux
# wget ftp://ftp.in-berlin.de/pub/capi4linux/capi4k-utils-2005-07-18.tar.gz

# tar xzvf capi4k-utils-2005-07-18.tar.gz
# cd capi4k-utils
# make config

here you need to check if the kernel source directory is correct.
when your'e done hit exit and then yes to save the configuration

Now: #make
#make install

Now download a script from http://blog.psuter.ch/uploads/capi.tar.gz
and put the file capi in /sbin
and # chmod 733 /sbin/capi
then run # capi start (OK)
to see if it worked, try capiinfo.

Now put it into your rc.d's so that it will be loaded when your box boots...
# cd /etc/rc.d/rc3.d
# ln -s /sbin/capi S35capi

Now download the chan_capi HEAD version
# wget ftp://ftp.chan-capi.org/chan-capi/chan_capi-HEAD.tgz
unpack and go in chan_capi-HEAD
modify the Makefile to point to your asterisk source
#make
#make install
#make samples
P.S you can have some warning but no problems, it works fine..
Now modify the file /etc/asterisk/modules.conf
# nano /etc/asterisk/modules.conf
Put in the [modules] section:
load => res_features.so
load => chan_capi.so
Put in the [general] section after chan_zap.so
chan_capi.so=yes

modify the file /etc/asterisk/capi.conf
change the context: context=capi-in
to context=from-pstn
(don't change the name of the interface (ex: ISDN1).
# reboot

To use the ISDN dial out make a custom trunk with this dialstring CAPI/ISDN1/$OUTNUM$/B

Good luck.



tischla
Posts: 6
Member Since:
2006-10-03
Re: How-To Fritz!Card Usb 2.0 and 2.X

link to http://blog.psuter.ch/uploads/capi.tar.gz not ok!

could you please post the content of the script

tischla



Babyporch
Posts: 10
Member Since:
2006-09-13
Re: How-To Fritz!Card Usb 2.0 and 2.X

#! /bin/bash
# /etc/rc.d/init.d/capi reps. /etc/init.d/capi -- CAPI device init script
#
# File Version: 2005.02.21
#
# Copyright (c) 2000-2004 Herbert U. Huebner
#
# Permission to use, copy, modify, and distribute this software/file
# for any purpose with or without fee is hereby granted, provided that
# the above copyright notice and this permission notice appear in all
# copies.
#
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# See http://mungo.homelinux.org or http://www.friendglow.net
#
#
# Please, note: CAPI init must start before network init (starts as 10)
# else the network ppp device setup will try to load the
# ISDN HISAX drivers from the isdn4k-utils package instead.
#
# Please sent any changes or additions to
# Herbert U. Huebner
# I try to collect this stuff in order to get a unified
# startup script ready for the community.
# Bluetooth setup is already integrated in the next release,
# it's left out here because the test cycle isn't finished
# for use with kernel 2.6.x
#
# capi Start/Stop the capi 2.0 daemon.
#
# chkconfig: 235 09 82
# description: CAPI is a UNIX program that starts the CAPI 2.0 interface \
# for CAPI compatible devices, like AVM PCI and USB devices, \
# certain Eicon DIVA cards, certain Siemens Gigaset devices, \
# certain Hagenuk external modems, etc..
# processname: capi
# config: /etc/capi.conf
# pidfile: /var/run/capicard.pid

# Check for missing programs
# The regular path is /sbin but other distributions might have it in /usr/sbin
test -x /sbin/capiinit -o -x /usr/sbin/capiinit || exit 5

# Source function library.
if [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
else
. /etc/init.d/functions
fi

RETVAL=0

# Try to work around hotplug/udev issues in kernel 2.6.x
# on several distributions
#
# This fixes the CAPI /dev/ entries that are wrong in
# certain kernel 2.6.x based distributions.
#
# Someone introduced the devices capi20.?? as
# character-major-191
# That is incorrect, char-major-191 is reserved for PCMCIA!
#
# In addition the naming scheme is partial incorrect.
# The device name for the first device is /dev/capi20. Some
# distributions like Fedora Core 3 use the name /dev/capi.
# The child devices are assigned to capi20.??
# - were ?? denotes the number.
# A maximum of 20 additional devices are defined in the kernel
# documentation. udev creates 31 with a wrong name.
# Special in the naming scheme is that child name behind the
# period sign must constist of two digits and the first 10
# devices - 0 to 9 - must have a leading 0.
#
# However, hotplug/udev assigns them to capi0 to capi31 which
# is wrong.

# This adds CAPI dev entries on installations that don't
# install them by default
createcapi()
{
# and to kernel 2.6 based installations. Now the program
# capiinit finds it's correct char-major-68 devices and in
# case of udev ignores the incorrect entries.
#
# We split the process in two parts because of leading zeros
# Variables used:
# C = device counter
# CE = device name extension = capi20.CE
# CN = device node number = 68 CN
#
# This is the controlling device and isn't named .CE
# so we treat it extra.
# /dev/capi20 = mknod -m 660 /dev/capi20 c 68 0
if [ ! -c /dev/capi20 ] >/dev/null 2>&1; then
mknod -m 660 /dev/capi20 c 68 0
fi

# all other devices = mknod -m 660 /dev/capi20.?? c 68 ?
# with variable below = mknod -m 660 /dev/capi20.?? c 68 ?
#
# Don't mess around with the following because it needs special
# arithmetic expressions.
# I.e. computers start calculationg with 0, human beeings with 1
# and bash doesn't like floating numbers out of the box.
#
C=0
CE=0
CC=20
CN=0
while [ $C -lt 20 ]; do
CE=`echo "scale=2; $CC+$C/100" | bc -l`
if [ ! -c /dev/capi$CE ] >/dev/null 2>&1; then
let CN=$C+1
mknod -m 660 /dev/capi$CE c 68 $CN
fi
C=`expr $C + 1`
done
}

# Because udev is slow it takes a while until it's devices show up.
# While we have created our devices with createcapi udev id behind
# and overwrites our /dev/capi20 major device.
# So we need to run it here gain AFTER our device ist initializes!
# Thats's why we give the system a little break for 5 seconds ;-)
capicreate()
{
# Old style
#if [ ! -c /dev/capi20 ] >/dev/null 2>&1; then
# mknod -m 660 /dev/capi20 c 68 0
#fi

# The system takes a little break until udev has changed the assignment again ;-)
sleep 5s
if (ls -l /dev/capi20 | grep '191') >/dev/null 2>&1; then
rm -f /dev/capi20
mknod -m 660 /dev/capi20 c 68 0
fi

}

# See how we were called.
case "$1" in
start)
echo -n "Starting the CAPI 2.0 daemon: "
if [ -f /dev/.udev.tdb ]; then
createcapi
fi
daemon capiinit start
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/capicard
if [ -f /dev/.udev.tdb ]; then
capicreate
fi
;;
stop)
echo -n "Stopping the CAPI 2.0 daemon: "
# udev on kernel 2.6 might have overwritten the original capi20 device
# That's why we need to overwrite the udev entry again
if [ -f /dev/.udev.tdb ]; then
createcapi
fi
daemon capiinit stop
RETVAL=$?
# udev in kernel 2.6 does not allow to remove the kernel module capifs!
# Therefore, in case your CAPI card/adapter needs re-initialized you MUST
# restart your computer.
# Kernel 2.4 didn't have his problem. All kernel CAPI modules have been
# removed with the appropriate rmmod command.
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/capicard
;;
status)
daemon capiinit show
# Just to make sure udev does not bite us.
if [ -f /dev/.udev.tdb ]; then
createcapi
fi
RETVAL=$?
;;
restart)
$0 stop
$0 start
RETVAL=$?
;;
*)
echo "Usage: capi {start|stop|show|restart}"
exit 1
esac

exit $RETVAL



Babyporch
Posts: 10
Member Since:
2006-09-13
Re: How-To Fritz!Card Usb 2.0 and 2.X

I'm using it on Netfinity server with 2 350Mhz processors and one port usb 1.0.
Testing it, i have no audio (or very choppy) when i receive a second call (and an error appears: kcapi ncci 0x10101 not on queue).
If someone is using it, can you post your configuration?
I think can be a problem with the smp kernel or with the usb (1.0) channel!
Thanks.



tischla
Posts: 6
Member Since:
2006-10-03
Re: How-To Fritz!Card Usb 2.0 and 2.X

thank you
works great
tischla



sp00n
Posts: 4
Member Since:
2006-10-12
Re: How-To Fritz!Card Usb 2.0 and 2.X

Hi there.
We're trying to follow your instructions, but we are already receiving an error at the very beginning.

We have downloaded the usb driver and extracted it as in your description, also we have edited the Makefile.
Yet, whenever we try to run the make command, we're receiving the following error(s):

make -C src
make[1]: Entering directory `/usr/src/fritz/src'
make -C /lib/modules/2.6.9-34.0.2.EL/build SUBDIRS=/usr/src/fritz/src modules
make: *** /lib/modules/2.6.9-34.0.2.EL/build: No such file or directory.  Stop.
make: Entering an unknown directorymake: Leaving an unknown directorymake[1]: *** [fcusb2.o] Error 2
make[1]: Leaving directory `/usr/src/fritz/src'
make: *** [src/fcusb2.ko] Error 2

I have no clue what that means, as I have bare to no knowledge of linux at all (despite the basic commands to navigate through the file system).
We have tried the Trixbox 1.2 ISO file as well as Trixbox 1.1 and then updated it via the trixbox-update command. Both times the same error.
I'm quite sure it's just a minor problem and easily solvable, but I just don't know how.

Thanks in advance.



Babyporch
Posts: 10
Member Since:
2006-09-13
Re: How-To Fritz!Card Usb 2.0 and 2.X

you have the latest trixbox and the in the kernel rpm is lost the build directory.
I'm trying to fix it.



tischla
Posts: 6
Member Since:
2006-10-03
Re: How-To Fritz!Card Usb 2.0 and 2.X

I have the same problem (now?).
tischla



sp00n
Posts: 4
Member Since:
2006-10-12
Re: How-To Fritz!Card Usb 2.0 and 2.X

So, we have downgraded to Trixbox 1.1 and it we're beginning to make it work. ;)
We had to download and extract the /include files using the old package asterisk-1.2.12.1.tar.gz, since we weren't able to find them on our trixbox (possibly just didn't search correctly though).
And we encounterd an error with the capi file. Since it is no longer available for download we copy&pasted it into our windows machine and tried to upload the file to the trixbox. Didn't work at first due to DOS/Unix imcompabilities (although I had an option to save as UNIX with UltraEdit). Solved this using Putty and pasting the content of the capi file directly into an empty file.

Anyway, up to this point everything works. We can dial internally, we can make a call to the outside.

BUT the machine crashes with a kernel panic when we are trying to make an outbound call. It doesn't happen always though. Sometimes we can call one number without a problem, then on the next call it crashes, sometimes it crashes on the very first call.
Internal calls work just fine.

I have added the error code below:

Quote:
/usr/src/fritz/src/driver.c:1152: spin_trylock(/usr/src/fritz/src/driver.c:c8ac7484) already locked by /usr/src/fritz/src/driver.c/1207
Kernel panic - not syncing: /usr/src/fritz/src/driver.c:1212: spin_unlock(/usr/src/fritz/src/driver.c:c8ac7484) not locked

And this is the code the error message is referring to in /usr/src/fritz/src/driver.c:
Line 1152:

1146:   static void rx_task (unsigned long arg) {
1147:   	card_p	pdc = capi_card;
1148:   	
1149:   	UNUSED_ARG (arg);
1150:   	if (in_critical ()) {
1151:   		atomic_set (&rx_flag, 1);
1152:   	} else if (spin_trylock (&stack_lock)) {
1153:   		rx_handler (pdc);
1154:   		spin_unlock (&stack_lock);
1155:   	} else {
1156:   		atomic_set (&rx_flag, 1);
1157:   	}
1158:   } /* rx_task */

Line 1207 & 1212:

1207		if (spin_trylock (&stack_lock)) {
1208			os_timer_poll ();
1209			if ((*capi_lib->cm_schedule) ()) {
1210				scheduler_control (TRUE);
1211			}
1212			spin_unlock (&stack_lock);
1213		}

Any ideas?



Babyporch
Posts: 10
Member Since:
2006-09-13
Re: How-To Fritz!Card Usb 2.0 and 2.X

Are you using vmware? If yes this is a tested problem with vmware (for now, no solution).
If you not are using vmware try to recompile the fritz driver, the isdn4k-utils and the chan_capi (i'm using now the 0.7.1 and is working great).

For who are using trixbox 1.2.2 and have some problem to recompile th fritz driver, i have downloaded the kernel-devel rpm from

http://linux.web.psi.ch/dist/scientific/4/kernel/2.6.9-34.0.2.EL/

when downloaded install with rpm -i (i have also used the smp version and everything works fine).
:-)



sp00n
Posts: 4
Member Since:
2006-10-12
Re: How-To Fritz!Card Usb 2.0 and 2.X

No, no vmware used, installed it on a seperate box.
We now have just executed again the commands you have listed in your first posting, but this didn't change anything. The very first outbound call crashed the machine.
What would be the correct way to recompile fritz driver etc? Just reenter the commands as we did, or first uninstall/delete something?

And thank you for your work, we might also try your updated version. Maybe it will work without the problems we currently have.



tischla
Posts: 6
Member Since:
2006-10-03
Re: How-To Fritz!Card Usb 2.0 and 2.X

I have the same problem as sp00n has.
(no vmware)
kernelpanic on outbound calls from x-lite SIP client.
the target line rings and then kernel panic (identical error message)

I installed the kernel-devel from the link you gave us and had installed and compiled everything new.



tischla
Posts: 6
Member Since:
2006-10-03
Re: How-To Fritz!Card Usb 2.0 and 2.X

hi,
by comparing the 64bit version (newer) driver for fritz!card usb I have changed the driver.c a littlebit (without knowing, what I do - I didn't ever program in c nor in linux) and it seems to solve the problem.
I did only do a little testing - mayby you could also try it and report.

driver.c

tischla



Babyporch
Posts: 10
Member Since:
2006-09-13
Re: How-To Fritz!Card Usb 2.0 and 2.X

tischla
Posts: 6
Member Since:
2006-10-03
Re: How-To Fritz!Card Usb 2.0 and 2.X
Quote:
Babyporch wrote:
Try the spin_lock patch from
http://www.trixbox.org/modules/newbb/viewtopic.php?topic_id=5012&...

this doesn't help anything (at my system)



sp00n
Posts: 4
Member Since:
2006-10-12
Re: How-To Fritz!Card Usb 2.0 and 2.X
Quote:
hi,
by comparing the 64bit version (newer) driver for fritz!card usb I have changed the driver.c a littlebit (without knowing, what I do - I didn't ever program in c nor in linux) and it seems to solve the problem.
I did only do a little testing - mayby you could also try it and report.

driver.c

The modified driver.c seems to have done it.
I tried the trylock fix, didn't help (or I wasn't able to perform it correctly).
I replaced the driver.c file with your one and installed the fritz drivers again (make -B and make install) and it seems to work now. No more crashes.
Although sometimes the when making an outbound call now it only rings once for about a second, and then x-lite tells me the line on our side is busy. Happened twice so far, but everything else seems to work fine. :-)



Babyporch
Posts: 10
Member Since:
2006-09-13
Re: How-To Fritz!Card Usb 2.0 and 2.X

Works good (i have the problem on a fresh 12.3 install). Two calls on same time ok.



Fuuu
Posts: 1
Member Since:
2007-01-31
Re: How-To Fritz!Card Usb 2.0 and 2.X

hi,
i have also the same spin_trylock crashes with the driver.c file.
copied your driver.c file but i get many syntax errors when trying to recompile.



MadDogMike
Posts: 22
Member Since:
2006-08-15
How-To Fritz!Card Usb 2.0 and 2.X

Finally!

I eventually got my three golden sevens following these scripts and have finally reached a point of accomplishment that has had me up for weeks glued to my keyboards and mice.

Thank you to Babyporch and everyone in this forum who actively participate!

Without your help I couldn't have done it myself.

I now have:
1 x Asterisk 1.4.4 on a P4 3GHz 1GB
1 x AVM Fritz!Card USB 2.1 on 1 x ISDN BRI
1 x GXV3000
1 x Linksys SPA-3102 and 3 Siemens Gigaset A140s
1 x Aethra Vega X3
1 x Aethra Vega Star Silver E
1 x Aethra Theseus
4 x eyeBeam 1.5.x

And they all sing along very well together now!!

BTW> I love Asterisk, ISDN, Open Source, my dogs, my wife, my sons, my family and my friends! Oh, and lotsa BEER!

Thank you, thank you, thank you all very very much!

PS> Did I remember to say thank you?

--

:-)



Babyporch
Posts: 10
Member Since:
2006-09-13
Thank you MadDogMike, i'm

Thank you MadDogMike, i'm using 2 FritzCrad USB 2.1 and i'm very satisfied.

Now I'm using the latest chan-capi 1.0.1 and in 1 year of use, NO PROBLEMS (no echo, no disconnection, nothing..).

I'm very satisfied with the FritzCard.



-bk-
Posts: 1
Member Since:
2007-10-23
Don't get it to work with TrixBox 2.2.4 CE

Hi Guys,

thanks for your effort on writing this howto. Unfortunately, it doesn't work for me, I get the same make errors as mentioned above, and don't get a solution. Maybe someone has a clue?

Thanks

-b-



vinoCrew84
Posts: 7
Member Since:
2007-10-23
kernel not up-to-date?

Hi!

I'm new to the trixbox. I installed the CE version (2.2.4) successfully.
Did yum -y update and trixbox -update, too.

Now i tried to install a fritz!pci card with the help oft this and other howtos but
i cant't find a kernelmodule which is matching to my kernel.

When i type uname -r, i get the following:

2.6.9-34.9.2.EL

But on the different mirrors which are mentioned here there are only kernelmoduls
from xxx42 above.

How can i update the kernel? yum -y update dosn't update the kernel. Or is there
any other solution?

Thanks!



gabrielke
Posts: 2
Member Since:
2006-07-19
compilation problem

Dear Sirs,

I've tried to compile the driver, and got following problem:

make -C /lib/modules/2.6.18-53.1.4.el5/build SUBDIRS=/root/fritz/src modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-53.1.4.el5-i686'
CC [M] /root/fritz/src/main.o
In file included from /root/fritz/src/main.c:33:
/root/fritz/src/tools.h:74: error: expected identifier or ‘(’ before ‘typeof’
/root/fritz/src/tools.h:74: error: expected ‘)’ before ‘__xchg’
In file included from /root/fritz/src/driver.h:28,
from /root/fritz/src/main.c:35:
include/linux/config.h:6:2: warning: #warning Including config.h is deprecated.
/root/fritz/src/main.c:85: error: unknown field ‘owner’ specified in initializer
/root/fritz/src/main.c:85: warning: initialization from incompatible pointer type
make[2]: *** [/root/fritz/src/main.o] Error 1
make[1]: *** [_module_/root/fritz/src] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.18-53.1.4.el5-i686'
make: *** [fcusb2.o] Error 2

Please help!

Thx,
Akos



gabrielke
Posts: 2
Member Since:
2006-07-19
Fritz USB 2.1 on Asterisk 1.4.22 / trixbox

I've the following card:

Bus 002 Device 003: ID 057c:1900 AVM GmbH ISDN-Controller FRITZ!Card v2.1

Installed in the newest trixbox CE
I've already some experience with mISDN (with other cards) but I wasn't able to start (not even to detect) this card with mISDN. Hence I'm trying every other way.
Please if you could point me to the good direction, do it :)

Thanks,
Akos



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.