Skip to content
Francisco Dias edited this page May 13, 2026 · 1 revision

Call

Discord Class: discordpp::Call

The Call module contains functions to manage an active voice session in a Lobby.

Functions

These are the functions in the Call module:



Back To Top

discord_social_call_set_audio_mode

Discord Function: discordpp::Call::SetAudioMode()

This function sets whether to use voice auto detection or push to talk for the current user on this call.

If using push to talk you should call discord_social_call_set_ptt_active whenever the user presses their confused push to talk key.


Syntax:

discord_social_call_set_audio_mode(channel_id, audio_mode)
Argument Type Description
channel_id Real The channel ID.
audio_mode DiscordAudioModeType The audio mode type.

Returns:

Boolean



Back To Top

discord_social_call_set_local_mute

Discord Function: discordpp::Call::SetLocalMute()

This function locally mutes the given user ID, so that the current user cannot hear them anymore.

Does not affect whether the given user is muted for any other connected clients.


Syntax:

discord_social_call_set_local_mute(channel_id, user_id, mute)
Argument Type Description
channel_id Real The channel ID.
user_id Real The user ID.
mute Boolean Whether to mute the user (true) or not (false).

Returns:

Boolean



Back To Top

discord_social_call_get_local_mute

Discord Function: discordpp::Call::GetLocalMute

This function returns whether the current user has locally muted the given user_id for themselves.


Syntax:

discord_social_call_get_local_mute(channel_id, user_id)
Argument Type Description
channel_id Real The channel ID.
user_id Real The user ID to check.

Returns:

Boolean



Back To Top

discord_social_call_get_voice_state_handle

Discord Function: discordpp::Call::GetVoiceStateHandle

This function returns a reference to the VoiceStateHandle for the user ID of the given call participant.

The VoiceStateHandle allows other users to know if the target user has muted or deafened themselves.


Syntax:

discord_social_call_get_voice_state_handle(channel_id, user_id)
Argument Type Description
channel_id Real The channel ID.
user_id Real The user ID.

Returns:

DiscordVoiceStateHandle



Back To Top

discord_social_call_set_on_voice_state_changed_callback

Discord Function: discordpp::Call::SetOnVoiceStateChangedCallback()

This function sets a callback function to generally be invoked whenever a field on a VoiceStateHandle object for a user would have changed.

For example when a user mutes themselves, all other connected clients will invoke the VoiceStateChanged callback, because the "self mute" field will be true now. The callback is generally not invoked when users join or leave channels.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_call_set_on_voice_state_changed_callback(channel_id, callback)
Argument Type Description
channel_id Real The channel ID.
callback Function The callback function to use.

Returns:

Boolean


Triggers:

Callback

Triggered when a field on a VoiceStateHandle object for a user would have changed.

Key Type Description
user_id Real The user ID.


Back To Top

discord_social_call_set_participant_changed_callback

Discord Function: discordpp::Call::SetParticipantChangedCallback()

This function sets a callback function to be invoked whenever some joins or leaves a voice call.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_call_set_participant_changed_callback(channel_id, callback)
Argument Type Description
channel_id Real The channel ID.
callback Function The callback function to use.

Returns:

Boolean


Triggers:

Callback

Triggered when someone joins or leaves a voice call.

Key Type Description
user_id Real The user ID.
added Boolean true if the participant was added, false otherwise.


Back To Top

discord_social_call_set_participant_volume

Discord Function: discordpp::Call::SetParticipantVolume()

This function locally changes the playout volume of the given user ID.

Does not affect the volume of this user for any other connected clients. The range of volume is [0, 200], where 100 indicate default audio volume of the playback device.


Syntax:

discord_social_call_set_participant_volume(channel_id, user_id, vol)
Argument Type Description
channel_id Real The channel ID.
user_id Real The user ID.
vol Real The volume.

Returns:

Boolean



Back To Top

discord_social_call_get_participant_volume

Discord Function: discordpp::Call::GetParticipantVolume

This function returns the locally set playout volume of the given user_id.

Does not affect the volume of this user for any other connected clients. The range of volume is [0, 200], where 100 indicates default audio volume of the playback device.


Syntax:

discord_social_call_get_participant_volume(channel_id, user_id)
Argument Type Description
channel_id Real The channel ID.
user_id Real The user ID.

Returns:

Real



Back To Top

discord_social_call_set_ptt_active

Discord Function: discordpp::Call::SetPTTActive()

When push to talk is enabled, this should be called whenever the user pushes or releases their configured push to talk key. This key must be configured in the game, the SDK does not handle keybinds itself.


Syntax:

discord_social_call_set_ptt_active(channel_id, active)
Argument Type Description
channel_id Real The channel ID.
active Boolean Whether push to talk should be active.

Returns:

Boolean



Back To Top

discord_social_call_set_ptt_release_delay

Discord Function: discordpp::Call::SetPTTReleaseDelay()

If set, extends the time that PTT is active after the user releases the PTT key and discord_social_call_set_ptt_active(false) is called.


Syntax:

discord_social_call_set_ptt_release_delay(channel_id, release_delay_ms)
Argument Type Description
channel_id Real The channel ID.
release_delay_ms Real The release delay in milliseconds.

Returns:

Boolean



Back To Top

discord_social_call_get_ptt_release_delay

Discord Function: discordpp::Call::GetPTTReleaseDelay

This function returns the time that PTT is active after the user releases the PTT key and discord_social_call_set_ptt_active(false) is called.


Syntax:

discord_social_call_get_ptt_release_delay(channel_id)
Argument Type Description
channel_id Real The channel ID.

Returns:

Real



Back To Top

discord_social_call_set_self_deaf

Discord Function: discordpp::Call::SetSelfDeaf()

This function mutes all audio from the currently active call for the current user. They will not be able to hear any other participants, and no other participants will be able to hear the current user either.


Syntax:

discord_social_call_set_self_deaf(channel_id, deaf)
Argument Type Description
channel_id Real The channel ID.
deaf Boolean Whether to mute all audio (true) or not (false).

Returns:

Boolean



Back To Top

discord_social_call_set_self_mute

Discord Function: discordpp::Call::SetSelfMute()

This function mutes the current user's microphone so that no other participant in their active calls can hear them.


Syntax:

discord_social_call_set_self_mute(channel_id, mute)
Argument Type Description
channel_id Real The channel ID.
mute Boolean Whether to mute the current user's microphone (true) or not (false).

Returns:

Boolean



Back To Top

discord_social_call_set_speaking_status_changed_callback

Discord Function: discordpp::Call::SetSpeakingStatusChangedCallback()

This function sets a callback function to be invoked whenever a user starts or stops speaking and is passed in the user ID and whether they are currently speaking.

It can be invoked in other cases as well, such as if the priority speaker changes or if the user plays a soundboard sound.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_call_set_speaking_status_changed_callback(channel_id, callback)
Argument Type Description
channel_id Real The channel ID.
callback Function The callback function to use.

Returns:

Boolean


Triggers:

Callback

Triggered when a user's speaking status changed.

Key Type Description
user_id Real The user ID.
is_playing_sound Boolean Whether the user is currently speaking.


Back To Top

discord_social_call_set_status_changed_callback

Discord Function: discordpp::Call::SetStatusChangedCallback()

This function sets a callback function to be invoked when the call status changes, such as when it fully connects or starts reconnecting.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Callback.


Syntax:

discord_social_call_set_status_changed_callback(channel_id, callback)
Argument Type Description
channel_id Real The channel ID.
callback Function The callback function to use.

Returns:

Boolean


Triggers:

Callback

Triggered when the call status changes.

Key Type Description
status DiscordCallStatus The call status.
error DiscordCallError The error code.
error_detail Real A 32 bit value indicating the detailed error.


Back To Top

discord_social_call_set_vad_threshold

Discord Function: discordpp::Call::SetVADThreshold()

This function customizes the void auto detection thresholds for picking up activity from a user's mic.

  • When automatic is set to true, Discord will automatically detect the appropriate threshold to use.
  • When automatic is set to false, the given threshold value will be used.

Syntax:

discord_social_call_set_vad_threshold(channel_id, automatic, threshold)
Argument Type Description
channel_id Real The channel ID.
automatic Boolean Whether to automatically detect the appropriate threshold to use.
threshold Real The threshold value. Threshold has a range of -100, 0, and defaults to -60.

Returns:

Boolean



Back To Top

discord_social_call_get_vad_threshold

Discord Function: discordpp::Call::GetVADThreshold

This function returns the current configuration for void auto detection thresholds. See the description of the struct for specifics.


Syntax:

discord_social_call_get_vad_threshold(channel_id)
Argument Type Description
channel_id Real The channel ID.

Returns:

DiscordVADThresholdSettings



Back To Top

discord_social_call_audio_should_mute

Discord Function: N / A

This function sets whether audio played by Discord should be muted in the audio received callback (see discord_social_client_start_call_with_audio_callbacks). If you process and play the audio yourself you can set this to true to mute the audio being played by Discord.

See: discordpp::Client::UserAudioReceivedCallback


Syntax:

discord_social_call_audio_should_mute(should_mute)
Argument Type Description
should_mute Boolean Whether to mute the audio played by Discord or not.

Returns:

N/A



Back To Top

discord_social_call_fetch_received_data

Discord Function: N / A

This function fetches received data in a buffer and returns the number of bytes written to the buffer.

In the next frame the out_buffer is cleared and writing of new audio starts at the start of the buffer.

Note

A call must first have been started using discord_social_client_start_call_with_audio_callbacks.


Syntax:

discord_social_call_fetch_received_data(lobby_id, user_id, out_buffer)
Argument Type Description
lobby_id Real The lobby ID.
user_id Real The user ID.
out_buffer Buffer The buffer to write the data to (needs to be at least samples_per_channel * number_of_channels, where each sample is two bytes).

Returns:

Real



Back To Top

discord_social_call_fetch_captured_data

Discord Function: N / A

This function fetches captured data in a buffer and returns the number of bytes written to the buffer.

In the next frame the out_buffer is cleared and writing of new audio starts at the start of the buffer.

Note

A call must first have been started using discord_social_client_start_call_with_audio_callbacks.


Syntax:

discord_social_call_fetch_captured_data(lobby_id, out_buffer)
Argument Type Description
lobby_id Real The lobby ID.
out_buffer Buffer The buffer to write the data to (needs to be at least samples_per_channel * number_of_channels, where each sample is two bytes).

Returns:

Real



Back To Top

discord_social_call_remove_on_voice_state_changed_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_call_set_on_voice_state_changed_callback.


Syntax:

discord_social_call_remove_on_voice_state_changed_callback(channel_id)
Argument Type Description
channel_id Real The channel ID.

Returns:

N/A



Back To Top

discord_social_call_remove_participant_changed_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_call_set_participant_changed_callback.


Syntax:

discord_social_call_remove_participant_changed_callback(channel_id)
Argument Type Description
channel_id Real The channel ID.

Returns:

N/A



Back To Top

discord_social_call_remove_speaking_status_changed_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_call_set_speaking_status_changed_callback.


Syntax:

discord_social_call_remove_speaking_status_changed_callback(channel_id)
Argument Type Description
channel_id Real The channel ID.

Returns:

N/A



Back To Top

discord_social_call_remove_status_changed_callback

Discord Function: N / A

This function removes the callback set with a call to discord_social_call_set_status_changed_callback.


Syntax:

discord_social_call_remove_status_changed_callback(channel_id)
Argument Type Description
channel_id Real The channel ID.

Returns:

N/A



Clone this wiki locally