]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8588 #resolve [Unreliable digit collection]
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 1 Dec 2015 19:21:34 +0000 (13:21 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 1 Dec 2015 19:21:34 +0000 (13:21 -0600)
src/switch_ivr_async.c
src/switch_ivr_play_say.c

index eaf68ec63692c35e7b72b9584a1ecd66eeef9afe..595ca3517b0666c33a238b48778f3b3a78caff6e 100644 (file)
@@ -79,6 +79,7 @@ struct switch_ivr_dmachine {
        void *user_data;
        switch_mutex_t *mutex;
        switch_status_t last_return;
+       uint8_t pinging;
 };
 
 
@@ -487,6 +488,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *
                return SWITCH_STATUS_SUCCESS;
        }
 
+       if (dmachine->pinging) {
+               printf("doh\n");
+               return SWITCH_STATUS_BREAK;
+       }
+
+       dmachine->pinging = 1;
+
        if (zstr(dmachine->digits) && !is_timeout) {
                r = SWITCH_STATUS_SUCCESS;
        } else if (dmachine->cur_digit_len > dmachine->max_digit_len) {
@@ -579,6 +587,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *
 
        dmachine->last_return = r;
 
+       dmachine->pinging = 0;
+
        switch_mutex_unlock(dmachine->mutex);
 
        return r;
index 968c7d031daf4aa0ee00f54fb6545d59d871e0d4..89325b2c83a945f170406366ff963087b090f09c 100644 (file)
@@ -1490,12 +1490,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                                   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
                                 */
                                if (switch_channel_has_dtmf(channel)) {
+                                       switch_channel_dequeue_dtmf(channel, &dtmf);
+
                                        if (!args->input_callback && !args->buf && !args->dmachine) {
                                                status = SWITCH_STATUS_BREAK;
                                                done = 1;
                                                break;
                                        }
-                                       switch_channel_dequeue_dtmf(channel, &dtmf);
+                                       
 
                                        if (args->dmachine) {
                                                char ds[2] = {dtmf.digit, '\0'};