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")]
13pub mod notify;
14pub mod reject;
15pub mod sdp_stream_metadata_changed;
16pub mod select_answer;
17
18use ruma_macros::StringEnum;
19use serde::{Deserialize, Serialize};
20
21use crate::PrivOwnedStr;
22
23#[derive(Clone, Debug, Deserialize, Serialize)]
29#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
30pub struct SessionDescription {
31 #[serde(rename = "type")]
35 pub session_type: String,
36
37 #[serde(default)]
41 pub sdp: String,
42}
43
44impl SessionDescription {
45 pub fn new(session_type: String, sdp: String) -> Self {
47 Self { session_type, sdp }
48 }
49}
50
51#[derive(Clone, Debug, Serialize, Deserialize)]
53#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
54pub struct StreamMetadata {
55 pub purpose: StreamPurpose,
57
58 #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
62 pub audio_muted: bool,
63
64 #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
68 pub video_muted: bool,
69}
70
71impl StreamMetadata {
72 pub fn new(purpose: StreamPurpose) -> Self {
74 Self { purpose, audio_muted: false, video_muted: false }
75 }
76}
77
78#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
80#[derive(Clone, PartialEq, Eq, StringEnum)]
81#[ruma_enum(rename_all = "m.lowercase")]
82#[non_exhaustive]
83pub enum StreamPurpose {
84 UserMedia,
88
89 ScreenShare,
93
94 #[doc(hidden)]
95 _Custom(PrivOwnedStr),
96}
97
98#[cfg(feature = "unstable-msc2747")]
100#[derive(Clone, Debug, Default, Serialize, Deserialize)]
101#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
102pub struct CallCapabilities {
103 #[serde(rename = "m.call.dtmf", default)]
109 pub dtmf: bool,
110}
111
112#[cfg(feature = "unstable-msc2747")]
113impl CallCapabilities {
114 pub fn new() -> Self {
116 Self::default()
117 }
118
119 pub fn is_default(&self) -> bool {
121 !self.dtmf
122 }
123}