[Freeswitch-svn] [commit] r9649 - in freeswitch/trunk/src: . include mod/applications/mod_dptools

Freeswitch SVN anthm at freeswitch.org
Thu Sep 25 15:53:44 EDT 2008


Author: anthm
Date: Thu Sep 25 15:53:43 2008
New Revision: 9649

Modified:
   freeswitch/trunk/src/include/switch_ivr.h
   freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
   freeswitch/trunk/src/switch_core_state_machine.c
   freeswitch/trunk/src/switch_ivr_async.c
   freeswitch/trunk/src/switch_ivr_play_say.c

Log:
tweak

Modified: freeswitch/trunk/src/include/switch_ivr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_ivr.h	(original)
+++ freeswitch/trunk/src/include/switch_ivr.h	Thu Sep 25 15:53:43 2008
@@ -275,9 +275,8 @@
 /*!
   \brief - NEEDDESC -
   \param session the session to act on
-  \return SWITCH_STATUS_SUCCESS if all is well - maybe more XXX FIXME
 */
-SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session);
+SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, switch_input_args_t *args);
 
 /*!
   \brief Stop looking for TONES

Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	Thu Sep 25 15:53:43 2008
@@ -1238,7 +1238,7 @@
 
 SWITCH_STANDARD_APP(echo_function)
 {
-	switch_ivr_session_echo(session);
+	switch_ivr_session_echo(session, NULL);
 }
 
 SWITCH_STANDARD_APP(park_function)

Modified: freeswitch/trunk/src/switch_core_state_machine.c
==============================================================================
--- freeswitch/trunk/src/switch_core_state_machine.c	(original)
+++ freeswitch/trunk/src/switch_core_state_machine.c	Thu Sep 25 15:53:43 2008
@@ -37,20 +37,20 @@
 
 static void switch_core_standard_on_init(switch_core_session_t *session)
 {
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard INIT %s\n", switch_channel_get_name(session->channel));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard INIT\n", switch_channel_get_name(session->channel));
 }
 
 static void switch_core_standard_on_hangup(switch_core_session_t *session)
 {
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard HANGUP %s, cause: %s\n",
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard HANGUP, cause: %s\n",
 					  switch_channel_get_name(session->channel), switch_channel_cause2str(switch_channel_get_cause(session->channel)));
 }
 
 static void switch_core_standard_on_reset(switch_core_session_t *session)
 {
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard RESET %s\n", switch_channel_get_name(session->channel));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard RESET\n", switch_channel_get_name(session->channel));
 }
 
 static void switch_core_standard_on_routing(switch_core_session_t *session)
@@ -61,7 +61,7 @@
 	char *expanded = NULL;
 	char *dpstr = NULL;
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard ROUTING %s\n", switch_channel_get_name(session->channel));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard ROUTING\n", switch_channel_get_name(session->channel));
 
 	if ((caller_profile = switch_channel_get_caller_profile(session->channel)) == 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't get profile!\n");
@@ -126,7 +126,7 @@
 {
 	switch_caller_extension_t *extension;
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard EXECUTE\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard EXECUTE\n", switch_channel_get_name(session->channel));
 
   top:
 	switch_channel_clear_flag(session->channel, CF_RESET);
@@ -164,20 +164,19 @@
 static void switch_core_standard_on_exchange_media(switch_core_session_t *session)
 {
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard LOOPBACK\n");
-	switch_ivr_session_echo(session);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard EXCHANGE_MEDIA\n", switch_channel_get_name(session->channel));
 }
 
 static void switch_core_standard_on_soft_execute(switch_core_session_t *session)
 {
 	switch_assert(session != NULL);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard TRANSMIT\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard SOFT_EXECUTE\n", switch_channel_get_name(session->channel));
 }
 
 static void switch_core_standard_on_park(switch_core_session_t *session)
 {
 	switch_assert(session != NULL);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard PARK\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard PARK\n", switch_channel_get_name(session->channel));
 	switch_channel_clear_flag(session->channel, CF_TRANSFER);
 	switch_core_session_reset(session, SWITCH_TRUE);
 	switch_ivr_park(session, NULL);
@@ -186,13 +185,13 @@
 static void switch_core_standard_on_consume_media(switch_core_session_t *session)
 {
 	switch_assert(session != NULL);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard HOLD\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard CONSUME_MEDIA\n", switch_channel_get_name(session->channel));
 }
 
 static void switch_core_standard_on_hibernate(switch_core_session_t *session)
 {
 	switch_assert(session != NULL);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard HIBERNATE\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Standard HIBERNATE\n", switch_channel_get_name(session->channel));
 }
 
 #include <sqlite3.h>

Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c	(original)
+++ freeswitch/trunk/src/switch_ivr_async.c	Thu Sep 25 15:53:43 2008
@@ -67,7 +67,7 @@
 }
 #endif
 
-SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session)
+SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session, switch_input_args_t *args)
 {
 	switch_status_t status;
 	switch_frame_t *read_frame;
@@ -95,6 +95,47 @@
 		if (!SWITCH_READ_ACCEPTABLE(status)) {
 			break;
 		}
+
+		if (switch_core_session_private_event_count(session)) {
+            switch_ivr_parse_all_events(session);
+        }
+
+		if (args && (args->input_callback || args->buf || args->buflen)) {
+			switch_dtmf_t dtmf;
+			
+			/*
+			   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) {
+					status = SWITCH_STATUS_BREAK;
+					break;
+				}
+				switch_channel_dequeue_dtmf(channel, &dtmf);
+				if (args->input_callback) {
+					status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
+				} else {
+					switch_copy_string((char *) args->buf, (void *) &dtmf, args->buflen);
+					status = SWITCH_STATUS_BREAK;
+				}
+			}
+			
+			if (args->input_callback) {
+				switch_event_t *event = NULL;
+
+				if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
+					status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
+					switch_event_destroy(&event);
+				}
+			}
+
+			if (status != SWITCH_STATUS_SUCCESS) {
+				break;
+			}
+		}
+
+
 		switch_core_session_write_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0);
 
 #ifndef SWITCH_VIDEO_IN_THREADS

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	Thu Sep 25 15:53:43 2008
@@ -657,6 +657,10 @@
 			break;
 		}
 
+		if (switch_core_session_private_event_count(session)) {
+            switch_ivr_parse_all_events(session);
+        }
+
 		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 gentones 



More information about the Freeswitch-svn mailing list