Revision
16894
Author
anthm
Date
2010-03-04 09:58:59 -0600 (Thu, 04 Mar 2010)

Log Message

FSCORE-565

Modified Paths

Diff

Modified: freeswitch/trunk/src/switch_ivr_bridge.c (16893 => 16894)


--- freeswitch/trunk/src/switch_ivr_bridge.c	2010-03-04 15:04:57 UTC (rev 16893)
+++ freeswitch/trunk/src/switch_ivr_bridge.c	2010-03-04 15:58:59 UTC (rev 16894)
@@ -929,6 +929,22 @@
 				}
 			}
 		}
+		
+		if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR) &&
+			switch_channel_down(other_channel) && switch_true(switch_channel_get_variable(other_channel, SWITCH_COPY_XML_CDR_VARIABLE))) {
+			switch_xml_t cdr;
+			char *xml_text;
+			
+			switch_channel_wait_for_state(other_channel, channel, CS_DESTROY);
+			
+			if (switch_ivr_generate_xml_cdr(other_session, &cdr) == SWITCH_STATUS_SUCCESS) {
+				if ((xml_text = switch_xml_toxml(cdr, SWITCH_FALSE))) {
+					switch_channel_set_variable(channel, "b_leg_cdr", xml_text);
+					switch_safe_free(xml_text);
+				}
+				switch_xml_free(cdr);
+			}
+		}
 
 		switch_core_session_rwunlock(other_session);
 	}
@@ -1204,7 +1220,7 @@
 			if ((cause = switch_channel_get_cause(peer_channel))) {
 				switch_channel_set_variable(caller_channel, SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE, switch_channel_cause2str(cause));
 			}
-
+			
 			if (switch_channel_down(peer_channel) && switch_true(switch_channel_get_variable(peer_channel, SWITCH_COPY_XML_CDR_VARIABLE))) {
 				switch_xml_t cdr;
 				char *xml_text;