2017-08-01 23:00:07 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2017-10-12 10:00:28 +08:00
|
|
|
import VoiceUsers from '/imports/api/voice-users';
|
2017-08-01 23:00:07 +08:00
|
|
|
|
|
|
|
export default function clearVoiceUser(meetingId) {
|
|
|
|
if (meetingId) {
|
2020-11-25 04:44:13 +08:00
|
|
|
try {
|
|
|
|
const numberAffected = VoiceUsers.remove({ meetingId });
|
|
|
|
|
|
|
|
if (numberAffected) {
|
2020-12-01 04:01:41 +08:00
|
|
|
Logger.info(`Cleared VoiceUsers in (${meetingId})`);
|
2020-11-25 04:44:13 +08:00
|
|
|
}
|
|
|
|
} catch (err) {
|
2020-12-01 04:01:41 +08:00
|
|
|
Logger.error(`Error on clearing VoiceUsers in ${meetingId}. ${err}`);
|
2020-11-25 04:44:13 +08:00
|
|
|
}
|
2020-12-01 04:01:41 +08:00
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
const numberAffected = VoiceUsers.remove({});
|
2020-11-25 04:44:13 +08:00
|
|
|
|
2020-12-01 04:01:41 +08:00
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info('Cleared VoiceUsers in all meetings');
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Error on clearing VoiceUsers. ${err}`);
|
2020-11-25 04:44:13 +08:00
|
|
|
}
|
|
|
|
}
|
2017-08-01 23:00:07 +08:00
|
|
|
}
|