Revision
15110
Author
anthm
Date
2009-10-07 17:35:21 -0500 (Wed, 07 Oct 2009)

Log Message

auto update displays in more places

Modified Paths

Diff

Modified: freeswitch/trunk/src/include/switch_caller.h (15109 => 15110)


--- freeswitch/trunk/src/include/switch_caller.h	2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/include/switch_caller.h	2009-10-07 22:35:21 UTC (rev 15110)
@@ -67,6 +67,10 @@
 	const char *caller_id_name;
 	/*! Caller ID Number */
 	const char *caller_id_number;
+	/*! Callee ID Name */
+	const char *callee_id_name;
+	/*! Callee ID Number */
+	const char *callee_id_number;
 	uint8_t caller_ton;
 	uint8_t caller_numplan;
 	/*! Caller Network Address (when applicable) */

Modified: freeswitch/trunk/src/include/switch_core.h (15109 => 15110)


--- freeswitch/trunk/src/include/switch_core.h	2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/include/switch_core.h	2009-10-07 22:35:21 UTC (rev 15110)
@@ -92,7 +92,7 @@
 	const char *_file;
 	const char *_func;
 	int _line;
-
+	const char *string_array_arg[10];
 };
 
 /*! \brief A generic object to pass as a thread's session object to allow mutiple arguements and a pool */

Modified: freeswitch/trunk/src/include/switch_ivr.h (15109 => 15110)


--- freeswitch/trunk/src/include/switch_ivr.h	2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/include/switch_ivr.h	2009-10-07 22:35:21 UTC (rev 15110)
@@ -408,6 +408,8 @@
 													 switch_originate_flag_t flags
 													 );
 
+SWITCH_DECLARE(void) switch_ivr_bridge_display(switch_core_session_t *session, switch_core_session_t *peer_session);
+
 /*!
   \brief Bridge Audio from one session to another
   \param session one session

Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (15109 => 15110)


--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	2009-10-07 22:35:21 UTC (rev 15110)
@@ -792,7 +792,7 @@
 	if (switch_strlen_zero(data)) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
 	} else {
-		name = switch_core_session_strdup(session, data);
+		name = switch_core_strdup(caller_profile->pool, data);
 		val = strchr(name, '=');
 
 		if (val) {
@@ -816,6 +816,12 @@
 		if (!strcasecmp(name, "caller_id_number")) {
 			caller_profile->caller_id_number = val;
 		}
+		if (!strcasecmp(name, "callee_id_name")) {
+			caller_profile->callee_id_name = val;
+		}
+		if (!strcasecmp(name, "callee_id_number")) {
+			caller_profile->callee_id_number = val;
+		}
 		if (val && !strcasecmp(name, "caller_ton")) {
 			caller_profile->caller_ton = (uint8_t) atoi(val);
 		}

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (15109 => 15110)


--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	2009-10-07 22:35:21 UTC (rev 15110)
@@ -175,7 +175,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-char * generate_pai_str(switch_core_session_t *session) 
+char *generate_pai_str(switch_core_session_t *session) 
 {
 	private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
 	const char *callee_name = NULL, *callee_number = NULL;
@@ -185,6 +185,12 @@
 		if (!(callee_number = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_number"))) {
 			callee_number = tech_pvt->caller_profile->destination_number;
 		}
+
+		if (!strchr(callee_number, '@')) {
+			char *tmp = switch_core_session_sprintf(session, "sip:%s@cluecon.com", callee_number);
+			callee_number = tmp;
+		}
+
 		pai = switch_core_session_sprintf(tech_pvt->session, "P-Asserted-Identity: \"%s\" <%s>", callee_name, callee_number);
 	}
 	return pai;
@@ -1257,20 +1263,46 @@
 
 	case SWITCH_MESSAGE_INDICATE_DISPLAY:
 		{
-			if (!switch_strlen_zero(msg->string_arg)) {
+			const char *name = msg->string_array_arg[0], *number = msg->string_array_arg[1];
+			char *arg = NULL;
+			char *argv[2] = { 0 };
+			int argc;
+			
+			if (switch_strlen_zero(name) && !switch_strlen_zero(msg->string_arg)) {
+				arg = strdup(msg->string_arg);
+				switch_assert(arg);
+
+				argc = switch_separate_string(arg, '|', argv, (sizeof(argv) / sizeof(argv[0])));
+				name = argv[0];
+				number = argv[1];
+
+			}
+
+
+			if (!switch_strlen_zero(name)) {
 				char message[256] = "";
 				const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
 
+				if (switch_strlen_zero(number)) {
+					number = tech_pvt->caller_profile->destination_number;
+				}
+
 				if (ua && switch_stristr("snom", ua)) {
-					snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", msg->string_arg, tech_pvt->caller_profile->destination_number);
-					nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
-				} else if (ua && switch_stristr("polycom", ua)) {
-					snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", msg->string_arg, tech_pvt->caller_profile->destination_number);
+					snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", name, number);
+					nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
+							 TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+							 SIPTAG_PAYLOAD_STR(message), TAG_END());
+				} else if (ua && (switch_stristr("polycom", ua) || switch_stristr("FreeSWITCH", ua))) {
+					snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", name, number);
 					nua_update(tech_pvt->nh,
 							   TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
+							   TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
 							   TAG_END());
 				}
+
 			}
+
+			switch_safe_free(arg);
 		}
 		break;
 
@@ -1284,11 +1316,14 @@
 
 				if (ua && switch_stristr("snom", ua)) {
 					snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", msg->string_arg, tech_pvt->caller_profile->destination_number);
-					nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
+					nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
+							 TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+							 SIPTAG_PAYLOAD_STR(message), TAG_END());
 				} else if (ua && switch_stristr("polycom", ua)) {
 					snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", msg->string_arg, tech_pvt->caller_profile->destination_number);
 					nua_update(tech_pvt->nh,
 							   TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
+							   TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
 							   TAG_END());
 				}
 			}
@@ -1553,6 +1588,10 @@
 
  end_lock:
 
+	if (msg->message_id == SWITCH_MESSAGE_INDICATE_ANSWER || msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
+		sofia_send_callee_id(session, NULL, NULL);
+	}
+
 	switch_mutex_unlock(tech_pvt->sofia_mutex);
 
   end:
@@ -2669,12 +2708,12 @@
 {
 	switch_call_cause_t cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 	switch_core_session_t *nsession = NULL;
-	char *data, *profile_name, *dest;
+	char *data, *profile_name, *dest, *dest_num = NULL;
 	sofia_profile_t *profile = NULL;
 	switch_caller_profile_t *caller_profile = NULL;
 	private_object_t *tech_pvt = NULL;
 	switch_channel_t *nchannel;
-	char *host = NULL, *dest_to = NULL;
+	char *host = NULL, *dest_to = NULL, *p;
 	const char *hval = NULL;
 
 	*new_session = NULL;
@@ -2894,8 +2933,16 @@
 	}
 	switch_channel_set_variable(nchannel, "sip_destination_url", tech_pvt->dest);
 
+	dest_num = switch_core_session_strdup(nsession, dest);
+	if ((p = strchr(dest_num, ':'))) {
+		dest_num = p + 1;
+		if ((p = strchr(dest_num, '@'))) {
+			*p = '\0';
+		}
+	}
+
 	caller_profile = switch_caller_profile_clone(nsession, outbound_profile);
-	caller_profile->destination_number = switch_core_strdup(caller_profile->pool, dest);
+	caller_profile->destination_number = switch_core_strdup(caller_profile->pool, dest_num);
 	switch_channel_set_caller_profile(nchannel, caller_profile);
 	switch_channel_set_flag(nchannel, CF_OUTBOUND);
 	sofia_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (15109 => 15110)


--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	2009-10-07 22:35:21 UTC (rev 15110)
@@ -147,7 +147,8 @@
 
 typedef enum {
 	MFLAG_REFER = (1 << 0),
-	MFLAG_REGISTER = (1 << 1)
+	MFLAG_REGISTER = (1 << 1),
+	MFLAG_UPDATE = (1 << 2)
 } MFLAGS;
 
 typedef enum {
@@ -910,3 +911,6 @@
 switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *user, const char *host, const char *event, const char *contenttype, const char *body, const char *o_contact, const char *network_ip);
 char *sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix);
 void sofia_glue_set_extra_headers(switch_channel_t *channel, sip_t const *sip, const char *prefix);
+void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg);
+void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *profile, sip_t const *sip, switch_bool_t send);
+void sofia_send_callee_id(switch_core_session_t *session, const char *name, const char *number);

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (15109 => 15110)


--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	2009-10-07 22:35:21 UTC (rev 15110)
@@ -52,8 +52,8 @@
 
 static void set_variable_sip_param(switch_channel_t *channel, char *header_type, sip_param_t const *params);
 
-static void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg);
 
+
 static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
 									 char const *phrase,
 									 nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
@@ -376,6 +376,105 @@
 	
 }
 
+void sofia_send_callee_id(switch_core_session_t *session, const char *name, const char *number) 
+{
+	const char *uuid;
+	switch_core_session_t *session_b;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_caller_profile_t *caller_profile = switch_channel_get_caller_profile(channel);
+
+
+	if (switch_strlen_zero(name)) {
+		name = caller_profile->callee_id_name;
+	}
+
+	if (switch_strlen_zero(number)) {
+		number = caller_profile->callee_id_number;
+	}
+
+	if (switch_strlen_zero(name)) {
+		name = "unknown";
+	}
+	
+	if (switch_strlen_zero(number)) {
+		number = caller_profile->destination_number;
+	}
+	
+	if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (session_b = switch_core_session_locate(uuid))) {
+		switch_core_session_message_t msg = { 0 };
+		
+		msg.message_id = SWITCH_MESSAGE_INDICATE_DISPLAY;
+		msg.string_array_arg[0] = name;
+		msg.string_array_arg[1] = number;
+		msg.from = __FILE__;
+		switch_core_session_receive_message(session_b, &msg);
+		switch_core_session_rwunlock(session_b);
+	}
+}
+
+void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *profile, sip_t const *sip, switch_bool_t send)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	sip_p_asserted_identity_t *passerted = NULL;
+	char *name = "unknown";
+	const char *number = "unknown", *tmp;
+	switch_caller_profile_t *caller_profile;
+	char *dup = NULL;
+
+	if (sip->sip_to) {
+		number = sip->sip_to->a_url->url_user;
+	}
+
+	if ((passerted = sip_p_asserted_identity(sip))) {
+		if (passerted->paid_url && passerted->paid_url->url_user) {
+			number = passerted->paid_url->url_user;
+		}
+		if (!switch_strlen_zero(passerted->paid_display)) {
+			dup = strdup(passerted->paid_display);
+			if (*dup == '"') {
+				name = dup + 1;
+			} else {
+				name = dup;
+			}
+			if (end_of(name) == '"') {
+				end_of(name) = '\0';
+			}
+		}
+	}
+
+	if ((tmp = switch_channel_get_variable(channel, "sip_callee_id_name"))) {
+		name = (char *)tmp;
+	}
+
+	if ((tmp = switch_channel_get_variable(channel, "sip_callee_id_number"))) {
+		number = tmp;
+	}
+
+	caller_profile = switch_channel_get_caller_profile(channel);
+	caller_profile->callee_id_name = switch_core_strdup(caller_profile->pool, name);
+	caller_profile->callee_id_number = switch_core_strdup(caller_profile->pool, number);
+
+	if (send) {
+		sofia_send_callee_id(session, NULL, NULL);
+	}
+
+	switch_safe_free(dup);
+}
+
+
+static void sofia_handle_sip_i_update(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[])
+{
+	if (!(profile->mflags & MFLAG_UPDATE)) {
+		nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
+		return;
+	}
+
+
+	sofia_update_callee_id(session, profile, sip, SWITCH_TRUE);
+}
+
+
+
 void sofia_event_callback(nua_event_t event,
 						  int status,
 						  char const *phrase,
@@ -540,6 +639,9 @@
 	case nua_i_info:
 		sofia_handle_sip_i_info(nua, profile, nh, session, sip, tags);
 		break;
+	case nua_i_update:
+		if (session) sofia_handle_sip_i_update(nua, profile, nh, session, sip, tags);
+		break;
 	case nua_r_update:
 		break;
 	case nua_r_refer:
@@ -896,7 +998,7 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created agent for %s\n", profile->name);
 
 	nua_set_params(profile->nua,
-				   SIPTAG_ALLOW_STR("INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO"),
+				   SIPTAG_ALLOW_STR("INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO"),
 				   NUTAG_APPL_METHOD("OPTIONS"),
 				   NUTAG_APPL_METHOD("REFER"),
 				   NUTAG_APPL_METHOD("REGISTER"),
@@ -910,6 +1012,7 @@
 				   NUTAG_ENABLEMESSENGER(1),
 				   TAG_IF((profile->mflags & MFLAG_REGISTER), NUTAG_ALLOW("REGISTER")),
 				   TAG_IF((profile->mflags & MFLAG_REFER), NUTAG_ALLOW("REFER")),
+				   TAG_IF((profile->mflags & MFLAG_UPDATE), NUTAG_ALLOW("UPDATE")),
 				   TAG_IF(!sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_ALLOW("PRACK")),
 				   NUTAG_ALLOW("INFO"),
 				   NUTAG_ALLOW("NOTIFY"),
@@ -945,6 +1048,7 @@
 					   NUTAG_AUTOALERT(0),
 					   TAG_IF((profile->mflags & MFLAG_REGISTER), NUTAG_ALLOW("REGISTER")),
 					   TAG_IF((profile->mflags & MFLAG_REFER), NUTAG_ALLOW("REFER")),
+					   TAG_IF((profile->mflags & MFLAG_UPDATE), NUTAG_ALLOW("UPDATE")),
 					   NUTAG_ALLOW("INFO"),
 					   TAG_IF(profile->pres_type, NUTAG_ALLOW("PUBLISH")),
 					   TAG_IF(profile->pres_type, NUTAG_ENABLEMESSAGE(1)),
@@ -2172,7 +2276,7 @@
 				switch_mutex_init(&profile->flag_mutex, SWITCH_MUTEX_NESTED, profile->pool);
 				profile->dtmf_duration = 100;
 				profile->tls_version = 0;
-				profile->mflags = MFLAG_REFER | MFLAG_REGISTER;
+				profile->mflags = MFLAG_REFER | MFLAG_REGISTER | MFLAG_UPDATE;
 				profile->rport_level = 1;
 				sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
 				sofia_set_pflag(profile, PFLAG_DISABLE_100REL);
@@ -2413,6 +2517,8 @@
 						profile->mflags &= ~MFLAG_REFER;
 					} else if (!strcasecmp(var, "disable-register") && switch_true(val)) {
 						profile->mflags &= ~MFLAG_REGISTER;
+					} else if (!strcasecmp(var, "disable-update") && switch_true(val)) {
+						profile->mflags &= ~MFLAG_UPDATE;
 					} else if (!strcasecmp(var, "media-option")) {
 						if (!strcasecmp(val, "resume-media-on-hold")) {
 							profile->media_options |= MEDIA_OPT_MEDIA_ON_HOLD;
@@ -2996,6 +3102,10 @@
 			}
 
 			sofia_glue_set_extra_headers(channel, sip, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
+
+			if (sip_p_asserted_identity(sip)) {
+				sofia_update_callee_id(session, profile, sip, SWITCH_FALSE);
+			}
 		}
 		
 		if (channel && sip && (status == 300 || status == 302 || status == 305) && switch_channel_test_flag(channel, CF_OUTBOUND)) {
@@ -4144,7 +4254,12 @@
 									moh = tmp;
 								}
 								//switch_channel_set_variable(a_channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE, "true");
-								switch_channel_set_variable_printf(a_channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE, "'endless_playback:%s':inline", moh);
+								if (moh) {
+									switch_channel_set_variable_printf(a_channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE, 
+																	   "'endless_playback:%s',park:inline", moh);
+								} else {
+									switch_channel_set_variable(a_channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE, "park:inline");
+								}
 								//switch_channel_set_variable_printf(a_channel, "park_command", "moh");
 								switch_core_session_rwunlock(a_session);
 							}
@@ -4157,8 +4272,8 @@
 							
 											  
 						} else if (br_a && br_b) {
-							switch_core_session_t *new_b_session = NULL, *a_session = NULL, *tmp = NULL;
-						
+							switch_core_session_t *tmp = NULL;
+							
 							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Attended Transfer [%s][%s]\n", 
 											  switch_str_nil(br_a),
 											  switch_str_nil(br_b));
@@ -4179,18 +4294,6 @@
 							switch_channel_set_variable(channel_b, "park_timeout", "2");
 							switch_channel_set_state(channel_b, CS_PARK);
 							
-
-							new_b_session = switch_core_session_locate(br_b);
-							a_session = switch_core_session_locate(br_a);
-							sofia_info_send_sipfrag(a_session, new_b_session);
-
-							if (new_b_session) {
-								switch_core_session_rwunlock(new_b_session);
-							}
-
-							if (a_session) {
-								switch_core_session_rwunlock(a_session);
-							}
 						} else {
 							if (!br_a && !br_b) {
 								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot transfer channels that are not in a bridge.\n");
@@ -5521,7 +5624,7 @@
 	nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
 }
 
-static void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg)
+void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg)
 {
 	private_object_t *b_tech_pvt = NULL, *a_tech_pvt = NULL;
 	char message[256] = "";
@@ -5542,7 +5645,10 @@
 				} else {
 					snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", acp->caller_id_name, acp->caller_id_number);
 				}
-				nua_info(b_tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
+				nua_info(b_tech_pvt->nh,
+						 SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
+						 TAG_IF(!switch_strlen_zero(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)),
+						 SIPTAG_PAYLOAD_STR(message), TAG_END());
 			} else if (ua && switch_stristr("polycom", ua)) {
 				if (switch_strlen_zero(acp->caller_id_name)) {
 					snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", acp->caller_id_number, acp->caller_id_number);
@@ -5551,6 +5657,7 @@
 				}
 				nua_update(b_tech_pvt->nh,
 						   TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
+						   TAG_IF(!switch_strlen_zero(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)),
 						   TAG_END());
 			}
 		}

Modified: freeswitch/trunk/src/switch_caller.c (15109 => 15110)


--- freeswitch/trunk/src/switch_caller.c	2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/switch_caller.c	2009-10-07 22:35:21 UTC (rev 15110)
@@ -78,7 +78,8 @@
 	profile_dup_clean(destination_number, profile->destination_number, pool);
 	profile->uuid = SWITCH_BLANK_STRING;
 	profile->chan_name = SWITCH_BLANK_STRING;
-
+	profile->callee_id_name = SWITCH_BLANK_STRING;
+	profile->callee_id_number = SWITCH_BLANK_STRING;
 	switch_set_flag(profile, SWITCH_CPF_SCREEN);
 	profile->pool = pool;
 	return profile;
@@ -95,6 +96,8 @@
 	profile_dup(tocopy->dialplan, profile->dialplan, pool);
 	profile_dup(tocopy->caller_id_name, profile->caller_id_name, pool);
 	profile_dup(tocopy->caller_id_number, profile->caller_id_number, pool);
+	profile_dup(tocopy->callee_id_name, profile->callee_id_name, pool);
+	profile_dup(tocopy->callee_id_number, profile->callee_id_number, pool);
 	profile_dup(tocopy->network_addr, profile->network_addr, pool);
 	profile_dup(tocopy->ani, profile->ani, pool);
 	profile_dup(tocopy->aniii, profile->aniii, pool);
@@ -139,15 +142,21 @@
 	if (!strcasecmp(name, "caller_id_name")) {
 		return caller_profile->caller_id_name;
 	}
+	if (!strcasecmp(name, "caller_id_number")) {
+		return caller_profile->caller_id_number;
+	}
+	if (!strcasecmp(name, "callee_id_name")) {
+		return caller_profile->callee_id_name;
+	}
+	if (!strcasecmp(name, "callee_id_number")) {
+		return caller_profile->callee_id_number;
+	}
 	if (!strcasecmp(name, "ani")) {
 		return caller_profile->ani;
 	}
 	if (!strcasecmp(name, "aniii")) {
 		return caller_profile->aniii;
 	}
-	if (!strcasecmp(name, "caller_id_number")) {
-		return caller_profile->caller_id_number;
-	}
 	if (!strcasecmp(name, "network_addr")) {
 		return caller_profile->network_addr;
 	}

Modified: freeswitch/trunk/src/switch_ivr_bridge.c (15109 => 15110)


--- freeswitch/trunk/src/switch_ivr_bridge.c	2009-10-07 14:47:15 UTC (rev 15109)
+++ freeswitch/trunk/src/switch_ivr_bridge.c	2009-10-07 22:35:21 UTC (rev 15110)
@@ -78,6 +78,58 @@
 }
 #endif
 
+
+static void send_display(switch_core_session_t *session, switch_core_session_t *peer_session) {
+
+	switch_core_session_message_t msg = { 0 };
+	switch_caller_profile_t *caller_profile;
+	switch_channel_t *caller_channel;
+	const char *name, *number;
+
+	caller_channel = switch_core_session_get_channel(session);
+	caller_profile = switch_channel_get_caller_profile(caller_channel);
+
+	if (switch_channel_direction(caller_channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
+		name = caller_profile->callee_id_name;
+		number = caller_profile->callee_id_number;
+		
+		if (switch_strlen_zero(name)) {
+			name = caller_profile->destination_number;
+		}
+		if (switch_strlen_zero(number)) {
+			number = caller_profile->destination_number;
+		}
+	} else {
+		name = caller_profile->caller_id_name;
+		number = caller_profile->caller_id_number;
+		
+		if (switch_strlen_zero(name)) {
+			name = caller_profile->destination_number;
+		}
+		if (switch_strlen_zero(number)) {
+			number = caller_profile->destination_number;
+		}
+	}
+
+
+	msg.message_id = SWITCH_MESSAGE_INDICATE_DISPLAY;
+	msg.string_array_arg[0] = name;
+	msg.string_array_arg[1] = number;
+	msg.from = __FILE__;
+	
+	switch_core_session_receive_message(peer_session, &msg);
+
+}
+
+
+SWITCH_DECLARE(void) switch_ivr_bridge_display(switch_core_session_t *session, switch_core_session_t *peer_session)
+{
+
+	send_display(session, peer_session);
+	send_display(peer_session, session);
+
+}
+
 struct switch_ivr_bridge_data {
 	switch_core_session_t *session;
 	char b_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
@@ -838,6 +890,8 @@
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Call has no media... Redirecting to signal bridge.\n");
 		return switch_ivr_signal_bridge(session, peer_session);
 	}
+	
+	switch_ivr_bridge_display(session, peer_session);
 
 	switch_channel_set_flag(caller_channel, CF_BRIDGE_ORIGINATOR);
 
@@ -1084,8 +1138,7 @@
 	switch_core_session_t *originator_session, *originatee_session, *swap_session;
 	switch_channel_t *originator_channel, *originatee_channel, *swap_channel;
 	switch_status_t status = SWITCH_STATUS_FALSE;
-	switch_caller_profile_t *cp, *originator_cp, *originatee_cp;
-	char *p;
+	switch_caller_profile_t *originator_cp, *originatee_cp;
 	switch_channel_state_t state;
 
 	if ((originator_session = switch_core_session_locate(originator_uuid))) {
@@ -1153,26 +1206,8 @@
 			switch_channel_set_variable(originator_channel, "original_caller_id_name", originator_cp->caller_id_name);
 			switch_channel_set_variable(originator_channel, "original_caller_id_number", originator_cp->caller_id_number);
 
-			cp = switch_caller_profile_clone(originatee_session, originatee_cp);
-			cp->destination_number = switch_core_strdup(cp->pool, originator_cp->caller_id_number);
-			cp->caller_id_number = switch_core_strdup(cp->pool, originator_cp->caller_id_number);
-			cp->caller_id_name = switch_core_strdup(cp->pool, originator_cp->caller_id_name);
-			cp->rdnis = switch_core_strdup(cp->pool, originatee_cp->destination_number);
-			if ((p = strchr(cp->rdnis, '@'))) {
-				*p = '\0';
-			}
-			switch_channel_set_caller_profile(originatee_channel, cp);
+
 			switch_channel_set_originator_caller_profile(originatee_channel, switch_caller_profile_clone(originatee_session, originator_cp));
-
-			cp = switch_caller_profile_clone(originator_session, originator_cp);
-			cp->destination_number = switch_core_strdup(cp->pool, originatee_cp->caller_id_number);
-			cp->caller_id_number = switch_core_strdup(cp->pool, originatee_cp->caller_id_number);
-			cp->caller_id_name = switch_core_strdup(cp->pool, originatee_cp->caller_id_name);
-			cp->rdnis = switch_core_strdup(cp->pool, originator_cp->destination_number);
-			if ((p = strchr(cp->rdnis, '@'))) {
-				*p = '\0';
-			}
-			switch_channel_set_caller_profile(originator_channel, cp);
 			switch_channel_set_originatee_caller_profile(originator_channel, switch_caller_profile_clone(originator_session, originatee_cp));
 
 			switch_channel_stop_broadcast(originator_channel);
@@ -1203,6 +1238,8 @@
 			
 			status = SWITCH_STATUS_SUCCESS;
 
+			switch_ivr_bridge_display(originator_session, originatee_session);
+
 			/* release the read locks we have on the channels */
 			switch_core_session_rwunlock(originator_session);
 			switch_core_session_rwunlock(originatee_session);