bigbluebutton-Github/bigbluebutton-html5/imports/api/voice-users/server/handlers/joinVoiceUser.js

62 lines
1.4 KiB
JavaScript
Raw Normal View History

2017-08-01 03:36:41 +08:00
import { check } from 'meteor/check';
2017-12-08 04:50:50 +08:00
import Users from '/imports/api/users';
import addUser from '/imports/api/users/server/modifiers/addUser';
2017-08-01 03:36:41 +08:00
import addVoiceUser from '../modifiers/addVoiceUser';
export default function handleJoinVoiceUser({ body }, meetingId) {
const voiceUser = body;
2017-08-02 21:11:53 +08:00
voiceUser.joined = true;
2017-08-01 03:36:41 +08:00
check(meetingId, String);
2017-12-08 04:50:50 +08:00
check(voiceUser, {
voiceConf: String,
intId: String,
voiceUserId: String,
callerName: String,
callerNum: String,
muted: Boolean,
talking: Boolean,
callingWith: String,
listenOnly: Boolean,
joined: Boolean,
});
const {
intId,
callerName,
} = voiceUser;
const User = Users.findOne({
meetingId,
intId,
connectionStatus: 'online',
});
2017-12-08 04:50:50 +08:00
if (!User) {
/* voice-only user - called into the conference */
2017-12-08 04:50:50 +08:00
const USER_CONFIG = Meteor.settings.public.user;
const ROLE_VIEWER = USER_CONFIG.role_viewer;
const voiceOnlyUser = { // web (Users) representation of dial-in user
intId,
extId: intId, // TODO
name: callerName,
role: ROLE_VIEWER.toLowerCase(),
guest: false,
authed: true,
waitingForAcceptance: false,
guestStatus: 'ALLOW',
emoji: 'none',
presenter: false,
locked: false, // TODO
2018-08-16 01:31:07 +08:00
avatar: '',
clientType: 'dial-in-user',
2017-12-08 04:50:50 +08:00
};
addUser(meetingId, voiceOnlyUser);
2017-12-08 04:50:50 +08:00
}
2017-08-01 03:36:41 +08:00
return addVoiceUser(meetingId, voiceUser);
}