via: ea29a1dfcc53729af1e7798050a62566700d99fa (commit)
from: f202328effa33588b3766a63ca0a7f6ab835ef76 (commit)
= COMMIT LOG ===========================================================
committer: Mathieu Parent
comments:
centralized registration:
- allow infinite registrations (expire=0)
- when removing a registration, keep the other with same user if multiple reg is allowed
diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c
index 1274213..2a6f9e3 100644
--- a/src/switch_core_sqldb.c
+++ b/src/switch_core_sqldb.c
@@ -1696,7 +1696,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_del_registration(const char *user, c
return SWITCH_STATUS_FALSE;
}
- sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q'", user, realm, switch_core_get_hostname());
+ if (!zstr(token) && runtime.multiple_registrations) {
+ sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q' and token='%q'", user, realm, switch_core_get_hostname(), 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);
switch_cache_db_release_db_handle(&dbh);
@@ -1723,7 +1727,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force)
if (force) {
sql = switch_mprintf("delete from registrations where hostname='%q'", switch_core_get_hostname());
} else {
- sql = switch_mprintf("delete from registrations where expires <= %ld and hostname='%q'", now, switch_core_get_hostname());
+ sql = switch_mprintf("delete from registrations where expires > 0 and expires <= %ld and hostname='%q'", now, switch_core_get_hostname());
}
switch_cache_db_execute_sql(dbh, sql, NULL);
Summary of changes: src/switch_core_sqldb.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 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