Skip to content

Media controls

These APIs let you control local and remote audio behavior during an active call.

Client-side vs server-side controls

Mute and noise suppression are applied locally on the device — they stop audio from being sent or filter it before transmission. Earmuff is applied server-side — the Vonage API suppresses the incoming audio stream before it reaches the client.

Platform availability

ControlAndroidiOSWeb
Mute / UnmuteYesYesYes
EarmuffYesYesYes
DTMFYesYesYes
Noise suppressionYesYesNo

Mute

Mute the local microphone so the remote party cannot hear you. The call remains active.


 // Callback
 client.mute("callId") {
     it?.let { err ->
         // Handle Error in muting call
         println("Error in muting call: $err")
     }
 }

 // Coroutine
 try {
     client.mute("callId")
 } catch (e: Error) {
     // Handle Error in muting call
 }

Unmute

Re-enable the local microphone after muting.


 // Callback
 client.unmute("callId") {
     it?.let { err ->
         // Handle Error in unmuting call
         println("Error in unmuting call: $err")
     }
 }

 // Coroutine
 try {
     client.unmute("callId")
 } catch (e: Error) {
     // Handle Error in unmuting call
 }

onMute update event

Fires when mute state changes, including changes triggered by the remote side or server.


 client.setOnMutedListener { call, legId, isMuted ->
     if (isMuted) {
         // leg is muted
         println("leg:$legId for call: $call was muted")
     } else {
         // leg is unmuted
         println("leg:$legId for call: $call was un-muted")
     }
 }

Enable earmuff

Earmuff prevents the local user from hearing remote audio. Unlike mute, earmuff is applied server-side — the audio stream is suppressed before it reaches the client.


 // Callback
 client.enableEarmuff("callId") {
     it?.let { err ->
         // Handle Error in enabling earmuff
         println("Error in enabling earmuff: $err")
     }
 }

 // Coroutine
 try {
     client.enableEarmuff("callId")
 } catch (e: Error) {
     // Handle Error in enabling earmuff
 }

Disable earmuff

Restore incoming audio after earmuffing.


 // Callback
 client.disableEarmuff("callId") {
     it?.let { err ->
         // Handle Error in disabling earmuff
         println("Error in disabling earmuff: $err")
     }
 }

 // Coroutine
 try {
     client.disableEarmuff("callId")
 } catch (e: Error) {
     // Handle Error in disabling earmuff
 }

onEarmuff update event

Fires when earmuff state changes.


 client.setOnEarmuffListener {call, legId, earmuffStatus ->
     if (earmuffStatus) {
         // earmuff enabled
         println("earmuff is enabled for leg:$legId with Call $call")
     } else {
         // earmuff disabled
         println("earmuff is disabled for leg:$legId with Call $call")
     }
 }

Send DTMF

Send dual-tone multi-frequency signals during an active call. Valid digits are 0-9, *, and #. DTMF is commonly used for IVR navigation and phone-system interaction.


 // Callback
 client.sendDTMF("callId", "1234") {
     it?.let { err ->
         // Handle Error in sending DTMF
         println("Error in sending DTMF: $err")
     }
 }

 // Coroutine
 try {
     client.sendDTMF("callId", "1234")
 } catch (e: Error) {
     // Handle Error in sending DTMF
 }

onDTMF update event

Fires when DTMF digits are received from the remote party.


 client.setOnDTMFListener {call, legId, digits ->
     println("Received DTMF digits: $digits for leg:$legId with Call $call")
 }

Enable noise suppression (Android/iOS)

Enable on-device noise suppression to filter background noise from the local microphone input. Not available on Web.


 // Callback
 client.enableNoiseSuppression("callId") { err ->
     err?.let {
         println("Error enabling noise suppression: $it")
     } ?: println("Noise suppression successfully enabled")
 }

 // Coroutine
 try {
     client.enableNoiseSuppression("callId")
 } catch (e: Error) {
     println("Error enabling noise suppression: $e")
 }

Disable noise suppression (Android/iOS)

Disable on-device noise suppression.


 // Callback
 client.disableNoiseSuppression("callId") { err ->
     err?.let {
         println("Error disabling noise suppression: $it")
     } ?: println("Noise suppression successfully disabled")
 }

 // Coroutine
 try {
     client.disableNoiseSuppression("callId")
     println("Noise suppression successfully disabled")
 } catch (e: Error) {
     println("Error disabling noise suppression: $e")
 }

Built with VitePress.