2. Who
are
we?
• Based
in
Paris,
France
• A
developer
oriented
cloud
communica>ons
provider
• We
built
our
infrastructure
with
opensource
so@ware
• We
provide
a
telecom
API
– apidaze.io
:
a
REST/XML
API
for
web
developers
3. WebRTC
and
(opensource)
telecom
• How?
– WebSocket
+
SIP
– A
JavaScript
SIP+WebSocket
API
on
the
client
side
• JsSIP
/
Doubango
/
QoffeeSIP
– A
SIP+WebSocket
server
• Asterisk
(possibly
OverSIP
or
Kamailio
as
a
frontend)
• Turns
the
web
browser
into
a
SIP
client
4. For
the
developer
• Include
a
SIP+WebSocket
library,
and
start
coding
<head>
<script src="http://jssip.net/download/jssip-devel.js">
</head>
<body>
<script>
var configuration = { 'outbound_proxy_set': 'ws://94.23.192.150:8088',
'uri': 'sip:alice@example.com',
'password': 'superpassword' };
var useAudio = true;
var useVideo = true;
var views = { 'selfView': document.getElementById('my-video'),
'remoteView': document.getElementById('peer-video')};
var eventHandlers = {
'connecting': function(e){ // Your code here },
'progress': function(e){ // Your code here },
'failed': function(e){ // Your code here },
'started': function(e){ // Your code here },
'ended': function(e){ // Your code here } };
var phone = new JsSIP.UA(configuration);
phone.call('sip:bob@example.com', useAudio, useVideo, eventHandlers, views);
…
</script>
</body>
5. Is
SIP
necessary?
• A
WebRTC
developer
is
a
web
developer
– SIP
:
What
is
this?
I’m
not
a
telco
guy,
I’m
a
web
developer!
– The
WebRTC
API
is
here,
why
not
use
it?
• Solu>on
:
a
WebRTC
gateway,
with
no
or
liZle
signalling
– Use
JSON,
a
well
known
format
for
web
developers,
to
carry
signalling
messages
6. WebSocket
gateway
capabili>es
• Must
«
speak
»
ICE
• Must
encrypt
media
traffic
– SRTP/SDES
now,
SRTP/DTLS
in
the
future
8. Show
me
the
code!
socket = new WebSocket('ws://94.23.192.150:8088/agaf6c31?secret=43fdre03fa1705a&action=joinroom&roomname=' +
roomName, 'webrtc');
/* Set listeners on the socket for events 'open', 'close', 'message' */
socket.addEventListener("open", function(event) {console.log("S->C : WebSocket connection open")});
socket.addEventListener("close", function(event) {console.log("S->C : WebSocket connection closed")});
socket.addEventListener("message", onMessage, false);
…
function onMessage(evt) {
console.log("S->C: "+evt.data);
var obj = JSON.parse(evt.data);
switch (obj.event.type) {
case "confbridgejoin":
break;
case "confbridgetalking”:
break;
case “confbridgeleav”:
break;
}
}
…
/* Send message as a JSON string */
function sendMessage(type, body) {
var tmp = {};
tmp['type'] = type;
tmp['sdp'] = body;
message = JSON.stringify(tmp);
console.log("C->S : " + message);
socket.send(message);
}
9. Interac>ng
with
the
gateway
• Enter
key
iden>fier/secret
socket = new WebSocket('ws://94.23.192.150:8088/agaf6c31?
secret=43fdre03fa1705a&action=joinroom&roomname=' + roomName, 'webrtc');
• Send
commands
through
the
WebSocket
– JSON
– Implement
your
own
signalling
protocol
using
our
gateway