Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion event_sync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ Component "esync.meet.mydomain.com" "event_sync_component"
return code >= 500 or code == 408
end

-- Optionally include total_dominant_speaker_time (milliseconds) in payload for occupant-left and room-destroyed
-- Optionally
-- include total_dominant_speaker_time (milliseconds) in payload for occupant-left and room-destroyed
include_speaker_stats = true
-- include complete JWT user context in payload for occupant joined and occupant left
include_user_info = true
```
23 changes: 15 additions & 8 deletions event_sync/mod_event_sync_component.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
--
-- --- The following are all optional
-- include_speaker_stats = true -- if true, total_dominant_speaker_time included in occupant payload
-- include_user_info = true -- if true, user info from jitsi_meet_context_user included in occupant payload
-- api_headers = {
-- ["Authorization"] = "Bearer TOKEN-237958623045";
-- }
Expand Down Expand Up @@ -39,6 +40,7 @@ local api_retry_count = tonumber(module:get_option("api_retry_count", 3));
local api_retry_delay = tonumber(module:get_option("api_retry_delay", 1));

local include_speaker_stats = module:get_option("include_speaker_stats", false);
local include_user_info = module:get_option("include_user_info", false);


-- Option for user to control HTTP response codes that will result in a retry.
Expand Down Expand Up @@ -143,16 +145,21 @@ end
--- Handle new occupant joining room
function EventData:on_occupant_joined(occupant_jid, event_origin)
local user_context = event_origin.jitsi_meet_context_user or {};

-- N.B. we only store user details on join and assume they don't change throughout the duration of the meeting
local occupant_data = {
occupant_jid = occupant_jid;
name = user_context.name;
id = user_context.id;
email = user_context.email;
occupant_jid = occupant_jid;
joined_at = now();
left_at = nil;
};
-- N.B. we only store user details on join and assume they don't change throughout the duration of the meeting
if include_user_info then
for k,v in pairs(user_context) do
occupant_data[k] = v;
end
else
occupant_data["name"] = user_context.name;
occupant_data["id"] = user_context.id;
occupant_data["email"] = user_context.email;
end

self.occupants[occupant_jid] = occupant_data;
self.active[occupant_jid] = true;
Expand Down Expand Up @@ -297,7 +304,7 @@ function occupant_joined(event)
end

local occupant_data = room_data:on_occupant_joined(occupant_jid, event.origin);
module:log("info", "New occupant - %s", json.encode(occupant_data));
module:log("info", "New occupant in room: %s - %s", room.jid, json.encode(occupant_data));

local payload = {
['event_name'] = 'muc-occupant-joined';
Expand Down Expand Up @@ -330,7 +337,7 @@ function occupant_left(event)
end

local occupant_data = room_data:on_occupant_leave(occupant_jid, room);
module:log("info", "Occupant left - %s", json.encode(occupant_data));
module:log("info", "Occupant left in room: %s - %s", room.jid, json.encode(occupant_data));

local payload = {
['event_name'] = 'muc-occupant-left';
Expand Down