opentalk_roomserver_types_livekit/
internal.rs1use std::{collections::BTreeSet, fmt::Debug};
5
6use opentalk_roomserver_signaling::signaling_module::InternalCommand;
7use opentalk_roomserver_types::livekit_proxy::{
8 LiveKitProxyRequest, PreparedSocket, websocket::LiveKitSocket,
9};
10use opentalk_types_signaling::ParticipantId;
11use tokio::sync::oneshot;
12use url::Url;
13
14use crate::MicrophoneRestrictionState;
15
16#[derive(Debug)]
18pub enum LiveKitInternal {
19 Mute {
21 sender: Option<ParticipantId>,
23 participants: BTreeSet<ParticipantId>,
25 return_channel: oneshot::Sender<ParticipantsMuted>,
27 },
28
29 UpdateMicrophoneRestrictions {
31 sender: ParticipantId,
33 new_state: MicrophoneRestrictionState,
35 return_channel:
37 oneshot::Sender<Result<MicrophoneRestrictionState, MicrophoneRestrictionError>>,
38 },
39
40 ConnectUpstreamSocket {
43 websocket_request: Box<LiveKitProxyRequest>,
44 return_channel: oneshot::Sender<Option<PreparedSocket>>,
45 },
46
47 ConnectDownstreamSocket {
49 websocket_request: Box<LiveKitProxyRequest>,
50 upstream_socket: Box<PreparedSocket>,
51 downstream_socket: Box<dyn LiveKitSocket>,
52 return_channel: oneshot::Sender<()>,
53 },
54
55 GetLivekitServiceUrl {
57 return_channel: oneshot::Sender<Url>,
58 },
59}
60
61#[derive(Debug)]
63pub enum MicrophoneRestrictionErrorKind {
64 ConflictingTask,
66 LivekitUnavailable,
68}
69
70#[derive(Debug)]
72pub struct MicrophoneRestrictionError {
73 pub sender: ParticipantId,
75 pub error: MicrophoneRestrictionErrorKind,
77}
78
79#[derive(Debug)]
81pub struct ParticipantsMuted {
82 pub sender: Option<ParticipantId>,
84 pub participants: BTreeSet<ParticipantId>,
86}
87
88impl InternalCommand for LiveKitInternal {}