SlideShare a Scribd company logo
1 of 73
Download to read offline
WebRTC Cloud Phone with
Asterisk, sipML5 & Janus
Alessandro Polidori - @ale_polidori

Chicago, IL, USA
August 8th 2019
Web Everywhere
travels
health
customer service
shopping
pay tv
hotels
eCommerce ?
getSupport() ?
knowledge base
email
live chat
facebook messenger
automatic bot
We will call you within: LESS THAN 1 MINUTE !
???
NEW INTERACTIONS
Web - Video Calls - Smartphone GSM
What components ?
1. Backend PBX
2. Frontend Web
1. Backend PBX
2. Frontend Web
1. Backend PBX
2. Frontend Web
1. Backend
1. Backend PBX
1. Backend PBX
1. Backend PBX
1. Backend PBX
1. Backend PBX
{ REST-API }WebSocket
1. Backend PBX
{ REST-API }WebSocket
Rest-API Doc
Developer Doc
bit.ly/nethcti-devdoc
bit.ly/nethcti-api
REAL-TIME COMMUNICATION
To the WEB
JAVASCRIPT
Media Engine
APIs
getUserMedia

RTCPeerConnection

RTCDataChannel
NATIVE SUPPORT
No Plugins

OpenSource
APPLICATIONS
Audio - Video - Data - P2P
S I G N A L I N G
SDP: media describe

SIP over WebSocket

Server needed
N E T W O R K
STUN

TURN

ICE
WHY ?
High costs

VoIP deep knowledge

Additional plugins
Used by Google Hangouts - Discord

Facebook Messenger

Amazon Chime - TokBox
Android iOS Web SDK
webrtcindex.com
• Video Conferencing

• Telephony

• Customer Service

• Healthcare

• Unified Communications

• Gaming
… and Browser Support ?
caniuse.com
supported
partialnot supported
Native debug
InternetPSTN
JS
InternetPSTN
JS
InternetPSTN
Signaling

WebSocket / HTTPS
SRTP Media

UDP
2. Frontend Web
sipML5
SIP over WebSocket (signaling)
Audio - Video - IM - Screen Sharing
OnSIP platform backend
JsSIP fork
HTML
<!doctype html>
<html>
<head></head>
<body>
<video autoplay id="video"></video>
<script src="sip-client.js"></script>
</body>
</html>
HTML
<!doctype html>
<html>
<head></head>
<body>
<video autoplay id="video"></video>
<script src="sip-client.js"></script>
</body>
</html>
let configuration = {
uri: '3000@nethesis.it',
transportOptions: {
wsServers: [ 'wss://nethesis.it:8089/ws' ]
},
authorizationUser: '3000',
password: '1234'
};
let phone = new SIP.UA(configuration);
phone.on('registered', e => {...});
phone.on('invite', e => {...});
phone.on('...', e => {...});
phone.start();
1 User Agent
2 Video Call
3 Answer Call
4 Hangup
let configuration = {
uri: '3000@nethesis.it',
transportOptions: {
wsServers: [ 'wss://nethesis.it:8089/ws' ]
},
authorizationUser: '3000',
password: '1234'
};
let phone = new SIP.UA(configuration);
phone.on('registered', e => {...});
phone.on('invite', e => {...});
phone.on('...', e => {...});
phone.start();
1 User Agent
2 Video Call
3 Answer Call
4 Hangup
3 Answer Call
4 Hangup
2 Video Call
1 User Agent
let session = phone.invite('34012@nethesis.it');
session.on('progress', e => {...});
session.on('failed', e => {...});
session.on('trackAdded', () => {
let pc = session.sessionDescriptionHandler
.peerConnection;
let remoteStream = new MediaStream();
pc.getReceivers().forEach(receiver => {
remoteStream.addTrack(receiver.track);
});
remoteStreamVideo.srcObject = remoteStream;
remoteStreamVideo.play();
// and add local one
});
3 Answer Call
4 Hangup
2 Video Call
1 User Agent
let session = phone.invite('34012@nethesis.it');
session.on('progress', e => {...});
session.on('failed', e => {...});
session.on('trackAdded', () => {
let pc = session.sessionDescriptionHandler
.peerConnection;
let remoteStream = new MediaStream();
pc.getReceivers().forEach(receiver => {
remoteStream.addTrack(receiver.track);
});
remoteStreamVideo.srcObject = remoteStream;
remoteStreamVideo.play();
// and add local one
});
2 Video Call
4 Hangup
1 User Agent
3 Answer Call
phone.on('invite', session => {
session.on('progress', e => {...});
session.on('failed', e => {...});
session.on('trackAdded', () => {
let pc = session
.sessionDescriptionHandler
.peerConnection;
let remoteStream = new MediaStream();
pc.getReceivers().forEach(receiver => {
remoteStream.addTrack(receiver.track);
});
remoteStreamVideo.srcObject = remoteStream;
remoteStreamVideo.play();
// and add local one
});
});
2 Video Call
4 Hangup
1 User Agent
3 Answer Call
phone.on('invite', session => {
session.on('progress', e => {...});
session.on('failed', e => {...});
session.on('trackAdded', () => {
let pc = session
.sessionDescriptionHandler
.peerConnection;
let remoteStream = new MediaStream();
pc.getReceivers().forEach(receiver => {
remoteStream.addTrack(receiver.track);
});
remoteStreamVideo.srcObject = remoteStream;
remoteStreamVideo.play();
// and add local one
});
});
3 Answer Call
1 User Agent
2 Video Call
4 Hangup
let hangup = e => {
rtcSession.terminate();
};
Implementation #2
sipML5
Google I/O 2012
Signals: SIP over WebSocket
Audio - Video - IM - Screen Sharing
Desktop & Mobile
1Initialization
2SIP Stack Creation
3Events Listener
4Extension registration
5Video call
SIPml.init(successCb, errorCb);
function engineReadyCb(e) {
createSipStack();
}
function engineErrorCb(e) {
console.error(e.stack);
}
3Events Listener
4Extension registration
5Video call
1Initialization
2SIP Stack Creation
let sipStack = new SIPml.Stack({
realm: 'nethesis.it',
impu: 'sip:3000@nethesis.it',
password: '1234',
display_name: 'ale_polidori',
websocket_proxy_url: 'wss://nethesis.it:8089/ws',
events_listener: {
events: '*',
listener: sipEventsListener
}
});
sipStack.start();
2SIP Stack Creation
4Extension registration
5Video call
1Initialization
3Events Listener
function sipEventsListener (e) {
if (e.type === 'i_new_call') {
ringing.play();
e.newSession.setConfiguration({
video_local: document.getElementById(localId),
video_remote: document.getElementById(remoteId),
audio_remote: document.getElementById(audioId),
events_listener: {
events: '*',
listener: callEventsListener
}
});
}
}
2SIP Stack Creation
3Events Listener
5Video call
1Initialization
4Extension registration
let registerSession = sipStack.newSession(
'register', {
events_listener: {
events: '*',
listener: registerEventsListener
}
});
registerSession.register();
2SIP Stack Creation
3Events Listener
4Extension registration
1Initialization
5Video Call
let callSession = sipStack.newSession(
'call-audiovideo', {
video_local: document.getElementById(localId),
video_remote: document.getElementById(remoteId),
audio_remote: document.getElementById(audioId),
events_listener: {
events: '*',
listener: callEventsListener
}
}
);
callSession.call('00393401234567');
calling.play();
Implementation #3
Meetecho Company
WebRTC Gateway
Plugins: SIP, VideoConf, Screen Sharing, IM
Transports: HTTP, WebSocket, RabbitMQ
Monitoring
1 Initialization
2 Video Call
3 Answer Call
4 Hangup
Janus.init({
debug: 'all',
callback: function () {
console.log('Janus initialized');
// session creation...
}
});
3 Answer Call
4 Hangup
2 Session creation
1 User Agent
function createSession() {
let janus = new Janus({
server: 'https://nethesis.it/janus',
success: function () {
// attach SIP plugin...
},
error: function (err) {
console.error(err.stack);
},
destroyed: function () {
console.log('janus destroyed !');
}
});
}
3 Answer Call
4 Hangup
2 Session creation
1 User Agent
function createSession() {
let janus = new Janus({
server: 'https://nethesis.it/janus',
success: function () {
// attach SIP plugin...
},
error: function (err) {
console.error(err.stack);
},
destroyed: function () {
console.log('janus destroyed !');
}
});
}
2 Video Call
4 Hangup
1 User Agent
3 Attach SIP Plugin
function attachSipPlugin() {
janus.attach({
plugin: 'janus.plugin.sip',
success: function (sipHandle) {...},
error: function (err) {...},
onmessage: function (msg, jsep) {
if (msg.result.event === 'incomingcall') {
ringing.play();
}
},
onlocalstream: function (stream) {
Janus.attachMediaStream(localStreamVideo, stream);
},
onremotestream: function (stream) {
var videoTracks = stream.getVideoTracks();
Janus.attachMediaStream(
remoteStreamVideo,
new MediaStream(videoTracks)
);
},
oncleanup: function () {...}
});
}
2 Video Call
4 Hangup
1 User Agent
3 Attach SIP Plugin
function attachSipPlugin() {
janus.attach({
plugin: 'janus.plugin.sip',
success: function (sipHandle) {...},
error: function (err) {...},
onmessage: function (msg, jsep) {
if (msg.result.event === 'incomingcall') {
ringing.play();
}
},
onlocalstream: function (stream) {
Janus.attachMediaStream(localStreamVideo, stream);
},
onremotestream: function (stream) {
var videoTracks = stream.getVideoTracks();
Janus.attachMediaStream(
remoteStreamVideo,
new MediaStream(videoTracks)
);
},
oncleanup: function () {...}
});
}
3 Answer Call
1 User Agent
2 Video Call
4 Video Call
sipHandle.createOffer({
media: {
audioSend: true, audioRecv: true,
videoSend: video, videoRecv: video
},
success: function (jsep) {
var body = {
request: 'call',
uri: 'sip:3401234567@nethesis.it'
};
sipcall.send({
'message': body,
'jsep': jsep
});
counterpartNum = to;
},
error: function (err) {...}
});
3 Answer Call
1 User Agent
2 Video Call
4 Video Call
sipHandle.createOffer({
media: {
audioSend: true, audioRecv: true,
videoSend: video, videoRecv: video
},
success: function (jsep) {
var body = {
request: 'call',
uri: 'sip:3401234567@nethesis.it'
};
sipcall.send({
'message': body,
'jsep': jsep
});
counterpartNum = to;
},
error: function (err) {...}
});
DEMO
alepolidori.github.com/janus-webrtc-phone
• SERVER

• CLIENT
NethServer VoIP PBX on DigitalOcean
links ON
bit.ly/cluecon-2019
TAKEAWAYS
SERVER PBX

NethVoice

NethServer PBX

CLIENT JS

SIP.js

sipML5

Janus-Gateway

DEMO

alepolidori.github.com/webrtc-phone
Alessandro Polidori
Sr. Software Engineer
@ale_polidori
ClueCon Weekly March 2019
bit.ly/ccweekly-alep
Thank you !
@ale_polidori
alessandro.polidori@nethesis.it
alessandropolidori

More Related Content

What's hot

4.4.1.2 packet tracer configure ip ac ls to mitigate attacks-instructor
4.4.1.2 packet tracer   configure ip ac ls to mitigate attacks-instructor4.4.1.2 packet tracer   configure ip ac ls to mitigate attacks-instructor
4.4.1.2 packet tracer configure ip ac ls to mitigate attacks-instructor
Salem Trabelsi
 
4.1.1.10 packet tracer configuring extended ac ls scenario 1
4.1.1.10 packet tracer   configuring extended ac ls scenario 14.1.1.10 packet tracer   configuring extended ac ls scenario 1
4.1.1.10 packet tracer configuring extended ac ls scenario 1
mps125
 
5.5.1.2 packet tracer configure ios intrusion prevention system (ips) using...
5.5.1.2 packet tracer   configure ios intrusion prevention system (ips) using...5.5.1.2 packet tracer   configure ios intrusion prevention system (ips) using...
5.5.1.2 packet tracer configure ios intrusion prevention system (ips) using...
Salem Trabelsi
 

What's hot (20)

Building scalable web socket backend
Building scalable web socket backendBuilding scalable web socket backend
Building scalable web socket backend
 
No More Fraud, Astricon, Las Vegas 2014
No More Fraud, Astricon, Las Vegas 2014No More Fraud, Astricon, Las Vegas 2014
No More Fraud, Astricon, Las Vegas 2014
 
Number one-issue-voip-today-fraud
Number one-issue-voip-today-fraudNumber one-issue-voip-today-fraud
Number one-issue-voip-today-fraud
 
Hackference 2014 - Node.js, the awesome parts
Hackference 2014 - Node.js, the awesome partsHackference 2014 - Node.js, the awesome parts
Hackference 2014 - Node.js, the awesome parts
 
Twilio
TwilioTwilio
Twilio
 
SIP & TLS - a very brief overview for the POSH BOF at IETF 87
SIP & TLS - a very brief overview for the POSH BOF at IETF 87SIP & TLS - a very brief overview for the POSH BOF at IETF 87
SIP & TLS - a very brief overview for the POSH BOF at IETF 87
 
No More Fraud Cluecon2014
No More Fraud Cluecon2014No More Fraud Cluecon2014
No More Fraud Cluecon2014
 
SIMCON 3
SIMCON 3SIMCON 3
SIMCON 3
 
LT04 IDNOG04 - Affan Basalamah (ITB) - Documenting your network
LT04 IDNOG04 - Affan Basalamah (ITB) - Documenting your networkLT04 IDNOG04 - Affan Basalamah (ITB) - Documenting your network
LT04 IDNOG04 - Affan Basalamah (ITB) - Documenting your network
 
Astricon 2010: Scaling Asterisk installations
Astricon 2010: Scaling Asterisk installationsAstricon 2010: Scaling Asterisk installations
Astricon 2010: Scaling Asterisk installations
 
WebRTC + Socket.io: building a skype-like video chat with native javascript
WebRTC + Socket.io: building a skype-like video chat with native javascriptWebRTC + Socket.io: building a skype-like video chat with native javascript
WebRTC + Socket.io: building a skype-like video chat with native javascript
 
Open Canary - novahackers
Open Canary - novahackersOpen Canary - novahackers
Open Canary - novahackers
 
The better PHP API (EN)
The better PHP API (EN)The better PHP API (EN)
The better PHP API (EN)
 
4.4.1.2 packet tracer configure ip ac ls to mitigate attacks-instructor
4.4.1.2 packet tracer   configure ip ac ls to mitigate attacks-instructor4.4.1.2 packet tracer   configure ip ac ls to mitigate attacks-instructor
4.4.1.2 packet tracer configure ip ac ls to mitigate attacks-instructor
 
4.1.1.10 packet tracer configuring extended ac ls scenario 1
4.1.1.10 packet tracer   configuring extended ac ls scenario 14.1.1.10 packet tracer   configuring extended ac ls scenario 1
4.1.1.10 packet tracer configuring extended ac ls scenario 1
 
Asterisk Voip
Asterisk VoipAsterisk Voip
Asterisk Voip
 
Elixir Berlin 2019: Dominic Letz on Doing Blockchain with Elixir
Elixir Berlin 2019: Dominic Letz on Doing Blockchain with ElixirElixir Berlin 2019: Dominic Letz on Doing Blockchain with Elixir
Elixir Berlin 2019: Dominic Letz on Doing Blockchain with Elixir
 
Python+anaconda Development Environment
Python+anaconda Development EnvironmentPython+anaconda Development Environment
Python+anaconda Development Environment
 
Sip2016 - a talk at VOIP2DAY 2016
Sip2016 - a talk at VOIP2DAY 2016Sip2016 - a talk at VOIP2DAY 2016
Sip2016 - a talk at VOIP2DAY 2016
 
5.5.1.2 packet tracer configure ios intrusion prevention system (ips) using...
5.5.1.2 packet tracer   configure ios intrusion prevention system (ips) using...5.5.1.2 packet tracer   configure ios intrusion prevention system (ips) using...
5.5.1.2 packet tracer configure ios intrusion prevention system (ips) using...
 

Similar to Presentation at ClueCon 2019 - Chicago, IL, USA 🇺🇸

Alexey Orlenko ''High-performance IPC and RPC for microservices and apps''
Alexey Orlenko ''High-performance IPC and RPC for microservices and apps''Alexey Orlenko ''High-performance IPC and RPC for microservices and apps''
Alexey Orlenko ''High-performance IPC and RPC for microservices and apps''
OdessaJS Conf
 
Cracking Into Embedded Devices - HACK.LU 2K8
Cracking Into Embedded Devices - HACK.LU 2K8Cracking Into Embedded Devices - HACK.LU 2K8
Cracking Into Embedded Devices - HACK.LU 2K8
guest441c58b71
 
Monitoring with Syslog and EventMachine (RailswayConf 2012)
Monitoring  with  Syslog and EventMachine (RailswayConf 2012)Monitoring  with  Syslog and EventMachine (RailswayConf 2012)
Monitoring with Syslog and EventMachine (RailswayConf 2012)
Wooga
 
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
CODE BLUE
 

Similar to Presentation at ClueCon 2019 - Chicago, IL, USA 🇺🇸 (20)

soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)
 
WebRTC 101 - How to get started building your first WebRTC application
WebRTC 101 - How to get started building your first WebRTC applicationWebRTC 101 - How to get started building your first WebRTC application
WebRTC 101 - How to get started building your first WebRTC application
 
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiGrâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi
 
Going real time with Socket.io
Going real time with Socket.ioGoing real time with Socket.io
Going real time with Socket.io
 
From Ruby to Node.js
From Ruby to Node.jsFrom Ruby to Node.js
From Ruby to Node.js
 
FMS Administration Seminar
FMS Administration SeminarFMS Administration Seminar
FMS Administration Seminar
 
Arduino and the real time web
Arduino and the real time webArduino and the real time web
Arduino and the real time web
 
Alexey Orlenko ''High-performance IPC and RPC for microservices and apps''
Alexey Orlenko ''High-performance IPC and RPC for microservices and apps''Alexey Orlenko ''High-performance IPC and RPC for microservices and apps''
Alexey Orlenko ''High-performance IPC and RPC for microservices and apps''
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 
The Physical World meets the Web
The Physical World meets the WebThe Physical World meets the Web
The Physical World meets the Web
 
Athens IoT meetup #7 - Create the Internet of your Things - Laurent Ellerbach...
Athens IoT meetup #7 - Create the Internet of your Things - Laurent Ellerbach...Athens IoT meetup #7 - Create the Internet of your Things - Laurent Ellerbach...
Athens IoT meetup #7 - Create the Internet of your Things - Laurent Ellerbach...
 
Iphone client-server app with Rails backend (v3)
Iphone client-server app with Rails backend (v3)Iphone client-server app with Rails backend (v3)
Iphone client-server app with Rails backend (v3)
 
Web rtc, Media stream, Peer connection, Setting up STUN and TURN on Linux and...
Web rtc, Media stream, Peer connection, Setting up STUN and TURN on Linux and...Web rtc, Media stream, Peer connection, Setting up STUN and TURN on Linux and...
Web rtc, Media stream, Peer connection, Setting up STUN and TURN on Linux and...
 
Cracking Into Embedded Devices - HACK.LU 2K8
Cracking Into Embedded Devices - HACK.LU 2K8Cracking Into Embedded Devices - HACK.LU 2K8
Cracking Into Embedded Devices - HACK.LU 2K8
 
Building fast,scalable game server in node.js
Building fast,scalable game server in node.jsBuilding fast,scalable game server in node.js
Building fast,scalable game server in node.js
 
Remote Notifications
Remote NotificationsRemote Notifications
Remote Notifications
 
Monitoring with Syslog and EventMachine (RailswayConf 2012)
Monitoring  with  Syslog and EventMachine (RailswayConf 2012)Monitoring  with  Syslog and EventMachine (RailswayConf 2012)
Monitoring with Syslog and EventMachine (RailswayConf 2012)
 
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
[CB16] Esoteric Web Application Vulnerabilities by Andrés Riancho
 
React Native EU 2021 - Creating a VoIP app in React Native - the beginner's g...
React Native EU 2021 - Creating a VoIP app in React Native - the beginner's g...React Native EU 2021 - Creating a VoIP app in React Native - the beginner's g...
React Native EU 2021 - Creating a VoIP app in React Native - the beginner's g...
 

Recently uploaded

Recently uploaded (20)

The Impact of PLM Software on Fashion Production
The Impact of PLM Software on Fashion ProductionThe Impact of PLM Software on Fashion Production
The Impact of PLM Software on Fashion Production
 
how-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdfhow-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdf
 
OpenChain @ LF Japan Executive Briefing - May 2024
OpenChain @ LF Japan Executive Briefing - May 2024OpenChain @ LF Japan Executive Briefing - May 2024
OpenChain @ LF Japan Executive Briefing - May 2024
 
architecting-ai-in-the-enterprise-apis-and-applications.pdf
architecting-ai-in-the-enterprise-apis-and-applications.pdfarchitecting-ai-in-the-enterprise-apis-and-applications.pdf
architecting-ai-in-the-enterprise-apis-and-applications.pdf
 
A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data Migration
 
Weeding your micro service landscape.pdf
Weeding your micro service landscape.pdfWeeding your micro service landscape.pdf
Weeding your micro service landscape.pdf
 
Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
 
The Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test AutomationThe Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test Automation
 
Salesforce Introduced Zero Copy Partner Network to Simplify the Process of In...
Salesforce Introduced Zero Copy Partner Network to Simplify the Process of In...Salesforce Introduced Zero Copy Partner Network to Simplify the Process of In...
Salesforce Introduced Zero Copy Partner Network to Simplify the Process of In...
 
INGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by DesignINGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by Design
 
What need to be mastered as AI-Powered Java Developers
What need to be mastered as AI-Powered Java DevelopersWhat need to be mastered as AI-Powered Java Developers
What need to be mastered as AI-Powered Java Developers
 
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdfStrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
 
Community is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletCommunity is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea Goulet
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
 
5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand
 
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
 
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesGraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
 
Microsoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdfMicrosoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdf
 

Presentation at ClueCon 2019 - Chicago, IL, USA 🇺🇸

  • 1. WebRTC Cloud Phone with Asterisk, sipML5 & Janus Alessandro Polidori - @ale_polidori Chicago, IL, USA August 8th 2019
  • 4.
  • 6. knowledge base email live chat facebook messenger automatic bot
  • 7. We will call you within: LESS THAN 1 MINUTE !
  • 8.
  • 9. ???
  • 10. NEW INTERACTIONS Web - Video Calls - Smartphone GSM
  • 11.
  • 13. 1. Backend PBX 2. Frontend Web
  • 14. 1. Backend PBX 2. Frontend Web
  • 15. 1. Backend PBX 2. Frontend Web
  • 21. 1. Backend PBX { REST-API }WebSocket
  • 22. 1. Backend PBX { REST-API }WebSocket
  • 24.
  • 25. REAL-TIME COMMUNICATION To the WEB JAVASCRIPT Media Engine
  • 28. S I G N A L I N G SDP: media describe SIP over WebSocket Server needed
  • 29. N E T W O R K STUN TURN ICE
  • 30. WHY ? High costs VoIP deep knowledge Additional plugins
  • 31.
  • 32. Used by Google Hangouts - Discord Facebook Messenger Amazon Chime - TokBox Android iOS Web SDK
  • 33. webrtcindex.com • Video Conferencing • Telephony • Customer Service • Healthcare • Unified Communications • Gaming
  • 34. … and Browser Support ? caniuse.com
  • 35.
  • 42. SIP over WebSocket (signaling) Audio - Video - IM - Screen Sharing OnSIP platform backend JsSIP fork
  • 43. HTML <!doctype html> <html> <head></head> <body> <video autoplay id="video"></video> <script src="sip-client.js"></script> </body> </html>
  • 44. HTML <!doctype html> <html> <head></head> <body> <video autoplay id="video"></video> <script src="sip-client.js"></script> </body> </html>
  • 45. let configuration = { uri: '3000@nethesis.it', transportOptions: { wsServers: [ 'wss://nethesis.it:8089/ws' ] }, authorizationUser: '3000', password: '1234' }; let phone = new SIP.UA(configuration); phone.on('registered', e => {...}); phone.on('invite', e => {...}); phone.on('...', e => {...}); phone.start(); 1 User Agent 2 Video Call 3 Answer Call 4 Hangup
  • 46. let configuration = { uri: '3000@nethesis.it', transportOptions: { wsServers: [ 'wss://nethesis.it:8089/ws' ] }, authorizationUser: '3000', password: '1234' }; let phone = new SIP.UA(configuration); phone.on('registered', e => {...}); phone.on('invite', e => {...}); phone.on('...', e => {...}); phone.start(); 1 User Agent 2 Video Call 3 Answer Call 4 Hangup
  • 47. 3 Answer Call 4 Hangup 2 Video Call 1 User Agent let session = phone.invite('34012@nethesis.it'); session.on('progress', e => {...}); session.on('failed', e => {...}); session.on('trackAdded', () => { let pc = session.sessionDescriptionHandler .peerConnection; let remoteStream = new MediaStream(); pc.getReceivers().forEach(receiver => { remoteStream.addTrack(receiver.track); }); remoteStreamVideo.srcObject = remoteStream; remoteStreamVideo.play(); // and add local one });
  • 48. 3 Answer Call 4 Hangup 2 Video Call 1 User Agent let session = phone.invite('34012@nethesis.it'); session.on('progress', e => {...}); session.on('failed', e => {...}); session.on('trackAdded', () => { let pc = session.sessionDescriptionHandler .peerConnection; let remoteStream = new MediaStream(); pc.getReceivers().forEach(receiver => { remoteStream.addTrack(receiver.track); }); remoteStreamVideo.srcObject = remoteStream; remoteStreamVideo.play(); // and add local one });
  • 49. 2 Video Call 4 Hangup 1 User Agent 3 Answer Call phone.on('invite', session => { session.on('progress', e => {...}); session.on('failed', e => {...}); session.on('trackAdded', () => { let pc = session .sessionDescriptionHandler .peerConnection; let remoteStream = new MediaStream(); pc.getReceivers().forEach(receiver => { remoteStream.addTrack(receiver.track); }); remoteStreamVideo.srcObject = remoteStream; remoteStreamVideo.play(); // and add local one }); });
  • 50. 2 Video Call 4 Hangup 1 User Agent 3 Answer Call phone.on('invite', session => { session.on('progress', e => {...}); session.on('failed', e => {...}); session.on('trackAdded', () => { let pc = session .sessionDescriptionHandler .peerConnection; let remoteStream = new MediaStream(); pc.getReceivers().forEach(receiver => { remoteStream.addTrack(receiver.track); }); remoteStreamVideo.srcObject = remoteStream; remoteStreamVideo.play(); // and add local one }); });
  • 51. 3 Answer Call 1 User Agent 2 Video Call 4 Hangup let hangup = e => { rtcSession.terminate(); };
  • 53. sipML5 Google I/O 2012 Signals: SIP over WebSocket Audio - Video - IM - Screen Sharing Desktop & Mobile
  • 54. 1Initialization 2SIP Stack Creation 3Events Listener 4Extension registration 5Video call SIPml.init(successCb, errorCb); function engineReadyCb(e) { createSipStack(); } function engineErrorCb(e) { console.error(e.stack); }
  • 55. 3Events Listener 4Extension registration 5Video call 1Initialization 2SIP Stack Creation let sipStack = new SIPml.Stack({ realm: 'nethesis.it', impu: 'sip:3000@nethesis.it', password: '1234', display_name: 'ale_polidori', websocket_proxy_url: 'wss://nethesis.it:8089/ws', events_listener: { events: '*', listener: sipEventsListener } }); sipStack.start();
  • 56. 2SIP Stack Creation 4Extension registration 5Video call 1Initialization 3Events Listener function sipEventsListener (e) { if (e.type === 'i_new_call') { ringing.play(); e.newSession.setConfiguration({ video_local: document.getElementById(localId), video_remote: document.getElementById(remoteId), audio_remote: document.getElementById(audioId), events_listener: { events: '*', listener: callEventsListener } }); } }
  • 57. 2SIP Stack Creation 3Events Listener 5Video call 1Initialization 4Extension registration let registerSession = sipStack.newSession( 'register', { events_listener: { events: '*', listener: registerEventsListener } }); registerSession.register();
  • 58. 2SIP Stack Creation 3Events Listener 4Extension registration 1Initialization 5Video Call let callSession = sipStack.newSession( 'call-audiovideo', { video_local: document.getElementById(localId), video_remote: document.getElementById(remoteId), audio_remote: document.getElementById(audioId), events_listener: { events: '*', listener: callEventsListener } } ); callSession.call('00393401234567'); calling.play();
  • 60. Meetecho Company WebRTC Gateway Plugins: SIP, VideoConf, Screen Sharing, IM Transports: HTTP, WebSocket, RabbitMQ Monitoring
  • 61. 1 Initialization 2 Video Call 3 Answer Call 4 Hangup Janus.init({ debug: 'all', callback: function () { console.log('Janus initialized'); // session creation... } });
  • 62. 3 Answer Call 4 Hangup 2 Session creation 1 User Agent function createSession() { let janus = new Janus({ server: 'https://nethesis.it/janus', success: function () { // attach SIP plugin... }, error: function (err) { console.error(err.stack); }, destroyed: function () { console.log('janus destroyed !'); } }); }
  • 63. 3 Answer Call 4 Hangup 2 Session creation 1 User Agent function createSession() { let janus = new Janus({ server: 'https://nethesis.it/janus', success: function () { // attach SIP plugin... }, error: function (err) { console.error(err.stack); }, destroyed: function () { console.log('janus destroyed !'); } }); }
  • 64. 2 Video Call 4 Hangup 1 User Agent 3 Attach SIP Plugin function attachSipPlugin() { janus.attach({ plugin: 'janus.plugin.sip', success: function (sipHandle) {...}, error: function (err) {...}, onmessage: function (msg, jsep) { if (msg.result.event === 'incomingcall') { ringing.play(); } }, onlocalstream: function (stream) { Janus.attachMediaStream(localStreamVideo, stream); }, onremotestream: function (stream) { var videoTracks = stream.getVideoTracks(); Janus.attachMediaStream( remoteStreamVideo, new MediaStream(videoTracks) ); }, oncleanup: function () {...} }); }
  • 65. 2 Video Call 4 Hangup 1 User Agent 3 Attach SIP Plugin function attachSipPlugin() { janus.attach({ plugin: 'janus.plugin.sip', success: function (sipHandle) {...}, error: function (err) {...}, onmessage: function (msg, jsep) { if (msg.result.event === 'incomingcall') { ringing.play(); } }, onlocalstream: function (stream) { Janus.attachMediaStream(localStreamVideo, stream); }, onremotestream: function (stream) { var videoTracks = stream.getVideoTracks(); Janus.attachMediaStream( remoteStreamVideo, new MediaStream(videoTracks) ); }, oncleanup: function () {...} }); }
  • 66. 3 Answer Call 1 User Agent 2 Video Call 4 Video Call sipHandle.createOffer({ media: { audioSend: true, audioRecv: true, videoSend: video, videoRecv: video }, success: function (jsep) { var body = { request: 'call', uri: 'sip:3401234567@nethesis.it' }; sipcall.send({ 'message': body, 'jsep': jsep }); counterpartNum = to; }, error: function (err) {...} });
  • 67. 3 Answer Call 1 User Agent 2 Video Call 4 Video Call sipHandle.createOffer({ media: { audioSend: true, audioRecv: true, videoSend: video, videoRecv: video }, success: function (jsep) { var body = { request: 'call', uri: 'sip:3401234567@nethesis.it' }; sipcall.send({ 'message': body, 'jsep': jsep }); counterpartNum = to; }, error: function (err) {...} });
  • 70. TAKEAWAYS SERVER PBX NethVoice NethServer PBX CLIENT JS SIP.js sipML5 Janus-Gateway DEMO alepolidori.github.com/webrtc-phone
  • 71. Alessandro Polidori Sr. Software Engineer @ale_polidori
  • 72. ClueCon Weekly March 2019 bit.ly/ccweekly-alep