2018-08-16 20:21:13 +08:00
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import addUser from '/imports/api/users/server/modifiers/addUser';
|
|
|
|
|
2023-04-01 04:40:41 +08:00
|
|
|
export default async function addDialInUser(meetingId, voiceUser) {
|
2018-08-16 20:21:13 +08:00
|
|
|
check(meetingId, String);
|
|
|
|
check(voiceUser, Object);
|
|
|
|
|
|
|
|
const USER_CONFIG = Meteor.settings.public.user;
|
|
|
|
const ROLE_VIEWER = USER_CONFIG.role_viewer;
|
|
|
|
|
2023-04-19 23:16:35 +08:00
|
|
|
const { intId, callerName, color } = voiceUser;
|
2018-08-16 20:21:13 +08:00
|
|
|
|
|
|
|
const voiceOnlyUser = {
|
|
|
|
intId,
|
|
|
|
extId: intId, // TODO
|
|
|
|
name: callerName,
|
|
|
|
role: ROLE_VIEWER.toLowerCase(),
|
2022-01-20 02:35:04 +08:00
|
|
|
guest: true,
|
2018-08-16 20:21:13 +08:00
|
|
|
authed: true,
|
2022-02-03 05:07:18 +08:00
|
|
|
waitingForAcceptance: false,
|
|
|
|
guestStatus: 'ALLOW',
|
2018-08-16 20:21:13 +08:00
|
|
|
emoji: 'none',
|
2023-07-26 02:23:57 +08:00
|
|
|
reactionEmoji: 'none',
|
|
|
|
raiseHand: false,
|
|
|
|
away: false,
|
2018-08-16 20:21:13 +08:00
|
|
|
presenter: false,
|
|
|
|
locked: false, // TODO
|
|
|
|
avatar: '',
|
2023-04-19 23:16:35 +08:00
|
|
|
color,
|
2022-01-03 21:22:28 +08:00
|
|
|
pin: false,
|
2018-08-16 20:21:13 +08:00
|
|
|
clientType: 'dial-in-user',
|
|
|
|
};
|
2023-04-01 04:40:41 +08:00
|
|
|
const user = await addUser(meetingId, voiceOnlyUser);
|
|
|
|
return user;
|
2018-08-16 20:21:13 +08:00
|
|
|
}
|