Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Voice Transfers #2390

Merged
merged 2 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ const ToggleMute: React.FC<Props> = ({ 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 },
});

Expand Down
25 changes: 25 additions & 0 deletions plugin-hrm-form/src/transfer/setUpTransferActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading