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
|
|
|
|
2023-03-17 02:37:24 +08:00
|
|
|
export default async function clearVoiceUser(meetingId) {
|
2017-08-01 23:00:07 +08:00
|
|
|
if (meetingId) {
|
2020-11-25 04:44:13 +08:00
|
|
|
try {
|
2023-03-17 02:37:24 +08:00
|
|
|
const numberAffected = await VoiceUsers.removeAsync({ meetingId });
|
2020-11-25 04:44:13 +08:00
|
|
|
|
|
|
|
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 {
|
2023-03-17 02:37:24 +08:00
|
|
|
const numberAffected = await VoiceUsers.removeAsync({});
|
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
|
|
|
}
|