]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add process_cdr variable
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 14 Jan 2008 15:26:46 +0000 (15:26 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 14 Jan 2008 15:26:46 +0000 (15:26 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7211 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_types.h
src/switch_core_state_machine.c

index 3ae3360c7b674cdd8e3fc5738d4bbd1e3d660480..c711ad64eb1c228807e7caaa8d4cc2532aef094a 100644 (file)
@@ -101,6 +101,7 @@ SWITCH_BEGIN_EXTERN_C
 #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"
index 36fed035362e3c93507348f2245c91e454a19630..d2dc1e2665cff72ccf6b8ffa1612a0a2614efaf3 100644 (file)
@@ -307,7 +307,7 @@ void switch_core_state_machine_init(switch_memory_pool_t *pool)
                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 @@ void switch_core_state_machine_init(switch_memory_pool_t *pool)
                                }                                                                                                               \
                        }                                                                                                                       \
                        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 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
                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 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
                        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");