cid logic changes for calle[re]
This commit is contained in:
parent
bad1eb1183
commit
8f452bc519
|
@ -312,6 +312,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_caller_extension_masquerade(switc
|
|||
*/
|
||||
SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension);
|
||||
|
||||
SWITCH_DECLARE(void) switch_channel_sort_cid(switch_channel_t *channel, switch_bool_t in);
|
||||
|
||||
/*!
|
||||
\brief Retrieve caller extension from a given channel
|
||||
\param channel channel to retrieve extension from
|
||||
|
|
|
@ -4065,6 +4065,8 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
|
|||
switch_channel_set_variable(nchannel, "sip_invite_params", "intercom=true");
|
||||
}
|
||||
|
||||
DUMP_EVENT(var_event);
|
||||
|
||||
if (((hval = switch_event_get_header(var_event, "effective_callee_id_name")) ||
|
||||
(hval = switch_event_get_header(var_event, "sip_callee_id_name"))) && !zstr(hval)) {
|
||||
caller_profile->callee_id_name = switch_core_strdup(caller_profile->pool, hval);
|
||||
|
|
|
@ -2382,12 +2382,48 @@ SWITCH_DECLARE(switch_status_t) switch_channel_caller_extension_masquerade(switc
|
|||
return status;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) switch_channel_sort_cid(switch_channel_t *channel, switch_bool_t in)
|
||||
{
|
||||
|
||||
if (in) {
|
||||
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !switch_channel_test_flag(channel, CF_DIALPLAN)) {
|
||||
switch_channel_set_flag(channel, CF_DIALPLAN);
|
||||
|
||||
switch_mutex_lock(channel->profile_mutex);
|
||||
if (channel->caller_profile->callee_id_name) {
|
||||
switch_channel_set_variable(channel, "pre_transfer_caller_id_name", channel->caller_profile->caller_id_name);
|
||||
channel->caller_profile->caller_id_name = switch_core_strdup(channel->caller_profile->pool, channel->caller_profile->callee_id_name);
|
||||
}
|
||||
channel->caller_profile->callee_id_name = SWITCH_BLANK_STRING;
|
||||
|
||||
if (channel->caller_profile->callee_id_number) {
|
||||
switch_channel_set_variable(channel, "pre_transfer_caller_id_number", channel->caller_profile->caller_id_number);
|
||||
channel->caller_profile->caller_id_number = switch_core_strdup(channel->caller_profile->pool, channel->caller_profile->callee_id_number);
|
||||
}
|
||||
channel->caller_profile->callee_id_number = SWITCH_BLANK_STRING;
|
||||
switch_mutex_unlock(channel->profile_mutex);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND && switch_channel_test_flag(channel, CF_DIALPLAN)) {
|
||||
switch_channel_clear_flag(channel, CF_DIALPLAN);
|
||||
switch_mutex_lock(channel->profile_mutex);
|
||||
channel->caller_profile->callee_id_name = SWITCH_BLANK_STRING;
|
||||
channel->caller_profile->callee_id_number = SWITCH_BLANK_STRING;
|
||||
switch_mutex_unlock(channel->profile_mutex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension)
|
||||
{
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
switch_channel_set_flag(channel, CF_DIALPLAN);
|
||||
|
||||
switch_channel_sort_cid(channel, SWITCH_TRUE);
|
||||
|
||||
switch_mutex_lock(channel->profile_mutex);
|
||||
caller_extension->next = channel->caller_profile->caller_extension;
|
||||
channel->caller_profile->caller_extension = caller_extension;
|
||||
|
|
|
@ -1544,21 +1544,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
|
|||
new_profile->destination_number = switch_core_strdup(new_profile->pool, extension);
|
||||
new_profile->rdnis = switch_core_strdup(new_profile->pool, profile->destination_number);
|
||||
|
||||
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
|
||||
if (profile->callee_id_name) {
|
||||
switch_channel_set_variable(channel, "pre_transfer_caller_id_name", new_profile->caller_id_name);
|
||||
new_profile->caller_id_name = switch_core_strdup(new_profile->pool, profile->callee_id_name);
|
||||
profile->callee_id_name = SWITCH_BLANK_STRING;
|
||||
}
|
||||
|
||||
if (profile->callee_id_number) {
|
||||
switch_channel_set_variable(channel, "pre_transfer_caller_id_number", new_profile->caller_id_number);
|
||||
new_profile->caller_id_number = switch_core_strdup(new_profile->pool, profile->callee_id_number);
|
||||
profile->callee_id_number = SWITCH_BLANK_STRING;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, NULL);
|
||||
|
||||
/* If HANGUP_AFTER_BRIDGE is set to 'true', SWITCH_SIGNAL_BRIDGE_VARIABLE
|
||||
|
|
|
@ -1052,6 +1052,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t *
|
|||
switch_channel_set_variable(caller_channel, "signal_bridge", "true");
|
||||
switch_channel_set_variable(peer_channel, "signal_bridge", "true");
|
||||
|
||||
switch_channel_sort_cid(peer_channel, SWITCH_FALSE);
|
||||
|
||||
/* fire events that will change the data table from "show channels" */
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(caller_channel, event);
|
||||
|
@ -1117,6 +1119,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
|
|||
switch_channel_set_flag_recursive(caller_channel, CF_BRIDGE_ORIGINATOR);
|
||||
switch_channel_clear_flag(peer_channel, CF_BRIDGE_ORIGINATOR);
|
||||
|
||||
switch_channel_sort_cid(peer_channel, SWITCH_FALSE);
|
||||
|
||||
b_leg->session = peer_session;
|
||||
switch_copy_string(b_leg->b_uuid, switch_core_session_get_uuid(session), sizeof(b_leg->b_uuid));
|
||||
b_leg->stream_id = stream_id;
|
||||
|
|
|
@ -2383,24 +2383,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||
new_profile->chan_name = SWITCH_BLANK_STRING;
|
||||
new_profile->destination_number = switch_core_strdup(new_profile->pool, chan_data);
|
||||
|
||||
if (switch_channel_direction(caller_channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
|
||||
const char *callee_id_name = new_profile->callee_id_name;
|
||||
const char *callee_id_number = new_profile->callee_id_number;
|
||||
|
||||
if (zstr(callee_id_number)) {
|
||||
callee_id_number = caller_caller_profile->destination_number;
|
||||
}
|
||||
|
||||
if (zstr(callee_id_name)) {
|
||||
callee_id_name = callee_id_number;
|
||||
}
|
||||
|
||||
new_profile->caller_id_name = callee_id_name;
|
||||
new_profile->caller_id_number = callee_id_number;
|
||||
new_profile->callee_id_name = SWITCH_BLANK_STRING;
|
||||
new_profile->callee_id_number = SWITCH_BLANK_STRING;
|
||||
}
|
||||
|
||||
if (cid_name_override) {
|
||||
new_profile->caller_id_name = switch_core_strdup(new_profile->pool, cid_name_override);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue