Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vonage video api support #845

Open
wants to merge 28 commits into
base: vonage
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
70818c6
Initial work for Vonage application support
jeffswartz Aug 16, 2022
203dd2a
README edits for Vonage application
jeffswartz Aug 16, 2022
710ba3a
Update @vonage/video version
jeffswartz Aug 16, 2022
6935ecc
Change the Vonage Video web client URL
jeffswartz Aug 16, 2022
ea8f4a4
API tests for Vonage applications
jeffswartz Aug 18, 2022
4c08e1d
README info on OpenTok.js URL (to https://unpkg.com/@vonage...)
jeffswartz Oct 5, 2022
aa34771
update to latest @vonage/video SDK
jeffswartz Oct 5, 2022
7eb6561
Remove separate App ID for precall test
jeffswartz Oct 5, 2022
75a6a24
Disable SIP in UI
jeffswartz Oct 5, 2022
760688c
Remove unused OpenTok server SDK mock
jeffswartz Oct 5, 2022
4cfb614
Remove unneeded console.log() call
jeffswartz Oct 5, 2022
209bb48
Fix API tests (for calls to Vonage Video server SDK)
jeffswartz Oct 7, 2022
88e3d72
More test fixes
jeffswartz Oct 11, 2022
9f70391
Change API key and API secret to app ID and private key
jeffswartz Oct 11, 2022
f837c13
Fix for ChatController test stubs
jeffswartz Oct 11, 2022
3c09d54
Fix call to Vonage server SDK sendSignal() method
jeffswartz Oct 12, 2022
57d8812
Rev version to 5.0, and fix node version in package.json
jeffswartz Oct 12, 2022
5cc5557
Fix deleteArchive()
jeffswartz Oct 13, 2022
0bdada4
Remove unneeded console.log() call
jeffswartz Oct 14, 2022
9a9c650
Merge remote-tracking branch 'origin/master' into vonage-application-…
jeffswartz Nov 19, 2022
7db22d9
rev version
jeffswartz Nov 19, 2022
cfae979
Add vonage video api support
haocheng2023 Nov 27, 2023
9b48acc
merge
haocheng2023 Nov 29, 2023
a5fcebe
merge
haocheng2023 Nov 29, 2023
0cbc25e
whitesource check
haocheng2023 Nov 29, 2023
ca75eae
lint
haocheng2023 Dec 1, 2023
de06b1d
change vonage private key path to vonage private key
haocheng2023 Dec 1, 2023
0ad370c
change vonage private key path to vonage private key
haocheng2023 Dec 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v12
v14
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ script:
- ./node_modules/travis-github-lint-status/index.js
- npm run test && bash <(curl -s https://codecov.io/bash)
env:
- TB_API_SECRET=123 TB_API_KEY=123 SAUCE_USERNAME=opentok
- VONAGE_APPLICATION_ID=123 VONAGE_APPLICATION_ID=123 SAUCE_USERNAME=opentok
- VONAGE_PRIVATE_KEY=123 VONAGE_PRIVATE_KEY=123 SAUCE_USERNAME=opentok
addons:
firefox: "latest"
jwt:
Expand Down
9 changes: 4 additions & 5 deletions INSTALL-heroku.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ button:

If you prefer to deploy to Heroku manually instead, follow the procedure described next.

Heroku will prompt you to add your OpenTok API key and OpenTok API secret, which you can obtain at the [TokBox Dashboard](https://tokbox.com/account).
Heroku will prompt you to add your Vonage application ID and private key, which you can obtain at the [Vonage dashboard](https://dashboard.nexmo.com/).

You have to set the following environment variables on your Heroku instance:

- `TB_API_KEY`: Your OpenTok API key.
- `TB_API_SECRET`: Your OpenTok API secret.
- `VONAGE_APPLICATION_PATH_`: Your Vonage application's private key path.

## Manual Installation using Heroku CLI

Expand All @@ -33,10 +32,10 @@ First, create the app:
$ heroku create
```

Now you will have to set the following environment variables on your heroku instance. Replace `<key>` and `<secret>` with your OpenTok API key and the corresponding API secret:
Now you will have to set the following environment variables on your heroku instance. Replace `<applicationId>` and `<key>` with your Vonage application ID and the corresponding private key:

```sh
$ heroku config:set TB_API_KEY=<key> TB_API_SECRET=<secret>
$ heroku config:set VONAGE_APPLICATION_ID=<applicationId> VONAGE_PRIVATE_KEY=<key>
```

You will need to choose a redis addon. These two are currently supported,
Expand Down
74 changes: 30 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ OpenTokRTC is your private web-based video conferencing solution. It is based on
the OpenTok SDKs and API. You can deploy the app on your servers to get your own
video conferencing app running on WebRTC.

**Important:** This version of the application is modified to work with Vonage applications
(instead of OpenTok projects). Contact Vonage for more information on having video enabled
for your Vonage application.

This repository contains a Node.js server and a web client application.

## Table of Contents
Expand Down Expand Up @@ -48,8 +52,8 @@ You will need to install these dependencies on your machine:
- [NodeJS v12](https://nodejs.org): This version of OpenTokRTC is tested with NodeJS v12 LTS.
- [Redis](https://redis.io): A `redis` server running on `localhost`.

You will also need these an OpenTok API key and secret. You can obtain these by signing up with
[OpenTok/Vonage Video API](https://tokbox.com/account/user/signup).
You will also need these an Vonage application ID and private key. You can obtain these by signing up with the
[Vonage Video API](https://dashboard.nexmo.com/).

### Installing dependencies

Expand All @@ -74,8 +78,8 @@ Note: You will need to run these commands as a non-root user, else `bower` will

Once all the dependencies are in place, you will need to set some configuration options
and install the application's dependencies. At a minimum, you need to set options for
the OpenTok API key and secret to be used by the app. You can obtain these from
your [OpenTok account](https://tokbox.com/account).
the Vonage application ID and private key to be used by the app. You can obtain these from
the [Vonage API dashboard](https://dashboard.nexmo.com/).

Other features of the app are enabled and configured using more configuration options,
described in this README.
Expand All @@ -95,13 +99,13 @@ $ cp config/example.json config/config.json
```

Edit the config.json file with the following, and replace `<key>` and `<secret>` with
your OpenTok API key and the corresponding API secret:
your Vonage application ID and the corresponding private key:

```js
{
"OpenTok": {
"apiKey": "<key>"
"apiSecret": "<secret>"
"Vonage": {
"applicationId": "c696-...-5e71",
"privateKey": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhk...\n-----END PRIVATE KEY-----\n",
}
}
```
Expand All @@ -111,13 +115,14 @@ which are described in the [Configuration options](#configuration-options) secti

#### Setting environment variables

You can set the `TB_API_KEY` and `TB_API_SECRET` to your OpenTok API key and secret.
For example, the following shell commands export these values for use by the app
(replace `<key>` and `<secret>` with your OpenTok API key and the corresponding API secret):
You can set the `VONAGE_APPLICATION_ID` and `VONAGE_PRIVATE_KEY` environment variables to
your Vonage application ID and private key. For example, the following shell commands export
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
your Vonage application ID and private key. For example, the following shell commands export
your Vonage application ID and private key (or path to the private key). For example, the following shell commands export

these values for use by the app (replace `<application-id>` and `<private-key>` with your
Vonage application ID and private key):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Vonage application ID and private key):
Vonage application ID and either the private key or path to the private key):


```sh
export TB_API_KEY=<key>
export TB_API_SECRET=<secret>
export VONAGE_APPLICATION_ID=<application-id>
export VONAGE_PRIVATE_KEY=<private-key>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code uses VONAGE_PRIVATE_KEY_PATH, right? I actually think VONAGE_PRIVATE_KEY is better, because this can be a path to a private key or the actual private key String, right? If so, please change throughout.

```

You can set other environment variables to enable and configure other options,
Expand Down Expand Up @@ -178,13 +183,13 @@ Environment variable settings overwrite any value set with the config JSON file.
The default config JSON file location is config/config.json. This path can be
overwritten by setting the `DEFAULT_JSON_CONFIG_PATH` environment variable.

### OpenTok configuration
### Vonage Video API configuration

The required configuration settings for the OpenTok API key and secret are
The required configuration settings for the Vonage Video application and private key are
described in the [basic configuration](#basic-configuration) section,
earlier in this README.

There are other OpenTok configuration settings (each of which are optional):
There are other Vonage Video API configuration settings (each of which are optional):

* **Publisher resolution** -- You can set the desired resolution of published video.
The config.json setting is `OpenTok.publisherResolution`. The environment variable
Expand All @@ -199,10 +204,9 @@ There are other OpenTok configuration settings (each of which are optional):
If the client system cannot support the resolution you requested, the stream will use
the next largest setting supported.

* **OpenTok.js URL** -- By default, the app uses the latest standard line version
of OpenTok.js. You can change the OpenTok.js source URL. For example you may
want to change this to the enterprise line version of OpenTok.js
(https://static.opentok.com/v2/js/opentok.min.js).
* **OpenTok.js URL** -- By default, the app uses the default Vonage Video web client URL,
`https://unpkg.com/@vonage/video-client@2/dist/js/opentok.js`. Set this value
to change the source URL for the Vonage Video web client SDK.

The config.json setting is `OpenTok.jsUrl`. The environment variable name is `TB_JS_URL`.

Expand All @@ -227,10 +231,8 @@ The config.json setting is `mediaMode`. The environment variable name is `MEDIA_
```json
{
"OpenTok": {
"apiKey": "<key>",
"apiSecret": "<secret>",
"publisherResolution": "1280x720",
"jsUrl": "https://static.opentok.com/v2/js/opentok.min.js",
"jsUrl": "https://unpkg.com/@vonage/video-client@2/dist/js/opentok.js",
"maxSessionAge": 7
},
"mediaMode": "routed"
Expand All @@ -241,12 +243,14 @@ The config.json setting is `mediaMode`. The environment variable name is `MEDIA_

```sh
export PUBLISHER_RESOLUTION="1280x720";
export TB_JS_URL="https://static.opentok.com/v2/js/opentok.min.js";
export TB_JS_URL="https://unpkg.com/@vonage/video-client@2/dist/js/opentok.js";
export TB_MAX_SESSION_AGE="7";
```

### Phone dial-out

**Important:** The SIP dial-out feature is not currently supported for Vonage applications.

The app can dial out and add a phone-based end user to the OpenTok session, using the OpenTok
[SIP API](https://tokbox.com/developer/rest/#sip_call). This app uses
[Nexmo](https://www.nexmo.com/) as the SIP application that connects
Expand All @@ -261,10 +265,10 @@ To enable this feature:
* `SIP.enabled` (config.json) / `SIP_ENABLED` (environment variable) -- Set this to `true`.

* `SIP.username` (config.json) / `SIP_USERNAME` (environment variable) -- Set this to
the apiKey for the Nexmo account you created.
the API key for the Nexmo account you created.

* `SIP.password` (config.json) / `SIP_PASSWORD` (environment variable) -- Set this to
the apiSecret for the Nexmo account you created.
the API secret for the Nexmo account you created.

* `SIP.requireGoogleAuth` (config.json) / `SIP_REQUIRE_GOOGLE_AUTH` (environment variable) -- See
[Google Authentication for Phone dial-out](#google-authentication-for-phone-dial-out)
Expand Down Expand Up @@ -515,24 +519,6 @@ export ENABLE_FEEDBACK=true;

### Pre-call test

Set the the `TB_PRECALL_API_KEY` and `TB_PRECALL_API_SECRET` environment variables
to the the OpenTok API key and secret to use for the test session used by
the precall-test. Or set these in the config.json file:

**Config.json example:**

```json
{
"precallTest": {
"apiKey": "46049502",
"apiSecret": "0f4a63f629cec64ebdc5552974fe2566d2eb2835"
}
}
```

These are optional. If you do not set these, the pre-call test will use the same
API key and secret that is used for the main OpenTok session used in the room.

You can disable the pre-call test by setting the `ENABLE_PRECALL_TEST`
environment variable to `false`. Or you can disable it using the config file:

Expand Down
8 changes: 4 additions & 4 deletions api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ paths:
produces:
- 'application/json,'
description: >-
Returns the information (sessionId, token, apiKey) that's required to
Returns the information (sessionId, token, application ID) that's required to
connect to an opentok session. The sessionId returned is specific for
the room, and the token MAY include information about the user that's
connecting (identified as anonymous if the user didn't specify a name).
Expand Down Expand Up @@ -431,7 +431,7 @@ definitions:
properties:
sessionId:
type: string
apiKey:
applicationId:
type: string
token:
type: string
Expand Down Expand Up @@ -478,8 +478,8 @@ definitions:
name:
description: The name of the archive you supplied (this is optional)
type: string
partnerId:
description: Your OpenTok API key.
applicationId:
description: Your Vonage application ID.
type: string
reason:
description: >-
Expand Down
8 changes: 4 additions & 4 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"postdeploy": "bower install && grunt clientBuild"
},
"env": {
"TB_API_KEY": {
"description": "OpenTok API key: Login to the Tokbox Dashboard (https://dashboard.tokbox.com/keys) to get this value.",
"VONAGE_APPLICATION_ID": {
"description": "Vonage application ID: Login to the Vonage Dashboard (https://dashboard.nexmo.com/) to get this value.",
"required": true
},
"TB_API_SECRET": {
"description": "OpenTok API secret: Login to the Tokbox Dashboard (https://dashboard.tokbox.com/keys) to get this value.",
"VONAGE_PRIVATE_KEY": {
"description": "Vonage private key: Login to the Vonage Dashboard (https://dashboard.nexmo.com/) to get this value.",
"required": true
}
},
Expand Down
7 changes: 5 additions & 2 deletions config/example.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
"showTos": false,
"meetingsRatePerMinute": 30,
"OpenTok":{
"apiKey": "<key>",
"apiSecret": "<secret>",
"publisherResolution": "640x480"
},
"Vonage":{
"applicationId": "<key>",
"privateKey": "<path>",
"publisherResolution": "640x480"
},
"precallTest": {
"enabled": true,
"apiKey": "46049502",
Expand Down
7 changes: 7 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ module.exports = function (config) {
'test/unit/layoutMenuView_spec.js': ['browserify'],
'test/unit/layouts_spec.js': ['browserify'],
'test/unit/precallController_spec.js': ['browserify'],
'test/unit/precallView_spec.js': ['browserify'],
'test/unit/recordingsController_spec.js': ['browserify'],
'test/unit/recordingsView_spec.js': ['browserify'],
'test/unit/roomStatus_spec.js': ['browserify'],
'test/unit/roomView_spec.js': ['browserify'],
'test/unit/screenShareController_spec.js': ['browserify'],
'test/unit/screenShareView_spec.js': ['browserify'],

},

Expand Down
Loading