From 4b62ff799e00a30fb898ddea2633d928d0d24eeb Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 17 Feb 2011 11:32:00 -0600 Subject: [PATCH 1/3] put transport in the request uri on outbound registers if register_transport is set and proxy does not already contain a transport param --- src/mod/endpoints/mod_sofia/sofia.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 825d1bf46e..e9d2cada2e 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2148,8 +2148,13 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) if (!zstr(from_domain)) { gateway->from_domain = switch_core_strdup(gateway->pool, from_domain); } + + if (!zstr(register_transport) && !switch_stristr("transport=", proxy)) { + gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s;transport=%s", proxy, register_transport); + } else { + gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s", proxy); + } - gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s", proxy); gateway->register_from = switch_core_sprintf(gateway->pool, "", from_user, !zstr(from_domain) ? from_domain : proxy, register_transport); From b36a7c0ba6381699cc9dbbc096aef90bea1ad4d3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 17 Feb 2011 12:12:43 -0600 Subject: [PATCH 2/3] add multiple-registrations flag to the core similar to mod_sofia --- src/include/private/switch_core_pvt.h | 1 + src/switch_core.c | 2 ++ src/switch_core_sqldb.c | 9 ++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index f8c6a794b9..ab0777ed3b 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -248,6 +248,7 @@ struct switch_runtime { int max_sql_buffer_len; switch_dbtype_t odbc_dbtype; char hostname[256]; + int multiple_registrations; }; extern struct switch_runtime runtime; diff --git a/src/switch_core.c b/src/switch_core.c index 66731b61c8..5479229100 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1549,6 +1549,8 @@ static void switch_load_core_config(const char *file) if (tmp > -1 && tmp < 11) { switch_core_session_ctl(SCSC_DEBUG_LEVEL, &tmp); } + } else if (!strcasecmp(var, "multiple-registrations")) { + runtime.multiple_registrations = switch_true(val); } else if (!strcasecmp(var, "sql-buffer-len")) { int tmp = atoi(val); diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index f135e9586d..1274213893 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1653,7 +1653,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c return SWITCH_STATUS_FALSE; } - sql = switch_mprintf("delete from registrations where hostname='%q' and (url='%q' or token='%q')", switch_core_get_hostname(), url, switch_str_nil(token)); + if (runtime.multiple_registrations) { + sql = switch_mprintf("delete from registrations where hostname='%q' and (url='%q' or token='%q')", + switch_core_get_hostname(), url, switch_str_nil(token)); + } else { + sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q'", + user, realm, switch_core_get_hostname()); + } + switch_cache_db_execute_sql(dbh, sql, NULL); free(sql); From 28242f871ac338876ffafa79dd677485d2ce0f5e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 17 Feb 2011 12:14:48 -0600 Subject: [PATCH 3/3] add multiple-registrations flag to the core similar to mod_sofia --- conf/autoload_configs/switch.conf.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/conf/autoload_configs/switch.conf.xml b/conf/autoload_configs/switch.conf.xml index 95c43331e4..4f72c6a65d 100644 --- a/conf/autoload_configs/switch.conf.xml +++ b/conf/autoload_configs/switch.conf.xml @@ -98,7 +98,9 @@ - + + +