bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/nav-bar/talking-indicator/container.jsx
Mario Jr 0a601359bb Prevent Error 1006 when user has two or more occurrences of ':' (colon) in your name
This happens because FreeSWITCH is not able to parse the "From" header when it has multiple occurrences of ':'. So user is not able to join audio.
To fix, we now changed the "callerId" to use the base64 value of the user name, instead of directly using user's input (the callerId format keeps being a triple like this: <user_id>-bbbID-<base64_encoded_name>).
Once this callerIdName is encoded at the same point it is generated, there shouldn't be server side effects for changing this value; except for those places where the callerName is retrieved by splitting this triple (such as the voice talking-indicator, as described below).
Updated the talking-indicator to retrieve the username from User's object, instead of retrieving from the one username generated by splitting the callerId triple.
This problem also happens in versions <= 2.2.26.
2020-11-17 15:31:43 -03:00

70 lines
1.8 KiB
JavaScript

import React from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import VoiceUsers from '/imports/api/voice-users';
import Users from '/imports/api/users'
import Auth from '/imports/ui/services/auth';
import { debounce } from 'lodash';
import TalkingIndicator from './component';
import { makeCall } from '/imports/ui/services/api';
import Service from './service';
const APP_CONFIG = Meteor.settings.public.app;
const { enableTalkingIndicator } = APP_CONFIG;
const TalkingIndicatorContainer = (props) => {
if (!enableTalkingIndicator) return null;
return (<TalkingIndicator {...props} />);
};
export default withTracker(() => {
const talkers = {};
const meetingId = Auth.meetingID;
const usersTalking = VoiceUsers.find({ meetingId, joined: true, spoke: true }, {
fields: {
callerName: 1,
talking: 1,
color: 1,
startTime: 1,
voiceUserId: 1,
muted: 1,
intId: 1,
},
}).fetch().sort(Service.sortVoiceUsers);
if (usersTalking) {
for (let i = 0; i < usersTalking.length; i += 1) {
const {
callerName, talking, color, voiceUserId, muted, intId,
} = usersTalking[i];
const user = Users.findOne({ userId: voiceUserId });
const _name = user ? user.name : 'USER';
talkers[`${intId}`] = {
color,
talking,
voiceUserId,
muted,
callerName: _name,
};
}
}
const muteUser = (id) => {
const user = VoiceUsers.findOne({ meetingId, voiceUserId: id }, {
fields: {
muted: 1,
},
});
if (user.muted) return;
makeCall('toggleVoice', id);
};
return {
talkers,
muteUser: id => debounce(muteUser(id), 500, { leading: true, trailing: false }),
openPanel: Session.get('openPanel'),
};
})(TalkingIndicatorContainer);