diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/freeswitch/scripts/common/database.lua | 23 | ||||
-rw-r--r-- | misc/freeswitch/scripts/dialplan/session.lua | 6 |
2 files changed, 29 insertions, 0 deletions
diff --git a/misc/freeswitch/scripts/common/database.lua b/misc/freeswitch/scripts/common/database.lua index 8aed1ac..be32ad7 100644 --- a/misc/freeswitch/scripts/common/database.lua +++ b/misc/freeswitch/scripts/common/database.lua @@ -67,6 +67,29 @@ function Database.query_return_value(self, sql_query) end +function Database.query_return_first(self, sql_query) + local result = nil; + + self.conn:query(sql_query, function(row) + result = row; + return result; + end); + + return result; +end + + +function Database.query_return_all(self, sql_query) + local result = {}; + + self.conn:query(sql_query, function(row) + table.insert(result, row); + end); + + return result; +end + + function Database.last_insert_id(self) return self:query_return_value('SELECT LAST_INSERT_ID()'); end diff --git a/misc/freeswitch/scripts/dialplan/session.lua b/misc/freeswitch/scripts/dialplan/session.lua index 78be98e..9c43e74 100644 --- a/misc/freeswitch/scripts/dialplan/session.lua +++ b/misc/freeswitch/scripts/dialplan/session.lua @@ -173,6 +173,12 @@ function Session.answer(self) return self.session:answer(); end +-- Is answered? +function Session.answered(self) + return self.session:answered(); +end + + function Session.intercept(self, uid) self.session:execute("intercept", uid); end |