login | register
Wed 08 of Oct, 2008 [07:28 UTC]

voip-info.org

Discuss [17] History

Asterisk How to connect with CAPI

Created by: stan,Last modification on Wed 11 of Jun, 2008 [22:42 UTC] by adev

Prerequisites


Capi Support in Asterisk is provided through chan_capi, original written by Klaus Peter Junghanns, ongoing development and maintained by Cytronics & Melware. In order to use it you need a capi compliant ISDN card with Linux drivers. These include all the cards by AVM and several others such as the Eicon DIVA cards. Follow the step below to use capi with Asterisk:

Step1

  • Ensure you have CAPI support in your linux kernel.
  • 5/4/05 linux-2.6.11-rc5 breaks chan_capi 0.3.5, see comments for 2 different patches for linux kernels bigger than 2.6.11-rc5
  • please report if any of those patches break or not break chan_capi in kernels smaller than 2.6.11-rc5

For AVM cards type:


 modprobe capi

If this works (you get no feedback) go on to step 2, if you get a message such as "modprobe: Can't locate module capi" then you need to recompile your kernel with capi as a module. In menuconfig select the following under

For Dialogic "Diva" boards (Dialogic was formerly known as Eicon)


Follow the instructions on this page: Eicon diva CAPI
This is much easier than doing the step below and means that after doing this you can go directly to step 3 .





Check if modules divadidd,divas,divacapi are loaded (part of vanilla kernel 2.6, tested with 2.6.10), type:

 lsmod

and you should see the modules. If ok, go on to step 2, otherwise include the required modules into the kernel:

Kernel configuration


Code maturity level options -->

[*] Prompt for development and/or incomplete code/drivers


then select the following in

ISDN Subsystem --> Active ISDN Cards -->:

<M> CAPI2.0 support
[*] Verbose reason code reporting (Kernel size +=7K)
[*] CAPI2.0 Middleware support (EXPERIMENTAL)
<M> CAPI2.0 /dev/capi support
[*] CAPI2.0 filesystem support
<M> CAPI2.0 capidrv interface support


Active cards (e.g. Dialogic "Diva Server") are directly supported,
ISDN Subsystem --> Active ISDN Cards -->Active Eicon DIVA Server cards-->:

* Support Eicon cards
<M> Support Eicon DIVA Server cards
* DIVA Server BRI/PCI support
<M> DIVA CAPI2.0 interface support
<M> DIVA User-IDI interface support
<M> DIVA Maint driver support


and recompile kernel (see here (debian) or here (all distros) for more information).


Step 2



  • You may need firmware in /usr/lib/isdn/ and a suitably configured /etc/capi.conf

(Please add extra pages with instructions for more cards)


Step 3


  • If not already done, download asterisk:

$ export CVSROOT=:pserver:anoncvs@cvs.digium.com:/usr/cvsroot
$ mkdir asterisk_src
$ cd asterisk_src
$ cvs login # password is anoncvs
$ cvs checkout asterisk
$ cd asterisk
$ # edit Makefile, i changed INSTALL_PREFIX to /home/risk/asterisk_bin (to keep an experiemental build separate from another * installation)
$ make
$ make install


Step 4

NOTE: If you are using chan_capi 0.3.5 with asterisk cvs-head (as of November 2004) you need to apply a small patch here for it to work. This patch also enables sending and receiving of faxes with active ISDN cards.

NOTE: If useing Asterisk cvs-head (as of April 2005) you will need the following patch to chan_capi 0.3.5 click here

NOTE: No patches are necessary when using latest package from ftp://ftp.chan-capi.org/chan-capi

  • I tried this on 2005-05-05, and the patch above did not apply cleanly. First of all you have to fix the long lines after cut'n'pasting the patch to a file. The patch program will give up with malformed patch errors on the lines where you have to remove a line break on the line before. Secondly, you have to steal include/asterisk/channel_pvt.h from 1.0.7 and copy it to /usr/include/asterisk/. After this is done, chan_capi 0.3.5 should compile. — RotHorseKid
  • Follow the chan_capi INSTALL file

NOTE: If your build of chan_capi fails because of a missing "capi20.h" just install the corresponding capi-devel (or sometimes isdn4linux-devel or isdn4k-utils-devel for Redhat 9, libcapi20-dev for Debian sarge, capi4k-utils for Slackware 10.2) package for your distribution.
NOTE2 (DK): If you have capi20.h, all include paths correctly entered in the Makefile and you still get a lot of no-sense messages while compiling from the first file (chan_capi.c) then do the following (it sounds crazy but it works!!!):
Change in the Makefile
DEBUG=-g #-pg

to:
DEBUG=-g -pg


The only asterisk configuration files that appear to need changing to start using the CAPI device are "etc/asterisk/modules.conf" as detailed in the INSTALL file, a new "etc/asterisk/capi.conf" as created by "make config" (i didn't change this file to get it working) and "etc/asterisk/extensions.conf" where "TRUNK=CAPI" was inserted in the "globals" section (and other TRUNK assignments commented out)
(beware that the INSTALL file of the 0.3.1 is incomplete. In /etc/asterisk/modules.conf you have to put this two lines:

   load => res_features.so
   load => chan_capi.so

   and in the [global] section:
   chan_capi.so=yes

since callgroup functionality has been introduced. If res_freatures.so is not loaded, asterisk will complain for a "undefined symbol: ast_get_group" when loading chan_capi!)
Note: With an older version of Asterisk, this module is called "res_parking.so".



Trying it out


# capiinit # (required if you are not loading capi at boot time)
# /home/risk/asterisk_bin/usr/sbin/asterisk -vvvgc
...
lots of verbose messages
...
Asterisk Ready.
  • CLI> capi info
Contr1: 2 B channels total, 2 B channels free.


then try ringing the isdn line the system is attached to and you should hear the asterisk congratulations message. Here some example dial statements for version 0.3.6:

 s,1,Dial,CAPI/${MSN}:b${EXTEN}|30     always early B3
 s,1,Dial,CAPI/${MSN}:${EXTEN}|30|r    no early B3, fake ring indication

(Where you should replace ${MSN} with the MSN associated with the channel you want to dial out on, which should be listed on the msn= line in capi.conf.)

== NOTE==

The dial string has changed with the later version of chan_cap. Also the msn= param has been removed from capi.conf. Here is an excerpt from the version 0.6 README file:

"The Dial string

Example: Dial(CAPI/g<group>/<destination>[/<params>])
Or: Dial(CAPI/contr<controller>/<destination>[/<params>])
Or: Dial(CAPI/<interface-name>/<destination>[/<params>])

'group' can be a value, comma separated list of values or a range
using '-'. The according interface is found by searching a match with
the 'group' specified in the capi.conf for each interface.

'params' is an optional part to set special settings for this call.
The string consists of a list of characters with the following meaning:
'b' : early B3 always.
'B' : early B3 on successful calls only.
'o' : use overlap sending of number if number is longer than 2 digits
(This is useful, when further digits shall be send to complete the
destination address).

If the <interface-name> is used in dialstring, be sure the name (specified
in capi.conf) does not start with 'contr' or 'g'."

NOTE:Another thing to be careful of is dialing out while having a ringing (=non-answered) call. To signal incoming calls simultaneously on my mobile and my normal ISDN phone I let my asterisk box dial my mobile while a call is incoming. If the call is not answered on the mobile for some time, my asterisk answering machine comes to action. This worked perfectly without any special dial parameters until I upgraded to chan_capi-cm 0.6.1. From there on every call to my mobile was "hung up" (message in the log) after some seconds and without even ringing my mobile. In hours of work, I figured out, that the recent chan_capi (which is chan_cpi-cm) does not allow early B3 connects while the calling channel is not answered. If you want to dial out while a call is ringing, you have to explicitly set the "r"-option in the dial string, e.g.

Dial (CAPI/ISDN1/<destination numer>,30,r)

NOTE:On some ISDN lines if you use isdnmode=MSN, it is mandatory to also set immediate=yes. This applied to me after changing to the German Telko "Hansenet" aka "Alice". I had strange behaviour with immediate=no: Calls from other customers of my Telko where answered by asterisk, while those from mobiles and others Telkos where silently ignored (in the log you found Incoming call from xxx ... Hangup even if the MSN was defined in capi.conf). This cost me another couple of hours...

NOTE: If you have debian, the "/etc/init.d/asterisk start" script will not load asterisk (but no error message produced). This is because "asterisk" user must first be added to the "dialout" group, so it can access /dev/capi20)

See also





Comments

Comments Filter
222

333some features not available on diva server 1.0 cards

by internex, Thursday 04 of May, 2006 [10:47:56 UTC]
The eicon site seems to indicate that certain features, like CACH are not available on Diva Server 1.0 cards. This is especially important because it includes things such as HOLD, ECT, Conference, Name ID, feature activators, and Message Waiting. - this is as of the latest drivers as of 05/01/2006.
222

333Patch to get working chan_capi-0.3.5 with kernel 2.6.15

by P0L0, Friday 03 of February, 2006 [13:21:07 UTC]
I tried to compile chan_capi-0.3.5 with the patch from April 05, but i got errors in other files. Here is a patch which applies clean and fixes all files. The only thing needed is to copy channel_pvt.h from asterisk-1.0.* to /usr/include/asterisk/

Here is the patch:
http://www.aixtelecom.com/Web/downloads.php#20060131170000

It seems that with a Fritz, it cancels better echo than newer versions. I got it working correctly with asterisk 1.2.4.
222

333solved: chan_capi dial error (everyone is busy)

by fhess, Thursday 11 of August, 2005 [08:54:27 UTC]
I recently had a problem with the latest sourceforge version of chan_capi : i wasn't able to dial, since every call was reporting something like "everyone is busy at this time".

The solution was "only" to set the caller id before dialing :

exten => _1XX,1,SetCallerId(0) (:lol:)
exten => _1XX,2,Dial(CAPI/contr1/b${EXTEN})

If this post could help someone...
Fred.



222

333Dont use the "Junghans.net" version, use the sourceforge version

by nethead, Friday 08 of July, 2005 [12:37:13 UTC]
After several tries of compiling the junghans.net version of chan_capi without success with an current cvs 1-0 version i did run over this updated version on sourceforge which compiled without problems:
http://sourceforge.net/project/showfiles.php?group_id=140312&package_id=155328&release_id=338368
222

333Re: does this also work on kernels smaller than 2.6.11-rc5 - nt

by nitram, Thursday 19 of May, 2005 [00:12:12 UTC]
just fix topic as preview did not show cutting off of smaller sign and kernel version. tiki comments s*ck. :/
222

333does this also work on kernels

by nitram, Thursday 19 of May, 2005 [00:03:42 UTC]
looking at chan_capi 0.4.0-pre1 i edited this chan_capi.c.diff, which fixes the problem for 2.6.12-rc3 and chan_capi 0.3.5 on my box. now i am interested if this patch or the other patch breaks kernels smaller than 2.6.11-rc5. did or can anyone try?

222

333chan_capi für SuSE 9.3

by eggman, Sunday 15 of May, 2005 [13:32:35 UTC]
A compiled version based on the named patch can be found under http://www.eyermann-online.de/asterisk/chan_capi.so
222

333Re: Patch to work on 2.6.11

by sn1, Tuesday 26 of April, 2005 [19:00:06 UTC]
Great, this patch works on 2.6.11.7.

Thanks a lot!
222

333Patch to work on 2.6.11

by irroot, Sunday 06 of March, 2005 [01:20:59 UTC]

+++ chan_capi-0.3.5-greg/chan_capi.c 2005-03-06 02:55:17.000000000 +0200 @@ -687,7 +687,7 @@
           p = malloc(sizeof(struct capi_pipe));
           memset(p, 0, sizeof(struct capi_pipe));
           p->fd = fds1;
- c->fds0 = fds1;
+ c->fds0 = fds0;            p->PLCI = -1;
           p->i = i;
           p->c = c;
222

333Currently Not Working in Linux 2.6.11

by irroot, Saturday 05 of March, 2005 [10:13:27 UTC]
the pipe code in the kernel has changed from RC4 to RC5 and has broken chan_capi.

CAPI messages are not been passed back to asterisk ill look into this and hopefuly patch it in the near future ... for now i have reverted fs/pipe.c to RC4.

(:sad:)