const char *soft_holding = NULL;
early_state_t early_state = { 0 };
int read_packet = 0;
+ int check_reject = 1;
if (strstr(bridgeto, SWITCH_ENT_ORIGINATE_DELIM)) {
return switch_ivr_enterprise_originate(session, bleg, cause, bridgeto, timelimit_sec, table, cid_name_override, cid_num_override,
If the value is set to 'true' any fail cause will end the attempt otherwise it can contain a comma (,) separated
list of cause names which should be considered fatal
*/
- if ((var = switch_event_get_header(var_event, "fail_on_single_reject")) && switch_true(var)) {
+ if ((var = switch_event_get_header(var_event, "fail_on_single_reject"))) {
fail_on_single_reject_var = strdup(var);
- fail_on_single_reject = 1;
+ if (switch_true(var)) {
+ fail_on_single_reject = 1;
+ } else {
+ fail_on_single_reject = -1;
+ }
}
if ((*oglobals.file != '\0') && (!strcmp(oglobals.file, "undef"))) {
char *p, *end = NULL;
const char *var_begin, *var_end;
int q = 0;
+ check_reject = 1;
+
oglobals.hups = 0;
reason = SWITCH_CAUSE_NONE;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot create outgoing channel of type [%s] cause: [%s]\n",
chan_type, switch_channel_cause2str(reason));
if (local_var_event) switch_event_destroy(&local_var_event);
+
+ if (fail_on_single_reject_var) {
+ const char *cause_str = switch_channel_cause2str(reason);
+ check_reject = 0;
+
+ if (fail_on_single_reject == 1 || switch_stristr(cause_str, fail_on_single_reject_var)) {
+ goto outer_for;
+ }
+ }
continue;
}
}
goto notready;
}
-
+
if ((to = (uint8_t) (elapsed >= (time_t) timelimit_sec)) || (fail_on_single_reject && oglobals.hups)) {
int ok = 0;
- if (fail_on_single_reject_var && !switch_true(fail_on_single_reject_var)) {
- ok = 1;
- for (i = 0; i < and_argc; i++) {
- switch_channel_t *pchannel;
- const char *cause_str;
+ if (fail_on_single_reject_var) {
+ if (!switch_true(fail_on_single_reject_var)) {
+ ok = 1;
- if (!originate_status[i].peer_session) {
- goto do_continue;
- }
- pchannel = switch_core_session_get_channel(originate_status[i].peer_session);
+ for (i = 0; i < and_argc; i++) {
+ switch_channel_t *pchannel;
+ const char *cause_str;
+
+ if (!originate_status[i].peer_session) {
+ continue;
+ }
+ pchannel = switch_core_session_get_channel(originate_status[i].peer_session);
- if (switch_channel_down(pchannel)) {
- cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel));
- if (switch_stristr(cause_str, fail_on_single_reject_var)) {
- ok = 0;
- break;
+ if (switch_channel_down(pchannel)) {
+ cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel));
+ if (switch_stristr(cause_str, fail_on_single_reject_var)) {
+ ok = 0;
+ break;
+ }
}
}
}
} else {
int ok = 0;
- if (fail_on_single_reject_var && !switch_true(fail_on_single_reject_var)) {
- ok = 1;
- for (i = 0; i < and_argc; i++) {
- switch_channel_t *pchannel;
- const char *cause_str;
+ if (fail_on_single_reject && check_reject) {
- if (!originate_status[i].peer_session) {
- continue;
- }
- pchannel = switch_core_session_get_channel(originate_status[i].peer_session);
+ if (!switch_true(fail_on_single_reject_var)) {
+ ok = 1;
- if (switch_channel_down(pchannel)) {
- cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel));
- if (switch_stristr(cause_str, fail_on_single_reject_var)) {
- ok = 0;
- break;
+ for (i = 0; i < and_argc; i++) {
+ switch_channel_t *pchannel;
+ const char *cause_str;
+
+ if (!originate_status[i].peer_session) {
+ continue;
+ }
+ pchannel = switch_core_session_get_channel(originate_status[i].peer_session);
+
+ if (switch_channel_down(pchannel)) {
+ cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel));
+ if (switch_stristr(cause_str, fail_on_single_reject_var)) {
+ ok = 0;
+ break;
+ }
}
}
}
}
+
if (ok) {
goto outer_for;
}