Web RTC Integrator's Guide

WebRTC%20Integrator's%20Guide

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 382

DownloadWeb RTC Integrator's Guide
Open PDF In BrowserView PDF
WebRTC Integrator's Guide

Successfully build your very own scalable WebRTC
infrastructure quickly and efficiently

Altanai

BIRMINGHAM - MUMBAI

WebRTC Integrator's Guide
Copyright © 2014 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.

First published: October 2014

Production reference: 1251014

Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-126-7
www.packtpub.com

Cover image by Gagandeep Sharma (er.gagansharma@gmail.com)

Credits
Author
Altanai
Reviewers
Alessandro Arrichiello
Pasquale Boemio
Antón Román Portabales
Andrii Sergiienko
Commissioning Editor
Usha Iyer
Acquisition Editor
Llewellyn Rozario
Content Development Editor
Akashdeep Kundu
Technical Editor
Menza Mathew
Copy Editors
Karuna Narayanan
Laxmi Subramanian
Project Coordinator
Neha Thakur

Proofreaders
Jenny Blake
Stephen Copestake
Maria Gould
Joel T. Johnson
Indexers
Hemangini Bari
Mariammal Chettiyar
Rekha Nair
Graphics
Ronak Dhruv
Valentina D'silva
Disha Haria
Abhinash Sahu
Production Coordinators
Adonia Jones
Nitesh Thakur
Cover Work
Nitesh Thakur

About the Author
Altanai, born into an Indian army family, is a bubbly, vivacious, intelligent

computer geek. She is an avid blogger and writes on Research and Development
of evolving technologies in Telecom (http://altanaitelecom.wordpress.com).
She holds a Bachelor's degree in Information Technology from Anna University,
Chennai. She has worked on many Telecom projects worldwide, specifically in the
development and deployment of IMS services. She firmly believes in contributing to
the Open Source community and is currently working on building a WebRTC-based
JS library with books for more applications.
Her hobbies include photography, martial arts, oil canvas painting, river rafting,
horse riding, and trekking, to name a few.
This is her first book, and it contains useful insight into WebRTC for beginners and
integrator in this field. The book has definitions and explanations that will cover
many interesting concepts in a clear manner.
Altanai can be contacted at tara181989@gmail.com.

About the Reviewers
Alessandro Arrichiello is a computer enthusiast. He graduated in Computer
Engineering from the University of Naples Federico II, Italy.

He has a passion for and knowledge of GNU/Linux systems that began at age
of 14 and continues today. He is an independent Android developer, who develops
apps for Google Play Store, and has strong knowledge of C++, Java, and other
derivatives. He also has experience with many other interpreted languages such
as Perl, PHP, and Python.
Alessandro is a proud open source supporter and has given his contribution to
many collaborative projects developed for academic purposes.
Recently, he enriched his knowledge on Network Monitoring, focusing on
Penetration Testing and Network Security in general.
At the moment, Alessandro is working as a software engineer in the
Communications and Media Solution group of Hewlett Packard in Milan, Italy.
He's involved in many business projects as a developer and technology consultant.
Alessandro has worked as a reviewer and author for Packt Publishing. He has
technically reviewed the book, WebRTC Blueprints, and now, he's working on a
video course on developing an application using the WebRTC technology.

Pasquale Boemio fell in love with Linux and the open source philosophy
at the age of 12. He has a Master's degree in Computer Engineering, and he
works as a researcher at the Computer Engineering department of the University
of Naples Federico II, Italy. At the same time, he collaborates with Meetecho
(www.meetecho.com), experimenting with a large number of innovative technologies
such as WebRTC, Docker, and Node.js.
Even though Pasquale is involved in such activities, he still releases free software on
GitHub (www.github.com/helloIAmPau).

Antón Román Portabales is the CTO of Quobis. After graduating as a
telecommunications engineer, he began working in Motorola as an IMS developer.
In 2008, he left Motorola to join Quobis, a Spanish company focused on SIP
interconnection. It works for major operators and companies in Europe and South
America. In 2010, he finished a Pre-PhD program in Telematics Engineering as the
main author of a paper about the use of IMS networks to transmit real-time data
from the electrical grid; he presented this paper in an IEEE conference in 2011.
He has been actively working on WebRTC since 2012, when Quobis decided to focus
on this technology. He has recently got involved in the activities of IETF, along with
other colleagues from Quobis. He also frequently participates in VoIP-related open
source events.

Andrii Sergiienko is an entrepreneur who's passionate about IT and also

about travelling. He has lived in different places, such as Ukraine, Russia, Belarus,
Mongolia, Buryatia, and Siberia, spending a considerable number of years in every
place. He also likes to travel by an auto rickshaw.
From his early childhood, Andrii was interested in computer programming and
hardware. He took the first steps in this field more than 20 years ago. Andrii has
experience in a wide set of languages and technologies, including C, C++, Java,
Assembler, Erlang, JavaScript, PHP, Riak, shell scripting, computer networks,
security, and so on.
During his career, Andrii has worked for both small, local companies, such as
domestic ISP; and large world corporations, such as Hewlett Packard. He also
started his own companies; some of them were relatively successful, while others
were a total failure.
Today, Andrii is working on growing Oslikas, his company, headquartered
in Estonia. The company is focused on modern IT technologies and solutions.
They also develop a full-stack framework to create rich media WebRTC
applications and services. You can find them at http://www.oslikas.com.

www.PacktPub.com
Support files, eBooks, discount offers, and more

You might want to visit www.PacktPub.com for support files and downloads related
to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and
ePub files available? You can upgrade to the eBook version at www.PacktPub.com and
as a print book customer, you are entitled to a discount on the eBook copy. Get in touch
with us at service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up
for a range of free newsletters and receive exclusive discounts and offers on Packt books
and eBooks.
TM

http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can access, read and search across Packt's entire library of books.

Why subscribe?
•
•
•

Fully searchable across every book published by Packt
Copy and paste, print and bookmark content
On demand and accessible via web browser

Free access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access
PacktLib today and view nine entirely free books. Simply use your login credentials for
immediate access.

Table of Contents
Preface
Chapter 1: Running WebRTC with and without SIP

1
7

JavaScript Session Establishment Protocol (JSEP)
Signal and media flows
Running WebRTC without SIP
Sending media over WebSockets

7
8
10
10

WebRTC through WebSocket signaling servers
Node.js
Making a peer-to-peer audio call using Node.js for signaling
Running WebRTC with SIP
Session Initiation Protocol (SIP)
JavaScript-based SIP libraries
Summary

24
24
26
32
32
36
37

getUserMedia
RTCPeerConnection
RTCDataChannel
Media traversal in WebRTC clients

Chapter 2: Making a Standalone WebRTC Communication Client
Description of the WebRTC client-server model
The sipML5 WebRTC client

Developing a minified webphone application using Tomcat
Developing our customized version of the sipML5 client

The jsSIP WebRTC client

Developing our version of the jsSIP client

SIP servers
SIP-WS to SIP-WS

SIP2SIP
OfficeSIP
SIP WS to SIP and vice-versa

The gateway to convert SIP over WebSocket to native SIP
The WebRTC2SIP gateway

10
12
18
23

39
40
41

42
46

49

50

53
55

56
57
58

59

59

Table of Contents
The WebRTC client with Brekeke SIP server
The WebRTC client with the Kamailio SIP server

Limitations of the existing setup
Firewall and NAT issues
Media transcoding
Summary

Chapter 3: WebRTC with SIP and IMS

The Interaction with core IMS nodes
The Call Session Control Function
Home Subscriber System
The IP Multimedia Subsystem core
The OpenIMS Core
The Telecom server
The Mobicents Telecom Application Server
The Media Server
The FreeSWITCH Media Server
Media Services

WebRTC over firewalls and proxies
The final architecture for the WebRTC-to-IMS integration
Summary

Chapter 4: WebRTC Integration with Intelligent Network

From mobiles to WebRTC client through GPRS
IMS connectivity to Gateway GPRS Support Node
From mobiles to WebRTC client through GSM
Call processed with the IN service logic
The WebRTC client's communication with the GSM phone
through IMS
The WebRTC client's communication with a GSM phone
with IN services
The services broker for endpoints and WebRTC in IMS to GSM
phone in Intelligence Networks
The WebRTC client's SIP messages to SMS in a GSM phone (SMSC)
The Kannel gateway
Summary

Chapter 5: WebRTC Integration with PSTN

What is PSTN?
WebRTC connectivity to the PSTN
The PSTN gateway
The PSTN connectivity to IMS via PSTN gateways

The call flow from a WebRTC SIP browser client to a fixed landline phone
[ ii ]

64
66

74
75
75
79

81
82
83
83
85
86
96
96
99
99

103

109
112
113

115
116
118
121
124
125
127
129
130
130
135

137
138
139
141
142

142

Table of Contents

The challenges in connecting the WebRTC world to
the PSTN landscape
Address mapping
Translation from SIP to ISUP

145
145
145

The service logic
SIP service logic through application server
IN services via IMSSF
The Service Broker for the orchestration of services
Summary

150
150
151
152
154

The call setup
The call termination
The call in progress

Chapter 6: Basic Features of WebRTC over SIP

SIP services
Registering a SIP client
Making audio and video calls using SIP
Text Chat using SIP
Obtaining the online/offline status of users using SIP
Services in the Application Server
Back-to-back user agent
Call screening
Basic call screening
Enhanced call screening

146
147
149

155

156
156
159
165
167
172
174
175
175
176

Call hold/resume
Call forwarding

176
177

Call transfer

179

Unconditional call forwarding
Call forwarding when the user is unavailable
Attended call transfer
Unattended call transfer

178
178
179
181

Generation of call log for tracking
Media Server-based features
Announcement
Media relay
Voicemail
Music on Hold
Interactive Voice Response
Conferencing

182
182
183
183
184
186
186
187

Features of a web application
Geolocation
Authenticating users with OAuth

188
188
190

Multipart communication

187

[ iii ]

Table of Contents

Import contacts from other accounts
Advertisements in the WebRTC call
Delivering an instant message as a mail
The admin console
Summary

Chapter 7: WebRTC with Industry Standard Frameworks

The Multitier architecture
The design of a WebRTC client
The Class diagram
The Entity Relationship model
The environment setup
Java Runtime Environment (JRE)
Integrated Development Environment with Java Enterprise Edition (EE)
Databases
The web application server
The web application infrastructure
JSP- / Servlet-based WebRTC web project
Programming the JSP- / Servlet-based web project structure
The development of modules

191
192
193
194
194

195
196
197
197
200
201
201
202
202
203
204
204

205
206

Struts- / Hibernate-based WebRTC web project

213

Spring 3 MVC-based WebRTC web project

223

Programming the Struts- / Hibernate-based web project structure
The development of modules
Programming the Spring 3 MVC web project structure
The development of modules

Testing
Testing the signal flow
Test cases for WebRTC client validation
Summary

Chapter 8: WebRTC and Rich Communication Services
Rich Communication Services
Position and adoption of RCS
Business impact of RCS
Technology impact
Rich Communication Services enhanced (RCS-e)
Joyn
The RCS configuration process
RCS specifications
Service discovery by an RCS-enabled device
User capability exchange
Chats with multimedia sharing

[ iv ]

213
215
223
226

236
237
237
241

243
244
244
245
245
246
246
246
247

248
248
249

Table of Contents
Group chat in a conference session
User availability through XCAP
REST-based notifications
Interoperability and interworking

251
252
253
253

The RCS ecosystem and WebRTC
RCS services in WebRTC

254
255

WebRTC architecture with RCS modules
Telecom operator's benefit derived from RCS
Voice over LTE
Combination of WebRTC, VOLTE, and RCS
Summary

266
266
268
268
269

User profile
Integration with social networks
The enhanced phonebook
User capabilities and Presence
Unified messaging box
Message history
Rich calls
Call logs
Message history
Multiparty conferencing

Chapter 9: Native SIP Application and Interaction
with WebRTC Clients
Support for WebRTC in various operating systems
Windows OS

Native browser support for WebRTC clients
SIP softphones capable of interacting with WebRTC clients
WebRTC unsupported browsers interacting with WebRTC clients

255
257
258
259
260
261
261
263
264
265

271
273
274

274
280
282

Linux OS

283

Mac OS

289

Android OS for mobiles

295

Windows OS for mobiles
Apple iPhone

301
302

Native browser support for WebRTC clients
SIP softphones capable of interacting with WebRTC clients
Native browser support for WebRTC clients
SIP softphones capable of interacting with WebRTC clients
WebRTC unsupported browsers interacting with WebRTC client
Native browser support for WebRTC clients
Android phone's/tablet's SIP applications capable of interacting with WebRTC clients
Developing a lightweight Android SIP application

iPhone/iPad IP applications interacting with WebRTC clients
Developing an iPhone SIP application

Summary

[v]

284
286
290
291
294
295
298
300

302
304

304

Table of Contents

Chapter 10: Other WebRTC Use Cases

Unified Communicator
Team Communicator
Customized Communicator for specific enterprise segments
Branches and back office communications
The Customer Relationship Management system
Network Operation Center
The human resource management tool
Communicating with candidates for an open post directly
from the job portal
Social networking – targeting consumers
Social networking platforms
Dating sites with anonymous call and chat
Retail services
WebRTC online marketing centers
WebRTC contact centers
Users contacting customer care
Health care
Online medical consultation with the doctor
Financial services
Communication with financial services
Insurance claims
Calling from the ATM
Remote management
Surveillance
Managing the connected device
WebRTC games
Two-player games
Multiplayer games
TV experience with WebRTC
Live broadcasting
IPTV integration and streaming
Streaming movies among peers
Interfacing services
WebRTC for e-learning
WebRTC for e-governance
Summary

Index

[ vi ]

305
306
306
310
310
313
318
319

319
321
321
323
325
325
327
328
329
330
334
334
336
338
338
339
340
340
341
342
343
344
345
346
348
348
350
350

351

Preface
WebRTC Integrator's Guide is a deep dive into the world of real-time telecommunication
and its integration with the telecom network. This book covers a wide range of
WebRTC solutions, such as GSM, PSTN, and IMS, designed for specific network
requirement. It also addresses the implementation woes by describing every minute
detail of the WebRTC platform setup from the APIs to the architecture, code-to-server
installations, RCS-to-Codec interoperability, and much more. It also describes various
enterprise-based use cases that can be built around WebRTC.

What this book covers

Chapter 1, Running WebRTC with and without SIP, is a quick brush-up of WebRTC
basics such as Media APIs. It also describes the use of plain WebSocket signaling
to deliver WebRTC-based browser-to-browser communication.
Chapter 2, Making a Standalone WebRTC Communication Client, talks about the use
of the Session Initiation Protocol (SIP) as the signaling mechanism for WebRTC.
It describes the setup of the SIP server for this purpose.
Chapter 3, WebRTC with SIP and IMS, outlines the interaction of a SIP-based WebRTC
client with the IP Multimedia Subsystem (IMS).
Chapter 4, WebRTC Integration with Intelligent Network, describes the ways in which
WebRTC can be made interoperable with mobile phones, as the majority of mobile
communications today are still on GSM under the IN model.
Chapter 5, WebRTC Integration with PSTN, describes the backward compatibility of
the WebRTC technology to the old, fixed-line telephones.
Chapter 6, Basic Features of WebRTC over SIP, describes the basic WebRTC SIP services
such as audio/video call, messaging, call transfer, call hold/resume, and others.

Preface

Chapter 7, WebRTC with Industry Standard Frameworks, discusses the
development of the WebRTC client over the industry-adopted framework
(that is, Model-View-Controller).
Chapter 8, WebRTC and Rich Communication Services, discusses how RCS enriches
the communication technology with features such as file transfer, Presence,
phonebook, and others.
Chapter 9, Native SIP Application and Interaction with WebRTC Clients, addresses a very
important concern, that is, the WebRTC interoperability with other SIP endpoints
such as desktop clients, SIP hardphones, and mobile-based SIP applications.
Chapter 10, Other WebRTC Use Cases, presents an interesting array of WebRTC use
cases that are both innovative and practical with the current WebRTC standards.

What you need for this book

A brief understanding of SIP is required to set up the operation environment.
It is recommended that you use Linux, as it supports the installation of many open
source components described in the book. Web development skills are required
to make the WebRTC web-based application using HTML and browser APIs. It is
recommended that you use the Eclipse IDE for client-side development, as depicted
in many screenshots provided in the book. To host the applications, any web server,
such as Apache, will do.

Who this book is for

Web developers, SIP application developers, and IMS experts can use this book to
develop and deploy a customized, readily deployable WebRTC platform. The use
cases described in the book cater to WebRTC integration in any industry segment.
Therefore, anyone with basic knowledge of HTML and JavaScript can develop a
WebRTC client after referring to this book.

Conventions

In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles, and an
explanation of their meaning.

[2]

Preface

Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows:
"We saw how to program the three basic APIs of WebRTC media stack namely,
getUserMedia, RTCPeerConnection, and DataChannel."
A block of code is set as follows:
public class loginServlet extends HttpServlet {
public loginServlet() {
super();
}
...

Any command-line input or output is written as follows:
ws://ns313841.ovh.net:10060/
Request Method:
GET
Status Code:
101 Switching Protocols

New terms and important words are shown in bold. Words that you see on the
screen, in menus or dialog boxes for example, appear in the text like this: "As peer 1
keys in the message and hits the Send button, the message is passed on to peer 2."
Warnings or important notes appear in a box like this.

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or may have disliked. Reader feedback is important for
us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to feedback@packtpub.com,
and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide on www.packtpub.com/authors.
[3]

Preface

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased
from your account at http://www.packtpub.com. If you purchased this book
elsewhere, you can visit http://www.packtpub.com/support and register to have
the files e-mailed directly to you.

Downloading the color images of this book

We also provide you a PDF file that has color images of the screenshots/diagrams
used in this book. The color images will help you better understand the changes in
the output. You can download this file from: https://www.packtpub.com/sites/
default/files/downloads/1267OS_ColoredImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in the text or
the code—we would be grateful if you would report this to us. By doing so, you can
save other readers from frustration and help us improve subsequent versions of this
book. If you find any errata, please report them by visiting http://www.packtpub.
com/submit-errata, selecting your book, clicking on the errata submission form link,
and entering the details of your errata. Once your errata are verified, your submission
will be accepted and the errata will be uploaded on our website, or added to any list of
existing errata, under the Errata section of that title. Any existing errata can be viewed
by selecting your title from http://www.packtpub.com/support.

[4]

Preface

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media.
At Packt, we take the protection of our copyright and licenses very seriously. If you
come across any illegal copies of our works, in any form, on the Internet, please
provide us with the location address or website name immediately so that we can
pursue a remedy.
Please contact us at copyright@packtpub.com with a link to the suspected
pirated material.
We appreciate your help in protecting our authors, and our ability to bring
you valuable content.

Questions

You can contact us at questions@packtpub.com if you are having a problem
with any aspect of the book, and we will do our best to address it.

[5]

Running WebRTC with
and without SIP
WebRTC lets us make calls right from a web page without any plugin. This was
made possible using media APIs of the browser to fetch user media, WebSocket for
transportation, and HTML5 to render the media on the web page. Thus, WebRTC
is an evolved form of WebSocket communication. WebSocket is a Transport Layer
protocol that carries data. The WebSocket API is an Application Programming
Interface (API) that enables web pages to use the WebSocket protocol for (duplex)
communication with a remote host.
In this chapter, we will study how WebRTC really works. We will also
demonstrate the use of WebRTC media APIs to capture and render input from a
user's microphone and camera onto a web page. In the later part of chapter, we will
find out how to build a simple standalone WebRTC client using the plain WebSocket
protocol as the signaling mechanism.

JavaScript Session Establishment
Protocol (JSEP)

The communication model between a client and remote host is based on the
JSEP architecture, which differentiates the signaling and media transaction
into different layers.

Running WebRTC with and without SIP

The differentiation is shown in the following figure:
WebRTC: JSEP Approach
Signaling vs Media

Network

Signaling

Signaling

App
App

App

SessionDescription

SessionDescription

WebRTC
Browser

Browser
Media

Caller

Callee

JSEP signaling and media

As an example, let's consider two peers, A and B, where A initiates communication
with B. Initially, in the first case, A being the offerer will have to call the
createOffer function to begin a session. A also mentions details such as codecs
through a setLocalDescription function, which sets up its local config. The remote
party, B, reads the offer and stores it using the setRemoteDescription function. The
remote party, B, calls the createAnswer function to generate an appropriate answer,
applies it using the setLocalDescription function, and sends the answer back
to the initiator over the signaling channel. When A gets the answer, it also stores it
using the setRemoteDescription function, and the initial setup is complete. This
is repeated for multiple offers and answers. The latest on JSEP specifications can be
read from the Internet Engineering Task Force (IETF) site at http://datatracker.
ietf.org/doc/draft-ietf-rtcweb-jsep/.

Signal and media flows

The differentiation between signal and media flows is an important aspect of the
WebRTC call setup.
The signaling mechanism can be any among HTTP/REST, JavaScript Object
Notation (JSON) via XMLHttpRequest (XHR), Session Initiation Protocol (SIP)
over websockets, XMPP, or any custom or proprietary protocol. The media
(audio/video) is defined through the Session Description Protocol (SDP) and
flows from peer to peer.
[8]

Chapter 1

A few instances of end-to-end signaling and media flow variants are shown in the
following screenshot:

JSON via XMLHttpRequest
Signaling

JSON via XMLHttpRequest

Network

Signaling

App

App
App

SessionDescription

SessionDescription

WebRTC
RTP

Browser

Caller

Browser

Media

websocket subprotocol JSON XMR

Callee

The preceding figure depicts signaling over the WebRTC API in the JSON format
via XHR.
Now, the following figure depicts signaling over the WebRTC API in eXtensible
Messaging and Presence Protocol (XMPP):

XMPP

Signaling

Network

App
App

XMPP

Signaling

App

SessionDescription

SessionDescription

WebRTC
Browser

Media

Caller

Browser

Callee

eXtensible Messaging and Presence Protocol (XMPP)

[9]

Running WebRTC with and without SIP

While it's very popular to use the WebRTC API with SIP support through
JavaScript libraries such as JSSIP, SIPML5, PJSIP, and so on, these libraries cater
to the SIP/IMS (IP Multimedia Subsystem) world and are not mandatory for
setting up enterprise-level WebRTC Infrastructure. In fact, it is a misconception
that WebRTC is coupled with SIP in itself; it isn't.
IP Multimedia System (IMS) is part of the Next Generation
Network (NGN) model for IP-based communication.

Running WebRTC without SIP

HTML5 websockets can be defined by ws:// followed by the URL in the server field
while readying a WebRTC client for registration. This enables bidirectional, duplex
communications with server-side processes, that is, server-side push events to the
client. It also enables the handshake after sharing media metadata such as ports,
codecs, and so on.
It should be noted that WebRTC works in an offer/answer mode and has ways
of traversing the Network Address Translation (NAT) and firewalls by means
of Interactive Connectivity Establishment (ICE). ICE makes use of the Session
Traversal Utilities for NAT (STUN) protocol and its extension, Traversal Using
Relay NAT (TURN). This is covered later in the chapter.

Sending media over WebSockets

WebRTC mainly comprises three operations: fetching user media from a
camera/microphone, transmitting media over a channel, and sending messages
over the channel. Now, let's take a look at the summarized description of every
operation type.

getUserMedia

The JavaScript getUserMedia function (also known as MediaStream) is used to allow
the web page to access users' media devices such as camera and microphone using
the browser's native API, without the need of any other third-party plugins such as
Adobe Flash and Microsoft Silverlight.

[ 10 ]

Chapter 1

For simple demos of these methods, download the WebRTC read-only
by executing the following command:
svn checkout http://webrtc.googlecode.com/svn/trunk/
webrtc-read-only

The following is the code to access the IP camera in the Google Chrome browser
and display the local video in a 

Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.6
Linearized                      : No
Create Date                     : 2014:10:27 15:23:03+05:30
Creator                         : Adobe InDesign CS6 (Windows)
Modify Date                     : 2014:10:31 12:27:21+05:30
Has XFA                         : No
XMP Toolkit                     : Adobe XMP Core 5.4-c005 78.147326, 2012/08/23-13:03:03
Instance ID                     : uuid:1060c219-b621-40ad-8c98-28e7cce479ac
Original Document ID            : adobe:docid:indd:4992da54-27df-11de-a18e-f5498a2a904f
Document ID                     : xmp.id:CAEB430BBF5DE4119C8AD742EA10E1E8
Rendition Class                 : proof:pdf
Derived From Instance ID        : xmp.iid:D86ED0E5BD5DE4119C8AD742EA10E1E8
Derived From Document ID        : xmp.did:E707A2D9A553E411B80ACDAE1EAFADE5
Derived From Original Document ID: adobe:docid:indd:4992da54-27df-11de-a18e-f5498a2a904f
Derived From Rendition Class    : default
History Action                  : converted
History Parameters              : from application/x-indesign to application/pdf
History Software Agent          : Adobe InDesign CS6 (Windows)
History Changed                 : /
History When                    : 2014:10:27 15:23:03+05:30
Metadata Date                   : 2014:10:31 12:27:21+05:30
Creator Tool                    : Adobe InDesign CS6 (Windows)
Format                          : application/pdf
Producer                        : Adobe PDF Library 10.0.1
Trapped                         : False
Page Count                      : 382
EXIF Metadata provided by EXIF.tools

Navigation menu