use std::collections::BTreeMap;
use js_int::UInt;
use ruma_common::{OwnedVoipId, VoipVersionId};
use ruma_macros::EventContent;
use serde::{Deserialize, Serialize};
use super::{SessionDescription, StreamMetadata};
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
#[ruma_event(type = "m.call.negotiate", kind = MessageLike)]
pub struct CallNegotiateEventContent {
pub call_id: OwnedVoipId,
pub party_id: OwnedVoipId,
pub version: VoipVersionId,
pub lifetime: UInt,
pub description: SessionDescription,
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub sdp_stream_metadata: BTreeMap<String, StreamMetadata>,
}
impl CallNegotiateEventContent {
pub fn new(
call_id: OwnedVoipId,
party_id: OwnedVoipId,
version: VoipVersionId,
lifetime: UInt,
description: SessionDescription,
) -> Self {
Self {
call_id,
party_id,
version,
lifetime,
description,
sdp_stream_metadata: Default::default(),
}
}
pub fn version_1(
call_id: OwnedVoipId,
party_id: OwnedVoipId,
lifetime: UInt,
description: SessionDescription,
) -> Self {
Self::new(call_id, party_id, VoipVersionId::V1, lifetime, description)
}
}