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';
|
|
|
|
|
2018-08-16 20:21:13 +08:00
|
|
|
|
2023-04-01 04:40:41 +08:00
|
|
|
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,
|
|
|
|
muted: Boolean,
|
|
|
|
talking: Boolean,
|
|
|
|
callingWith: String,
|
|
|
|
listenOnly: Boolean,
|
|
|
|
joined: Boolean,
|
|
|
|
});
|
|
|
|
|
|
|
|
const {
|
|
|
|
intId,
|
|
|
|
} = voiceUser;
|
|
|
|
|
2023-04-01 04:40:41 +08:00
|
|
|
const User = await Users.findOneAsync({
|
2018-07-17 01:03:01 +08:00
|
|
|
meetingId,
|
|
|
|
intId,
|
|
|
|
});
|
2017-12-08 04:50:50 +08:00
|
|
|
|
2018-07-17 01:03:01 +08:00
|
|
|
if (!User) {
|
|
|
|
/* voice-only user - called into the conference */
|
2023-04-01 04:40:41 +08:00
|
|
|
await addDialInUser(meetingId, voiceUser);
|
2017-12-08 04:50:50 +08:00
|
|
|
}
|
2017-08-01 03:36:41 +08:00
|
|
|
|
2023-04-01 04:40:41 +08:00
|
|
|
const result = await addVoiceUser(meetingId, voiceUser);
|
|
|
|
return result;
|
2017-08-01 03:36:41 +08:00
|
|
|
}
|