From 6f47fe7fe8a78f9b43b52106e75b0e5fbba1c074 Mon Sep 17 00:00:00 2001
From: Marc Olivier Chouinard <mochouinard@moctel.com>
Date: Mon, 19 Dec 2011 00:27:51 -0500
Subject: [PATCH] FS-3620 --resolve This look to be the same parsing done in
 lcr_app_function.  So I would think it an expected behavior and it good to
 have it at both place.

---
 src/mod/applications/mod_lcr/mod_lcr.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c
index 3c5062ed6f..d24aa2df1a 100644
--- a/src/mod/applications/mod_lcr/mod_lcr.c
+++ b/src/mod/applications/mod_lcr/mod_lcr.c
@@ -1535,7 +1535,14 @@ SWITCH_STANDARD_DIALPLAN(lcr_dialplan_hunt)
 
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "LCR Lookup on %s using profile %s\n", caller_profile->destination_number, caller_profile->context);
 	routes.lookup_number = caller_profile->destination_number;
-	routes.cid = (char *) caller_profile->caller_id_number;
+
+	if (caller_profile) {
+		routes.cid = (char *) switch_channel_get_variable(channel, "effective_caller_id_number");
+		if (!routes.cid) {
+			routes.cid = (char *) caller_profile->caller_id_number;
+		}
+	}
+
 	if (lcr_do_lookup(&routes) == SWITCH_STATUS_SUCCESS) {
 		if ((extension = switch_caller_extension_new(session, caller_profile->destination_number, caller_profile->destination_number)) == 0) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "memory error!\n");