diff -Naur asterisk/channels/chan_zap.c asterisk-patched/channels/chan_zap.c --- asterisk/channels/chan_zap.c 2005-06-10 00:34:29.000000000 +0200 +++ asterisk-patched/channels/chan_zap.c 2005-06-15 13:44:24.000000000 +0200 @@ -252,6 +252,7 @@ static int cur_debounce = -1; static int priindication_oob = 0; +static int handleprogresscause = 0; #ifdef ZAPATA_PRI static int minunused = 2; @@ -524,6 +525,7 @@ unsigned int echocanon:1; unsigned int faxhandled:1; /* Has a fax tone already been handled? */ unsigned int firstradio:1; + unsigned int handleprogresscause:1; /* Whether we should handle PROGRESS messages with cause code */ unsigned int hanguponpolarityswitch:1; unsigned int hidecallerid; unsigned int ignoredtmf:1; @@ -6844,6 +6846,7 @@ tmp->restrictcid = restrictcid; tmp->use_callingpres = use_callingpres; tmp->priindication_oob = priindication_oob; + tmp->handleprogresscause = handleprogresscause; tmp->emdigitwait = cur_emdigitwait; if (tmp->usedistinctiveringdetection) { if (!tmp->use_callerid) { @@ -8301,6 +8304,20 @@ #endif struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROGRESS, }; + /* handle cause code 'user busy' (17) in q.931 PROGRESS messages*/ + if (e->proceeding.cause > -1) { + if (option_verbose > 2) + ast_verbose(VERBOSE_PREFIX_3 "PROGRESS with cause code %d receiveded!\n",e->proceeding.cause); + if ( handleprogresscause && (e->proceeding.cause == AST_CAUSE_USER_BUSY)) { + if (pri->pvts[chanpos]->owner) { + if (option_verbose > 2) + ast_verbose(VERBOSE_PREFIX_3 "PROGRESS with 'user busy' received, signaling AST_CONTROL_BUSY instead of AST_CONTROL_PROGRESS\n"); + pri->pvts[chanpos]->owner->hangupcause = e->proceeding.cause; + f.subclass = AST_CONTROL_BUSY; + } + } + } + ast_mutex_lock(&pri->pvts[chanpos]->lock); ast_log(LOG_DEBUG, "Queuing frame from PRI_EVENT_PROGRESS on channel %d/%d span %d\n", pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span); @@ -10280,6 +10297,13 @@ else ast_log(LOG_WARNING, "'%s' is not a valid pri indication value, should be 'inband' or 'outofband' at line %d\n", v->value, v->lineno); + } else if (!strcasecmp(v->name, "handleprogresscause")) { + if (!strcasecmp(v->value, "yes")) + handleprogresscause = 1; + else if (!strcasecmp(v->value, "no")) + handleprogresscause = 0; + else + ast_log(LOG_WARNING, "'%s' is not a valid value for 'handleprogresscause', should be 'yes' or 'no' at line %d\n",v->value, v->lineno); } else if (!strcasecmp(v->name, "internationalprefix")) { ast_copy_string(internationalprefix, v->value, sizeof(internationalprefix)); } else if (!strcasecmp(v->name, "nationalprefix")) { diff -Naur asterisk/configs/zapata.conf.sample asterisk-patched/configs/zapata.conf.sample --- asterisk/configs/zapata.conf.sample 2005-05-12 17:04:55.000000000 +0200 +++ asterisk-patched/configs/zapata.conf.sample 2005-06-15 13:25:24.000000000 +0200 @@ -124,6 +124,15 @@ ; ; priindication = outofband ; +; Handle cause code in PROGRESS message +; Some Telcos send PROGRESS messages with a cause code to signal +; certain line conditions, e.g. user busy. +; Turn this option on to enable busy detection in PROGRESS messages. +; Allowed values: yes/no +; Default = no +; +;handleprogresscause=yes +; ; ISDN Timers ; All of the ISDN timers and counters that are used are configurable. Specify ; the timer name, and its value (in ms for timers)