[Freeswitch-svn] [commit] r13786 - in freeswitch/trunk/src/mod: endpoints/mod_sofia event_handlers/mod_event_multicast

FreeSWITCH SVN andrew at freeswitch.org
Tue Jun 16 11:46:28 PDT 2009


Author: andrew
Date: Tue Jun 16 13:46:28 2009
New Revision: 13786

Log:
Fix multicast replication of sofia registrations (OKed by anthm)


Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
   freeswitch/trunk/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Tue Jun 16 13:46:28 2009
@@ -590,15 +590,15 @@
 		char *exp_str = switch_event_get_header(event, "orig-expires");
 		char *rpid = switch_event_get_header(event, "orig-rpid");
 		char *call_id = switch_event_get_header(event, "orig-call-id");
-		char *user_agent = switch_event_get_header(event, "user-agent");
+		char *user_agent = switch_event_get_header(event, "orig-user-agent");
 		long expires = (long) switch_epoch_time_now(NULL);
 		char *profile_name = switch_event_get_header(event, "orig-profile-name");
 		char *to_user = switch_event_get_header(event, "orig-to-user");
-		char *presence_hosts = switch_event_get_header(event, "presence-hosts");
-		char *network_ip = switch_event_get_header(event, "network-ip");
-		char *network_port = switch_event_get_header(event, "network-port");
-		char *username = switch_event_get_header(event, "username");
-		char *realm = switch_event_get_header(event, "realm");
+		char *presence_hosts = switch_event_get_header(event, "orig-presence-hosts");
+		char *network_ip = switch_event_get_header(event, "orig-network-ip");
+		char *network_port = switch_event_get_header(event, "orig-network-port");
+		char *username = switch_event_get_header(event, "orig-username");
+		char *realm = switch_event_get_header(event, "orig-realm");
 
 		
 		sofia_profile_t *profile = NULL;
@@ -628,11 +628,11 @@
 		
 		switch_find_local_ip(guess_ip4, sizeof(guess_ip4), NULL, AF_INET);
 		sql = switch_mprintf("insert into sip_registrations "
-							 "(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires,"
-							 "user_agent,server_user,server_host,profile_name,hostname,network_ip,network_port,sip_username,sip_realm) "
-							 "values ('%q', '%q','%q','%q','Registered', '%q', %ld, '%q', '%q', '%q','%q','%q','%q','%q','%q','%q')",
+							 "(call_id, sip_user, sip_host, presence_hosts, contact, status, rpid, expires,"
+							 "user_agent, server_user, server_host, profile_name, hostname, network_ip, network_port, sip_username, sip_realm) "
+							 "values ('%q','%q','%q','%q','%q','Registered','%q',%ld, '%q','%q','%q','%q','%q','%q','%q','%q','%q')",
 							 call_id, from_user, from_host, presence_hosts, contact_str, rpid, expires, user_agent, to_user, guess_ip4, 
-							 profile_name,mod_sofia_globals.hostname, network_ip, network_port, username, realm);
+							 profile_name, mod_sofia_globals.hostname, network_ip, network_port, username, realm);
 
 		if (sql) {
 			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_reg.c	Tue Jun 16 13:46:28 2009
@@ -1126,6 +1126,7 @@
 			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "network-port", network_port_c);
 			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "username", username);
 			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "realm", realm);
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "user-agent", agent);
 			switch_event_fire(&s_event);
 		}
 

Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c	Tue Jun 16 13:46:28 2009
@@ -326,6 +326,7 @@
 							term++;
 						}
 					}
+					switch_url_decode(val);
 					switch_snprintf(tmpname, sizeof(tmpname), "Orig-%s", var);
 					switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, tmpname, val);
 					var = term + 1;



More information about the Freeswitch-svn mailing list