uint32_t span_max;
if (span_id) {
+ if (span_id >= ZAP_MAX_SPANS_INTERFACE) {
+ zap_log(ZAP_LOG_CRIT, "SPAN NOT DEFINED!\n");
+ *zchan = NULL;
+ return ZAP_FAIL;
+ }
+
if (globals.spans[span_id].active_count >= globals.spans[span_id].chan_count) {
zap_log(ZAP_LOG_CRIT, "All circuits are busy.\n");
*zchan = NULL;
zap_mutex_lock(globals.mutex);
- if (span_id && globals.spans[span_id].channel_request) {
- zap_log(ZAP_LOG_ERROR, "Individual channel selection not implemented on this span.\n");
- goto done;
- }
-
if (span_id < ZAP_MAX_SPANS_INTERFACE && chan_id < ZAP_MAX_CHANNELS_SPAN) {
zap_channel_t *check;
+ if (globals.spans[span_id].channel_request) {
+ zap_log(ZAP_LOG_ERROR, "Individual channel selection not implemented on this span.\n");
+ goto done;
+ }
+
check = &globals.spans[span_id].channels[chan_id];
if (zap_test_flag(check, ZAP_CHANNEL_SUSPENDED) ||
zap_log(ZAP_LOG_ERROR, "D-Chan Read Error!\n");
snprintf(span->last_error, sizeof(span->last_error), "D-Chan Read Error!");
if (++errs == 10) {
+ isdn_data->dchan->state = ZAP_CHANNEL_STATE_UP;
goto done;
}
}
} else {
if (zap_channel_open(span->span_id, i, &dchans[x]) == ZAP_SUCCESS) {
zap_log(ZAP_LOG_DEBUG, "opening d-channel #%d %d:%d\n", x, dchans[x]->span_id, dchans[x]->chan_id);
+ dchans[x]->state = ZAP_CHANNEL_STATE_UP;
x++;
}
}