mod_callcenter: Add param to change the location or name of the sqlite database like to put it into a ramdisk
This commit is contained in:
parent
4aa9a83898
commit
8bd3513461
|
@ -1,6 +1,7 @@
|
||||||
<configuration name="callcenter.conf" description="CallCenter">
|
<configuration name="callcenter.conf" description="CallCenter">
|
||||||
<settings>
|
<settings>
|
||||||
<!--<param name="odbc-dsn" value="dsn:user:pass"/>-->
|
<!--<param name="odbc-dsn" value="dsn:user:pass"/>-->
|
||||||
|
<!--<param name="dbname" value="/dev/shm/callcenter.db"/>-->
|
||||||
</settings>
|
</settings>
|
||||||
|
|
||||||
<queues>
|
<queues>
|
||||||
|
|
|
@ -402,6 +402,7 @@ static struct {
|
||||||
char *odbc_dsn;
|
char *odbc_dsn;
|
||||||
char *odbc_user;
|
char *odbc_user;
|
||||||
char *odbc_pass;
|
char *odbc_pass;
|
||||||
|
char *dbname;
|
||||||
int32_t threads;
|
int32_t threads;
|
||||||
int32_t running;
|
int32_t running;
|
||||||
switch_mutex_t *mutex;
|
switch_mutex_t *mutex;
|
||||||
|
@ -506,7 +507,7 @@ switch_cache_db_handle_t *cc_get_db_handle(void)
|
||||||
dbh = NULL;
|
dbh = NULL;
|
||||||
return dbh;
|
return dbh;
|
||||||
} else {
|
} else {
|
||||||
options.core_db_options.db_path = CC_SQLITE_DB_NAME;
|
options.core_db_options.db_path = globals.dbname;
|
||||||
if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) != SWITCH_STATUS_SUCCESS)
|
if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) != SWITCH_STATUS_SUCCESS)
|
||||||
dbh = NULL;
|
dbh = NULL;
|
||||||
return dbh;
|
return dbh;
|
||||||
|
@ -1258,6 +1259,8 @@ static switch_status_t load_config(void)
|
||||||
|
|
||||||
if (!strcasecmp(var, "debug")) {
|
if (!strcasecmp(var, "debug")) {
|
||||||
globals.debug = atoi(val);
|
globals.debug = atoi(val);
|
||||||
|
} else if (!strcasecmp(var, "dbname")) {
|
||||||
|
globals.dbname = strdup(val);
|
||||||
} else if (!strcasecmp(var, "odbc-dsn")) {
|
} else if (!strcasecmp(var, "odbc-dsn")) {
|
||||||
globals.odbc_dsn = strdup(val);
|
globals.odbc_dsn = strdup(val);
|
||||||
|
|
||||||
|
@ -2680,6 +2683,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load)
|
||||||
memset(&globals, 0, sizeof(globals));
|
memset(&globals, 0, sizeof(globals));
|
||||||
globals.pool = pool;
|
globals.pool = pool;
|
||||||
|
|
||||||
|
globals.dbname = CC_SQLITE_DB_NAME;
|
||||||
|
|
||||||
switch_core_hash_init(&globals.queue_hash, globals.pool);
|
switch_core_hash_init(&globals.queue_hash, globals.pool);
|
||||||
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
|
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
|
||||||
|
|
||||||
|
@ -2773,6 +2778,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_callcenter_shutdown)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_safe_free(globals.odbc_dsn);
|
switch_safe_free(globals.odbc_dsn);
|
||||||
|
switch_safe_free(globals.dbname);
|
||||||
switch_mutex_unlock(globals.mutex);
|
switch_mutex_unlock(globals.mutex);
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue