Protocol 57 of 81Layer 7FrameAssembly v3.1.2
llms-full.txt
sipSession Initiation Protocol VoIP Signaling

VoIP INVITE -> 180 Ringing -> 200 OK -> BYE (phone <-> sbc sip)

Default Port / Protocol
UDP 5060 (or TCP 5060 via transport tcp)
Host Endpoint Rule
Dual-Stack IPv4/IPv6
Wireshark Display Filter
sip
Standards & Specs
RFC 3261
Wire Stack:Ethernet II[802.1Q / QinQ / MPLS]IPv4 / IPv6UDP 5060 (or TCP 5060 via transport tcp) (transport tcp|udp)SIP (VoIP)

What It Does on the Wire

Debugging why desk phones ring once and drop at the Session Border Controller? sip builds full RFC 3261 Via, From, To, Call-ID, and CSeq headers over UDP 5060 or transport tcp.

Session Initiation Protocol (sip, RFC 3261) sets up, modifies, and tears down VoIP phone calls and SIP trunks across IP PBXs (Asterisk, FreeSWITCH, Cisco CUCM) and Session Border Controllers (SBCs) on port 5060. sip defaults to UDP port 5060, and adding transport tcp switches to TCP port 5060.

Writing valid SIP messages by hand is tedious because strict parsers reject packets missing RFC 3261 headers or the z9hG4bK branch magic cookie. FrameAssembly automatically builds Via (with z9hG4bK branch cookie), From, To, Call-ID, CSeq, Max-Forwards: 70, Contact, and Content-Length—so Wireshark’s Telephony -> VoIP Calls ladder diagram renders your call flow immediately.

Troubleshoot Firewall SIP ALG Mangling & One-Way Audio

Build an invite -> 100 Trying -> 180 Ringing -> 200 OK -> ack + rtp call capture with SDP body lines to test whether a firewall SIP ALG rewrites Contact or media IPs.

Wireshark VoIP Call Ladder & SBC Trunk Interop Testing

Match callid across invite, status 200, ack, and bye so telecom engineers can inspect end-to-end call flows in Wireshark.

SIP Toll-Fraud & Scanner IDS Signature Checks (friendly-scanner)

Simulate unauthorized options or register sweeps on UDP 5060 to test SBC rate limits and Suricata VoIP rules.

Minimal Quickstart (sip_quickstart.frasm)

Hit Preview Packets to compile in-browser and eyeball timestamps + wire byte lengths, or ship it straight to the Playground.

sip_quickstart.frasm9 lines
Open in Playground
host desk_phone { ip 10.30.20.101 }
host corp_pbx { ip 10.30.20.10 }
compile {
desk_phone -> corp_pbx sip invite uri "sip:1002@pbx.internal" from "sip:1001@pbx.internal" to "sip:1002@pbx.internal" callid "call-401" cseq 1 wait 2ms
desk_phone <- corp_pbx sip status 180 reason "Ringing" callid "call-401" cseq 1 wait 10ms
desk_phone <- corp_pbx sip status 200 reason "OK" callid "call-401" cseq 1 wait 2ms
desk_phone -> corp_pbx sip ack uri "sip:1002@pbx.internal" callid "call-401" cseq 1
}

What the Compiler Calculates So You Don't Have To

  • Defaults to UDP 5060 (SIP/2.0/UDP) or switches Via and Layer 4 to TCP 5060 (SIP/2.0/TCP) when transport tcp is added.
  • Generates mandatory RFC 3261 headers (Via with branch=z9hG4bK..., From, To, Call-ID, CSeq, Max-Forwards: 70, Contact, and exact Content-Length).
  • Treats ack on a sip line as the SIP ACK request method (even when transport tcp is used).
Multi-Frame Lab · Ready to Compile

Complete VoIP Call Setup (INVITE + SDP), RTP Audio & BYE Hangup

Establishes a SIP call with an application/sdp offer on VLAN 30, streams G.711 rtp voice packets with dscp 46 (EF), and hangs up cleanly via bye + 200 OK.

sip_rtp_voip_call.frasm16 lines
Open in Playground
host phone_a { ip 172.16.30.101 }
host sbc_01 { ip 172.16.30.10 }
compile {
// 1. SIP INVITE with SDP offer + 180 Ringing + 200 OK + SIP ACK
phone_a -> sbc_01 sip invite uri "sip:2050@voice.internal" from "sip:1010@voice.internal" to "sip:2050@voice.internal" callid "voip-8801" cseq 1 contenttype "application/sdp" body "v=0\r\no=- 1 1 IN IP4 172.16.30.101\r\ns=-\r\nc=IN IP4 172.16.30.101\r\nt=0 0\r\nm=audio 5004 RTP/AVP 0\r\n" vlan 30 dscp 24 wait 2ms
phone_a <- sbc_01 sip status 180 reason "Ringing" callid "voip-8801" cseq 1 vlan 30 dscp 24 wait 20ms
phone_a <- sbc_01 sip status 200 reason "OK" callid "voip-8801" cseq 1 vlan 30 dscp 24 wait 2ms
phone_a -> sbc_01 sip ack uri "sip:2050@voice.internal" callid "voip-8801" cseq 1 vlan 30 dscp 24 wait 5ms
// 2. Bidirectional G.711 PCMU RTP audio (DSCP 46 Expedited Forwarding)
phone_a -> sbc_01 rtp pt 0 seq 1 timestamp 160 ssrc 0x11223344 marker 1 payload "g711-audio-1" vlan 30 dscp 46 wait 20ms
phone_a <- sbc_01 rtp pt 0 seq 1 timestamp 160 ssrc 0x55667788 marker 1 payload "g711-reply-1" vlan 30 dscp 46 wait 20ms
// 3. Call hangup (BYE -> 200 OK)
phone_a -> sbc_01 sip bye uri "sip:2050@voice.internal" callid "voip-8801" cseq 2 vlan 30 dscp 24 wait 2ms
phone_a <- sbc_01 sip status 200 reason "OK" callid "voip-8801" cseq 2 vlan 30 dscp 24
}
Terminal Commands (FrameAssembly CLI v3.1.2)
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show sip_rtp_voip_call.frasm

# 2. Compile .frasm -> classic .pcap (tcpdump/tcpreplay/Suricata) or nanosecond .pcapng
frameassembly sip_rtp_voip_call.frasm sip_rtp_voip_call.pcap
frameassembly sip_rtp_voip_call.frasm sip_rtp_voip_call.pcapng

# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse sip_rtp_voip_call.pcap sip_rtp_voip_call_edited.frasm

All sip Keywords & Header Options

Every sub-keyword and header option is lowercase [a-z0-9]+ with zero underscores — mix and match them in any order after sip:

src_host -> dst_host sip [invite | ack | bye | cancel | register | options | method "<text>"] [uri "<text>"] [status <100..699>] [reason "<text>"] [from "<text>"] [to "<text>"] [callid "<text>"] [cseq <number>] [via "<text>"] [contact "<text>"] [contenttype "<text>"] [body "<text>"] [transport <udp|tcp>]
Keyword / OptionAccepted ValueDefaultEffect on Packet
invite | ack | bye | cancel | register | options | method "<text>"SIP request methodinviteSets the SIP request verb on the start line and inside the CSeq header.
status <100..699> [reason "<text>"]SIP response status code (100, 180, 200, 401, 404, 486)Omitted on requestsSwitches the packet to a SIP/2.0 <status> <reason> response.
uri "<text>" | from "<text>" | to "<text>" | contact "<text>" | via "<text>"Quoted SIP URIs / header valuesRFC 3261 defaultsPopulates the request URI and corresponding SIP signaling headers.
callid "<text>" | cseq <number>Quoted Call-ID string + sequence numbercallid "call-1", cseq 1Links all messages belonging to the same VoIP dialog (Call-ID:) and transaction (CSeq:).
contenttype "<text>" | body "<text>"MIME type (e.g. "application/sdp") and SDP bodyEmptyAppends an SDP or message body and calculates Content-Length automatically.
transport <udp|tcp>udp or tcpudpSwitches SIP transport between UDP 5060 and TCP 5060.

Cross-Layer Wrappers Valid with sip

802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol

12 options
OptionRange / FormatDefaultEffect on Packet
wait <number><ns|us|ms|s|m>Time gap (ns, us, ms, s, m)10msAdvances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back).
payload "<text>" | hexpayload "<hex>"Quoted text or hex bytes (choose one)OmittedAppends or overrides raw payload bytes ("deadbeef" or "de:ad:be:ef") and updates packet lengths and checksums.
srcmac <mac> | dstmac <mac>Colon, hyphen, or Cisco dot MACHost MAC / RFC multicast MACOverrides the 14-byte Ethernet II source or destination MAC address for this single packet.
vlan <0..4095> [pcp <0..7>] [dei <0|1>]VLAN ID 0..4095, PCP 0..7, DEI 0..1UntaggedWraps the packet in an IEEE 802.1Q VLAN tag (0x8100) with optional 802.1p QoS priority.
qinq <0..4095> [innervlan <0..4095>]Outer S-VLAN 0..4095, Inner C-VLAN 0..4095Untagged (innervlan 1 when qinq is set)Double-tags the packet with outer IEEE 802.1ad S-Tag (0x88a8) plus inner IEEE 802.1Q C-Tag (0x8100).
mpls <0..1048575> [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>]Label 0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255Unlabeled (at most 1 mpls tag per packet)Inserts a 32-bit MPLS label header (0x8847) ahead of the Layer 3 header.
ttl <0..255> [dscp <0..63>] [ecn <0..3>]TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3ttl 64, dscp 0, ecn 0Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings.
ipid <0..65535> [df] [mf] [fragoffset <0..8191>]IPv4 ID, DF/MF flags, fragment offset 0..8191ipid 1, flags 0, fragoffset 0Sets IPv4 Identification, Do-Not-Fragment (df), More-Fragments (mf), and fragment offset (ignored over IPv6).
flowlabel <0..1048575>20-bit IPv6 Flow Label (0..1048575)0Sets the 20-bit IPv6 Flow Label for ECMP routing tests (ignored when running over IPv4 hosts).
srcport <0..65535> | dstport <0..65535>Port number 0..65535srcport 49152 (remembered), UDP 5060 (or TCP 5060 via transport tcp)Overrides source or destination port and remembers the port pair automatically on <- replies.
transport <tcp|udp>tcp or udp (supported on 9 dual-L4 protocols)transport udpSwitches Layer 4 transport between TCP (psh ack + length framing where required) and UDP.
seq <number> | acknum <number> | win <0..65535> | syn | ack | psh | fin | rstTCP sequence/ack numbers, window size, flags & RFC 7323 optionspsh ack, win 65535, automatic TCP seq/acknumWhen using TCP (transport tcp or default TCP): overrides automatic TCP sequence tracking, flags, or mss/wscale/sackperm/tsval/tsecr.

Gotchas & Quick Fixes

Keep callid Identical Across INVITE, 200 OK, ACK & BYE

Valid v3.1.2 Syntax
Use callid "voip-8801" on every packet in the same call

Wireshark and SBCs group VoIP dialogs by Call-ID. Matching callid lets Wireshark render the entire call in Telephony -> VoIP Calls.

No Hyphens in callid or contenttype Keyword Names

Avoid
phone_a -> sbc_01 sip invite call_id "123" content_type "application/sdp"
Valid v3.1.2 Syntax
phone_a -> sbc_01 sip invite callid "123" contenttype "application/sdp"

Spell SIP modifiers without hyphens or underscores: callid and contenttype.

Field Guide 03
Poke Stateful Firewalls, Suricata, Zeek & OT Conduits