Hi @danmaby,
I’m also trying to enable mod_muc_max_occupants.lua, in my jitsi meet settings and still had no luck.
Here is my /etc/prosody/conf.avail/mydomain.org:
Component “conference.mydomain.org” “muc”
storage = “memory”
muc_max_occupants = 3
modules_enabled = {
“muc_meeting_id”;
“muc_domain_mapper”;
– “token_verification”;
“muc_max_occupants”;
}
admins = { “focus@mydomain.org” }
muc_room_locking = false
muc_room_default_public_jids = true
And here is the contents of mod_muc_max_occupants.lua in /usr/share/jitsi-meet/prosody-plugins:
– MUC Max Occupants
– Configuring muc_max_occupants will set a limit of the maximum number
– of participants that will be able to join in a room.
– Participants in muc_access_whitelist will not be counted for the
– max occupants value (values are jids like recorder@jitsi.meeet.example.com).
– This module is configured under the muc component that is used for jitsi-meet
local split_jid = require “util.jid”.split;
local st = require “util.stanza”;
local it = require “util.iterators”;
local whitelist = module:get_option_set(“muc_access_whitelist”);
local MAX_OCCUPANTS = module:get_option_number(“muc_max_occupants”, -1);
local function count_keys(t)
return it.count(it.keys(t));
end
local function check_for_max_occupants(event)
local room, origin, stanza = event.room, event.origin, event.stanza;
local actor = stanza.attr.from;
local user, domain, res = split_jid(stanza.attr.from);
–no user object means no way to check for max occupants
if user == nil then
return
end
– If we’re a whitelisted user joining the room, don’t bother checking the max
– occupants.
if whitelist and whitelist:contains(domain) or whitelist:contains(user…’@’…domain) then
return;
end
if room and not room._jid_nick[stanza.attr.from] then
local count = count_keys(room._occupants);
local slots = MAX_OCCUPANTS;
-- If there is no whitelist, just check the count.
if not whitelist and count >= MAX_OCCUPANTS then
module:log("info", "Attempt to enter a maxed out MUC");
origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
return true;
end
-- TODO: Are Prosody hooks atomic, or is this a race condition?
-- For each person in the room that's not on the whitelist, subtract one
-- from the count.
for _, occupant in room:each_occupant() do
user, domain, res = split_jid(occupant.bare_jid);
if not whitelist:contains(domain) and not whitelist:contains(user..'@'..domain) then
slots = slots - 1
end
end
-- If the room is full (<0 slots left), error out.
if slots <= 0 then
module:log("info", "Attempt to enter a maxed out MUC");
origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
return true;
end
end
end
if MAX_OCCUPANTS > 0 then
module:hook(“muc-occupant-pre-join”, check_for_max_occupants, 3);
end
I’ve already set check_for_max_occupants, 3 the default value is 10 and i’ve already update prosody version to: 11.5.
Here is the content of the log files:
-
prosody.err:
Jun 30 08:45:30 c2s55facaaf2760 error Traceback[c2s]: …are/jitsi-meet/prosody-plugins/mod_muc_max_occupants.lua:30: attempt to index upvalue ‘whitelist’ (a nil value)
stack traceback:
…are/jitsi-meet/prosody-plugins/mod_muc_max_occupants.lua:30: in function ‘?’
/usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75>
(…tail calls…)
/usr/lib/prosody/modules/muc/muc.lib.lua:561: in function </usr/lib/prosody/modules/muc/muc.lib.lua:498>
(…tail calls…)
/usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75>
(…tail calls…)
/usr/lib/prosody/core/stanza_router.lua:180: in function ‘core_post_stanza’
/usr/lib/prosody/core/stanza_router.lua:127: in function ‘core_process_stanza’
/usr/lib/prosody/modules/mod_c2s.lua:275: in function ‘func’
/usr/lib/prosody/util/async.lua:127: in function </usr/lib/prosody/util/async.lua:125>
-
prosody.log:
Jun 30 08:45:17 bosh7dfaee98-c39a-4c64-8642-cff0074ebba6 info BOSH client disconnected: session close
Jun 30 08:45:30 c2s55facaaf2760 error Traceback[c2s]: …are/jitsi-meet/prosody-plugins/mod_muc_max_occupants.lua:30: attempt to index upvalue ‘whitelist’ (a nil value)
stack traceback:
…are/jitsi-meet/prosody-plugins/mod_muc_max_occupants.lua:30: in function ‘?’
/usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75>
(…tail calls…)
/usr/lib/prosody/modules/muc/muc.lib.lua:561: in function </usr/lib/prosody/modules/muc/muc.lib.lua:498>
(…tail calls…)
/usr/lib/prosody/util/events.lua:79: in function </usr/lib/prosody/util/events.lua:75>
(…tail calls…)
/usr/lib/prosody/core/stanza_router.lua:180: in function ‘core_post_stanza’
/usr/lib/prosody/core/stanza_router.lua:127: in function ‘core_process_stanza’
/usr/lib/prosody/modules/mod_c2s.lua:275: in function ‘func’
/usr/lib/prosody/util/async.lua:127: in function </usr/lib/prosody/util/async.lua:125>
Could anyone give some advices regarding this problem? 
Thanks