]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FSCORE-357
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 27 Apr 2009 17:45:04 +0000 (17:45 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 27 Apr 2009 17:45:04 +0000 (17:45 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13167 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_core.h
src/switch_channel.c
src/switch_core_session.c
src/switch_ivr_bridge.c

index 78f566b7395eb26696b49ba700e5832dd6483f9a..e1ba1ac312bd46753f8ac7f72d902ea575a5f784 100644 (file)
@@ -677,6 +677,8 @@ SWITCH_DECLARE(void) switch_core_session_hupall(_In_ switch_call_cause_t cause);
 SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(_In_ const char *var_name, _In_ const char *var_val, _In_ switch_call_cause_t cause);
 SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_interface_t *endpoint_interface, switch_call_cause_t cause);
 
+SWITCH_DECLARE(switch_status_t) switch_core_session_get_partner(switch_core_session_t *session, switch_core_session_t **partner);
+
 /*! 
   \brief Send a message to another session using it's uuid
   \param uuid_str the unique id of the session you want to send a message to
index b1beb3a55ed081b0880b3f8e0cd8c31fd78cff0c..f1a2472eb5b2dfec47d43306fbd691823304070f 100644 (file)
@@ -764,7 +764,7 @@ SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, sw
                state = switch_channel_get_running_state(other_channel);
                mystate = switch_channel_get_running_state(channel);
 
-               if (mystate != ostate || state >= CS_HANGUP || state == want_state) {
+               if (mystate != ostate || state >= CS_HANGUP || state >= want_state) {
                        break;
                }
                switch_cond_next();
index 3c6dd890dcfaf2b4f2d79cd27ac55bb1c17c5cd2..114a2e0fd97c27cbbd6e497b3449ad3d395625b2 100644 (file)
@@ -75,6 +75,19 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_locate(const char *u
        return session;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_core_session_get_partner(switch_core_session_t *session, switch_core_session_t **partner)
+{
+       const char *uuid;
+       
+       if ((uuid = switch_channel_get_variable(session->channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
+               *partner = switch_core_session_locate(uuid);
+               return SWITCH_STATUS_SUCCESS;
+       }
+
+       *partner = NULL;
+       return SWITCH_STATUS_FALSE;
+}
+
 
 SWITCH_DECLARE(void) switch_core_session_hupall_matching_var(const char *var_name, const char *var_val, switch_call_cause_t cause)
 {
index 2b10b26a800ce90ed5e84676f951aed5f4773c0a..96ea48e09f367974e56dfda16bd0d3b5d2b4f187 100644 (file)
@@ -508,15 +508,24 @@ static switch_status_t audio_bridge_on_exchange_media(switch_core_session_t *ses
        
 
        if (switch_true(switch_channel_get_variable(channel, SWITCH_COPY_XML_CDR_VARIABLE))) {
+               switch_core_session_t *other_session;
+               switch_channel_t *other_channel;
                switch_xml_t cdr;
                char *xml_text;
 
-               if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
-                       if ((xml_text = switch_xml_toxml(cdr, SWITCH_FALSE))) {
-                               switch_channel_set_variable_partner(channel, "b_leg_cdr", xml_text);
-                               switch_safe_free(xml_text);
+               if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
+                       other_channel = switch_core_session_get_channel(other_session);
+                       
+                       switch_channel_wait_for_state(channel, other_channel, CS_REPORTING);
+                       
+                       if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
+                               if ((xml_text = switch_xml_toxml(cdr, SWITCH_FALSE))) {
+                                       switch_channel_set_variable(other_channel, "b_leg_cdr", xml_text);
+                                       switch_safe_free(xml_text);
+                               }
+                               switch_xml_free(cdr);
                        }
-                       switch_xml_free(cdr);
+                       switch_core_session_rwunlock(other_session);
                }
        }