Diagnose One-Way VoIP Audio, SIP ALGs & WAN DSCP Stripping
Phones ring fine on UDP 5060, somebody picks up, and only one side hears audio—usually because a firewall SIP ALG mangled the SDP media IP, UDP 16384+ RTP is Asymmetric-NAT blocked, or the WAN carrier bleached DSCP 46 back to 0.
The Catch
Testing VoIP trunks and SBC policies by placing 30 live test calls annoys everyone in earshot, and hand-crafting SIP messages fails fast if you miss the RFC 3261 z9hG4bK Via branch magic cookie or miscalculate SDP Content-Length.
FrameAssembly builds valid RFC 5389 XOR-masked STUN bindings, complete RFC 3261 SIP dialogs with matching callid headers, and VLAN-tagged dscp 46 G.711 RTP media streams in ten readable lines.
Voice VLAN 110 Desk Phone <-> NAT Firewall / SBC Call Lifecycle
Ten packets reproduce a full enterprise voice call: (1) RFC 5389 stun bindingrequest <-> bindingresponse discovering public NAT IP 203.0.113.45; (2) CS3-marked (dscp 24) sip invite with SDP audio offer -> 180 Ringing -> 200 OK -> sip ack sharing callid "voip-call-901"; (3) bidirectional EF-marked (vlan 110 pcp 5 dscp 46) G.711 PCMU rtp voice frames; and (4) clean sip bye -> 200 OK teardown.
Adapt It for Your Network
- Set desk_phone and cloud_sbc to your voice subnet and SBC trunk IPs, and adjust vlan 110 to your Voice VLAN.
- Keep callid identical across invite, status, ack, and bye so Wireshark groups the call into one VoIP ladder.
- Compile -> open in Wireshark (Telephony -> VoIP Calls) -> replay across your firewall to check SIP ALG and DSCP 46 preservation.
.frasm -> .pcap
Preview frames inline or open in Playground ->Generates 10 Voice-VLAN frames covering STUN XOR-MAPPED-ADDRESS discovery, a matched-Call-ID SIP + SDP dialog, bidirectional DSCP-EF RTP, and BYE.
host desk_phone { ip 10.110.20.45 mac 00:04:f2:aa:20:45 }
host cloud_sbc { ip 198.51.100.60 mac 00:1c:73:60:00:01 }
flow nat_stun_discovery(phone, sbc) {
// 1. RFC 5389 STUN NAT discovery returning XOR-masked public IP 203.0.113.45
phone -> sbc vlan 110 stun bindingrequest txid 0x20459001 software "PolyEdge-B" wait 2ms
phone <- sbc vlan 110 stun bindingresponse txid 0x20459001 xormappedaddr 203.0.113.45 wait 3ms
}
flow sip_call_and_ef_rtp(phone, sbc) {
// 2. SIP call setup (CS3 dscp 24) with SDP offer sharing callid "voip-call-901"
phone -> sbc vlan 110 pcp 3 dscp 24 sip invite uri "sip:18005550199@sbc.example.net" from "sip:2045@corp.example.net" to "sip:18005550199@sbc.example.net" callid "voip-call-901" cseq 1 contenttype "application/sdp" body "v=0\r\no=- 1 1 IN IP4 203.0.113.45\r\ns=-\r\nc=IN IP4 203.0.113.45\r\nt=0 0\r\nm=audio 16400 RTP/AVP 0\r\n" wait 2ms
phone <- sbc vlan 110 pcp 3 dscp 24 sip status 180 reason "Ringing" callid "voip-call-901" cseq 1 wait 20ms
phone <- sbc vlan 110 pcp 3 dscp 24 sip status 200 reason "OK" callid "voip-call-901" cseq 1 wait 2ms
phone -> sbc vlan 110 pcp 3 dscp 24 sip ack uri "sip:18005550199@sbc.example.net" callid "voip-call-901" cseq 1 wait 5ms
// 3. Bidirectional G.711 PCMU RTP audio stamped with 802.1p PCP 5 + DSCP 46 (EF)
phone -> sbc vlan 110 pcp 5 dscp 46 srcport 16400 dstport 16400 rtp pt 0 seq 100 timestamp 160 ssrc 0x11223344 marker 1 payload "G711_TX_AUDIO" wait 20ms
phone <- sbc vlan 110 pcp 5 dscp 46 rtp pt 0 seq 500 timestamp 160 ssrc 0x99887766 marker 1 payload "G711_RX_AUDIO" wait 20ms
// 4. Clean call hangup (BYE -> 200 OK)
phone -> sbc vlan 110 pcp 3 dscp 24 sip bye uri "sip:18005550199@sbc.example.net" callid "voip-call-901" cseq 2 wait 2ms
phone <- sbc vlan 110 pcp 3 dscp 24 sip status 200 reason "OK" callid "voip-call-901" cseq 2 wait 1ms
}
compile {
nat_stun_discovery(desk_phone, cloud_sbc)
sip_call_and_ef_rtp(desk_phone, cloud_sbc)
}# 1. Compile the STUN + SIP + DSCP-EF RTP call capture
frameassembly voip_sip_rtp_qos.frasm voip_sip_rtp_qos.pcap
# 2. Verify STUN XOR-MAPPED-ADDRESS, SIP Call-ID, and RTP DSCP 46 markings in tshark
tshark -r voip_sip_rtp_qos.pcap -Y "stun || sip || rtp"
# 3. Replay across your WAN edge or firewall to verify SIP ALG & QoS queue mapping
sudo tcpreplay -i eth0 voip_sip_rtp_qos.pcapKeep voip_sip_rtp_qos.frasm in Git and build .pcap in under 1ms
Single rootless binary + VS Code extension with live squiggles, quick-fixes, and side-by-side packet ladders ready for Wireshark.
Related Examples
All 81 Protocols ->Test Encrypted SNMPv3 Traps Before an Actual Outage
vlan · snmp3
Stamp 802.1Q VLAN, Double-Tagged QinQ & MPLS Without an IXIA Rack
vlan · rtp · qinq · mpls
Poke OT / SCADA Firewalls Without Opening a Substation Breaker
tcp · modbus · dnp3 · bacnet