]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
app_dial: Fix progress timeout calculation with no answer timeout.
authorNaveen Albert <asterisk@phreaknet.org>
Wed, 16 Oct 2024 21:46:42 +0000 (17:46 -0400)
committerAsterisk Development Team <asteriskteam@digium.com>
Thu, 14 Nov 2024 20:01:34 +0000 (20:01 +0000)
If to_answer is -1, simply comparing to see if the progress timeout
is smaller than the answer timeout to prefer it will fail. Add
an additional check that chooses the progress timeout if there is
no answer timeout (or as before, if the progress timeout is smaller).

Resolves: #821
(cherry picked from commit 6a07e8e0f11a088c1c74fa2f2b1f855d671c2765)

apps/app_dial.c

index 252539d615532b1e22fe79030f7874b50ccfc694..dec9284dd47d9133f1c1b7e8880ea03c5e693802 100644 (file)
@@ -1292,7 +1292,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in,
                }
 
                /* If progress timeout is active, use that if it's the shorter of the 2 timeouts. */
-               winner = ast_waitfor_n(watchers, pos, *to_progress > 0 && *to_progress < *to_answer ? to_progress : to_answer);
+               winner = ast_waitfor_n(watchers, pos, *to_progress > 0 && (*to_answer < 0 || *to_progress < *to_answer) ? to_progress : to_answer);
 
                AST_LIST_TRAVERSE(out_chans, o, node) {
                        int res = 0;