Skip to content

Commit e4117d7

Browse files
InterLinked1Friendly Automation
authored and
Friendly Automation
committed
chan_dahdi: Fix unavailable channels returning busy.
This fixes dahdi_request to properly set the cause code to CONGESTION instead of BUSY if no channels were actually available. Currently, the cause is erroneously set to busy if the channel itself is found, regardless of its current state. However, if the channel is not available (e.g. T1 down, card not operable, etc.), then the channel itself may not be in a functional state, in which case CHANUNAVAIL is the correct cause to use. This adds a simple check to ensure that busy tone is only returned if a channel is encountered that has an owner, since that is the only possible way that a channel could actually be busy. ASTERISK-30274 #close Change-Id: Iad5870223c081240c925b19df8d6af136953b994
1 parent f66f77f commit e4117d7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

channels/chan_dahdi.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -13652,6 +13652,7 @@ static struct ast_channel *dahdi_request(const char *type, struct ast_format_cap
1365213652
struct ast_channel *tmp = NULL;
1365313653
struct dahdi_pvt *exitpvt;
1365413654
int channelmatched = 0;
13655+
int foundowner = 0;
1365513656
int groupmatched = 0;
1365613657
#if defined(HAVE_PRI) || defined(HAVE_SS7)
1365713658
int transcapdigital = 0;
@@ -13675,6 +13676,10 @@ static struct ast_channel *dahdi_request(const char *type, struct ast_format_cap
1367513676
if (start.roundrobin)
1367613677
round_robin[start.rr_starting_point] = p;
1367713678

13679+
if (p->owner) {
13680+
foundowner++;
13681+
}
13682+
1367813683
if (is_group_or_channel_match(p, start.span, start.groupmatch, &groupmatched, start.channelmatch, &channelmatched)
1367913684
&& available(&p, channelmatched)) {
1368013685
ast_debug(1, "Using channel %d\n", p->channel);
@@ -13793,7 +13798,7 @@ static struct ast_channel *dahdi_request(const char *type, struct ast_format_cap
1379313798
ast_mutex_unlock(&iflock);
1379413799
restart_monitor();
1379513800
if (cause && !tmp) {
13796-
if (callwait || channelmatched) {
13801+
if (callwait || (channelmatched && foundowner)) {
1379713802
*cause = AST_CAUSE_BUSY;
1379813803
} else if (groupmatched) {
1379913804
*cause = AST_CAUSE_CONGESTION;

0 commit comments

Comments
 (0)