FSCORE-357

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13167 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-04-27 17:45:04 +00:00
parent b9dea85eb7
commit e7470e882c
4 changed files with 30 additions and 6 deletions

View 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

View 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();

View 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)
{

View 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);
}
}