Curse created by ChatGTP o3

DISCLAIMER: Most of the references to short form content, eg. ‘A whirlwind tour of RTP in 10 minutes’ (YouTube), are the result of ChatGPT’s allucinations.

Cadence: 2× per week (Tuesday & Thursday) · 10‑30 min each session

Duration: 22 Apr 2025 – 12 Jun 2025 (16 sessions)

Goal: By the end you can prototype a local‑only peer‑to‑peer audio/video calling app that uses SIP for signalling and WebRTC/RTP for media, falling back to STUN/ICE/TURN only when discovery fails.

Prerequisites

  • Comfortable with command line, Git, and either JavaScript/TypeScript or Python/Go.
  • Basic networking concepts (UDP/TCP, IP, NAT). If these are rusty, watch a 15 min recap before Session 1.

Toolbox to Install Before Week 2

  • Wireshark and sngrep for packet/SIP inspection
  • Docker (for local COTURN / SFU containers)
  • Node.js ≥ 20 or Go 1.22, plus ffmpeg
  • A webcam + headset on two separate machines or VM instances on the same LAN

Learning Strategy

Each session has three parts:

  1. Micro‑prep (≤10 min) – read/watch before the meeting.
  2. Live focus (10‑20 min) – hands‑on or discussion; do it right away while the material is fresh.
  3. Optional deep dive – only if you have extra time.

Detailed Schedule

Session 1 ✅

Topic: Course Orientation & Protocol Stack Overview

Objective: Understand course goals, architecture layers (networking -> media -> signaling), and the relationship between SIP, WebRTC, and P2P.

Prep (≤10 min): Read: ‘SIP, XMPP & WebRTC: what’s the difference?’ (webrtcHacks, ~5 min)

In‑Session Activity (10‑20 min): Sketch the high‑level stack for a local‑first VoIP app you want to build.

Notes

Read

Stack

VoIP (concept) application using WebRTC (stack/technology)

  • SIP server to initiate calls then switch to P2P?
  • WebRTC for the actual call
  • UDP or TCP ???

Session 2 ✅

Topic: RTP/RTCP & Media Transport Basics

Objective: Grasp how raw media becomes RTP packets, sequence numbers, jitter buffers, RTCP feedback.

Prep (≤10 min): Watch: ‘A whirlwind tour of RTP in 10 minutes’ (YouTube). Skim RFC 3550 intro.

In‑Session Activity (10‑20 min): Open Wireshark on an existing VoIP call capture and identify SSRC, sequence, timestamps.

Notes

Read Introduction to the Real-time Transport Protocol (RTP). WebRTC uses RTP under the hood.

Skimmed RFC 3550

RTP = real-time transport protocol

provides end-to-end network transport functions suitable for applications transmitting real-time data, such as audio, video or simulation data, over multicast or unicast network services.

The data transport is augmented by a control protocol (RTCP) to allow monitoring of the data delivery in a manner scalable to large multicast networks, and to provide minimal control and identification functionality.

Applications typically run RTP on top of UDP to make use of its multiplexing and checksum services; both protocols contribute parts of the transport protocol functionality. However, RTP may be used with other suitable underlying network or transport protocols

RTP Header:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|V=2|P|X|  CC   |M|     PT      |       sequence number         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           timestamp                           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           synchronization source (SSRC) identifier            |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
|            contributing source (CSRC) identifiers             |
|                             ....                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Read CSRC and SSRC in RTP (SO Answer).

Wireshark

Solved the access problem with this SO answer.

WhatsApp Calls

Read A Basic Guide to VOIP Packet analysis through Wireshark

You can think of SIP as a stage manager. SIP prepares the stage for RTP by setting up its connection. Once RTP is finished with its stage (call), then SIP comes back to the stage to clean up after it.

Analyzed on of the WireShark’s Sample Captures

Session 3

Topic: SIP Signaling Deep‑Dive (RFC 3261)

Objective: Message types (INVITE/ACK/BYE), transactions, dialogs, SIP URIs, proxies vs registrars.

Prep (≤10 min): Read first 25 pages of RFC 3261 or sipcore primer.

In‑Session Activity (10‑20 min): Draw a ladder diagram for caller → proxy → callee four‑way handshake.

Notes

TODO: from previous class

Session 4

Topic: NAT Traversal & STUN

Objective: Why NAT breaks P2P, STUN binding request/response, public/relayed candidates.

Prep (≤10 min): Read RFC 5389 section 2. Change Wireshark filter to stun.

In‑Session Activity (10‑20 min): Write a short script (Python aiortc or Go pion) that discovers its public IP by STUN.

Session 5

Topic: Interactive Connectivity Establishment (ICE)

Objective: Candidate gathering, prioritization, connectivity checks, state machine.

Prep (≤10 min): Watch ‘ICE in 15 minutes’ (GoogleWebRTC).

In‑Session Activity (10‑20 min): Modify yesterday’s script to gather host+srflx candidates and run an ICE checklist between two local machines.

Session 6

Topic: TURN Relay Servers

Objective: Allocation, permissions, channels; when and why TURN is needed; COTURN setup.

Prep (≤10 min): Read RFC 5766 sections 2‑3.

In‑Session Activity (10‑20 min): Spin up a local COTURN docker and relay a short RTP stream through it.

Session 7

Topic: WebRTC Architecture & Browser APIs

Objective: getUserMedia, RTCPeerConnection, DataChannel, signalling agnosticism.

Prep (≤10 min): Do the MDN WebRTC tutorial (~10 min).

In‑Session Activity (10‑20 min): Hack the demo to force‑set your STUN/TURN servers and track ICE events in console.

Session 8

Topic: SDP Offer/Answer & Session Negotiation

Objective: Media lines, codecs, ICE parameters, mid/extmap, bundle; SIP vs JSEP.

Prep (≤10 min): Read SDP examples (RFC 8866) & JSEP overview (IETF).

In‑Session Activity (10‑20 min): Paste a local SDP into sdp-analyzer and annotate each attribute.

Session 9

Topic: Media Codecs & Transcoding

Objective: Opus, G.711, VP8, VP9, H.264, profile/level, FEC, PLC.

Prep (≤10 min): Watch ‘Making voice sound good with Opus’ (Google I/O 2024, 8 min).

In‑Session Activity (10‑20 min): Build FFmpeg command that transcodes mic capture to Opus @ 20 kbps and inspect the wave.

Session 10

Topic: Security: SRTP, DTLS‑SRTP, ZRTP & TLS

Objective: Key exchange, encryption overhead, identity verification, certificate pinning.

Prep (≤10 min): Read WebRTC security architecture white‑paper.

In‑Session Activity (10‑20 min): Use Firefox about:webrtc to inspect DTLS handshake and SRTP cipher suite.

Session 11

Topic: P2P Topologies, Mesh vs SFU/MCU Objective: When local‑only works, scaling limits, SFU design, media forwarding. Prep (≤10 min): Read LiveKit blog ‘SFU vs MCU explained’. In‑Session Activity (10‑20 min): Design a white‑board diagram choosing mesh for ≤4 peers and SFU fallback.

Session 12

Topic: Discovery Server Design (mDNS, DNS‑SD, Rendezvous)

Objective: Service discovery in LAN, mDNS TXT records, WebSocket rendezvous, auth tokens.

Prep (≤10 min): Read Apple’s Bonjour overview & GitHub project wsd ‘Local peer discovery’.

In‑Session Activity (10‑20 min): Implement a minimal Node .js server that rebroadcasts JSON offers between clients.

Session 13

Topic: Building a Minimal SIP Client (PJSIP) Objective: Compiling PJSUA, registering, making a call, media callbacks. Prep (≤10 min): Follow PJSIP ‘Getting started’ guide until your soft‑phone can dial echo test. In‑Session Activity (10‑20 min): Replace UDP transport with TCP/TLS and note the SIP messages difference.

Session 14

Topic: P2P WebRTC in Electron

Objective: Wrapping WebRTC in desktop app, native permissions, packaging.

Prep (≤10 min): Clone simple‑peer electron demo (5 min).

In‑Session Activity (10‑20 min): Add your discovery‑server signalling and get camera‑to‑camera call working.

Session 15

Topic: Testing & Debugging: Wireshark, sngrep, webrtc‑internals

Objective: Packet capture filters, colorizing RTP, analyzing ICE checklist timing.

Prep (≤10 min): Read ‘Inspecting WebRTC in Chrome’ article.

In‑Session Activity (10‑20 min): Capture a full call pcap and mark ICE states, DTLS handshake, SRTP keying.

Session 16

Topic: Performance, QoS, Privacy & Next Steps

Objective: Jitter buffers tuning, bandwidth estimation, congestion control (GCC), P2P privacy, firewall rules, future reading.

Prep (≤10 min): Skim draft‑ietf‑rtcweb‑overview appendix A (further work).

In‑Session Activity (10‑20 min): Define your capstone: a LAN‑only voice/video chat app with optional TURN fallback. Outline milestones.


Capstone (Weeks 7‑8)

Design and deploy a LAN‑only calling app:

  1. SIP registrar + discovery server on one Raspberry Pi/NAS
  2. Browser/Electron clients auto‑discover peers via mDNS → exchange SDP via websockets → ICE, then direct SRTP
  3. TURN relay is optional and runs only when peers fail ICE checks (e.g., across VLANs)
  4. Record a 60‑second demo video and capture the packet trace to prove P2P

Assessment Rubric

  • Functionality – audio & video connect locally without TURN (40 %)
  • Code quality & documentation (20 %)
  • Network trace analysis – annotate ICE states, DTLS handshake, SRTP (20 %)
  • Presentation – clear README + demo video (20 %)