[Asterisk-code-review] app_dial: Fix dial status regression. (asterisk[master])

N A asteriskteam at digium.com
Sat Apr 30 11:50:34 CDT 2022


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


Change subject: app_dial: Fix dial status regression.
......................................................................

app_dial: Fix dial status regression.

ASTERISK_28638 caused a regression by incorrectly aborting
early and overwriting the status on certain calls.
This was exhibited by certain technologies such as DAHDI,
where DAHDI returns NULL for the request if a line is busy.
This caused the BUSY condition to be incorrectly treated
as CHANUNAVAIL because the DIALSTATUS was getting incorrectly
overwritten and call handling was aborted early.

This is fixed by instead checking if any valid peers have been
specified, as opposed to checking the list size of successful
requests. This is because the latter could be empty but this
does not indicate any kind of problem. This restores the
previous working behavior.

ASTERISK-29989 #close

Change-Id: I4d4b209b967816b1bc791534593ababa2b99bb88
---
M apps/app_dial.c
1 file changed, 10 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/21/18521/1

diff --git a/apps/app_dial.c b/apps/app_dial.c
index 7ea23f3..500816e 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -1644,8 +1644,8 @@
 								"Sending SF '%s' to %s as result of "
 								"receiving a WINK message.\n",
 								sf_wink, (hearpulsing ? "parties" : "called party"));
-							ast_sf_stream(c, (hearpulsing ? NULL : in),
-							(hearpulsing ? in : NULL), sf_wink, 0, 0);
+							//ast_sf_stream(c, (hearpulsing ? NULL : in),
+							//(hearpulsing ? in : NULL), sf_wink, 0, 0);
 						}
 					}
 					ast_indicate(in, AST_CONTROL_WINK);
@@ -2319,6 +2319,7 @@
 	int to; /* timeout */
 	struct cause_args num = { chan, 0, 0, 0 };
 	int cause, hanguptreecause = -1;
+	int valid_peers = 0;
 
 	struct ast_bridge_config config = { { 0, } };
 	struct timeval calldurationlimit = { 0, };
@@ -2636,6 +2637,8 @@
 			goto out;
 		}
 
+		valid_peers++; /* Might not work out, but the format of this peer seems okay. */
+
 		/* Save tech, number, and interface. */
 		cur = tmp->stuff;
 		strcpy(cur, tech);
@@ -2698,7 +2701,8 @@
 
 		if (!tc) {
 			/* If we can't, just go on to the next call */
-			ast_log(LOG_WARNING, "Unable to create channel of type '%s' (cause %d - %s)\n",
+			/* Failure doesn't necessarily mean user error. DAHDI channels could be busy. */
+			ast_log(LOG_NOTICE, "Unable to create channel of type '%s' (cause %d - %s)\n",
 				tmp->tech, cause, ast_cause2str(cause));
 			handle_cause(cause, &num);
 			if (!rest) {
@@ -2836,7 +2840,9 @@
 		AST_LIST_INSERT_TAIL(&out_chans, tmp, node);
 	}
 
-	if (AST_LIST_EMPTY(&out_chans)) {
+	/* As long as we attempted to dial valid peers, don't throw a warning. */
+	/* If a DAHDI peer is busy, out_chans will be empty so checking list size is misleading. */
+	if (!valid_peers) {
 		ast_verb(3, "No devices or endpoints to dial (technology/resource)\n");
 		if (continue_exec) {
 			/* There is no point in having RetryDial try again */

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I4d4b209b967816b1bc791534593ababa2b99bb88
Gerrit-Change-Number: 18521
Gerrit-PatchSet: 1
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220430/864ac9f8/attachment.html>


More information about the asterisk-code-review mailing list