- 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:
parent
91b4ab5a4f
commit
e90739c7e8
64
README
64
README
|
@ -33,7 +33,7 @@ This chan_capi version includes:
|
||||||
- Early B3 connects (always,success,never)
|
- Early B3 connects (always,success,never)
|
||||||
- Digital audio (what did you think?)
|
- Digital audio (what did you think?)
|
||||||
- Incoming/outgoing calls
|
- 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!)
|
- 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
|
- Tuneable latency: you can configure the size of B3 blocks at compile time
|
||||||
(in chan_capi_pvt.h, AST_CAPI_MAX_B3_BLOCK_SIZE)
|
(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)
|
- Eicon CAPI echo cancelation (echocancel=1)
|
||||||
- Reject call waiting (ACO)
|
- Reject call waiting (ACO)
|
||||||
- DID for Point to Point mode (a.k.a overlap receiving)
|
- 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)
|
- Rx/Tx gains (rxgain=1.0)
|
||||||
- Call deflection on circuit busy (deflect=12345678)
|
- Call deflection on circuit busy (deflect=12345678)
|
||||||
- (Inter)national dialing prefix (for callerid) configurable in capi.conf
|
- (Inter)national dialing prefix (for callerid) configurable in capi.conf
|
||||||
- CLI command "capi info" shows B channel status of chan_capi
|
- CLI command "capi info" shows B channel status of chan_capi
|
||||||
- CapiECT will announce the callerID since it gets lost on most isdn pbxes
|
- CapiECT will announce the callerID since it gets lost on most isdn pbxes
|
||||||
The called party can press # to drop the call
|
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=*)
|
- Catch all MSN (incomingmsn=*)
|
||||||
- Some configuration enhancements (msn=123,124,125 and controller=1,2,3,4)
|
- Some configuration enhancements (msn=123,124,125 and controller=1,2,3,4)
|
||||||
- Added accountcode=
|
- Added accountcode=
|
||||||
- Echo squelching (echosquelch=1)
|
- Echo squelching (echosquelch=1)
|
||||||
- Callgroup support
|
- Callgroup support
|
||||||
- Fixed pipe leak
|
- report correct DIALSTATUS and HANGUPCAUSE.
|
||||||
- Updated to support the new frame->delivery field
|
- Updated to support the new frame->delivery field
|
||||||
- Compiles with different Asterisk versions (automatic build configuration)
|
- 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
|
- Added app_capiNoES for disabling the primitive echo suppressor, use this
|
||||||
before you start recording voicemail or your files may get choppy
|
before you start recording voicemail or your files may get choppy
|
||||||
- Added app_capiFax to receive faxes over CAPI (see below)
|
- 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
|
The Dial string
|
||||||
|
===============
|
||||||
It used to be: Dial(CAPI/[@]<outgoingMSN>:[b|B]<destination>)
|
|
||||||
|
Example: Dial(CAPI/g<group>/<destination>[/<params>])
|
||||||
Now it is: Dial(CAPI/g<group>/[b|B]<destination>)
|
Or: Dial(CAPI/contr<controller>/<destination>[/<params>])
|
||||||
Or: Dial(CAPI/contr<controller>/[b|B]<destination>)
|
|
||||||
|
|
||||||
'group' can be a value, comma separated list of values or a range
|
'group' can be a value, comma separated list of values or a range
|
||||||
using '-'. The according interface is found by searching a match with
|
using '-'. The according interface is found by searching a match with
|
||||||
the 'group' specified in the capi.conf for each interface.
|
the 'group' specified in the capi.conf for each interface.
|
||||||
|
|
||||||
CLIP/CLIR now uses the calling presentation of the calling channel, which can
|
'params' is an optional part to set special settings for this call.
|
||||||
be modified using the CallingPres() application. Use CallingPres(32) for CLIR.
|
The string consists of a list of characters with the following meaning:
|
||||||
That is why the msn= param in capi.conf is now obsolete. The callerID is also
|
'b' : early B3 always.
|
||||||
taken from the calling channel.
|
'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
|
Helper applications
|
||||||
===================
|
===================
|
||||||
|
@ -120,28 +123,28 @@ Use the SetCallerPres() application before you dial:
|
||||||
|
|
||||||
Enjoying early B3 connects (inband call progress, tones and announcements)
|
Enjoying early B3 connects (inband call progress, tones and announcements)
|
||||||
==========================================================================
|
==========================================================================
|
||||||
Early B3 is now configurable in the dialstring.
|
Early B3 is configurable in the dialstring parameters.
|
||||||
If you prefix the destination number with a 'b' early B3 will always be used,
|
If you set a 'b', early B3 will always be used, also if the call fails,
|
||||||
also if the call fails, because the number is unprovisioned, etc ...
|
because the number is unprovisioned, etc ...
|
||||||
If you prefix it with a 'B' early B3 will only be used on successful calls,
|
If you set a 'B', early B3 will only be used on successful calls,
|
||||||
giving you ring indication,etc...
|
giving you ring indication,etc...
|
||||||
|
|
||||||
Don't use indications in the Dial command, your local exchange will do that for
|
Don't use indications in the Dial command, your local exchange will do that for
|
||||||
you:
|
you:
|
||||||
exten => _X.,1,Dial(CAPI/contr1/B${EXTEN},30)
|
exten => _X.,1,Dial(CAPI/contr1/${EXTEN}/B,30)
|
||||||
(early B3 on success)
|
(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)
|
(always early B3)
|
||||||
|
|
||||||
exten => _X.,1,Dial(CAPI/contr1/${EXTEN},30,r)
|
exten => _X.,1,Dial(CAPI/contr1/${EXTEN},30,r)
|
||||||
(no early B3, fake ring indication)
|
(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
|
(always early B3, fake indicatons if the exchange does not give us
|
||||||
indications)
|
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
|
(early B3 on success, fake indicatons if the exchange does not give us
|
||||||
indications)
|
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)
|
Overlap sending (a.k.a. real dialtone)
|
||||||
======================================
|
======================================
|
||||||
When you dial an empty number, and have early B3 enabled, with:
|
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
|
The channel will come up at once and give you the dialtone it gets from the
|
||||||
local exchange.
|
local exchange.
|
||||||
At this point the channel is like a legacy phone, now you can send DTMF digits
|
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
|
- fax up to 33600
|
||||||
- high resolution
|
- high resolution
|
||||||
- Color Fax
|
- Color Fax
|
||||||
- JPEG Compression is disabled (I can't test it)
|
- JPEG Compression is disabled (not tested yet)
|
||||||
|
|
||||||
------
|
|
||||||
|
|
||||||
More information/documentation and commercial support can be found at:
|
|
||||||
http://www.junghanns.net/asterisk/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,8 @@ static int capi_change_bchan_fax(struct ast_channel *c)
|
||||||
usleep(10000);
|
usleep(10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: if state != BCONNECTED */
|
||||||
|
|
||||||
SELECT_B_PROTOCOL_REQ_HEADER(&CMSG, ast_capi_ApplID, get_ast_capi_MessageNumber(), 0);
|
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_PLCI(&CMSG) = i->PLCI;
|
||||||
SELECT_B_PROTOCOL_REQ_B1PROTOCOL(&CMSG) = 4;
|
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);
|
LOCAL_USER_ADD(u);
|
||||||
|
|
||||||
if (strcasecmp("CAPI", chan->type) == 0) {
|
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 {
|
|
||||||
ast_log(LOG_WARNING, "capiFax only works on CAPI channels, check your extensions.conf!\n");
|
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;
|
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);
|
LOCAL_USER_REMOVE(u);
|
||||||
|
|
14
capi.conf
14
capi.conf
|
@ -2,13 +2,18 @@
|
||||||
; CAPI config
|
; CAPI config
|
||||||
;
|
;
|
||||||
;
|
;
|
||||||
|
|
||||||
|
; general section
|
||||||
[general]
|
[general]
|
||||||
nationalprefix=0
|
nationalprefix=0
|
||||||
internationalprefix=00
|
internationalprefix=00
|
||||||
rxgain=0.8
|
rxgain=0.8
|
||||||
txgain=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)
|
; mode: ptmp (point-to-multipoint) or ptp (point-to-point)
|
||||||
isdnmode=ptmp
|
isdnmode=ptmp
|
||||||
|
@ -18,6 +23,8 @@ incomingmsn=*
|
||||||
controller=1
|
controller=1
|
||||||
; dialout group
|
; dialout group
|
||||||
group=1
|
group=1
|
||||||
|
; set a prefix to calling number on incoming calls
|
||||||
|
; prefix=0
|
||||||
; enable/disable software dtmf detection, recommended for AVM cards
|
; enable/disable software dtmf detection, recommended for AVM cards
|
||||||
softdtmf=1
|
softdtmf=1
|
||||||
; accountcode to use in CDRs
|
; 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)
|
; number of concurrent calls on this controller (2 makes sense for single BRI)
|
||||||
devices => 2
|
devices => 2
|
||||||
|
|
||||||
|
;[myName]
|
||||||
;PointToPoint (55512-0)
|
;PointToPoint (55512-0)
|
||||||
;isdnmode=ptp
|
;isdnmode=ptp
|
||||||
;msn=55512
|
;incomingmsn=*
|
||||||
;controller=2
|
;controller=2
|
||||||
;devices => 30
|
;devices => 30
|
||||||
|
|
||||||
|
|
1589
chan_capi.c
1589
chan_capi.c
File diff suppressed because it is too large
Load Diff
|
@ -117,6 +117,7 @@ struct ast_capi_gains {
|
||||||
#define PRES_PROHIB_NETWORK_NUMBER 0x23
|
#define PRES_PROHIB_NETWORK_NUMBER 0x23
|
||||||
#define PRES_NUMBER_NOT_AVAILABLE 0x43
|
#define PRES_NUMBER_NOT_AVAILABLE 0x43
|
||||||
|
|
||||||
|
#define CAPI_ISDN_STATE_SETUP_ACK 0x01
|
||||||
|
|
||||||
/* ! Private data for a capi device */
|
/* ! Private data for a capi device */
|
||||||
struct ast_capi_pvt {
|
struct ast_capi_pvt {
|
||||||
|
@ -124,6 +125,8 @@ struct ast_capi_pvt {
|
||||||
int fd;
|
int fd;
|
||||||
int fd2;
|
int fd2;
|
||||||
|
|
||||||
|
char name[AST_CAPI_MAX_STRING];
|
||||||
|
|
||||||
/*! Channel we belong to, possibly NULL */
|
/*! Channel we belong to, possibly NULL */
|
||||||
struct ast_channel *owner;
|
struct ast_channel *owner;
|
||||||
/*! Frame */
|
/*! Frame */
|
||||||
|
@ -147,13 +150,16 @@ struct ast_capi_pvt {
|
||||||
unsigned char rec_buffer[AST_CAPI_MAX_BUF + AST_FRIENDLY_OFFSET];
|
unsigned char rec_buffer[AST_CAPI_MAX_BUF + AST_FRIENDLY_OFFSET];
|
||||||
|
|
||||||
/* current state */
|
/* current state */
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
|
unsigned int isdnstate;
|
||||||
|
|
||||||
char context[AST_MAX_EXTENSION];
|
char context[AST_MAX_EXTENSION];
|
||||||
/*! Multiple Subscriber Number we listen to (, seperated list) */
|
/*! Multiple Subscriber Number we listen to (, seperated list) */
|
||||||
char incomingmsn[AST_CAPI_MAX_STRING];
|
char incomingmsn[AST_CAPI_MAX_STRING];
|
||||||
/*! Prefix to Build CID */
|
/*! Prefix to Build CID */
|
||||||
char prefix[AST_MAX_EXTENSION];
|
char prefix[AST_MAX_EXTENSION];
|
||||||
|
|
||||||
/*! Caller ID if available */
|
/*! Caller ID if available */
|
||||||
char cid[AST_MAX_EXTENSION];
|
char cid[AST_MAX_EXTENSION];
|
||||||
/*! Dialed Number if available */
|
/*! Dialed Number if available */
|
||||||
|
@ -167,6 +173,10 @@ struct ast_capi_pvt {
|
||||||
/*! default language */
|
/*! default language */
|
||||||
char language[MAX_LANGUAGE];
|
char language[MAX_LANGUAGE];
|
||||||
|
|
||||||
|
/* additional numbers to dial */
|
||||||
|
int doOverlap;
|
||||||
|
char overlapdigits[AST_MAX_EXTENSION];
|
||||||
|
|
||||||
int calledPartyIsISDN;
|
int calledPartyIsISDN;
|
||||||
/* this is an outgoing channel */
|
/* this is an outgoing channel */
|
||||||
int outgoing;
|
int outgoing;
|
||||||
|
@ -221,12 +231,10 @@ struct ast_capi_pvt {
|
||||||
unsigned int reason;
|
unsigned int reason;
|
||||||
unsigned int reasonb3;
|
unsigned int reasonb3;
|
||||||
|
|
||||||
struct capi_pipe *mypipe;
|
|
||||||
/*! Next channel in list */
|
/*! Next channel in list */
|
||||||
struct ast_capi_pvt *next;
|
struct ast_capi_pvt *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct ast_capi_profile {
|
struct ast_capi_profile {
|
||||||
unsigned short ncontrollers;
|
unsigned short ncontrollers;
|
||||||
unsigned short nbchannels;
|
unsigned short nbchannels;
|
||||||
|
@ -241,21 +249,25 @@ struct ast_capi_profile {
|
||||||
unsigned int manufacturer[5];
|
unsigned int manufacturer[5];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct capi_pipe {
|
struct ast_capi_conf {
|
||||||
/* lock */
|
char name[AST_CAPI_MAX_STRING];
|
||||||
ast_mutex_t lock;
|
char incomingmsn[AST_CAPI_MAX_STRING];
|
||||||
|
char context[AST_MAX_EXTENSION];
|
||||||
/* fd for writing to the channel */
|
char controllerstr[AST_CAPI_MAX_STRING];
|
||||||
int fd;
|
char prefix[AST_MAX_EXTENSION];
|
||||||
|
char deflect2[AST_MAX_EXTENSION];
|
||||||
/* PLCI of the B3 CON */
|
char accountcode[20];
|
||||||
unsigned int PLCI;
|
int devices;
|
||||||
/* pointer to the interface */
|
int softdtmf;
|
||||||
struct ast_capi_pvt *i;
|
int echocancel;
|
||||||
/* pointer to the channel */
|
int ecoption;
|
||||||
struct ast_channel *c;
|
int ectail;
|
||||||
/* next pipe */
|
int isdnmode;
|
||||||
struct capi_pipe *next;
|
int es;
|
||||||
|
unsigned int callgroup;
|
||||||
|
unsigned int group;
|
||||||
|
float rxgain;
|
||||||
|
float txgain;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ast_capi_controller {
|
struct ast_capi_controller {
|
||||||
|
|
Loading…
Reference in New Issue