From f7438a22f7b482ffeaf9c457491c156ecef7aa95 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 5 Jan 2012 13:24:57 -0600 Subject: [PATCH] fix regression from earlier commit --- src/include/switch_ivr.h | 1 + src/switch_ivr_async.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 39ce354e9f..0fb3c83e7f 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -916,6 +916,7 @@ SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid); +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_last_ping(switch_ivr_dmachine_t *dmachine); SWITCH_DECLARE(const char *) switch_ivr_dmachine_get_name(switch_ivr_dmachine_t *dmachine); SWITCH_DECLARE(void) switch_ivr_dmachine_set_match_callback(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_callback_t match_callback); SWITCH_DECLARE(void) switch_ivr_dmachine_set_nonmatch_callback(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_callback_t nonmatch_callback); diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 8958d10813..bea3229df6 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -74,9 +74,15 @@ struct switch_ivr_dmachine { switch_ivr_dmachine_binding_t *last_matching_binding; void *user_data; switch_mutex_t *mutex; + switch_status_t last_return; }; +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_last_ping(switch_ivr_dmachine_t *dmachine) +{ + return dmachine->last_return; +} + SWITCH_DECLARE(switch_digit_action_target_t) switch_ivr_dmachine_get_target(switch_ivr_dmachine_t *dmachine) { switch_assert(dmachine); @@ -507,6 +513,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * switch_ivr_dmachine_clear(dmachine); } + dmachine->last_return = r; + switch_mutex_unlock(dmachine->mutex); return r; @@ -3256,7 +3264,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_se args->buflen = sizeof(state); status = switch_ivr_play_file(session, NULL, file, args); - if (args->dmachine && (switch_ivr_dmachine_get_match(args->dmachine) || switch_ivr_dmachine_get_failed_digits(args->dmachine))) { + if (args->dmachine && switch_ivr_dmachine_last_ping(args->dmachine) != SWITCH_STATUS_SUCCESS) { state.done = 1; goto done; } @@ -3272,7 +3280,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_detect_speech(switch_core_se while (!state.done && switch_channel_ready(channel)) { status = switch_ivr_sleep(session, input_timeout, SWITCH_FALSE, args); - if (args->dmachine && (switch_ivr_dmachine_get_match(args->dmachine) || switch_ivr_dmachine_get_failed_digits(args->dmachine))) { + if (args->dmachine && switch_ivr_dmachine_last_ping(args->dmachine) != SWITCH_STATUS_SUCCESS) { state.done = 1; goto done; }