From eed386bc8d843d01cda4c0ab99382aa3c49f41c5 Mon Sep 17 00:00:00 2001 From: William King Date: Mon, 6 Jul 2015 14:13:12 -0700 Subject: [PATCH] FS-7783 Add channel variable for capturing DTMF input when using play_and_get_digits when the response does not match --- src/switch_ivr_play_say.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index efd0fbaa0e..d03f9d872c 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -2174,14 +2174,21 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t if (!(status == SWITCH_STATUS_TOO_SMALL && strlen(digit_buffer) == 0)) { if (status == SWITCH_STATUS_SUCCESS) { if (!zstr(digit_buffer)) { + char *invalid_var = NULL; if (zstr(digits_regex)) { return SWITCH_STATUS_SUCCESS; } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "Test Regex [%s][%s]\n", digit_buffer, digits_regex); + + invalid_var = switch_mprintf("%s_invalid", var_name); if (switch_regex_match(digit_buffer, digits_regex) == SWITCH_STATUS_SUCCESS) { + switch_channel_set_variable(channel, invalid_var, NULL); + switch_safe_free(invalid_var); return SWITCH_STATUS_SUCCESS; } else { switch_channel_set_variable(channel, var_name, NULL); + switch_channel_set_variable(channel, invalid_var, digit_buffer); + switch_safe_free(invalid_var); } } }