Sfoglia il codice sorgente

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.
factor2
Дамян Минков 10 mesi fa
parent
commit
4e72601bee
Nessun account collegato all'indirizzo email del committer

+ 7
- 4
resources/prosody-plugins/mod_speakerstats_component.lua Vedi File

1
 local util = module:require "util";
1
 local util = module:require "util";
2
 local get_room_from_jid = util.get_room_from_jid;
2
 local get_room_from_jid = util.get_room_from_jid;
3
 local room_jid_match_rewrite = util.room_jid_match_rewrite;
3
 local room_jid_match_rewrite = util.room_jid_match_rewrite;
4
+local is_jibri = util.is_jibri;
4
 local is_healthcheck_room = util.is_healthcheck_room;
5
 local is_healthcheck_room = util.is_healthcheck_room;
5
 local process_host_module = util.process_host_module;
6
 local process_host_module = util.process_host_module;
7
+local is_transcriber_jigasi = util.is_transcriber_jigasi;
6
 local jid_resource = require "util.jid".resource;
8
 local jid_resource = require "util.jid".resource;
7
 local st = require "util.stanza";
9
 local st = require "util.stanza";
8
 local socket = require "socket";
10
 local socket = require "socket";
221
 
223
 
222
 -- Create SpeakerStats object for the joined user
224
 -- Create SpeakerStats object for the joined user
223
 function occupant_joined(event)
225
 function occupant_joined(event)
224
-    local occupant, room = event.occupant, event.room;
226
+    local occupant, room, stanza = event.occupant, event.room, event.stanza;
225
 
227
 
226
-    if is_healthcheck_room(room.jid) or is_admin(occupant.bare_jid) then
228
+    if is_healthcheck_room(room.jid)
229
+        or is_admin(occupant.bare_jid)
230
+        or is_transcriber_jigasi(stanza)
231
+        or is_jibri(occupant) then
227
         return;
232
         return;
228
     end
233
     end
229
 
234
 
230
-    local occupant = event.occupant;
231
-
232
     local nick = jid_resource(occupant.nick);
235
     local nick = jid_resource(occupant.nick);
233
 
236
 
234
     if room.speakerStats then
237
     if room.speakerStats then

+ 7
- 0
resources/prosody-plugins/util.lib.lua Vedi File

31
 
31
 
32
 local OUTBOUND_SIP_JIBRI_PREFIXES = { 'outbound-sip-jibri@', 'sipjibriouta@', 'sipjibrioutb@' };
32
 local OUTBOUND_SIP_JIBRI_PREFIXES = { 'outbound-sip-jibri@', 'sipjibriouta@', 'sipjibrioutb@' };
33
 local INBOUND_SIP_JIBRI_PREFIXES = { 'inbound-sip-jibri@', 'sipjibriina@', 'sipjibriina@' };
33
 local INBOUND_SIP_JIBRI_PREFIXES = { 'inbound-sip-jibri@', 'sipjibriina@', 'sipjibriina@' };
34
+local RECORDER_PREFIXES = module:get_option_inherited_set('recorder_prefixes', { 'recorder@recorder.', 'jibria@recorder.', 'jibrib@recorder.' });
34
 
35
 
35
 local split_subdomain_cache = cache.new(1000);
36
 local split_subdomain_cache = cache.new(1000);
36
 local extract_subdomain_cache = cache.new(1000);
37
 local extract_subdomain_cache = cache.new(1000);
530
     return false
531
     return false
531
 end
532
 end
532
 
533
 
534
+function is_jibri(occupant)
535
+    return starts_with_one_of(occupant.jid, RECORDER_PREFIXES)
536
+end
537
+
533
 -- process a host module directly if loaded or hooks to wait for its load
538
 -- process a host module directly if loaded or hooks to wait for its load
534
 function process_host_module(name, callback)
539
 function process_host_module(name, callback)
535
     local function process_host(host)
540
     local function process_host(host)
595
 return {
600
 return {
596
     OUTBOUND_SIP_JIBRI_PREFIXES = OUTBOUND_SIP_JIBRI_PREFIXES;
601
     OUTBOUND_SIP_JIBRI_PREFIXES = OUTBOUND_SIP_JIBRI_PREFIXES;
597
     INBOUND_SIP_JIBRI_PREFIXES = INBOUND_SIP_JIBRI_PREFIXES;
602
     INBOUND_SIP_JIBRI_PREFIXES = INBOUND_SIP_JIBRI_PREFIXES;
603
+    RECORDER_PREFIXES = RECORDER_PREFIXES;
598
     extract_subdomain = extract_subdomain;
604
     extract_subdomain = extract_subdomain;
599
     is_feature_allowed = is_feature_allowed;
605
     is_feature_allowed = is_feature_allowed;
606
+    is_jibri = is_jibri;
600
     is_healthcheck_room = is_healthcheck_room;
607
     is_healthcheck_room = is_healthcheck_room;
601
     is_moderated = is_moderated;
608
     is_moderated = is_moderated;
602
     is_sip_jibri_join = is_sip_jibri_join;
609
     is_sip_jibri_join = is_sip_jibri_join;

Loading…
Annulla
Salva