We are building a custom softphone extension using the Genesys Cloud JavaScript SDK (@genesyscloud/purecloud-platform-client-v2). The requirement is to programmatically mute and unmute the agent’s microphone during an active conversation without relying on the standard UI controls.
The logic seems straightforward based on the documentation. We subscribe to the conversationEvents and trigger the mute function via a custom button. Here is the implementation we’ve put together:
import { WebChatClient } from '@genesyscloud/purecloud-platform-client-v2';
const client = new WebChatClient();
async function toggleMic(isMuted) {
try {
const conversation = getActiveConversation(); // Helper to get current conv object
const result = await client.conversationsApi.conversationsCallsMute({
conversationId: conversation.id,
body: {
muted: isMuted
}
});
console.log('Mute status updated:', result.body);
} catch (error) {
console.error('Failed to update mute status', error);
}
}
The API call returns a 200 OK response, and the JSON payload confirms the muted field is set to true. However, the agent’s microphone remains active in the browser, and the remote party can still hear audio. The SDK event listener does not fire a muteStateChange event either, which suggests the local audio track is not being updated.
We’ve verified that the user has the necessary permissions (conversation:conversation:update) and that the call is in an active state. Is there a specific method in the JavaScript SDK to force the local audio track to respect the server-side mute state, or are we missing a step in the client-side audio handling logic?