This chapter describes how to set up runtime environment checks and debug the applications you develop using the Oracle Communications WebRTC Session Controller Javascript application programming interface (API) library.
How well your applications perform in the runtime depend partly on browser compatibility, media device availability and network connectivity. This section deals with how you can check these elements in your runtime environment.
Your WebRTC-enabled applications are supported on browsers such as Google Chrome, Microsoft Firefox, Opera, and Edge. Within your application, you need to verify and monitor the following:
Browsers. See "Testing Browser Compatibility."
Network connections. See "Monitoring Network Connections."
WebSocket connection. See "Monitoring the WebSocket."
RTCPeerConnection interface. See "Verifying the WebRTC Connection to a Peer."
Media devices, including microphones and camera. For:
Microphones, see "Selecting Appropriate Source for the Audio Elements."
Camera, see "Selecting Appropriate Source for the Video Elements."
To verify the browser compatibility, call the testBrowser method of the wsc namespace. Its syntax is:
<static> testBrowser()
The testBrowser method returns an object whose format is:
{ compatible: boolean, details: { browserName: String, browserVersion: String, supportedMinimumVersion: String, supportedMaximumVersion: String, supportWebRTC: boolean, supportWebSocket: boolean, supportSessionStorage: boolean } }
For more information about wsc.testBrowser, see Oracle Communications WebRTC Session Controller Cloud Edition JavaScript API Reference.
To monitor your network connections call the testNetwork method of the wsc namespace. Its syntax is:
<static> testNetwork(turnURI, username, password)
Where all three input parameters are required:
turnURI contains the URI of the TURN server. For example, turn:myserver.com:3478
.
username contains the user name for the TURN server.
password contains the password for the TURN server.
The wsc.testNetwork method returns a Promise whose value is an object in the format shown in:
Example 11-1 Object format of Promise Returned by wsc.testNetwork
{ connectivity: boolean, // true if (udpConnectivity || tcpConnectivity) && (dataThroughput > 0 && videoBandwidth > 0) details: { udpConnectivity: boolean, tcpConnectivity: boolean, dataThroughput: Number // unit: kbps videoBandwidth: Number // unit: kbps } }
For more information on wsc.testNetwork, see Oracle Communications WebRTC Session Controller JavaScript API Reference.
WebRTC Session Controller Javascript SDK uses WebSocket connections to send and receive real-time communication (RTC) and JSON messages to and from the Signaling Engine server. The rapid but disparate rates in the evolution of the supported browsers makes the configuration and monitoring of WebSockets an important task.
For more information on monitoring WebSocket connections, see the description about "Using the WebSocket Protocol in WebLogic Server" in Oracle Fusion Middleware Developing Applications for Oracle WebLogic Server.
RTCPeerConnection is an interface that enables you to manage a WebRTC connection between a local computer and a remote peer. Information on how to use the RTCPeerConnection is available at
This guide contains an example of how to configure local video and audio MediaStream objects using the WebRTC PeerConnectionFactory, for an Android application. See "Configure the Local MediaStream for Audio".
Media devices include microphone and camera. There may be multiple microphones and cameras on one terminal. To check the given device, WebRTC Session Controller uses the device source ID. If no device source ID is provided, the default device is used.
When your applications support the use of audio devices, it is important to know the state of the audio devices at a terminal. At times, there may be multiple microphones at a terminal. To check a given device, Web RTC Session Controller uses the source ID of the device. If no device source ID is provided, it uses the default device.
To verify and test microphone availability in the runtime environment, use the following:
getuserMedia
The getUserMedia method uses constraints to help select an appropriate source for a track and configure it. When you use the getUserMedia method, a track is not connected to a source if its initial constraints cannot be satisfied.
For more information on the getUserMedia method, see
http://w3c.github.io/mediacapture-main/getusermedia.html
To troubleshoot a microphone, you can use the WebRTC Troubleshooter at
wsc.testMicrophone
To test the microphone availability, call the testMicrophone method of the wsc namespace. Its syntax is:
<static> testMicrophone()
The wsc.testMicrophone method returns a Promise whose value is an object in the format shown in:
Example 11-2 Object format of Promise Returned by wsc.testNetwork
{ available: boolean, // true if one source is available details: [ { available: boolean, sourceId: String, label: String, channelNumber: Number, isStereo: boolean }, ... { available: boolean, sourceId: String, label: String, channelNumber: Number, isStereo: boolean } ] }
For more information on wsc.testNetwork, see Oracle Communications WebRTC Session Controller JavaScript API Reference.
Web Audio API
The Web Audio API has been designed so that applications can support the changing face of modern desktop audio software.
For more information on the Web Audio API, see
When your applications support the use of media devices, it is important to know the state of the media device at a terminal. At times, there may be multiple microphones and cameras at one terminal. To check a given device, Web RTC Session Controller uses the source ID of the device. If no device source ID is provided, it uses the default device.
To verify, and test camera availability in the runtime environment, use the following:
getuserMedia
The getUserMedia method uses constraints to help select an appropriate source for a track and configure it. When you use the getUserMedia method, a track is not connected to a source if its initial constraints cannot be satisfied.
For more information on the getUserMedia method, see
http://w3c.github.io/mediacapture-main/getusermedia.html
To troubleshoot a camera, you can use the WebRTC Troubleshooter at
wsc.testCamera
To test the microphone availability, call the testCamera method of the wsc namespace. Its syntax is:
<static> testCamera()
The wsc.testCamera method returns a Promise whose value is an object in the format shown in:
Example 11-3 Object format of Promise Returned by wsc.testCamera
{ available: boolean, // true if one source is available details: [ { available: boolean, sourceId: String, label: String, availableResolutions: [String] }, ... { available: boolean, sourceId: String, label: String, availableResolutions: [String] } ] }
For more information on wsc.testCamera, see Oracle Communications WebRTC Session Controller JavaScript API Reference.
You can enable the debug mode for an application at the server level. When you do so, all the sessions of that application are in the debug mode and logs are collected for those sessions.
To run the application in the debug mode, select the Debug check box for your application entry in the WebRTC Session Controller Administration Console.
To do so, access the Application Profiles tab, select the application name. In the Profile tab for the application, select the Debug check box. For more information about configurable runtime parameters, see the table under "Global Integration Parameters of the Signaling Engine" in WebRTC Session Controller System Administrator's Guide.
When you enable this API in your application, the following logs are recorded for the specific application:
All JsonRTC messages from the client and to the client.
All SIP message from the client and to the client.
All session or sub-session status.
All the error and exception messages encountered.
When the debug mode is enabled for an application, WebRTC Session Controller provides information over the life cycle of the session and its sub-sessions. WebRTC Session Controller logs errors and exceptions at the following events:
For a Session:
onSessionCreate
onSessionDestroy
For a Sub Session
onSubSessionStarted
onSubSessionEstablished
onSubSessionFailed
For SIP
onSipRequestReceived
onSipResponseReceived
onSipRequestSent
onSipReesponseReceived
onSipSessionEnd
Example 11-4 shows a sample debug log file:
Example 11-4 Sample Debug Log File
DEBUG 2015-07-03 17:31:56,001 [ (self-tuning)'] (sc.core.debug.LogRecorder: 43) - -------------------------------------------------- ## Application : guest ## SessionId : pQAAAU5TN6Ml6hLzQqzR71zJqnwAAAAD_4 ## MessageState : JSON_RECEIVED ## LogContent : Registration message : Frame(control=Control(version=1.0, verb=connect, type=REQUEST, messageState=null, sequence=1, sessionId=null, subSessionId=null, correlationId=null, ackSequence=0, packagetype=register, wscId=null, connectSlr=null, connectSlw=null, connectSuw=null, connectSslr=null), normalized={control={}, header={}, payload={}}) DEBUG 2015-07-03 17:31:56,005 [ (self-tuning)'] (sc.core.debug.LogRecorder: 43) - -------------------------------------------------- ## Application : guest ## SessionId : pQAAAU5TN6Ml6hLzQqzR71zJqnwAAAAD_4 ## MessageState : SUBSESSION_CREATED ## LogContent :
When an application runs in the debug mode, WebRTC Session Controller stores the output to a file named, wsc-debug-client.log. Look for this file in the domain/server/logs directory.
Example 11-5 shows the setup of the debug log file:
Example 11-5 Application Debug Log File Configuration
<Appenders> <RollingFile name="debug" fileName="servers/${sys:weblogic.Name}/logs/wsc-debug-server.log" filePattern="servers/${sys:weblogic.Name}/logs/wsc-debug-server.log-%d{yyyy-MM-dd}-%i" immediateFlush="true" append="true"> <PatternLayout pattern="%5p %d [%-15.15t] (%-25.25c:%4L) - %m%n" /> <Policies> <OnStartupTriggeringPolicy /> <TimeBasedTriggeringPolicy interval="24" modulate="true" /> <SizeBasedTriggeringPolicy size="100 MB"/> </Policies> <DefaultRolloverStrategy max="10"/> </RollingFile> </Appenders> <Loggers> <Logger name="oracle.wsc.core.threat.log" level="info" additivity="false"> <AppenderRef ref="threat"/> </Logger> <Logger name="oracle.wsc.core.debug" level="debug" additivity="false"> <AppenderRef ref="debug"/> </Logger> <Root level="warn"> <AppenderRef ref="file" /> </Root> </Loggers>