forked from Mirrors/freeswitch
fix for MODAPP-122
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9248 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
db4ae66fde
commit
1bb00325a5
@ -181,7 +181,9 @@ typedef enum {
|
||||
typedef enum {
|
||||
SOF_NONE = 0,
|
||||
SOF_NOBLOCK = (1 << 0),
|
||||
SOF_FORKED_DIAL = (1 << 1)
|
||||
SOF_FORKED_DIAL = (1 << 1),
|
||||
SOF_NO_EFFECTIVE_CID_NUM = (1 << 2),
|
||||
SOF_NO_EFFECTIVE_CID_NAME = (1 << 3)
|
||||
} switch_originate_flag_enum_t;
|
||||
typedef uint32_t switch_originate_flag_t;
|
||||
|
||||
|
@ -271,8 +271,13 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_
|
||||
if (caller_profile) {
|
||||
const char *ecaller_id_name = NULL, *ecaller_id_number = NULL;
|
||||
|
||||
if (!(flags & SOF_NO_EFFECTIVE_CID_NAME)) {
|
||||
ecaller_id_name = switch_channel_get_variable(channel, "effective_caller_id_name");
|
||||
}
|
||||
|
||||
if (!(flags & SOF_NO_EFFECTIVE_CID_NUM)) {
|
||||
ecaller_id_number = switch_channel_get_variable(channel, "effective_caller_id_number");
|
||||
}
|
||||
|
||||
if (ecaller_id_name || ecaller_id_number) {
|
||||
outgoing_profile = switch_caller_profile_clone(session, caller_profile);
|
||||
|
@ -506,7 +506,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
||||
const char *cid_num_override,
|
||||
switch_caller_profile_t *caller_profile_override, switch_originate_flag_t flags)
|
||||
{
|
||||
switch_originate_flag_t myflags = SOF_NONE;
|
||||
switch_originate_flag_t dftflags = SOF_NONE, myflags = dftflags;
|
||||
char *pipe_names[MAX_PEERS] = { 0 };
|
||||
char *data = NULL;
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
@ -538,6 +538,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
||||
uint8_t ring_ready = 0;
|
||||
char *loop_data = NULL;
|
||||
uint32_t progress_timelimit_sec = 0;
|
||||
const char *cid_tmp;
|
||||
|
||||
*bleg = NULL;
|
||||
|
||||
@ -742,18 +743,34 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
||||
}
|
||||
}
|
||||
|
||||
if ((cid_tmp = switch_event_get_header(var_event, "origination_caller_id_name"))) {
|
||||
cid_name_override = cid_tmp;
|
||||
}
|
||||
|
||||
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_tmp = switch_event_get_header(var_event, "origination_caller_id_number"))) {
|
||||
cid_num_override = cid_tmp;
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
if (cid_num_override) {
|
||||
dftflags |= SOF_NO_EFFECTIVE_CID_NUM;
|
||||
}
|
||||
|
||||
if (cid_name_override) {
|
||||
dftflags |= SOF_NO_EFFECTIVE_CID_NAME;
|
||||
}
|
||||
|
||||
if (!progress_timelimit_sec) {
|
||||
progress_timelimit_sec = timelimit_sec;
|
||||
}
|
||||
@ -793,6 +810,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
||||
to = 0;
|
||||
sent_ring = 0;
|
||||
progress = 0;
|
||||
myflags = dftflags;
|
||||
|
||||
if (try > 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Originate attempt %d/%d in %d ms\n", try + 1, retries, sleep_ms);
|
||||
@ -915,6 +933,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
||||
strncpy(tmp, var_begin, strlen(var_begin));
|
||||
}
|
||||
new_profile->caller_id_number = switch_core_strdup(new_profile->pool, tmp);
|
||||
myflags |= SOF_NO_EFFECTIVE_CID_NUM;
|
||||
}
|
||||
|
||||
if (vdata && (var_begin = switch_stristr("origination_caller_id_name=", vdata))) {
|
||||
@ -927,8 +946,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
||||
strncpy(tmp, var_begin, strlen(var_begin));
|
||||
}
|
||||
new_profile->caller_id_name = switch_core_strdup(new_profile->pool, tmp);
|
||||
myflags |= SOF_NO_EFFECTIVE_CID_NAME;
|
||||
}
|
||||
|
||||
|
||||
if ((reason =
|
||||
switch_core_session_outgoing_channel(session, var_event, chan_type, new_profile, &new_session, &pool,
|
||||
myflags)) != SWITCH_CAUSE_SUCCESS) {
|
||||
|
Loading…
Reference in New Issue
Block a user