From 4ab3db97abf450ff759c500195556e205f1c3499 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Sun, 1 May 2022 10:10:35 +0200 Subject: [PATCH] Fixed issue in handling channel offer When (exclusive or suggested) channel is offered, we must "seize" it, so that it is linked with call instance. Still the channel might be changed on reply. --- src/isdn/dss1.c | 7 ++++--- src/isdn/isdn.c | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) 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 96ae0d5..ea9acf6 100644 --- a/src/isdn/isdn.c +++ b/src/isdn/isdn.c @@ -512,8 +512,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; @@ -532,7 +532,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");