JS web SDK mute flag ignoring RTP stream during active call

Trying to toggle the agent mic mid-call, but session.updateMedia({ mute: true }) just returns a 200 and the audio keeps pumping. I’ve wired a custom button to fire it, yet the client state never flips and the media server completely ignores the flag.

const session = await client.callControl.getSession();
await session.updateMedia({ mute: true });

Headers look fine, timestamps sync up, audio still pumps.

The docs state: “updateMedia requires the session to be in an active state and the media stream to be initialized.”
You’re calling updateMedia before the RTP stream is fully established. The 200 just means the request was accepted, not that the media server processed it. You need to wait for the mediaStarted event.

client.callControl.on('mediaStarted', (event) => {
 const session = client.callControl.getSession();
 if (session) {
 session.updateMedia({ mute: true });
 }
});

Also check your OAuth scope. You need call:write on the access token. If the token is stale or missing the scope, the SDK might silently fail the media update. Check the token payload.

Don’t rely on updateMedia for hard muting in a production app. It’s a soft mute flag mostly. The media server might still send RTP packets depending on your org config, and the client state can get out of sync if the network hiccups. You’ll want to mute the actual WebRTC track locally to be sure.

// Mute the local audio track directly
const audioTrack = session.mediaManager.getAudioTrack();
if (audioTrack) {
 audioTrack.mute();
}

// Then signal the server
await session.updateMedia({ mute: true });

This ensures the client stops sending audio immediately. The server flag handles the call control state. If you skip the track mute, you’re trusting the network to drop the packets. That’s a risk you don’t need.