-
Notifications
You must be signed in to change notification settings - Fork 387
fix(contact-center): fixed-outdial-fail-issue #4579
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
Conversation
| case CC_EVENTS.AGENT_OUTBOUND_FAILED: | ||
| // We don't have to emit any event here since this will be result of promise. | ||
| if (task.data) { | ||
| this.removeTaskFromCollection(task); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This here was the root cause of the issue, have removed it - it was old code.
| if (task.data) { | ||
| this.removeTaskFromCollection(task); | ||
| } | ||
| task = this.updateTaskData(task, payload.data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we simply update the task, post metrics and then emit the TASK_REJECTED event so users can handle it. Agent Desktop also does the same (shows a modal).
I preferred re-using this event as opposed to simply sending another event from the SDK.
| if (task.data.interaction.state === 'new' || isSecondaryEpDnAgent(task.data.interaction)) { | ||
| // Only remove tasks in 'new' state or isSecondaryEpDnAgent immediately. For other states, | ||
| // retain tasks until they complete wrap-up, unless the task disconnected before being answered. | ||
| const isOutdial = task?.data?.interaction?.outboundType === 'OUTDIAL'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are new conditions. Open to suggestions if I can do it it a better way but this is the cleanest way I saw.
Let me explain - basically we only need to clear the task for outdial cases where the user rejects it (i.e agent rejects it). In the case where we get AgentOutboundFailed - we ALWAYS get ContactEnded AND AgentWrapup in the same sequence. Hence once the user wraps up the task clears up automatically.
The change I made ensures these cases are handled with as minimal changes to the SDK flow. Otherwise we might need more checks and I wanted to do this as a pure SDK change and no widgets change needed.
| // If terminated, keep task for wrap-up flow (CONTACT_ENDED → AGENT_WRAPUP) | ||
| // For non-OUTDIAL: remove if state is 'new' | ||
| // Always remove if secondary EpDn agent | ||
| if ((isNew && !(isOutdial && isTerminated)) || isSecondaryEpDnAgent(task.data.interaction)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another point - I've tested this with widgets against older flows and nothing breaks.
All old calls will follow the same flow and the check specifcially checks for both isOutdial and isTerminated.
| }); | ||
|
|
||
| it('should remove currentTask from taskCollection on AGENT_OUTBOUND_FAILED event', () => { | ||
| it('should NOT remove OUTDIAL task from taskCollection on AGENT_OUTBOUND_FAILED when terminated (wrap-up flow)', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some tests for checking the clearing of the task and also the case where we do not want to clear the task object.
COMPLETES #< AD-HOC >
This pull request addresses
AgentOutboundFailedevent, the widgets was not properly cleaning up the call and so the user was not able to do further outdials.taskobject on receiving this event and hence subsequent wrapup was not being shown.by making the following changes
Vidcast (EXTENSION) - https://app.vidcast.io/share/604f2f25-55ea-4446-950b-68777ce8f6a3
Vidcast (BROWSER) - https://app.vidcast.io/share/25857bee-9aa8-4539-b411-5b4c4808d1d3
Change Type
The following scenarios were tested
The GAI Coding Policy And Copyright Annotation Best Practices
I certified that
Make sure to have followed the contributing guidelines before submitting.