/Project-WebRTC-Widget

BroadSoft’s open-source version of the WebRTC widget that interfaces with BroadSoft’s WebRTC Gateway

Primary LanguageJavaScriptApache License 2.0Apache-2.0

## What you need to build WEBrtc

You just need to have [Node.js](http://nodejs.org/) and [Git](http://git-scm.com/). Optionally you also need [PhantomJS](http://phantomjs.org/) if you want to run test units.


### Node.js

* [Install Node.js via package manager](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager)
  e.g. on fedora
   yum install npm

* [Install Node.js from sources](http://nodejs.org)

### Git

* [Install Git](http://git-scm.com/book/en/Getting-Started-Installing-Git)


### PhantomJS

(optional, just for running unit tests)

* [Install PhantomJS](http://phantomjs.org/download.html)
* In modern Debian/Ubuntu systems PhantomJS can be installed via `apt-get install phantomjs`


## How to build webrtc

Install grunt-cli globally:
```
$ npm install -g grunt-cli
```

Enter the directory and install the Node.js dependencies:
```
$ cd webrtc && npm install
```

Make sure you have `grunt` installed by testing:
```
$ grunt -version
```

Finally, run `grunt` command with no arguments to get a complete version of webrtc:
```
$ grunt
```

The built version of webrtc will be available in the `dist/` subdirectory in both flavors: normal (uncompressed)  and minified, both linted with [JSLint](http://jslint.com/). There will be also a file named `dist/webrtc-devel.js` which is an exact copy of the uncompressed file.


## Development version

Run `grunt devel` for just generating the `dist/webrtc-devel.js` file. An uncompressed webrtc source file named `webrtc-devel.js` will be created in `dist` directory.


## Test units

webrtc includes test units based on [QUnit](http://qunitjs.com/). Test units use the `dist/webrtc-devel.js` file. Run the tests as follows:
```
$ grunt test

Running "qunit:noWebRTC" (qunit) task
Testing testNoWebRTC.html.........OK
>> 250 assertions passed (177ms)
```

## Configuration

The configuration file will be copied from js/client-config.js.example to js/client-config.js on the first run
of grunt if it doesn't exist already.

The following options exist

  enableHD: This feature enables 720pHD resolution from the client to the WebRTC Server.
  enableCallControl: This feature enables a window to enter SIP URI and call button.
  enableCallTimer: This feature enables the display of how long the user is on a call.
  enableCallHistory: Allows the client to keep call history.  Show the history with <Shift>+H.
  enableFullScreen: This feature enables the button for expanding the client to full screen.
  enableSelfView: This feature enables the button for enabling/disabling self-view.
  enableCallStats: This feature enables the display of call statistics using <Shift>+S.  Statistics include bitrate in/out, lost packets, and lost percent for audio and video.  Video statistics also include frame rate in and out and resolution in and out.  Audio statistics also include audio level in and out.  The total jitter of the link is also shown.
  enableDiaplad: This feature enables display of a dial pad.
  enableMute: This feature enables a mute button.
  enableMessages: This feature enables the status messages for connectivity, registration, and call progress.
  enableRegistrationIcon: This feature enables an icon that indicates whether user is registered or not.  Fades away under normal operating conditions.  Stays red when there is a problem.
  enableConnectionIcon: This feature enables an icon that indicates whether the user is connected via WebSockets.  The icon fades away under normal operating conditions and stays red when there is a problem.
  enableWindowDrag: This feature enables the user to drag the self-view, statistics, and history windows around.
  enableSettings: This feature enables the user to configure individual user settings that are stored as cookies.
  enableAutoAnswer: This feature enables being able to set auto answer in settings.
  enableAutoAcceptReInvite: This feature enables automatic answer of incoming reInvite requests.
  enableConnectLocalMedia: This feature enables connecting to users local media before the call.
  enableTransfer: This feature enables the transfer button.
  enableHold: This feature enables the hold/resume button.
  enableIms: This feature enables the following for operation in an IMS environment.
    P-Asserted-Identity:  The user portion is taken from the networkUserId client variable.
    The “user=phone URI parameter is added to the request-URI, From, To, and P-Asserted-Identity.

  volumeClick: Sets the audio volume for the click tone. Can be anyvalue from 0 to 1
  volumeDTMF: Sets the DTMF tone volume. Can be any value from 0 to 1.
  domainFrom: The default domain to use in the From header.
  domainTo: The default domain to use in the To header.
  allowOutside: Allows calls that are destined for a different domain.
  stunServer: IP address of the STUN server
  stunPort: port of the STUN server
  websocketsServers: enables specification of the WebSockets server(s) to connect to.  Replace ws_uri and ws with wss_uri and wss respectively for secure WebSockets.
  networkUserId: The phone number to place in the user portion of the From header.
  displayName: SIP display name
  endCallURL: Where to send the browser at the end of a call.
  bandwidthLow: bandwidth in kbps to use for low resolution.  Default is 128
  bandwidthMed: bandwidth in kbps to use for medium resolution.  Default is 512
  bandwidthHigh: bandwidth in kbps to use for high resolution.  Default is 2048
  expires: expiry time in days for cookies
  debug: enable logs in console
  displayResolution: resolution of the display eg. 960x720
  encodingResolution: resolution of the video encoding eg. 960x720
  view: view type for the WebRTC Client UI eg. audioOnly

  messageProgress: message to show on SIP progress,
  messageOutsideDomain: message to show if address is outside domain,
  messageStarted: message to show when call has started,
  messageHold: message to show when call is on hold,
  messageResume: message to show when call has been resumed,
  messageEnded: message to show when call has ended,
  messageCall: message to show when connecting,
  messageConnected: message to show when connected,
  messageConnectionFailed: message to show when connection failed,
  messageRegistered: message to show when registered,
  messageRegistrationFailed: message to show when registration failed,
  messageEmptyDestination: message to show when address is not valid,
  messageGetUserMedia: message to show when retrieving user media failed