Skip to Content
Voice & Video Calls

Voice & Video Calls

Technical specification of real-time encrypted communication.

Overview

Zentalk uses WebRTC for peer-to-peer voice and video calls, with DTLS-SRTP for media encryption and E2EE for signaling.

Protocol Stack

LayerProtocolPurpose
SignalingE2EE (Double Ratchet)SDP exchange, ICE candidates
Key ExchangeDTLS 1.2Derive SRTP keys
Media TransportSRTPEncrypted audio/video
NAT TraversalICE/STUN/TURNConnection establishment

Signaling (E2EE)

Call setup messages are encrypted using existing Double Ratchet sessions:

MessageContentEncryption
Call OfferSDP, DTLS fingerprintDouble Ratchet
Call AnswerSDP, DTLS fingerprintDouble Ratchet
ICE CandidatesAddress:port pairsDouble Ratchet
Call EndTermination signalDouble Ratchet

SDP Security

Encrypted SDP contains: - Media codecs (Opus, VP8/VP9) - DTLS fingerprint (SHA-256) - ICE credentials - Candidate addresses

The server never sees SDP content - only encrypted blobs.

DTLS-SRTP

Datagram Transport Layer Security establishes media encryption keys:

Handshake

StepMessagePurpose
1ClientHelloCipher suite proposal
2ServerHelloCipher selection
3CertificateSelf-signed, fingerprint verified
4KeyExchangeECDHE key exchange
5FinishedHandshake complete

Fingerprint Verification

1. Alice includes DTLS fingerprint in SDP (E2EE signaling) 2. Bob receives fingerprint via Double Ratchet 3. During DTLS handshake, Bob verifies certificate matches fingerprint 4. If mismatch → terminate call (MITM detected)

Key Derivation

DTLS Master Secret ├─► SRTP Encryption Key (AES-128) ├─► SRTP Authentication Key (HMAC-SHA1) └─► SRTP Salt (112 bits)

SRTP Parameters

ParameterValue
CipherAES-128-GCM or AES-128-CTR
AuthenticationHMAC-SHA1-80 (if not GCM)
Key size128 bits
Salt112 bits
Replay protection64-bit sequence window

Packet Format

┌─────────────────────────────────────────┐ │ RTP Header (12 bytes) │ ├─────────────────────────────────────────┤ │ Encrypted Payload (variable) │ ├─────────────────────────────────────────┤ │ Authentication Tag (10 bytes) │ └─────────────────────────────────────────┘

ICE (Interactive Connectivity Establishment)

Candidate Types

TypeDescriptionPrivacy
HostLocal IP addressReveals LAN IP
Server ReflexivePublic IP via STUNReveals public IP
RelayTURN server relayHides both IPs

TURN Servers

For maximum privacy, relay candidates are preferred:

PropertyValue
ProtocolTURNS (TLS encrypted)
AuthenticationEphemeral credentials
Credential lifetime24 hours
Server selectionGeographic proximity

Connection Priority

1. Direct peer-to-peer (if possible) 2. STUN-assisted (NAT traversal) 3. TURN relay (fallback)

Audio Encryption

Opus Codec

ParameterValue
Sample rate48 kHz
Bit rate6-510 kbps (VBR)
Frame size20 ms
Channels1 (mono) or 2 (stereo)

Per-Packet Encryption

For each audio packet: 1. Encode audio → Opus frame 2. Encrypt with SRTP key 3. Add authentication tag 4. Transmit via UDP

Video Encryption

Codecs

CodecUsage
VP8Default, good compatibility
VP9Higher efficiency
H.264Hardware acceleration

Selective Forwarding (SFU)

For group calls, video uses SFU architecture:

PropertyValue
EncryptionE2EE (insertable streams)
SFU visibilityEncrypted bitstream only
Key distributionVia E2EE signaling

Group Calls

Architecture

ParticipantsMethod
2Peer-to-peer
3-6SFU (Selective Forwarding)

Group Call Keys

1. Initiator generates Media Key (MK) 2. MK distributed via Double Ratchet to each participant 3. All participants use MK for SRTP 4. Key rotation on participant change

Insertable Streams API

Encryption Pipeline: Camera → Encode → Encrypt(MK) → SFU → Decrypt(MK) → Decode → Display SFU sees: Encrypted bitstream (cannot decode)

Security Properties

PropertyMechanism
ConfidentialitySRTP (AES-128-GCM)
IntegrityGCM tag / HMAC-SHA1
AuthenticityDTLS fingerprint verification
Forward SecrecyECDHE in DTLS
Replay ProtectionSRTP sequence numbers

Metadata Protection

DataProtection
Call initiation3-hop relay
Call durationLocal only, not logged
Participant IPsTURN relay option
SDP contentE2EE encrypted

Call States

StateDescription
IDLENo active call
OFFERINGSDP offer sent
ANSWERINGSDP answer sent
CONNECTINGICE/DTLS in progress
CONNECTEDMedia flowing
DISCONNECTEDCall ended

Error Handling

ErrorAction
DTLS fingerprint mismatchTerminate, warn user
ICE timeoutFallback to TURN
SRTP auth failureDrop packet
Connection lostAttempt reconnect (30s)
Last updated on