From d03163bf5d6d915c1be44032a5392b33f1b49323 Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Tue, 16 Jun 2009 18:46:28 +0000 Subject: [PATCH] Fix multicast replication of sofia registrations (OKed by anthm) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13786 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/sofia.c | 20 +++++++++---------- src/mod/endpoints/mod_sofia/sofia_reg.c | 1 + .../mod_event_multicast/mod_event_multicast.c | 1 + 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index e5e97709ff..ac5b1deee0 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -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); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 32883ab39c..6c5a36e6dc 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -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); } diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index e5d7f4d96c..410f5e57ac 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -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;