Asterisk CAPI Channels

Asterisk CAPI Channels - drivers for Linux Capi 2.0

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:
For asterisk CVS see here

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.


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 Stocker

Note 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:
Note that when you are implementing two CAPI cards, you must duplicate all of the CAPI information for each channel in capi.conf or the second card will not answer calls.

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.

AVM Fritz!Card (passive)

As of now (2009/2010) it has become difficult to find a working driver for the well spread Fritz!Card (PCI). With fcpci (Gentoo has it in portage), however, a good and reliable solution is available, that by the way also works nicely capi4hylafax. Do not confuse fcpci with fritzcapi.

See also: Asterisk AVM Fritz CAPI Driver Install

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



Asterisk CAPI Channels - drivers for Linux Capi 2.0

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:
For asterisk CVS see here

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.


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 Stocker

Note 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:
Note that when you are implementing two CAPI cards, you must duplicate all of the CAPI information for each channel in capi.conf or the second card will not answer calls.

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.

AVM Fritz!Card (passive)

As of now (2009/2010) it has become difficult to find a working driver for the well spread Fritz!Card (PCI). With fcpci (Gentoo has it in portage), however, a good and reliable solution is available, that by the way also works nicely capi4hylafax. Do not confuse fcpci with fritzcapi.

See also: Asterisk AVM Fritz CAPI Driver Install

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



Created by: oej, Last modification: Wed 03 of Mar, 2010 (01:13 UTC) by JustRumours
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+