Friday, November 12, 2004

Linux 2.6 with mISDN stack

ISDN is a telephone network widespread in european countries. Having faster call setup times than tipical PSTN lines makes it ideal for PABX systems. Historically, isdn4linux has been the first ISDN stack for the linux kernel, it has support for several devices but its support is discontinued for Linux 2.6 branch.

mISDN stands for modular ISDN, and of course is the next generation ISDN stack for passive adapters. One of the most disadvantages on using isdn4linux is the lack of a common CAPI 2.0 interface implementation (as of today, capidrv supports a small subset of CAPI 2.0 features). On the other hand, mISDN provides modules that expose a CAPI 2.0 compliant API for any supported adapter card.

The main objective of this tutorial is to setup the CAPI 2.0 support for passive ISDN adapters using the modular ISDN stack. It is assumed that the reader has the knowledge and skills to configure, compile, and install a linux 2.6.x kernel.

0. Prerequisites

# apt-get install build-essential cvs

1. Checkout mISDN sources from cvs

# export CVSROOT=:pserver:guest@cvs.isdn4linux.de/i4ldev
# cvs login
# cvs co mISDN

When prompted for a password enter readonly.

2. Integrate mISDN in your kernel source tree

# cd mISDN
# ln -s <your-kernel-tree-path> /usr/src/linux
# sh < std2kern

3. Configure, build and install the new modules

# cd /usr/src/linux
# make menuconfig

Under Device Drivers -> ISDN subsystem perform the following selections



Then under Modular ISDN driver perform these other selections



Enabling support for all cards is safe since every driver is built as a kernel module. When finished configure, build and istall the kernel as usual.

4. Loading the module

This step is quite important make sure to understand it deeply enough. If you try to load your module directly you'll end up with a failure message, instead you must use a modprobe script.

While on many systems it is sufficient to add the following lines to the file /etc/modprobe.conf, on Debian the preferred way is to create a file in /etc/modprobe.d (name it /etc/modprobe.d/capi) containg these directives (w6692pci is my choice, but you can replace it with any other low-level driver, ie avmfritz, hfcpci, ...):

alias /dev/capi20 w6692pci
alias char-major-68-0 w6692pci

install w6692pci /sbin/modprobe capi; \
/sbin/modprobe mISDN_core; \
/sbin/modprobe mISDN_l1; \
/sbin/modprobe mISDN_l2; \
/sbin/modprobe l3udss1; \
/sbin/modprobe mISDN_capi; \
/sbin/modprobe mISDN_x25dte; \
/sbin/modprobe --ignore-install w6692pci protocol=2

remove w6692pci /sbin/modprobe -r --ignore-remove w6692pci; \
/sbin/modprobe -r mISDN_x25dte; \
/sbin/modprobe -r mISDN_capi; \
/sbin/modprobe -r l3udss1; \
/sbin/modprobe -r mISDN_l2; \
/sbin/modprobe -r mISDN_l1; \
/sbin/modprobe -r mISDN_core; \
/sbin/modprobe -r capi

Now it is possible to load the module issuing a modprobe or by enabling discover at startup.

# modprobe w6692pci

Make sure the driver is correctly loaded, a sample syslog output follows:

Modular ISDN Stack core $Revision: 1.23 $
mISDNd: kernel daemon started
mISDNd: test event done
CAPI Subsystem Rev 1.1.2.8
capifs: Rev 1.1.2.3
capi20: Rev 1.1.2.7: started up with major 68 (middleware+capifs)
ISDN L1 driver version 1.11
ISDN L2 driver version 1.19
mISDN: DSS1 Rev. 1.26
mISDN Capi 2.0 driver file version 1.14
X25 DTE modul version 1.6
Winbond W6692 PCI driver Rev. 1.12
mISDN_w6692: found adapter Dynalink/AsusCom IS64PH at 0000:01:05.0
W6692: Winbond W6692 version (0): W6692 V00
kcapi: Controller 1: mISDN1 attached
w6692: IRQ 17 count 4
kcapi: card 1 "mISDN1" ready.
w6692 1 cards installed

5.1. Install the isdn utilitiles the Debian Sarge way

# apt-get install isdnutils-base libcapi20-3 isdnactivecards

Open the file /etc/isdn/capi.conf and comment out everything (usually passive ISDN cards don't need a firmware).

5.2. Install the isdn utilitiles from source

# cvs co isdn4k-utils
# cd isdn4k-utils/capiinfo
# ./configure
# make
# make install

6. Issue a capiinfo to see the hardware/driver capabilities

# capiinfo

Will output something similar to:

Number of Controllers : 1
Controller 1:
Manufacturer: mISDN CAPI controller W6692_1
CAPI Version: 2.0
Manufacturer Version: 1.0
Serial Number: 0002
[...]

7. Conclusions and future improvements

mISDN support is needed for using chan_capi or chan_misdn (I've only tested the former). Enabling asterisk CAPI support support is quite easy once mISDN modules are properly configured.

See also

Asterisk How to connect with CAPI
chan_capi Home
Asterisk CAPI readme

No comments: