When VoIP meets Web - The revolution of WebRTC

32
When VoIP meets Web The Revolution of WebRTC 1 Giacomo Vacca, [email protected]

Transcript of When VoIP meets Web - The revolution of WebRTC

Page 1: When VoIP meets Web - The revolution of WebRTC

When VoIP meets WebThe Revolution of WebRTC

1

Giacomo Vacca, [email protected]

Page 2: When VoIP meets Web - The revolution of WebRTC

I'm a developer of Real-Time Communications solutions, with particular emphasis on server-side, Linux-based applications.

Founder of rtcsoft.net, consulting and development services.

https://www.linkedin.com/in/giacomovaccahttp://www.twitter.com/giavac

About me

2

Page 3: When VoIP meets Web - The revolution of WebRTC

Popular VoIP apps

- Viber- Skype- Google Hangouts- Truphone- Libon

3

Page 4: When VoIP meets Web - The revolution of WebRTC

Classical VoIP

- The “Trapezoid”: Signalling vs Media- Security IS an option

- TLS & SRTP- Client applications

- Desk, desktop, mobile- Interoperability- Standard vs Proprietary

4

Page 5: When VoIP meets Web - The revolution of WebRTC

Recent announcements

Whatsapp (800M users) launching ‘calls for Android’(PJSIP)

“An inspection of the binary using the strings tool shows both PJSIP and several strings hinting at the use of elements from the webrtc.org voice engine such as the acoustic echo cancellation (AEC), AECM, gain control (AGC), noise suppression and the high-pass filter.”http://www.theverge.com/2015/3/31/8318821/whatsapp-voice-calls-android-ioshttps://webrtchacks.com/whats-up-with-whatsapp-and-webrtc/

5

Page 6: When VoIP meets Web - The revolution of WebRTC

The WebRTC Approach

- The Client is in the browser*- P2P- No Plugins- Audio/Video/Data- Security

* Nov 2014: 400M users on Chrome mobilehttp://venturebeat.com/2014/11/19/googles-chrome-browser-hits-400m-monthly-active-users-on-mobile-up-from-300m-in-june/

6

Page 8: When VoIP meets Web - The revolution of WebRTC

WebRTC APIs

- getUserMedia: access to mic & camera- RTCPeerConnection: media transport- DataChannel: data transmission

JS adapter for different browsers: https://github.com/webrtc/samples/blob/master/src/js/adapter.js

8

Page 9: When VoIP meets Web - The revolution of WebRTC

Signalling: choose your own

No mandatory signalling protocol

- SIP- XMPP- Invent one! (see the workshop)

9

Page 10: When VoIP meets Web - The revolution of WebRTC

The Mythological SDP

- Global- Audio/Video- ICE candidates- DTLS

10

Page 11: When VoIP meets Web - The revolution of WebRTC

SDP (Very informative: https://webrtchacks.com/sdp-anatomy/)11

Page 12: When VoIP meets Web - The revolution of WebRTC

Punch a hole in that NAT!

- STUN- ICE (RFC 5245)

- Trickle ICE- TURN

- See https://code.google.com/p/coturn/

12

Page 13: When VoIP meets Web - The revolution of WebRTC

Codecs

- Audio- Opus (VBR, FEC)- G.711

- Video- VP8- H.264

13

Page 14: When VoIP meets Web - The revolution of WebRTC

Embedded Security

- DTLS SRTP- RFC 5764- Integrates key management on SRTP

- Ephemeral Authentication- Deal with client-side JS risks- Kamailio auth_ephemeral module

14

Page 15: When VoIP meets Web - The revolution of WebRTC

The tricky part: Multiparty

- Full Mesh- SFU (e.g. Jitsi* VideoBridge)- Simulcast- Media mixers (openMCU)

* recently acquired by Atlassian, http://blogs.atlassian.com/2015/04/atlassian-acquires-blue-jimp-jitsi-org/

15

Page 16: When VoIP meets Web - The revolution of WebRTC

Interoperability (Web/SIP/PSTN)

- FreeSWITCH- Asterisk (Respoke)- Janus GW- Kurento- opentok

16

Page 17: When VoIP meets Web - The revolution of WebRTC

A long way to gohttp://iswebrtcreadyyet.com/(20/4/2015)

17

Page 18: When VoIP meets Web - The revolution of WebRTC

Open Source Components

- node.js- Kamailio- FreeSWITCH- Asterisk (+ Respoke)- JsSIP (& SIPjs)- coturn

18

Page 19: When VoIP meets Web - The revolution of WebRTC

References & Nice To Read/Watch- https://bloggeek.me/- "Real-Time Communication with WebRTC: Peer-To-Peer in the Browser",

Loreto & Romano, http://www.amazon.com/gp/product/1449371876- “WebRTC for Business People”, T. Levent-Levi,

http://www.amazon.co.uk/WebRTC-Business-People-Unraveling-opportunities-ebook/dp/B00PKLJOA6

- “WebRTC Update, Jan 2015”, https://youtu.be/iBNCAaVoks0- http://rtcbits.blogspot.fr/2014/09/using-native-webrtc-simulcast-support.

html- http://www.html5rocks.com/en/tutorials/webrtc/infrastructure/

19

Page 21: When VoIP meets Web - The revolution of WebRTC

The Workshop

Building a videochat client in less than an hour…

- Use Chome/FF- Keep a tab open on chrome://webrtc-internals/- Open Console (e.g. ‘Cmd Alt I’ on Mac)

- Run a webserver- Local machine or any other VM will do

- Get workshop code on github- https://github.com/giavac/webrtc-workshop

21

Page 22: When VoIP meets Web - The revolution of WebRTC

Level 1 - Access local media

- Static HTML with a video element- JS script to call getUserMedia()- Attach local stream to video when available

22

Page 23: When VoIP meets Web - The revolution of WebRTC

Grab local media - getUserMedia() navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;

var constraints = {audio: false, video: true};

navigator.getUserMedia(constraints, successCallBack, errorCallBack);

function successCallBack(stream) {

var video = document.querySelector("video");

window.stream = stream;

if (window.URL) {

// Convert stream into Blob URL, for Chrome

video.src = window.URL.createObjectURL(stream);

}

video.play();

} 23

Page 24: When VoIP meets Web - The revolution of WebRTC

Level 2

Send & receive video!

Reference code: https://github.com/giavac/webrtc-workshop

Feel free to fork & share

24

Page 25: When VoIP meets Web - The revolution of WebRTC

Workshop - architecture

25

Page 26: When VoIP meets Web - The revolution of WebRTC

Videochat - the Caller

- Caller- Access local media- Attach local stream to video element- Create Offer- Collect ICE candidates- Send Offer SDP- Receive Answer SDP- Attach remote stream to video element

26

Page 27: When VoIP meets Web - The revolution of WebRTC

Videochat - The Callee

- Callee- Receive offer SDP- Access local media- Attach local stream to video element- Create Answer- Collect ICE candidates- Send Answer SDP- Attach remote stream to video element

27

Page 28: When VoIP meets Web - The revolution of WebRTC

Videochat - signalling server

WebSocket server available at:ws://xxx.xxx.xxx.xxx:xxxx(Unsecure ws to simplify set up)

Use responsibly during the workshop!

28

Page 29: When VoIP meets Web - The revolution of WebRTC

Videochat - A rudimentary protocol

- { ‘command’: ‘register’, ‘user_id’: ‘alice’ }- { ‘command’: ‘call’, ‘callee’: ‘bob’, ‘caller’:

‘alice’, ‘SDP’: ‘v=0\n...’}- { ‘command’: ‘answer’, ‘caller’: ‘alice’, ‘SDP’:

‘v=0\n...’}

29

Page 30: When VoIP meets Web - The revolution of WebRTC

The caller accesses her media description & sends it to the callee30

Page 31: When VoIP meets Web - The revolution of WebRTC

The callee receives the caller’s session description & answers with his31

Page 32: When VoIP meets Web - The revolution of WebRTC

Thanks!

32

When VoIP meets Web