bigbluebutton-Github/bigbluebutton-html5/imports/api/phone/server/eventHandlers.js

42 lines
1.2 KiB
JavaScript
Raw Normal View History

2016-05-17 03:12:49 +08:00
import { eventEmitter } from '/imports/startup/server';
import { updateVoiceUser } from '/imports/api/users/server/modifiers/updateVoiceUser';
eventEmitter.on('user_left_voice_message', function (arg) {
handleVoiceEvent(arg);
});
eventEmitter.on('user_joined_voice_message', function (arg) {
handleVoiceEvent(arg);
});
eventEmitter.on('user_voice_talking_message', function (arg) {
handleVoiceEvent(arg);
});
eventEmitter.on('user_voice_muted_message', function (arg) {
handleVoiceEvent(arg);
});
eventEmitter.on('user_listening_only', function (arg) {
const voiceUserObj = {
web_userid: arg.payload.userid,
listen_only: arg.payload.listen_only,
};
const meetingId = arg.payload.meeting_id;
return updateVoiceUser(meetingId, voiceUserObj, arg.callback);
});
const handleVoiceEvent = function (arg) {
const meetingId = arg.payload.meeting_id;
2016-05-26 02:21:42 +08:00
const voiceUser = arg.payload.user.voiceUser;
2016-05-17 03:12:49 +08:00
const voiceUserObj = {
web_userid: voiceUser.web_userid,
listen_only: arg.payload.listen_only,
talking: voiceUser.talking,
joined: voiceUser.joined,
locked: voiceUser.locked,
muted: voiceUser.muted,
};
return updateVoiceUser(meetingId, voiceUserObj, arg.callback);
};