]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_callcenter: Add param to change the location or name of the sqlite database like...
authorMarc Olivier Chouinard <mochouinard@moctel.com>
Sat, 2 Oct 2010 03:01:03 +0000 (23:01 -0400)
committerMarc Olivier Chouinard <mochouinard@moctel.com>
Sat, 2 Oct 2010 03:01:03 +0000 (23:01 -0400)
conf/autoload_configs/callcenter.conf.xml
src/mod/applications/mod_callcenter/mod_callcenter.c

index 117839146c806e1331349a4f0ed5cfe85d68ce8a..9140193b22eecdd448aaa88b31fcd29e201317a9 100644 (file)
@@ -1,6 +1,7 @@
 <configuration name="callcenter.conf" description="CallCenter">
   <settings>
     <!--<param name="odbc-dsn" value="dsn:user:pass"/>-->
+    <!--<param name="dbname" value="/dev/shm/callcenter.db"/>-->
   </settings>
 
   <queues>
index b58e647e3bf1dcc74be6e1f5c0b53c8ef81114ba..e06812273207deb376599efe9084949a2ad26e32 100644 (file)
@@ -402,6 +402,7 @@ static struct {
        char *odbc_dsn;
        char *odbc_user;
        char *odbc_pass;
+       char *dbname;
        int32_t threads;
        int32_t running;
        switch_mutex_t *mutex;
@@ -506,7 +507,7 @@ switch_cache_db_handle_t *cc_get_db_handle(void)
                        dbh = NULL;
                return dbh;
        } 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)
                        dbh = NULL;
                return dbh;
@@ -1258,6 +1259,8 @@ static switch_status_t load_config(void)
 
                        if (!strcasecmp(var, "debug")) {
                                globals.debug = atoi(val);
+                       } else if (!strcasecmp(var, "dbname")) {
+                               globals.dbname = strdup(val);
                        } else if (!strcasecmp(var, "odbc-dsn")) {
                                globals.odbc_dsn = strdup(val);
 
@@ -2680,6 +2683,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load)
        memset(&globals, 0, sizeof(globals));
        globals.pool = pool;
 
+       globals.dbname = CC_SQLITE_DB_NAME;
+
        switch_core_hash_init(&globals.queue_hash, 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.dbname);
        switch_mutex_unlock(globals.mutex);
 
        return SWITCH_STATUS_SUCCESS;