summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/event_manager.lua
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-17 12:01:45 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-17 12:01:45 +0100
commitb80bd744ad873f6fc43018bc4bfb90677de167bd (patch)
tree072c4b0e33d442528555b82c415f5e7a1712b2b0 /misc/freeswitch/scripts/event_manager.lua
parent3e706c2025ecc5523e81ad649639ef2ff75e7bac (diff)
Start of GS5.
Diffstat (limited to 'misc/freeswitch/scripts/event_manager.lua')
-rw-r--r--misc/freeswitch/scripts/event_manager.lua39
1 files changed, 39 insertions, 0 deletions
diff --git a/misc/freeswitch/scripts/event_manager.lua b/misc/freeswitch/scripts/event_manager.lua
new file mode 100644
index 0000000..0e3c0e0
--- /dev/null
+++ b/misc/freeswitch/scripts/event_manager.lua
@@ -0,0 +1,39 @@
+-- Gemeinschaft 5.0 event handler
+-- (c) AMOOMA GmbH 2012
+--
+
+-- Set logger
+require "common.log"
+local log = common.log.Log:new()
+log.prefix = "#E# "
+
+log:info('[event] EVENT_MANAGER 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');
+ return;
+end
+
+require "configuration.sip"
+local sip = configuration.sip.Sip:new{ log = log, database = database }
+
+local domain = '127.0.0.1';
+local domains = sip:domains();
+if domains[1] then
+ domain = domains[1]['host'];
+else
+ log:error('[event] EVENT_MANAGER - No SIP domains found!');
+end
+
+require 'event.event'
+local event_manager = event.event.EventManager:new{ log = log, database = database, domain = domain }
+event_manager:run();
+
+-- ensure database handle is released on exit
+if database then
+ database:release();
+end
+
+log:info('[event] EVENT_MANAGER exit');