SDP & SIP (3)

Parse SDP/SIP, negotiate WebRTC offer/answer, and track stateful SIP dialogs from text or pcap — with FSM state, codec tables, and a sequence-diagram timeline.

sdp_parseParse SDP / SIP

Parse a raw SDP blob or a full SIP message into structured JSON: media lines, codecs (rtpmap/fmtp), RTP header extensions (extmap), ICE, DTLS, direction, and BUNDLE. Stateless.

ParameterTypeRequiredDefaultDescription
textstringrequiredRaw SDP or a full SIP message (headers + body).
formatenum["auto","sdp","sip"]optionalautoauto detects SIP (start line) vs bare SDP.

sdp_negotiateWebRTC SDP offer/answer

Negotiate a WebRTC (JSEP) offer/answer given as raw SDP. Returns the parsed offer/answer and the negotiated result per m-line (agreed codecs, RTP extensions, BUNDLE, DTLS roles, ICE, hold). Pass session_id to accumulate renegotiation cycles as a session.

ParameterTypeRequiredDefaultDescription
offerstringrequiredOffer SDP (text).
answerstringoptionalAnswer SDP (text). Omit to only parse the offer (signaling state have-remote-offer).
session_idstringoptionalOptional WebRTC session id; accumulates offer/answer cycles in the in-memory store.

sip_dialogSIP dialog session

Track SIP dialogs statefully. Feed raw SIP messages (text) or a pcap (base64, classic or pcapng); the dialog is stored in memory keyed by Call-ID + tags. Inspect connection state (FSM), per-step codec/extension tables, and the lifetime as a JSON sequence diagram (+ Mermaid). Handles re-INVITE/UPDATE/PRACK, multiple m-lines, BUNDLE, hold, and forking.

ParameterTypeRequiredDefaultDescription
actionenum["add","state","timeline","codecs","list","reset"]requiredadd = feed message/pcap; state = FSM + offer/answer; timeline = sequence diagram JSON + Mermaid; codecs = per-step codec/extension table; list = all dialogs; reset = delete.
dialog_idstringoptionalDialog id. Optional for add (derived from Call-ID/tags) and reset (omit = all); required for state/timeline/codecs.
messagestringoptionalRaw SIP message text (action=add).
pcap_base64stringoptionalpcap file/fragment as base64 (action=add).
directionenum["caller->callee","callee->caller","auto"]optionalautoMessage direction; auto is derived from From/To tags.
sip_portnumberoptional5060SIP port to match in pcap (UDP/TCP).