From: David Brooks Date: Mon, 3 Aug 2009 16:15:20 +0000 (+0000) Subject: Fixes dialplan wildcard extension taking precedence over call pickup code. X-Git-Tag: 1.4.26.2~4^2~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29f865ad1703c06f88054aaecdd6eca1649911ac;p=thirdparty%2Fasterisk.git Fixes dialplan wildcard extension taking precedence over call pickup code. Prior to this patch, a wildcard extension in the dialplan (for example, _*.) would take precedence over picking up a call in the channel's pickup group. This patch simply moves the block of code handling pickup group matching to above the extension matching code. (closes issue #14735) Reported by: stevedavies Review: https://reviewboard.asterisk.org/r/319/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@210067 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 8252d3f1ba..6f0fb10a1c 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -6264,7 +6264,35 @@ static void *ss_thread(void *data) tone_zone_play_tone(p->subs[index].dfd, -1); else tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_DIALTONE); - if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num) && strcmp(exten, ast_parking_ext())) { + if (!strcmp(exten,ast_pickup_ext())) { + /* Scan all channels and see if there are any + * ringing channels that have call groups + * that equal this channels pickup group + */ + if (index == SUB_REAL) { + /* Switch us from Third call to Call Wait */ + if (p->subs[SUB_THREEWAY].owner) { + /* If you make a threeway call and the *8# a call, it should actually + look like a callwait */ + alloc_sub(p, SUB_CALLWAIT); + swap_subs(p, SUB_CALLWAIT, SUB_THREEWAY); + unalloc_sub(p, SUB_THREEWAY); + } + dahdi_enable_ec(p); + if (ast_pickup_call(chan)) { + ast_log(LOG_DEBUG, "No call pickup possible...\n"); + res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_CONGESTION); + dahdi_wait_event(p->subs[index].dfd); + } + ast_hangup(chan); + goto quit; + } else { + ast_log(LOG_WARNING, "Huh? Got *8# on call not on real\n"); + ast_hangup(chan); + goto quit; + } + + } else if (ast_exists_extension(chan, chan->context, exten, 1, p->cid_num) && strcmp(exten, ast_parking_ext())) { if (!res || !ast_matchmore_extension(chan, chan->context, exten, 1, p->cid_num)) { if (getforward) { /* Record this as the forwarding extension */ @@ -6329,34 +6357,6 @@ static void *ss_thread(void *data) memset(exten, 0, sizeof(exten)); timeout = firstdigittimeout; - } else if (!strcmp(exten,ast_pickup_ext())) { - /* Scan all channels and see if there are any - * ringing channels that have call groups - * that equal this channels pickup group - */ - if (index == SUB_REAL) { - /* Switch us from Third call to Call Wait */ - if (p->subs[SUB_THREEWAY].owner) { - /* If you make a threeway call and the *8# a call, it should actually - look like a callwait */ - alloc_sub(p, SUB_CALLWAIT); - swap_subs(p, SUB_CALLWAIT, SUB_THREEWAY); - unalloc_sub(p, SUB_THREEWAY); - } - dahdi_enable_ec(p); - if (ast_pickup_call(chan)) { - ast_log(LOG_DEBUG, "No call pickup possible...\n"); - res = tone_zone_play_tone(p->subs[index].dfd, DAHDI_TONE_CONGESTION); - dahdi_wait_event(p->subs[index].dfd); - } - ast_hangup(chan); - goto quit; - } else { - ast_log(LOG_WARNING, "Huh? Got *8# on call not on real\n"); - ast_hangup(chan); - goto quit; - } - } else if (!p->hidecallerid && !strcmp(exten, "*67")) { if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3 "Disabling Caller*ID on %s\n", chan->name);