XSDP
XSDP validates and negotiates WebRTC session descriptions.
WebRTC peers must agree on codecs, encryption fingerprints, and network
candidates before media flows. That agreement is written in Session
Description Protocol (SDP). XSDP operates on %XMediaLib.SDP{} structs from
xmedialib for parse/encode, then
checks WebRTC rules and builds answers.
Validation
{:ok, sdp} = XSDP.validate(sdp_binary, ice_role: :full)
{:ok, answer} =
XSDP.validate_answer(offer, answer, ice_role: :lite, strict: false)
Checks BUNDLE mid consistency, DTLS fingerprints, RTCP-mux offer/answer rules, SCTP data-channel port negotiation, and ICE full vs lite role constraints.
XSDP.ICE.shape_for_role/2 adjusts session-level a=ice-lite.
Answer an offer body
{:ok, answer_bin} =
XSDP.answer_offer(offer_bin,
capabilities: %{
codecs: [%{name: "opus", clock_rate: 48000, encoding_params: "2"}],
extmaps: ["urn:ietf:params:rtp-hdrext:ssrc-audio-level"]
}
)
Session and answers
session = XSDP.Session.new(ice_role: :full)
{:ok, session} = XSDP.Session.set_remote_description(session, offer)
{:ok, answer} =
XSDP.Session.create_answer(session,
capabilities: %{
codecs: [%{name: "opus", clock_rate: 48000, encoding_params: "2"}],
extmaps: ["urn:ietf:params:rtp-hdrext:ssrc-audio-level"]
}
)
{:ok, session} = XSDP.Session.set_local_description(session, answer)
XSDP.Negotiator.negotiate_answer/3 intersects codecs, fmtp, extmaps, and SCTP
fields against local capabilities.
Trickle ICE
{:ok, session} =
XSDP.Session.TrickleICE.add_remote_candidate(session, %{
mid: "0",
candidate: candidate_struct
})
{:ok, session} =
XSDP.Session.TrickleICE.add_remote_candidate(session, %{
mid: "0",
end_of_candidates: true
})
RFCs
- RFC 8866 / RFC 4566 (SDP)
- RFC 3264 (offer/answer)
- RFC 5888 / RFC 8843 (grouping / BUNDLE)
- RFC 8122 (DTLS fingerprint)
- RFC 8445 (ICE)
- RFC 8838 (Trickle ICE)
- RFC 5761 (RTCP mux)
- RFC 8841 / RFC 8842 (SCTP over DTLS)
Installation
def deps do
[
{:xmedialib, "~> 0.3.0"},
{:xsdp, "~> 0.1.0"}
]
end
Contact
For questions or suggestions, email experts@xirsys.com
Copyright
Copyright (c) 2013 - 2026 Jahred Love & Xirsys LLC
All rights reserved.
XSDP is licensed by Xirsys, with permission, under the Apache License Version 2.0. See LICENSE for the full license text.