]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FSCORE-357
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 12 May 2009 14:54:34 +0000 (14:54 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 12 May 2009 14:54:34 +0000 (14:54 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13285 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_channel.c
src/switch_ivr_originate.c

index 7ec6a5fd2d8647351c2c3c59ae90fdba3c501db5..09b5fe64dbc541c1d4378b085f92e06ac2eac675 100644 (file)
@@ -796,7 +796,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *c
                                                                                                                         uint32_t to,
                                                                                                                         switch_channel_t *super_channel)
 {
-
+       
        if (to) {
                to++;
        }
@@ -2314,6 +2314,12 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
        char dtstr[SWITCH_DTMF_LOG_LEN+1] = "";
        int x = 0;
 
+       if (switch_channel_test_flag(channel, CF_TIMESTAMP_SET)) {
+               return SWITCH_STATUS_FALSE;
+       }
+       
+       switch_channel_set_flag(channel, CF_TIMESTAMP_SET);
+
        if (!(caller_profile = switch_channel_get_caller_profile(channel)) || !channel->variables) {
                return SWITCH_STATUS_FALSE;
        }
@@ -2506,8 +2512,6 @@ 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 d684fccdda520bf940fb9d16b1e07d71bfe57872..e0f6314cd1304280b0d79f91371c0a5b67569ec1 100644 (file)
@@ -2056,16 +2056,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
 
                                                channel = switch_core_session_get_channel(originate_status[i].peer_session);
                                                
-                                               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);
+                                               switch_channel_wait_for_state_timeout(channel, CS_REPORTING, 5000);
+                                               
+                                               if (!switch_channel_test_flag(channel, CF_TIMESTAMP_SET)) {
+                                                       switch_channel_set_timestamps(channel);
                                                }
-
+                                               
                                                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);