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.
This commit is contained in:
Andreas Eversberg 2022-05-01 10:10:35 +02:00
parent ef4950bd66
commit e1dcbb89db
2 changed files with 7 additions and 6 deletions

View File

@ -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); PDEBUG(DDSS1, DEBUG_INFO, "Codec %s selected for transmission.\n", call->codec->payload_name);
/* get channel */ /* 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) { if (rc < 0) {
PDEBUG(DDSS1, DEBUG_NOTICE, "There is no channel available on the interface.\n"); PDEBUG(DDSS1, DEBUG_NOTICE, "There is no channel available on the interface.\n");
release_and_destroy(call, -rc, 0, 0); release_and_destroy(call, -rc, 0, 0);
return; return;
} }
channel = call->b_channel; /* must seize it, if we gave a channel, so that requested channel is stored in call instance */
exclusive = call->b_exclusive; if (channel)
seize_bchannel(call, channel, exclusive);
/* creating pid */ /* creating pid */
call->l3_pid = request_new_pid(call->isdn_ep->ml3); call->l3_pid = request_new_pid(call->isdn_ep->ml3);

View File

@ -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) { if (channel==-1 || call->b_channel==channel) {
call->b_exclusive = 1; // we are done call->b_exclusive = 1; // we are done
/* if channel was accepted, try to get it */ /* if channel was accepted, seize_bchannel shall simply return, because given channel is already set */
rc = seize_bchannel(call, channel, 1); // exclusively rc = seize_bchannel(call, call->b_channel, 1); // exclusively
if (rc < 0) { if (rc < 0) {
PDEBUG(DISDN, DEBUG_DEBUG, " -> result = replied channel not available\n"); PDEBUG(DISDN, DEBUG_DEBUG, " -> result = replied channel not available\n");
return -47; return -47;
@ -531,7 +531,7 @@ int open_bchannel_out(call_t *call, unsigned int cmd, int channel, int exclusive
return -111; // protocol error 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 rc = seize_bchannel(call, channel, 1); // exclusively
if (rc < 0) { if (rc < 0) {
PDEBUG(DISDN, DEBUG_DEBUG, " -> result = replied channel not available\n"); PDEBUG(DISDN, DEBUG_DEBUG, " -> result = replied channel not available\n");