summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/event_manager.lua
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-12 13:53:28 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-02-12 13:53:28 +0100
commitc9066760fd1f5f2f892ce2be5cf2a83bb5210246 (patch)
tree82ecdd528e803ccd1b469dc13482e06cf8ea0b8e /misc/freeswitch/scripts/event_manager.lua
parent0b97717b2171820dea41de8df705f8f0e4b71464 (diff)
parentfb66a5e5a4c5d5f9eac4a5e8de6a286482cb55d5 (diff)
Release a new beta.5.1-beta4
Diffstat (limited to 'misc/freeswitch/scripts/event_manager.lua')
-rw-r--r--misc/freeswitch/scripts/event_manager.lua21
1 files changed, 14 insertions, 7 deletions
diff --git a/misc/freeswitch/scripts/event_manager.lua b/misc/freeswitch/scripts/event_manager.lua
index 1e61baf..3991f8f 100644
--- a/misc/freeswitch/scripts/event_manager.lua
+++ b/misc/freeswitch/scripts/event_manager.lua
@@ -7,12 +7,12 @@ require "common.log"
local log = common.log.Log:new()
log.prefix = "#E# "
-log:info('[event] EVENT_MANAGER start');
+log:info('[event] EVENT_MANAGER_LOADER start');
require 'common.database'
local database = common.database.Database:new{ log = log }:connect();
if not database:connected() then
- log:error('[event] EVENT_MANAGER - cannot connect to Gemeinschaft database');
+ log:error('[event] EVENT_MANAGER_LOADER - cannot connect to Gemeinschaft database');
return;
end
@@ -23,16 +23,23 @@ local domain = '127.0.0.1';
if domains[1] then
domain = domains[1]['host'];
else
- log:error('[event] EVENT_MANAGER - No SIP domains found!');
+ log:error('[event] EVENT_MANAGER_LOADER - No SIP domains found!');
end
-require 'event.event'
-local event_manager = event.event.EventManager:new{ log = log, database = database, domain = domain }
-event_manager:run();
+local event_consumer = nil;
+freeswitch.setGlobalVariable('gs_event_manager', 'true');
+while freeswitch.getGlobalVariable('gs_event_manager') ~= 'false' do
+ package.loaded['event.event'] = nil;
+ local manager_class = require('event.event');
+ local event_manager = manager_class.EventManager:new{ log = log, database = database, domain = domain, consumer = event_consumer };
+ freeswitch.setGlobalVariable('gs_event_manager', 'true');
+ event_manager:run();
+ event_consumer = event_manager.consumer;
+end
-- ensure database handle is released on exit
if database then
database:release();
end
-log:info('[event] EVENT_MANAGER exit');
+log:info('[event] EVENT_MANAGER_LOADER exit');