[Asterisk-doc] More input on CAPI: Installation step-by-step

Philipp von Klitzing asterisk-doc@lists.digium.com
Sat, 17 Jan 2004 01:23:27 +0100


*** For the auther of the CAPI section ***

RedHat 7.3 experience:

- server was lacking "capiinit", which is part of the isdn4k-utils rpm 
package. After getting this and the -devel version of the package the 
problem was solved. (isdn4k-utils-3.1-53.i386.rpm, isdn4k-utils-devel-3.1-
53.i386.rpm)

- we used the fcpci-suse8.2-03.11.02.tar.gz file provided by AVM, to be 
used for Kernel 2.4.20-4GB; SUSE 8.2 and other (read the info.txt file 
for installation instructions; after that read compile-help-english.txt 
or compile-help-german.txt)

=== === ===

Taken from Wiki comments at:
http://www.voip-info.org/tiki-
index.php?page=Asterisk%3A+How+to+connect+with+CAPI

* CAPI installation tips for AVM Fritz! PCI and capi_chan

1) Download the PCI AVM drivers from ftp://ftp.avm.de/cardware
You will probably end up with the SUSE 8.2 version since that appears to 
be the latest driver available for non-SUSE distributions
1a) Make sure you have isdn4k-utils (for RedHat: you'll also need the -
devel .rpm) or a similar tool collection that contains "capiinit"
2) Download the Chan_capi from http://www.junghanns.net/asterisk/
3) tar -xvzf fcpci-suse8.0-03.09.10.tar.gz which creates a directory
called "fritz"
3b) read the installation instructions "compile-help-english.txt" and 
modify your non-SUSE kernel accordingly via "make menuconfig" followed by 
make dep, make modules, make modules_install. Note that you must also 
turn on support for _active_ AVM cards while installing this passive 
card. In case of trouble "dmesg" and "cat /proc/dmesg" are your friend, 
i.e. did you correctly insert the ISDN card into the slot?


Only if you experience make problems consider this step:
4) edit the file fritz/src.drv/tools.c and put "//" in front of the
following lines to exclude them :

#include 
#include 
#include 
#include 
//#if LINUX_VERSION_CODE 
//#else
//#include 
//#endif


5) run "make"
6) run "make install"
7) create a file /etc/capi.conf with the following line in it:
fcpci - - - - - -
(6 x 5 "spaces" plus one "-")

>> 7.5) COMMENT: You should stop any isdnutils services and unload any 
hisax or isdn
>> modules at this point

8a) run "lsmod" and do "modprobe capi" if it isn't already present
8b) run "insmod -f fcpci". You will get errors about the version of GCC
but it should still work
9) run "capiinit"
10) run "capiinfo" which should give output showing the card and
supported features.

>> COMMENT: This next bit is apparently unnecessary/no good.
Also forgot to mention that you should make sure that the "isdn" module 
is loaded by doing (we don't need HiSax, so unload it if present):

  modprobe isdn

11) extract using tar -xvzf chan_capi.0.2.2.tar.gz
12) in the chan_capi-0.2.2 directory run "make" and "make install" and
"make config"
13) edit /etc/asterisk/modules.conf and add :

load => chan_capi.so

And in the global section add:

chan_capi.so=yes

14) then start Asterisk
Take a look at /var/log/asterisk/messages

*CLI> capi info
Contr1: 2 B channels total, 2 B channels free.
*CLI>


--capi.conf--

general
nationalprefix=0
internationalprefix=0011
rxgain=0.8
txgain=0.8

interfaces
; which MSN to display to remote user and telco for outgoing calls
msn=277996337
; multiple entries are allowed; the Dial() line must find a matching MSN 
here!
;msn=277996337,277996338,277996339
; on which incoming MSNs should we listen and react on?
incomingmsn=*
;incomingmsn=277996337,277996338
controller=1
softdtmf=1
accountcode=
context=demo
; we have 1 controller with 2 B-channels, thus devices=2
devices=2


--extensions.conf--

exten => 11031976,1,Dial,CAPI/277996337:0526059875,5,tr
exten => 02111947,1,Dial,CAPI/@277996337:0526059875,5,tr

Use @ in front of your outgoing MSN to use CLIR (hide caller ID)
Read more in the capi_chan documentation

Note: Don't forget to load the required modules during startup in 
rc.local, or compile the ISDN subsystem support directly into the kernel

Example for /etc/rc.d/rc.local:

# load ISDN modules for Asterisk use
modprobe isdn
modprobe capi
# Note: 'modprobe capi' also loads kernelcapi, capiutil, capifs
insmod -f fcpci
capiinit start


Useful links:
http://mungo.homelinux.org/ --> help for installing Fritz! with Linux 
distributions other than SUSE
http://www.linuxhilfen.com/ --> good straight installation direction for 
Fritz! with RedHat etc


=== === ===

* Two or more Fritz! cards in one system *

http://www.quiss.org/caiviar/Two-Fritzcards-HOWTO

Introduction

It's possible to use two Fritz cards simultaneously in one computer. 2 
Fritz/PCI Cards are about 3 times cheaper than an AVM C2 Card and both 
have the same number of B-Channels, so this is a good way to save money. 
The kernel driver for Fritz!Cards can easily handle 2 or more of them. 
When doing CAPI, however, you need the AVM Drivers, which need some 
tweaking before they work in "dual mode". The following procedure can 
safely be described as "big hack". However, it works.

Step 1: Preparing the Drivers

The fcpci-suse*.*-*-*-*.tar.gz package on ftp.avm.de/cardware can be used 
to build a module fcpci.o. This module, when inserted into the kernel, 
registers with the kernel capi interface the first Fritz!card found in 
the computer- it's simple to build a second module which loads the 
second.
In the package there's a directory "src.drv". Edit the makefile in that 
one. Insert the following line:
CARD = f2pci

Now copy lib/fcpci-lib.o to lib/f2pci-lib.o and replace all occurences of 
"fcpci" in f2pci-lib.o by "f2pci". (It's a binary file, so be careful)
Replace all occurences of __fcpci__ in src.drv/* by __f2pci__. (quite 
many)
In src.drv/defs.h, replace 
# define PRODUCT_LOGO "AVM FRITZ!Card PCI"
by
# define PRODUCT_LOGO "AVM FRITZ!Card PCI (2nd)"
And
#define SHORT_LOGO "fritz-" INTERFACE
by
#define SHORT_LOGO "fritz2-" INTERFACE