Media roadmap (RTP / SRTP)¶
Gossipper keeps RTP as a separate milestone layered on top of the SIP engine.
Why it is separate¶
- SIP XML compatibility and dialog timing are the hard dependencies for a useful MVP.
- RTP support becomes much easier once SIP call lifecycle and media address extraction are stable.
- The media layer remains intentionally narrow: no full browser-style WebRTC stack, but enough hooks for SDES SRTP, DTLS-SRTP, and ICE-lite-style signalling common in SIP-to-WebRTC bridges.
Current state (summary)¶
internal/mediausesgithub.com/pion/rtp,github.com/pion/rtcp,github.com/pion/srtp/v3,github.com/pion/dtls/v3,github.com/pion/stun/v3,github.com/pion/turn/v4where relevant.exec rtp_streamstarts a real RTP sender (file, synthetic, or microphone), derives the remote endpoint from SDP, supportspause/resume/stop, andecholoopback.- SDP → remote media:
ParseAudioEndpoint/ParseMediaEndpointreadc=andm=audio/m=video/m=image. Bodies are normalized withEffectiveMediaSDPBody:Content-Type: application/trickle-ice+jsonis turned into SDPa=lines before parsing.a=group:BUNDLE/a=mid:are honored when placeholders require the bundle transport (first MID in the group). For WebRTC placeholders (0.0.0.0/::,m=port 9, or missingm=for that type), they prefera=candidate(UDP, RTP component 1) in the first matching media section, or from a trickle-style fragment (nom=<type>in the body). The chosen ICEtypis exposed onEndpoint.ICECandidateTyp. Hostnames in candidates are resolved with a short DNS lookup (prefer IPv4). - SRTP (
-media_srtp): SDES froma=crypto:inline, or DTLS-SRTP froma=fingerprint:(SHA-256 / SHA-384). DTLS role followsa=setup:inm=audio:active→ gossipper runs DTLS server; otherwise DTLS client. Cleartext-only scenarios can use-media_reject_srtpto fail when SDP looks encrypted. Seedocs/srtp.md. - ICE (lightweight): Per-call local
a=ice-ufrag/a=ice-pwd(templates[ice_ufrag],[ice_pwd]). Remote ICE from peer SDP; STUN Binding responses on the RTP/DTLS socket and outbound connectivity checks before DTLS when remote credentials are present.SetRemoteIceFromSDPmerges credentials and does not clear them on candidate-only fragments. - Configure path: If the last SIP body has ICE attributes but no SRTP hint,
configureMediaSRTPForRTPStreamrefreshes ICE only and does not wipe an existing DTLS/SDES negotiation (supports trickle INFO after the main answer). The function usesEffectiveMediaSDPBodyon the last message, so JSON trickle updates participate in the same path. - RTCP: Sender reports; inbound parsing and counters; RTCP-mux when
a=rtcp-muxis in remote SDP for SRTP paths. - QoS in engine summary (cleartext and SRTP): the same
internal/mediaSession.Snapshot()feedsinternal/stats:MediaSummaryexposes RR-derived fields (e.g.rtcp_reception_reports,rtcp_max_fraction_lost,rtcp_max_jitter_ts, min/avg jitter,rtp_recv_max_cumulative_lost,rtp_recv_interarrival_jitter_peak_ts, per-call inbound RTP minima). CLI-health_max_rtcp_fraction_lost/-health_max_rtcp_jitter_tsgatesummary/health; HTML report and JSON stats include these. Periodic-trace_statCSV still carries only RTP/RTCP packet counts (no QoS columns yet). Seedocs/qos-reporting.mdfor HEP mirroring. - PCAP replay (
play_pcap_audio/ video / image), WAV send/receive, microphone, RTP recording, rtpcheck, engine stats — unchanged broad behaviour; seedocs/rtp-in-scenarios.md.
Supported media scope today¶
- Audio RTP as the primary path; pragmatic m=video / m=image for PCAP replay.
- Cleartext RTP/AVP and SRTP (SDES or DTLS) when
-media_srtpis enabled and SDP matches. - Partial WebRTC parity: BUNDLE (transport from bundled MID), SDP + JSON trickle bodies, and TURN relay (see
-turn_server/-turn_user/-turn_pass/-turn_realmindocs/srtp.md) are supported for RTP addressing and media sockets. Still not a full browser stack: ICE nomination, rich controlling/controlled behaviour, and advanced TURN (TCP allocations, etc.) are not goals of the current layer.
Known limits¶
- TURN is UDP allocate only, using the same
host:portfor STUN and TURN in the pion client; no dedicated TCP TURN or TURN-TLS mode in gossipper’s CLI yet. - Trickle works from the last SIP message body: SDP (full or fragment) or
application/trickle-ice+jsonafter conversion to SDP lines. The scenario must surface that message beforeexec rtp_stream start/mic/ PCAP actions, same as before. - No dedicated video encode/decode pipeline; no full SIPp
rtpcheckparity. docs/srtp.mdis the detailed contract for SRTP/DTLS/ICE flags and limits.
Closed (was on the roadmap)¶
- RTCP / QoS in engine summary — done for both cleartext and
-media_srtppaths: aggregation from inbound RR and local RTP loss/jitter estimates is ininternal/stats.MediaSummary, surfaced in JSON, HTML, and health thresholds. Not extended to the legacy periodic-trace_statCSV row format (still basic RTP/RTCP counters only).
High-scale cleartext RTP (load generator)¶
-media_scaleusesinternal/media/scale_engine.go: central scheduler, batched UDP send, no per-stream tickers or RTCP/recv loops.- Documented in
docs/high-scale-cleartext-rtp.md(full design) anddocs/media-scale.md(quick reference). - Not mixed with SRTP/DTLS milestones below.
Planned milestones (media)¶
- Optional: extend periodic
-trace_statCSV (and any other narrow text exports) with the same QoS columns as JSON, if operators need time-series without parsing JSON. - Richer ICE/TURN (TCP/TLS TURN, clearer error surfaces, optional channel semantics) if real deployments still hit gaps.
- Video pipeline only if scenarios need codec-specific handling beyond PCAP replay.
Library choices¶
github.com/pion/rtp,github.com/pion/rtcp,github.com/pion/srtp/v3,github.com/pion/dtls/v3,github.com/pion/stun/v3,github.com/pion/turn/v4github.com/google/gopacket/pcapgofor PCAP replay