Skip to content

DAVE support#291

Open
beer-psi wants to merge 28 commits intoserenity-rs:nextfrom
beerpsi-forks:davey
Open

DAVE support#291
beer-psi wants to merge 28 commits intoserenity-rs:nextfrom
beerpsi-forks:davey

Conversation

@beer-psi
Copy link

@beer-psi beer-psi commented Feb 22, 2026

Closes #293

Sending voice packets now mostly works.

Receiving is not very heavily tested, and there are a bunch of annoyances:

  • Passthrough (unencrypted) voice packets will still go into the decryption code path, so you will get error logs like:
ERROR davey::cryptor::frame_processors: no magic marker
  • The UDP receiving task is separate from the gateway task, so decrypting the first few packets will fail because the key ratchets haven't been set up yet. This should probably be fixed with a buffer? Packets that are received before the key ratchets are set up are silently dropped.
  • SpeakingStateUpdate events are apparently not fired consistently

The PR is still unreviewed, but if your bot needs this it's been tested and working on a few bots. If you use serenity-next, you may want to depend on jtscuba's fork of this PR instead, which depends on serenity-next: https://github.com/jtscuba/songbird/tree/davey

TODO

  • serenity-voice-model will need to be updated on crates.io to add the missing dave_protocol_version field in SessionDescription.
  • Add a way to retrieve the voice privacy code and the verification codes (e.g. Call::voice_privacy_code?)

@beer-psi beer-psi marked this pull request as draft February 22, 2026 16:12
beer-psi added a commit to beer-psi/discord-ext-songbird that referenced this pull request Feb 23, 2026
This is currently a PR over at serenity-rs/songbird#291, but I'd like to cut an alpha release to
battle test this on my bots.

Also upgrade PyO3 to 0.28.2, and maturin to 1.12 for the namespace package support.
@beer-psi
Copy link
Author

I'm not sure how I can surface the voice privacy code up to the Driver interface in the existing architecture. Could I add a new CoreEvent::VoicePrivacyCode or something of that sort and then emit the event when a DAVE transition is executed (which is when the code is changed)?

This is due to a race condition between buffered gateway events (all events except
Hello, Ready, Resumed before SessionDescription are buffered) and newly incoming
gateway events. Due to tokio::select! [polling branches in random order](https://docs.rs/tokio/latest/tokio/macro.select.html#fairness),
DaveMlsProposals can be processed before ClientsConnect, which is where the list
of connected users are sent. Ensuring that all buffered events are processed
first allows for the list of recognized user IDs to be properly populated.
@beer-psi beer-psi marked this pull request as ready for review February 27, 2026 12:47
tktcorporation pushed a commit to tktcorporation/discord-tts-bot that referenced this pull request Mar 4, 2026
Discord enforced DAVE (E2EE) protocol for all voice connections starting
March 2, 2026. The voice gateway now rejects non-DAVE clients with close
code 4017 ("E2EE/DAVE protocol required").

Switch songbird dependency from crates.io v0.5.0 to beerpsi-forks/songbird
(davey branch) which implements DAVE protocol support via the `davey` crate
and MLS-based key exchange. This fork is from PR serenity-rs/songbird#291.

Ref: serenity-rs/songbird#291

https://claude.ai/code/session_01K2oMKKW55q1PFaipJhmwK8
@tktcorporation
Copy link
Contributor

Thanks for the great work on this! I was able to get my library working by pointing to your fork in the meantime. I may not be in a position to contribute much directly, but please let me know if there’s anything I can do to help move this forward!

@tdgroot
Copy link

tdgroot commented Mar 4, 2026

Works for me! 😃

SharkBaitDLS added a commit to SharkBaitDLS/my-man that referenced this pull request Mar 6, 2026
Can be moved back to a normal dependency once
serenity-rs/songbird#291
is in a published release
reiyw added a commit to reiyw/songbird that referenced this pull request Mar 7, 2026
Kronicaler added a commit to Kronicaler/songbird that referenced this pull request Mar 7, 2026
phoxwupsh added a commit to phoxwupsh/turto that referenced this pull request Mar 11, 2026
Discord now needs DAVE/E2EE for voice connection,
PR in origin songbird upstream hasn't been merged,
so swtich to beerpsi's fork to fix this

Refs:
serenity-rs/songbird#291
@LukeZurg22

This comment was marked as off-topic.

Copy link
Member

@Erk- Erk- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes looks good, I have the comment about the unnecessary (as far as I can tell) atomic (I was wrong there) and then there is some warning of unused values you get when you for example build the twilight example that needs to be cleaned up, but other than that it looks good.

@Siydge
Copy link

Siydge commented Mar 14, 2026

Tested, works great for me, no issues, tested with following override for others in need

[patch.crates-io]
songbird = { git = "https://github.com/beerpsi-forks/songbird", branch = "davey" }

@Achilleees
Copy link

Thanks for this guys. Tested and works great! Looking forward to the merge.

@krywicki
Copy link

Ran in to trouble with DAVE protocol on my sound bot. I've added this as a songbird patch and tested it. It works great! 🙌

krywicki pushed a commit to krywicki/discord-soundboard-bot-rs that referenced this pull request Mar 24, 2026
* Discord E2EE/DAVE

Discord is now enforcing DAVE (Discord Audio Video Encryption) for voice
now. There is a [PR](serenity-rs/songbird#291)
to support the protocol. The changes here will add that PR as a
temporary patch.

* Sqlite types fix

Updates to rusqlite no longer support u64 types. This changes the types
to i64 now.
krywicki added a commit to krywicki/discord-soundboard-bot-rs that referenced this pull request Mar 25, 2026
* Discord E2EE/DAVE

Discord is now enforcing DAVE (Discord Audio Video Encryption) for voice
now. There is a [PR](serenity-rs/songbird#291)
to support the protocol. The changes here will add that PR as a
temporary patch.

* Sqlite types fix

Updates to rusqlite no longer support u64 types. This changes the types
to i64 now.

Co-authored-by: krywicki <joseph.krywicki@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants