Skip to content

fix(contact-center): read mediaResourceId from interaction.media in holdResume()#4863

Open
bhabalan wants to merge 1 commit intowebex:task-refactorfrom
bhabalan:fix/hold-resume-media-resource-id-task-refactor
Open

fix(contact-center): read mediaResourceId from interaction.media in holdResume()#4863
bhabalan wants to merge 1 commit intowebex:task-refactorfrom
bhabalan:fix/hold-resume-media-resource-id-task-refactor

Conversation

@bhabalan
Copy link
Copy Markdown
Contributor

@bhabalan bhabalan commented Apr 15, 2026

COMPLETES # https://jira-eng-sjc12.cisco.com/jira/browse/CAI-7507

This pull request addresses

Port of #4848 to the task-refactor branch. The holdResume() method in Voice.ts reads mediaResourceId from the top-level this.data.mediaResourceId, which can become stale after partial event payloads (e.g. recording pause/resume events) overwrite task data. Although the refactored reconcileData() on this branch doesn't delete missing keys (unlike next), using the top-level field is fragile and inconsistent with how the canonical media data is stored in interaction.media.

by making the following changes

  • Updated holdResume() in packages/@webex/contact-center/src/services/task/voice/Voice.ts to resolve mediaResourceId from this.data.interaction.media[mainInteractionId].mediaResourceId — the canonical source — with a fallback to the top-level this.data.mediaResourceId
  • This applies to the hold path, resume path, state machine events, metrics tracking, and the error handling path
  • Added mainInteractionId to the test data helper createBaseData() in the Voice test file
  • Added a regression test that verifies hold() uses interaction.media as the source for mediaResourceId even when the top-level field is stale

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

Automated Testing

  • Added regression test: hold() reads mediaResourceId from interaction.media via mainInteractionId — simulates stale top-level mediaResourceId and verifies the correct value is sent to contact.hold()
  • Existing unit tests unaffected (Voice.ts test suite has a pre-existing xstate.setup infrastructure issue on task-refactor that is unrelated to this change)

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Other - Claude Code
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

I certified that

  • I have read and followed contributing guidelines
  • I discussed changes with code owners prior to submitting this pull request
  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the documentation accordingly

…oldResume()

Port of webex#4848 to task-refactor branch. The holdResume() method in Voice.ts
was reading mediaResourceId from the top-level this.data.mediaResourceId,
which can become stale after partial event payloads (e.g. recording events)
overwrite task data. Changed to read from the canonical source at
this.data.interaction.media[mainInteractionId].mediaResourceId, with a
fallback to the top-level field.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bhabalan bhabalan marked this pull request as ready for review April 15, 2026 09:18
@bhabalan bhabalan requested a review from a team as a code owner April 15, 2026 09:18
@bhabalan bhabalan added the validated If the pull request is validated for automation. label Apr 15, 2026
@bhabalan
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

ℹ️ 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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

validated If the pull request is validated for automation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant