#

Avaya IP Office WebRTC SDK documentation for version: 11.1

# Avaya IP Office WebRTC SDK Module

This document describes about the Avaya IP Office WebRTC SDK Open APIs provided for web client application integration using java script language and these APIs can be used to develop or integrate web pages for consuming the telephony features provided by Avaya IP Office.

This is a java script based minified SDK("awl.min.js") which takes care of WebRTC functionalities for different WebRTC enabled browsers(latest versions of Chrome and Firefox) as well handles signaling between the WebRTC Gateway(i.e., Signal Gateway) and the web browser client using a secure web socket connection.

The SDK provides a AWL.client API interface, which upon instantiation can be used to invoke the following APIs(non-telephony and telephony) listed below inorder to consume the telephony features provided by Avaya IP Office. The details about these APIs and the parameters passed in them are best described in AWL.client

Non Telephony APIs:

       1. isWebRTCSupported()
                               2. getSdkVersion()
                               3. setConfiguration(arg1, callback_onConfigChanged, callback_onRegistrationStateChanged, callback_onCallStateChanged, callback_onAuthTokenRenewed) - Mandatory to call this API, before using logIn(arg1, arg2) API
                               4. enableLogging()
                               5. setDomElements(arg1)
                               6. logIn(arg1, arg2) - Mandatory to call this API, before using any of the Telephony APIs.
                               7. logOut()
                               8. isloggedIn()
                               9. setLogObject(arg1)
                               10. disableLogging()
                               11. getDeviceList(arg1)
                               12. setDeviceIds(arg1)
                               13. playVideo(arg1)
                               14. pauseVideo(arg1)
                               15. getAlternateServerConfig()
                               16. tokenLogIn(arg1, arg2, arg3)
                               17. generateAppInstanceID()
                               18. getStunConfiguration()
                               19. setStunConfiguration(arg1)

Telephony APIs:

       1.  makeCall(arg1, arg2)
                               2.  answerCall(arg1)
                               3.  rejectCall(arg1)
                               4.  dropCall(arg1)
                               5.  cancelCall(arg1)
                               6.  doHold(arg1)
                               7.  doUnHold(arg1)
                               8.  doMute(arg1)
                               9.  doUnMute(arg1)
                               10. sendDTMF(arg1, arg2)
                               11. transferCall(arg1, arg2 ,arg3)
                               12. getStats(arg1)
                               13. addVideo(arg1)
                               14. removeVideo(arg1)
                               15. setMediaStream(arg1, arg2, arg3, arg4)

Network Test APIs:

       1.  createLoopBackConnection()
                               2.  endLoopBackConnection()
                               3.  getLoopBackStats()

Pre-requisites:

- WebRTC is available with IP Office Server Edition, IP Office Select and IP Office preferred Edition and to access WebRTC, the associated users must have Power User or Office Worker profiles.
- The WebRTC Gateway IP address should be reachable from the web application which is integrated with the SDK.

Guidelines for using the SDK APIs: In order to experience Avaya IP Office WebRTC audio/video calls, following mandatory guidelines have to be met first, before using any other non Telephony or Telephony APIs.

Mandatory steps

1. Include Avaya IP Office WebRTC SDK file “awl.min.js” in the javascript include list

2. Create a AWL.client instance as this would be used to access all the non-telephony and telephony SDK APIs further

       Example:
                                       var myWebRTC = new AWL.client();

3. Set all the configuration (i.e., Populate serviceType("phone" or "agent"), enableVideo, Gateway IP address(Mandatory), Stun/Turn(Optional) server details, application data and disableResiliency details as in the following object literal notation template('cfg')) element(arg1) along with the four callback functions arg2, arg3, arg4 and arg5 which would be triggered upon any configuration changes, registration/unregistration state changes, callstate changes and token renewal (if resiliency is not disabled) respectively. All these except arg5 are mandatory arguments to be passed while invoking setConfiguration API. Out of all these fields in arg1 template, mandatory data to be filled is Gateway IP address or FQDN inorder to setup communication with the Avaya IP Office WebRTC Gateway(i.e., Signal Gateway component).

For the serviceType property, if set as Phone service(i.e., "phone") it provides client to be used as Avaya IP Office extension, with its own UI whereas if set as agentservice(i.e., "agent") it is better suited for scenarios where the telephony operations are controlled by CTI application. For the AppData, appInstanceID is the instance Id of the application and should be unique for each instantiation of application or AWL SDK.The appInstanceID can be obtained from AWL SDK utility API generateAppInstanceID().The appInstanceID is a mandatory configuration and should be done by every AWL SDK based applications. The applicationID and applicationUA are optional configurations to be used by third-party application developers using AWL SDK. The applicationUA represents application name registered with Avaya and applicationID represents the application identity key obtained from Avaya after the application registered with Avaya.

Note:

1. Equinox Select Client (or any Client) must set the remembered/persisted appInstanceID again, when AWL SDK is re-instantiated during Fail-over or Fail-back.
2. These two configurations are reserved for future usage.

By default, resiliency is supported at SDK.To disable resiliency support at SDK,applications have to set the disableResiliency property to true while passing the configuration parameter to setConfiguration API.If disableResiliency is set true,then AWL SDK will not renew the authentication token before it expires.Also,autologin using token during failover and failback will not be supported and the applications have to go for manual login during failover and failback.

       Example:
                                       var cfg = {
                                           serviceType: "phone",
                                           enableVideo: false,
                                           Gateway: {ip: "192.0.2.0", port: "9443"},
                                           Stunserver: {ip: "", port: "3478"},
                                           Turnserver: {ip: "", port: "3478", user: "", pwd: ""},
                                           AppData: {applicationID : "", applicationUA : "", appInstanceID : "" },
                                           disableResiliency : false
                                       };

                                       myWebRTC.setConfiguration(cfg, onConfigChanged, onRegistrationStateChanged, onCallListener, onAuthTokenRenewed);

                                       //    cfg: arg1
                                       //    onConfigChanged: callback_onConfigChanged
                                       //    onRegistrationStateChanged: callback_onRegistrationStateChanged
                                       //    onCallListener: callback_onCallStateChanged
                                       //    onAuthTokenRenewed: callback_onAuthTokenRenewed

The above API call would invoke the configuration change callback function which was passed as 'callback_onConfigChanged' earlier with the result and reason associated with it.

4. logIn with the Avaya IP Office SIP username, password as the WebRTC client's username, password in the logIn API.

        Example:
                                       myWebRTC.logIn('6501', '********');
                                                        |        |
                                                        |        |
                                                        V        V
                                                       arg1     arg2

The above API call would invoke the registration state change callback function which was passed as 'callback_onRegistrationStateChanged' earlier with the result and reason associated with it.

5. Once the login(i.e., Registration) is reported successful, all the telephony APIs can be invoked to make or receive calls and other on call relevant features. During call state changes or for an incoming call 'callback_onCallStateChanged' will get triggered.

6. After successful login, if resiliency support at SDK is not disabled by the client, then the authentication token received from the gateway will be used for autologin to alternate server during failover and tofailback.Also, the authentication token will be renewed by the SDK before it expires.

Copyright (c) 2017 Avaya Inc. All rights reserved.

This module provides the following classes:

- AWL.client