Web Call Server 4 - User Guide

© 2015 Flashphoner, LLC 2 Web Call Server 4 - User Guide

Contents

0 Part I Introduction 5 Part II Features and Capabilities 7 Part III Browser and SIP calls 11 1 WebR..T..C.. .-. .W...e..b..R...T..C...... 11 Deployment ...... 11 Call Flow ...... 12 Quick Start ...... 13 2 WebR..T..C.. .-. .S..I.P...... 14 Deployment ...... 14 Call Flow ...... 15 Quick Start ...... 15 3 WebR..T..C.. .-. .F..l.a..s..h...... 16 Deployment ...... 16 Call Flow ...... 17 Quick Start ...... 17 4 Flash. .-. .F..l.a..s.h...... 18 Deployment ...... 18 Call Flow ...... 19 Quick Start ...... 19 5 Flash. .-. .S..I.P...... 20 Deployment ...... 20 Call Flow ...... 21 Quick Start ...... 21 Part IV Streaming 23 1 WebR..T..C.. ./. .W...e..b..R...T..C...... 23 Deployment ...... 23 Call Flow ...... 23 Configuring ...... 24 Quick Start ...... 24 Publish a s.t.r..e..a..m...... 24 Play a stre.a..m...... 28 2 WebR..T..C.. ./. .R..T..M...F..P...... 30 Deployment ...... 30 Call Flow ...... 30 Quick Start ...... 30 3 WebR..T..C.. ./. .R..T..S...P...... 31 Deployment ...... 31 Call Flow ...... 32 Configuring ...... 32 Quick Start ...... 32 Stream pla.y..b..a..c..k.. .w...i.t.h.. .V..L..C... .p..la..y..e..r...... 33

© 2015 Flashphoner, LLC Stream pla.y..b..a..c..k.. .w...i.t.h.. .W...o..w...z..a.. .F..l.a..s..h.. .R..T..M...P.. .p..l.a..y..e..r...... 35 4 WebR..T..C.. ./. .W...e..b..S...o..c.k..e..t. .i.O...S.. .S..a..f.a..r.i...... 36 Deployment ...... 37 Call Flow ...... 37 Configuring ...... 37 Quick Start ...... 37 5 RTMF.P... ./. .W...e..b..R..T..C...... 38 Deployment ...... 38 Call Flow ...... 39 Quick Start ...... 39 6 RTMF.P... ./. .R..T..M...F..P...... 39 Deployment ...... 40 Call Flow ...... 40 Quick Start ...... 40 7 RTMF.P... ./. .R..T..S..P...... 41 Deployment ...... 41 Call Flow ...... 41 Quick Start ...... 41 8 RTMF.P... ./. .W...e..b..s.o..c..k..e..t. .i.O..S... .S..a..f.a..r.i...... 42 Deployment ...... 42 Call Flow ...... 43 Quick Start ...... 43 9 RTSP. ./. .W...e..b..R...T..C...... 44 Deployment ...... 46 Call Flow ...... 46 Quick Start ...... 47 10 RTSP. ./. .W...e..b..S...o..c.k..e..t. .f.o..r. .i.O...S.. .S..a..f.a..r..i...... 47 Deployment ...... 48 Call Flow ...... 48 Quick Start ...... 49 Configuring ...... 50 Usage ...... 50 11 SIP / .R..T..M...P...... 60 Deployment ...... 60 Call Flow ...... 61 Configuring ...... 61 Quick Start ...... 62 Usage ...... 65 Call manag.e..m...e..n..t...... 65 SDP attribu..t.e..s.. .r.e..c..v..o..n..l.y.. .a..n..d.. .s..e..n..d..r.e..c..v...... 69 Supported. .c..o..d..e..c..s...... 71 HTTPS ...... 72 0

© 2015 Flashphoner, LLC

3 Part I Introduction 5

1 Introduction

The document describes main features of the product and examples of its usage. For the moment of writing this guide the product has two major features sets:

Browser - SIP calls

It is all linked with calls between browsers and integration with SIP networks

Streaming

The functions related to video capturing from vary video sources and delivery of video streams to web browsers and other devices

Therefore the document contains four parts:

1. Available features and capabilities 2. SIP and Browser calls 3. Streaming 4. Integration capabilities

© 2015 Flashphoner, LLC Part II Features and Capabilities 7

2 Features and Capabilities

SIP

There are three possible parties of a call (audio or video call): WebRTC Flash SIP

The WebRTC and Flash are used in browsers. Supported browsers are listed in the table below:

Table 1 - Supported browsers for Flash and WebRTC

Microsoft Chrome Firefox IE Safari (Mac) Edge (Win10)

WebRTC Yes Yes No No No

Flash Yes Yes Yes Yes Yes

Therefore we have five possible configurations for calls:

WebRTC - WebRTC WebRTC - SIP WebRTC - Flash Flash - SIP Flash - Flash

In this case SIP is a server, softphone or another device supporting SIP protocol and accompanying specifications: RTP, SDP, etc.

Besides this, there are a set of specific for SIP supplementary features:

DTMF HOLD Transfer Call recording

Streaming

SIP represents two-way conversation where two parties are equitable participants. But for streaming we always have a video source (capture from video surveillance system, browser or a third party video server), and a video receiver (browser or another device or software displaying the video stream).

Web Call Server supports following sources and receivers of video stream:

Sources WebRTC Flash RTSP SIP

© 2015 Flashphoner, LLC 8 Web Call Server 4 - User Guide Features and Capabilities 8

Receivers WebRTC Flash RTSP Websockets iOS Safari RTMP

In addition to already described technology WebRTC and Flash here we use following technology and protocols:

RTSP The protocol used in IP cams, video surveillance systems and other software and hardware devices can deliver streaming video to connected clients.

Websocket iOS Safari The protocol of delivering streaming video with playback directly in HTML-page in the iOS Safari browser. The function can be used also in Chrome and Firefox browsers, but its general purpose is iOS Safari browser, because for now, it is only technology which allows to play streaming video in the body of HTML page with minimal latency.

SIP The protocol in this context is being considered as a source of streaming video. WCS can connect to the SIP source and forward received video to any server or CDN using RTMP protocol

RTMP The protocol currently used for forwarding video received from a SIP source

The Final Specification

SIP

Calls WebRTC - WebRTC Yes WebRTC - Flash Yes WebRTC - SIP Yes Flash - Flash Yes Flash - SIP Yes Messaging Websocket - Websocket Websocket - SIP (SMS) Supplementary Functions DTMF Hold Transfer

© 2015 Flashphoner, LLC Features and Capabilities 9

Call Recording

Streaming

WebRTC RTMFP RTSP Websocket RTMP

WebRTC • Yes Yes Yes Yes ?

RTMFP Yes Yes Yes Yes ?

RTSP Yes ? ? ? ?

SIP ? ? ? ? Yes

Codecs

Audio Video

G.711 Opus Speex G.722 G.729 AAC H.263 H.264 VP8 MPEG

WebR Yes Yes ? Yes Yes TC

RTMF Yes Yes ? Yes P

RTSP Yes ? ? ? ? Yes ? Yes ? ? IN

RTSP Yes ? ? ? ? ? ? Yes ? ? OUT

Webso Yes Yes cket

RTMP Yes Yes ? ? Yes

SIP Yes Yes Yes ? Yes ? ? Yes Yes

SIP - Yes ? Yes ? ? ? ? Yes ? ? RTMP

Designation

Yes - Ready to use ? - The function is not currently implemented or not tested. The function can be added as a pre- ordering feature. • - Audio and Video recording available for this feature. Grey - The codec is unavailable for this technology.

© 2015 Flashphoner, LLC Part III Browser and SIP calls 11

3 Browser and SIP calls

3.1 WebRTC - WebRTC

3.1.1 Deployment

Deployments

1. SIP server as a signaling and RTP media proxy server 2. SIP server as a signaling server only 3. No external SIP server. SIP and RTP media is done on WCS

Participants

WebRTC Browser WCS SIP Server

Protocols / technology

WebRTC Websocket SIP RTP

© 2015 Flashphoner, LLC 12 Web Call Server 4 - User Guide Browser and SIP calls 12

3.1.2 Call Flow

The call flow describes WebRTC connection between two browsers via SIP server. Red and blue arrows is media traffic. Other is signaling.

© 2015 Flashphoner, LLC Browser and SIP calls 13

3.1.3 Quick Start

WebRTC - WebRTC Video Call in 5 Steps

1. Open two web phone pages in the Chrome browser and click 'Log in'. 2. Enter SIP credentials and press 'log in' . 3. Enter callee number and press 'Video Call'. 4. Allow microphone and camera for caller, then click 'Answer with Video' on callee, then allow mic and cam for callee. 5. Two-way WebRTC video call is established.

© 2015 Flashphoner, LLC 14 Web Call Server 4 - User Guide Browser and SIP calls 14

Click image to open in a web-browser 3.2 WebRTC - SIP

3.2.1 Deployment

Deployments

1. SIP server as a signaling and RTP media proxy server 2. SIP server as a signaling server only

Participants

WebRTC Browser WCS SIP Server SIP Endpoint

Protocols / technology

WebRTC Websocket SIP RTP

© 2015 Flashphoner, LLC Browser and SIP calls 15

3.2.2 Call Flow

The call flow describes WebRTC connection between a web browser and SIP Endpoint. Red and blue arrows is media traffic. Other is signaling.

3.2.3 Quick Start

WebRTC - SIP Video Call in 4 Steps

1. Prepare a SIP softphone and make sure compatible codecs are enabled. 2. Open web-phone, log-in, enter callee ID, press 'Video Call' and allow cam and mic. 3. WebRTC - SIP call is in progress. Click answer button to pick up the phone. 4. Two-way WebRTC-SIP video call is established.

© 2015 Flashphoner, LLC 16 Web Call Server 4 - User Guide Browser and SIP calls 16

Click to open in a web-browser 3.3 WebRTC - Flash

3.3.1 Deployment

Deployments

1. SIP server as a signaling and RTP media proxy server 2. SIP server as a signaling server only 3. No external SIP server. SIP and RTP media is done on WCS.

Participants

WebRTC Browser Flash Browser (IE, Microsoft Edge, Safari) WCS SIP Server

Protocols / technology

WebRTC RTMFP Websocket SIP RTP

© 2015 Flashphoner, LLC Browser and SIP calls 17

3.3.2 Call Flow

Enter topic text here. 3.3.3 Quick Start

WebRTC - Call in 3 Steps

1. Open Chrome and IE browsers and log-in. 2. Enter callee ID in Chrome and press 'Video Call', then allow mic and cam, then allow mic and cam for IE.

© 2015 Flashphoner, LLC 18 Web Call Server 4 - User Guide Browser and SIP calls 18

3. WebRTC - Flash call is established.

Click image to open in a browser 3.4 Flash - Flash

3.4.1 Deployment

Deployments

1. SIP server as a signaling and RTP media proxy server 2. SIP server as a signaling server only 3. No external SIP server. SIP and RTP media is done on WCS

Participants

Flash Browser WCS SIP Server

Protocols / technology

RTMFP Websocket SIP RTP

© 2015 Flashphoner, LLC Browser and SIP calls 19

3.4.2 Call Flow

Enter topic text here. 3.4.3 Quick Start

Flash - Flash Video Call in 4 Steps

1. Open two IE browsers and setup SIP credentials, then press 'log-in'. 2. Enter callee ID in Chrome and press 'Video Call', then allow mic and cam for IE. 3. Pick up the phone on callee, then allow mic and cam for callee. 4. Flash - Flash call is established.

© 2015 Flashphoner, LLC 20 Web Call Server 4 - User Guide Browser and SIP calls 20

Click to open in a web-browser 3.5 Flash - SIP

Enter topic text here. 3.5.1 Deployment

Deployments

1. SIP server as a signaling and RTP media proxy server 2. SIP server as a signaling server only

Participants

WebRTC Browser WCS SIP Server SIP Endpoint

Protocols / technology

WebRTC Websocket SIP RTP

© 2015 Flashphoner, LLC Browser and SIP calls 21

3.5.2 Call Flow

Enter topic text here. 3.5.3 Quick Start

Flash - SIP Video Call in 4 Steps

1. Open IE and Softphone. Log-in using SIP accounts. 2. Enter callee ID in IE and press 'Video Call', then allow mic and cam for IE. 3. Pick up the Softphone. 4. Flash - SIP call is established.

Click to open in a web-browser

© 2015 Flashphoner, LLC Part IV Streaming 23

4 Streaming

4.1 WebRTC / WebRTC

One of the main functions of WCS is the operation for web browser in Streaming Video Server mode. WCS JavaScript API has functions publishStream and playStream. They are used to transmit any quantity of video streams to server and for playback of any quantity of video streams from server.

WCS JavaScript API supports simultaneous transmission and playback of several streams from one web-page. It enables implementation of different scenarios of video streams exchange, such as video chat, video conference, webinar, live-video, online-couching and others, where implementation of video playback between browsers is required. 4.1.1 Deployment

1. 'Browser' is a web browser supporting WebRTC, e.g. Chrome 2. 'WCS' is Web Call Server 4 4.1.2 Call Flow

© 2015 Flashphoner, LLC 24 Web Call Server 4 - User Guide Streaming 24

This Call Flow illustrates signaling (black lines) and streaming (red lines) communication paths in case of stream publishing / playing. 4.1.3 Configuring

No changes to WCS default configuration settings are required for the functionality. 4.1.4 Quick Start

WebRTC as WebRTC Playback in 4 Steps

1. Open WebRTC Streaming client in Chrome and wait till it connects to WCS 2. Start stream publishing 3. Allow Chrome access to camera and microphone 4. Copy the stream sharing link and open it in another Chrome window to play the stream

Click to open in a web-browser

4.1.4.1 Publish a stream

1. Start stream publishing a) Open the Streaming.html page in web browser Browser has established connection with WCS and is ready to send a stream

© 2015 Flashphoner, LLC Streaming 25

b) Click 'Start'

© 2015 Flashphoner, LLC 26 Web Call Server 4 - User Guide Streaming 26

2. Allow access to camera and microphone Browser requests access to microphone and camera in order to have ability to publish video stream

© 2015 Flashphoner, LLC Streaming 27

3. Stream is being published The stream is sent to the server. The image from the camera is displayed in the video frame.

The link displayed at the bottom of the frame can be copied and opened to play the stream. To stop sending the stream to the server, click the red square 'Stop' button.

© 2015 Flashphoner, LLC 28 Web Call Server 4 - User Guide Streaming 28

4.1.4.2 Play a stream

1. Connect to a stream Go to the link provided by the user publishing the stream to connect to the stream. Waiting for connection

© 2015 Flashphoner, LLC Streaming 29

2. Stream playback The video stream is being played

To stop the stream playback, click the red square 'Stop' button.

© 2015 Flashphoner, LLC 30 Web Call Server 4 - User Guide Streaming 30

4.2 WebRTC / RTMFP

4.2.1 Deployment

1. 'WebRTC Browser' is a web browser supporting WebRTC, e.g. Chrome 2. 'WCS' is Web Call Server 4 3. 'Flash Browser' is a web browser with Flash support, e.g. IE with Player 4.2.2 Call Flow

This Call Flow illustrates signaling (black lines) and streaming (red lines) communication paths. 4.2.3 Quick Start

WebRTC as RTMFP Playback in 2 Steps

1. Log in Flash client in IE and WebRTC client in Chrome 2. Start stream publishing in Chrome and play the stream in IE

© 2015 Flashphoner, LLC Streaming 31

Click to open in a web-browser 4.3 WebRTC / RTSP

WCS4 can operate as RTSP streaming server.

4.3.1 Deployment

1. 'Browser' is a web browser supporting WebRTC, e.g. Chrome 2. 'WCS' is Web Call Server 4 3. 'Media Player' is a player for RTSP/RTP stream playback, e.g. VLC media player

© 2015 Flashphoner, LLC 32 Web Call Server 4 - User Guide Streaming 32

4.3.2 Call Flow

This Call Flow illustrates signaling (black lines) and streaming (red lines) communication paths. 4.3.3 Configuring

To enable the functionality, the following setting should be added to WCS_HOME/conf/ server.properties rtsp_server_enabled = true 4.3.4 Quick Start

WebRTC as RTSP Playback in 5 Steps

1. Open WebRTC Streaming client in Chrome and wait till it connects to WCS 2. Start stream publishing 3. Allow Chrome access to camera and microphone 4. Open the network stream in VLC media player 5. Play the stream in VLC

© 2015 Flashphoner, LLC Streaming 33

Click to open in a web-browser

4.3.4.1 Stream playback with VLC player

Configure VLC media player for RTSP/RTP playback - Go to Tools | Preferences | 'Input / Codecs' - In the Network area, set the 'Live555 stream transport' option to 'RTP over RTSP (TCP)' and save the settings

© 2015 Flashphoner, LLC 34 Web Call Server 4 - User Guide Streaming 34

Playback a stream 1. Start video streaming using examples/streaming/Streaming.html 2. Copy the stream ID and open the stream in VLC player (Media | 'Open Network Stream') using similar RTSP URL rtsp://-as-rtsp.flashphoner.com/streamID (here webrtc-as-rtsp.flashphoner.com is the address of the WCS server) For example:

3. Click [Play]

© 2015 Flashphoner, LLC Streaming 35

4.3.4.2 Stream playback with Wowza Flash RTMP player

1. Start video streaming using examples/streaming/Streaming.html 2. Open Wowza Streaming Engine Manager 3. Go to Server | 'Stream Files' 4. Add a stream file linked to RTSP url (e.g. rtsp://webrtc-as-rtsp.flashphoner.com/streamID, where webrtc-as-rtsp.flashphoner.com is the address of the WCS server) For example:

5. Connect this stream file

© 2015 Flashphoner, LLC 36 Web Call Server 4 - User Guide Streaming 36

6. Open this stream in Wowza default Flash player

Here - Server: rtmp://rtmp.flashphoner.com/live, where rtmp.flashphoner.com is the address of the Wowza server - Stream: newStream.stream - the stream file linked with the RTSP stream 7. Click [Start] to play the stream 4.4 WebRTC / WebSocket iOS Safari

WebRTC stream published using WCS4 can be played on an iOS device in Safari browser.

© 2015 Flashphoner, LLC Streaming 37

4.4.1 Deployment

1. 'Browser' is a web browser supporting WebRTC, e.g. Chrome 2. 'WCS' is Web Call Server 4 3. 'iOS Safari' is the Safari browser on iOS device 4.4.2 Call Flow

This Call Flow illustrates signaling (black lines) and streaming (red lines) communication paths. 4.4.3 Configuring

No changes to WCS default configuration settings are required for the functionality. 4.4.4 Quick Start

For video streaming the same web-interface as in case of WebRTC as WebRTC is used: examples/ streaming/Streaming.html

© 2015 Flashphoner, LLC 38 Web Call Server 4 - User Guide Streaming 38

The following example describes how WebRTC stream can be played in iOS Safari browser.

1. VoW Player setup a) Edit examples/min/vow-player-min.js Specify the URL for connection to WCS server via Websocket var url = "ws://webrtc_for_safari.flashphoner.com:8080"; Here webrtc_for_safari.flashphoner.com is the address of the WCS server.

Specify the stream name, for example var streamName = "vmUWfXP0rTph1wtFZp8BYrR6W04LXS"; Here vmUWfXP0rTph1wtFZp8BYrR6W04LXS is the WebRTC stream ID of the stream (from the stream sharing link provided by the user publishing the stream).

b) Change resolution in examples/flashphoner.xml Change video_width and video_height from the default values to 320x240 320 240

3. Stream playback in Safari with VoW Player Open VoW Player page in Safari browser on iOS device using similar URL http://webrtc_for_safari.flashphoner.com/examples/min/vow-player-min.html Connection with WSC should be established: 'CONNECTED' will be displayed in the status area.

Click the [Play] button to start the stream playback. Playback can be paused and resumed using the [Pause]/[Resume] button. 4.5 RTMFP / WebRTC

4.5.1 Deployment

1. 'Flash Browser' is a web browser with Flash support, e.g. Internet Explorer with 2. 'WCS' is Web Call Server 4 3. 'WebRTC Browser' is a web browser supporting WebRTC, e.g. Chrome

© 2015 Flashphoner, LLC Streaming 39

4.5.2 Call Flow

This Call Flow illustrates signaling (black lines) and streaming (red lines) communication paths. 4.5.3 Quick Start

RTMFP as WebRTC Playback in 2 Steps

1. Login Flash client in IE and WebRTC client in Chrome. 2. Start stream publishing in IE and play the stream in Chrome.

Click to open in a web-browser 4.6 RTMFP / RTMFP

© 2015 Flashphoner, LLC 40 Web Call Server 4 - User Guide Streaming 40

4.6.1 Deployment

1. 'Browser' is a web browser with Flash support, e.g. Internet Explorer with Adobe Flash Player 2. 'WCS' is Web Call Server 4 4.6.2 Call Flow

This Call Flow illustrates signaling (black lines) and streaming (red lines) communication paths in case of stream publishing / playing. 4.6.3 Quick Start

RTMFP as RTMFP Playback in 2 Steps

1. Log in two Flash clients in IE 2. Start stream publishing in one IE client and play the stream in the other IE client

© 2015 Flashphoner, LLC Streaming 41

Click to open in a web-browser 4.7 RTMFP / RTSP

4.7.1 Deployment

1. 'Browser' is a web browser with Flash support, e.g. Internet Explorer with Adobe Flash Player 2. 'WCS' is Web Call Server 4 3. 'Media Player' is a player for RTSP/RTP stream playback, e.g. VLC media player 4.7.2 Call Flow

This Call Flow illustrates signaling (black lines) and streaming (red lines) communication paths. 4.7.3 Quick Start

RTMFP as RTSP Playback in 4 Steps

1. Log in Flash client in IE 2. Start stream publishing in IE 3. Open the network stream in VLC media player 4. Play the stream in VLC

© 2015 Flashphoner, LLC 42 Web Call Server 4 - User Guide Streaming 42

Click to open in a web-browser 4.8 RTMFP / Websocket iOS Safari

Enter topic text here. 4.8.1 Deployment

1. 'Browser' is a web browser with Flash support, e.g. Internet Explorer with Adobe Flash Player 2. 'WCS' is Web Call Server 4 3. 'iOS Safari' is the Safari browser on iOS device

© 2015 Flashphoner, LLC Streaming 43

4.8.2 Call Flow

This Call Flow illustrates signaling (black lines) and streaming (red lines) communication paths. 4.8.3 Quick Start

RTMFP as WebSocket binary stream for iOS Safari in 3 Steps

1. Log in Flash client in IE 2. Start stream publishing in IE 3. Open vow-player-min.html page in Chrome or iOS Safari and play the RTMFP stream as WebSocket binary stream

Click to open in a web-browser

© 2015 Flashphoner, LLC 44 Web Call Server 4 - User Guide Streaming 44

4.9 RTSP / WebRTC

RTSP-WebRTC broadcasting scheme WCS4 can grab video from IP-cameras and other devices using RTSP Protocol and send this video to browser using WebRTC technology.

For more info about RTSP Protocol support and codecs, that can be used for video playback from IP- cameras, please refer to Web Call Server 4 - Specification document. For video playback from IP-cameras the same web-interface as in example WebRTC as WebRTC is used: examples/streaming/Streaming.html

In order to play a video stream, you need to designate as a parameter in the browser RTSP URL of IP- camera.

Example of RTSP-stream playback in WebRTC-browser http://192.168.1.5/Streaming.html?id=rtsp://mystream.com:1935/live/sys3.stream

In this example rtsp://mystream.com:1935/live/sys3.stream is a stream address, which IP-camera will use for a video transmission. At first check the address of your camera in VLC Player, QuickTime or another player, which can playback RTSP. If it works with these desktop players, then it should work with your WCS.

© 2015 Flashphoner, LLC Streaming 45

Here is a screenshot of a stream playback by browser using WebRTC technology.

Besides IP cameras, any RTSP-server can be used as a stream source. WCS can connect to an RTSP- server and distribute a received stream over WebRTC in the same way as with IP camera, which appears in fact as a mini RTSP-server, having its own IP address in the network and operating system.

Interleave mode WCS-server supports RTSP interleave mode. It means, that if for some reason there is no RTP-traffic from IP-camera or RTSP-server (e.g. UDP-traffic is blocked in firewall), then WCS will try to capture video stream using existing established RTSP-connection between WCS and IP-camera (or RTSP-server). In this case video traffic will be transmitted over RTSP/TCP connection and UDP-protocol will not be used. Switching to interleave mode is triggered after timeout (60 seconds by default), which can be specified by rtsp_activity_timer_timeout setting in flashphoner.properties.

© 2015 Flashphoner, LLC 46 Web Call Server 4 - User Guide Streaming 46

4.9.1 Deployment

Deployment 1: Stream from Live Encoder

1. 'Live Encoder' is a software solution for video encoding and broadcasting 2. 'RTMP CDN' is an RTMP server supporting RTMP audio+video streams with H.264 + AAC codecs 3. 'WCS' is Web Call Server 4 4. 'Browser' is a web browser supporting WebRTC, e.g. Chrome

Deployment 2: Stream from IP camera

1. 'IP camera' is an IP camera streaming video via RTSP 2. 'WCS' is Web Call Server 4 3. 'Browser' is a web browser supporting WebRTC, e.g. Chrome 4.9.2 Call Flow

These Call Flows illustrate signaling (black lines) and streaming (red lines) communication paths.

Stream from Live Encoder

Stream from IP camera

© 2015 Flashphoner, LLC Streaming 47

4.9.3 Quick Start

RTSP to WebRTC streaming in 4 Steps

1. Open Wirecast and click 'Add shot' to select an MP4 file in H.264+AAC codecs. 2. Start playback. 3. Setup RTMP encoding and publishing settings. 4. Publish stream. 5. Open the Streaming.html page in Chrome browser and play the RTSP stream as WebRTC.

Click to open in a web-browser 4.10 RTSP / WebSocket for iOS Safari

WCS4 can be used to play an RTSP stream from an RTMP server on an iOS device in Safari browser.

© 2015 Flashphoner, LLC 48 Web Call Server 4 - User Guide Streaming 48

4.10.1 Deployment

Deployment 1: Stream from Live Encoder

1. 'Live Encoder' is a software solution for video encoding and broadcasting 2. 'RTMP CDN' is an RTMP server supporting RTMP audio+video streams with H.264 + AAC codecs 3. 'WCS' is Web Call Server 4 4. 'iOS Safari' is the Safari browser on iOS device

Deployment 2: Stream from IP camera

1. 'IP camera' is an IP camera streaming video via RTSP 2. 'WCS' is Web Call Server 4 3. 'iOS Safari' is the Safari browser on iOS device 4.10.2 Call Flow

These Call Flows illustrate signaling (black lines) and streaming (red lines) communication paths.

Stream from Live Encoder

Stream from IP camera

© 2015 Flashphoner, LLC Streaming 49

4.10.3 Quick Start

RTSP as Websocket binary stream for iOS Safari in 4 Steps

1. Open Wirecast and press 'Add shot' to select an MP4 file in H.264 + AAC codecs 2. Start playback. 3. Setup RTMP encoding and publishing settings. 4. Publish stream. 5. Open vow-player-min.html page in Chrome or iOS Safari and play the RTSP stream as Websocket binary stream.

Click to open in a web-browser

© 2015 Flashphoner, LLC 50 Web Call Server 4 - User Guide Streaming 50

4.10.4 Configuring

Server-side configuration Add the following settings to WCS_HOME/conf/flashphoner.properties for supported codecs, including mpeg4-generic (AAC), and video rescaling. Video rescaling will be used if resolution requested by client is different from the stream resolution; in that case, video will be converted to the required resolution.

codecs=opus,alaw,ulaw,g729,speex16,g722,mpeg4-generic,telephone- event,vp8,h264,flv,h263,h263p,mpv rtsp_interleaved_mode=true rtsp_interleaved_enable_rtcp=true force_client_requested_video_resolution=true resample_video=true

Server-side application 'defaultApp' The default notification URL for 'defaultApp' can be changed via WCS CLI. (See Admin Guide for more information on the Command Line Interface.) For example, it can be a custom URL for streams authorization allowing to prohibit playback of a stream. 4.10.5 Usage

Below is the example of using WCS to play a video stream in iOS Safari browser, where - Wirecast is used for video encoding and broadcasting, and - Wowza Streaming Engine is used as the RTMP server A file saved to the computer on which Wirecast is installed is used as the video source.

1. Wowza setup a) Install Wowza Streaming Engine or use an existing installation b) Open Wowza Streaming Engine Manager (available on port 8088) c) Allow RTMP publishing Go to Applications | live | 'Incoming Security', select e.g. 'Open (no authentication required)' and save the settings

© 2015 Flashphoner, LLC Streaming 51

© 2015 Flashphoner, LLC 52 Web Call Server 4 - User Guide Streaming 52

2. Wirecast setup a) Install Wirecast b) Add video file Click 'Add Video Shot' to select a video file saved to the computer

© 2015 Flashphoner, LLC Streaming 53

c) Start the file playback Click the arrow button (see the screenshot below) to start playback

© 2015 Flashphoner, LLC 54 Web Call Server 4 - User Guide Streaming 54

d) Configure 'Output Settings' Go to Output | 'Output Settings'

Select 'RTMP Server' as the Output Destination and click [OK].

© 2015 Flashphoner, LLC Streaming 55

Click the gear icon and select 'New Preset' (see the screenshot below)

© 2015 Flashphoner, LLC 56 Web Call Server 4 - User Guide Streaming 56

Configure the encoding settings for mobile devices H.264 + AAC, set the resolution to 320x240

Save the encoding preset.

© 2015 Flashphoner, LLC Streaming 57

In 'Output Settings', specify the RTMP server address and the stream name

Here - the server address is rtmp://rtmp.flashphoner.com/live, where rtmp.flashphoner.com is the address of the Wowza server - the stream name is myStream

© 2015 Flashphoner, LLC 58 Web Call Server 4 - User Guide Streaming 58

e) Start broadcasting the stream Click the [Stream] button to start sending the RTMP stream to the server. The color of the 'Connection' indicator in the upper right corner will change to green

© 2015 Flashphoner, LLC Streaming 59

3. VoW Player setup a) Edit examples/min/vow-player-min.js Specify the URL for connection to WCS server via Websocket var url = "ws://rtsp_for_safari.flashphoner.com:8080"; Here rtsp_for_safari.flashphoner.com is the address of the WCS server.

Specify the stream name var streamName = "rtsp://rtmp.flashphoner.com:1935/live/myStream"; Here - rtmp.flashphoner.com is the address of the Wowza server - myStream is the name of the stream (as in Wirecast 'Output Settings')

b) Change resolution in examples/flashphoner.xml Change video_width and video_height from the default values to 320x240 320 240

3. Stream playback in Safari with VoW Player Open VoW Player page in Safari browser on iOS device using similar URL http://rtsp_for_safari.flashphoner.com/examples/min/vow-player-min.html Connection with WSC should be established: 'CONNECTED' will be displayed in the status area.

Click the [Play] button to start the stream playback. Playback can be paused and resumed using the [Pause]/[Resume] button.

© 2015 Flashphoner, LLC 60 Web Call Server 4 - User Guide Streaming 60

4.11 SIP / RTMP

WCS allows to stream media received from a SIP endpoint to an RTMP receiver. As a result, video stream can be played in, for example, RTMP Player window. Below are described the feature usage scenario, deployment and call flow.

Scenario 1. Call session with video is established with a SIP endpoint 2. Audio and video traffic is received from the SIP endpoint 3. The received audio and video traffic is forwarded to an RTMP CDN

Here - SIP endpoint is a SIP MCU, conference or a SIP softphone, and - RTMP CDN is an RTMP server or another RTMP receiver 4.11.1 Deployment

1. 'REST Client' is a software solution, script or UI working through REST/HTTP/HTTPS 2. 'SIP Endpoint' is a device or endpoint supporting rfc3261(SIP), RTP and H.264 video codec + G.711(allaw, ulaw) or Speex 16 kHz audio codecs 3. 'WCS' is Web Call Server 4 4. 'RTMP CDN' is an RTMP server supporting RTMP audio+video streams with H.264 + G.711 or Speex 16kHz codecs

© 2015 Flashphoner, LLC Streaming 61

4.11.2 Call Flow

This Call Flow illustrates signaling (black lines) and streaming (red lines) communication paths.

4.11.3 Configuring

Server-side codecs configuration Codecs are configured in WCS_HOME/conf/flashphoner.properties. By default, full codec list is used. For 'SIP as RTMP', add the following setting to use only the specified SIP codecs: codecs = alaw,ulaw,speex16,h264

By default, SIP negotiated codec is used for RTMP. To use a specific codec even if SIP endpoint does not support that codec, add the following setting force_rtmp_audio_codec =

Server-side launch configuration By default, WCS server is lauched in dev mode. To run the server with production profile, uncomment the following line in WCS_HOME/bin/setenv.sh WCS_MANAGER_OPTS="-Dspring.profiles.active=production" In production mode, HTTPS support for REST requests is enabled.

Server-side application for internal notifications 'callApp' http://localhost:9091/CallApp is the default notification URL for 'callApp' which will receive all intermediary statuses of a call (RING, TRYING, etc) and intermediary statuses of RTMP stream associated with the call (RTMP_STREAM_WAIT, RTMP_STREAM_ACTIVE, RTMP_CONNECTION_LOST, RTMP_CONNECTION_FAILED). The default notification URL can be changed via WCS CLI. See Admin Guide for more information on the Command Line Interface.

© 2015 Flashphoner, LLC 62 Web Call Server 4 - User Guide Streaming 62

4.11.4 Quick Start

Using the functionality would require placing REST calls to a SIP endpoint, for which a REST Client would be necessary. Also, an RTMP server should be available. For example, Wowza Streaming Engine and its Flash RTMP player can be used.

Below is the example of using REST Console extension for Chrome Browser to initiate a REST call and start a video stream.

1. Install REST Console a) Visit Chrome store and install REST Console extension for Chrome Browser. b) Open REST Console in chrome://extensions

2. In REST Console, fill out the following three fields of the form a) Target / Target / Request URI http://sip-as-rtmp.flashphoner.com:9091/RESTCall/call Here sip-as-rtmp.flashphoner.com is the address of the WCS server.

b) Body / Content Headers / Content-Type application/json

c) Body / Request Payload / RAW Body { "callId":"Xq2tlLcX89tTjaji", "callee":"10001", "rtmpUrl":"rtmp://rtmp-server.flashphoner.com:1935/live", "rtmpStream":"streamName2", "hasAudio":"true", "hasVideo":"true", "connection":{ "sipLogin":"10008", "sipPassword":"1234", "sipAuthenticationName":"10008", "sipDomain":"sip-server.flashphoner.com", "sipPort":"5080", "sipRegisterRequired":"false", "appKey":"callApp" } } Here rtmp-server.flashphoner.com is the address of the RTMP server.

Make sure to specify valid RTMP URL and SIP credentials. See Call management section to get more information.

© 2015 Flashphoner, LLC Streaming 63

REST Console example:

3. Click 'POST' button to send HTTP / REST / POST request to WCS server Check WCS logs to be sure that the SIP call has been initiated and established tail -f /usr/local/FlashphonerWebCallServer/logs/server_logs/flashphoner.log tail -f /usr/local/FlashphonerWebCallServer/logs/flashphoner_manager.log

© 2015 Flashphoner, LLC 64 Web Call Server 4 - User Guide Streaming 64

4. Open the RTMP URL in your test RTMP player and playback the stream Example with Wowza default Flash player:

Here - Server: rtmpUrl: rtmp://rtmp.flashphoner.com/live - Stream: rtmpStream: streamName2

Click [Start]/[Stop] to play the stream, or stop the playback.

© 2015 Flashphoner, LLC Streaming 65

4.11.5 Usage

The following sections provide additional information required for the usage of the functionality.

4.11.5.1 Call management

General rules 1. Each SIP call can have only one RTMP stream. In case of a new SIP call with the same RTMP URL (rtmpUrl + rtmpStream) as for an existing stream, the second call will be rejected with 409 Conflict HTTP status. 2. SIP call ID must be unique. Attempt of initiating a new SIP call with an existing call ID will be rejected by WCS server with 409 Conflict status.

REST request must be HTTP/HTTPS POST request in the following format - HTTP: http://sip-as-rtmp.flashphoner.com:9091/RESTCall/call - HTTPS: http://sip-as-rtmp.flashphoner.com:8888/RESTCall/call

Here - sip-as-rtmp.flashphoner.com is the address of the WCS server - 9091 is the default HTTP port - 8888 is the default HTTPS port - RESTCall is mandatory part of the URL - call is the used REST method (other methods are hangup, getStatus and getCalls)

REST methods and returned statuses

REST Request Body Example Response Body Response method Example Statuses call { {} 200 - Call "callId":"Xq2tlLcX89tTjaji", Accepted "callee":"10001", 409 - RTMP URL "rtmpUrl": "rtmp://rtmp- Conflict server.flashphoner.com:1935/live", "rtmpStream":"streamName2", "hasAudio":"true", "hasVideo":"true", "connection":{ "sipLogin":"10008", "sipPassword":"1234", "sipAuthenticationName":"10008 ", "sipDomain": "sip-server.flashphoner.com", "sipPort":"5080", "sipRegisterRequired":"false", "appKey":"callApp" } }

hangup { "callId":"Xq2tlLcX89tTjaji" } {} 200 - Call Termination Accepted 404 - NOT

© 2015 Flashphoner, LLC 66 Web Call Server 4 - User Guide Streaming 66

FOUND getStatus { "callId":"Xq2tlLcX89tTjaji" } {} 200 - Call ESTABLISHED 404 - NO SUCH CALL getCalls {} [{ 200 - Calls list is "custom": {}, not empty "nodeId": 404 - NO CALLS null, "appKey": FOUND null, "sessionId": null, "callId": "Xq2tlLcX89tTjaji" , "parentCallId" : null, "incoming": false, "status": "ESTABLISHED", "sipStatus": 200, "rtmpUrl": "rtmp:// rtmp.flashphoner.c om:1935/live", "rtmpStream": "streamName2", "rtmpStreamSta tus": "RTMP_STREAM_ACTIV E", "caller": "10008", "callee": "10001", "hasAudio": true, "hasVideo": true, "sdp": null, "visibleName": "10008", "inviteParamet ers": null, "mediaProvider ": "Flash", "sipMessageRaw ": null, "isMsrp": false, "target": null }]

© 2015 Flashphoner, LLC Streaming 67

Fields

Field Name Description Example callId SIP call ID - unique string Xq2tlLcX89tTjaji identifier callee SIP callee 10001 rtmpUrl RTMP URL rtmp://rtmp-server.flashphoner.com:1935/live

Here live is RTMP application name. RTMP URL may also have instance name and query string, i.e. rtmp://rtmp-server.flashphoner.com:1935/live/ _definst_?param1=value1¶m2=value2

rtmpStream Name of RTMP stream streamName2 hasAudio If true, audio section of SDP true will have 'sendrecv' attribute, otherwise 'readonly' hasVideo If true, video section of SDP true will have 'sendrecv' attribute, otherwise 'readonly' connection JSON object containing SIP { credentials "sipLogin":"10008", "sipPassword":"1234", "sipAuthenticationName":"10008", See detailed description of "sipDomain":"sip- the connection object server.flashphoner.com", "sipPort":"5080", "sipRegisterRequired":"false", "appKey":"callApp" }

status WCS call status ESTABLISHED

Full list of WCS call statuses can be found in the Call Flow docs (method CallStatusEvent). sipStatus Associated SIP response 200 code rtmpStreamS Status of RTMP stream RTMP_STREAM_ACTIVE tatus RTMP_STREAM_WAIT - RTMP stream is initializing RTMP_STREAM_ACTIVE - RTMP stream is connected and established RTMP_CONNECTION_LOST - RTMP connection has been lost during streaming RTMP_CONNECTION_FAILED - RTMP connection has not been established caller SIP username of the call initiator

© 2015 Flashphoner, LLC 68 Web Call Server 4 - User Guide Streaming 68

visibleName Caller's SIP visible name mediaProvid NOT USED NOT USED er

Additional status information WCS uses internal server-side application 'callApp' for additional status notifications.

Examples - TRYING, RTMP_STREAM_WAIT { "nodeId" : "[email protected]", "appKey" : "callApp", "sessionId" : "127.0.0.1:1403649870519623722", "callId" : "Xq2tlLcX89tTjaji_3", "incoming" : false, "status" : "TRYING", "sipStatus" : 100, "rtmpUrl" : "rtmp://rtmp.flashphoner.com:1935/live", "rtmpStream" : "streamName2", "rtmpStreamStatus" : "RTMP_STREAM_WAIT", "caller" : "3000", "callee" : "3002", "hasAudio" : true, "hasVideo" : true, "visibleName" : "3000", "mediaProvider" : "Flash", "isMsrp" : false } - ESTABLISHED, RTMP_STREAM_ACTIVE { "nodeId" : "[email protected]", "appKey" : "callApp", "sessionId" : "127.0.0.1:1403649870519623722", "callId" : "Xq2tlLcX89tTjaji_3", "incoming" : false, "status" : "ESTABLISHED", "sipStatus" : 200, "rtmpUrl" : "rtmp.flashphoner.com:1935/live", "rtmpStream" : "streamName2", "rtmpStreamStatus" : "RTMP_STREAM_ACTIVE", "caller" : "3000", "callee" : "3002", "hasAudio" : true, "hasVideo" : true, "visibleName" : "3000", "mediaProvider" : "Flash", "isMsrp" : false }

© 2015 Flashphoner, LLC Streaming 69

- ESTABLISHED, RTMP_CONNECTION_LOST { "nodeId" : "[email protected]", "appKey" : "callApp", "sessionId" : "127.0.0.1:1403649870519623722", "callId" : "Xq2tlLcX89tTjaji_3", "incoming" : false, "status" : "ESTABLISHED", "sipStatus" : 200, "rtmpUrl" : "rtmp.flashphoner.com:1935/live", "rtmpStream" : "streamName2", "rtmpStreamStatus" : "RTMP_CONNECTION_LOST", "caller" : "3000", "callee" : "3002", "hasAudio" : true, "hasVideo" : true, "visibleName" : "3000", "mediaProvider" : "Flash", "isMsrp" : false }

These notifications are done internally at server-side through internal REST invocations. See Admin Guide 'Command Line Interface' | 'Application management' and Call Flow documentation to learn more about internal REST apps. Also, a custom web application which will receive the notifications from WCS can be created.

4.11.5.2 SDP attributes recvonly and sendrecv

There are two general modes of REST calls 1. sendrecv hasAudio: true hasVideo: true

v=0 o=Flashphoner 0 1437391553771 IN IP4 sip.flashphoner.com s=Flashphoner/1.0 c=IN IP4 sip.flashphoner.com t=0 0 m=audio 31022 RTP/AVP 8 0 c=IN IP4 46.101.139.106 a=rtpmap:8 pcma/8000 a=rtpmap:0 pcmu/8000 a=ptime:20 a=rtcp:31023 IN IP4 sip.flashphoner.com a=sendrecv a=ssrc:1478013757 cname:rtp/audio/Xq2tlLcX89tTjaji m=video 31024 RTP/AVP 112 113 c=IN IP4 sip.flashphoner.com a=rtpmap:112 H264/90000 a=fmtp:112 packetization-mode=1; profile-level-id=420020 a=rtpmap:113 H264/90000 a=fmtp:113 packetization-mode=0; profile-level-id=420020 a=rtcp-fb:* ccm fir a=rtcp-fb:* nack a=rtcp-fb:* nack pli a=rtcp:31025 IN IP4 sip.flashphoner.com a=sendrecv a=ssrc:979076678 cname:rtp/video/Xq2tlLcX89tTjaji

© 2015 Flashphoner, LLC 70 Web Call Server 4 - User Guide Streaming 70

2. recvonly hasAudio: false hasVideo: false

v=0 o=Flashphoner 0 1437391553771 IN IP4 sip.flashphoner.com s=Flashphoner/1.0 c=IN IP4 sip.flashphoner.com t=0 0 m=audio 31022 RTP/AVP 8 0 c=IN IP4 46.101.139.106 a=rtpmap:8 pcma/8000 a=rtpmap:0 pcmu/8000 a=ptime:20 a=rtcp:31023 IN IP4 sip.flashphoner.com a=recvonly a=ssrc:1478013757 cname:rtp/audio/Xq2tlLcX89tTjaji m=video 31024 RTP/AVP 112 113 c=IN IP4 sip.flashphoner.com a=rtpmap:112 H264/90000 a=fmtp:112 packetization-mode=1; profile-level-id=420020 a=rtpmap:113 H264/90000 a=fmtp:113 packetization-mode=0; profile-level-id=420020 a=rtcp-fb:* ccm fir a=rtcp-fb:* nack a=rtcp-fb:* nack pli a=rtcp:31025 IN IP4 sip.flashphoner.com a=recvonly a=ssrc:979076678 cname:rtp/video/Xq2tlLcX89tTjaji

In both modes WCS does not send audio and video traffic at all, as just a command from REST is sent and no traffic source is used. However, WCS can indicate that it is not going to send audio and video traffic ('recvonly' mode).

If your SIP endpoint is a softphone or another SIP phone device, it will most likely drop the call ('sendrecv' mode) in a minute due to missing audio and video traffic from WCS. Some softphones support 'recvonly' mode, e.g. MicroSIP. In others, e.g. Bria, RTP inactivity timer value can be increased for longer call duration in 'sendrecv' mode.

If your SIP endpoint is a video conferencing server, there is a chance that it supports 'recvonly' mode and a call can be established for an extended period of time.

© 2015 Flashphoner, LLC Streaming 71

4.11.5.3 Supported codecs

The following codecs are supported Video codec: H.264 Audio codecs - Speex 16kHz (Speex codec with sampling rate 16000 samples per second) - G.711 alaw, ulaw

SIP codecs negotiation If the SIP endpoint answers with G.711 or Speex16 in SDP, WCS will use that negotiated audio codec for RTMP streaming.

Example #1 - WCS offers G.711, Speex16 - SIP Endpoint answers with G.711 - Result: RTMP codec is G.711

Example #2 - WCS offers G.711, Speex16 - SIP Endpoint answers with Speex16 - Result: RTMP codec is Speex16

Audio transcoding: G.711 to Speex Some RTMP servers like Wowza may record audio in Speex codec but do not support recording feature for G.711.

RTMP codec can be forced using server-side setting in flashphoner.properties force_rtmp_audio_codec = speex16

As a result, G.711 will be transcoded to Speex16.

Example - WCS offers G.711, Speex16 - SIP Endpoint answers with G.711 - Result: RTMP codec is Speex16

© 2015 Flashphoner, LLC 72 Web Call Server 4 - User Guide Streaming 72

4.11.5.4 HTTPS

REST works over HTTP on port 9091 (default) and HTTPS on port 8888.

To enable HTTPS, run the server with production profile (Configuring, "Launch configuration").

By default, WCS uses a self-signed SSL certificate. To confirm security exception for this certificate in the used browser a) Open similar URL https://sip-as-rtmp.flashphoner.com:8888 (here sip-as-rtmp.flashphoner.com is the address of the WCS server)

© 2015 Flashphoner, LLC Streaming 73

b) Click 'ADVANCED'

c) Click 'Proceed'

After this procedure WCS self-signed certificate is permitted by the web browser and HTTPS URL can be used for REST calls, for example: https://sip-as-rtmp.flashphoner.com:8888/RESTCall/call

© 2015 Flashphoner, LLC 74 Web Call Server 4 - User Guide Streaming 74

Authentication When production mode is enabled, each REST/HTTPS or REST/HTTP request requires Basic authentication. The default username and password are admin:admin. The credentials can be changed in WCS CLI. (Read more about the Command Line Interface in Admin Guide.)

In REST Console, authorization header can be added in the following way - click 'Basic Auth' in Authorization / Authorization Header, - add admin:admin as username and password, - click 'Set Header'

As a result, Authorization Header will be selected:

© 2015 Flashphoner, LLC Streaming 75

© 2015 Flashphoner, LLC 76 Web Call Server 4 - User Guide

© 2015 Flashphoner, LLC © 2015 Flashphoner, LLC