Use os.time instead of mysql native function

Odd, but on some deployments LUA wont accept unixtime stamp functions (regardless it works on CLI). So, to workaround this, lets use os.time() which it returns the same value expected.
This commit is contained in:
Luis Daniel Lucio Quiroz
2015-08-09 21:56:28 -06:00
parent ade62be0f1
commit 780b69a253
@@ -170,7 +170,8 @@
sql = sql .. "WHERE reg_user = '"..dialed_extension.."' "; sql = sql .. "WHERE reg_user = '"..dialed_extension.."' ";
sql = sql .. "AND realm = '"..domain_name.."' "; sql = sql .. "AND realm = '"..domain_name.."' ";
if (database["type"] == "mysql") then if (database["type"] == "mysql") then
sql = sql .. "AND expires > unix_timestamp(NOW())"; now = os.time();
sql = sql .. "AND expires > "..now;
else else
sql = sql .. "AND to_timestamp(expires) > NOW()"; sql = sql .. "AND to_timestamp(expires) > NOW()";
end end