abstract out originate_signal_bond to a function to avoid confustion and regressions

This commit is contained in:
Anthony Minessale
2012-05-29 13:10:15 -05:00
parent 4d8cdb3276
commit 8bb55ed4bf
27 changed files with 98 additions and 90 deletions
+4 -4
View File
@@ -172,7 +172,7 @@ static switch_status_t sofia_on_reset(switch_core_session_t *session)
const char *uuid = switch_core_session_get_uuid(session);
if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
const char *other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
const char *other_uuid = switch_channel_get_partner_uuid(channel);
int x = 0;
if (other_uuid) {
@@ -1824,7 +1824,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
}
sofia_glue_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE);
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
if ((uuid = switch_channel_get_partner_uuid(channel))
&& (other_session = switch_core_session_locate(uuid))) {
other_channel = switch_core_session_get_channel(other_session);
ip = switch_channel_get_variable(other_channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
@@ -2061,7 +2061,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
const char *uuid;
const char *call_id = NULL, *to_user = NULL, *to_host = NULL, *to_tag = NULL, *from_tag = NULL, *from_user = NULL, *from_host = NULL;
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) || (uuid = switch_channel_get_variable(channel, "originate_signal_bond"))) {
if ((uuid = switch_channel_get_partner_uuid(channel))) {
switch_core_session_t *rsession;
if ((rsession = switch_core_session_locate(uuid))) {
switch_channel_t *rchannel = switch_core_session_get_channel(rsession);
@@ -2191,7 +2191,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) {
const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
const char *uuid = switch_channel_get_partner_uuid(channel);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "SEND");
+14 -14
View File
@@ -618,7 +618,7 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
if (sofia_test_flag(tech_pvt, TFLAG_SLA_BARGE)) {
switch_core_session_t *new_session, *other_session;
const char *other_uuid = switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE);
const char *other_uuid = switch_channel_get_partner_uuid(tech_pvt->channel);
char *cmd = NULL;
if (!zstr(other_uuid) && (other_session = switch_core_session_locate(other_uuid))) {
@@ -783,7 +783,7 @@ void sofia_send_callee_id(switch_core_session_t *session, const char *name, cons
number = caller_profile->destination_number;
}
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (session_b = switch_core_session_locate(uuid))) {
if ((uuid = switch_channel_get_partner_uuid(channel)) && (session_b = switch_core_session_locate(uuid))) {
switch_core_session_message_t *msg;
//switch_channel_t *channel_b = switch_core_session_get_channel(session_b);
@@ -906,7 +906,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro
caller_profile->callee_id_number = switch_sanitize_number(switch_core_strdup(caller_profile->pool, number));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s Update Callee ID to \"%s\" <%s>\n", switch_channel_get_name(channel), name, number);
if (lazy || (att && !switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
if (lazy || (att && !switch_channel_get_partner_uuid(channel))) {
switch_channel_flip_cid(channel);
}
}
@@ -914,7 +914,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro
if (send) {
if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) {
const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
const char *uuid = switch_channel_get_partner_uuid(channel);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "RECV");
if (uuid) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridged-To", uuid);
@@ -5211,7 +5211,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
goto end;
}
if ((br = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
if ((br = switch_channel_get_partner_uuid(channel))) {
switch_xml_t root = NULL, domain = NULL;
switch_core_session_t *a_session;
switch_channel_t *a_channel;
@@ -5370,7 +5370,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
if (sofia_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
sofia_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
if ((uuid = switch_channel_get_partner_uuid(channel)) && (other_session = switch_core_session_locate(uuid))) {
const char *r_sdp = NULL;
switch_core_session_message_t *msg;
private_object_t *other_tech_pvt = switch_core_session_get_private(other_session);
@@ -5602,7 +5602,7 @@ void *SWITCH_THREAD_FUNC media_on_hold_thread_run(switch_thread_t *thread, void
switch_channel_t *channel = switch_core_session_get_channel(session);
private_object_t *tech_pvt = switch_core_session_get_private(session);
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
if ((uuid = switch_channel_get_partner_uuid(channel)) && (other_session = switch_core_session_locate(uuid))) {
if (switch_core_session_compare(session, other_session)) {
sofia_set_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
switch_ivr_media(switch_core_session_get_uuid(other_session), SMF_REBRIDGE);
@@ -6057,7 +6057,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
}
if ((b_private = nua_handle_magic(bnh))) {
const char *br_b = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
const char *br_b = switch_channel_get_partner_uuid(channel);
char *br_a = b_private->uuid;
@@ -6859,8 +6859,8 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
b_tech_pvt = (private_object_t *) switch_core_session_get_private(b_session);
channel_b = switch_core_session_get_channel(b_session);
br_a = switch_channel_get_variable(channel_a, SWITCH_SIGNAL_BOND_VARIABLE);
br_b = switch_channel_get_variable(channel_b, SWITCH_SIGNAL_BOND_VARIABLE);
br_a = switch_channel_get_partner_uuid(channel_a);
br_b = switch_channel_get_partner_uuid(channel_b);
if (!switch_ivr_uuid_exists(br_a)) {
br_a = NULL;
@@ -7109,7 +7109,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
}
nua_handle_unref(bnh);
} else { /* the other channel is on a different box, we have to go find them */
if (exten && (br_a = switch_channel_get_variable(channel_a, SWITCH_SIGNAL_BOND_VARIABLE))) {
if (exten && (br_a = switch_channel_get_partner_uuid(channel_a))) {
switch_core_session_t *a_session;
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -7232,7 +7232,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
const char *br;
switch_core_session_t *b_session;
if ((br = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (b_session = switch_core_session_locate(br))) {
if ((br = switch_channel_get_partner_uuid(channel)) && (b_session = switch_core_session_locate(br))) {
const char *var;
switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
@@ -7554,7 +7554,7 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
const char *uuid;
switch_core_session_t *session_b;
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (session_b = switch_core_session_locate(uuid))) {
if ((uuid = switch_channel_get_partner_uuid(channel)) && (session_b = switch_core_session_locate(uuid))) {
while (switch_channel_has_dtmf(channel)) {
switch_dtmf_t idtmf = { 0, 0 };
if (switch_channel_dequeue_dtmf(channel, &idtmf) == SWITCH_STATUS_SUCCESS) {
@@ -8575,7 +8575,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
tech_pvt->caller_profile->dialplan = "inline";
bridge_uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE);
bridge_uuid = switch_channel_get_partner_uuid(b_channel);
if (call_info) {
const char *olu;
+7 -7
View File
@@ -688,7 +688,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, switch
pass_fmtp = NULL;
if (switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE)) {
if (switch_channel_get_partner_uuid(tech_pvt->channel)) {
if ((of = switch_channel_get_variable_partner(tech_pvt->channel, "sip_video_fmtp"))) {
pass_fmtp = of;
}
@@ -4189,9 +4189,9 @@ int sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly)
if (!strcasecmp(stream, "indicate_hold")) {
switch_channel_set_flag(tech_pvt->channel, CF_SUSPEND);
switch_channel_set_flag(tech_pvt->channel, CF_HOLD);
switch_ivr_hold_uuid(switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE), NULL, 0);
switch_ivr_hold_uuid(switch_channel_get_partner_uuid(tech_pvt->channel), NULL, 0);
} else {
switch_ivr_broadcast(switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE), stream,
switch_ivr_broadcast(switch_channel_get_partner_uuid(tech_pvt->channel), stream,
SMF_ECHO_ALEG | SMF_LOOP | SMF_PRIORITY);
switch_yield(250000);
}
@@ -4217,7 +4217,7 @@ int sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly)
switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
}
if ((uuid = switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (b_session = switch_core_session_locate(uuid))) {
if ((uuid = switch_channel_get_partner_uuid(tech_pvt->channel)) && (b_session = switch_core_session_locate(uuid))) {
switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
if (switch_channel_test_flag(tech_pvt->channel, CF_HOLD)) {
@@ -5330,7 +5330,7 @@ void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp)
switch_core_session_t *other_session;
switch_channel_t *other_channel;
if ((val = switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE))
if ((val = switch_channel_get_partner_uuid(tech_pvt->channel))
&& (other_session = switch_core_session_locate(val))) {
other_channel = switch_core_session_get_channel(other_session);
switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, sdp);
@@ -5904,7 +5904,7 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
}
if (switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) {
if (switch_channel_get_partner_uuid(channel)) {
sofia_set_flag(tech_pvt, TFLAG_RECOVERING_BRIDGE);
} else {
switch_xml_t callflow, param, x_extension;
@@ -6826,7 +6826,7 @@ void sofia_glue_tech_simplify(private_object_t *tech_pvt)
if ((uuid = switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE))
if ((uuid = switch_channel_get_partner_uuid(tech_pvt->channel))
&& (other_session = switch_core_session_locate(uuid))) {
other_channel = switch_core_session_get_channel(other_session);