pub struct ParsedSipMessage {
pub direction: Direction,
pub transport: Transport,
pub address: String,
pub timestamp: Timestamp,
pub message_type: SipMessageType,
pub headers: Vec<(String, String)>,
pub body: Vec<u8>,
pub frame_count: usize,
}Expand description
A fully parsed SIP message (Level 3 output).
Provides typed access to the request/response line, headers, and body.
For JSON content types, body_text() unescapes RFC 8259
string sequences. For multipart bodies, body_parts()
splits into individual MIME parts.
Fields§
§direction: DirectionWhether this message was received or sent.
transport: TransportTransport protocol.
address: StringRemote address as ip:port.
timestamp: TimestampWhen this message was logged.
message_type: SipMessageTypeParsed request or response first line.
headers: Vec<(String, String)>Headers in wire order as (name, value) pairs. Names preserve
original casing; lookups are case-insensitive.
body: Vec<u8>Raw body bytes after the \r\n\r\n header terminator.
frame_count: usizeNumber of Level 1 frames that were reassembled into this message.
Implementations§
Source§impl ParsedSipMessage
impl ParsedSipMessage
Sourcepub fn is_multipart(&self) -> bool
pub fn is_multipart(&self) -> bool
Returns true if the Content-Type starts with multipart/.
Sourcepub fn multipart_boundary(&self) -> Option<&str>
pub fn multipart_boundary(&self) -> Option<&str>
Extract the MIME boundary string from the Content-Type header.
Sourcepub fn body_parts(&self) -> Option<Vec<MimePart>>
pub fn body_parts(&self) -> Option<Vec<MimePart>>
Split a multipart body into individual MimeParts.
Returns None if the message is not multipart.
Sourcepub fn body_text(&self) -> Cow<'_, str>
pub fn body_text(&self) -> Cow<'_, str>
Content-type-aware body text. For JSON content types (application/json
and application/*+json), unescapes RFC 8259 string sequences
(\r\n to CRLF, \t to tab, \uXXXX to Unicode). Passthrough for
all other content types.
Sourcepub fn json_field(&self, key: &str) -> Option<String>
pub fn json_field(&self, key: &str) -> Option<String>
Parse the body as JSON and return the unescaped string value of a
top-level key. Returns None if the content type is not JSON, the
body is invalid JSON, the key is missing, or the value is not a string.
Source§impl ParsedSipMessage
impl ParsedSipMessage
Sourcepub fn call_id(&self) -> Option<&str>
pub fn call_id(&self) -> Option<&str>
Returns the Call-ID header value. Checks both Call-ID and
the compact form i.
Sourcepub fn content_type(&self) -> Option<&str>
pub fn content_type(&self) -> Option<&str>
Returns the Content-Type header value. Checks both Content-Type and
the compact form c.
Sourcepub fn content_length(&self) -> Option<usize>
pub fn content_length(&self) -> Option<usize>
Returns the Content-Length header value as usize. Checks both
Content-Length and the compact form l.
Sourcepub fn method(&self) -> Option<&str>
pub fn method(&self) -> Option<&str>
Returns the SIP method: from the request line for requests, or from the CSeq header for responses.
Trait Implementations§
Source§impl Clone for ParsedSipMessage
impl Clone for ParsedSipMessage
Source§fn clone(&self) -> ParsedSipMessage
fn clone(&self) -> ParsedSipMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more