Skip to content

Commit

Permalink
Merge pull request #44 from bigbluebutton/develop
Browse files Browse the repository at this point in the history
v3.1.0
  • Loading branch information
prlanzarin authored Feb 21, 2024
2 parents 1cb9cae + c5eaddb commit ffc9b36
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 29 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

### v3.1.0

* feat(events): add guest field to user-joined/user-left

### v3.0.0

#### Changelog since v3.0.0-beta.5
Expand Down
48 changes: 24 additions & 24 deletions example/events/mapped-events.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{"data":{"type":"event","id":"meeting-created","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868","name":"random-9019868","is-breakout":false,"parent-id":"bbb-none","duration":0,"create-time":1698771157700,"create-date":"Tue Oct 31 13:52:37 BRT 2023","moderator-pass":"mp","viewer-pass":"ap","record":false,"voice-conf":"71347","dial-number":"613-555-1234","max-users":0,"metadata":{}}},"event":{"ts":1698771158138}}}
{"data":{"type":"event","id":"user-joined","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","name":"John Doe","role":"MODERATOR","presenter":false}},"event":{"ts":1698771164651}}}
{"data":{"type":"event","id":"user-presenter-assigned","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom"}},"event":{"ts":1698771164695}}}
{"data":{"type":"event","id":"user-presenter-assigned","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom"}},"event":{"ts":1698771164762}}}
{"data":{"type":"event","id":"user-presenter-assigned","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom"}},"event":{"ts":1698771164807}}}
{"data":{"type":"event","id":"user-joined","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_uxw0dzhtvk0l","external-user-id":"w_uxw0dzhtvk0l","name":"Mary Sue","role":"VIEWER","presenter":false}},"event":{"ts":1698771173896}}}
{"data":{"type":"event","id":"user-audio-voice-enabled","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","listening-only":false,"sharing-mic":true,"muted":false}},"event":{"ts":1698771180561}}}
{"data":{"type":"event","id":"user-audio-muted","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","muted":true}},"event":{"ts":1698771185945}}}
{"data":{"type":"event","id":"user-audio-unmuted","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","muted":false}},"event":{"ts":1698771197509}}}
{"data":{"type":"event","id":"user-audio-voice-disabled","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","listening-only":false,"sharing-mic":false,"muted":true}},"event":{"ts":1698771202728}}}
{"data":{"type":"event","id":"user-cam-broadcast-start","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","stream":"w_xfsb9gxtlfom_0e2313d7c9d39860e908e20cd196adc3a6b8bf5c16110fdadc63741f48193c19"}},"event":{"ts":1698771212439}}}
{"data":{"type":"event","id":"user-cam-broadcast-end","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","stream":"w_xfsb9gxtlfom_0e2313d7c9d39860e908e20cd196adc3a6b8bf5c16110fdadc63741f48193c19"}},"event":{"ts":1698771219314}}}
{"data":{"type":"event","id":"meeting-screenshare-started","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom"}},"event":{"ts":1698771224459}}}
{"data":{"type":"event","id":"meeting-screenshare-stopped","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom"}},"event":{"ts":1698771228671}}}
{"data":{"type":"event","id":"chat-group-message-sent","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"chat-message":{"id":"1698771232706-9idm9pxf","message":"Public chat test","sender":{"internal-user-id":"w_xfsb9gxtlfom","name":"John Doe","time":1698771232706}},"chat-id":"MAIN-PUBLIC-GROUP-CHAT"},"event":{"ts":1698771232718}}}
{"data":{"type":"event","id":"user-emoji-changed","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","emoji":"🙁"}},"event":{"ts":1698771238519}}}
{"data":{"type":"event","id":"user-emoji-changed","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","emoji":"none"}},"event":{"ts":1698771241768}}}
{"data":{"type":"event","id":"user-raise-hand-changed","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","raise-hand":true}},"event":{"ts":1698771246543}}}
{"data":{"type":"event","id":"user-raise-hand-changed","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","raise-hand":false}},"event":{"ts":1698771251456}}}
{"data":{"type":"event","id":"poll-started","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom"},"poll":{"id":"2be5820127b5f8efc050fa003e83ef53fa62c356-1698771157729/1/1698771266437","question":"ABCD Poll Test","answers":[{"id":0,"key":"A"},{"id":1,"key":"B"},{"id":2,"key":"C"},{"id":3,"key":"D"}]}},"event":{"ts":1698771266455}}}
{"data":{"type":"event","id":"poll-responded","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom"},"poll":{"id":"2be5820127b5f8efc050fa003e83ef53fa62c356-1698771157729/1/1698771266437","answerIds":[0]}},"event":{"ts":1698771271189}}}
{"data":{"type":"event","id":"user-left","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_uxw0dzhtvk0l","external-user-id":"w_uxw0dzhtvk0l"}},"event":{"ts":1698771293007}}}
{"data":{"type":"event","id":"user-left","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom"}},"event":{"ts":1698771303012}}}
{"data":{"type":"event","id":"meeting-ended","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"}},"event":{"ts":1698771310228}}}
{"data":{"type":"event","id":"meeting-created","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868","name":"random-9019868","is-breakout":false,"parent-id":"bbb-none","duration":0,"create-time":1698771157700,"create-date":"Tue Oct 31 13:52:37 BRT 2023","moderator-pass":"mp","viewer-pass":"ap","record":false,"voice-conf":"71347","dial-number":"613-555-1234","max-users":0,"metadata":{}}},"event":{"ts":1708381132686}}}
{"data":{"type":"event","id":"user-joined","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","name":"John Doe","role":"MODERATOR","presenter":false,"guest":false}},"event":{"ts":1708381133689}}}
{"data":{"type":"event","id":"user-presenter-assigned","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom"}},"event":{"ts":1708381134691}}}
{"data":{"type":"event","id":"user-presenter-assigned","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom"}},"event":{"ts":1708381135692}}}
{"data":{"type":"event","id":"user-presenter-assigned","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom"}},"event":{"ts":1708381136693}}}
{"data":{"type":"event","id":"user-joined","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_uxw0dzhtvk0l","external-user-id":"w_uxw0dzhtvk0l","name":"Mary Sue","role":"VIEWER","presenter":false,"guest":false}},"event":{"ts":1708381137694}}}
{"data":{"type":"event","id":"user-audio-voice-enabled","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","listening-only":false,"sharing-mic":true,"muted":false}},"event":{"ts":1708381138695}}}
{"data":{"type":"event","id":"user-audio-muted","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","muted":true}},"event":{"ts":1708381139696}}}
{"data":{"type":"event","id":"user-audio-unmuted","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","muted":false}},"event":{"ts":1708381140697}}}
{"data":{"type":"event","id":"user-audio-voice-disabled","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","listening-only":false,"sharing-mic":false,"muted":true}},"event":{"ts":1708381141698}}}
{"data":{"type":"event","id":"user-cam-broadcast-start","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","stream":"w_xfsb9gxtlfom_0e2313d7c9d39860e908e20cd196adc3a6b8bf5c16110fdadc63741f48193c19"}},"event":{"ts":1708381142699}}}
{"data":{"type":"event","id":"user-cam-broadcast-end","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","stream":"w_xfsb9gxtlfom_0e2313d7c9d39860e908e20cd196adc3a6b8bf5c16110fdadc63741f48193c19"}},"event":{"ts":1708381143701}}}
{"data":{"type":"event","id":"meeting-screenshare-started","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom"}},"event":{"ts":1708381144703}}}
{"data":{"type":"event","id":"meeting-screenshare-stopped","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom"}},"event":{"ts":1708381145704}}}
{"data":{"type":"event","id":"chat-group-message-sent","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"chat-message":{"id":"1698771232706-9idm9pxf","message":"Public chat test","sender":{"internal-user-id":"w_xfsb9gxtlfom","name":"John Doe","time":1698771232706}},"chat-id":"MAIN-PUBLIC-GROUP-CHAT"},"event":{"ts":1708381146705}}}
{"data":{"type":"event","id":"user-emoji-changed","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","emoji":"🙁"}},"event":{"ts":1708381147706}}}
{"data":{"type":"event","id":"user-emoji-changed","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","emoji":"none"}},"event":{"ts":1708381148707}}}
{"data":{"type":"event","id":"user-raise-hand-changed","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","raise-hand":true}},"event":{"ts":1708381149707}}}
{"data":{"type":"event","id":"user-raise-hand-changed","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","raise-hand":false}},"event":{"ts":1708381150710}}}
{"data":{"type":"event","id":"poll-started","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom"},"poll":{"id":"2be5820127b5f8efc050fa003e83ef53fa62c356-1698771157729/1/1698771266437","question":"ABCD Poll Test","answers":[{"id":0,"key":"A"},{"id":1,"key":"B"},{"id":2,"key":"C"},{"id":3,"key":"D"}]}},"event":{"ts":1708381151711}}}
{"data":{"type":"event","id":"poll-responded","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom"},"poll":{"id":"2be5820127b5f8efc050fa003e83ef53fa62c356-1698771157729/1/1698771266437","answerIds":[0]}},"event":{"ts":1708381152712}}}
{"data":{"type":"event","id":"user-left","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_uxw0dzhtvk0l","external-user-id":"w_uxw0dzhtvk0l","guest":false}},"event":{"ts":1708381153713}}}
{"data":{"type":"event","id":"user-left","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"},"user":{"internal-user-id":"w_xfsb9gxtlfom","external-user-id":"w_xfsb9gxtlfom","guest":false}},"event":{"ts":1708381154716}}}
{"data":{"type":"event","id":"meeting-ended","attributes":{"meeting":{"internal-meeting-id":"8043c8452ae9830aac14c517adff3839dbd9228f-1698771157700","external-meeting-id":"random-9019868"}},"event":{"ts":1708381155717}}}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bbb-webhooks",
"version": "3.0.0",
"version": "3.1.0",
"description": "A BigBlueButton mudule for events WebHooks",
"type": "module",
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions src/db/redis/user-mapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ class UserMappingCompartment extends StorageCompartmentKV {
return (mapping != null ? mapping.payload?.externalUserID : undefined);
}

isGuest(internalUserID) {
const user = this.getUser(internalUserID);
return user?.guest === true || user?.guest === 'true';
}

// Initializes global methods for this model.
initialize() {
return this.resync();
Expand Down
13 changes: 11 additions & 2 deletions src/process/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ export default class WebhooksEvent {
userTemplate(messageObj) {
const msgBody = messageObj.core.body;
const msgHeader = messageObj.core.header;
const extId = UserMapping.get().getExternalUserID(msgHeader.userId) || msgBody.extId || "";
const userId = msgHeader.userId;
const extId = UserMapping.get().getExternalUserID(userId) || msgBody.extId || "";
this.outputEvent = {
data: {
"type": "event",
Expand All @@ -279,7 +280,7 @@ export default class WebhooksEvent {
"external-meeting-id": IDMapping.get().getExternalMeetingID(messageObj.envelope.routing.meetingId)
},
"user":{
"internal-user-id": msgHeader.userId,
"internal-user-id": userId,
"external-user-id": extId,
"name": msgBody.name,
"role": msgBody.role,
Expand Down Expand Up @@ -318,6 +319,14 @@ export default class WebhooksEvent {
this.outputEvent.data["attributes"]["user"]["raise-hand"] = msgBody.raiseHand;
break;
}
case "user-joined":
case "user-left": {
const guest = msgBody.guest ?? UserMapping.get().isGuest(userId);
this.outputEvent.data["attributes"]["user"]["guest"] = typeof guest === 'boolean'
? guest
: guest === 'true';
break;
}
default:
break;
}
Expand Down

0 comments on commit ffc9b36

Please sign in to comment.