# requestToggleAudio()

Requests toggle of a remote user's microphone. The target user's id is provided as a parameter.\
As an optional second parameter you can specify a concrete wanted state for the remote user's microphone. In case it is not specified, then the microphone will be toggled - if it is enabled, then it will become muted and vice-versa - if muted, then the remote user will be asked to enable it.

{% hint style="warning" %}
You cannot forcefully unmute a remote user, because that can easily become a privacy concern. You can only request a remote user to unmute and then the remote user will accept or deny the request.
{% endhint %}

```javascript
//Toggles the state of the remote user microphone - id as param
sambaFrame.requestToggleAudio('9efc7798-a1a4-44bd-9d8d-532fe0feea9d');

//Mutes the remote user's microphone - id as first param, true means mute
sambaFrame.requestToggleAudio('9efc7798-a1a4-44bd-9d8d-532fe0feea9d', true);

//Ask the remote user to unmute microphone - id as first param, false means unmute
sambaFrame.requestToggleAudio('9efc7798-a1a4-44bd-9d8d-532fe0feea9d', false);
```

**Sample use case**: \
Have a custom participants panel in your integration and want moderators to be able to toggle or set the remote user's microphone state.

{% hint style="info" %}
This method is a combination of [requestMute](/reference/sdk/methods/requestmute.md) and [requestUnmute](/reference/sdk/methods/requestunmute.md) functionality.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalsamba.com/reference/sdk/methods/requesttoggleaudio.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
