Skip to content

feat(calling): add media core ICE event listeners for call media monitoring#4925

Open
Kesari3008 wants to merge 8 commits intowebex:nextfrom
Kesari3008:CAI-6517-Media-Core-Event-Listeners
Open

feat(calling): add media core ICE event listeners for call media monitoring#4925
Kesari3008 wants to merge 8 commits intowebex:nextfrom
Kesari3008:CAI-6517-Media-Core-Event-Listeners

Conversation

@Kesari3008
Copy link
Copy Markdown
Contributor

@Kesari3008 Kesari3008 commented Apr 27, 2026

COMPLETES #CAI-6517

This pull request addresses

Mid-call media monitoring for calls

by making the following changes

Adds listeners for ICE_GATHERING_STATE_CHANGED, PEER_CONNECTION_STATE_CHANGED, ICE_CONNECTION_STATE_CHANGED, and ICE_CANDIDATE_ERROR events on the media connection. Events are logged, submitted as media metrics, and emitted as call events for consumer handling.

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

< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >

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 - Please Specify
  • 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

Make sure to have followed the contributing guidelines before submitting.

…toring

Adds listeners for ICE_GATHERING_STATE_CHANGED, PEER_CONNECTION_STATE_CHANGED,
ICE_CONNECTION_STATE_CHANGED, and ICE_CANDIDATE_ERROR events on the media
connection. Events are logged, submitted as media metrics, and emitted as
call events for consumer handling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Kesari3008 Kesari3008 added the validated If the pull request is validated for automation. label Apr 27, 2026
@Kesari3008 Kesari3008 requested a review from a team as a code owner April 27, 2026 17:04
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de61f45473

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +263 to +267
private handleIceGatheringStateChanged = (
event: Partial<{state: string; iceGatheringState: string}>
) => {
const iceGatheringState = Call.getPeerConnectionStateFromEvent(event, 'iceGatheringState');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Emit new ICE call events from media listeners

The new ICE listeners in Call only log and submit metrics, but never call this.emit(...) for the newly added CALL_EVENT_KEYS.ICE_* events. Since this commit also exposes these events in CallEventTypes, consumers can register handlers that will never fire at runtime. Any client depending on call.on(...) for ICE state/error monitoring will silently miss all updates, so the feature is incomplete for external callers.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8d052aeabe

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +348 to +352
this.metricManager.submitMediaMetric(
METRIC_EVENT.MEDIA_ERROR,
MEDIA_CONNECTION_ACTION.ICE_CANDIDATE_ERROR,
METRIC_TYPE.BEHAVIORAL,
this.callId,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass error details when reporting ICE candidate failures

handleIceCandidateError() submits a METRIC_EVENT.MEDIA_ERROR metric without a CallError argument, but submitMediaMetric() only emits MEDIA_ERROR payloads when callError is present (see packages/calling/src/Metrics/index.ts, case METRIC_EVENT.MEDIA_ERROR). In ICE-candidate-failure scenarios this call becomes a no-op, so the new error telemetry is silently dropped instead of being recorded.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 348cbb82e7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +347 to +348
errorCode: event.errorCode,
errorText: event.errorText,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Read ICE candidate details from the emitted error payload

ICE_CANDIDATE_ERROR from media-core is consumed elsewhere in this repo as a nested payload (event.error.errorCode / event.error.errorText in packages/@webex/plugin-meetings/src/meeting/index.ts), but this handler reads top-level event.errorCode and event.errorText. In that common shape, the new warning message and MEDIA_ERROR metric lose the actual ICE failure details (code/text), so the monitoring signal becomes effectively non-actionable in production.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ded9bed949

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

},
preferredKey: 'connectionState' | 'iceConnectionState' | 'iceGatheringState'
): string {
return event[preferredKey] || event.state || Call.UNKNOWN_STATE;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Guard ICE state handlers against missing event payload

The new ICE state listeners assume the callback always receives an object and immediately read event[preferredKey], but media-core state-change callbacks are also used in this repo with no payload (for example, PEER_CONNECTION_STATE_CHANGED listeners are invoked as listener() in packages/@webex/plugin-meetings/test/unit/spec/meeting/index.js:9447). In that case event is undefined, this line throws a TypeError, and the call can crash on routine state-change events instead of just logging/submitting metrics.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

@mkesavan13 mkesavan13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Kindly resolve the merge conflicts. Approving

@Kesari3008 Kesari3008 enabled auto-merge (squash) May 7, 2026 10:57
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.

2 participants