[Freeswitch-svn] [commit] r13167 - in freeswitch/trunk/src: . include
FreeSWITCH SVN
anthm at freeswitch.org
Mon Apr 27 10:45:04 PDT 2009
Author: anthm
Date: Mon Apr 27 12:45:04 2009
New Revision: 13167
Log:
FSCORE-357
Modified:
freeswitch/trunk/src/include/switch_core.h
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_core_session.c
freeswitch/trunk/src/switch_ivr_bridge.c
Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h (original)
+++ freeswitch/trunk/src/include/switch_core.h Mon Apr 27 12:45:04 2009
@@ -677,6 +677,8 @@
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
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Mon Apr 27 12:45:04 2009
@@ -764,7 +764,7 @@
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();
Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c (original)
+++ freeswitch/trunk/src/switch_core_session.c Mon Apr 27 12:45:04 2009
@@ -75,6 +75,19 @@
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)
{
Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c (original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c Mon Apr 27 12:45:04 2009
@@ -508,15 +508,24 @@
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);
}
}
More information about the Freeswitch-svn
mailing list