Asterisk CAPI readme

NB: See Asterisk How to connect with CAPI for patches that may be required to work with Asterisk Head

README from the CHAN_CAPI 0.3.5 distribution

This text is based on the README in chan_capi 0.3.5

NOTE: For newer versions of chan_capi, see file README in the chan_capi-cm package, which is available at http://www.chan-capi.org

NOTE: The following old text and links are not valid for newer versions of chan-capi from Cytronics & Melware for http://www.chan-capi.org

(C) 2002, 2003 Junghanns.NET GmbH , Klaus-Peter Junghanns <kpj@junghanns.net>

Thanks go to the debuggers and bugfixers (listed in chronological order) :)


Lele Forzani <lele@windmill.it>
Florian Overkamp <florian@obsimref.com>
Gareth Watts <gareth@omnipotent.net>
Jeff Noxon <jeff@planetfall.com>
Petr Michalek <petr.michalek@aca.cz>
(...and all the others that i forgot..) :-)

chan_capi version 0.3.5 includes:

  • multiple controller support
  • CID,DNID (callling party, called party)
  • CLIR/CLIP
  • supplementary services, CD,HOLD,RETRIEVE,ECT
  • hardware (dependend on card) + software DTMF support
  • early B3 connects (always,success,never)
  • digital audio (what did you think?)
  • incoming/outgoing calls
  • overlap sending (dialtone)
  • E(xplicit) C(all) T(ransfer) (...although it's done implicit .. but dont tell!)
  • tuneable latency ;) you can configure the size of B3 blocks at compile time (in chan_capi_pvt.h, AST_CAPI_MAX_B3_BLOCK_SIZE) the default is 160 samples, for non-VoIP use you can tune it down to 130
  • use asterisk's internal dsp functions for dtmf
  • alaw support
  • ulaw support!
  • Eicon CAPI echo cancelation (echocancel=1)
  • reject call waiting (ACO)
  • DID for Point to Point mode (a.k.a overlap receiving)
  • experimental echo squelching (echosquelch=1)
  • call progress, no need to add ||r to your dialstring anymore
  • rx/tx gains (rxgain=1.0)
  • call deflection on circuitbusy (makefile option) (deflect=12345678)
  • (inter)national dialing prefix (for callerid) configurable in capi.conf
  • CLI command "capi info" shows B channel status
  • capiECT will announce the callerID since it gets lost on most isdn pbxes the called party can press # to drop the call
  • audio syncing (timing outgoing dataB3 on incoming dataB3), supposed to fix the DATA_B3_REQ (error = 0x1103) problem
  • catch all MSN (incomingmsn=*)
  • some configuration enhancements (msn=123,124,125 and controller=1,2,3,4)
  • accountcode= added.
  • finally the echo squelching works!
  • callgroup support
  • fixed pipe leak
  • updated to support the new frame->delivery field
  • compiles with latest cvs with a makefile option (LOOK AT THE MAKEFILE)
  • fixed channel name bug in p2p mode
  • added app_capiNoES for disabling the primitive echo suppressor, use this before you start recording voicemail or your files may get choppy
  • fixed for latest cvs (AST_MUTEX_DEFINE_STATIC)
  • fixed for latest cvs (asterisk/parking.h -> asterisk/features.h)
  • fixed for latest cvs ast_pthread_create

The default codec has now changed from signed linear to alaw/ulaw. This will have a positive effect on performance and might even reduce some echo (latency).


Helper applications

kapejod says: "No No No, dont use those yet....!" (except maybe HOLD, ECT)

  • app_capiCD.c: forwards an unanswered call to another phone (does not rely on sservice CD). Example:
exten => s,1,Wait,1
exten => s,2,capiCD,12345678

  • app_capiHOLD.c: puts an answered call on hold, this has nothing to do with asterisk's onhold thingie (music et al) after putting a call onhold, never use the Wait application!

  • app_capiRETRIEVE.c: gets the holded call back

  • app_capiECT.c: explicit call transfer of the holded call (must put call on hold first!). This example will ECT the call to 50 using 55 as the callerid/outgoing MSN:
exten => s,1,Answer
exten => s,2,capiHOLD
exten => s,3,capiECT,55:50

Using CLIR

in the Dial command put a '@' infront of the msn you want to use for dialing out, e.g.:

exten => s,1,Dial(CAPI/@12345678:${EXTEN},30,r)

Enjoying early B3 connects

Early B3 is now configurable in the dialstring :) If you prefix the destination number with a 'b' early B3 will always be used. Also if the call fails because the number is unprovisioned. If you prefix it with a 'B' early B3 will only be used on successful calls, giving you ring indication.

Don't use indications in the Dial command, your local exchange will do that for you:

exten => s,1,Dial(CAPI/12345678:B${EXTEN},30) (early B3 on success)
exten => s,1,Dial(CAPI/12345678:b${EXTEN},30) (always early B3)
exten => s,1,Dial(CAPI/12345678:${EXTEN},30,r) (no early B3, fake ring indication)

exten => s,1,Dial(CAPI/12345678:b${EXTEN},30,r) (always early B3, fake indicatons if the exchange does not give us indications)
exten => s,1,Dial(CAPI/12345678:B${EXTEN},30,r) (early B3 on success, fake indicatons if the exchange does not give us indications)

You can totally turn B3 off in the Makefile at build time with -DNEVER_EVER_EARLY_B3_CONNECTS.

For normal PBX use you would use the "b" option, always early B3.

Overlap sending (a.k.a. real dialtone)

when you dial an empty number, and have early B3 enabled, with:

Dial(CAPI/12345678:b)

the channel will come up at once and give you the dialtone it gets from the local exchange. At this point the channel is like a legacy phone, now you can send DTMF digits to dial.


More information/documentation and commercial support can be found at:




NB: See Asterisk How to connect with CAPI for patches that may be required to work with Asterisk Head

README from the CHAN_CAPI 0.3.5 distribution

This text is based on the README in chan_capi 0.3.5

NOTE: For newer versions of chan_capi, see file README in the chan_capi-cm package, which is available at http://www.chan-capi.org

NOTE: The following old text and links are not valid for newer versions of chan-capi from Cytronics & Melware for http://www.chan-capi.org

(C) 2002, 2003 Junghanns.NET GmbH , Klaus-Peter Junghanns <kpj@junghanns.net>

Thanks go to the debuggers and bugfixers (listed in chronological order) :)


Lele Forzani <lele@windmill.it>
Florian Overkamp <florian@obsimref.com>
Gareth Watts <gareth@omnipotent.net>
Jeff Noxon <jeff@planetfall.com>
Petr Michalek <petr.michalek@aca.cz>
(...and all the others that i forgot..) :-)

chan_capi version 0.3.5 includes:

  • multiple controller support
  • CID,DNID (callling party, called party)
  • CLIR/CLIP
  • supplementary services, CD,HOLD,RETRIEVE,ECT
  • hardware (dependend on card) + software DTMF support
  • early B3 connects (always,success,never)
  • digital audio (what did you think?)
  • incoming/outgoing calls
  • overlap sending (dialtone)
  • E(xplicit) C(all) T(ransfer) (...although it's done implicit .. but dont tell!)
  • tuneable latency ;) you can configure the size of B3 blocks at compile time (in chan_capi_pvt.h, AST_CAPI_MAX_B3_BLOCK_SIZE) the default is 160 samples, for non-VoIP use you can tune it down to 130
  • use asterisk's internal dsp functions for dtmf
  • alaw support
  • ulaw support!
  • Eicon CAPI echo cancelation (echocancel=1)
  • reject call waiting (ACO)
  • DID for Point to Point mode (a.k.a overlap receiving)
  • experimental echo squelching (echosquelch=1)
  • call progress, no need to add ||r to your dialstring anymore
  • rx/tx gains (rxgain=1.0)
  • call deflection on circuitbusy (makefile option) (deflect=12345678)
  • (inter)national dialing prefix (for callerid) configurable in capi.conf
  • CLI command "capi info" shows B channel status
  • capiECT will announce the callerID since it gets lost on most isdn pbxes the called party can press # to drop the call
  • audio syncing (timing outgoing dataB3 on incoming dataB3), supposed to fix the DATA_B3_REQ (error = 0x1103) problem
  • catch all MSN (incomingmsn=*)
  • some configuration enhancements (msn=123,124,125 and controller=1,2,3,4)
  • accountcode= added.
  • finally the echo squelching works!
  • callgroup support
  • fixed pipe leak
  • updated to support the new frame->delivery field
  • compiles with latest cvs with a makefile option (LOOK AT THE MAKEFILE)
  • fixed channel name bug in p2p mode
  • added app_capiNoES for disabling the primitive echo suppressor, use this before you start recording voicemail or your files may get choppy
  • fixed for latest cvs (AST_MUTEX_DEFINE_STATIC)
  • fixed for latest cvs (asterisk/parking.h -> asterisk/features.h)
  • fixed for latest cvs ast_pthread_create

The default codec has now changed from signed linear to alaw/ulaw. This will have a positive effect on performance and might even reduce some echo (latency).


Helper applications

kapejod says: "No No No, dont use those yet....!" (except maybe HOLD, ECT)

  • app_capiCD.c: forwards an unanswered call to another phone (does not rely on sservice CD). Example:
exten => s,1,Wait,1
exten => s,2,capiCD,12345678

  • app_capiHOLD.c: puts an answered call on hold, this has nothing to do with asterisk's onhold thingie (music et al) after putting a call onhold, never use the Wait application!

  • app_capiRETRIEVE.c: gets the holded call back

  • app_capiECT.c: explicit call transfer of the holded call (must put call on hold first!). This example will ECT the call to 50 using 55 as the callerid/outgoing MSN:
exten => s,1,Answer
exten => s,2,capiHOLD
exten => s,3,capiECT,55:50

Using CLIR

in the Dial command put a '@' infront of the msn you want to use for dialing out, e.g.:

exten => s,1,Dial(CAPI/@12345678:${EXTEN},30,r)

Enjoying early B3 connects

Early B3 is now configurable in the dialstring :) If you prefix the destination number with a 'b' early B3 will always be used. Also if the call fails because the number is unprovisioned. If you prefix it with a 'B' early B3 will only be used on successful calls, giving you ring indication.

Don't use indications in the Dial command, your local exchange will do that for you:

exten => s,1,Dial(CAPI/12345678:B${EXTEN},30) (early B3 on success)
exten => s,1,Dial(CAPI/12345678:b${EXTEN},30) (always early B3)
exten => s,1,Dial(CAPI/12345678:${EXTEN},30,r) (no early B3, fake ring indication)

exten => s,1,Dial(CAPI/12345678:b${EXTEN},30,r) (always early B3, fake indicatons if the exchange does not give us indications)
exten => s,1,Dial(CAPI/12345678:B${EXTEN},30,r) (early B3 on success, fake indicatons if the exchange does not give us indications)

You can totally turn B3 off in the Makefile at build time with -DNEVER_EVER_EARLY_B3_CONNECTS.

For normal PBX use you would use the "b" option, always early B3.

Overlap sending (a.k.a. real dialtone)

when you dial an empty number, and have early B3 enabled, with:

Dial(CAPI/12345678:b)

the channel will come up at once and give you the dialtone it gets from the local exchange. At this point the channel is like a legacy phone, now you can send DTMF digits to dial.


More information/documentation and commercial support can be found at:




Created by: oej, Last modification: Thu 30 of Mar, 2006 (13:56 UTC) by gambistics
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+