From d65de9c5c39bbc641adff2f9f2cd63dd1f229323 Mon Sep 17 00:00:00 2001
From: Tilghman Lesher <tilghman@meg.abyt.es>
Date: Tue, 28 Feb 2012 21:26:34 +0000
Subject: [PATCH] Correctly reset the dialplan priority.

When the stack frame is allocated, we save the address to which we should
return, when the Gosub returns.  However, if we just want to restore the
priority, then we need to subtract 1 before setting it.  Otherwise, when
a Gosub goes to a nonexistent address, it will skip a priority in the
dialplan.  This is because when we return from an application, the PBX
increments the priority for us.
........

Merged revisions 357416 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 357421 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357436 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 apps/app_stack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apps/app_stack.c b/apps/app_stack.c
index 06febbaeb7..0ae2f5a749 100644
--- a/apps/app_stack.c
+++ b/apps/app_stack.c
@@ -421,7 +421,7 @@ static int gosub_exec(struct ast_channel *chan, const char *data)
 				ast_channel_context(chan), ast_channel_exten(chan), ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP) ? ast_channel_priority(chan) + 1 : ast_channel_priority(chan));
 		ast_channel_context_set(chan, newframe->context);
 		ast_channel_exten_set(chan, newframe->extension);
-		ast_channel_priority_set(chan, newframe->priority);
+		ast_channel_priority_set(chan, newframe->priority - 1);
 		ast_free(newframe);
 		return -1;
 	}
-- 
GitLab