Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat: Adds option to print not-allowed errors we sent back to client.

damencho68f030bb7f87
diff --git a/resources/prosody-plugins/mod_muc_domain_mapper.lua b/resources/prosody-plugins/mod_muc_domain_mapper.lua
index ea744f440f..c9c7a53712 100644
--- a/resources/prosody-plugins/mod_muc_domain_mapper.lua
+++ b/resources/prosody-plugins/mod_muc_domain_mapper.lua
@@ -11,12 +11,14 @@ if not muc_domain_base then
return
end
+local log_not_allowed_errors = module:get_option_boolean('muc_mapper_log_not_allowed_errors', false);
+
local util = module:require "util";
local room_jid_match_rewrite = util.room_jid_match_rewrite;
local internal_room_jid_match_rewrite = util.internal_room_jid_match_rewrite;
-- We must filter stanzas in order to hook in to all incoming and outgoing messaging which skips the stanza routers
-function filter_stanza(stanza)
+function filter_stanza(stanza, session)
if stanza.skipMapping then
return stanza;
end
@@ -36,6 +38,16 @@ function filter_stanza(stanza)
if stanza.attr.from then
stanza.attr.from = internal_room_jid_match_rewrite(stanza.attr.from, stanza)
end
+
+ if log_not_allowed_errors and stanza.name == 'presence' and stanza.attr.type == 'error' then
+ local error = stanza:get_child('error');
+ if error and error.attr.type == 'cancel'
+ and error:get_child('not-allowed', 'urn:ietf:params:xml:ns:xmpp-stanzas')
+ and not session.jitsi_not_allowed_logged then
+ session.jitsi_not_allowed_logged = true;
+ session.log('error', 'Not allowed presence %s', stanza);
+ end
+ end
end
return stanza;
end