diff options
author | spag <spag@golwen.net> | 2013-01-09 11:10:04 +0100 |
---|---|---|
committer | spag <spag@golwen.net> | 2013-01-09 11:10:04 +0100 |
commit | c8db7371bc31c6ef6ab27026d5f839c2095b924f (patch) | |
tree | d3828c5f4751383ba56305207d842ea1d2b3735e /misc/freeswitch/scripts/dialplan_default.lua | |
parent | 1c9204491cf7d9539c31b465fc4590c188fbc01e (diff) |
read dialplan configuration from database
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); |