for(i = 1; i <= span->chan_count; i++) {
if (span->channels[i].type == ZAP_CHAN_TYPE_DQ921) {
- 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);
- x++;
+ if (x > 1) {
+ snprintf(span->last_error, sizeof(span->last_error), "Span has more than 2 D-Channels!");
+ return ZAP_FAIL;
+ } 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);
+ x++;
+ }
}
}
}