[Freeswitch-svn] [commit] r7211 - in freeswitch/trunk/src: . include

Freeswitch SVN anthm at freeswitch.org
Mon Jan 14 10:26:46 EST 2008


Author: anthm
Date: Mon Jan 14 10:26:46 2008
New Revision: 7211

Modified:
   freeswitch/trunk/src/include/switch_types.h
   freeswitch/trunk/src/switch_core_state_machine.c

Log:
add process_cdr variable

Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h	(original)
+++ freeswitch/trunk/src/include/switch_types.h	Mon Jan 14 10:26:46 2008
@@ -101,6 +101,7 @@
 #define SWITCH_PATH_SEPARATOR "/"
 #endif
 #define SWITCH_URL_SEPARATOR "://"
+#define SWITCH_PROCESS_CDR_VARIABLE "process_cdr"
 #define SWITCH_BRIDGE_CHANNEL_VARIABLE "bridge_channel"
 #define SWITCH_CHANNEL_NAME_VARIABLE "channel_name"
 #define SWITCH_BRIDGE_UUID_VARIABLE "bridge_uuid"

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	Mon Jan 14 10:26:46 2008
@@ -307,7 +307,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) State %s\n", switch_channel_get_name(session->channel), __STATE_STR);	\
 		if (!driver_state_handler->on_##__STATE || (driver_state_handler->on_##__STATE(session) == SWITCH_STATUS_SUCCESS \
 													&& midstate == switch_channel_get_state(session->channel))) { \
-			while ((application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) { \
+			while (do_extra_handlers && (application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) { \
 				if (!application_state_handler || !application_state_handler->on_##__STATE \
 					|| (application_state_handler->on_##__STATE			\
 						&& application_state_handler->on_##__STATE(session) == SWITCH_STATUS_SUCCESS \
@@ -320,7 +320,7 @@
 				}														\
 			}															\
 			index = 0;													\
-			while (proceed && (application_state_handler = switch_core_get_state_handler(index++)) != 0) { \
+			while (do_extra_handlers && proceed && (application_state_handler = switch_core_get_state_handler(index++)) != 0) { \
 				if (!application_state_handler || !application_state_handler->on_##__STATE || \
 					(application_state_handler->on_##__STATE &&			\
 					 application_state_handler->on_##__STATE(session) == SWITCH_STATUS_SUCCESS \
@@ -408,7 +408,8 @@
 		if (state != switch_channel_get_running_state(session->channel) || state == CS_HANGUP || exception) {
 			int index = 0;
 			int proceed = 1;
-			
+			int do_extra_handlers = 1;			
+
 			switch_channel_set_running_state(session->channel);
 
 			switch (state) {
@@ -418,7 +419,15 @@
 			case CS_DONE:
 				goto done;
 			case CS_HANGUP:	    /* Deactivate and end the thread */
-				STATE_MACRO(hangup, "HANGUP");
+				{
+					const char *var = NULL;
+
+					if (!(var = switch_channel_get_variable(session->channel, SWITCH_PROCESS_CDR_VARIABLE)) || !switch_true(var)) {
+						do_extra_handlers = 0;
+					}
+					
+					STATE_MACRO(hangup, "HANGUP");
+				}
 				goto done;
 			case CS_INIT:		/* Basic setup tasks */
 				STATE_MACRO(init, "INIT");



More information about the Freeswitch-svn mailing list