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);
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;
}
{
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));
/*
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;
int monitor_early_media_ring_count;
int monitor_early_media_ring_total;
int cancel_timeout;
+ int continue_on_timeout;
} originate_global_t;
switch_core_session_set_read_codec(session, &write_codec);
}
}
-
+
if (ringback_data) {
char *tmp_data = NULL;
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);
}
}
}
+ if (timelimit_sec <= 0) {
+ timelimit_sec = 60;
+ }
+
oglobals.idx = IDX_NADA;
oglobals.early_ok = 1;
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")) {
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;
}
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;
}
if (ok) {
goto outer_for;
}
+
+ if (to && !oglobals.continue_on_timeout) {
+ goto outer_for;
+ }
}
}
}