mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 17:38:59 +00:00
add metadata col to internal registrations table
This commit is contained in:
@@ -1713,7 +1713,8 @@ static char create_registrations_sql[] =
|
||||
" network_ip VARCHAR(256),\n"
|
||||
" network_port VARCHAR(256),\n"
|
||||
" network_proto VARCHAR(256),\n"
|
||||
" hostname VARCHAR(256)\n"
|
||||
" hostname VARCHAR(256),\n"
|
||||
" metadata VARCHAR(256)\n"
|
||||
");\n";
|
||||
|
||||
|
||||
@@ -1843,7 +1844,8 @@ static char basic_calls_sql[] =
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, const char *realm, const char *token, const char *url, uint32_t expires,
|
||||
const char *network_ip, const char *network_port, const char *network_proto)
|
||||
const char *network_ip, const char *network_port, const char *network_proto,
|
||||
const char *metadata)
|
||||
{
|
||||
char *sql;
|
||||
|
||||
@@ -1860,19 +1862,35 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c
|
||||
}
|
||||
|
||||
switch_queue_push(sql_manager.sql_queue[0], sql);
|
||||
|
||||
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),
|
||||
switch_str_nil(token),
|
||||
switch_str_nil(url),
|
||||
expires,
|
||||
switch_str_nil(network_ip),
|
||||
switch_str_nil(network_port),
|
||||
switch_str_nil(network_proto),
|
||||
switch_core_get_switchname()
|
||||
);
|
||||
|
||||
if ( !zstr(metadata) ) {
|
||||
sql = switch_mprintf("insert into registrations (reg_user,realm,token,url,expires,network_ip,network_port,network_proto,hostname,metadata) "
|
||||
"values ('%q','%q','%q','%q',%ld,'%q','%q','%q','%q','%q')",
|
||||
switch_str_nil(user),
|
||||
switch_str_nil(realm),
|
||||
switch_str_nil(token),
|
||||
switch_str_nil(url),
|
||||
expires,
|
||||
switch_str_nil(network_ip),
|
||||
switch_str_nil(network_port),
|
||||
switch_str_nil(network_proto),
|
||||
switch_core_get_switchname(),
|
||||
metadata
|
||||
);
|
||||
} else {
|
||||
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),
|
||||
switch_str_nil(token),
|
||||
switch_str_nil(url),
|
||||
expires,
|
||||
switch_str_nil(network_ip),
|
||||
switch_str_nil(network_port),
|
||||
switch_str_nil(network_proto),
|
||||
switch_core_get_switchname()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
switch_queue_push(sql_manager.sql_queue[0], sql);
|
||||
@@ -2007,6 +2025,8 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
|
||||
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);
|
||||
|
||||
switch_cache_db_test_reactive(dbh, "select metadata from registrations", NULL, "ALTER TABLE registrations ADD COLUMN metadata VARCHAR(256)");
|
||||
|
||||
|
||||
switch (dbh->type) {
|
||||
case SCDB_TYPE_ODBC:
|
||||
|
Reference in New Issue
Block a user