Restore call progress code for analog ports.
authorRichard Mudgett <rmudgett@digium.com>
Mon, 5 Dec 2011 17:44:15 +0000 (17:44 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Mon, 5 Dec 2011 17:44:15 +0000 (17:44 +0000)
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
........

Merged revisions 347006 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 347007 from http://svn.asterisk.org/svn/asterisk/branches/10

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@347008 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_dahdi.c
channels/sig_analog.c
channels/sig_analog.h

index aa3c71f..f0ae826 100644 (file)
@@ -3615,7 +3615,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 =
 {
@@ -3683,6 +3694,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. */
index 0035637..edfd0da 100644 (file)
@@ -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")) {
@@ -2744,7 +2753,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)
index 0f1a656..fd19b53 100644 (file)
@@ -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);
 };