ruwuma/src/call/candidates.rs
2019-06-16 16:16:37 -07:00

40 lines
1.2 KiB
Rust

//! Types for the *m.call.candidates* event.
use js_int::UInt;
use serde::{Deserialize, Serialize};
room_event! {
/// This event is sent by callers after sending an invite and by the callee after answering.
/// Its purpose is to give the other party additional ICE candidates to try using to
/// communicate.
pub struct CandidatesEvent(CandidatesEventContent) {}
}
/// The payload of a `CandidatesEvent`.
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct CandidatesEventContent {
/// The ID of the call this event relates to.
pub call_id: String,
/// A list of candidates.
pub candidates: Vec<Candidate>,
/// The version of the VoIP specification this messages adheres to.
pub version: UInt,
}
/// An ICE (Interactive Connectivity Establishment) candidate.
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub struct Candidate {
/// The SDP "a" line of the candidate.
pub candidate: String,
/// The SDP media type this candidate is intended for.
#[serde(rename = "sdpMid")]
pub sdp_mid: String,
/// The index of the SDP "m" line this candidate is intended for.
#[serde(rename = "sdpMLineIndex")]
pub sdp_m_line_index: UInt,
}