diff --git a/capi.conf b/capi.conf index e5eec46..9b4fa26 100644 --- a/capi.conf +++ b/capi.conf @@ -26,7 +26,9 @@ softdtmf=on ;enable/disable software dtmf detection, recommended for AVM ca relaxdtmf=on ;in addition to softdtmf, you can use relaxed dtmf detection accountcode= ;Asterisk accountcode to use in CDRs context=capi-in ;context for incoming calls -hold=yes ;when Asterisk put on hold, ISDN HOLD shall be used +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) ;echosquelch=1 ;_VERY_PRIMITIVE_ echo suppression diff --git a/chan_capi.c b/chan_capi.c index 0ca4b19..3ddc95f 100644 --- a/chan_capi.c +++ b/chan_capi.c @@ -1160,6 +1160,7 @@ static struct ast_channel *capi_new(struct ast_capi_pvt *i, int state) i->doES = i->ES; i->outgoing = 0; i->onholdPLCI = 0; + i->doholdtype = i->holdtype; i->B3q = 0; ast_mutex_init(&i->lockB3q); memset(i->txavg, 0, ECHO_TX_COUNT); @@ -3174,6 +3175,7 @@ static int capi_hold(struct ast_channel *c, char *param) char buffer[16]; char fac[4]; +#warning TODO: support holdtype notify if (i->isdnstate & CAPI_ISDN_STATE_HOLD) { ast_log(LOG_NOTICE,"%s: %s already on hold.\n", i->name, c->name); @@ -3435,14 +3437,14 @@ static int capi_indicate(struct ast_channel *c, int condition) case AST_CONTROL_HOLD: cc_ast_verbose(3, 1, VERBOSE_PREFIX_2 "%s: Requested HOLD-Indication for %s\n", i->name, c->name); - if (i->hold) { + if (i->doholdtype != CC_HOLDTYPE_LOCAL) { ret = capi_hold(c, NULL); } break; case AST_CONTROL_UNHOLD: cc_ast_verbose(3, 1, VERBOSE_PREFIX_2 "%s: Requested UNHOLD-Indication for %s\n", i->name, c->name); - if (i->hold) { + if (i->doholdtype != CC_HOLDTYPE_LOCAL) { ret = capi_retrieve(c, NULL); } break; @@ -3655,7 +3657,7 @@ int mkif(struct ast_capi_conf *conf) tmp->callgroup = conf->callgroup; tmp->group = conf->group; tmp->immediate = conf->immediate; - tmp->hold = conf->hold; + tmp->holdtype = conf->holdtype; tmp->smoother = ast_smoother_new(AST_CAPI_MAX_B3_BLOCK_SIZE); @@ -4025,9 +4027,13 @@ static int conf_interface(struct ast_capi_conf *conf, struct ast_variable *v) } continue; } - if (!strcasecmp(v->name, "hold")) { - if (ast_true(v->value)) { - conf->hold = 1; + if (!strcasecmp(v->name, "holdtype")) { + if (!strcasecmp(v->value, "hold")) { + conf->holdtype = CC_HOLDTYPE_HOLD; + } else if (!strcasecmp(v->value, "notify")) { + conf->holdtype = CC_HOLDTYPE_NOTIFY; + } else { + conf->holdtype = CC_HOLDTYPE_LOCAL; } continue; } diff --git a/chan_capi.h b/chan_capi.h index 81ba214..2019640 100644 --- a/chan_capi.h +++ b/chan_capi.h @@ -129,6 +129,10 @@ typedef struct fax3proto3 { #define FACILITYSELECTOR_SUPPLEMENTARY 3 #define FACILITYSELECTOR_ECHO_CANCEL 6 +#define CC_HOLDTYPE_LOCAL 0 +#define CC_HOLDTYPE_HOLD 1 +#define CC_HOLDTYPE_NOTIFY 2 + /* * state combination for a normal incoming call: * DIS -> ALERT -> CON -> BCON -> CON -> DIS @@ -246,8 +250,9 @@ struct ast_capi_pvt { int isdnmode; /* Answer before getting digits? */ int immediate; - /* Use ISDN HOLD */ - int hold; + /* which holdtype */ + int holdtype; + int doholdtype; /* Common ISDN Profile (CIP) */ int cip; @@ -319,7 +324,7 @@ struct ast_capi_conf { int ectail; int isdnmode; int immediate; - int hold; + int holdtype; int es; unsigned int callgroup; unsigned int group;