mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-17 09:12:25 +00:00
Merge branch 'master' of ssh://git.freeswitch.org:222/freeswitch
This commit is contained in:
commit
0e0c15b4b4
@ -2328,9 +2328,6 @@ SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t
|
|||||||
SWITCH_DECLARE(switch_status_t) _switch_core_recovery_db_handle(switch_cache_db_handle_t ** dbh, const char *file, const char *func, int line);
|
SWITCH_DECLARE(switch_status_t) _switch_core_recovery_db_handle(switch_cache_db_handle_t ** dbh, const char *file, const char *func, int line);
|
||||||
#define switch_core_recovery_db_handle(_a) _switch_core_recovery_db_handle(_a, __FILE__, __SWITCH_FUNC__, __LINE__)
|
#define switch_core_recovery_db_handle(_a) _switch_core_recovery_db_handle(_a, __FILE__, __SWITCH_FUNC__, __LINE__)
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) _switch_core_persist_db_handle(switch_cache_db_handle_t ** dbh, const char *file, const char *func, int line);
|
|
||||||
#define switch_core_persist_db_handle(_a) _switch_core_persist_db_handle(_a, __FILE__, __SWITCH_FUNC__, __LINE__)
|
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_handle_t *db,
|
SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_handle_t *db,
|
||||||
const char *test_sql, const char *drop_sql, const char *reactive_sql);
|
const char *test_sql, const char *drop_sql, const char *reactive_sql);
|
||||||
SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute(switch_cache_db_handle_t *dbh, const char *sql, uint32_t retries);
|
SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute(switch_cache_db_handle_t *dbh, const char *sql, uint32_t retries);
|
||||||
|
@ -1650,7 +1650,7 @@ void sofia_msg_thread_start(int idx)
|
|||||||
|
|
||||||
switch_threadattr_create(&thd_attr, mod_sofia_globals.pool);
|
switch_threadattr_create(&thd_attr, mod_sofia_globals.pool);
|
||||||
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
||||||
switch_threadattr_priority_set(thd_attr, SWITCH_PRI_REALTIME);
|
//switch_threadattr_priority_set(thd_attr, SWITCH_PRI_REALTIME);
|
||||||
switch_thread_create(&mod_sofia_globals.msg_queue_thread[i],
|
switch_thread_create(&mod_sofia_globals.msg_queue_thread[i],
|
||||||
thd_attr,
|
thd_attr,
|
||||||
sofia_msg_thread_run,
|
sofia_msg_thread_run,
|
||||||
@ -2376,7 +2376,7 @@ switch_thread_t *launch_sofia_worker_thread(sofia_profile_t *profile)
|
|||||||
|
|
||||||
switch_threadattr_create(&thd_attr, profile->pool);
|
switch_threadattr_create(&thd_attr, profile->pool);
|
||||||
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
|
||||||
switch_threadattr_priority_set(thd_attr, SWITCH_PRI_REALTIME);
|
//switch_threadattr_priority_set(thd_attr, SWITCH_PRI_REALTIME);
|
||||||
switch_thread_create(&thread, thd_attr, sofia_profile_worker_thread_run, profile, profile->pool);
|
switch_thread_create(&thread, thd_attr, sofia_profile_worker_thread_run, profile, profile->pool);
|
||||||
|
|
||||||
while (!sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
|
while (!sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
|
||||||
|
@ -934,7 +934,7 @@ static void send_conference_data(sofia_profile_t *profile, switch_event_t *event
|
|||||||
sql = switch_mprintf("select full_to, full_from, contact %q ';_;isfocus', expires, call_id, event, network_ip, network_port, "
|
sql = switch_mprintf("select full_to, full_from, contact %q ';_;isfocus', expires, call_id, event, network_ip, network_port, "
|
||||||
"'%q' as ct,'%q' as pt "
|
"'%q' as ct,'%q' as pt "
|
||||||
" from sip_subscriptions where "
|
" from sip_subscriptions where "
|
||||||
"hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q'"
|
"hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q' "
|
||||||
"and call_id = '%q' ",
|
"and call_id = '%q' ",
|
||||||
switch_sql_concat(),
|
switch_sql_concat(),
|
||||||
type,
|
type,
|
||||||
@ -956,10 +956,19 @@ static void send_conference_data(sofia_profile_t *profile, switch_event_t *event
|
|||||||
sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_send_sql, &cb);
|
sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_send_sql, &cb);
|
||||||
|
|
||||||
if (switch_true(final)) {
|
if (switch_true(final)) {
|
||||||
|
if (call_id) {
|
||||||
|
sql = switch_mprintf("delete from sip_subscriptions where "
|
||||||
|
"hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q' "
|
||||||
|
"and call_id = '%q' ",
|
||||||
|
mod_sofia_globals.hostname, profile->name,
|
||||||
|
from_user, from_host, event_str, call_id);
|
||||||
|
|
||||||
|
} else {
|
||||||
sql = switch_mprintf("delete from sip_subscriptions where "
|
sql = switch_mprintf("delete from sip_subscriptions where "
|
||||||
"hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q'",
|
"hostname='%q' and profile_name='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q'",
|
||||||
mod_sofia_globals.hostname, profile->name,
|
mod_sofia_globals.hostname, profile->name,
|
||||||
from_user, from_host, event_str);
|
from_user, from_host, event_str);
|
||||||
|
}
|
||||||
|
|
||||||
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ SWITCH_DECLARE(char *) switch_console_expand_alias(char *cmd, char *arg)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (switch_core_persist_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
|
if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database Error\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database Error\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1859,7 +1859,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_alias(const char *string)
|
|||||||
switch_cache_db_handle_t *db = NULL;
|
switch_cache_db_handle_t *db = NULL;
|
||||||
char *sql = NULL;
|
char *sql = NULL;
|
||||||
|
|
||||||
if (switch_core_persist_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
|
if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database Error\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database Error\n");
|
||||||
free(mydata);
|
free(mydata);
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
|
@ -731,32 +731,14 @@ SWITCH_DECLARE(int32_t) set_realtime_priority(void)
|
|||||||
* Try to use a round-robin scheduler
|
* Try to use a round-robin scheduler
|
||||||
* with a fallback if that does not work
|
* with a fallback if that does not work
|
||||||
*/
|
*/
|
||||||
int fd;
|
|
||||||
const char *rt = "/proc/sys/kernel/sched_rt_runtime_us";
|
|
||||||
char data[] = "-1\n";
|
|
||||||
struct sched_param sched = { 0 };
|
struct sched_param sched = { 0 };
|
||||||
sched.sched_priority = SWITCH_PRI_LOW;
|
sched.sched_priority = SWITCH_PRI_LOW;
|
||||||
if (sched_setscheduler(0, SCHED_RR, &sched)) {
|
if (sched_setscheduler(0, SCHED_FIFO, &sched)) {
|
||||||
sched.sched_priority = 0;
|
sched.sched_priority = 0;
|
||||||
if (sched_setscheduler(0, SCHED_OTHER, &sched)) {
|
if (sched_setscheduler(0, SCHED_OTHER, &sched)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fd = open(rt, O_WRONLY)) > 0) {
|
|
||||||
int r;
|
|
||||||
|
|
||||||
if (!(r = write(fd, data, sizeof(data)))) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Disablling RT limits [%s][%d]\n", rt, r);
|
|
||||||
} else {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Disabling RT throttling.\n");
|
|
||||||
}
|
|
||||||
close(fd);
|
|
||||||
} else {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error opening %s\n", rt);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ static switch_cache_db_handle_t *get_handle(const char *db_str, const char *user
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define SWITCH_CORE_DB "file:scoreboard?mode=memory&cache=shared"
|
#define SWITCH_CORE_DB "core"
|
||||||
/*!
|
/*!
|
||||||
\brief Open the default system database
|
\brief Open the default system database
|
||||||
*/
|
*/
|
||||||
@ -218,49 +218,6 @@ SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SWITCH_CORE_PERSIST_DB "core"
|
|
||||||
/*!
|
|
||||||
\brief Open the default system database
|
|
||||||
*/
|
|
||||||
SWITCH_DECLARE(switch_status_t) _switch_core_persist_db_handle(switch_cache_db_handle_t **dbh, const char *file, const char *func, int line)
|
|
||||||
{
|
|
||||||
switch_cache_db_connection_options_t options = { {0} };
|
|
||||||
switch_status_t r;
|
|
||||||
|
|
||||||
if (!sql_manager.manage) {
|
|
||||||
return SWITCH_STATUS_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (zstr(runtime.odbc_dsn)) {
|
|
||||||
if (switch_test_flag((&runtime), SCF_CORE_ODBC_REQ)) {
|
|
||||||
return SWITCH_STATUS_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (runtime.dbname) {
|
|
||||||
options.core_db_options.db_path = runtime.dbname;
|
|
||||||
} else {
|
|
||||||
options.core_db_options.db_path = SWITCH_CORE_PERSIST_DB;
|
|
||||||
}
|
|
||||||
r = _switch_cache_db_get_db_handle(dbh, SCDB_TYPE_CORE_DB, &options, file, func, line);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
options.odbc_options.dsn = runtime.odbc_dsn;
|
|
||||||
options.odbc_options.user = runtime.odbc_user;
|
|
||||||
options.odbc_options.pass = runtime.odbc_pass;
|
|
||||||
|
|
||||||
r = _switch_cache_db_get_db_handle(dbh, SCDB_TYPE_ODBC, &options, file, func, line);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* I *think* we can do without this now, if not let me know
|
|
||||||
if (r == SWITCH_STATUS_SUCCESS && !(*dbh)->io_mutex) {
|
|
||||||
(*dbh)->io_mutex = sql_manager.io_mutex;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define SWITCH_CORE_RECOVERY_DB "core_recovery"
|
#define SWITCH_CORE_RECOVERY_DB "core_recovery"
|
||||||
SWITCH_DECLARE(switch_status_t) _switch_core_recovery_db_handle(switch_cache_db_handle_t **dbh, const char *file, const char *func, int line)
|
SWITCH_DECLARE(switch_status_t) _switch_core_recovery_db_handle(switch_cache_db_handle_t **dbh, const char *file, const char *func, int line)
|
||||||
{
|
{
|
||||||
@ -2409,13 +2366,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
switch_cache_db_test_reactive(sql_manager.dbh, "select hostname from aliases", "DROP TABLE aliases", create_alias_sql);
|
||||||
switch_cache_db_handle_t *db = NULL;
|
|
||||||
switch_core_persist_db_handle(&db);
|
|
||||||
switch_cache_db_test_reactive(db, "select hostname from aliases", "DROP TABLE aliases", create_alias_sql);
|
|
||||||
switch_cache_db_release_db_handle(&db);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_cache_db_test_reactive(sql_manager.dbh, "select hostname from complete", "DROP TABLE complete", create_complete_sql);
|
switch_cache_db_test_reactive(sql_manager.dbh, "select hostname from complete", "DROP TABLE complete", create_complete_sql);
|
||||||
switch_cache_db_test_reactive(sql_manager.dbh, "select hostname from nat", "DROP TABLE nat", create_nat_sql);
|
switch_cache_db_test_reactive(sql_manager.dbh, "select hostname from nat", "DROP TABLE nat", create_nat_sql);
|
||||||
switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user='' or network_proto='tcp' or network_proto='tls'",
|
switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user='' or network_proto='tcp' or network_proto='tls'",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user