Skip to main content
Voice calls are a core feature of the Discord Social SDK that enable real-time voice communication between players within lobbies.
Voice calls require an active lobby with participants. You must create or join a lobby before starting a voice call. See Managing Lobbies for details.

Prerequisites

Before starting a voice call:
  • Complete OAuth2 authorization with the required communications scopes
  • Create or join a lobby using Client::CreateOrJoinLobby
  • Keep voice calls to 25 members or fewer for optimal performance (lobbies technically support up to 1,000 members)

Starting and joining voice calls

Both Client::CreateOrJoinLobby and Client::StartCall handle existing and new scenarios automatically — you don’t need to check whether a lobby or call already exists.
const std::string lobbySecret = "my-game-lobby-secret";

client->CreateOrJoinLobby(lobbySecret, [client](const discordpp::ClientResult& result, uint64_t lobbyId) {
    if (result.Successful()) {
        const auto call = client->StartCall(lobbyId);
        if (call) {
            // Voice call initiated
        } else {
            // Already in this voice channel
        }
    }
});
  • Client::CreateOrJoinLobby — joins an existing lobby with the given secret, or creates a new one
  • Client::StartCall — joins an active call in the lobby, or starts a new one; returns null if already in this voice channel

Controlling voice settings

Global controls

These apply across all active calls via the Client object:
MethodDescription
Client::SetSelfMuteAllMute your microphone across all calls
Client::SetSelfDeafAllDeafen yourself across all calls
Client::SetInputVolumeSet microphone volume
Client::SetOutputVolumeSet speaker volume

Per-call controls

These apply to a specific Call object:
MethodDescription
Call::SetSelfMuteMute your microphone in this call
Call::SetSelfDeafDeafen yourself in this call
Call::SetParticipantVolumeAdjust volume of a specific participant
Call::SetVADThresholdControl voice activity detection sensitivity
auto call = client->GetCall(lobbyId);
if (call) {
    call.SetSelfMute(true);
    call.SetParticipantVolume(userId, 150.0f);
    call.SetVADThreshold(false, -30.0f);
}

// Global controls
client->SetSelfMuteAll(true);
client->SetInputVolume(75.0f);
client->SetOutputVolume(120.0f);

Advanced audio processing

Use Client::StartCallWithAudioCallbacks to access raw audio data for real-time manipulation or external audio system integration (e.g., FMOD, Wwise).
const auto call = client->StartCallWithAudioCallbacks(
    lobbyId,
    [](uint64_t userId, int16_t *data, const size_t samplesPerChannel,
       int sampleRate, const size_t channels, bool &outShouldMuteData) {
        // Reduce incoming volume by 50%
        for (int i = 0; i < samplesPerChannel * channels; i++) {
            data[i] *= 0.5;
        }
    },
    [](int16_t *data, uint64_t samplesPerChannel, int32_t sampleRate,
       uint64_t channels) {});
The SDK handles all voice encoding/decoding automatically — you work with raw PCM samples.

Ending voice calls

// End call for a specific lobby
client->EndCall(lobbyId, []() {
    // Call ended
});

// End all active calls
client->EndCalls([]() {
    // All calls ended
});

Checking voice call status

Use LobbyHandle::GetCallInfoHandle() to check if an active call exists and inspect participant states:
const auto callInfoHandle = lobby->GetCallInfoHandle();
if (callInfoHandle) {
    const auto participants = callInfoHandle->GetParticipants();

    for (const auto& participantId : participants) {
        const auto voiceState = callInfoHandle->GetVoiceStateHandle(participantId);
        if (voiceState) {
            bool isMuted = voiceState->SelfMute();
            bool isDeafened = voiceState->SelfDeaf();
        }
    }
}
VoiceStateHandle provides:
  • SelfMutetrue if the user has muted themselves
  • SelfDeaftrue if the user has deafened themselves

Next steps

Managing Lobbies

Create and manage lobbies that host voice calls.

How-To Guides

Additional guides for moderation, Discord APIs, and more.