]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FSCORE-357
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 11 May 2009 16:52:01 +0000 (16:52 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 11 May 2009 16:52:01 +0000 (16:52 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13274 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_types.h
src/switch_channel.c
src/switch_ivr_originate.c

index 853e17801fa7711308df8be7d8cb58191e48fc99..ae9b2a49b315276d808e5e78a62ecd63f8714b3a 100644 (file)
@@ -886,6 +886,7 @@ typedef enum {
        CF_FS_RTP,
        CF_REPORTING,
        CF_PARK,
+       CF_TIMESTAMP_SET,
        /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
        CF_FLAG_MAX
 } switch_channel_flag_t;
index 346bb51c4e72becfba5995fc543d46561f9c5f6a..7ec6a5fd2d8647351c2c3c59ae90fdba3c501db5 100644 (file)
@@ -2507,6 +2507,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
        switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, legbillusec);
        switch_channel_set_variable(channel, "flow_billusec", tmp);
 
+       switch_channel_set_flag(channel, CF_TIMESTAMP_SET);
+       
        return status;
 }
 
index 13b70a25d6cfa279482d357bb626031f244c5ce5..d684fccdda520bf940fb9d16b1e07d71bfe57872 100644 (file)
@@ -2048,12 +2048,24 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
                                
                                if (cdr_var) {
                                        for (i = 0; i < and_argc; i++) {
+                                               switch_channel_t *channel;
+
                                                if (!originate_status[i].peer_session) {
                             continue;
                         }
+
+                                               channel = switch_core_session_get_channel(originate_status[i].peer_session);
                                                
-                                               switch_channel_wait_for_state_timeout(switch_core_session_get_channel(originate_status[i].peer_session), CS_REPORTING, 5000);
-                                               switch_yield(100000);
+                                               switch_channel_wait_for_flag(channel,
+                                                                                                        CF_TIMESTAMP_SET,
+                                                                                                        SWITCH_TRUE,
+                                                                                                        5000,
+                                                                                                        NULL);
+
+                                               if (!switch_channel_test_flag(channel, CF_TIMESTAMP_SET) || !switch_core_session_running(originate_status[i].peer_session)) {
+                                                       switch_core_session_reporting_state(originate_status[i].peer_session);
+                                               }
+
                                                if (switch_ivr_generate_xml_cdr(originate_status[i].peer_session, &cdr) == SWITCH_STATUS_SUCCESS) {
                                                        if ((xml_text = switch_xml_toxml(cdr, SWITCH_FALSE))) {
                                                                switch_snprintf(buf, sizeof(buf), "%s_%d", cdr_var, ++cdr_total);