From 4c635d6142100ede5148f94dc8af7ebbb1edf52e Mon Sep 17 00:00:00 2001
From: Ken Rice <krice@freeswitch.org>
Date: Fri, 21 Feb 2014 16:44:07 -0600
Subject: [PATCH] FS-4620 --resolve expose to dl_to_user and dl_to_host as chan
 vars

---
 src/mod/endpoints/mod_dingaling/mod_dingaling.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c
index d862e574d4..d2f6f20641 100644
--- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c
+++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c
@@ -4249,6 +4249,22 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
 				}
 
 				tech_pvt->them = switch_core_session_strdup(session, ldl_session_get_callee(dlsession));
+
+				if (tech_pvt->them && (tmp = strdup(tech_pvt->them))) {
+					char *p, *q;
+
+					if ((p = strchr(tmp, '@'))) {
+						*p++ = '\0';
+						if ((q = strchr(p, '/'))) {
+							*q = '\0';
+						}
+						switch_channel_set_variable(channel, "dl_to_user", tmp);
+						switch_channel_set_variable(channel, "dl_to_host", p);
+					}
+
+					switch_safe_free(tmp);
+				}
+
 				tech_pvt->us = switch_core_session_strdup(session, ldl_session_get_caller(dlsession));
 
 				if (tech_pvt->us && (tmp = strdup(tech_pvt->us))) {