- capi.conf structure changes: one own section for each interface,

no global 'interfaces' any more. Section name will be interface name.
- restructured module loading and init.
- dial string changed: parameters like 'b' no in number any more.
- send alert on alerting only (busy() and congestion() work now).
- better overlap sending (new parameter 'o' for dialstring to
  send only the first two digits with CONNECT_REQ only, the remaining
  digits and even digits following the dial() command, will be send
  as INFO_REQ/Overlap).
This commit is contained in:
MelwareDE 2005-07-17 19:01:14 +00:00
parent 91b4ab5a4f
commit e90739c7e8
5 changed files with 985 additions and 820 deletions

64
README
View File

@ -33,7 +33,7 @@ This chan_capi version includes:
- Early B3 connects (always,success,never)
- Digital audio (what did you think?)
- Incoming/outgoing calls
- Overlap sending (dialtone)
- Overlap sending (dialtone and additional digits)
- E(xplicit) C(all) T(ransfer) (...although it's done implicit-but don't 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)
@ -44,45 +44,48 @@ This chan_capi version includes:
- Eicon CAPI echo cancelation (echocancel=1)
- Reject call waiting (ACO)
- DID for Point to Point mode (a.k.a overlap receiving)
- Call progress, no need to add ||r to your dialstring anymore
- Rx/Tx gains (rxgain=1.0)
- Call deflection on circuit busy (deflect=12345678)
- (Inter)national dialing prefix (for callerid) configurable in capi.conf
- CLI command "capi info" shows B channel status of chan_capi
- 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)
- Added accountcode=
- Echo squelching (echosquelch=1)
- Callgroup support
- Fixed pipe leak
- report correct DIALSTATUS and HANGUPCAUSE.
- Updated to support the new frame->delivery field
- Compiles with different Asterisk versions (automatic build configuration)
- Fixed channel name bug in PtP mode
- Added app_capiNoES for disabling the primitive echo suppressor, use this
before you start recording voicemail or your files may get choppy
- Added app_capiFax to receive faxes over CAPI (see below)
- Fixes for BSD (Jan Stocker)
- ATTENTION! the dialstring syntax now uses the zaptel dialstring syntax
It used to be: Dial(CAPI/[@]<outgoingMSN>:[b|B]<destination>)
Now it is: Dial(CAPI/g<group>/[b|B]<destination>)
Or: Dial(CAPI/contr<controller>/[b|B]<destination>)
The Dial string
===============
Example: Dial(CAPI/g<group>/<destination>[/<params>])
Or: Dial(CAPI/contr<controller>/<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.
CLIP/CLIR now uses the calling presentation of the calling channel, which can
be modified using the CallingPres() application. Use CallingPres(32) for CLIR.
That is why the msn= param in capi.conf is now obsolete. The callerID is also
taken from the calling channel.
'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).
CLIP/CLIR uses the calling presentation of the calling channel, which can
be modified using the SetCallerPres() application. Use
SetCallerPres(prohib_not_screened) for CLIR. That is why the msn= param in
capi.conf has been removed. The callerID is also taken from the calling channel.
- Fixes for BSD (Jan Stocker)
Helper applications
===================
@ -120,28 +123,28 @@ Use the SetCallerPres() application before you dial:
Enjoying early B3 connects (inband call progress, tones and announcements)
==========================================================================
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, etc ...
If you prefix it with a 'B' early B3 will only be used on successful calls,
Early B3 is configurable in the dialstring parameters.
If you set a 'b', early B3 will always be used, also if the call fails,
because the number is unprovisioned, etc ...
If you set a 'B', early B3 will only be used on successful calls,
giving you ring indication,etc...
Don't use indications in the Dial command, your local exchange will do that for
you:
exten => _X.,1,Dial(CAPI/contr1/B${EXTEN},30)
exten => _X.,1,Dial(CAPI/contr1/${EXTEN}/B,30)
(early B3 on success)
exten => _X.,1,Dial(CAPI/contr1/b${EXTEN},30)
exten => _X.,1,Dial(CAPI/contr1/${EXTEN}/b,30)
(always early B3)
exten => _X.,1,Dial(CAPI/contr1/${EXTEN},30,r)
(no early B3, fake ring indication)
exten => _X.,1,Dial(CAPI/contr1/b${EXTEN},30,r)
exten => _X.,1,Dial(CAPI/contr1/${EXTEN}/b,30,r)
(always early B3, fake indicatons if the exchange does not give us
indications)
exten => _X.,1,Dial(CAPI/contr1/B${EXTEN},30,r)
exten => _X.,1,Dial(CAPI/contr1/${EXTEN}/B,30,r)
(early B3 on success, fake indicatons if the exchange does not give us
indications)
@ -150,7 +153,7 @@ For normal PBX usage 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/g1/b)
Dial(CAPI/g1//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
@ -192,12 +195,5 @@ With a DIVA Server, following features are provided:
- fax up to 33600
- high resolution
- Color Fax
- JPEG Compression is disabled (I can't test it)
------
More information/documentation and commercial support can be found at:
http://www.junghanns.net/asterisk/
- JPEG Compression is disabled (not tested yet)

View File

@ -116,6 +116,8 @@ static int capi_change_bchan_fax(struct ast_channel *c)
usleep(10000);
}
/* TODO: if state != BCONNECTED */
SELECT_B_PROTOCOL_REQ_HEADER(&CMSG, ast_capi_ApplID, get_ast_capi_MessageNumber(), 0);
SELECT_B_PROTOCOL_REQ_PLCI(&CMSG) = i->PLCI;
SELECT_B_PROTOCOL_REQ_B1PROTOCOL(&CMSG) = 4;
@ -190,50 +192,54 @@ static int capianswerfax_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
if (strcasecmp("CAPI", chan->type) == 0) {
i->fFax = fopen(vdata, "wb");
if (i->fFax == NULL) {
ast_log(LOG_WARNING, "capiAnswerFax: can't create the output file (%s)\n", strerror(errno));
res = -1;
} else {
i->FaxState = 1;
if (i->state != CAPI_STATE_BCONNECTED) {
capi_answer_fax(chan);
} else {
capi_change_bchan_fax(chan);
}
while (i->FaxState) {
sleep(1);
}
switch (i->reason) {
case 0x3490:
case 0x349f:
res = (i->reasonb3 == 0) ? 0 : -1;
break;
default:
res = -1;
}
/* if the file has zero length */
if (ftell(i->fFax) == 0L)
res = -1;
cc_ast_verbose(2, 1, VERBOSE_PREFIX_3 "Closing fax file...\n");
fclose(i->fFax);
i->fFax = NULL;
if (res != 0) {
cc_ast_verbose(2, 0,
VERBOSE_PREFIX_1 "capiAnswerFax: fax receive failed.\n");
unlink(vdata);
} else {
cc_ast_verbose(2, 0,
VERBOSE_PREFIX_1 "capiAnswerFax: fax received.\n");
}
}
} else {
if (!strcasecmp("CAPI", chan->type) == 0) {
ast_log(LOG_WARNING, "capiFax only works on CAPI channels, check your extensions.conf!\n");
LOCAL_USER_REMOVE(u);
return -1;
}
i->fFax = fopen(vdata, "wb");
if (i->fFax == NULL) {
ast_log(LOG_WARNING, "capiAnswerFax: can't create the output file (%s)\n", strerror(errno));
LOCAL_USER_REMOVE(u);
return -1;
}
i->FaxState = 1;
if (i->state != CAPI_STATE_BCONNECTED) {
capi_answer_fax(chan);
} else {
capi_change_bchan_fax(chan);
}
while (i->FaxState) {
sleep(1);
}
/* if the file has zero length */
if (ftell(i->fFax) == 0L)
res = -1;
cc_ast_verbose(2, 1, VERBOSE_PREFIX_3 "Closing fax file...\n");
fclose(i->fFax);
i->fFax = NULL;
switch (i->reason) {
case 0x3490:
case 0x349f:
res = (i->reasonb3 == 0) ? 0 : -1;
break;
default:
res = -1;
}
if (res != 0) {
cc_ast_verbose(2, 0,
VERBOSE_PREFIX_1 "capiAnswerFax: fax receive failed.\n");
unlink(vdata);
} else {
cc_ast_verbose(2, 0,
VERBOSE_PREFIX_1 "capiAnswerFax: fax received.\n");
}
LOCAL_USER_REMOVE(u);

View File

@ -2,13 +2,18 @@
; CAPI config
;
;
; general section
[general]
nationalprefix=0
internationalprefix=00
rxgain=0.8
txgain=0.8
[interfaces]
; interface sections
; this example interface has name ISDN1
[ISDN1]
; mode: ptmp (point-to-multipoint) or ptp (point-to-point)
isdnmode=ptmp
@ -18,6 +23,8 @@ incomingmsn=*
controller=1
; dialout group
group=1
; set a prefix to calling number on incoming calls
; prefix=0
; enable/disable software dtmf detection, recommended for AVM cards
softdtmf=1
; accountcode to use in CDRs
@ -36,9 +43,10 @@ context=capi-in
; number of concurrent calls on this controller (2 makes sense for single BRI)
devices => 2
;[myName]
;PointToPoint (55512-0)
;isdnmode=ptp
;msn=55512
;incomingmsn=*
;controller=2
;devices => 30

File diff suppressed because it is too large Load Diff

View File

@ -117,6 +117,7 @@ struct ast_capi_gains {
#define PRES_PROHIB_NETWORK_NUMBER 0x23
#define PRES_NUMBER_NOT_AVAILABLE 0x43
#define CAPI_ISDN_STATE_SETUP_ACK 0x01
/* ! Private data for a capi device */
struct ast_capi_pvt {
@ -124,6 +125,8 @@ struct ast_capi_pvt {
int fd;
int fd2;
char name[AST_CAPI_MAX_STRING];
/*! Channel we belong to, possibly NULL */
struct ast_channel *owner;
/*! Frame */
@ -147,13 +150,16 @@ struct ast_capi_pvt {
unsigned char rec_buffer[AST_CAPI_MAX_BUF + AST_FRIENDLY_OFFSET];
/* current state */
int state;
int state;
unsigned int isdnstate;
char context[AST_MAX_EXTENSION];
/*! Multiple Subscriber Number we listen to (, seperated list) */
char incomingmsn[AST_CAPI_MAX_STRING];
/*! Prefix to Build CID */
char prefix[AST_MAX_EXTENSION];
/*! Caller ID if available */
char cid[AST_MAX_EXTENSION];
/*! Dialed Number if available */
@ -167,6 +173,10 @@ struct ast_capi_pvt {
/*! default language */
char language[MAX_LANGUAGE];
/* additional numbers to dial */
int doOverlap;
char overlapdigits[AST_MAX_EXTENSION];
int calledPartyIsISDN;
/* this is an outgoing channel */
int outgoing;
@ -221,12 +231,10 @@ struct ast_capi_pvt {
unsigned int reason;
unsigned int reasonb3;
struct capi_pipe *mypipe;
/*! Next channel in list */
struct ast_capi_pvt *next;
};
struct ast_capi_profile {
unsigned short ncontrollers;
unsigned short nbchannels;
@ -241,21 +249,25 @@ struct ast_capi_profile {
unsigned int manufacturer[5];
};
struct capi_pipe {
/* lock */
ast_mutex_t lock;
/* fd for writing to the channel */
int fd;
/* PLCI of the B3 CON */
unsigned int PLCI;
/* pointer to the interface */
struct ast_capi_pvt *i;
/* pointer to the channel */
struct ast_channel *c;
/* next pipe */
struct capi_pipe *next;
struct ast_capi_conf {
char name[AST_CAPI_MAX_STRING];
char incomingmsn[AST_CAPI_MAX_STRING];
char context[AST_MAX_EXTENSION];
char controllerstr[AST_CAPI_MAX_STRING];
char prefix[AST_MAX_EXTENSION];
char deflect2[AST_MAX_EXTENSION];
char accountcode[20];
int devices;
int softdtmf;
int echocancel;
int ecoption;
int ectail;
int isdnmode;
int es;
unsigned int callgroup;
unsigned int group;
float rxgain;
float txgain;
};
struct ast_capi_controller {