[Asterisk-code-review] chan_dahdi: Fix unavailable channels returning busy. (asterisk[16])

N A asteriskteam at digium.com
Wed Oct 26 07:43:44 CDT 2022


N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19457 )


Change subject: chan_dahdi: Fix unavailable channels returning busy.
......................................................................

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
---
M channels/chan_dahdi.c
1 file changed, 33 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/57/19457/1

diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index d59d26e..254e7a8 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -13659,6 +13659,7 @@
 	struct ast_channel *tmp = NULL;
 	struct dahdi_pvt *exitpvt;
 	int channelmatched = 0;
+	int foundowner = 0;
 	int groupmatched = 0;
 #if defined(HAVE_PRI) || defined(HAVE_SS7)
 	int transcapdigital = 0;
@@ -13682,6 +13683,10 @@
 		if (start.roundrobin)
 			round_robin[start.rr_starting_point] = p;
 
+		if (p->owner) {
+			foundowner++;
+		}
+
 		if (is_group_or_channel_match(p, start.span, start.groupmatch, &groupmatched, start.channelmatch, &channelmatched)
 			&& available(&p, channelmatched)) {
 			ast_debug(1, "Using channel %d\n", p->channel);
@@ -13800,7 +13805,7 @@
 	ast_mutex_unlock(&iflock);
 	restart_monitor();
 	if (cause && !tmp) {
-		if (callwait || channelmatched) {
+		if (callwait || (channelmatched && foundowner)) {
 			*cause = AST_CAUSE_BUSY;
 		} else if (groupmatched) {
 			*cause = AST_CAUSE_CONGESTION;

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19457
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Iad5870223c081240c925b19df8d6af136953b994
Gerrit-Change-Number: 19457
Gerrit-PatchSet: 1
Gerrit-Owner: N A <asterisk at phreaknet.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221026/a2aea6ac/attachment.html>


More information about the asterisk-code-review mailing list