Crate sdp_types

source ·
Expand description

Crate for handling SDP (RFC 4566) session descriptions, including a parser and serializer.

§Serializing an SDP

// Create SDP session description
let sdp = sdp_types::Session {

// And write it to an `Vec<u8>`
let mut output = Vec::new();
sdp.write(&mut output).unwrap();

§Parsing an SDP

// Parse SDP session description from a byte slice
let sdp = sdp_types::Session::parse(&data).unwrap();

// Access the 'tool' attribute
match sdp.get_first_attribute_value("tool") {
    Ok(Some(tool)) => println!("tool: {}", tool),
    Ok(None) => println!("tool: empty"),
    Err(_) => println!("no tool attribute"),


  • SDP session descriptions are by default in UTF-8 but an optional charset attribute can change this for various SDP fields, including various other attributes. This is currently not supported, only UTF-8 is supported.

  • Network addresses, Phone numbers, E-Mail addresses and various other fields are currently parsed as a plain string and not according to the SDP grammar.


  • Attributes for the session or media.
  • Error returned when an attribute is not found.
  • Bandwidth information for the session or media.
  • Connection data for the session or media.
  • Encryption key for the session or media.
  • Media description.
  • Originator of the session.
  • Repeat times for timing information.
  • SDP session description.
  • Timing information of the session.
  • Time zone information for the session.