63 Commits

Author SHA1 Message Date
Andrey Volk
4dd86960ba [mod_lua] Fix leaks. 2020-01-21 13:27:06 +00:00
Seven Du
813771f737 FS-11676 add JSON support to mod_lua 2019-07-17 19:46:09 +04:00
Ethan Atkins
4876cb76a7 FS-11037: [mod_lua] reduce logging levels 2018-07-24 07:21:40 +00:00
Sergey Safarov
df1ab07ca4 FS-9924: Removed extra space in source files 2017-02-09 23:59:49 -05:00
Aron Podrigal
d3201c6335 FS-9741: lua expose db err str in freeeswitch.dbh
Added 2 methods to lua freeswitch.Dbh
`last_error()` Returns the error string from the last query or nil.
`clear_error()` clears the error string.
2016-11-21 21:11:03 +00:00
Anthony Minessale
9b8a5edd3d FS-9638 2016-11-10 12:09:00 -06:00
Mark Lipscombe
4e9977507d FS-8537: Passing nil to various lua functions causes segfault
Various functions exposed via lua do not check their parameters for null
causing freeswitch to segfault.

This change adds checking for null parameters and returns an error
instead of segfaulting.
2015-11-15 10:43:09 +11:00
Peter Wu
8e4423f126 Document Dbh.test_reactive, return saner values
In the FreeSWITCH core, the return value of switch_case_db_test_reactive
is ignored, but it is usable in LUA modules (and other bindings via
SWIG). The LUA API example[1] shows how to check the return value, but
that example miserably fails if the database did not exist before.

Changes:

 - Document the expected behavior of the test_reactive function.
 - Assert that test_sql and sql_reactive are both given. If either
   query is not given, the caller is using the wrong API.
 - When SCF_AUTO_SCHEMAS is cleared, use the return value of the
   test_sql execution. Does anybody use this? Why not remove it?
 - Do not unconditionally return SWITCH_FALSE when test_sql fails,
   instead allow it to become SWITCH_TRUE when reactive_sql passes.
 - Remove the unnecessary test_sql check for SCDB_TYPE_CORE_DB
   (this is now enforced through an assert check). (+reindent)
 - Clarify the error message of drop_sql, prepending "Ignoring" to
   the "SQL ERR" message.
 - LUA: Do not print "DBH NOT Connected" if the query fails. This was
   the initial source of confusion.

 [1]: https://confluence.freeswitch.org/display/FREESWITCH/Lua+API+Reference
2014-09-15 15:39:08 +02:00
Anthony Minessale
99765fbd9a FS-6241 --resolve 2014-02-20 01:25:12 +05:00
Anthony Minessale
2771498707 change to lua 5.2 2013-11-13 07:55:12 +05:00
Anthony Minessale
0ca2c2b0e7 print message before destroying obj 2013-03-22 10:28:15 -05:00
Anthony Minessale
117609d2b3 FS-5027 try this one 2013-01-23 14:32:04 -06:00
Anthony Minessale
120a0e3385 make it back-compat as possible instead 2013-01-22 10:26:51 -06:00
Anthony Minessale
6b6198e96f FS-5027 2013-01-22 09:55:15 -06:00
Anthony Minessale
081e261956 FS-4883 --resolve I can add this but if it leads to issues in the loaded code we may not have resoures to investigate 2012-11-29 08:58:44 -06:00
William King
48a0924b54 merge failure on my part. this should have been included. 2012-11-07 18:04:13 -08:00
William King
2cea7f0ff6 Enable mod_lua to use native pgsql dbh support 2012-11-07 17:47:46 -08:00
Ken Rice
2b6aa7fd04 FS-4015 --resolve 2012-03-27 15:40:05 -05:00
Anthony Minessale
f38c287a4b FS-3961 --resolve 2012-03-09 11:28:29 -06:00
Anthony Minessale
02ea0221ab fix proper return value on input callback in event case 2012-02-15 14:18:01 -06:00
Anthony Minessale
09ad887948 FS-3841 --resolve ok return the string "die" or "exit" from hanguphook to cause an error or call s:destroy("any err message"); either should now halt the script 2012-01-27 19:03:04 -06:00
Jeff Lenk
e414d99438 remove unreferenced variable 2011-04-22 21:23:46 -05:00
Jeff Lenk
88c83420bf FS-3210 remove unneeded log message already logged in docall 2011-03-31 12:10:02 -05:00
Anthony Minessale
c49c1fdea9 FS-3161 2011-03-17 17:21:41 -05:00
Leon de Rooij
425df0c783 Added test_reactive to mod_lua freeswitch.Dbh 2011-01-27 14:17:49 +01:00
Leon de Rooij
a01814794c Added optional core: prefix to first arg passed to freeswitch.Dbh for giving direct access to sqlite db 2011-01-27 13:10:26 +01:00
Brian West
d79cf48475 FS-2962 2011-01-05 11:45:48 -06:00
Leon de Rooij
09e6fd3f4e Make dbh:connected accessible from Lua - thanks Grmt 2011-01-03 12:20:06 +01:00
Leon de Rooij
7eae2b629e mod_lua: cannot assume idx != 0 if cb_fun is provided 2010-09-10 02:58:37 +02:00
Leon de Rooij
87db11afe0 Made 2nd arg to freeswitch.Dbh:query (cb func) optional 2010-09-10 01:36:27 +02:00
Anthony Minessale
26f2e095ef MODLANG-174 2010-09-07 11:21:25 -05:00
Mathieu Rene
ec90b19af5 MODLANG-158
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16843 d0543943-73ff-0310-b7d9-9358b9ac24b2
2010-02-27 20:00:28 +00:00
Anthony Minessale
df7637f687 change switch_strlen_zero to zstr
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15211 d0543943-73ff-0310-b7d9-9358b9ac24b2
2009-10-23 16:03:42 +00:00
Anthony Minessale
dce827321d pad buffer
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14832 d0543943-73ff-0310-b7d9-9358b9ac24b2
2009-09-11 17:34:12 +00:00
Brian West
d53d493ba7 MODLANG-116
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13993 d0543943-73ff-0310-b7d9-9358b9ac24b2
2009-06-27 00:18:47 +00:00
Anthony Minessale
4025b42470 fix hanguphook order of operations vs destroy method issue in c++ code
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12730 d0543943-73ff-0310-b7d9-9358b9ac24b2
2009-03-24 15:30:08 +00:00
Anthony Minessale
523e0653ed FSCORE-341
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12728 d0543943-73ff-0310-b7d9-9358b9ac24b2
2009-03-24 14:54:13 +00:00
Anthony Minessale
377043e0ef update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12718 d0543943-73ff-0310-b7d9-9358b9ac24b2
2009-03-22 21:32:08 +00:00
Anthony Minessale
4dbbe79d70 update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12717 d0543943-73ff-0310-b7d9-9358b9ac24b2
2009-03-22 21:19:25 +00:00
Anthony Minessale
749c21775a tweak lua hangup hook (part 2)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12714 d0543943-73ff-0310-b7d9-9358b9ac24b2
2009-03-22 18:35:55 +00:00
Anthony Minessale
ed327e6fe7 tweak lua hangup hook
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12713 d0543943-73ff-0310-b7d9-9358b9ac24b2
2009-03-22 18:23:24 +00:00
Anthony Minessale
c052a99837 dont eval blank string
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9311 d0543943-73ff-0310-b7d9-9358b9ac24b2
2008-08-16 15:56:29 +00:00
Brian West
12f01067c5 fix lua originate
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9297 d0543943-73ff-0310-b7d9-9358b9ac24b2
2008-08-14 17:35:46 +00:00
Brian West
23c0d9ebbf add unsetInputCallback method
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9296 d0543943-73ff-0310-b7d9-9358b9ac24b2
2008-08-14 17:20:34 +00:00
Anthony Minessale
6f6cd375ad tweak for MODLANG-77
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9244 d0543943-73ff-0310-b7d9-9358b9ac24b2
2008-08-11 18:47:30 +00:00
Anthony Minessale
b5751a46a9 tweak
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9065 d0543943-73ff-0310-b7d9-9358b9ac24b2
2008-07-16 22:04:31 +00:00
Anthony Minessale
df5afbcacd even more lang stuff
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9063 d0543943-73ff-0310-b7d9-9358b9ac24b2
2008-07-16 21:06:14 +00:00
Anthony Minessale
920ef82cb3 lang stuff
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9062 d0543943-73ff-0310-b7d9-9358b9ac24b2
2008-07-16 20:19:11 +00:00
Anthony Minessale
89b123d5b2 handle failed originate a little more gracefully (MODLANG-70)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9049 d0543943-73ff-0310-b7d9-9358b9ac24b2
2008-07-16 06:23:35 +00:00
Brian West
d6022f302a include session in hangup hook
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9015 d0543943-73ff-0310-b7d9-9358b9ac24b2
2008-07-14 15:38:44 +00:00