move accidental new behaviour behind new param originate_continue_on_timeout=true

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15121 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-10-08 17:43:51 +00:00
parent 04c90a3c7f
commit 5b6d1cd33c
2 changed files with 29 additions and 19 deletions

View File

@ -1595,12 +1595,10 @@ static switch_status_t hanguphook(switch_core_session_t *session)
SWITCH_STANDARD_APP(att_xfer_function)
{
const char *var;
switch_core_session_t *peer_session = NULL;
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
switch_channel_t *channel, *peer_channel = NULL;
const char *bond = NULL;
int timelimit = 60;
switch_core_session_t *b_session = NULL;
channel = switch_core_session_get_channel(session);
@ -1612,11 +1610,7 @@ SWITCH_STANDARD_APP(att_xfer_function)
switch_channel_set_variable(channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE, bond);
switch_channel_set_flag(channel, CF_XFER_ZOMBIE);
if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))) {
timelimit = atoi(var);
}
if (switch_ivr_originate(session, &peer_session, &cause, data, timelimit, NULL, NULL, NULL, NULL, NULL, SOF_NONE)
if (switch_ivr_originate(session, &peer_session, &cause, data, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE)
!= SWITCH_STATUS_SUCCESS || !peer_session) {
goto end;
}
@ -2125,22 +2119,17 @@ SWITCH_STANDARD_APP(audio_bridge_function)
{
switch_channel_t *caller_channel = switch_core_session_get_channel(session);
switch_core_session_t *peer_session = NULL;
unsigned int timelimit = 60;
const char *var, *continue_on_fail = NULL, *failure_causes = NULL;
const char *continue_on_fail = NULL, *failure_causes = NULL;
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
if (switch_strlen_zero(data)) {
return;
}
if ((var = switch_channel_get_variable(caller_channel, SWITCH_CALL_TIMEOUT_VARIABLE))) {
timelimit = atoi(var);
}
continue_on_fail = switch_channel_get_variable(caller_channel, "continue_on_fail");
failure_causes = switch_channel_get_variable(caller_channel, "failure_causes");
if (switch_ivr_originate(session, &peer_session, &cause, data, timelimit, NULL, NULL, NULL, NULL, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS) {
if (switch_ivr_originate(session, &peer_session, &cause, data, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Originate Failed. Cause: %s\n", switch_channel_cause2str(cause));
/*
@ -2258,11 +2247,11 @@ static switch_call_cause_t group_outgoing_channel(switch_core_session_t *session
switch_originate_flag_t myflags = SOF_NONE;
char *cid_name_override = NULL;
char *cid_num_override = NULL;
const char *var, *skip = NULL;
unsigned int timelimit = 60;
char *domain = NULL;
switch_channel_t *new_channel = NULL;
unsigned int timelimit = 60;
const char *skip, *var;
group = strdup(outbound_profile->destination_number);
if (!group) goto done;

View File

@ -113,6 +113,7 @@ typedef struct {
int monitor_early_media_ring_count;
int monitor_early_media_ring_total;
int cancel_timeout;
int continue_on_timeout;
} originate_global_t;
@ -755,7 +756,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
switch_core_session_set_read_codec(session, &write_codec);
}
}
if (ringback_data) {
char *tmp_data = NULL;
@ -1033,10 +1034,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
switch_channel_state_t wait_state = 0;
if (session) {
const char *to_var;
caller_channel = switch_core_session_get_channel(session);
switch_channel_set_flag(caller_channel, CF_ORIGINATOR);
oglobals.session = session;
if ((to_var = switch_channel_get_variable(caller_channel, SWITCH_CALL_TIMEOUT_VARIABLE))) {
timelimit_sec = atoi(to_var);
}
if (switch_true(switch_channel_get_variable(caller_channel, SWITCH_PROXY_MEDIA_VARIABLE))) {
switch_channel_set_flag(caller_channel, CF_PROXY_MEDIA);
}
@ -1060,6 +1067,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
}
}
if (timelimit_sec <= 0) {
timelimit_sec = 60;
}
oglobals.idx = IDX_NADA;
oglobals.early_ok = 1;
@ -1193,6 +1204,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
ok = 1;
} else if (!strcasecmp((char *) hi->name, "ignore_early_media")) {
ok = 1;
} else if (!strcasecmp((char *) hi->name, "originate_continue_on_timeout")) {
ok = 1;
} else if (!strcasecmp((char *) hi->name, "ignore_ring_ready")) {
ok = 1;
} else if (!strcasecmp((char *) hi->name, "monitor_early_media_ring")) {
@ -1296,6 +1309,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
oglobals.ignore_early_media = 1;
}
if ((var_val = switch_event_get_header(var_event, "originate_continue_on_timeout")) && switch_true(var_val)) {
oglobals.continue_on_timeout = 1;
}
if ((var_val = switch_event_get_header(var_event, "ignore_ring_ready")) && switch_true(var_val)) {
oglobals.ignore_ring_ready = 1;
}
@ -2145,7 +2162,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
switch_core_session_reset(oglobals.session, SWITCH_FALSE, SWITCH_TRUE);
}
if ((oglobals.idx == IDX_TIMEOUT || oglobals.idx == IDX_KEY_CANCEL) && switch_channel_ready(caller_channel)) {
if ((oglobals.idx == IDX_TIMEOUT || oglobals.idx == IDX_KEY_CANCEL) && (caller_channel && switch_channel_ready(caller_channel))) {
holding = NULL;
}
@ -2465,6 +2482,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
if (ok) {
goto outer_for;
}
if (to && !oglobals.continue_on_timeout) {
goto outer_for;
}
}
}
}