summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-02-05 14:30:30 +0100
committerspag <spag@golwen.net>2013-02-05 14:30:30 +0100
commite22d3f5cb2791b70a9fcfe6befdeca233772688d (patch)
tree4d2874755deae4eaee7e8c2c68b79c86a8e475e1 /misc/freeswitch/scripts
parentc7379b1b30043b5526aa3a5dc7f0111174a7f915 (diff)
preserve event consumer
Diffstat (limited to 'misc/freeswitch/scripts')
-rw-r--r--misc/freeswitch/scripts/event/event.lua6
-rw-r--r--misc/freeswitch/scripts/event_manager.lua4
2 files changed, 7 insertions, 3 deletions
diff --git a/misc/freeswitch/scripts/event/event.lua b/misc/freeswitch/scripts/event/event.lua
index c98b534..652fc48 100644
--- a/misc/freeswitch/scripts/event/event.lua
+++ b/misc/freeswitch/scripts/event/event.lua
@@ -16,13 +16,16 @@ function EventManager.new(self, arg)
self.class = 'eventmanager'
self.database = arg.database;
self.domain = arg.domain;
+ self.consumer = arg.consumer;
return object;
end
function EventManager.register(self)
- self.consumer = freeswitch.EventConsumer('all');
+ if not self.consumer then
+ self.consumer = freeswitch.EventConsumer('all');
+ end
return (self.consumer ~= nil);
end
@@ -117,6 +120,5 @@ function EventManager.run(self)
end
end
- self.consumer = nil;
self.log:info('[event] EVENT_MANAGER_EXIT - action: ', freeswitch.getGlobalVariable('gs_event_manager'));
end
diff --git a/misc/freeswitch/scripts/event_manager.lua b/misc/freeswitch/scripts/event_manager.lua
index 3d558e5..3991f8f 100644
--- a/misc/freeswitch/scripts/event_manager.lua
+++ b/misc/freeswitch/scripts/event_manager.lua
@@ -26,13 +26,15 @@ else
log:error('[event] EVENT_MANAGER_LOADER - No SIP domains found!');
end
+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 }
+ 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