]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Fix multicast replication of sofia registrations (OKed by anthm)
authorAndrew Thompson <andrew@hijacked.us>
Tue, 16 Jun 2009 18:46:28 +0000 (18:46 +0000)
committerAndrew Thompson <andrew@hijacked.us>
Tue, 16 Jun 2009 18:46:28 +0000 (18:46 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13786 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_reg.c
src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c

index e5e97709ff9ce5534be93cbac35f99bdb2b0c59b..ac5b1deee02a9969e43b9be664067678c8fda7ff 100644 (file)
@@ -590,15 +590,15 @@ void event_handler(switch_event_t *event)
                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 @@ void event_handler(switch_event_t *event)
                
                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);
index 32883ab39c443ca7c0c458483f60cebffb6ee92f..6c5a36e6dcca710176fee08c3ed2c71b81ddfb49 100644 (file)
@@ -1126,6 +1126,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
                        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);
                }
 
index e5d7f4d96c14eff356b63c536ec32da28364b3bd..410f5e57aca2059450eebff026e058e458dcdfa1 100644 (file)
@@ -326,6 +326,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_multicast_runtime)
                                                        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;