My config is not working… I am attempting to programmatically mute the agent microphone during an active voice interaction using the Android SDK. I have accessed the VoiceInteraction instance and called interaction.setMuted(true), but the audio stream remains active on the Genesys Cloud side. The UI button works, implying a local state mismatch. Is setMuted deprecated or does it require an explicit interaction.update() call to persist the state change to the platform API?
According to the docs, they say that setMuted on the VoiceInteraction object is often just a local state flag in older SDK versions, not a command to the Genesys Cloud media server. You need to use the AudioController or the specific CallControl interface provided by the PureCloudPlatformClientV2 wrapper. In my Chrome extension work, I see similar issues where local state doesn’t sync without an explicit API call. For the Android SDK, you must invoke the mute method on the active session’s media controller, not the interaction metadata object.
Retrieve the current CallSession from your VoiceInteraction.
Access the AudioDeviceManager or CallControl instance attached to that session.
Call setMute(true) on that specific control object.
Here is the Kotlin pattern that works reliably:
val callSession = voiceInteraction.callSession
callSession?.callControl?.setMute(true)
If you are using the lower-level genesyscloud-core SDK directly without the full platform client wrapper, you might need to use MediaStreamController. Ensure you have the interaction:modify OAuth scope, otherwise the client-side mute might fail silently. This approach guarantees the server-side mute state updates, which is what prevents your customer from hearing the agent. Relying on interaction.setMuted usually only updates the local UI, which explains why the audio stream remains active on the Genesys Cloud side.
The suggestion above is correct. setMuted is often just a local UI state flag in older SDK versions. You need to use the AudioController or the specific CallControl interface provided by the PureCloudPlatformClientV2 wrapper.
Here is the working Kotlin snippet for Android SDK 2.0+. You need to access the AudioDeviceManager and explicitly toggle the mute state on the active voice interaction’s audio stream.
// Assuming you have the PureCloudPlatformClientV2 instance initialized
val client = PureCloudPlatformClientV2.getInstance()
val interaction = client.getInteractionManager().getActiveInteraction() as? VoiceInteraction
if (interaction != null) {
// Get the audio controller for this specific interaction
val audioController = interaction.audioController
// Toggle mute programmatically
audioController.setMuted(true) // or false
// Verify state change callback
audioController.onMuteStateChanged = { isMuted ->
Log.d("AudioState", "Mic muted: $isMuted")
}
}
This ensures the command hits the Genesys Cloud media server. If you are using JWT auth, make sure your OAuth token has conversation:voice:read and conversation:voice:update scopes. Missing scopes will cause silent failures on the API side.
Also, check your AndroidManifest.xml for RECORD_AUDIO permission. Android 14 requires explicit runtime permissions for microphone access. If the permission is denied, the SDK might not be able to route the mute command correctly.