From c736cef310e9ce919ce0deea875932ec3625da99 Mon Sep 17 00:00:00 2001
From: Naveen Albert <asterisk@phreaknet.org>
Date: Thu, 2 Sep 2021 23:20:43 +0000
Subject: [PATCH] app_stack: Include current location if branch fails

Previously, the error emitted when app_stack tries
to branch to a dialplan location that doesn't exist
has included only the information about the attempted
branch in the error log. This adds the current location
as well so users can see where the branch failed in
the logs.

ASTERISK-29626

Change-Id: Ia23502ab2ad21485a1ac74295063a8f25a6df5ce
---
 apps/app_stack.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/apps/app_stack.c b/apps/app_stack.c
index 179694b7e4..3c857a9356 100644
--- a/apps/app_stack.c
+++ b/apps/app_stack.c
@@ -590,8 +590,8 @@ static int gosub_exec(struct ast_channel *chan, const char *data)
 	ast_channel_unlock(chan);
 
 	if (!ast_exists_extension(chan, dest_context, dest_exten, dest_priority, caller_id)) {
-		ast_log(LOG_ERROR, "Attempt to reach a non-existent destination for %s: (Context:%s, Extension:%s, Priority:%d)\n",
-			app_gosub, dest_context, dest_exten, dest_priority);
+		ast_log(LOG_ERROR, "%s attempted to reach non-existent destination '%s,%s,%d' from '%s,%s,%d'",
+			app_gosub, dest_context, dest_exten, dest_priority, orig_context, orig_exten, orig_priority);
 		goto error_exit;
 	}
 
-- 
GitLab