Skip to content

Commit

Permalink
Merge from internal (#273)
Browse files Browse the repository at this point in the history
Co-authored-by: Cyrus Twombly <[email protected]>
Co-authored-by: Yingdong Li <[email protected]>
Co-authored-by: danbee <[email protected]>
Co-authored-by: cr-merge <[email protected]>
Co-authored-by: David Oh <[email protected]>
Co-authored-by: Jeong Won Lee <[email protected]>
Co-authored-by: John Lim <[email protected]>
Co-authored-by: Kim, Minsoo <[email protected]>
Co-authored-by: Vidit Jain <[email protected]>
Co-authored-by: Andy Ratsirarson <[email protected]>
Co-authored-by: Martin Greenberg <[email protected]>
Co-authored-by: Haochi Chen <[email protected]>
Co-authored-by: Vikas Garg <[email protected]>
  • Loading branch information
14 people authored Jun 25, 2020
1 parent b729887 commit 2b3342b
Show file tree
Hide file tree
Showing 27 changed files with 40,759 additions and 40,351 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ build
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.vscode
28 changes: 27 additions & 1 deletion Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ Find build artifacts in **release** directory - This will generate a file called

To run unit tests:
```
$ npm run test
$ npm run gulp-test
```

## Using the AWS SDK and Streams
Expand Down Expand Up @@ -173,6 +173,11 @@ and made available to your JS client code.
ringtone audio that is played when a call is incoming.
* `ringtoneUrl`: If the ringtone is not disabled, this allows for overriding
the ringtone with any browser-supported audio file accessible by the user.
* `chat`: This object is optional and allows you to specify ringtone params for Chat.
* `disableRingtone`: This option allows you to completely disable the built-in
ringtone audio that is played when a chat is incoming.
* `ringtoneUrl`: If the ringtone is not disabled, this allows for overriding
the ringtone with any browser-supported audio file accessible by the user.

#### A few things to note:
* You have the option to show or hide the pre-built UI by showing or hiding the
Expand Down Expand Up @@ -281,6 +286,15 @@ session. This callback is provided with a `Contact` API object for this
contact. `Contact` API objects can also be listed from the `Agent` API by
calling `agent.getContacts()`.

### `connect.onWebSocketInitFailure()`
```
connect.onWebSocketInitFailure(function() { ... });
```
Subscribe a method to be called when the WebSocket connection fails to initialize.
If the WebSocket has already failed at least once in initializing, the call is
synchronous and the callback is invoked immediately. Otherwise, the callback is
invoked once the first attempt to initialize fails.

## Agent API
The Agent API provides event subscription methods and action methods which can
be called on behalf of the agent. There is only ever one agent per Streams
Expand Down Expand Up @@ -348,6 +362,18 @@ Subscribe a method to be called when the agent is put into an error state specif

The `error` argument is a `connect.SoftphoneError` instance with the following methods: `getErrorType()`, `getErrorMessage()`, `getEndPointUrl()`.

### `agent.onWebSocketConnectionLost()`
```
agent.onWebSocketConnectionLost(function(agent) { ... });
```
Subscribe a method to be called when the agent is put into an error state specific to losing a WebSocket connection.

### `agent.onWebSocketConnectionGained()`
```
agent.onWebSocketConnectionGained(function(agent) { ... });
```
Subscribe a method to be called when the agent gains a WebSocket connection.

### `agent.onAfterCallWork()`
```js
agent.onAfterCallWork(function(agent) { /* ... */ });
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Find build artifacts in **release** directory - This will generate a file called

To run unit tests specifically:
```
$ npm run test
$ npm run gulp-test
```

## Using the AWS SDK and Streams
Expand Down
2 changes: 1 addition & 1 deletion cheat-sheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,4 @@ onSoftphoneSessionInit Event Handler

fetch API

connect.fetch("endpoint", options, retryinterval, maxRetry);
connect.fetch("endpoint", options, retryinterval, maxRetry);
25 changes: 12 additions & 13 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
var istanbul = require('gulp-istanbul'),
var istanbul = require('gulp-istanbul'),
mocha = require('gulp-mocha'),
concat = require('gulp-concat'),
gulp = require('gulp'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
watch = require('gulp-watch'),
jshint = require('gulp-jshint'),
replace = require('gulp-replace'),
pump = require('pump');
Expand All @@ -25,20 +24,20 @@ var source = [ "src/aws-client.js",
"src/worker.js",
"src/mediaControllers/*",

];
];

gulp.task('pre-test', function () {
return gulp.src(['./src/*.js'])
// Covering files
.pipe(istanbul({includeUntested: false}))
// Force `require` to return covered files
.pipe(istanbul.hookRequire());
return gulp.src(['./src/*.js'])
// Covering files
.pipe(istanbul({includeUntested: false}))
// Force `require` to return covered files
.pipe(istanbul.hookRequire());
});
gulp.task('test', gulp.series('pre-test', function () {

gulp.task('test', gulp.series('pre-test', function (cb) {
return gulp.src(['test/unit/**/*.spec.js'])
.pipe(mocha({exit: true, showStack:true}))
.on('error', console.error)
.on('error', (err) => cb(err))
// Creating the reports after tests ran
.pipe(istanbul.writeReports());
}));
Expand All @@ -60,4 +59,4 @@ gulp.task('script', function (cb) {
], cb);
});

gulp.task('default', gulp.series('test','script'));
gulp.task('default', gulp.series('script', 'test'));
Loading

0 comments on commit 2b3342b

Please sign in to comment.