Merge branch 'master' of fs-git:freeswitch

This commit is contained in:
Raymond Chandler 2011-02-17 14:12:47 -05:00
commit d46ea5d346
5 changed files with 20 additions and 3 deletions

View file

@ -98,7 +98,9 @@
<!-- <param name="core-db-name" value="/dev/shm/core.db" /> -->
<!-- The system will create all the db schemas automatically, set this to false to avoid this behaviour-->
<!--<param name="auto-create-schemas" value="true"/>-->
<!-- <param name="core-dbtype" value="MSSQL"/> -->
<!-- <param name="core-dbtype" value="MSSQL"/> -->
<!-- Allow multiple registrations to the same account in the central registration table -->
<!-- <param name="multiple-registrations" value="true"/> -->
</settings>
</configuration>

View file

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

View file

@ -2148,8 +2148,13 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
if (!zstr(from_domain)) {
gateway->from_domain = switch_core_strdup(gateway->pool, from_domain);
}
if (!zstr(register_transport) && !switch_stristr("transport=", proxy)) {
gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s;transport=%s", proxy, register_transport);
} else {
gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s", proxy);
}
gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s", proxy);
gateway->register_from = switch_core_sprintf(gateway->pool, "<sip:%s@%s;transport=%s>",
from_user, !zstr(from_domain) ? from_domain : proxy, register_transport);

View file

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

View file

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