1pub mod answer;
6pub mod candidates;
7pub mod hangup;
8pub mod invite;
9#[cfg(feature = "unstable-msc3401")]
10pub mod member;
11pub mod negotiate;
12#[cfg(feature = "unstable-msc4075")]
13#[allow(deprecated)]
14pub mod notify;
15pub mod reject;
16pub mod sdp_stream_metadata_changed;
17pub mod select_answer;
18
19use ruma_macros::StringEnum;
20use serde::{Deserialize, Serialize};
21
22use crate::PrivOwnedStr;
23
24#[derive(Clone, Debug, Deserialize, Serialize)]
30#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
31pub struct SessionDescription {
32 #[serde(rename = "type")]
36 pub session_type: String,
37
38 #[serde(default)]
42 pub sdp: String,
43}
44
45impl SessionDescription {
46 pub fn new(session_type: String, sdp: String) -> Self {
48 Self { session_type, sdp }
49 }
50}
51
52#[derive(Clone, Debug, Serialize, Deserialize)]
54#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
55pub struct StreamMetadata {
56 pub purpose: StreamPurpose,
58
59 #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
63 pub audio_muted: bool,
64
65 #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
69 pub video_muted: bool,
70}
71
72impl StreamMetadata {
73 pub fn new(purpose: StreamPurpose) -> Self {
75 Self { purpose, audio_muted: false, video_muted: false }
76 }
77}
78
79#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
81#[derive(Clone, PartialEq, Eq, StringEnum)]
82#[ruma_enum(rename_all = "m.lowercase")]
83#[non_exhaustive]
84pub enum StreamPurpose {
85 UserMedia,
89
90 ScreenShare,
94
95 #[doc(hidden)]
96 _Custom(PrivOwnedStr),
97}
98
99#[cfg(feature = "unstable-msc2747")]
101#[derive(Clone, Debug, Default, Serialize, Deserialize)]
102#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
103pub struct CallCapabilities {
104 #[serde(rename = "m.call.dtmf", default)]
110 pub dtmf: bool,
111}
112
113#[cfg(feature = "unstable-msc2747")]
114impl CallCapabilities {
115 pub fn new() -> Self {
117 Self::default()
118 }
119
120 pub fn is_default(&self) -> bool {
122 !self.dtmf
123 }
124}