From 10d3037aa6e4dbdcd438b436b094bdb225f34de5 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Tue, 30 Jul 2013 13:06:09 +0200 Subject: find_by_uuid method added --- misc/freeswitch/scripts/common/conference.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'misc') diff --git a/misc/freeswitch/scripts/common/conference.lua b/misc/freeswitch/scripts/common/conference.lua index 5694f62..423d564 100644 --- a/misc/freeswitch/scripts/common/conference.lua +++ b/misc/freeswitch/scripts/common/conference.lua @@ -52,8 +52,7 @@ function Conference.settings_get(self) end -function Conference.find_by_id(self, id) - local sql_query = 'SELECT *, (NOW() >= `start` AND NOW() <= `end`) AS `open_now` FROM `conferences` WHERE `id`= ' .. tonumber(id) .. ' LIMIT 1'; +function Conference.find_sql(self, sql_query) local conference = nil; self.database:query(sql_query, function(conference_entry) @@ -82,6 +81,16 @@ function Conference.find_by_id(self, id) end +function Conference.find_by_id(self, id) + return self:find_sql('SELECT *, (NOW() >= `start` AND NOW() <= `end`) AS `open_now` FROM `conferences` WHERE `id`= ' .. tonumber(id) .. ' LIMIT 1'); +end + + +function Conference.find_by_uuid(self, uuid) + return self:find_sql('SELECT *, (NOW() >= `start` AND NOW() <= `end`) AS `open_now` FROM `conferences` WHERE `uuid`= ' .. self.database:escape(uuid, '"') .. ' LIMIT 1'); +end + + function Conference.find_invitee_by_numbers(self, phone_numbers) if not self.record then return false; -- cgit v1.2.3