pub struct Capabilities {
pub address: IpAddr,
pub audio_port: u16,
pub audio_formats: Vec<String>,
pub rtpmaps: Vec<(String, String)>,
pub direction: Direction,
pub session_id: u64,
pub session_version: u64,
pub crypto: Option<Crypto>,
pub dtls: Option<Fingerprint>,
pub rtcp_mux: bool,
pub dtls_setup: SetupCapabilities,
}Expand description
What this side can do.
Fields§
§address: IpAddrWhere to receive media.
audio_port: u16The port to receive audio on. Zero rejects audio entirely.
audio_formats: Vec<String>Payload types this side supports, as offered.
rtpmaps: Vec<(String, String)>rtpmap values by payload type, for the formats above.
direction: DirectionThe direction this side wants.
session_id: u64The session identifier to use.
session_version: u64The session version to use.
crypto: Option<Crypto>The SRTP keying this side offers, if the media is to be encrypted (RFC 4568).
None means plain RTP. It is None unless the signalling is secure, because
crate::crypto::Crypto::offer will not produce a key over a path that anyone can read.
dtls: Option<Fingerprint>The certificate fingerprint this side offers, if the media is to be keyed with DTLS-SRTP (RFC 5763 / 8122).
Exclusive with crypto: they are different m= protocols, and a stream cannot be keyed
both ways at once.
rtcp_mux: boolWhether this side can put RTP and RTCP on the media port (RFC 5761).
dtls_setup: SetupCapabilitiesDTLS roles the local handshake can hold.
Implementations§
Source§impl Capabilities
impl Capabilities
Sourcepub fn g711(address: IpAddr, audio_port: u16) -> Self
pub fn g711(address: IpAddr, audio_port: u16) -> Self
The G.711 pair plus RFC 4733 DTMF, which is what practically every endpoint accepts.
Sourcepub fn with_opus(address: IpAddr, audio_port: u16) -> Self
pub fn with_opus(address: IpAddr, audio_port: u16) -> Self
Opus first, then the G.711 pair, then DTMF.
Order matters in an offer — it is how this side says what it would rather use — and not in an answer, where RFC 3264 §6.1 gives the order to the offerer. So this is the list to offer with; answering an offer that puts G.711 first still answers G.711 first, which is the point.
G.711 stays in the list rather than being replaced. Opus is better when both ends have it and useless when they do not, and an endpoint that offered only Opus would fail to call most of the telephone network.
The payload type is 111 by convention rather than by standard: Opus has no static type
(RFC 7587 §7 assigns none), so the number means nothing on its own and the rtpmap is
what the far end matches on. 48000/2 is likewise fixed by RFC 7587 §7 regardless of the
rate the audio is sampled at or the number of channels actually sent.
Sourcepub fn with_srtp(self, secure_signalling: bool) -> Self
pub fn with_srtp(self, secure_signalling: bool) -> Self
The same capabilities, offering SRTP.
secure_signalling decides whether a key is generated at all: SDES carries the master
key in the SDP body, so offering one over cleartext SIP publishes it (RFC 4568 §7.1).
Passing false therefore leaves the offer as plain RTP rather than offering encryption
that would not be encryption.
Sourcepub fn with_dtls_srtp(self, fingerprint: Fingerprint) -> Self
pub fn with_dtls_srtp(self, fingerprint: Fingerprint) -> Self
The same capabilities, offering DTLS-SRTP (RFC 5763).
fingerprint is of the certificate this endpoint will present on the media path. Unlike
Capabilities::with_srtp there is no secure_signalling flag, and its absence is the
point: SDES needs one because the SDP carries the key, and here it carries only a hash of
a certificate. That is what makes DTLS-SRTP usable over signalling sipx does not control —
a proxy that terminates the TLS learns nothing it can decrypt with.
What it can do is substitute a fingerprint of its own. RFC 8122 §7 says so plainly, and it is the reason this is a keying improvement rather than an authentication one.
The role offered is actpass, which RFC 5763 §5 requires of an offerer: the answerer picks,
and picking active means its ClientHello opens the NAT it sits behind.
Sourcepub fn with_rtcp_mux(self) -> Self
pub fn with_rtcp_mux(self) -> Self
Offer or answer RTP/RTCP multiplexing on the media port (RFC 5761).
Sourcepub fn with_dtls_setup_capabilities(self, setup: SetupCapabilities) -> Self
pub fn with_dtls_setup_capabilities(self, setup: SetupCapabilities) -> Self
Limit the DTLS setup roles this capability set may negotiate.
Sourcepub fn protocol(&self) -> &'static str
pub fn protocol(&self) -> &'static str
The media transport this side offers.
UDP/TLS/RTP/SAVP for DTLS-SRTP (RFC 5764 §8), RTP/SAVP for SDES, RTP/AVP otherwise.
The token is not decoration: it is what tells the far end which keying to expect, and an
RTP/SAVP line with an a=fingerprint describes a stream nobody can key.
Sourcepub fn dtls(&self) -> Option<&Fingerprint>
pub fn dtls(&self) -> Option<&Fingerprint>
The fingerprint this side offers, if it is offering DTLS-SRTP.
Trait Implementations§
Source§impl Clone for Capabilities
impl Clone for Capabilities
Source§fn clone(&self) -> Capabilities
fn clone(&self) -> Capabilities
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more