From 4e72601bee2884dd061c70d10a7ea147155dca3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=8F=D0=BD=20=D0=9C=D0=B8=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Wed, 4 Dec 2024 14:49:31 -0600 Subject: [PATCH] fix(speakerstats): Filters speaker stats to not include hidden participants. * fix(speakerstats): Filters speaker stats to not include hidden participants. * squash: Make recorder prefixes configurable. --- .../prosody-plugins/mod_speakerstats_component.lua | 11 +++++++---- resources/prosody-plugins/util.lib.lua | 7 +++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/resources/prosody-plugins/mod_speakerstats_component.lua b/resources/prosody-plugins/mod_speakerstats_component.lua index 3487b17fd6..4dc91faab6 100644 --- a/resources/prosody-plugins/mod_speakerstats_component.lua +++ b/resources/prosody-plugins/mod_speakerstats_component.lua @@ -1,8 +1,10 @@ local util = module:require "util"; local get_room_from_jid = util.get_room_from_jid; local room_jid_match_rewrite = util.room_jid_match_rewrite; +local is_jibri = util.is_jibri; local is_healthcheck_room = util.is_healthcheck_room; local process_host_module = util.process_host_module; +local is_transcriber_jigasi = util.is_transcriber_jigasi; local jid_resource = require "util.jid".resource; local st = require "util.stanza"; local socket = require "socket"; @@ -221,14 +223,15 @@ end -- Create SpeakerStats object for the joined user function occupant_joined(event) - local occupant, room = event.occupant, event.room; + local occupant, room, stanza = event.occupant, event.room, event.stanza; - if is_healthcheck_room(room.jid) or is_admin(occupant.bare_jid) then + if is_healthcheck_room(room.jid) + or is_admin(occupant.bare_jid) + or is_transcriber_jigasi(stanza) + or is_jibri(occupant) then return; end - local occupant = event.occupant; - local nick = jid_resource(occupant.nick); if room.speakerStats then diff --git a/resources/prosody-plugins/util.lib.lua b/resources/prosody-plugins/util.lib.lua index 1878cb75fb..3e6cecb270 100644 --- a/resources/prosody-plugins/util.lib.lua +++ b/resources/prosody-plugins/util.lib.lua @@ -31,6 +31,7 @@ local roomless_iqs = {}; local OUTBOUND_SIP_JIBRI_PREFIXES = { 'outbound-sip-jibri@', 'sipjibriouta@', 'sipjibrioutb@' }; local INBOUND_SIP_JIBRI_PREFIXES = { 'inbound-sip-jibri@', 'sipjibriina@', 'sipjibriina@' }; +local RECORDER_PREFIXES = module:get_option_inherited_set('recorder_prefixes', { 'recorder@recorder.', 'jibria@recorder.', 'jibrib@recorder.' }); local split_subdomain_cache = cache.new(1000); local extract_subdomain_cache = cache.new(1000); @@ -530,6 +531,10 @@ function is_sip_jibri_join(stanza) return false end +function is_jibri(occupant) + return starts_with_one_of(occupant.jid, RECORDER_PREFIXES) +end + -- process a host module directly if loaded or hooks to wait for its load function process_host_module(name, callback) local function process_host(host) @@ -595,8 +600,10 @@ end return { OUTBOUND_SIP_JIBRI_PREFIXES = OUTBOUND_SIP_JIBRI_PREFIXES; INBOUND_SIP_JIBRI_PREFIXES = INBOUND_SIP_JIBRI_PREFIXES; + RECORDER_PREFIXES = RECORDER_PREFIXES; extract_subdomain = extract_subdomain; is_feature_allowed = is_feature_allowed; + is_jibri = is_jibri; is_healthcheck_room = is_healthcheck_room; is_moderated = is_moderated; is_sip_jibri_join = is_sip_jibri_join;