[Freeswitch-svn] [commit] r8739 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Mon Jun 2 12:40:44 EDT 2008


Author: anthm
Date: Mon Jun  2 12:40:44 2008
New Revision: 8739

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c

Log:
wait there's more

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_presence.c	Mon Jun  2 12:40:44 2008
@@ -413,7 +413,8 @@
 
 			if (probe_euser && probe_host && (profile = sofia_glue_find_profile(probe_host))) {
 				sql = switch_mprintf("select sip_registrations.sip_user, sip_registrations.sip_host, sip_registrations.status, "
-									 "sip_registrations.rpid,'', sip_dialogs.uuid, sip_dialogs.state, sip_dialogs.direction "
+									 "sip_registrations.rpid,'', sip_dialogs.uuid, sip_dialogs.state, sip_dialogs.direction, "
+									 "sip_dialogs.sip_to_user, sip_dialogs.sip_to_host "
 									 "from sip_registrations left join sip_dialogs on "
 									 "(sip_dialogs.sip_from_user = sip_registrations.sip_user) "
 									 "and sip_dialogs.sip_from_host = sip_registrations.sip_host "
@@ -668,15 +669,22 @@
 	char *status = argv[2];
 	char *rpid = argv[3];
 	char *proto = argv[4];
+	char *to_user = NULL;
 	char *uuid = NULL;
 	char *state = NULL;
 	char *direction = NULL;
 	switch_event_t *event;
+	char to_buf[128] = "";
 
 	if (argc > 5) {
 		uuid = switch_str_nil(argv[5]);
 		state = switch_str_nil(argv[6]);
 		direction = switch_str_nil(argv[7]);
+		if (argc > 8) {
+			switch_set_string(to_buf, argv[8]);
+			switch_url_decode(to_buf);
+			to_user = to_buf;
+		}
 	}
 
 	if (switch_strlen_zero(proto)) {
@@ -693,6 +701,10 @@
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog");
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", 0);
 
+		if (!switch_strlen_zero(to_user)) {
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "to-user", "%s", to_user);
+		}
+
 		if (switch_strlen_zero(state)) {
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "unique-id", "%s", SOFIA_CHAT_PROTO);
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-state", "%s", "CS_HANGUP");
@@ -875,8 +887,8 @@
 		const char *from_user = switch_str_nil(switch_event_get_header(helper->event, "variable_sip_from_user"));
 		const char *clean_to_user = NULL;
 		const char *clean_from_user = NULL;
-
-
+		const char *p_to_user = switch_str_nil(switch_event_get_header(helper->event, "to-user"));
+		
 		if (is_dialog) {
 			SWITCH_STANDARD_STREAM(stream);
 		}
@@ -1012,6 +1024,10 @@
 					}
 
 					if (switch_strlen_zero(from_id)) {
+						from_id = p_to_user;
+					}
+					
+					if (switch_strlen_zero(from_id)) {
 						switch_snprintf(status_line, sizeof(status_line), "On The Phone");
 					} else {
 						switch_snprintf(status_line, sizeof(status_line), "Talk %s", switch_str_nil(from_id));



More information about the Freeswitch-svn mailing list