INNER CODE UNIT · JavaScript
snooze
twilio-labs/function-templates · experimental-flex-dialpad/ui-src/src/customActions/index.js:99
const snooze = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const getLatestConference = (taskSid) => {
const updatedTask = StateHelper.getTaskByTaskrouterTaskSid(taskSid);
return updatedTask.conference;
};
// check if worker hanging up is last worker on the call
if (conference.liveWorkerCount === 1) {
//if so, ensure no other participants are on hold as
//no external parties will be able to remove them from being on hold.
conference.participants.forEach(async (participant) => {
const { participantType, workerSid, callSid } = participant;
if (participant.onHold && participant.status === 'joined') {
await Actions.invokeAction('UnholdParticipant', {
participantType,
task: payload.task,
targetSid: participantType === 'worker' ? workerSid : callSid,
});