From 350aaac04b6cff28f7752f8b157b904d48259e8c Mon Sep 17 00:00:00 2001
From: "Kevin P. Fleming" <kpfleming@digium.com>
Date: Wed, 5 Oct 2005 21:18:28 +0000
Subject: [PATCH] properly report hangupcause when ast_request() fails for the
 last (or only) target of a dial operation (issue #5394, different fix)

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

diff --git a/apps/app_dial.c b/apps/app_dial.c
index e25f2d6daa..ac579fe94b 100755
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -1109,6 +1109,8 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
 			ast_log(LOG_NOTICE, "Unable to create channel of type '%s' (cause %d - %s)\n", tech, cause, ast_cause2str(cause));
 			HANDLE_CAUSE(cause, chan);
 			cur = rest;
+			if (!cur)
+				chan->hangupcause = cause;
 			continue;
 		}
 		pbx_builtin_setvar_helper(tmp->chan, "DIALEDPEERNUMBER", numsubst);
-- 
GitLab