Gentoo Wiki


I set up asterisk using Asterisk and then I'd liked to setup a ISDN gateway to the rest of our companys phone network. Therefore I got a "FRITZ!Card pci" from AVM to install a BRI connection to our PBX. Because it wasn't always easy to get the right config i write it down here.


Getting started

Install asterisk using Asterisk.

Install Fritz!Card PCI

in fact asterisk should work with all capi capable isdn adapters. But because I just had a Fritz!Card at hand i write down the example for that Card. The most part should be the same. The important thing is that capi drivers have to exist.

kernel configuration

First enable capi support in kernel. If not enabled rebuild kernel and modules install them and reboot.

Linux Kernel Configuration: (gentoo-sources-2.6.x)
 Device Drivers --->
     ISDN subsystem  --->
     <*> ISDN support
           Old ISDN4Linux  --->
     ---   CAPI subsystem
     <*>   CAPI2.0 support                                 
     [*]     Verbose reason code reporting (kernel size 7K)
     [ ]     CAPI2.0 Middleware support (EXPERIMENTAL)
     <*>     CAPI2.0 /dev/capi support
     ---     CAPI hardware drivers 
             Active AVM cards  --->                                          
             Active Eicon DIVA Server cards  --->

CAPI and Fritz! PCI modules

First select the modules we like to beeing built in make.conf. If you don't do that all modules will be built so it is not really important.

File: /etc/make.conf

rpm2tar would be installed as depency of the fritzcapi-script because fritzcapi is a rpm-paket from suse:

emerge -va fritzcapi

you can now check if the module is available by

modprobe fcpci

I'm not sure if its needed for asterisk but I also installed capi4k-utils

emerge -va capi4k-utils

now we have to edit /etc/capi.conf. Uncomment the line with fcpci at front.

File: /etc/capi.conf
### AVM FritzCard PCI
fcpci           -               -       -       -       -       -

Now we can start the capi initscript. And put it into default runlevel (the kernel modules will be loaded automaticly)

/etc/init.d/capi start
rc-update add capi default

if everything worked till now, the module is loaded and the capi4k-utils are installed you could check the state of the isdncard by the capiinfo command:

meierf2 linux # capiinfo

Number of Controllers : 1
Controller 1:
Manufacturer: AVM GmbH
CAPI Version: 2.0
Manufacturer Version: 3.11-07  (49.23)
Serial Number: 1000001
BChannels: 2
Global Options: 0x00000039
   internal controller supported
   DTMF supported
   Supplementary Services supported
   channel allocation supported (leased lines)
B1 protocols support: 0x4000011f
   64 kbit/s with HDLC framing
   64 kbit/s bit-transparent operation
   V.110 asynconous operation with start/stop byte framing
   V.110 synconous operation with HDLC framing
   T.30 modem for fax group 3
   Modem asyncronous operation with start/stop byte framing
B2 protocols support: 0x00000b1b
   ISO 7776 (X.75 SLP)
   LAPD with Q.921 for D channel X.25 (SAPI 16)
   T.30 for fax group 3
   ISO 7776 (X.75 SLP) with V.42bis compression
   V.120 asyncronous mode
   V.120 bit-transparent mode
B3 protocols support: 0x800000bf
   T.90NL, T.70NL, T.90
   ISO 8208 (X.25 DTE-DTE)
   X.25 DCE
   T.30 for fax group 3
   T.30 for fax group 3 with extensions

  00000000 00000000 00000000 00000000 00000000 00000000
  01000001 00020000 00000000 00000000 00000000

Supplementary services support: 0x000003ff
   Hold / Retrieve
   Terminal Portability
   Call Forwarding
   Call Deflection

configure asterisk

to enable capi support in asterisk we have to install the capi module first

emerge -va asterisk-chan_capi

If the package is masked, don't forget to put it in /etc/portage/package.keywords first.

now we configure that the module I being loaded in /etc/asterisk/modules.conf

File: /etc/asterisk/modules.conf
load =>
load =>

Be sure that /dev/capi20 is read/writeable for the asterisk user. Either chmod /dev/capi20 to 666 or make the asterisk user a member of the capi group

next edit /etc/asterisk/capi.conf. I let it nearly the same as the original

File: /etc/asterisk/capi.conf


; mode: ptmp (point-to-multipoint) or ptp (point-to-point)
; allow incoming calls to this list of MSNs, * == any
; capi controller number
; dialout group
; enable/disable software dtmf detection, recommended for AVM cards
; context for incoming calls
; number of concurrent calls on this controller (2 makes sense for single BRI)
devices => 2

finaly we can add the extensions for calling in and out in /etc/asterisk/extensions.conf. This is a simple configuration with only one MSN (556). When I get more MSN on my port i will see how i can have the correct number diplayed. At the moment my SIP and the PSTN numbers are not synchronized... I will change that later.

Outgoing calls are established with '9' as prefix. Incomming calls are redirected to context "capi-in", that we have configured in /etc/asterisk/capi.conf. The second command adds a '9' in front of the incomming number so we can callback. Then the call is forwarded to SIP/1006.

File: /etc/asterisk/extensions.conf
exten => _9X.,1,SetCIDNum(556)                   ; outgoing MSN
exten => _9X.,2,SetCallerPres(prohib)            ; oder allowed (default) -> (CLIR)
exten => _9X.,3,Dial(Capi/contr1/${EXTEN:1},,)  ; the capi dial command
exten => _9X.,4,Hangup()

exten => 556,1,Answer()
exten => 556,2,SetCIDNum(9${CALLERID})
exten => 556,3,Dial(SIP/1006)
exten => 556,4,Hangup()

now you can restart or reload the asterisk and try out your new gateway.

This HOWTO shows only my first steps in the asterisk world. So if someone knows a better way to accomplish this or has further information please edit this wiki entry.


gentoo 2006.0 (10.08.06)
kernel 2.6.16-gentoo-r7
asterisk-1.0.11_p1 (USE="alsa bri gtk mmx mysql pri speex)

Great HOWTO!
I did as suggested, and got a basic dial plan running in less than 2 houres.
I used:
Gentoo 2006.1
net-misc/asterisk-1.0.11_p1 (USE="alsa gtk mmx")

See also

Retrieved from ""

Last modified: Sun, 07 Sep 2008 00:26:00 +0000 Hits: 8,457