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

FreeSWITCH SVN anthm at freeswitch.org
Mon May 11 09:52:01 PDT 2009


Author: anthm
Date: Mon May 11 11:52:01 2009
New Revision: 13274

Log:
FSCORE-357

Modified:
   freeswitch/trunk/src/include/switch_types.h
   freeswitch/trunk/src/switch_channel.c
   freeswitch/trunk/src/switch_ivr_originate.c

Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h	(original)
+++ freeswitch/trunk/src/include/switch_types.h	Mon May 11 11:52:01 2009
@@ -886,6 +886,7 @@
 	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;

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Mon May 11 11:52:01 2009
@@ -2507,6 +2507,8 @@
 	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;
 }
 

Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c	(original)
+++ freeswitch/trunk/src/switch_ivr_originate.c	Mon May 11 11:52:01 2009
@@ -2048,12 +2048,24 @@
 				
 				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);



More information about the Freeswitch-svn mailing list