How to limit the number of users in each room?

Hey , we use jitsi meet for classroom .
is there any way to limit the number of users in room ?
i know we can limit the number of users with “muc_max_occupants” but this affects for all room .

for example :

room1 => limit to 20 user
room2 => limit to 10 user

Any help to get this resolved would be greatly appreciated.

I have not been able to find a pre-canned solution for setting max occupants per room.

However, I’ve just noticed that the muc_max_occupants module also considers max occupant if set on room event data, so if you find a way to set that you can influence the max values per roon.

No idea what’s the easiest/best way to set that. If I were to hazard a guess – if a hardcoded list of room (or room pattern) is sufficient then perhaps a custom module that hooks to muc-room-created event might work?

1 Like

Last week, we had add this https://github.com/jitsi/jitsi-meet/commit/a5fc75ed35dcaa1bc9718258139de74615061c03#diff-ae81089121c2c45027ac6233ec694cf57817d9f81184b388b105c843f1021087

So you need some other module to check what is the limit for the current room and set it to room._data.max_occupants, maybe on pre-create or create of the room …

1 Like

thanks for you reply , i checked the link but i didn’t understand how can i configure this !
Exactly where should I set this limit for the room ?

Thank you for more help

There is no such feature at the moment, you need ton implement it in a custom module, what I showed you is how to do it without changing the original code.

I had a quick attempt a something that can hopefully help you get started. It builds on top of an upcoming version of mod_muc_max_occupants which means that from the next release onwards, it will be easy to include in a deployment without changing official code.

  1. First of all, you will need the latest version of mod_muc_max_occupants which also checks event.room._data.max_occupants.

  2. Add custom module that will set event.room._data.max_occupants based on configured room name. Here’s a very basic example: https://gist.github.com/shawnchin/68d60a84d680e963a8a0352c71b91e5c

    • Copy that to /usr/share/jitsi-meet/prosody-plugins/mod_muc_per_room_max_occupants.lua
  3. Configure muc_max_occupants the usual way.

    • Your muc component config should look something like this
    Component "conference.meet.example.com" "muc"
       storage = "memory"
       modules_enabled = {
           "muc_meeting_id";
           "muc_domain_mapper";
           "muc_max_occupants"; 
       }
       muc_max_occupants = "5"  -- default max occupants for all rooms
       muc_access_whitelist = { "focus@auth.meet.example.com" }
    
  4. Configure the custom component to change max occupants based on room name

    Component "conference.meet.example.com" "muc"
       storage = "memory"
       modules_enabled = {
           "muc_meeting_id";
           "muc_domain_mapper";
           "muc_max_occupants"; 
           "muc_per_room_max_occupants";   -- ADD THIS
       }
       muc_max_occupants = "5"  -- default max occupants for all rooms
       muc_access_whitelist = { "focus@auth.meet.example.com" }
    
       max_occupants_for_room = {  -- override max_occupants for specific rooms
           class101 = 30; 
           class965 = 50;
       }
    

If this is set up correctly, then the config above will allow max 5 occupants for all rooms except class101 and class965 which will allow 30 and 50 occupants respectively.

I have not fully tested the module, but hopefully it works for simple use cases. For anything more complex, you’ll probably want to extend the module to use regex matches for room names instead, or perhaps make an API call to a custom endpoint which can dynamically return max_occupants per room.

Hope this helps.

Good luck.

3 Likes

Absolutely brilliant! Great job, @shawn! :+1:t5: