fix(cc-task): recover consult destination and show consult hold state…#1
Conversation
… after leg switch
Changeset Review SummaryChangeset 1: Robust consult media resolution after refresh
Changeset 2: EP-DN consult destination recovery
Changeset 3: Agent fallback chain for non-EP-DN consults
Overall this change set improves transfer resiliency for hydrated consult tasks while preserving existing agent-transfer behavior. |
| }); | ||
| const media = interaction?.media; | ||
| const hinted = (currentTask.data as {consultMediaResourceId?: string | null}).consultMediaResourceId; | ||
| const consultId = |
There was a problem hiding this comment.
Change 1 (media resolution fallback chain): this replaces single-source consult lookup with a resilient order (consultMediaResourceId hint -> latest consult media -> legacy finder). This is needed because hydrated task payloads can reorder media or keep stale consult entries.
| if (!p || p.id === myAgentId) continue; | ||
| const epId = (p as {epId?: string}).epId?.trim(); | ||
| if (epId && (p.pType === 'EP-DN' || (p as {type?: string}).type === 'EpDn')) { | ||
| destination = {to: epId, destinationType: 'entryPoint' as DestinationType}; |
There was a problem hiding this comment.
Change 2 (EP-DN mapping): this block intentionally builds an entryPoint transfer destination from participant epId when consult participant is EP-DN/EpDn. This is the core fix for payloads where transfer must target entry point instead of an agent.
| if (!destination?.to) { | ||
| for (const pid of pids) { | ||
| const p = parts[pid]; | ||
| if (p?.id !== myAgentId && p.pType === 'Agent') { |
There was a problem hiding this comment.
Change 3 (agent fallback): if EP-DN target is not present, this loop preserves existing behavior by recovering transfer destination from the other consult-leg agent participant.
| } | ||
| if (!destination?.to) { | ||
| const cid = ( | ||
| interaction as {callProcessingDetails?: {consultedAgentId?: string}} |
There was a problem hiding this comment.
Change 4 (payload-shape fallback): this uses callProcessingDetails.consultedAgentId as a final recovery path for hydrated payloads where consult media participants do not include the answered agent.
COMPLETES #N/A (No linked issue)
This pull request addresses
Consult transfer destination recovery failing after refresh/hydration for consult calls, especially EP-DN consult payloads where the transfer target should resolve to an entry point (
epId).by making the following changes
consultTransferusing:consultMediaResourceIdhint from task data,EP-DN/EpDnepId{to: epId, destinationType: 'entryPoint'}Agentparticipantinteraction.callProcessingDetails.consultedAgentIdChange Type
The following scenarios were tested
task-object.json) to verify destination resolves to entry point for EP-DN caseyarn workspace @webex/cc-task buildThe GAI Coding Policy And Copyright Annotation Best Practices
Checklist before merging
Make sure to have followed the contributing guidelines before submitting.