do some more caller-id cleanup
This commit is contained in:
parent
9ca7401089
commit
b72d2c32d7
|
@ -3078,6 +3078,10 @@ SWITCH_STANDARD_APP(fifo_function)
|
|||
|
||||
switch_ivr_multi_threaded_bridge(session, other_session, on_dtmf, other_session, session);
|
||||
|
||||
if (!switch_channel_test_flag(other_channel, CF_TRANSFER) || !switch_channel_up(other_channel)) {
|
||||
switch_channel_set_variable(other_channel, "fifo_initiated_bridge", "true");
|
||||
}
|
||||
|
||||
if (outbound_id) {
|
||||
long now = (long) switch_epoch_time_now(NULL);
|
||||
|
||||
|
|
|
@ -954,12 +954,22 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
|||
case SWITCH_MESSAGE_INDICATE_DISPLAY:
|
||||
{
|
||||
|
||||
if (!zstr(msg->string_array_arg[0])) {
|
||||
switch_channel_set_profile_var(tech_pvt->other_channel, "callee_id_name", msg->string_array_arg[0]);
|
||||
}
|
||||
|
||||
if (!zstr(msg->string_array_arg[1])) {
|
||||
switch_channel_set_profile_var(tech_pvt->other_channel, "callee_id_number", msg->string_array_arg[1]);
|
||||
if (switch_test_flag(tech_pvt, TFLAG_BLEG)) {
|
||||
if (!zstr(msg->string_array_arg[0])) {
|
||||
switch_channel_set_profile_var(tech_pvt->other_channel, "caller_id_name", msg->string_array_arg[0]);
|
||||
}
|
||||
|
||||
if (!zstr(msg->string_array_arg[1])) {
|
||||
switch_channel_set_profile_var(tech_pvt->other_channel, "caller_id_number", msg->string_array_arg[1]);
|
||||
}
|
||||
} else {
|
||||
if (!zstr(msg->string_array_arg[0])) {
|
||||
switch_channel_set_profile_var(tech_pvt->other_channel, "callee_id_name", msg->string_array_arg[0]);
|
||||
}
|
||||
|
||||
if (!zstr(msg->string_array_arg[1])) {
|
||||
switch_channel_set_profile_var(tech_pvt->other_channel, "callee_id_number", msg->string_array_arg[1]);
|
||||
}
|
||||
}
|
||||
|
||||
pass = 1;
|
||||
|
|
|
@ -6672,6 +6672,8 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
|||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Process REFER to [%s@%s]\n", exten, (char *) refer_to->r_url->url_host);
|
||||
|
||||
switch_channel_set_variable(tech_pvt->channel, "transfer_disposition", "recv_replace");
|
||||
|
||||
|
||||
if (refer_to->r_url && refer_to->r_url->url_headers) {
|
||||
rep = (char *) switch_stristr("Replaces=", refer_to->r_url->url_headers);
|
||||
|
@ -6724,6 +6726,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);
|
||||
|
||||
switch_channel_set_variable(channel_b, "transfer_disposition", "replaced");
|
||||
|
||||
br_a = switch_channel_get_partner_uuid(channel_a);
|
||||
br_b = switch_channel_get_partner_uuid(channel_b);
|
||||
|
||||
|
@ -6868,6 +6872,8 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
|||
switch_channel_set_flag(tchannel, CF_BYPASS_MEDIA_AFTER_BRIDGE);
|
||||
}
|
||||
|
||||
switch_channel_set_variable(tchannel, "transfer_disposition", "bridge");
|
||||
|
||||
switch_channel_set_flag(tchannel, CF_ATTENDED_TRANSFER);
|
||||
switch_core_session_rwunlock(tmp);
|
||||
}
|
||||
|
@ -6881,6 +6887,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
|||
|
||||
if (switch_true(switch_channel_get_variable(channel_a, "recording_follow_transfer")) &&
|
||||
(tmp = switch_core_session_locate(br_a))) {
|
||||
switch_channel_set_variable(switch_core_session_get_channel(tmp), "transfer_disposition", "bridge");
|
||||
switch_core_media_bug_transfer_recordings(session, tmp);
|
||||
switch_core_session_rwunlock(tmp);
|
||||
}
|
||||
|
@ -6894,9 +6901,9 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
|||
|
||||
switch_channel_set_variable_printf(channel_a, "transfer_to", "att:%s", br_b);
|
||||
|
||||
mark_transfer_record(session, br_b, br_a);
|
||||
mark_transfer_record(session, br_a, br_b);
|
||||
|
||||
switch_ivr_uuid_bridge(br_b, br_a);
|
||||
switch_ivr_uuid_bridge(br_a, br_b);
|
||||
switch_channel_set_variable(channel_b, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
|
||||
nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"),
|
||||
NUTAG_SUBSTATE(nua_substate_terminated),SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK\r\n"), SIPTAG_EVENT_STR(etmp),
|
||||
|
|
|
@ -3032,6 +3032,12 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan
|
|||
switch_channel_set_variable_partner(channel, "last_bridge_" SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE, var);
|
||||
}
|
||||
|
||||
if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
|
||||
switch_channel_set_variable(channel, "last_bridge_role", "originator");
|
||||
} else if (switch_channel_test_flag(channel, CF_BRIDGED)) {
|
||||
switch_channel_set_variable(channel, "last_bridge_role", "originatee");
|
||||
}
|
||||
|
||||
|
||||
if (!switch_core_session_running(channel->session) && !switch_core_session_started(channel->session)) {
|
||||
switch_core_session_thread_launch(channel->session);
|
||||
|
|
|
@ -100,26 +100,26 @@ static void send_display(switch_core_session_t *session, switch_core_session_t *
|
|||
caller_channel = switch_core_session_get_channel(session);
|
||||
caller_profile = switch_channel_get_caller_profile(caller_channel);
|
||||
|
||||
if (switch_channel_direction(caller_channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !switch_channel_test_flag(caller_channel, CF_DIALPLAN)) {
|
||||
|
||||
if (switch_channel_test_flag(caller_channel, CF_BRIDGE_ORIGINATOR)) {
|
||||
name = caller_profile->caller_id_name;
|
||||
number = caller_profile->caller_id_number;
|
||||
|
||||
if (zstr(number)) {
|
||||
number = "UNKNOWN";
|
||||
}
|
||||
} else {
|
||||
name = caller_profile->callee_id_name;
|
||||
number = caller_profile->callee_id_number;
|
||||
|
||||
if (zstr(name)) {
|
||||
name = caller_profile->destination_number;
|
||||
}
|
||||
if (zstr(number)) {
|
||||
number = caller_profile->destination_number;
|
||||
}
|
||||
} else {
|
||||
name = caller_profile->caller_id_name;
|
||||
number = caller_profile->caller_id_number;
|
||||
}
|
||||
|
||||
if (zstr(name)) {
|
||||
name = caller_profile->destination_number;
|
||||
}
|
||||
if (zstr(number)) {
|
||||
number = caller_profile->destination_number;
|
||||
}
|
||||
|
||||
if (zstr(name)) {
|
||||
name = number;
|
||||
}
|
||||
|
||||
if ((p = strrchr(number, '/'))) {
|
||||
|
@ -129,6 +129,9 @@ static void send_display(switch_core_session_t *session, switch_core_session_t *
|
|||
name = p + 1;
|
||||
}
|
||||
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SEND %s [%s][%s]\n", switch_core_session_get_name(peer_session), name, number);
|
||||
|
||||
msg = switch_core_session_alloc(peer_session, sizeof(*msg));
|
||||
MESSAGE_STAMP_FFL(msg);
|
||||
msg->message_id = SWITCH_MESSAGE_INDICATE_DISPLAY;
|
||||
|
@ -1576,18 +1579,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
|
|||
}
|
||||
|
||||
|
||||
|
||||
if (switch_channel_direction(originatee_channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !switch_channel_test_flag(originatee_channel, CF_DIALPLAN)) {
|
||||
switch_channel_flip_cid(originatee_channel);
|
||||
switch_channel_set_flag(originatee_channel, CF_DIALPLAN);
|
||||
}
|
||||
|
||||
if (switch_channel_direction(originator_channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !switch_channel_test_flag(originator_channel, CF_DIALPLAN)) {
|
||||
switch_channel_flip_cid(originator_channel);
|
||||
switch_channel_set_flag(originator_channel, CF_DIALPLAN);
|
||||
}
|
||||
|
||||
|
||||
if (switch_channel_down_nosig(originator_channel)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(originator_session), SWITCH_LOG_DEBUG, "%s is hungup refusing to bridge.\n", switch_channel_get_name(originatee_channel));
|
||||
switch_core_session_rwunlock(originator_session);
|
||||
|
@ -1639,6 +1635,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
|
|||
originator_cp = switch_channel_get_caller_profile(originator_channel);
|
||||
originatee_cp = switch_channel_get_caller_profile(originatee_channel);
|
||||
|
||||
if (switch_channel_inbound_display(originatee_channel)) {
|
||||
const char *tname = originatee_cp->caller_id_name;
|
||||
const char *tnum = originatee_cp->caller_id_number;
|
||||
|
||||
#ifdef DEEP_DEBUG_CID
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SWAP [%s][%s] [%s][%s]\n", originatee_cp->caller_id_name, originatee_cp->caller_id_number, originatee_cp->callee_id_name, originatee_cp->callee_id_number);
|
||||
#endif
|
||||
|
||||
originatee_cp->caller_id_name = originatee_cp->callee_id_name;
|
||||
originatee_cp->caller_id_number = originatee_cp->callee_id_number;
|
||||
|
||||
originatee_cp->callee_id_name = tname;
|
||||
originatee_cp->callee_id_number = tnum;
|
||||
}
|
||||
|
||||
|
||||
switch_channel_set_variable(originatee_channel, "original_destination_number", originatee_cp->destination_number);
|
||||
switch_channel_set_variable(originatee_channel, "original_caller_id_name", originatee_cp->caller_id_name);
|
||||
|
@ -1654,15 +1665,43 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
|
|||
originator_cp = switch_channel_get_caller_profile(originator_channel);
|
||||
originatee_cp = switch_channel_get_caller_profile(originatee_channel);
|
||||
|
||||
|
||||
#ifdef DEEP_DEBUG_CID
|
||||
{
|
||||
switch_event_t *event;
|
||||
|
||||
if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
|
||||
//switch_channel_event_set_basic_data(originator_channel, event);
|
||||
switch_caller_profile_event_set_data(originator_cp, "ORIGINATOR", event);
|
||||
switch_caller_profile_event_set_data(originatee_cp, "ORIGINATEE", event);
|
||||
DUMP_EVENT(event);
|
||||
switch_event_destroy(&event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
switch_channel_set_originator_caller_profile(originatee_channel, switch_caller_profile_clone(originatee_session, originator_cp));
|
||||
switch_channel_set_originatee_caller_profile(originator_channel, switch_caller_profile_clone(originator_session, originatee_cp));
|
||||
|
||||
originator_cp->callee_id_name = switch_core_strdup(originator_cp->pool, originatee_cp->caller_id_name);
|
||||
originator_cp->callee_id_number = switch_core_strdup(originator_cp->pool, originatee_cp->caller_id_number);
|
||||
originator_cp->callee_id_name = switch_core_strdup(originator_cp->pool, originatee_cp->callee_id_name);
|
||||
originator_cp->callee_id_number = switch_core_strdup(originator_cp->pool, originatee_cp->callee_id_number);
|
||||
|
||||
originatee_cp->callee_id_name = switch_core_strdup(originatee_cp->pool, originator_cp->caller_id_name);
|
||||
originatee_cp->callee_id_number = switch_core_strdup(originatee_cp->pool, originator_cp->caller_id_number);
|
||||
|
||||
originatee_cp->caller_id_name = switch_core_strdup(originatee_cp->pool, originator_cp->caller_id_name);
|
||||
originatee_cp->caller_id_number = switch_core_strdup(originatee_cp->pool, originator_cp->caller_id_number);
|
||||
|
||||
#ifdef DEEP_DEBUG_CID
|
||||
{
|
||||
switch_event_t *event;
|
||||
|
||||
if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
|
||||
//switch_channel_event_set_basic_data(originator_channel, event);
|
||||
switch_caller_profile_event_set_data(originator_cp, "POST-ORIGINATOR", event);
|
||||
switch_caller_profile_event_set_data(originatee_cp, "POST-ORIGINATEE", event);
|
||||
DUMP_EVENT(event);
|
||||
switch_event_destroy(&event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
switch_channel_stop_broadcast(originator_channel);
|
||||
switch_channel_stop_broadcast(originatee_channel);
|
||||
|
|
Loading…
Reference in New Issue