Added module for filtering transcription requests from presence stanz… (#6404)
* Added module for filtering transcription requests from presence stanzas when the users making the requests do not have access to the transcription feature * Add comments explaining the functionality and configuration for the transcription filtering module. Co-authored-by: drimovecz <daniel.rimovecz@8x8.com>
This commit is contained in:
parent
5ea8e198c7
commit
3ab6b97b8b
|
@ -0,0 +1,31 @@
|
|||
--This module performs features checking when a transcription is requested.
|
||||
--If the transcription feature is not allowed, the tag indicating that a
|
||||
--transcription is being requested will be stripped from the presence stanza.
|
||||
--The module must be enabled under the muc component.
|
||||
local is_feature_allowed = module:require "util".is_feature_allowed;
|
||||
|
||||
module:log("info", "Loading mod_muc_transcription_filter!");
|
||||
local filtered_tag_name = "jitsi_participant_requestingTranscription";
|
||||
|
||||
function filter_transcription_tag(event)
|
||||
local stanza = event.stanza;
|
||||
local session = event.origin;
|
||||
if stanza and stanza.name == "presence" then
|
||||
if not is_feature_allowed(session,'transcription') then
|
||||
stanza:maptags(function(tag)
|
||||
if tag and tag.name == filtered_tag_name then
|
||||
module:log("info", "Removing %s tag from presence stanza!", filtered_tag_name);
|
||||
return nil;
|
||||
else
|
||||
return tag;
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module:hook("presence/bare", filter_transcription_tag);
|
||||
module:hook("presence/full", filter_transcription_tag);
|
||||
module:hook("presence/host", filter_transcription_tag);
|
||||
|
||||
module:log("info", "Loaded mod_muc_transcription_filter!");
|
Loading…
Reference in New Issue