Project "FreeSWITCH Source" received a push.

branch: master updated

       via: 04bb74fcaeb72683754ed4b4d6df197a898887b7 (commit)
      from: 436413e0bb506a07758c60cdcf4a6be1adc0e575 (commit)


= COMMIT LOG ===========================================================
committer: Anthony Minessale
comments: 
FS-3050 FS-3051

diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c
index 76b1dcc..5109e0b 100644
--- a/src/mod/endpoints/mod_sofia/sofia_reg.c
+++ b/src/mod/endpoints/mod_sofia/sofia_reg.c
@@ -1543,6 +1543,8 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
 				}
 			}
 		} else {
+			switch_core_del_registration(to_user, reg_host, call_id);
+
 			if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) {
 				switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile-name", profile->name);
 				switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "from-user", to_user);
diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c
index ba92ebc..f54bd65 100644
--- a/src/switch_core_sqldb.c
+++ b/src/switch_core_sqldb.c
@@ -1625,7 +1625,7 @@ static char create_nat_sql[] =
 
 static char create_registrations_sql[] =
 	"CREATE TABLE registrations (\n"
-	"   user      VARCHAR(256),\n"
+	"   reg_user      VARCHAR(256),\n"
 	"   realm     VARCHAR(256),\n"
 	"   token     VARCHAR(256),\n"
 	"   url      TEXT,\n"
@@ -1635,7 +1635,7 @@ static char create_registrations_sql[] =
 	"   network_proto VARCHAR(256),\n"
 	"   hostname VARCHAR(256)\n"
 	");\n"
-	"create index regindex1 on registrations (user,real,hostname);\n";
+	"create index regindex1 on registrations (user,realm,hostname);\n";
 	
 
 SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, const char *realm, const char *token, const char *url, uint32_t expires, 
@@ -1653,7 +1653,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c
 	switch_cache_db_execute_sql(dbh, sql, NULL);
 	free(sql);
 
-	sql = switch_mprintf("insert into registrations (user,realm,token,url,expires,network_ip,network_port,network_proto,hostname) "
+	sql = switch_mprintf("insert into registrations (reg_user,realm,token,url,expires,network_ip,network_port,network_proto,hostname) "
 						 "values ('%q','%q','%q','%q',%ld,'%q','%q','%q','%q')",
 						 switch_str_nil(user),
 						 switch_str_nil(realm),
@@ -1685,7 +1685,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_del_registration(const char *user, c
 		return SWITCH_STATUS_FALSE;
 	}
 
-	sql = switch_mprintf("delete from registrations where user='%q' and realm='%q' and hostname='%q'", user, realm, switch_core_get_hostname());
+	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);
 	switch_cache_db_release_db_handle(&dbh);
@@ -1798,7 +1798,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
 	switch_cache_db_test_reactive(dbh, "select hostname from complete", "DROP TABLE complete", create_complete_sql);
 	switch_cache_db_test_reactive(dbh, "select hostname from aliases", "DROP TABLE aliases", create_alias_sql);
 	switch_cache_db_test_reactive(dbh, "select hostname from nat", "DROP TABLE nat", create_nat_sql);
-	switch_cache_db_test_reactive(dbh, "delete from registrations where network_proto='tcp' or network_proto='tls'", 
+	switch_cache_db_test_reactive(dbh, "delete from registrations where reg_user='' or network_proto='tcp' or network_proto='tls'", 
 								  "DROP TABLE registrations", create_registrations_sql);
 
 
@@ -1816,7 +1816,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
 			}
 			switch_cache_db_test_reactive(dbh, "select ikey from interfaces", "DROP TABLE interfaces", create_interfaces_sql);
 			switch_cache_db_test_reactive(dbh, "select hostname from tasks", "DROP TABLE tasks", create_tasks_sql);
-			switch_cache_db_test_reactive(dbh, "delete from registrations where network_proto='tcp' or network_proto='tls'", 
+			switch_cache_db_test_reactive(dbh, "delete from registrations where reg_user='' or network_proto='tcp' or network_proto='tls'", 
 										  "DROP TABLE registrations", create_registrations_sql);
 
 			if (runtime.odbc_dbtype == DBTYPE_DEFAULT) {
========================================================================

Summary of changes:
 src/mod/endpoints/mod_sofia/sofia_reg.c |    2 ++
 src/switch_core_sqldb.c                 |   12 ++++++------
 2 files changed, 8 insertions(+), 6 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