Project "FreeSWITCH Source" received a push.

branch: master updated

       via: b36a7c0ba6381699cc9dbbc096aef90bea1ad4d3 (commit)
      from: 4b62ff799e00a30fb898ddea2633d928d0d24eeb (commit)


= COMMIT LOG ===========================================================
committer: Anthony Minessale
comments: 
add multiple-registrations flag to the core similar to mod_sofia

diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h
index f8c6a79..ab0777e 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 66731b6..5479229 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 f135e95..1274213 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);
 
========================================================================

Summary of changes:
 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 deletions(-)

this email was generated because of /git/your-repo.git/hooks/post-receive by the file /git-core/contrib/hooks/post-receive-email
For more info, see http://blog.chomperstomp.com/?p=630 --
FreeSWITCH Source