Commit a3ec4dfd authored by Johannes Barthel's avatar Johannes Barthel
Browse files

use redis's pubsub instead of mongo's for compatibility with bbb2.2

parent 078376a4
*.deb
senfsip-moderated-mute*
!senfsip-moderated-mute.service
\ No newline at end of file
!senfsip-moderated-mute.service
packages/
......@@ -3,6 +3,7 @@
import greenswitch
from xml.dom.minidom import parse
import pymongo
import redis
import json
import logging
import subprocess
......@@ -71,22 +72,27 @@ class ModeratedMic:
self.fs.process_events()
def run_as_permissions_change_handler(self):
# main loop iterates over mongodb events
for change in self.db.meetings.watch([{ "$match" : {"operationType" : "update" }}]):
print("got meeting update event")
try:
mics_disabled = change['updateDescription']['updatedFields']['lockSettingsProps']['disableMic']
except KeyError as _:
print("the meeting update did not concern permissions")
conn = redis.Redis()
ps = conn.pubsub()
ps.subscribe("to-akka-apps-redis-channel")
l = ps.listen()
# main loop iterates over redis events
for msg in l:
if msg["type"] != 'message':
continue
msg = json.loads(msg["data"])["core"]
if msg["header"]["name"] != "ChangeLockSettingsInMeetingCmdMsg":
continue
meeting_id = msg["header"]["meetingId"]
mics_disabled = msg["body"]["disableMic"]
print("meeting {} is now {}".format(meeting_id, "locked" if mics_disabled else "unlocked"))
if not mics_disabled:
print("mics not disabled")
continue
print("mics are disabled")
# note: this will mute mics "again" if they were already muted
# and some other permission change caused the event to fire.
meeting_mongo_id = change['documentKey']['_id']
meeting = self.db.meetings.find_one({"_id": meeting_mongo_id})
meeting = self.db.meetings.find_one({"meetingId": meeting_id})
#print("meeting",meeting)
conference_id = meeting["voiceProp"]["voiceConf"]
for user in self.db.voiceUsers.find({"joined":True, "meetingId": meeting["meetingId"]}):
......
wheel==0.36.2
greenswitch==0.0.11
pymongo==3.11.3
redis==3.5.3
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment