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);
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);