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
|
|
|
|
2023-03-17 02:37:24 +08:00
|
|
|
export default async function clearVoiceCallStates(meetingId) {
|
2020-02-19 06:03:06 +08:00
|
|
|
if (meetingId) {
|
2020-11-25 04:44:13 +08:00
|
|
|
try {
|
2023-03-17 02:37:24 +08:00
|
|
|
const numberAffected = await VoiceCallStates.removeAsync({ meetingId });
|
2020-11-25 04:44:13 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Cleared VoiceCallStates in (${meetingId})`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.info(`Error on clearing VoiceCallStates in (${meetingId}). ${err}`);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
try {
|
2023-03-17 02:37:24 +08:00
|
|
|
const numberAffected = await VoiceCallStates.removeAsync({});
|
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
|
|
|
}
|