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

42 lines
955 B
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';
2018-08-16 20:21:13 +08:00
import addDialInUser from '/imports/api/users/server/modifiers/addDialInUser';
2017-08-01 03:36:41 +08:00
import addVoiceUser from '../modifiers/addVoiceUser';
export default async function handleJoinVoiceUser({ body }, meetingId) {
2017-08-01 03:36:41 +08:00
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,
color: String,
2017-12-08 04:50:50 +08:00
muted: Boolean,
talking: Boolean,
callingWith: String,
listenOnly: Boolean,
joined: Boolean,
});
const {
intId,
} = voiceUser;
const User = await Users.findOneAsync({
meetingId,
intId,
});
2017-12-08 04:50:50 +08:00
if (!User) {
/* voice-only user - called into the conference */
await addDialInUser(meetingId, voiceUser);
2017-12-08 04:50:50 +08:00
}
2017-08-01 03:36:41 +08:00
const result = await addVoiceUser(meetingId, voiceUser);
return result;
2017-08-01 03:36:41 +08:00
}