diff --git a/src/isdn/dss1.c b/src/isdn/dss1.c index 6e0df2b..474febe 100644 --- a/src/isdn/dss1.c +++ b/src/isdn/dss1.c @@ -1516,14 +1516,15 @@ void setup_req(call_t *call, osmo_cc_msg_t *msg) PDEBUG(DDSS1, DEBUG_INFO, "Codec %s selected for transmission.\n", call->codec->payload_name); /* get channel */ - rc = hunt_bchannel_out(call->isdn_ep, &call->b_channel, &call->b_exclusive); + rc = hunt_bchannel_out(call->isdn_ep, &channel, &exclusive); if (rc < 0) { PDEBUG(DDSS1, DEBUG_NOTICE, "There is no channel available on the interface.\n"); release_and_destroy(call, -rc, 0, 0); return; } - channel = call->b_channel; - exclusive = call->b_exclusive; + /* must seize it, if we gave a channel, so that requested channel is stored in call instance */ + if (channel) + seize_bchannel(call, channel, exclusive); /* creating pid */ call->l3_pid = request_new_pid(call->isdn_ep->ml3); diff --git a/src/isdn/isdn.c b/src/isdn/isdn.c index e52f31c..04d2d13 100644 --- a/src/isdn/isdn.c +++ b/src/isdn/isdn.c @@ -511,8 +511,8 @@ int open_bchannel_out(call_t *call, unsigned int cmd, int channel, int exclusive if (channel==-1 || call->b_channel==channel) { call->b_exclusive = 1; // we are done - /* if channel was accepted, try to get it */ - rc = seize_bchannel(call, channel, 1); // exclusively + /* if channel was accepted, seize_bchannel shall simply return, because given channel is already set */ + rc = seize_bchannel(call, call->b_channel, 1); // exclusively if (rc < 0) { PDEBUG(DISDN, DEBUG_DEBUG, " -> result = replied channel not available\n"); return -47; @@ -531,7 +531,7 @@ int open_bchannel_out(call_t *call, unsigned int cmd, int channel, int exclusive return -111; // protocol error } - /* if channel was not accepted, try to get it */ + /* if channel was not accepted, try to get a different one */ rc = seize_bchannel(call, channel, 1); // exclusively if (rc < 0) { PDEBUG(DISDN, DEBUG_DEBUG, " -> result = replied channel not available\n");