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
|
|
|
|
2017-08-01 03:36:41 +08:00
|
|
|
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,
|
|
|
|
} = voiceUser;
|
|
|
|
|
2018-07-17 01:03:01 +08:00
|
|
|
const User = Users.findOne({
|
|
|
|
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 */
|
2018-08-16 20:21:13 +08:00
|
|
|
addDialInUser(meetingId, voiceUser);
|
2017-12-08 04:50:50 +08:00
|
|
|
}
|
2017-08-01 03:36:41 +08:00
|
|
|
|
|
|
|
return addVoiceUser(meetingId, voiceUser);
|
|
|
|
}
|