Asterisk CAPI Channels
Created by: oej,Last modification on Sat 12 of Jul, 2008 [17:41 UTC] by JustRumours
Asterisk CAPI Channels - drivers for Linux Capi 2.0
Page Contents
The Asterisk CAPI channels support ISDN BRI cards - both active and passive - that have CAPI 2.0 support. CAPI channel support is not included in the Asterisk distribution. You can download it here: ftp://ftp.chan-capi.org/chan-capi
For more details and subversion access, see http://www.melware.org/ChanCapi
This new chan-capi version (named chan_capi-cm) is maintained by Cytronics & Melware (Armin Schindler).
With chan_capi-cm 1.0.1 QSIG support was added, even though that support is not yet fully feature complete.
Note: chan_capi-cm has drastically changed the Dial() format to comply with the syntax of most other Asterisk channels!
Note2: Some useful hints for using chan_capi-cm can be found in the README-file included in the package and at the bottom of the Wiki Page CAPI installation and use
Bugs and feature-requests are reported at the Melware Bug Tracker
Older versions (e.g. 0.3.5 and 0.4.pre) can be found here:
- http://www.junghanns.net/asterisk
- Junghann's chan_capi is now part of bristuff , as of version 0.3.0-pre.
If instead of pure CAPI you'd like to use mISDN (kernel 2.6 and newer only) you end up with two options: Since the mISDN structure provides a CAPI interface you can then choose between chan_mISDN or chan_capi.
Status monitor?
It appears as if CAPI as such does not permit a general status monitor of the ISDN channels. That means if you do a "capi info" at the Asterisk CLI you'll also learn how many CAPI channels are used by Asterisk - but you'll not see if an external application (for example Hylafax) has grabbed one or more of your channels. Likewise "capiinfo" issued outside of Asterisk at your shell prompt doesn't provide you with channel status information - under BSD this might be a different story, though!However, AVM has a graphical (KDE) application called "K ISDN Watch" that does exactly that, i.e. monitor CAPI channels. For a server a KDE application is, of course, not the way to go.
So, what remains are trial-and-error methods like using the GROUP() function to count CAPI channels within Asterisk, and then check the variable HANGUPCAUSE after a failed Dial() command to detect if someone else has already grabbed our ISDN B-channel(s).
Open questions
- Are there any comparable command line CAPI tools out there?
- Can we still monitor the ISDN status with either ISDN or HiSax tools and still don't interfere with chan_capi?
Remote CAPI: ISDN over TCP
One interesting use of this technology would be to be able to run Asterisk completely independent from hardware (in a virtual machine for example) while still supporting ISDN connectivity, using cheap, reliable and easy to find ISDN "bridges" (Cisco 801's for example, or an AVM Fritz!Box).Remote CAPI already exists for a specific protocol (Bintec). This protocol is used by rcapid as well, a daemon which exports local CAPI ISDN hardware via TCP using the bintec protocol. With rcapid you can use the ISDN hardware remotely within windows with the 'brickware' (by Funkwerk/Bintec) or from another linux host with the melware modified libcapi20 (ftp://ftp.melware.de).
So you do can have an Asterisk server with chan-capi and the modified libcapi20 connected via TCP to the CAPI server running rcapid. If you want to use that Cisco router as CAPI server instead, then you just might need to extend the libcapi20 to support that protocol as well.
Currently we can find Cisco 801 ISDN Routers on ebay for about 40 euro. This equipment
supports RCAPI (CAPI over TCP) Think of it as a isdn-ethernet adapter. There are other
manufacturers who support this protocol in their ISDN devices. (AVM, Bintec, Draytek)
Howto: Using the S0 (BRI) on Fritz!Box Fon 7050 via remote capi rcapid on Linux (here: OpenSuSE)
Using rcapid compared to AVM-NetCAPI on the Fritz!Box has the advantage that there's a linux client available for it (update: Since Apr 2008 there's also a libcapi20 available for the AVM-NetCAPI, see blow). Please note that since a Fritz!Box only contains a passive ISDN card/controller any G3 fax communication needs be managed by an application (e.g. fax4box, HylaFax, CapiSpFax) - this capability is not provided by the exposed CAPI.In general: Programs that use CAPI on Linux require libcapi for that. That libcapi, in return, routes the calls through the network/LAN (by using the kernel drivers) if capi20.conf exists and has valid configuration data. On the other hand, calls are handled the usual way if that capi20.conf is missing.
Example use case: Asterisk on a Linksys NSLU2 with remote capi and chan_capi terminating through a cheap Fritz!Box 5012. Can be used together with CapiSpFax from a Linux PC.
- German language posting: rcapid on Fritz!Box
- German language posting: faxing from OpenSuSE
- Faxen mit rcapi (german)
- Remote controller not found (german)
Fritz!Box with native NetCAPI and libcap20
Please do not confuse this with the rcapi method as outlined above!- Wiki on how to use the AVM Capi-over-TCP (aka capiovertcp) with Linux, user example
- this approach does not require the installation of rcapid (see above) or any other modification of the Fritz!Box
- can be used together with CapiSpFax from a Linux PC and CUPS and/or GNOME for print-to-fax services.
Background info by Enrik on AVM-NetCAPI: After some playing around, I've finally found out what capiotcp_server is good for. It implements CMTP over TCP. CMTP (Capi Message Transport Protocol) is the protocol that is defined by the bluetooth CIP.
For the sake of completeness here an alternative means to make ISDN calls thru a Fritz!Box with Asterisk (off-topic): Let the Fritz!Box register thru SIP with Asterisk, and arrange a callthrough (Durchwahl) where the Dial() application automatically enters the requested PIN by DTMF. This approach does not require any of the above CAPI magic. :-)
FreeBSD notes
FreeBSD users can use chan_capi along with LibLinuxCapi (compatibility layer for the LINUX CAPI implementation) ports provided by Jan StockerNote on DID, AVM Fritz A1 and fcpci
The driver from AVM for the passive Fritz card only supports PTM (Point-to-Multipoint). This is called "Mehrgeraeteanschluss" in Germany. You cannot use the AVM Fritz A1 card in P2P mode (point-to-point, "Anlagenanschluss" in Germany) where you can use DID.Actually, you can. Simply use use the new mISDN capi layer with chan_capi. However, some people perceived this as an unstable experience with kernel crashes (at beginning of June 2004, code quality for used kernel drivers tend to go up quickly).
On the other hand it makes sense to use an ISDN card based on the HFC chipset instead, since it will provide you with zaptel timing and echo cancelation. A list of these cards can be found at http://isdn.jolly.de/cards.html. For more info, look at zaphfc.
Two FritzCards in the same system
On Linux, it's possible to use more than one Fritz A1 card in the same system, although it requires some tweaking (and compilation of a seperate module for the second card). More information is at:- http://www.quiss.org/caiviar/Two-Fritzcards-HOWTO - kernel 2.4
- http://amatisoft.homelinux.com/atswiki/MultipleFritzPCI - kernel 2.6
Update: It appears that Suse 10.2/10.3 (at least with chan_misdn) and SLES 10.2 SP2 both come with a modified driver that permits to use two FritzCards.
Note on DID, AVM Fritz B1
You can get the the firmware from ftp://ftp.in-berlin.de/pub/capi4linux/firmware/b1/. Place the b1.t4 file in /usr/share/isdn or /usr/lib/isdn. Edit /etc/capi.info to look like this:b1pci b1.t4 DSS1 - - - - P2P
and load the kernel driver for the card with "capiinit start" (do not modprobe the driver). More examples can be found here.
Note on EICON Server BRI/PRI
Most of the Eicon/Dialogic cards have a hardware DSP and therefore implement Fax G3/G4 support directly on the card, which makes these active cards a very good choice for professional fax solutions.Kernel 2.6.10 and up fully supports EICON cards (Enable as modules). Additionally you need firmware and firmware loader:
You can get the firmware from ftp://ftp.melware.net/divas/v2/firmware, just copy files as described in README to /usr/share/eicon
The firmware loader, divactrl can be downloaded from ftp://ftp.melware.net/divas/v2. Load the firmware with "divactrl load -c 1 -f ETSI" (assuming euro isdn as protocol and one card)
Newer version of driver and firmware is provided by Melware's V3 divas driver ftp://ftp.melware.net/divas/v3. See http://www.melware.org/EiconDivaServerV3 for details.
HOW to: A@H with passive ISDN card for newbies?__ (->comment)
A@H provides only "build in" support for the AVM B1 active ISDN card.This card is quite expensive and not frequent offered at e-bay for example.
ISDN phones are widely used in Germany and the European Union.
It would be desirable to have a sort of "build in" support for passive ISDN cards. This is not the case right now.
Asterisk@Home is aiming towards the "Home user" with limited experiences in setting up PC systems specially under Linux and derivates. To add drivers and do recompiling of the kernel plus integrating isdn drivers into A@H is a complex and time consuming issue to most of us newbies.
I am struggeling with ISDN passive support now for some days. Actually I know by now quite a little bit of unix. The time I spent on this is my learning curve and it was worth the time, but still I could not accomplish the the passive isdn card integration into A@H.
A straight forward description, or smart patching tool is very much appreciated.
Does anyone know about such "things" in the web?
- 6 February 2006: There has been an install script for HFC chipset ISDN cards since AAH2.1 install-ZAPHFC (W1zz)
See also
- CAPI installation and use
- Asterisk CAPI Readme
- Asterisk ISDN4Linux
- Asterisk mISDN channels: chan_mISDN
- Asterisk vISDN: For HFC chipsets, doesn't need zaptel nor libpri
- Asterisk channels
- Keywords: ISDN, BRI, PRI, CAPI, MSN, DDI
- Asterisk config files
- Asterisk zaphfc
- Example /etc/capi.conf
- c't magazine on i4l, hisax and mISDN (German language, excellent article)
- Some comments about the difference between Junghanns and Beronet BRI cards.
- Asterisk | FAQ | Introduction | Tips & Tricks

Comments
333Re: CAPI for Teles PCI card?
These were inexpensive cards sold by Telemar (Brazil) for end users (CAPI support for Windows only), just when ISDN became available to brazilian customers.
I tried to find a way to make Teles run on Asterisk, ISDN2H323 and a few other VoIP stuff for Linux, but I quit about three years ago.
By running VoIP applications with Teles cards you'll waste a lot of time trying to compile drivers and even if you're lucky enough to make it work you'll get no audio on both ways.
So, trash Teles and buy any AVM (BT Speedway is only US$5 on Ebay) or HFC card.
333Fritz Passive with A@H and Telstra Australia
I too have had a great deal of problems getting the Fritz Passive Card to work with A@H, if anyone has a set of installation tips that could help please please email it to me.
I am happy to pay for support if anyone can tell me how to get this working.
Thanks Heaps.
email: bruce@itigroup.com.au
333Re: In reply to:
I have the same ISDN card (Teles) how did you do the "magic"... could you send me some info.
Best regards
333CAPI for teles PCI card?
I´m trying to do it, but can´t find any capi drivers fro my teles card, any info? anyone?
333RE: Linux Kernel 2.6.13 and CAPI
i had the same very annoying problem forcing me to use chan_modem :-(
Today I installed chan_capi-cm and changed the syntax of the complete Dial-Commands an - it works again :-)
Christoph
333Linux Kernel 2.6.13 and CAPI
333In reply to: "HOW to: A@H with passive ISDN card for newbies?"
I have my PBX box setup with a Teles S0.PCI isdn card suported by isdn4Linux HISAX driver for dialing PSTN isdn lines.
1-Just need to recompile the kernel to suport isdn4linux that the original ISO CD instalation from asterisk@home instaled on your server.
2-In my case for Teles suport audio need to patch HISAX with the Traverse Technologie voice_2.4_240602.tar
3-Create the normal modem.conf parameters as allready exampled on the file itself and load asterisk
4-Using AMP setup create CUSTOM Trunk with custum dial string with: Modem/g0:$OUTNUM$ and then one Outbound Routing using that trunk meeting the Dial Patterns you want.
Full details for anyone intereested can be posted.
333Re: for a phone, or an ISDN line?
asterisk@home and isdn
333for a phone, or an ISDN line?