top 5 challenges to add web calls to truphone voip platform
DESCRIPTION
This presentation is a practical example on how WebRTC can enable calls from browsers to VoIP clients and PSTN, and the related architectural changes.TRANSCRIPT
Top 5 Challenges to Add Web Calls to Truphone VoIP
Platform
Giacomo VaccaSenior Network Applications Developer
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
labs.truphone.com
2
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014 3
WebRTC is not for VoIP devs
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014 4
The “Traditional Architecture”
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
• Follow standards
• Use Open Source products
• Think scalability since the beginning
• Don’t compromise on security
• Change often, keep technical debt low
• Deploy automatically
5
Design Principles
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
• JS client (JsSIP-based)
• WebSockets
• Authentication
• Media relay for p2p sessions
• FreeSWITCH out of the media path
• Web/VoIP/PSTN interaction
–Support for DTLS
6
Changes Required
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
Websocket support
7
Challenge 1
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014 8
Adding WebSocket support…
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014 9
… with Kamailio
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
Kamailio websocket module
loadmodule "websocket.so"
…
event_route[xhttp:request] {
set_reply_close();
set_reply_no_connect();
…
if ($hdr(Upgrade)=~"websocket" && $hdr(Connection)=~"Upgrade"
&& $rm=~"GET") {
if (ws_handle_handshake()) {
exit;
}
}
}
10
WebSockets support
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
v=0
o=- 2700277954018656518 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE audio video
a=msid-semantic: WMS e8hFvtt1SQ9FiqpbYbOhN19wvpp21flszxZ4
m=audio 63529 RTP/SAVPF 111 103 104 0 8 106 105 13 126
c=IN IP4 162.243.255.49
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
11
Gigantic SDP 1/10
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
a=rtpmap:106 CN/32000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:126 telephone-event/8000
a=rtcp:63529 IN IP4 162.243.255.49
a=candidate:1867667642 1 udp 2122260223 192.168.254.1 58603 typ
host generation 0
a=candidate:1867667642 2 udp 2122260223 192.168.254.1 58603 typ
host generation 0
a=candidate:2448668656 1 udp 2122194687 192.168.142.1 58604 typ
host generation 0
a=candidate:2448668656 2 udp 2122194687 192.168.142.1 58604 typ
host generation 0
12
Gigantic SDP 2/10
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
a=candidate:882550992 1 udp 2122129151 10.2.129.202 58605 typ host
generation 0
a=candidate:882550992 2 udp 2122129151 10.2.129.202 58605 typ host
generation 0
a=candidate:567387210 1 tcp 1518280447 192.168.254.1 0 typ host
generation 0
a=candidate:567387210 2 tcp 1518280447 192.168.254.1 0 typ host
generation 0
a=candidate:3748678400 1 tcp 1518214911 192.168.142.1 0 typ host
generation 0
a=candidate:3748678400 2 tcp 1518214911 192.168.142.1 0 typ host
generation 0
a=candidate:2048480288 1 tcp 1518149375 10.2.129.202 0 typ host
generation 0
13
Gigantic SDP 3/10
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
a=candidate:2048480288 2 tcp 1518149375 10.2.129.202 0 typ host
generation 0
a=candidate:3427568147 1 udp 41754367 162.243.255.49 63529 typ relay
raddr 195.110.37.225 rport 48569 generation 0
a=candidate:3427568147 2 udp 41754367 162.243.255.49 63529 typ relay
raddr 195.110.37.225 rport 48569 generation 0
a=ice-ufrag:JuWsZDrjSjaP91bz
a=ice-pwd:QUc3SJ/aJe+FLa658U5y2qJp
a=ice-options:google-ice
a=fingerprint:sha-256
C0:42:EE:16:BF:BD:87:76:A4:0F:F6:A9:48:C8:BA:45:2E:0E:AD:1F:41:AA:
C3:3C:99:45:CA:FE:50:9D:E4:32
a=setup:actpass
a=mid:audio
14
Gigantic SDP 4/10
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=rtcp-mux
a=maxptime:60
a=ssrc:2566549015 cname:TdImtoO7ee/QmnJN
a=ssrc:2566549015 msid:e8hFvtt1SQ9FiqpbYbOhN19wvpp21flszxZ4
d7516c7a-7f81-4598-a2e6-aa71b7ceb8db
a=ssrc:2566549015 mslabel:e8hFvtt1SQ9FiqpbYbOhN19wvpp21flszxZ4
a=ssrc:2566549015 label:d7516c7a-7f81-4598-a2e6-aa71b7ceb8db
m=video 63529 RTP/SAVPF 100 116 117 96
c=IN IP4 162.243.255.49
a=rtpmap:100 VP8/90000
a=rtpmap:116 red/90000
a=rtpmap:117 ulpfec/90000
15
Gigantic SDP 5/10
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
a=rtpmap:96 rtx/90000
a=fmtp:96 apt=100
a=rtcp:63529 IN IP4 162.243.255.49
a=candidate:1867667642 1 udp 2122260223 192.168.254.1 58603 typ
host generation 0
a=candidate:1867667642 2 udp 2122260223 192.168.254.1 58603 typ
host generation 0
a=candidate:2448668656 1 udp 2122194687 192.168.142.1 58604 typ
host generation 0
a=candidate:2448668656 2 udp 2122194687 192.168.142.1 58604 typ
host generation 0
a=candidate:882550992 1 udp 2122129151 10.2.129.202 58605 typ host
generation 0
a=candidate:882550992 2 udp 2122129151 10.2.129.202 58605 typ host
generation 0
16
Gigantic SDP 6/10
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
a=candidate:567387210 1 tcp 1518280447 192.168.254.1 0 typ host
generation 0
a=candidate:567387210 2 tcp 1518280447 192.168.254.1 0 typ host
generation 0
a=candidate:3748678400 1 tcp 1518214911 192.168.142.1 0 typ host
generation 0
a=candidate:3748678400 2 tcp 1518214911 192.168.142.1 0 typ host
generation 0
a=candidate:2048480288 1 tcp 1518149375 10.2.129.202 0 typ host
generation 0
a=candidate:2048480288 2 tcp 1518149375 10.2.129.202 0 typ host
generation 0
a=candidate:3427568147 1 udp 41754367 162.243.255.49 63529 typ relay
raddr 195.110.37.225 rport 48569 generation 0
a=candidate:3427568147 2 udp 41754367 162.243.255.49 63529 typ relay
raddr 195.110.37.225 rport 48569 generation 017
Gigantic SDP 7/10
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
a=ice-ufrag:JuWsZDrjSjaP91bz
a=ice-pwd:QUc3SJ/aJe+FLa658U5y2qJp
a=ice-options:google-ice
a=fingerprint:sha-256
C0:42:EE:16:BF:BD:87:76:A4:0F:F6:A9:48:C8:BA:45:2E:0E:AD:1F:41:AA:
C3:3C:99:45:CA:FE:50:9D:E4:32
a=setup:actpass
a=mid:video
a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=rtcp-mux
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack
a=rtcp-fb:100 nack pli
a=rtcp-fb:100 goog-remb18
Gigantic SDP 8/10
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
a=ssrc-group:FID 1964375756 3405612694
a=ssrc:1964375756 cname:TdImtoO7ee/QmnJN
a=ssrc:1964375756 msid:e8hFvtt1SQ9FiqpbYbOhN19wvpp21flszxZ4
fb4cdb67-4167-4f63-a934-fa49977f955a
a=ssrc:1964375756 mslabel:e8hFvtt1SQ9FiqpbYbOhN19wvpp21flszxZ4
a=ssrc:1964375756 label:fb4cdb67-4167-4f63-a934-fa49977f955a
a=ssrc:3405612694 cname:TdImtoO7ee/QmnJN
a=ssrc:3405612694 msid:e8hFvtt1SQ9FiqpbYbOhN19wvpp21flszxZ4
fb4cdb67-4167-4f63-a934-fa49977f955a
a=ssrc:3405612694 mslabel:e8hFvtt1SQ9FiqpbYbOhN19wvpp21flszxZ4
a=ssrc:3405612694 label:fb4cdb67-4167-4f63-a934-fa49977f955a
19
Gigantic SDP 9/10
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014 20
Gigantic SDP 10/10
Increase tcp_rd_buf_size!
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
WebRTC/VoIP and WebRTC/PSTN
21
Challenge 2
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
• FreeSWITCH to the rescue– session:execute("export", "media_webrtc=true")
– session:setVariable("bypass_media", "true")
• Certs for DTLS– /etc/freeswitch/tls/dtls-srtp.crt
• Transcoding (mod_opus)– <load module="mod_opus"/>
22
WebRTC/VoIP (and PSTN)
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014 23
WebRTC/VoIP - WebRTC/PSTN
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
Authentication
24
Challenge 3
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014 25
Ephemeral Authentication
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
Kamailio auth_ephemeral module
loadmodule "auth.so“
loadmodule "auth_ephemeral.so“
…
modparam("auth_ephemeral", "secret", AUTH_EPHEMERAL_SECRET)
…
if (!autheph_proxy("$fd")) {
auth_challenge("$fd", "0");
exit;
}
26
Ephemeral Authentication
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
Media relay for p2p
27
Challenge 4
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
• rfc-5766-turn-server
–Open Source
–Easy to set up (e.g. Puppet)
–Ephemeral auth. applies here too!
• JsSIP configuration easy:– turn_servers: { urls: [“turn:myturn.com”], username: “u”, credentials: “c”}
28
Media relay (TURN + STUN)
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014 29
Media relay (TURN + STUN)
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
Testing
30
Challenge 5
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
• From sipp & PJSUA to… Selenium?
• Chrome and FF change
–A lot
–Often
• JsSIP master vs develop (re-INVITEs)
• FreeSWITCH 1.5 or 1.4?
31
5. Testing
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
Dealing with Web Developers
32
Bonus challenge
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
• Different tools/processes
• Bleeding edge libs/apps
• Automating deployment of non-stock apps?
• Don’t care about signalling/media
33
Web Development
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014 34
findable.io
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
• Big shift to web technologies
• No need to revolutionize your VoIP platform
• SIP can do the job, but…
–verto endpoint for FreeSWITCH?
• (Automated) Testing is hard
• chrome://webrtc-internals is cool
35
Wrapping up
© 2014 Truphone Limited. All Rights Reserved. 05 August 2014
Q&A
Giacomo Vacca - @giavac
https://labs.truphone.com/about/
36