diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserConnectedToGlobalAudioMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserConnectedToGlobalAudioMsgHdlr.scala index a2ff5546bf..63a6f57abb 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserConnectedToGlobalAudioMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/UserConnectedToGlobalAudioMsgHdlr.scala @@ -19,8 +19,8 @@ trait UserConnectedToGlobalAudioMsgHdlr { val header = BbbClientMsgHeader(UserJoinedVoiceConfToClientEvtMsg.NAME, props.meetingProp.intId, vu.intId) val body = UserJoinedVoiceConfToClientEvtMsgBody(voiceConf = msg.header.voiceConf, intId = vu.intId, voiceUserId = vu.intId, - callingWith = vu.callingWith, callerName = vu.callerName, - callerNum = vu.callerNum, muted = true, talking = false, listenOnly = true) + callingWith = vu.callingWith, callerName = vu.callerName, callerNum = vu.callerNum, color = vu.color, + muted = true, talking = false, listenOnly = true) val event = UserJoinedVoiceConfToClientEvtMsg(header, body) val msgEvent = BbbCommonEnvCoreMsg(envelope, event) outGW.send(msgEvent) @@ -36,6 +36,7 @@ trait UserConnectedToGlobalAudioMsgHdlr { callingWith = "flash", callerName = user.name, callerNum = user.name, + color = user.color, muted = true, talking = false, listenOnly = true, diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ValidateAuthTokenReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ValidateAuthTokenReqMsgHdlr.scala index cdaf704920..3e36f9734d 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ValidateAuthTokenReqMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/users/ValidateAuthTokenReqMsgHdlr.scala @@ -130,7 +130,7 @@ trait ValidateAuthTokenReqMsgHdlr extends HandlerHelpers { def sendAllVoiceUsersInMeeting(requesterId: String, voiceUsers: VoiceUsers, meetingId: String): Unit = { val vu = VoiceUsers.findAll(voiceUsers).map { u => VoiceConfUser(intId = u.intId, voiceUserId = u.voiceUserId, callingWith = u.callingWith, callerName = u.callerName, - callerNum = u.callerNum, muted = u.muted, talking = u.talking, listenOnly = u.listenOnly) + callerNum = u.callerNum, color = u.color, muted = u.muted, talking = u.talking, listenOnly = u.listenOnly) } val event = MsgBuilder.buildGetVoiceUsersMeetingRespMsg(meetingId, requesterId, vu) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/SyncGetVoiceUsersMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/SyncGetVoiceUsersMsgHdlr.scala index 004cc6ce4b..3ffc7010cb 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/SyncGetVoiceUsersMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/SyncGetVoiceUsersMsgHdlr.scala @@ -14,7 +14,7 @@ trait SyncGetVoiceUsersMsgHdlr { def buildSyncGetVoiceUsersRespMsg(): BbbCommonEnvCoreMsg = { val voiceUsers = VoiceUsers.findAll(liveMeeting.voiceUsers).map { u => VoiceConfUser(intId = u.intId, voiceUserId = u.voiceUserId, callingWith = u.callingWith, callerName = u.callerName, - callerNum = u.callerNum, muted = u.muted, talking = u.talking, listenOnly = u.listenOnly) + callerNum = u.callerNum, color = u.color, muted = u.muted, talking = u.talking, listenOnly = u.listenOnly) } val routing = Routing.addMsgToHtml5InstanceIdRouting(liveMeeting.props.meetingProp.intId, liveMeeting.props.systemProps.html5InstanceId.toString) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/UserJoinedVoiceConfEvtMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/UserJoinedVoiceConfEvtMsgHdlr.scala index 354473b0f2..6bfa2907ee 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/UserJoinedVoiceConfEvtMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/UserJoinedVoiceConfEvtMsgHdlr.scala @@ -88,6 +88,7 @@ trait UserJoinedVoiceConfEvtMsgHdlr extends SystemConfiguration { msg.body.callingWith, msg.body.callerIdName, msg.body.callerIdNum, + userColor, msg.body.muted, msg.body.talking, "freeswitch" diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala index 776731fe41..0a80fe578d 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/VoiceApp.scala @@ -7,9 +7,10 @@ import org.bigbluebutton.core.bus.InternalEventBus import org.bigbluebutton.core2.MeetingStatus2x import org.bigbluebutton.core2.message.senders.MsgBuilder import org.bigbluebutton.common2.msgs._ -import org.bigbluebutton.core.running.{ LiveMeeting, MeetingActor, OutMsgRouter } +import org.bigbluebutton.core.running.{LiveMeeting, MeetingActor, OutMsgRouter} import org.bigbluebutton.core.models._ import org.bigbluebutton.core.apps.users.UsersApp +import org.bigbluebutton.core.util.ColorPicker object VoiceApp extends SystemConfiguration { @@ -164,6 +165,7 @@ object VoiceApp extends SystemConfiguration { cvu.callingWith, cvu.callerIdName, cvu.callerIdNum, + ColorPicker.nextColor(liveMeeting.props.meetingProp.intId), cvu.muted, cvu.talking, cvu.calledInto @@ -213,6 +215,7 @@ object VoiceApp extends SystemConfiguration { callingWith: String, callerIdName: String, callerIdNum: String, + color: String, muted: Boolean, talking: Boolean, callingInto: String @@ -240,6 +243,7 @@ object VoiceApp extends SystemConfiguration { voiceUserState.voiceUserId, voiceUserState.callerName, voiceUserState.callerNum, + voiceUserState.color, voiceUserState.muted, voiceUserState.talking, voiceUserState.callingWith, @@ -267,6 +271,7 @@ object VoiceApp extends SystemConfiguration { callingWith, callerIdName, callerIdNum, + color, muted, talking, listenOnly = isListenOnly, diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/VoiceUsers.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/VoiceUsers.scala index b89414f50b..9886fba1c4 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/VoiceUsers.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/VoiceUsers.scala @@ -174,6 +174,7 @@ case class VoiceUserState( callingWith: String, callerName: String, callerNum: String, + color: String, muted: Boolean, talking: Boolean, listenOnly: Boolean, diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/guests/GuestsWaitingApprovedMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/guests/GuestsWaitingApprovedMsgHdlr.scala index fadb99ad0c..491e476800 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/guests/GuestsWaitingApprovedMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/handlers/guests/GuestsWaitingApprovedMsgHdlr.scala @@ -42,6 +42,7 @@ trait GuestsWaitingApprovedMsgHdlr extends HandlerHelpers with RightsManagementT "none", dialInUser.name, dialInUser.name, + dialInUser.color, MeetingStatus2x.isMeetingMuted(liveMeeting.status), false, "freeswitch" diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala index 56213b3712..85fb84d61f 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/testdata/FakeUserGenerator.scala @@ -65,7 +65,7 @@ object FakeUserGenerator { val voiceUserId = RandomStringGenerator.randomAlphanumericString(8) val lastFloorTime = System.currentTimeMillis().toString(); VoiceUserState(intId = user.id, voiceUserId = voiceUserId, callingWith, callerName = user.name, - callerNum = user.name, muted, talking, listenOnly, "freeswitch", System.currentTimeMillis(), floor, lastFloorTime) + callerNum = user.name, "#ff6242", muted, talking, listenOnly, "freeswitch", System.currentTimeMillis(), floor, lastFloorTime) } def createFakeVoiceOnlyUser(callingWith: String, muted: Boolean, talking: Boolean, @@ -75,7 +75,7 @@ object FakeUserGenerator { val name = getRandomElement(firstNames, random) + " " + getRandomElement(lastNames, random) val lastFloorTime = System.currentTimeMillis().toString(); VoiceUserState(intId, voiceUserId = voiceUserId, callingWith, callerName = name, - callerNum = name, muted, talking, listenOnly, "freeswitch", System.currentTimeMillis(), floor, lastFloorTime) + callerNum = name, "#ff6242", muted, talking, listenOnly, "freeswitch", System.currentTimeMillis(), floor, lastFloorTime) } def createFakeWebcamStreamFor(userId: String, subscribers: Set[String]): WebcamStream = { diff --git a/akka-bbb-apps/src/test/scala/org/bigbluebutton/core2/testdata/TestDataGen.scala b/akka-bbb-apps/src/test/scala/org/bigbluebutton/core2/testdata/TestDataGen.scala index 6e97c2b86f..10cf8ed3cf 100755 --- a/akka-bbb-apps/src/test/scala/org/bigbluebutton/core2/testdata/TestDataGen.scala +++ b/akka-bbb-apps/src/test/scala/org/bigbluebutton/core2/testdata/TestDataGen.scala @@ -24,7 +24,7 @@ object TestDataGen { listenOnly: Boolean): VoiceUserState = { val voiceUserId = RandomStringGenerator.randomAlphanumericString(8) VoiceUserState(intId = user.id, voiceUserId = voiceUserId, callingWith, callerName = user.name, - callerNum = user.name, muted, talking, listenOnly) + callerNum = user.name, "#ff6242", muted, talking, listenOnly) } def createFakeVoiceOnlyUser(callingWith: String, muted: Boolean, talking: Boolean, @@ -32,7 +32,7 @@ object TestDataGen { val voiceUserId = RandomStringGenerator.randomAlphanumericString(8) val intId = "v_" + RandomStringGenerator.randomAlphanumericString(16) VoiceUserState(intId, voiceUserId = voiceUserId, callingWith, callerName = name, - callerNum = name, muted, talking, listenOnly) + callerNum = name, "#ff6242", muted, talking, listenOnly) } def createFakeWebcamStreamFor(userId: String, subscribers: Set[String]): WebcamStream = { diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala index 6736acef1b..9e7d62f8f2 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/UsersMsgs.scala @@ -373,7 +373,7 @@ object GetVoiceUsersMeetingRespMsg { case class GetVoiceUsersMeetingRespMsg(header: BbbClientMsgHeader, body: GetVoiceUsersMeetingRespMsgBody) extends BbbCoreMsg case class GetVoiceUsersMeetingRespMsgBody(users: Vector[VoiceConfUser]) case class VoiceConfUser(intId: String, voiceUserId: String, callingWith: String, callerName: String, - callerNum: String, muted: Boolean, talking: Boolean, listenOnly: Boolean) + callerNum: String, color: String, muted: Boolean, talking: Boolean, listenOnly: Boolean) /** * Sent from client to add user to the presenter group of a meeting. diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala index 7abc4127c5..7e54df08ec 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala @@ -408,7 +408,7 @@ case class UserJoinedVoiceConfEvtMsgBody(voiceConf: String, voiceUserId: String, object UserJoinedVoiceConfToClientEvtMsg { val NAME = "UserJoinedVoiceConfToClientEvtMsg" } case class UserJoinedVoiceConfToClientEvtMsg(header: BbbClientMsgHeader, body: UserJoinedVoiceConfToClientEvtMsgBody) extends BbbCoreMsg case class UserJoinedVoiceConfToClientEvtMsgBody(voiceConf: String, intId: String, voiceUserId: String, callerName: String, - callerNum: String, muted: Boolean, + callerNum: String, color: String, muted: Boolean, talking: Boolean, callingWith: String, listenOnly: Boolean) /** diff --git a/bigbluebutton-html5/imports/api/users/server/modifiers/addDialInUser.js b/bigbluebutton-html5/imports/api/users/server/modifiers/addDialInUser.js index 5a1ce8f79b..9cb82b76e2 100644 --- a/bigbluebutton-html5/imports/api/users/server/modifiers/addDialInUser.js +++ b/bigbluebutton-html5/imports/api/users/server/modifiers/addDialInUser.js @@ -8,7 +8,7 @@ export default async function addDialInUser(meetingId, voiceUser) { const USER_CONFIG = Meteor.settings.public.user; const ROLE_VIEWER = USER_CONFIG.role_viewer; - const { intId, callerName } = voiceUser; + const { intId, callerName, color } = voiceUser; const voiceOnlyUser = { intId, @@ -23,6 +23,7 @@ export default async function addDialInUser(meetingId, voiceUser) { presenter: false, locked: false, // TODO avatar: '', + color, pin: false, clientType: 'dial-in-user', }; diff --git a/bigbluebutton-html5/imports/api/users/server/modifiers/addUser.js b/bigbluebutton-html5/imports/api/users/server/modifiers/addUser.js index b659e56d25..b8a476989b 100755 --- a/bigbluebutton-html5/imports/api/users/server/modifiers/addUser.js +++ b/bigbluebutton-html5/imports/api/users/server/modifiers/addUser.js @@ -70,6 +70,7 @@ export default async function addUser(meetingId, userData) { intId: userId, callerName: user.name, callerNum: '', + color: user.color, muted: false, talking: false, callingWith: '', diff --git a/bigbluebutton-html5/imports/api/voice-users/server/handlers/getVoiceUsers.js b/bigbluebutton-html5/imports/api/voice-users/server/handlers/getVoiceUsers.js index aed808a9a2..d121d76bb9 100644 --- a/bigbluebutton-html5/imports/api/voice-users/server/handlers/getVoiceUsers.js +++ b/bigbluebutton-html5/imports/api/voice-users/server/handlers/getVoiceUsers.js @@ -40,6 +40,7 @@ export default async function handleGetVoiceUsers({ body }, meetingId) { callerName: user.callerName, callerNum: user.callerNum, muted: user.muted, + color: user.color, talking: user.talking, callingWith: user.callingWith, listenOnly: user.listenOnly, diff --git a/bigbluebutton-html5/imports/api/voice-users/server/handlers/joinVoiceUser.js b/bigbluebutton-html5/imports/api/voice-users/server/handlers/joinVoiceUser.js index 760fa67871..2781e3d220 100755 --- a/bigbluebutton-html5/imports/api/voice-users/server/handlers/joinVoiceUser.js +++ b/bigbluebutton-html5/imports/api/voice-users/server/handlers/joinVoiceUser.js @@ -3,7 +3,6 @@ import Users from '/imports/api/users'; import addDialInUser from '/imports/api/users/server/modifiers/addDialInUser'; import addVoiceUser from '../modifiers/addVoiceUser'; - export default async function handleJoinVoiceUser({ body }, meetingId) { const voiceUser = body; voiceUser.joined = true; @@ -15,6 +14,7 @@ export default async function handleJoinVoiceUser({ body }, meetingId) { voiceUserId: String, callerName: String, callerNum: String, + color: String, muted: Boolean, talking: Boolean, callingWith: String, diff --git a/bigbluebutton-html5/imports/api/voice-users/server/handlers/voiceUsers.js b/bigbluebutton-html5/imports/api/voice-users/server/handlers/voiceUsers.js index 6036abb664..e8c836210c 100644 --- a/bigbluebutton-html5/imports/api/voice-users/server/handlers/voiceUsers.js +++ b/bigbluebutton-html5/imports/api/voice-users/server/handlers/voiceUsers.js @@ -5,7 +5,6 @@ import removeVoiceUser from '../modifiers/removeVoiceUser'; import updateVoiceUser from '../modifiers/updateVoiceUser'; import addVoiceUser from '../modifiers/addVoiceUser'; - export default async function handleVoiceUsers({ header, body }) { const { voiceUsers } = body; const { meetingId } = header; @@ -38,6 +37,7 @@ export default async function handleVoiceUsers({ header, body }) { intId: voice.intId, callerName: voice.callerName, callerNum: voice.callerNum, + color: voice.color, muted: voice.muted, talking: voice.talking, callingWith: voice.callingWith, diff --git a/bigbluebutton-html5/imports/api/voice-users/server/modifiers/addVoiceUser.js b/bigbluebutton-html5/imports/api/voice-users/server/modifiers/addVoiceUser.js index 25cb431846..2f5dc62694 100644 --- a/bigbluebutton-html5/imports/api/voice-users/server/modifiers/addVoiceUser.js +++ b/bigbluebutton-html5/imports/api/voice-users/server/modifiers/addVoiceUser.js @@ -1,7 +1,6 @@ import { check } from 'meteor/check'; import Logger from '/imports/startup/server/logger'; import VoiceUsers from '/imports/api/voice-users'; -import Users from '/imports/api/users'; import flat from 'flat'; export default async function addVoiceUser(meetingId, voiceUser) { @@ -11,6 +10,7 @@ export default async function addVoiceUser(meetingId, voiceUser) { intId: String, callerName: String, callerNum: String, + color: String, muted: Boolean, talking: Boolean, callingWith: String, @@ -27,19 +27,12 @@ export default async function addVoiceUser(meetingId, voiceUser) { }; const modifier = { - $set: Object.assign( - { meetingId, spoke: talking }, - flat(voiceUser), - ), - }; - - const user = await Users.findOneAsync({ meetingId, userId: intId }, { - fields: { - color: 1, + $set: { + meetingId, + spoke: talking, + ...flat(voiceUser), }, - }); - - if (user) modifier.$set.color = user.color; + }; try { const { numberAffected } = await VoiceUsers.upsertAsync(selector, modifier);