fix issue with user channel and cid

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8825 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-06-23 19:04:17 +00:00
parent e55c99a143
commit f045bb9a8f
2 changed files with 19 additions and 7 deletions

View File

@ -1961,6 +1961,13 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
char *d_dest = NULL;
switch_channel_t *channel;
switch_originate_flag_t myflags = SOF_NONE;
char *cid_name_override = NULL;
char *cid_num_override = NULL;
if (var_event) {
cid_name_override = switch_event_get_header(var_event, "origination_caller_id_name");
cid_num_override = switch_event_get_header(var_event, "origination_caller_id_number");
}
if (session) {
channel = switch_core_session_get_channel(session);
@ -1992,7 +1999,8 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
myflags |= SOF_NOBLOCK;
}
if (switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL, NULL, NULL, NULL, myflags) == SWITCH_STATUS_SUCCESS) {
if (switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL,
cid_name_override, cid_num_override, NULL, myflags) == SWITCH_STATUS_SUCCESS) {
const char *context;
switch_caller_profile_t *cp;

View File

@ -708,11 +708,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
}
}
if (!cid_name_override) {
if (cid_name_override) {
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_caller_id_name", cid_name_override);
} else {
cid_name_override = switch_event_get_header(var_event, "origination_caller_id_name");
}
if (!cid_num_override) {
if (cid_num_override) {
switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_caller_id_number", cid_num_override);
} else {
cid_num_override = switch_event_get_header(var_event, "origination_caller_id_number");
}
@ -861,9 +865,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
}
}
if (vdata && (var_begin = switch_stristr("effective_caller_id_number=", vdata))) {
if (vdata && (var_begin = switch_stristr("origination_caller_id_number=", vdata))) {
char tmp[512] = "";
var_begin += strlen("effective_caller_id_number=");
var_begin += strlen("origination_caller_id_number=");
var_end = strchr(var_begin, '|');
if (var_end) {
strncpy(tmp, var_begin, var_end-var_begin);
@ -873,9 +877,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
new_profile->caller_id_number = switch_core_strdup(new_profile->pool, tmp);
}
if (vdata && (var_begin = switch_stristr("effective_caller_id_name=", vdata))) {
if (vdata && (var_begin = switch_stristr("origination_caller_id_name=", vdata))) {
char tmp[512] = "";
var_begin += strlen("effective_caller_id_name=");
var_begin += strlen("origination_caller_id_name=");
var_end = strchr(var_begin, '|');
if (var_end) {
strncpy(tmp, var_begin, var_end-var_begin);