diff options
Diffstat (limited to 'misc/freeswitch/scripts/dialplan_default.lua')
-rw-r--r-- | misc/freeswitch/scripts/dialplan_default.lua | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/misc/freeswitch/scripts/dialplan_default.lua b/misc/freeswitch/scripts/dialplan_default.lua index ee4a88f..91ad4e4 100644 --- a/misc/freeswitch/scripts/dialplan_default.lua +++ b/misc/freeswitch/scripts/dialplan_default.lua @@ -23,10 +23,18 @@ log = common.log.Log:new{ prefix = '### [' .. session:get_uuid() .. '] ' }; require 'dialplan.session' start_caller = dialplan.session.Session:new{ log = log, session = session }; +-- connect to database +require 'common.database' +local database = common.database.Database:new{ log = log }:connect(); +if not database:connected() then + log:critical('DIALPLAN_DEFAULT - database connect failed'); + return; +end + -- dialplan object require 'dialplan.dialplan' -start_dialplan = dialplan.dialplan.Dialplan:new{ log = log, caller = start_caller }; +start_dialplan = dialplan.dialplan.Dialplan:new{ log = log, caller = start_caller, database = database }; start_dialplan:configuration_read(); start_caller.local_node_id = start_dialplan.node_id; start_caller:init_channel_variables(); @@ -39,16 +47,6 @@ if not start_dialplan:check_auth() then return false; end --- connect to database -require 'common.database' -local database = common.database.Database:new{ log = log }:connect(); -if not database:connected() then - log:critical('DIALPLAN_DEFAULT - database connect failed'); - return; -end - -start_dialplan.database = database; - if start_caller.from_node and not start_dialplan:check_auth_node() then log:debug('AUTHENTICATION_REQUIRED_NODE - node_id: ', start_caller.node_id, ', domain: ', start_dialplan.domain); start_dialplan:hangup(407, start_dialplan.domain); |