Howto get Asterisk with mISDN V2 and Linux Call Router running on debian lenny

March 9th, 2009 by Ralf Schlatterbeck

Update 2009-03-31: provide signed archive with archive key, add udev rules, add /etc/modules entries, add amd64.
Update 2009-04-05: typos fixed

This is a short howto how I built the debian patches and how you can — as a user — install everything needed for mISDN version 2 and Linux Call Router (LCR) with asterisk chan_lcr running on debian lenny.

I’m providing debian packages for Kernel (v, an updated zaptel (debian lenny zaptel doesn’t compile with newer kernels and zaptel wctdm uses some settings for analogue phones that don’t work with german and austrian phone like the “R”-key or optional pulse dialling), finally I’m providing a slightly patched asterisk for larger buffer sizes when playing long tones, LCR and misdnv2user packages originally built by Joerg Dorchain. My misdnv2user is the same as Joergs. The lcr package contains my bug-fix for DTMF digits A-F (also in Joergs packages now) which don’t work in upstream LCR version 1.3 and an updated /etc/init.d/lcr for querying the status of lcr.

I’m also providing source packages, except for the kernel — the kernel is stock configured for use of mISDN. The kernel was built using debians make-kpkg from the kernel-package debian package. And the config used for building the kernel is in the binary package.

I hope I can contribute something in order to get mISDN V2 and LCR into debian… in the meantime others may want to uses these on debian stable.


apt-get install vim less ssh ntp
apt-get install python-dev openbsd-inetd postfix madplay

Add following lines to /etc/apt/sources.list:

deb lenny main
deb-src lenny main

If you want to avoid warnings about an untrusted archive key from apt, you should import the following archive key. Save the key to a file and then issue the command
apt-key add file

Version: GnuPG v1.4.9 (GNU/Linux)


Then install:

apt-get update
apt-get install linux-headers- linux-image- 
    asterisk zaptel lcr zaptel-modules-

If you’re on the amd64 architecture, you should replace i686 in the packages above with amd64.

and optionally (for misdn_info):

apt-get install misdnv2user

Edit /etc/default/asterisk and set RUNASTERISK=yes. Then make several directories (should be done by a future version of the lcr package):

mkdir /var/run/lcr
chown asterisk.asterisk /var/run/lcr
mkdir /var/log/lcr
chown asterisk.asterisk /var/log/lcr

I’ve also made a start-script for lcr (for use as /etc/init.d/lcr) ,
downloadable at
this probably should also be part of the lcr package.

Config file examples used for lcr — these pass
everything to asterisk. File /etc/lcr/interface.conf:

portnum 0

portnum 1

portnum 2

portnum 3

I’m using a Beronet 4 port ISDN card, your config will probably differ: This system only expects incoming calls and needs to check on which line a call comes in. So I distinguish all external interfaces as separate interfaces of LCR. I also need to check an interface by calling out via that interface, you probably would want to make all external ports a trunk by grouping them into one LCR interface.

And the routing config needs to match your interface definition. This config will pass all calls — if asterisk is running — to asterisk. If asterisk isn’t running, I’m calling a test application (untested). The context in asterisk will be the interface name. Again, if you’re using a trunk here, be sure to match the routing config with your interface config. /etc/lcr/routing.conf:

remote=asterisk interface=Ext1 : remote application=asterisk
remote=asterisk interface=Ext2 : remote application=asterisk
remote=asterisk interface=Int1 : remote application=asterisk
remote=asterisk interface=Int2 : remote application=asterisk
default                        : efi

Update /etc/modules to include the following lines (the command appends the lines between cat and EOF):

cat >> /etc/modules << EOF
mISDN_core debug=0x0
mISDN_dsp debug=0x0 options=0x0
hfcmulti debug=0x0

Linux udev must be configured to correctly set the user for the isdn device(s):

cat > /etc/udev/rules.d/91-isdn.rules << EOF
ACTION!="add|change", GOTO="permissions_end"

KERNEL=="mISDN*",       GROUP="dialout"


After a reboot asterisk and lcr should be running.


Getting kernel:


For compilation (zlib isn’t checked by make-kpkg!):

apt-get install kernel-package bzip2 libncurses5-dev zaptel-source 
    zlib1g-dev fakeroot

Compile Kernel:

tar xvf linux-2.6.28.tar.bz2
cd linux-2.6.28
zcat ../patch- | patch -N -p1 | less 2>&1
cp /boot/config- .config
make oldconfig
make menuconfig # just to be sure

For amd64:

make-kpkg --append-to-version -amd64 --revision --us 
    --uc --initrd --rootcmd fakeroot binary > m.out 2> m.err

For i686:

make-kpkg --append-to-version -i686 --revision --us 
    --uc --initrd --rootcmd fakeroot binary > m.out 2> m.err

The following doesn’t seem to work although zaptel is installed:
probably need to unpack /usr/src/zaptel.tar.bz2 into
/usr/src/modules/zaptel (tar file contains modules directory!)
this would save us from the m-a a-i step below. amd64:

make-kpkg --append-to-version -amd64 --revision --us 
    --uc --initrd --rootcmd fakeroot modules > mo.out 2> mo.err
cd ..

For i686:

make-kpkg --append-to-version -i686 --revision --us 
    --uc --initrd --rootcmd fakeroot modules > mo.out 2> mo.err
cd ..

Make a debianized zaptel for new kernel:

apt-get install devscripts libnewt-dev quilt libusb-dev asciidoc
svn checkout zaptel
apt-get source zaptel-source
cp zaptel/kernel/ztdummy.* zaptel-1.4.11~dfsg/kernel
cd zaptel-1.4.11~dfsg
# Add "Fix compilation for newer kernels"
dch -i
cd ..
dpkg -i zaptel-source_1.4.11~dfsg-3.1_all.deb
m-a a-i zaptel

The following installs my patched asterisk, I’m modifying some buffer sizes because I want to play long tones (I’m generating a faked modem guard-tone that is needed in a project). You probably won’t need the patches asterisk, but it won’t hurt to install it. The create-patches script is available from

apt-get install libreadline5-dev libgsm1-dev libssl-dev libtonezone-dev 
    libvpb-dev autotools-dev libsqlite-dev libspeex-dev libspeexdsp-dev 
    graphviz libcurl4-openssl-dev doxygen libpopt-dev libopenh323-dev   
    libiksemel-dev libradiusclient-ng-dev freetds-dev libvorbis-dev     
    libsnmp-dev libc-client2007b-dev libcap2-dev libpq-dev unixodbc-dev 
apt-get source asterisk
scp ralf@bee:checkout/own/config/asterisk/create-patches .
cd asterisk-
sh ../create-patches
# Hunk #1 succeeded at 25 (offset 3 lines).
# Add " local buffer-size patches"
# and new version-number 1:
dch -i # add comment
dpkg-buildpackage -rfakeroot
cd ..

For mISDNuser and chan_lcr I’m using Joerg Dorchains packages with my added patches for DTMF codes A-F.

6 Responses to “Howto get Asterisk with mISDN V2 and Linux Call Router running on debian lenny”

  1. zhu Says:

    i tried openvox card with NT mode, but the port should Layer 1 is down.
    ISDN_TE (port 2: hfc-4s.1-3) TE-mode ptmp use:0 L2 unknown L1 unknown
    ISDN_TE (port 3: hfc-4s.1-4) TE-mode ptmp use:0 L2 unknown L1 inactive
    Int (port 0: hfc-4s.1-1) NT-mode ptp use:0 L2 unknown L1 inactive
    15.05.09 01:57:10.181 –: LCR terminated signal 15
    15.05.09 01:57:10.181 CH: PORT (close) port 1
    15.05.09 01:57:10.181 CH: PORT (close) port 2
    15.05.09 01:57:10.181 CH: PORT (close) port 3
    15.05.09 01:57:10.181 CH: PORT (close) port 0
    15.05.09 01:57:13.026 CH: PORT (open) port 1 mode terminal channels 2
    15.05.09 01:57:13.026 CH: PORT (open) port 2 mode terminal channels 2
    15.05.09 01:57:13.026 CH: DL_ESTABLISH REQUEST U->N port 3 tei 0
    15.05.09 01:57:13.026 CH: PORT (open) port 3 mode terminal channels 2
    15.05.09 01:57:13.026 CH: PORT (open) port 0 mode network channels 2
    15.05.09 01:57:13.026 –: LCR 1.3 started, waiting for calls…

    any idea for that?

  2. Ralf Schlatterbeck Says:

    – I don’t know the openvox card, is it HFC-based (cologne chip)?
    – The Beronet cards work fine for me
    – So maybe you have a cabling problem:
    -> Is the NT-Mode port (0) jumpered to NT, you either need to jumper the
    card to NT-Mode or use an ISDN crossover-cable (which is *NOT* the
    same as an ethernet crossover cable).

  3. jackfritt Says:
    don´t work



  4. Ralf Schlatterbeck Says:

    jackfritt: fixed the links, thanks.

  5. ginolabatta Says:

    chan_lcr sends and detect random dtmf tones on a call!


  6. Ralf Schlatterbeck Says:

    concerning random dtmf tones:
    I’ve never seen chan_lcr *send* random tones. On reception the dtmf detection in chan_lcr isn’t very good. You may want (in newer versions of chan_lcr) to turn it off and use the asterisk dtmf detection instead.