From 4905481005a456b94596bc6a5ebd7e987ff8af6f Mon Sep 17 00:00:00 2001 From: Murilo Machado Date: Wed, 10 Jul 2024 20:18:36 +0100 Subject: [PATCH 1/2] Fix and debug Mute --- .../src/components/Conference/ConferenceActions/ToggleMute.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin-hrm-form/src/components/Conference/ConferenceActions/ToggleMute.tsx b/plugin-hrm-form/src/components/Conference/ConferenceActions/ToggleMute.tsx index bacab842c8..c528b695cc 100644 --- a/plugin-hrm-form/src/components/Conference/ConferenceActions/ToggleMute.tsx +++ b/plugin-hrm-form/src/components/Conference/ConferenceActions/ToggleMute.tsx @@ -41,9 +41,10 @@ const ToggleMute: React.FC = ({ call, task, conference }) => { const currentMutedState = workerParticipant.muted; const toggleMute = !currentMutedState; + console.log(`conferenceSid from attributes: ${task?.attributes?.conference?.sid}`); await conferenceApi.updateParticipant({ callSid: call?.parameters?.CallSid, - conferenceSid: task?.attributes?.conference?.sid, + conferenceSid: conference?.source?.conferenceSid, updates: { muted: toggleMute }, }); From fb39e9487386b7a96be4f44bd7fbfd71a700e18f Mon Sep 17 00:00:00 2001 From: Murilo Machado Date: Wed, 10 Jul 2024 20:49:42 +0100 Subject: [PATCH 2/2] Fix and debug call transfer --- .../src/transfer/setUpTransferActions.tsx | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/plugin-hrm-form/src/transfer/setUpTransferActions.tsx b/plugin-hrm-form/src/transfer/setUpTransferActions.tsx index 6030bc42c5..384ce582f5 100644 --- a/plugin-hrm-form/src/transfer/setUpTransferActions.tsx +++ b/plugin-hrm-form/src/transfer/setUpTransferActions.tsx @@ -101,6 +101,31 @@ const customTransferTask = (setupObject: SetupObject): ReplacedActionFunction => await TransferHelpers.setTransferMeta(payload, counselorName); if (TaskHelper.isCallTask(payload.task)) { + /** + * Temporary Fix: + * - Sometimes a call task comes without the conference object set in its attributes. + * - The code below updates the task attributes to include the conference information + * if it is missing. + */ + const { conferenceSid } = payload.task.conference || {}; + const conferenceSidFromAttributes = payload.task.attributes?.conference?.sid; + if (!conferenceSid && !conferenceSidFromAttributes) { + console.log('>> Could not find any conferenceSid'); + } else if (conferenceSid && !conferenceSidFromAttributes) { + console.log('>> Updating task attributes with conferenceSid'); + const customer = payload.task.conference?.participants.find(p => p.participantType === 'customer').participantSid; + await payload.task.setAttributes({ + ...payload.task.attributes, + conference: { + sid: conferenceSid, + // TODO: Do we need to set any participants as well? + // participants: { + // customer, + // }, + }, + }); + } + const disableTransfer = !TransferHelpers.canTransferConference(payload.task); if (disableTransfer) {