]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Added optional core: prefix to first arg passed to freeswitch.Dbh for giving direct...
authorLeon de Rooij <leon@toyos.nl>
Thu, 27 Jan 2011 12:10:26 +0000 (13:10 +0100)
committerLeon de Rooij <leon@toyos.nl>
Thu, 27 Jan 2011 12:10:26 +0000 (13:10 +0100)
src/mod/languages/mod_lua/freeswitch_lua.cpp

index 1a170dcc983c98c2d329864c6dd6dc6a35574f1c..01f708d66a88c2aae844a80126d11c195596d072 100644 (file)
@@ -312,15 +312,21 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp
 Dbh::Dbh(char *dsn, char *user, char *pass)
 {
   switch_cache_db_connection_options_t options = { {0} };
+  const char *prefix = "core:";
+  m_connected = false;
 
-  options.odbc_options.dsn = dsn;
-  options.odbc_options.user = user;
-  options.odbc_options.pass = pass;
-
-  if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) == SWITCH_STATUS_SUCCESS) {
-    m_connected = true;
+  if (strstr(dsn, prefix) == dsn) {
+    options.core_db_options.db_path = &dsn[strlen(prefix)];
+    if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) == SWITCH_STATUS_SUCCESS) {
+      m_connected = true;
+    }
   } else {
-    m_connected = false;
+    options.odbc_options.dsn = dsn;
+    options.odbc_options.user = user;
+    options.odbc_options.pass = pass;
+    if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) == SWITCH_STATUS_SUCCESS) {
+      m_connected = true;
+    }
   }
 }