[Freeswitch-svn] [commit] r10398 - freeswitch/trunk/src

FreeSWITCH SVN anthm at freeswitch.org
Fri Nov 14 06:20:11 PST 2008


Author: anthm
Date: Fri Nov 14 09:20:10 2008
New Revision: 10398

Log:
finish fixing MODAPP-166

Modified:
   freeswitch/trunk/src/switch_ivr_play_say.c

Modified: freeswitch/trunk/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_play_say.c	(original)
+++ freeswitch/trunk/src/switch_ivr_play_say.c	Fri Nov 14 09:20:10 2008
@@ -1393,6 +1393,12 @@
 
 	switch_assert(session);
 
+	if (max_digits < min_digits) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
+						  "Max digits %u is less than Min %u, forcing Max to %u\n", max_digits, min_digits, min_digits);
+		max_digits = min_digits;
+	}
+
 	channel = switch_core_session_get_channel(session);
 	switch_channel_set_variable(channel, SWITCH_READ_RESULT_VARIABLE, NULL);
 
@@ -1408,7 +1414,9 @@
 	args.buflen = (uint32_t) digit_buffer_length;
 
 	if (!switch_strlen_zero(prompt_audio_file) && strcasecmp(prompt_audio_file, "silence")) {
-		status = switch_ivr_play_file(session, NULL, prompt_audio_file, &args);
+		if ((status = switch_ivr_play_file(session, NULL, prompt_audio_file, &args)) == SWITCH_STATUS_BREAK) {
+			status = SWITCH_STATUS_SUCCESS;
+		}
 	}
 
 	if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
@@ -1417,7 +1425,6 @@
 
 	len = strlen(digit_buffer);
 
-
 	if ((min_digits && len < min_digits) || len < max_digits) {
 		args.buf = digit_buffer + len;
 		args.buflen = (uint32_t) (digit_buffer_length - len);
@@ -1429,16 +1436,20 @@
 		status = SWITCH_STATUS_TOO_SMALL;
 	}
 
-	if (status == SWITCH_STATUS_SUCCESS) {
+	switch (status) {
+	case SWITCH_STATUS_SUCCESS:
 		switch_channel_set_variable(channel, SWITCH_READ_RESULT_VARIABLE, "success");
-	} else if (status == SWITCH_STATUS_TIMEOUT) {
+		break;
+	case SWITCH_STATUS_TIMEOUT:
 		switch_channel_set_variable(channel, SWITCH_READ_RESULT_VARIABLE, "timeout");
-	} else {
+		break;
+	default:
 		switch_channel_set_variable(channel, SWITCH_READ_RESULT_VARIABLE, "failure");
+		break;
+		
 	}
-
-
-  end:
+	
+ end:
 
 	if (var_name && !switch_strlen_zero(digit_buffer)) {
 		switch_channel_set_variable(channel, var_name, digit_buffer);
@@ -1469,13 +1480,12 @@
 		switch_channel_flush_dtmf(channel);
 		status = switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, NULL, 
 												 digit_buffer, digit_buffer_length, timeout, valid_terminators);
-
 		if (status == SWITCH_STATUS_TIMEOUT && strlen(digit_buffer) >= min_digits) {
 			status = SWITCH_STATUS_SUCCESS;
 		}
 
 		if (status == SWITCH_STATUS_SUCCESS) {
-			if (!switch_strlen_zero((char *)digit_buffer)) {
+			if (!switch_strlen_zero(digit_buffer)) {
 				if (switch_strlen_zero(digits_regex)) {
 					return SWITCH_STATUS_SUCCESS;
 				}
@@ -1493,6 +1503,7 @@
 		max_tries--;
 	}
 
+	memset(digit_buffer, 0, digit_buffer_length);
 	return SWITCH_STATUS_FALSE;
 }
 



More information about the Freeswitch-svn mailing list