[Asterisk-code-review] app_dial: Prevent call from hanging (asterisk[master])

N A asteriskteam at digium.com
Fri Aug 6 16:25:05 CDT 2021


Attention is currently required from: Joshua Colp.
N A has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/15985 )

Change subject: app_dial: Prevent call from hanging
......................................................................


Patch Set 2:

(1 comment)

File apps/app_dial.c:

https://gerrit.asterisk.org/c/asterisk/+/15985/comment/78c9fe8b_6ad70485 
PS2, Line 1802: 						if (ast_check_hangup_locked(o->chan)) {
> A hangup is generally detected by the channel being read using ast_read, and it returning NULL. […]
Using frame trace, I can confirm in this situation that a barrage of VOICE frames will always be present in the infinite loop, thus allowing this infinite loop to continue if the only check is for a null frame. Is this something that isn't supposed to happen? Otherwise, app_dial will try to pull frames forever when the channel's already gone.

0.07/0.08s seems to be the consistent cutoff for this issue to appear, so something needs ~80ms+ for things to work properly, *IF* the channel hasn't been answered yet.

Here is something I *can* say for sure: https://github.com/asterisk/asterisk/blob/master/apps/app_dial.c#L1276

pos is 1 at >= 0.08s wait, and 2 at < 0.08s, which leads to an infinite loop. It stays 2 forever, and the code to give up (which should be what it executes) requires that pos be 1. So, this means that this is returning an item when it shouldn't be:

AST_LIST_TRAVERSE(out_chans, o, node) {
	/* Keep track of important channels */
	if (ast_test_flag64(o, DIAL_STILLGOING) && o->chan)
	watchers[pos++] = o->chan;
        numlines++;
}



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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I6f2ee3f77b892015bc05513d868f071f279a3c80
Gerrit-Change-Number: 15985
Gerrit-PatchSet: 2
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Attention: Joshua Colp <jcolp at sangoma.com>
Gerrit-Comment-Date: Fri, 06 Aug 2021 21:25:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Joshua Colp <jcolp at sangoma.com>
Comment-In-Reply-To: N A <mail at interlinked.x10host.com>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20210806/90d1f5fd/attachment.html>


More information about the asterisk-code-review mailing list