提交 b36a7c0b authored 作者: Anthony Minessale's avatar Anthony Minessale

add multiple-registrations flag to the core similar to mod_sofia

上级 4b62ff79
...@@ -248,6 +248,7 @@ struct switch_runtime { ...@@ -248,6 +248,7 @@ struct switch_runtime {
int max_sql_buffer_len; int max_sql_buffer_len;
switch_dbtype_t odbc_dbtype; switch_dbtype_t odbc_dbtype;
char hostname[256]; char hostname[256];
int multiple_registrations;
}; };
extern struct switch_runtime runtime; extern struct switch_runtime runtime;
......
...@@ -1549,6 +1549,8 @@ static void switch_load_core_config(const char *file) ...@@ -1549,6 +1549,8 @@ static void switch_load_core_config(const char *file)
if (tmp > -1 && tmp < 11) { if (tmp > -1 && tmp < 11) {
switch_core_session_ctl(SCSC_DEBUG_LEVEL, &tmp); 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")) { } else if (!strcasecmp(var, "sql-buffer-len")) {
int tmp = atoi(val); int tmp = atoi(val);
......
...@@ -1653,7 +1653,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c ...@@ -1653,7 +1653,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c
return SWITCH_STATUS_FALSE; 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); switch_cache_db_execute_sql(dbh, sql, NULL);
free(sql); free(sql);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论