WebRTC allows browsers to communicate directly through peer-to-peer connections without plugins. It uses protocols like SRTP for secure media, ICE for network traversal, and SDP for session description. Signaling can be done through any protocol that supports SDP exchange. WebRTC addresses issues like NAT traversal using STUN, TURN servers, and trickle ICE. RTP bundling allows multiple media streams to be multiplexed over a single port.
2. Introduction to
WebRTC
Browser to Browser communication
V 2.1 oej@edvina.net 2017-02-15
twitter @oej
Copyright Edvina AB, Sollentuna, Sweden 2014-2017.All rights reserved.
3. The idea
Browers can play
audio and video. Why not let them use
the webcam and the
microphone?
If so, users can talk to
each other using the
browser.
Using NO PLUGINS
7. Much more than browsers
Browser
Thing with
WebRTC stack
Gateway
with WebRTC stack
Something else.
SIP, XMPP, DecNet
8. Much more than browsers
App (no browser)
Thing with
WebRTC stack
Gateway
with WebRTC stack
Something else.
SIP, XMPP, DecNet
9. Much more than browsers
SIP phone SIP phone
Gateway
with WebRTC stack
Something else.
SIP, XMPP, DecNet
10. P2P SCTP over UDP
P2P SRTP
P2P SRTP
Multiple channels
AUDIO
VIDEO
DATA
#moreCrypto
11. WebRTC API
JavaScript API defined by
the W3C
User needs to allow usage
of camera and
microphone.
Defines the session in a
SDP document
The applications needs to
provide the SDP exchange
between peers
12. The WebRTC protocols
Defined by the IETF
No signalling protocol
specified
Use SRTP for media
Use ICE (TURN, STUN) for
network discovery
13. WebRTC media
Can be bundled and
mixed to one single
RTP port
Always use secure
RTP with DTLS key
exchange
Use ICE to find the
best media path
Use TURN to traverse
NAT and firewalls.
15. P2P call setup
with network issues
Web
Server
Media
SDP SDP
The web application defines the signaling
TURN
Server
TURN
Server
16. P2P call setup
with Changing networks
Wifi
Media
If a device moves from one network
to another during a session,
a turn server can handle session
handover to the new network.
TURN
Server
TURN
Server
4G
21. Using a turn server
TURN
on Internet IP
TURN
on Internet IP
22. Using a STUN server
NAT box
STUN on
Internet IP
Finding
the outside IP on the
NAT box
23. Using a turn server to
bypass firewalls
TURN
on Internet IP
Tunnel
media over TLS/
443
24. Using a turn server to reach
old IPv4
TURN
on Internet IPv6
and IPv4
IPv6 client allocates
IPv4 turn adddress
25. Using a turn server to safely
leave the LAN
TURN
on Internet IP
in DMZ Auto discovery
26. ICE: Finding best media
path
TURN
on Internet IP
Test all
connections, then
start media
STUN: Outside of
NAT IP
1
2
3
27. Trickle ice: Start media early,
find best later
TURN
on Internet IP
STUN: Outside of
NAT IP
1
2
3
Start media
where a connection
is found
Then spend
time to find BEST
connection
28. Summary
• Use any signalling you want, as long as you can
exchange SDP documents
• Many ways to handle NAT/Firewalls
29. Compatibility with SIP
WebRTC use a lot of updates to
SDP and RTP.
Most old SIP clients and servers
does not directly support it.
A gateway will unfortunately
be needed.
34. The moving target problem
• Early implementations work to follow standard
• A push towards #MoreCrypto and better crypto
• Browsers push the gateways
• Continuous implementation issues
35. The moving target problem
- Protocols
• Early implementations work to follow standard
• A push towards #MoreCrypto and better crypto
• Browsers push the gateways
• Continuous implementation issues
36. The moving target problem
- API’s
• Early implementations work to follow standard
• Implementing private name space to indicate
early proprietary implementation
• Applications mix name spaces, have
interoperability issues
• Continuous implementation issues
38. A RTP session
Exchange of media
Consisting of streams
Each stream has an SSRC and one or more CSRC
Synchronisation source, Contributing source
39. A RTP stream
Exchange of media
Consisting of streams
Each stream has an SSRC and one or more CSRC
Synchronisation source, Contributing source (Random numbers)
RTPRTCP
RTCP gives a SSRC a CNAME as an identifier
40. SDP declares a stream with
m=
Exchange of media
AUDIO
VIDEO
42. Issues with RTP+RTCP mix
• RTP payload types 64-65, 72-80 conflicts with RTCP
packet types
• RTP payload types 64-95 should not be used,
dynamic payload types should be in the range 96-127
when possible
• RTP Payload types below 64 can be used, if not
conflicting with statically assigned numbers
• RTCP packet types 1-191 and 224-254 should not be
used
43. Example SDP
v=0
o=csp 1153134164 1153134164 IN IP6 2001:DB8::211:24ff:fea3:7a2e
s=-
c=IN IP6 2001:DB8::211:24ff:fea3:7a2e
t=1153134164 1153137764
m=audio 49170 RTP/AVP 97
a=rtpmap:97 iLBC/8000
a=rtcp-mux
This device is capable of receiving
RTCP-mux
44. For SRTP + SRTCP mux
• Still two encryption streams, multiplex after
encryption
46. Bundle
• Use sdp and RTCP to handle bundling
• Define a SDP grouping scheme called BUNDLE
• Define an RTP header extension
• One SDP can contain multiple SDP bundles
• Multiple media flows in one RTP session
47. Bundle offer/answer
• Offer contains bundle
• Answer may not contain BUNDLE and then
streams are separated
• If answer includes BUNDLE streams are
bundled
• Some streams may not work without bundle
49. Edvina Training classes
CUSTOM
INHOUSE
TRAININGS
• Update for existing
Kamailio, OpenSER
and SER users
• Introduces Kamailio
version 4
• New SIP standards
• SIP, Asterisk, Kamailio
and much more
• Done at your site,
customized for your
project
• Cost effective when
more than four
students
Find more details at http://edvina.net