+ *channel = CHANNEL_NO;
+ break;
+
+ default:
+ if (selchannel->channel<1 || selchannel->channel==16) {
+ trace_header("CHANNEL SELECTION (channel out of range)", DIRECTION_NONE);
+ add_trace("port", NULL, "%d", ifport->portnum);
+ add_trace("position", NULL, "%d", index);
+ add_trace("channel", NULL, "%d", selchannel->channel);
+ end_trace();
+ break; /* invalid channels */
+ }
+ i = selchannel->channel-1-(selchannel->channel>=17);
+ if (i >= mISDNport->b_num) {
+ trace_header("CHANNEL SELECTION (channel out of range)", DIRECTION_NONE);
+ add_trace("port", NULL, "%d", ifport->portnum);
+ add_trace("position", NULL, "%d", index);
+ add_trace("channel", NULL, "%d", selchannel->channel);
+ add_trace("channels", NULL, "%d", mISDNport->b_num);
+ end_trace();
+ break; /* channel not in port */
+ }
+ if (mISDNport->b_port[i] == NULL) {
+ *channel = selchannel->channel;
+ trace_header("CHANNEL SELECTION (selecting given channel)", DIRECTION_NONE);
+ add_trace("port", NULL, "%d", ifport->portnum);
+ add_trace("position", NULL, "%d", index);
+ add_trace("channel", NULL, "%d", *channel);
+ end_trace();
+ break;
+ }