2020-02-19 06:03:06 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2021-02-09 20:30:09 +08:00
|
|
|
import VoiceCallStates from '/imports/api/voice-call-states';
|
2020-02-19 06:03:06 +08:00
|
|
|
|
|
|
|
export default function clearVoiceCallStates(meetingId) {
|
|
|
|
if (meetingId) {
|
2020-11-25 04:44:13 +08:00
|
|
|
try {
|
|
|
|
const numberAffected = VoiceCallStates.remove({ meetingId });
|
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Cleared VoiceCallStates in (${meetingId})`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.info(`Error on clearing VoiceCallStates in (${meetingId}). ${err}`);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
const numberAffected = VoiceCallStates.remove({});
|
2020-02-19 06:03:06 +08:00
|
|
|
|
2020-11-25 04:44:13 +08:00
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info('Cleared VoiceCallStates in all meetings');
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Error on clearing VoiceCallStates in all meetings. ${err}`);
|
|
|
|
}
|
|
|
|
}
|
2020-02-19 06:03:06 +08:00
|
|
|
}
|