Structurally parse a single SIP message
parse_sip_message[cost: free (pure CPU, no network) | read-only, no persistence]
Parse a single raw SIP message (request OR response) and return a structured view: start line (method/status), every header in order with line numbers, body, duplicate-header counts, and a list of structural flags the parser noticed (missing-crlf, tag-on-pai, tag-on-ppi, invalid-folding, duplicate-single-instance, content-length-mismatch).
Use FIRST when the user pastes a single INVITE / 200 / NOTIFY and asks 'what does this look like to a parser?' or 'is this even valid?'. The output makes header-level bugs (two From: headers, ;tag= on PAI/PPI, missing CRLF between headers, broken Identity folding) obvious without an LLM having to scan visually.
Pair with: lint_sip_request for the full RFC compliance suite (request only); diff_sip_messages to compare two parsed messages structurally; validate_stir_shaken_identity if the message carries an Identity header.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Raw SIP message text. Should start with a request line (`INVITE sip:...@... SIP/2.0`) or status line (`SIP/2.0 200 OK`). Headers must be CRLF or LF separated. |