fix(contact-center): route transfers through consult transfer when consult leg remains active after conference downgrade - #5129
Conversation
…nsult leg remains active after conference downgrade
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24110ba495
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (this.getStateMachineSnapshot()?.matches(TaskState.CONSULTING)) { | ||
| return true; |
There was a problem hiding this comment.
Require consult ownership before selecting consult transfer
When an incoming or EP-DN consult is assigned with isConsulted: true while the raw interaction remains connected, guards.isConsultingAssignment moves the receiver's state machine to CONSULTING, even though uiControlsComputer.ts deliberately disables transfer when !consultInitiator. This new snapshot check therefore makes a direct call to the public transfer() method issue contact.consultTransfer from the consulted receiver, which cannot bridge the customer and consult legs. Include initiator/ownership in this decision rather than treating every CONSULTING snapshot as transferable.
Useful? React with 👍 / 👎.
| ...dummyContact, | ||
| consultTransfer: jest.fn().mockResolvedValue('consultTransferred'), | ||
| blindTransfer: jest.fn().mockResolvedValue('blindTransferred'), | ||
| vteamTransfer: jest.fn().mockResolvedValue('vteamTransferred'), |
There was a problem hiding this comment.
Replace the new Jest mocks with Sinon stubs
The newly added transfer-contact helper creates its mocks with jest.fn(), contrary to the repository's explicit requirement that mocks and stubs use Sinon. Converting these new doubles to Sinon also prevents this change from further coupling the test helper to Jest-specific mock APIs.
AGENTS.md reference: AGENTS.md:L43-L47
Useful? React with 👍 / 👎.
|
|
||
| // consult transfer path | ||
| if (this.data.interaction.state === 'consulting') { | ||
| if (isConsultTransfer) { |
There was a problem hiding this comment.
Record the transfer-routing change in the contract catalog
This changes the routing semantics of the public Voice.transfer() API, but the commit updates only the task spec/source-material architecture document and leaves ai-docs/CONTRACTS.md and .sdd/manifest.json unchanged. The package workflow explicitly requires both artifacts to be updated when public behavior or routing changes, so add the corresponding contract and manifest updates to keep the authoritative catalog aligned with runtime behavior.
AGENTS.md reference: packages/@webex/contact-center/AGENTS.md:L66-L70
Useful? React with 👍 / 👎.
COMPLETES #CAI-8344
This pull request addresses
When an agent is consulting another agent during a conference and a third agent exits, the backend downgrades the main call leg back to a 1:1
connected/holdstate while the consult leg remains live.Voice.transfer()previously keyed offinteraction.state === 'consulting', so it incorrectly issued a blind transfer against the main interaction instead of a consult transfer against the live consult leg.This mismatch can leave the consult destination ringing or otherwise break the transfer flow after a conference downgrade.
by making the following changes
hasActiveConsultLeg()inVoice.tsto derive consulting state the same way UI controls do: state machineCONSULTING, elsegetTaskStateForUiControls(...) === CONSULTING.transfer()throughconsultTransferwhen that derived state is consulting, even ifinteraction.statereportsconnected/hold.interaction.mainInteractionId(falling back tointeractionId) for consult transfer requests after conference downgrade.getTaskStateForUiControlsfrom the state-machine barrel for reuse.interaction.state.Change Type
The following scenarios were tested
Automated
yarn workspace @webex/contact-center test:unit --targets services/task/voice/Voice.ts— 32 tests passedThe GAI Coding Policy And Copyright Annotation Best Practices
I certified that
Make sure to have followed the contributing guidelines before submitting.
Made with Cursor