- use 'immediate' config in MSN mode, if pbx shall be started on

CONNECT_IND and shall not wait until SETUP/SENDING-COMPLETE was received.
  Since info like REDIRECTINGNUMBER will come after CONNECT_IND, this may
  be lost then. But for some drivers/telcos/pbx, this setting is needed.
This commit is contained in:
MelwareDE 2005-09-26 11:35:13 +00:00
parent b805e5f809
commit acdefd3374
3 changed files with 40 additions and 36 deletions

View File

@ -18,8 +18,8 @@ txgain=0.8
;name not starting with 'g' or 'contr'.
;ntmode=yes ;if isdn card operates in nt mode, set this to yes
isdnmode=msn ;'MSN' (point-to-multipoint) or 'DID' (direct inward dial)
;when using NT-mode, ptp should be set in any case
incomingmsn=* ;allow incoming calls to this list of MSNs/DIDs, * == any
;when using NT-mode, 'DID' should be set in any case
incomingmsn=* ;allow incoming calls to this list of MSNs/DIDs, * = any
;controller=0 ;ISDN4BSD default
;controller=7 ;ISDN4BSD USB default
controller=1 ;capi controller number to use
@ -32,8 +32,11 @@ context=capi-in ;context for incoming calls
holdtype=hold ;when Asterisk puts the call on hold, ISDN HOLD will be used. If
;set to 'local' (default value), no hold is done and Asterisk may
;play MOH.
;immediate=yes ;immediate start of pbx with extension 's' if no digits were
;received on incoming call (no destination number yet)
;immediate=yes ;DID: immediate start of pbx with extension 's' if no digits were
; received on incoming call (no destination number yet)
;MSN: start pbx on CONNECT_IND and don't wait for SETUP/SENDING-COMPLETE.
; info like REDIRECTINGNUMBER may be lost, but this is necessary for
; drivers/pbx/telco which does not send SETUP or SENDING-COMPLETE.
;echosquelch=1 ;_VERY_PRIMITIVE_ echo suppression
;echocancel=yes ;EICON DIVA SERVER (CAPI) echo cancelation
;(possible values: 'no', 'yes', 'force', 'g164', 'g165')

View File

@ -2020,8 +2020,15 @@ static void start_pbx_on_match(struct ast_capi_pvt *i, unsigned int PLCI, _cword
{
_cmsg CMSG2;
if (i->isdnstate & CAPI_ISDN_STATE_PBX) {
cc_ast_verbose(3, 1, VERBOSE_PREFIX_2 "%s: pbx already started on channel %s\n",
i->name, i->owner->name);
return;
}
switch(search_did(i->owner)) {
case 0: /* match */
i->isdnstate |= CAPI_ISDN_STATE_PBX;
ast_setstate(i->owner, AST_STATE_RING);
if (ast_pbx_start(i->owner)) {
ast_log(LOG_ERROR, "%s: Unable to start pbx on channel!\n",
@ -2034,10 +2041,13 @@ static void start_pbx_on_match(struct ast_capi_pvt *i, unsigned int PLCI, _cword
break;
case 1:
/* would possibly match */
break;
if (i->isdnmode == AST_CAPI_ISDNMODE_DID)
break;
/* fall through for MSN mode, because there won't be a longer msn */
case -1:
default:
/* doesn't match */
i->isdnstate |= CAPI_ISDN_STATE_PBX; /* don't try again */
ast_log(LOG_ERROR, "%s: did not find exten for '%s', ignoring call.\n",
i->name, i->dnid);
CONNECT_RESP_HEADER(&CMSG2, ast_capi_ApplID, MessageNumber, 0);
@ -2203,7 +2213,7 @@ static void handle_info_disconnect(_cmsg *CMSG, unsigned int PLCI, unsigned int
static void handle_setup_element(_cmsg *CMSG, unsigned int PLCI, struct ast_capi_pvt *i)
{
if (i->isdnstate & CAPI_ISDN_STATE_SETUP) {
cc_ast_verbose(3, 1, VERBOSE_PREFIX_4 "%s: IE SETUP already received.\n",
cc_ast_verbose(3, 1, VERBOSE_PREFIX_4 "%s: IE SETUP / SENDING-COMPLETE already received.\n",
i->name);
return;
}
@ -3167,6 +3177,10 @@ static void capi_handle_connect_indication(_cmsg *CMSG, unsigned int PLCI, unsig
pbx_builtin_setvar_helper(i->owner, "SECONDCALLERID", buffer);
*/
*interface = i;
if ((i->isdnmode == AST_CAPI_ISDNMODE_MSN) && (i->immediate)) {
/* if we don't want to wait for SETUP/SENDING-COMPLETE in MSN mode */
start_pbx_on_match(i, PLCI, HEADER_MSGNUM(CMSG));
}
return;
}
}
@ -4469,6 +4483,13 @@ static int conf_interface(struct ast_capi_conf *conf, struct ast_variable *v)
var = atoi(v->value); \
continue; \
}
#define CONF_TRUE(var, token, val) \
if (!strcasecmp(v->name, token)) { \
if (ast_true(v->value)) \
var = val; \
continue; \
}
for (; v; v = v->next) {
CONF_INTEGER(conf->devices, "devices");
@ -4478,18 +4499,15 @@ static int conf_interface(struct ast_capi_conf *conf, struct ast_variable *v)
CONF_STRING(conf->deflect2, "deflect");
CONF_STRING(conf->prefix, "prefix");
CONF_STRING(conf->accountcode, "accountcode");
if (!strcasecmp(v->name, "softdtmf")) {
if ((!conf->softdtmf) && (ast_true(v->value))) {
conf->softdtmf = 1;
}
continue;
}
if (!strcasecmp(v->name, "immediate")) {
if (ast_true(v->value)) {
conf->immediate = 1;
}
continue;
}
CONF_TRUE(conf->softdtmf, "relaxdtmf", 2);
if (!strcasecmp(v->name, "holdtype")) {
if (!strcasecmp(v->value, "hold")) {
conf->holdtype = CC_HOLDTYPE_HOLD;
@ -4500,24 +4518,12 @@ static int conf_interface(struct ast_capi_conf *conf, struct ast_variable *v)
}
continue;
}
if (!strcasecmp(v->name, "relaxdtmf")) {
if (ast_true(v->value)) {
conf->softdtmf = 2;
}
continue;
}
if (!strcasecmp(v->name, "echosquelch")) {
if (ast_true(v->value)) {
conf->es = 1;
}
continue;
}
if (!strcasecmp(v->name, "bridge")) {
if (ast_true(v->value)) {
conf->bridge = 1;
}
continue;
}
CONF_TRUE(conf->immediate, "immediate", 1);
CONF_TRUE(conf->es, "echosquelch", 1);
CONF_TRUE(conf->bridge, "bridge", 1);
CONF_TRUE(conf->ntmode, "ntmode", 1);
if (!strcasecmp(v->name, "callgroup")) {
conf->callgroup = ast_get_group(v->value);
continue;
@ -4577,12 +4583,6 @@ static int conf_interface(struct ast_capi_conf *conf, struct ast_variable *v)
}
continue;
}
if (!strcasecmp(v->name, "ntmode")) {
if (ast_true(v->value)) {
conf->ntmode = 1;
}
continue;
}
if (!strcasecmp(v->name, "isdnmode")) {
if (!strcasecmp(v->value, "did"))
conf->isdnmode = AST_CAPI_ISDNMODE_DID;

View File

@ -190,6 +190,7 @@ struct ast_capi_gains {
#define CAPI_ISDN_STATE_PROGRESS 0x0010
#define CAPI_ISDN_STATE_LI 0x0020
#define CAPI_ISDN_STATE_DISCONNECT 0x0040
#define CAPI_ISDN_STATE_PBX 0x8000
/* ! Private data for a capi device */
struct ast_capi_pvt {