Hi fellow Jitsi developers,
I have created a prosody module that limits the total amount of concurrent users on Jitsi for one of our clients. The module works like a charm, the only thing that is not working as expected is the error message that a logged in user receives when he wants to create a new room. I am unable to figure out what I need return or send via the stanza error_reply that the error message for the user is not “connection.get_session_id_error”.
To strip it down to the most basic form, I just always return/send the error_reply via the hook as follows:
local st = require "util.stanza"; module:hook("muc-room-pre-create", function(event) local origin, stanza = event.origin, event.stanza; origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); return false; end)
I expected that the user will be presented with some kind of error message - ideally I would like it to be the same one that gets presented to the user when wanting to join a open room but the max occupancy is already reached. This message gets shown via
origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
which I took from the mod_muc_max_occupants.lua script, but with a “muc-occupant-pre-join” hook instead. I have no idea if type of hook and returned error message is somehow dependent on the user presented notification.
I also tried many other types of returns which I found from the other existing modules, like:
origin.send(st.error_reply(stanza, "cancel", "not-allowed", "Room and token mismatched")); origin.send(st.error_reply(stanza, "cancel", "not-allowed")); ...
but I am really just guessing here as I couldn’t find the documentation anywhere about the type of hooks that exist and the return types. Maybe someone could point me towards the correct resource?
The basic example above is basically the same action as in the mod_token_verification.lua script at the “muc-room-pre-create” section, so I am not sure why it is not working.