diff --git a/src/switch_core.c b/src/switch_core.c index c5363cf1b9..41f10104b0 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1567,8 +1567,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_outgoing_channel(switch_core ecaller_id_name = switch_channel_get_variable(channel, "effective_caller_id_name"); ecaller_id_number = switch_channel_get_variable(channel, "effective_caller_id_number"); - + if (ecaller_id_name || ecaller_id_number) { + if (!ecaller_id_name) { + ecaller_id_name = caller_profile->caller_id_name; + } + if (!ecaller_id_number) { + ecaller_id_number = caller_profile->caller_id_number; + } outgoing_profile = switch_caller_profile_new(switch_core_session_get_pool(session), caller_profile->username, caller_profile->dialplan, diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 12b8edbcb9..d92b76ce2a 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2555,6 +2555,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess early_ok = 0; } + if (!cid_name_override) { + cid_name_override = switch_event_get_header(var_event, "origination_caller_id_name"); + } + + if (!cid_num_override) { + cid_num_override = switch_event_get_header(var_event, "origination_caller_id_number"); + } + + or_argc = switch_separate_string(data, '|', pipe_names, (sizeof(pipe_names) / sizeof(pipe_names[0]))); if (caller_channel && or_argc > 1 && !ringback_data) { @@ -2603,7 +2612,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } caller_caller_profile = caller_profile_override ? caller_profile_override : switch_channel_get_caller_profile(caller_channel); - + if (!cid_name_override) { cid_name_override = caller_caller_profile->caller_id_name; } @@ -2616,9 +2625,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess caller_caller_profile->dialplan, cid_name_override, cid_num_override, - caller_caller_profile->network_addr, + caller_caller_profile->network_addr, + NULL, NULL, - NULL, caller_caller_profile->rdnis, caller_caller_profile->source, caller_caller_profile->context, @@ -2983,15 +2992,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess *cause = SWITCH_CAUSE_UNALLOCATED; if (var_event) { + if (!caller_channel) { /* install the vars from the {} params */ + switch_event_header_t *header; + for (header = var_event->headers; header; header = header->next) { + switch_channel_set_variable(peer_channel, header->name, header->value); + } + } switch_event_destroy(&var_event); } if (status == SWITCH_STATUS_SUCCESS) { if (caller_channel) { switch_channel_set_variable(caller_channel, "originate_disposition", "call accepted"); - } + } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Originate Resulted in Success: [%s]\n", switch_channel_get_name(peer_channel)); *cause = SWITCH_CAUSE_SUCCESS; + } else { if (peer_channel) { *cause = switch_channel_get_cause(peer_channel);