Two protocols, two jobs
A phone call over the data network needs two things: someone has to set up the call (who calls whom, where is the other phone, which codec?) and then the voice has to flow. There are two protocols for this:
| Job | Protocol | Transport |
|---|---|---|
| Register, call, hang up | SIP (RFC 3261) with SDP (RFC 8866) | UDP 5060, text like HTTP |
| Voice | RTP (RFC 3550) | UDP, here port 4000, one packet every 20 ms |
Phone system
The phone system (in leyoNET a service on a server) is registrar and proxy. At startup each phone registers with REGISTER: “Number 201 can be reached at 192.168.1.21.” When someone calls 201, the phone system looks it up and forwards the request. Without a phone system a phone can also call an IP address directly.
How a call works
Phone 201 Phone system Phone 202
│── INVITE (SDP) ───▶│── INVITE (SDP) ───▶│
│◀── 180 Ringing ────│◀── 180 Ringing ────│ ringing
│◀── 200 OK (SDP) ───│◀── 200 OK (SDP) ───│ answered
│── ACK ────────────▶│── ACK ────────────▶│
│◀═══════════ RTP (voice, both directions) ═════════════▶│
│── BYE ────────────▶│── BYE ────────────▶│ hung up
│◀── 200 OK ─────────│◀── 200 OK ─────────│
The INVITE and the 200 OK carry an SDP part: c=IN IP4 192.168.1.21 (where the voice should go), m=audio 4000 RTP/AVP 0 (port and payload type 0 = G.711 µ-law). The responses find their way back via the Via lines.
Voice with RTP
G.711 (ITU-T) samples the voice 8000 times per second, one byte per sample: 64 kbit/s. Every 20 ms a packet with 160 bytes of voice is created. The RTP header (12 bytes) carries:
| Field | Meaning |
|---|---|
| Version, payload type | 2, type 0 = PCMU (G.711 µ-law, RFC 3551) |
| Sequence number | +1 per packet: the receiver detects loss and reordering |
| Timestamp | +160 per packet (samples): when it was spoken |
| SSRC | identifier of the source |
With all headers (RTP 12, UDP 8, IP 20, Ethernet 18 bytes) a call needs about 87 kbit/s per direction, not 64.
Quality
| Measure | good | poor | Why |
|---|---|---|---|
| One-way delay | up to 150 ms (ITU-T G.114) | over 400 ms | people talk over each other |
| Loss | up to 1 % | over 5 % | syllables are missing |
| Jitter | up to 30 ms | over 60 ms | the phone's buffer runs empty or overflows |
Jitter is the variation of the delay. RFC 3550 calculates it continuously: J = J + (|D| − J) / 16, where D is the difference in delay between two consecutive packets. After the call a phone shows all three values.
When a line is congested, voice suffers first: it waits behind large data packets. Quality of Service (DiffServ, 802.1p) helps.
SIP provider and NAT
At home there is no phone system: the phone registers directly with the SIP provider on the internet, using its landline number (up to 15 digits according to ITU-T E.164). Since the switch to all IP, every landline in Switzerland works like this. In between sits the home router with NAT, which causes two problems:
- Signalling: the phone writes its private address (192.168.1.100) into the SIP message. The provider therefore answers to the address and port the REGISTER really came from (
receivedandrport, RFC 3581). Through this entry in the NAT table it can also reach the phone for an incoming call. - Voice: the SDP also contains the private address. The provider replaces it with its own and forwards the RTP packets (media relay, like a session border controller). The target is always the address the other side sends from (symmetric RTP).
That way calls between two home networks work, even if both use the same private addresses.
In leyoNET
- Phone: settings → Telephony: number and address of the phone system or SIP provider. In the simulation a double click opens the phone with a keypad: enter the number, call, hang up. On the command line:
call 202,call 192.168.1.22,hangup. - SIP provider: a server with a public address and the phone system enabled; behind NAT it relays the voice itself.
- Server: settings → Telephony → “Enable phone system”; in the simulation the registered numbers are listed there.
- Packet list: filter
siporrtp; the bytes show the SIP text and the RTP header. - Check “Phone call”, optionally under load.
How to do it in leyoNET
The same text as in the app’s help (F1 key).
Telephony over IP (VoIP)
An IP phone makes calls over the data network. SIP (RFC 3261, UDP 5060) sets up the call: INVITE → 180 Ringing → 200 OK → ACK, and BYE at the end. The INVITE carries an SDP description (RFC 8866) saying where the voice should go. The voice itself runs via RTP (RFC 3550): one packet with 160 bytes of G.711 every 20 ms.
- Phone system: enable it on a server under Telephony. Phones enter its address and their number and register (REGISTER). Then “call 202” calls number 202.
- SIP provider: a server on the internet with the phone system enabled. Phones behind a home router register with their landline number; the provider answers to the observed address and relays the voice (NAT, RFC 3581).
- Using the phone: in the simulation a double click opens the phone with a keypad.
- Without a phone system: “call 192.168.10.22” calls an IP address directly.
- After the call the phone shows loss, delay and jitter. Good is: up to 150 ms delay (ITU-T G.114), at most 1 % loss and 30 ms jitter.
- Phones need power via Power over Ethernet (PoE). Quality of Service (QoS) helps when there is a bottleneck.
See an example
- Telephony with QoS over a WAN line
Two sites, connected by a 2 Mbit/s line. A PC loads it with 4 Mbit/s while phones 201 and 202 call each other via the phone system (SIP, RTP). Thanks to QoS the voice still arrives cleanly.
Filter “sip”: REGISTER, INVITE, 180 Ringing, 200 OK, ACK, BYE. Filter “rtp”: the voice packets with DSCP EF. After the call the phone shows loss, delay and jitter.
- Calling via a SIP provider
Two families call each other over the internet, as is common today: the IP phones are connected to the home router (NAT) and registered with the SIP provider under their landline number. Both home networks use the same private addresses 192.168.1.0/24.
Filter “sip”: REGISTER from the home router's public address, then INVITE, 180, 200, ACK. Filter “rtp”: the voice runs via the provider (media relay) because the phones behind NAT cannot be reached directly.
“Watch live” opens the network in leyoNET, the simulation runs in a loop. In the app you find it under File → Demo networks, with a step-by-step tour.
Practise
- ★★★★☆ Calling despite a full line (QoS) · 2 goals · Worksheet (German)
- ★★★★★ Final exercise: set up an office · 10 goals · Worksheet (German)
In leyoNET under Tools → Exercise catalogue. Every exercise checks itself.
What leyoNET simplifies
| Protocol | Layer | Simplification in the simulation |
|---|---|---|
| SIP, SDP, RTP | 7 | SIP: REGISTER, INVITE, ACK, BYE and responses 180, 200, 404, 486 as text over UDP 5060; phone system or SIP provider as registrar and proxy (all requests via it; behind NAT answers to the observed address and port per RFC 3581 and media relay), the called phone answers after 1 s; SDP only with address, port and G.711 µ-law; no authentication, no TCP/TLS. RTP: 160 bytes of G.711 µ-law (payload type 0) every 20 ms with a real 12-byte header, silence instead of speech; no RTCP, the phone calculates jitter and loss (RFC 3550, section 6.4.1) |
Standards
- RFC 3261 – SIP: Session Initiation Protocol
- RFC 3581 – An Extension to SIP for Symmetric Response Routing
- RFC 8866 – SDP: Session Description Protocol
- RFC 3550 – RTP: A Transport Protocol for Real-Time Applications
- RFC 3551 – RTP Profile for Audio and Video Conferences with Minimal Control
- ITU-T G.711 – Pulse code modulation (PCM) of voice frequencies (current edition: ITU-T G.711 (11/1988) mit Ergänzungen)
- ITU-T G.114 – One-way transmission time (current edition: ITU-T G.114 (05/2003))
- ITU-T E.164 – The international public telecommunication numbering plan (current edition: ITU-T E.164 (11/2010))