mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-06 11:43:50 +00:00
Fix. Use correct database for Call Center while FS load. (#1597)
Problem that `mod_commands` may load after than `mod_callcenter` and there no function `global_getvar` So current code just create database with name `INVALID COMMAND!.db`.
This commit is contained in:
committed by
FusionPBX
parent
38c43217ce
commit
619912324c
@@ -46,8 +46,13 @@
|
||||
assert(dbh:connected());
|
||||
|
||||
--get the variables
|
||||
dsn = trim(api:execute("global_getvar", "dsn"));
|
||||
dsn_callcenter = trim(api:execute("global_getvar", "dsn_callcenter"));
|
||||
dsn = trim(api:execute("global_getvar", "dsn")) or '';
|
||||
dsn_callcenter = trim(api:execute("global_getvar", "dsn_callcenter")) or '';
|
||||
|
||||
if dsn:find("INVALID COMMAND", nil, true) then
|
||||
freeswitch.consoleLog('err', '[xml_handler] Can not correctly load mod_callcenter becase mod_commands not loaded\n')
|
||||
dsn, dsn_callcenter = '', ''
|
||||
end
|
||||
|
||||
--start the xml array
|
||||
local xml = {}
|
||||
@@ -56,14 +61,12 @@
|
||||
table.insert(xml, [[ <section name="configuration">]]);
|
||||
table.insert(xml, [[ <configuration name="callcenter.conf" description="Call Center">]]);
|
||||
table.insert(xml, [[ <settings>]]);
|
||||
if (dsn_callcenter) then
|
||||
if #dsn_callcenter > 0 then
|
||||
table.insert(xml, [[ <param name="odbc-dsn" value="]]..dsn_callcenter..[["/>]]);
|
||||
else
|
||||
if (string.len(dsn) > 0) then
|
||||
table.insert(xml, [[ <param name="odbc-dsn" value="]]..database["switch"]..[["/>]]);
|
||||
end
|
||||
elseif #dsn > 0 then
|
||||
table.insert(xml, [[ <param name="odbc-dsn" value="]]..database["switch"]..[["/>]]);
|
||||
end
|
||||
--table.insert(xml, [[ <param name="dbname" value="/usr/local/freeswitch/db/call_center.db"/>]]);
|
||||
-- table.insert(xml, [[ <param name="dbname" value="]]..database_dir..[[/call_center.db"/>]]);
|
||||
table.insert(xml, [[ </settings>]]);
|
||||
|
||||
--write the queues
|
||||
|
||||
Reference in New Issue
Block a user