From: Richard Mudgett Date: Mon, 5 Dec 2011 17:39:33 +0000 (+0000) Subject: Restore call progress code for analog ports. X-Git-Tag: 1.8.9.0-rc1~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=202cfa080e7a144af819057390f609e034956134;p=thirdparty%2Fasterisk.git Restore call progress code for analog ports. Extracting sig_analog from chan_dahdi lost call progress detection functionality. * Fix analog ports from considering a call answered immediately after dialing has completed if the callprogress option is enabled. (closes issue ASTERISK-18841) Reported by: Richard Miller Patches: chan_dahdi.diff (license #5685) patch uploaded by Richard Miller (Modified by me) sig_analog.c.diff (license #5685) patch uploaded by Richard Miller (Modified by me) sig_analog.h.diff (license #5685) patch uploaded by Richard Miller git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@347006 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 267a9b963c..808e95ac00 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -3576,7 +3576,18 @@ static void my_handle_notify_message(struct ast_channel *chan, void *pvt, int ci } } +static int my_have_progressdetect(void *pvt) +{ + struct dahdi_pvt *p = pvt; + if ((p->callprogress & CALLPROGRESS_PROGRESS) + && CANPROGRESSDETECT(p) && p->dsp && p->outgoing) { + return 1; + } else { + /* Don't have progress detection. */ + return 0; + } +} static struct analog_callback dahdi_analog_callbacks = { @@ -3644,6 +3655,7 @@ static struct analog_callback dahdi_analog_callbacks = .start_polarityswitch = my_start_polarityswitch, .answer_polarityswitch = my_answer_polarityswitch, .hangup_polarityswitch = my_hangup_polarityswitch, + .have_progressdetect = my_have_progressdetect, }; /*! Round robin search locations. */ diff --git a/channels/sig_analog.c b/channels/sig_analog.c index 93ebec3b69..79f22895bb 100644 --- a/channels/sig_analog.c +++ b/channels/sig_analog.c @@ -200,6 +200,15 @@ static int analog_wait_event(struct analog_pvt *p) return -1; } +static int analog_have_progressdetect(struct analog_pvt *p) +{ + if (p->calls->have_progressdetect) { + return p->calls->have_progressdetect(p->chan_pvt); + } + /* Don't have progress detection. */ + return 0; +} + enum analog_cid_start analog_str_to_cidstart(const char *value) { if (!strcasecmp(value, "ring")) { @@ -2741,7 +2750,9 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_ } } if (ast->_state == AST_STATE_DIALING) { - if (analog_check_confirmanswer(p) || (!p->dialednone + if (analog_have_progressdetect(p)) { + ast_debug(1, "Done dialing, but waiting for progress detection before doing more...\n"); + } else if (analog_check_confirmanswer(p) || (!p->dialednone && ((mysig == ANALOG_SIG_EM) || (mysig == ANALOG_SIG_EM_E1) || (mysig == ANALOG_SIG_EMWINK) || (mysig == ANALOG_SIG_FEATD) || (mysig == ANALOG_SIG_FEATDMF_TA) || (mysig == ANALOG_SIG_FEATDMF) diff --git a/channels/sig_analog.h b/channels/sig_analog.h index 0f1a6563d5..fd19b53528 100644 --- a/channels/sig_analog.h +++ b/channels/sig_analog.h @@ -235,6 +235,7 @@ struct analog_callback { void (* const set_new_owner)(void *pvt, struct ast_channel *new_owner); const char *(* const get_orig_dialstring)(void *pvt); + int (* const have_progressdetect)(void *pvt); };