bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/modifiers/addDialInUser.js
Daniel Schreiber 6dcc4cab75 Fix telephone dialin
this fixes a crash in bbb-html5 when someone uses phone dialin. The
crash resulted in users joining the audio convference but not being
visible in the users list.

Fixed stack trace:

~~~
error: UserJoinedVoiceConfToClientEvtMsg: Error: Match error: Missing key 'pin'
    at check (packages/check/match.js:36:17)
    at addUser (imports/api/users/server/modifiers/addUser.js:23:3)
    at addDialInUser (imports/api/users/server/modifiers/addDialInUser.js:30:10)
    at EventEmitter.handleJoinVoiceUser (imports/api/voice-users/server/handlers/joinVoiceUser.js:36:5)
    at EventEmitter.emitAsync (/usr/share/meteor/bundle/programs/server/npm/node_modules/eventemitter2/lib/eventemitter2.js:463:31)
    at MeetingMessageQueue.handleTask (imports/startup/server/redis.js:114:10)
    at imports/startup/server/redis.js:126:28
    at Queue.start (/usr/share/meteor/bundle/programs/server/npm/node_modules/queue/index.js:145:17)
    at Queue.<computed> [as push] (/usr/share/meteor/bundle/programs/server/npm/node_modules/queue/index.js:59:12)
    at MeetingMessageQueue.add (imports/startup/server/redis.js:125:16)
    at RedisPubSub.handleMessage (imports/startup/server/redis.js:327:63)
    at runWithEnvironment (packages/meteor.js:1320:24)
~~~
2022-01-03 14:22:28 +01:00

33 lines
770 B
JavaScript

import { check } from 'meteor/check';
import addUser from '/imports/api/users/server/modifiers/addUser';
export default function addDialInUser(meetingId, voiceUser) {
check(meetingId, String);
check(voiceUser, Object);
const USER_CONFIG = Meteor.settings.public.user;
const ROLE_VIEWER = USER_CONFIG.role_viewer;
const { intId, callerName } = voiceUser;
const voiceOnlyUser = {
intId,
extId: intId, // TODO
name: callerName,
role: ROLE_VIEWER.toLowerCase(),
guest: false,
authed: true,
waitingForAcceptance: false,
guestStatus: 'ALLOW',
emoji: 'none',
presenter: false,
locked: false, // TODO
avatar: '',
pin: false,
clientType: 'dial-in-user',
};
return addUser(meetingId, voiceOnlyUser);
}