Replace tonumber function with # which casts the string to a number
This commit is contained in:
@@ -206,7 +206,7 @@
|
|||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
freeswitch.consoleLog("notice", "[conference center] SQL: " .. sql .. "; params:" .. json.encode(params) .. "; Rows: "..num_rows.."\n");
|
freeswitch.consoleLog("notice", "[conference center] SQL: " .. sql .. "; params:" .. json.encode(params) .. "; Rows: "..num_rows.."\n");
|
||||||
end
|
end
|
||||||
if (tonumber(num_rows) == 0) then
|
if (#num_rows == 0) then
|
||||||
local sql = {}
|
local sql = {}
|
||||||
table.insert(sql, "INSERT INTO v_conference_sessions ");
|
table.insert(sql, "INSERT INTO v_conference_sessions ");
|
||||||
table.insert(sql, "(");
|
table.insert(sql, "(");
|
||||||
@@ -651,14 +651,14 @@
|
|||||||
|
|
||||||
--set a conference parameter
|
--set a conference parameter
|
||||||
if (max_members ~= nil) then
|
if (max_members ~= nil) then
|
||||||
if (tonumber(max_members) > 0) then
|
if (#max_members > 0) then
|
||||||
--max members must be 2 or more
|
--max members must be 2 or more
|
||||||
session:execute("set","conference_max_members="..max_members);
|
session:execute("set","conference_max_members="..max_members);
|
||||||
if (conference_exists) then
|
if (conference_exists) then
|
||||||
cmd = "conference "..conference_room_uuid.."@"..domain_name.." get count";
|
cmd = "conference "..conference_room_uuid.."@"..domain_name.." get count";
|
||||||
count = trim(api:executeString(cmd));
|
count = trim(api:executeString(cmd));
|
||||||
if (count ~= nil) then
|
if (count ~= nil) then
|
||||||
if (tonumber(count) >= tonumber(max_members)) then
|
if (#count >= #max_members) then
|
||||||
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-locked.wav");
|
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-locked.wav");
|
||||||
session:hangup("CALL_REJECTED");
|
session:hangup("CALL_REJECTED");
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user