From 890717f3052c9715e1ac6be08d9e5d77b55892be Mon Sep 17 00:00:00 2001
From: Richard Mudgett <rmudgett@digium.com>
Date: Mon, 27 Feb 2012 23:42:12 +0000
Subject: [PATCH] Fix callerid of Originated calls.

Thanks to Matt Riddell for tracking this down.

(closes issue ASTERISK-19385)
Reported by: ornix
........

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

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357096 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 main/channel.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/main/channel.c b/main/channel.c
index f4717cc3d7..3ec6ac4f32 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -5371,6 +5371,16 @@ struct ast_channel *__ast_request_and_dial(const char *type, struct ast_format_c
 		}
 	}
 
+	/*
+	 * I seems strange to set the CallerID on an outgoing call leg
+	 * to whom we are calling, but this function's callers are doing
+	 * various Originate methods.  This call leg goes to the local
+	 * user.  Once the local user answers, the dialplan needs to be
+	 * able to access the CallerID from the CALLERID function as if
+	 * the local user had placed this call.
+	 */
+	ast_set_callerid(chan, cid_num, cid_name, cid_num);
+
 	ast_set_flag(ast_channel_cdr(chan), AST_CDR_FLAG_ORIGINATED);
 	ast_party_connected_line_set_init(&connected, &chan->connected);
 	if (cid_num) {
-- 
GitLab