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

Freeswitch SVN brian at freeswitch.org
Tue Sep 2 06:39:39 EDT 2008


Author: brian
Date: Tue Sep  2 06:39:39 2008
New Revision: 9402

Modified:
   freeswitch/trunk/src/switch_ivr.c
   freeswitch/trunk/src/switch_ivr_play_say.c

Log:
comment cleanup and such

Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c	(original)
+++ freeswitch/trunk/src/switch_ivr.c	Tue Sep  2 06:39:39 2008
@@ -1160,7 +1160,7 @@
 	if (parser != NULL) {
 		int pool_auto_created = 0;
 
-		// if the caller didn't provide a pool, make one
+		/* if the caller didn't provide a pool, make one */
 		if (pool == NULL) {
 			switch_core_new_memory_pool(&pool);
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "created a memory pool\n");
@@ -1168,11 +1168,11 @@
 				pool_auto_created = 1;
 			}
 		}
-		// if we have a pool, make a parser object
+		/* if we have a pool, make a parser object */
 		if (pool != NULL) {
 			*parser = (switch_ivr_digit_stream_parser_t *) switch_core_alloc(pool, sizeof(switch_ivr_digit_stream_parser_t));
 		}
-		// if we have parser object, initialize it for the caller
+		/* if we have parser object, initialize it for the caller */
 		if (pool && *parser != NULL) {
 			memset(*parser, 0, sizeof(switch_ivr_digit_stream_parser_t));
 			(*parser)->pool_auto_created = pool_auto_created;
@@ -1183,7 +1183,7 @@
 			status = SWITCH_STATUS_SUCCESS;
 		} else {
 			status = SWITCH_STATUS_MEMERR;
-			// if we can't create a parser object,clean up the pool if we created it
+			/* if we can't create a parser object,clean up the pool if we created it */
 			if (pool != NULL && pool_auto_created) {
 				switch_core_destroy_memory_pool(&pool);
 			}
@@ -1202,7 +1202,7 @@
 			switch_core_hash_destroy(&parser->hash);
 			parser->hash = NULL;
 		}
-		// free the memory pool if we created it
+		/* free the memory pool if we created it */
 		if (parser->pool_auto_created && parser->pool != NULL) {
 			status = switch_core_destroy_memory_pool(&parser->pool);
 		}
@@ -1215,7 +1215,7 @@
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
-	// if we have a paser object memory pool and a stream object pointer that is null
+	/* if we have a paser object memory pool and a stream object pointer that is null */
 	if (parser != NULL && parser->pool && stream != NULL && *stream == NULL) {
 		*stream = (switch_ivr_digit_stream_t *) switch_core_alloc(parser->pool, sizeof(switch_ivr_digit_stream_t));
 		if (*stream != NULL) {
@@ -1250,9 +1250,10 @@
 		if (status == SWITCH_STATUS_SUCCESS) {
 			switch_size_t len = strlen(digits);
 
-			// if we don't have a terminator, then we have to try and
-			// figure out when a digit set is completed, therefore we
-			// keep track of the min and max digit lengths
+			/* if we don't have a terminator, then we have to try and
+			 * figure out when a digit set is completed, therefore we
+			 * keep track of the min and max digit lengths
+			 */
 			if (parser->terminator == '\0') {
 				if (len > parser->maxlen) {
 					parser->maxlen = len;
@@ -1263,7 +1264,7 @@
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "min len %u\n", (uint32_t) parser->minlen);
 				}
 			} else {
-				// since we have a terminator, reset min and max
+				/* since we have a terminator, reset min and max */
 				parser->minlen = 0;
 				parser->maxlen = 0;
 			}
@@ -1298,13 +1299,14 @@
 	if (parser != NULL && stream != NULL) {
 		switch_size_t len = (stream->digits != NULL ? strlen(stream->digits) : 0);
 
-		// handle new digit arrivals
+		/* handle new digit arrivals */
 		if (digit != '\0') {
 
-			// if it's not a terminator digit, add it to the collected digits
+			/* if it's not a terminator digit, add it to the collected digits */
 			if (digit != parser->terminator) {
-				// if collected digits length >= the max length of the keys
-				// in the hash table, then left shift the digit string
+				/* if collected digits length >= the max length of the keys
+				 * in the hash table, then left shift the digit string
+				 */
 				if (len > 0 && parser->maxlen != 0 && len >= parser->maxlen) {
 					char *src = stream->digits + 1;
 					char *dst = stream->digits;
@@ -1323,15 +1325,16 @@
 				}
 			}
 		}
-		// don't allow collected digit string testing if there are varying sized keys until timeout
+		/* don't allow collected digit string testing if there are varying sized keys until timeout */
 		if (parser->maxlen - parser->minlen > 0 && (switch_timestamp_now() / 1000) - stream->last_digit_time < parser->digit_timeout_ms) {
 			len = 0;
 		}
-		// if we have digits to test
+		/* if we have digits to test */
 		if (len) {
 			result = switch_core_hash_find(parser->hash, stream->digits);
-			// if we matched the digit string, or this digit is the terminator
-			// reset the collected digits for next digit string
+			/* if we matched the digit string, or this digit is the terminator
+			 * reset the collected digits for next digit string
+			 */
 			if (result != NULL || parser->terminator == digit) {
 				free(stream->digits);
 				stream->digits = NULL;
@@ -1362,7 +1365,7 @@
 
 	if (parser != NULL) {
 		parser->terminator = digit;
-		// since we have a terminator, reset min and max
+		/* since we have a terminator, reset min and max */
 		parser->minlen = 0;
 		parser->maxlen = 0;
 		status = SWITCH_STATUS_SUCCESS;
@@ -1750,7 +1753,7 @@
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
 	if ((si = switch_loadable_module_get_say_interface(module_name))) {
-		// should go back and proto all the say mods to const....
+		/* should go back and proto all the say mods to const.... */
 		status = si->say_function(session, (char *) tosay, switch_ivr_get_say_type_by_name(say_type), switch_ivr_get_say_method_by_name(say_method), args);
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", module_name);
@@ -1818,7 +1821,6 @@
 	return status;
 }
 
-
 /* For Emacs:
  * Local Variables:
  * mode: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	Tue Sep  2 06:39:39 2008
@@ -1436,102 +1436,102 @@
 														   char *digits_regex)
 {
 
-	char terminator;			//used to hold terminator recieved from  
-	switch_channel_t *channel = switch_core_session_get_channel(session);	//the channel contained in session
-	switch_status_t status;		//used to recieve state out of called functions
+	char terminator;			                                          /* used to hold terminator recieved from */
+	switch_channel_t *channel = switch_core_session_get_channel(session); /* the channel contained in session */
+	switch_status_t status;		                                          /* used to recieve state out of called functions */
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
 					  "switch_play_and_get_digits(session, %d, %d, %d, %d, %s, %s, %s, digit_buffer, %d, %s)\n",
 					  min_digits, max_digits, max_tries, timeout, valid_terminators, prompt_audio_file,
 					  bad_input_audio_file, digit_buffer_length, digits_regex);
 
-	//Answer the channel if it hasn't already been answered
+	/* Answer the channel if it hasn't already been answered */
 	switch_channel_pre_answer(channel);
 
-	//Start pestering the user for input
+	/* Start pestering the user for input */
 	for (; switch_channel_ready(channel) && max_tries > 0; max_tries--) {
 		switch_input_args_t args = { 0 };
-		//make the buffer so fresh and so clean clean
+		/* make the buffer so fresh and so clean clean */
 		memset(digit_buffer, 0, digit_buffer_length);
 
 		args.buf = digit_buffer;
 		args.buflen = digit_buffer_length;
-		//Play the file
+		/* Play the file */
 		status = switch_ivr_play_file(session, NULL, prompt_audio_file, &args);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "play gave up %s\n", (char *) digit_buffer);
 
-		//Make sure we made it out alive
+		/* Make sure we made it out alive */
 		if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
 			goto done;
 		}
-		//we only get one digit out of playback, see if thats all we needed and what we got
+		/* we only get one digit out of playback, see if thats all we needed and what we got */
 		if (max_digits == 1 && status == SWITCH_STATUS_BREAK) {
-			//Check the digit if we have a regex
+			/* Check the digit if we have a regex */
 			if (digits_regex != NULL) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking regex [%s] on [%s]\n", digits_regex, (char *) digit_buffer);
 
-				//Make sure the digit is allowed
+				/* Make sure the digit is allowed */
 				if (switch_regex_match(digit_buffer, digits_regex) == SWITCH_STATUS_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Match found!\n");
-					//jobs done
+					/* jobs done */
 					break;
 				} else {
-					//See if a bad input prompt was specified, if so, play it
+					/* See if a bad input prompt was specified, if so, play it */
 					if (strlen(bad_input_audio_file) > 0) {
 						status = switch_ivr_play_file(session, NULL, bad_input_audio_file, NULL);
 
-						//Make sure we made it out alive
+						/* Make sure we made it out alive */
 						if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
 							goto done;
 						}
 					}
 				}
 			} else {
-				//jobs done
+				/* jobs done */
 				break;
 			}
 		}
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Calling more digits try %d\n", max_tries);
 
-		//Try to grab some more digits for the timeout period
+		/* Try to grab some more digits for the timeout period */
 		status = switch_ivr_collect_digits_count(session, digit_buffer, digit_buffer_length, max_digits, valid_terminators, &terminator, timeout, 0, 0);
 
-		//Make sure we made it out alive
+		/* Make sure we made it out alive */
 		if (status != SWITCH_STATUS_SUCCESS) {
-			//Bail
+			/* Bail */
 			goto done;
 		}
-		//see if we got enough
+		/* see if we got enough */
 		if (min_digits <= strlen(digit_buffer)) {
-			//See if we need to test a regex
+			/* See if we need to test a regex */
 			if (digits_regex != NULL) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking regex [%s] on [%s]\n", digits_regex, (char *) digit_buffer);
-				//Test the regex
+				/* Test the regex */
 				if (switch_regex_match(digit_buffer, digits_regex) == SWITCH_STATUS_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Match found!\n");
-					//Jobs done
+					/* Jobs done */
 					return SWITCH_STATUS_SUCCESS;
 				} else {
-					//See if a bad input prompt was specified, if so, play it
+					/* See if a bad input prompt was specified, if so, play it */
 					if (strlen(bad_input_audio_file) > 0) {
 						status = switch_ivr_play_file(session, NULL, bad_input_audio_file, NULL);
 
-						//Make sure we made it out alive
+						/* Make sure we made it out alive */
 						if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
 							goto done;
 						}
 					}
 				}
 			} else {
-				//Jobs done
+				/* Jobs done */
 				return SWITCH_STATUS_SUCCESS;
 			}
 		}
 	}
 
   done:
-	//if we got here, we got no digits or lost the channel
+	/* if we got here, we got no digits or lost the channel */
 	digit_buffer = "\0";
 	return SWITCH_STATUS_FALSE;
 }
@@ -1659,9 +1659,8 @@
 		}
 
 		if (args && (args->input_callback || args->buf || args->buflen)) {
-			/*
-			   dtmf handler function you can hook up to be executed when a digit is dialed during playback 
-			   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
+			/* dtmf handler function you can hook up to be executed when a digit is dialed during playback 
+			 * if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
 			 */
 			if (switch_channel_has_dtmf(channel)) {
 				if (!args->input_callback && !args->buf) {
@@ -1784,14 +1783,12 @@
 
 	}
 
-
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done speaking text\n");
 	flags = 0;
 	switch_core_speech_flush_tts(sh);
 	return status;
 }
 
-
 struct cached_speech_handle {
 	char tts_name[80];
 	char voice_name[80];
@@ -1799,6 +1796,7 @@
 	switch_codec_t codec;
 	switch_timer_t timer;
 };
+
 typedef struct cached_speech_handle cached_speech_handle_t;
 
 SWITCH_DECLARE(void) switch_ivr_clear_speech_cache(switch_core_session_t *session)
@@ -1817,7 +1815,6 @@
 	}
 }
 
-
 SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *session,
 													  const char *tts_name, const char *voice_name, char *text, switch_input_args_t *args)
 {
@@ -1894,7 +1891,6 @@
 	switch_channel_pre_answer(channel);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OPEN TTS %s\n", tts_name);
 
-
 	codec_name = "L16";
 
 	if (need_create) {
@@ -1993,7 +1989,6 @@
 	channel = switch_core_session_get_channel(session);
 	switch_assert(channel != NULL);
 
-
 	if ((other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
 		if ((other_session = switch_core_session_locate(other_uuid))) {
 			other_channel = switch_core_session_get_channel(other_session);
@@ -2038,7 +2033,6 @@
 
 }
 
-
 /* For Emacs:
  * Local Variables:
  * mode:c



More information about the Freeswitch-svn mailing list