- added capicommand(echocancel|on/off) to dynamically en/disable CAPI
echo-chancel.V0_7
parent
0b5ff0dd0f
commit
f1318438d3
15
README
15
README
|
@ -32,16 +32,13 @@ This chan_capi version includes:
|
|||
- Multiple controller support
|
||||
- CID,DNID (callling party, called party)
|
||||
- CLIR/CLIP
|
||||
- Supplementary services, CD,HOLD,RETRIEVE,ECT
|
||||
- Supplementary services: CD (deflect/reroute),HOLD,RETRIEVE,ECT
|
||||
- DTMF (dependend on card) + software DTMF support
|
||||
- Early B3 connects (always,success,never)
|
||||
- Digital audio (what did you think?)
|
||||
- Incoming/outgoing calls
|
||||
- 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.h, AST_CAPI_MAX_B3_BLOCK_SIZE)
|
||||
The default is 160 samples, for non-VoIP use you can tune it down to 130
|
||||
- Use asterisks internal DSP functions for DTMF
|
||||
- Alaw support
|
||||
- Ulaw support!
|
||||
|
@ -51,7 +48,6 @@ This chan_capi version includes:
|
|||
- Rx/Tx gains (rxgain=1.0)
|
||||
- (Inter)national dialing prefix (for callerid) configurable in capi.conf
|
||||
- CLI command "capi info" shows B channel status of chan_capi
|
||||
The called party can press # to drop the call
|
||||
- Catch all MSN (incomingmsn=*)
|
||||
- Some configuration enhancements (msn=123,124,125 and controller=1,2,3,4)
|
||||
- Added accountcode=
|
||||
|
@ -134,6 +130,15 @@ Enable/Disable echosquelch:
|
|||
or
|
||||
exten => s,1,capicommand(echosquelch|no)
|
||||
|
||||
Enable/Disable echocancel:
|
||||
Enable or disable echo-cancel provided by CAPI driver/hardware.
|
||||
You may need to disable echo-cancel when e.g. data/fax transmission handled
|
||||
by non-CAPI application.
|
||||
Example:
|
||||
exten => s,1,capicommand(echocancel|yes)
|
||||
or
|
||||
exten => s,1,capicommand(echocancel|no)
|
||||
|
||||
Malicious Call Identification:
|
||||
Report a call of malicious nature.
|
||||
Example:
|
||||
|
|
42
chan_capi.c
42
chan_capi.c
|
@ -572,6 +572,12 @@ static void capi_echo_canceller(struct ast_channel *c, int function)
|
|||
if ((i->isdnstate & CAPI_ISDN_STATE_DISCONNECT))
|
||||
return;
|
||||
|
||||
if (((function == EC_FUNCTION_ENABLE) && (i->isdnstate & CAPI_ISDN_STATE_EC)) ||
|
||||
((function != EC_FUNCTION_ENABLE) && (!(i->isdnstate & CAPI_ISDN_STATE_EC)))) {
|
||||
/* nothing to do */
|
||||
return;
|
||||
}
|
||||
|
||||
/* If echo cancellation is not requested or supported, don't attempt to enable it */
|
||||
cc_mutex_lock(&contrlock);
|
||||
if (!capi_controllers[i->controller]->echocancel || !i->doEC) {
|
||||
|
@ -601,6 +607,9 @@ static void capi_echo_canceller(struct ast_channel *c, int function)
|
|||
write_capi_word(&buf[4], i->ecOption); /* bit field - ignore echo canceller disable tone */
|
||||
write_capi_word(&buf[6], i->ecTail); /* Tail length, ms */
|
||||
/* buf 8 and 9 are "pre-delay lenght ms" */
|
||||
i->isdnstate |= CAPI_ISDN_STATE_EC;
|
||||
} else {
|
||||
i->isdnstate &= ~CAPI_ISDN_STATE_EC;
|
||||
}
|
||||
|
||||
FACILITY_REQ_FACILITYREQUESTPARAMETER(&CMSG) = (_cstruct)buf;
|
||||
|
@ -4061,6 +4070,32 @@ static int capi_malicious(struct ast_channel *c, char *param)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* set echo cancel
|
||||
*/
|
||||
static int capi_echocancel(struct ast_channel *c, char *param)
|
||||
{
|
||||
struct capi_pvt *i = CC_CHANNEL_PVT(c);
|
||||
|
||||
if (!param) {
|
||||
cc_log(LOG_WARNING, "Parameter for echocancel missing.\n");
|
||||
return -1;
|
||||
}
|
||||
if (ast_true(param)) {
|
||||
i->doEC = 1;
|
||||
capi_echo_canceller(c, EC_FUNCTION_ENABLE);
|
||||
} else if (ast_false(param)) {
|
||||
capi_echo_canceller(c, EC_FUNCTION_DISABLE);
|
||||
i->doEC = 0;
|
||||
} else {
|
||||
cc_log(LOG_WARNING, "Parameter for echocancel invalid.\n");
|
||||
return -1;
|
||||
}
|
||||
cc_verbose(2, 0, VERBOSE_PREFIX_4 "%s: echocancel switched %s\n",
|
||||
i->name, i->doEC ? "ON":"OFF");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* set echo squelch
|
||||
*/
|
||||
|
@ -4080,7 +4115,7 @@ static int capi_echosquelch(struct ast_channel *c, char *param)
|
|||
cc_log(LOG_WARNING, "Parameter for echosquelch invalid.\n");
|
||||
return -1;
|
||||
}
|
||||
cc_verbose(2, 1, VERBOSE_PREFIX_4 "%s: echosquelch switched %s\n",
|
||||
cc_verbose(2, 0, VERBOSE_PREFIX_4 "%s: echosquelch switched %s\n",
|
||||
i->name, i->doES ? "ON":"OFF");
|
||||
return 0;
|
||||
}
|
||||
|
@ -4106,8 +4141,8 @@ static int capi_holdtype(struct ast_channel *c, char *param)
|
|||
cc_log(LOG_WARNING, "Parameter for holdtype invalid.\n");
|
||||
return -1;
|
||||
}
|
||||
cc_verbose(2, 1, VERBOSE_PREFIX_4 "%s: holdtype switched %s\n",
|
||||
i->name, i->doES ? "ON":"OFF");
|
||||
cc_verbose(2, 0, VERBOSE_PREFIX_4 "%s: holdtype switched to %s\n",
|
||||
i->name, param);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -4150,6 +4185,7 @@ static struct capicommands_s {
|
|||
{ "deflect", capi_call_deflect, 1 },
|
||||
{ "receivefax", capi_receive_fax, 1 },
|
||||
{ "echosquelch", capi_echosquelch, 1 },
|
||||
{ "echocancel", capi_echocancel, 1 },
|
||||
{ "malicious", capi_malicious, 1 },
|
||||
{ "hold", capi_hold, 1 },
|
||||
{ "holdtype", capi_holdtype, 1 },
|
||||
|
|
|
@ -219,6 +219,7 @@ struct cc_capi_gains {
|
|||
#define CAPI_ISDN_STATE_B3_CHANGE 0x00000400
|
||||
#define CAPI_ISDN_STATE_RTP 0x00000800
|
||||
#define CAPI_ISDN_STATE_HANGUP 0x00001000
|
||||
#define CAPI_ISDN_STATE_EC 0x00002000
|
||||
#define CAPI_ISDN_STATE_PBX 0x80000000
|
||||
|
||||
#define CAPI_CHANNELTYPE_B 0
|
||||
|
|
Loading…
Reference in New Issue