bigbluebutton-Github/bigbluebutton-html5/imports/api/voice-users/server/handlers/joinVoiceUser.js
2023-04-19 12:16:35 -03:00

42 lines
955 B
JavaScript
Executable File

import { check } from 'meteor/check';
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;
check(meetingId, String);
check(voiceUser, {
voiceConf: String,
intId: String,
voiceUserId: String,
callerName: String,
callerNum: String,
color: String,
muted: Boolean,
talking: Boolean,
callingWith: String,
listenOnly: Boolean,
joined: Boolean,
});
const {
intId,
} = voiceUser;
const User = await Users.findOneAsync({
meetingId,
intId,
});
if (!User) {
/* voice-only user - called into the conference */
await addDialInUser(meetingId, voiceUser);
}
const result = await addVoiceUser(meetingId, voiceUser);
return result;
}