Skip to content

Commit ea3b520

Browse files
InterLinked1gtjoseph
authored andcommitted
app_if: Fix next priority calculation.
Commit fa3922a fixed a branching issue but "overshoots" when calculating the next priority. This fixes that; accompanying test suite tests have also been extended. Resolves: #560
1 parent b916e9c commit ea3b520

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

apps/app_if.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,11 @@ static int if_helper(struct ast_channel *chan, const char *data, int end)
286286
snprintf(end_varname,sizeof(end_varname),"END_%s",varname);
287287
ast_channel_lock(chan);
288288
/* For EndIf, simply go to the next priority.
289+
* We do not add 1 to ast_channel_priority because the dialplan will
290+
* auto-increment the priority when we return, so just keep the priority as is.
289291
* For ExitIf or false If() condition, we need to find the end of the current
290292
* If branch (at same indentation) and branch there. */
291-
endifpri = end == 2 ? ast_channel_priority(chan) + 1 : find_matching_endif(chan, NULL);
293+
endifpri = end == 2 ? ast_channel_priority(chan) : find_matching_endif(chan, NULL);
292294
if ((goto_str = pbx_builtin_getvar_helper(chan, end_varname))) {
293295
ast_parseable_goto(chan, goto_str);
294296
pbx_builtin_setvar_helper(chan, end_varname, NULL);

0 commit comments

Comments
 (0)