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;
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);
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);
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);
}
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);
}
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),
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)) {
- name = caller_profile->callee_id_name;
- number = caller_profile->callee_id_number;
- if (zstr(name)) {
- name = caller_profile->destination_number;
- }
+ 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 = caller_profile->destination_number;
+ number = "UNKNOWN";
}
} else {
- name = caller_profile->caller_id_name;
- number = caller_profile->caller_id_number;
+ 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;
}
}
+
+ if (zstr(name)) {
+ name = number;
+ }
+
if ((p = strrchr(number, '/'))) {
number = p + 1;
}
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;
}
-
- 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);
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);
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);
-
- 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);
-
+ 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->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);