From 70818c6ba99647e5aa2443e323fc784167a9b8cc Mon Sep 17 00:00:00 2001 From: Jeff Swartz Date: Tue, 16 Aug 2022 10:43:36 -0700 Subject: [PATCH 01/26] Initial work for Vonage application support --- README.md | 34 ++++--- config/example.json | 6 +- package-lock.json | 190 +++++++++++++++++++++++++------------- package.json | 2 +- server/serverConstants.js | 4 + server/serverMethods.js | 126 ++++++++++++------------- 6 files changed, 217 insertions(+), 145 deletions(-) diff --git a/README.md b/README.md index c2ffe35ab..74c504649 100644 --- a/README.md +++ b/README.md @@ -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 @@ -95,13 +99,13 @@ $ cp config/example.json config/config.json ``` Edit the config.json file with the following, and replace `` and `` with -your OpenTok API key and the corresponding API secret: +your Vonage application ID and the corresponding private key: ```js { - "OpenTok": { - "apiKey": "" - "apiSecret": "" + "Vonage": { + "applicationId": "c696-...-5e71", + "privateKey": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhk...\n-----END PRIVATE KEY-----\n", } } ``` @@ -111,7 +115,7 @@ 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. +You can set the `TB_API_KEY` and `TB_API_SECRET` to your Vonage application ID and private key. For example, the following shell commands export these values for use by the app (replace `` and `` with your OpenTok API key and the corresponding API secret): @@ -178,13 +182,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 @@ -227,8 +231,8 @@ The config.json setting is `mediaMode`. The environment variable name is `MEDIA_ ```json { "OpenTok": { - "apiKey": "", - "apiSecret": "", + "apiKey": "", + "apiSecret": "", "publisherResolution": "1280x720", "jsUrl": "https://static.opentok.com/v2/js/opentok.min.js", "maxSessionAge": 7 @@ -247,6 +251,8 @@ export TB_MAX_SESSION_AGE="7"; ### Phone dial-out +**Important:** The dial-out 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 @@ -515,8 +521,10 @@ export ENABLE_FEEDBACK=true; ### Pre-call test +**Important:** The pre-call test is not currently supported for Vonage applications. + 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 +to the the Vonage application ID and private keys to use for the test session used by the precall-test. Or set these in the config.json file: **Config.json example:** @@ -524,8 +532,8 @@ the precall-test. Or set these in the config.json file: ```json { "precallTest": { - "apiKey": "46049502", - "apiSecret": "0f4a63f629cec64ebdc5552974fe2566d2eb2835" + "apiKey": "", + "apiSecret": "", } } ``` diff --git a/config/example.json b/config/example.json index 9e4d3e9a1..ececab814 100644 --- a/config/example.json +++ b/config/example.json @@ -2,10 +2,12 @@ "showTos": false, "meetingsRatePerMinute": 30, "OpenTok":{ - "apiKey": "", - "apiSecret": "", "publisherResolution": "640x480" }, + "Vonage": { + "applicationId": "c696-...-5e71", + "privateKey": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhk...\n-----END PRIVATE KEY-----\n", + }, "precallTest": { "enabled": true, "apiKey": "46049502", diff --git a/package-lock.json b/package-lock.json index 65ad442aa..1062232a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -802,6 +802,50 @@ "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", "dev": true }, + "@vonage/auth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@vonage/auth/-/auth-0.2.0.tgz", + "integrity": "sha512-wJFUJM6vffutFDywaeumo2x2xEpTqRWHtPWi7JP2ynxA5D37TkTnJ0m6VBBMBkMoZ5u4MjtM19EwTIpipcJuaw==", + "requires": { + "@vonage/jwt": "^0.2.0", + "crypto": "^1.0.1" + } + }, + "@vonage/jwt": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@vonage/jwt/-/jwt-0.2.0.tgz", + "integrity": "sha512-QcBWwpCydz6YAqI+DH2n/5OAYbbAd3GR/gueR+n9Zkj+R8Jr0jo999ypTNY9f/Ws+coWgJ+kmJhmLh/SCjf49w==", + "requires": { + "jsonwebtoken": "^8.5.1", + "uuid": "^8.3.2" + }, + "dependencies": { + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==" + } + } + }, + "@vonage/vetch": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@vonage/vetch/-/vetch-0.1.0.tgz", + "integrity": "sha512-2wOUUyrKwjHR8NBICU8+/SeG9lBtkt0KOzqiTF6PrUNtKBE1pF8gtpgL5aTnfExxd4bf8goilpcb/FQPrfQ5tA==", + "requires": { + "lodash.merge": "^4.6.2", + "node-fetch": "^2.6.1" + } + }, + "@vonage/video": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@vonage/video/-/video-0.7.0.tgz", + "integrity": "sha512-vUzWauuYSPY1Dkx7jQ0laZLMpjD/1H0U+JFU/RqkISWpsxuUMRHkHjIUcyRzOXkCH5bVoWkDwddZ9yCTnHcEQw==", + "requires": { + "@vonage/auth": "^0.2.0", + "@vonage/jwt": "^0.2.0", + "@vonage/vetch": "^0.1.0" + } + }, "@wdio/cli": { "version": "6.9.0", "resolved": "https://registry.npmjs.org/@wdio/cli/-/cli-6.9.0.tgz", @@ -1438,6 +1482,7 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, "requires": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -1727,6 +1772,7 @@ "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "dev": true, "requires": { "safer-buffer": "~2.1.0" } @@ -1762,7 +1808,8 @@ "assert-plus": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true }, "assertion-error": { "version": "1.1.0", @@ -1978,7 +2025,8 @@ "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true }, "at-least-node": { "version": "1.0.0", @@ -2014,12 +2062,14 @@ "aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true }, "aws4": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", - "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" + "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", + "dev": true }, "axe-core": { "version": "4.1.0", @@ -2157,6 +2207,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, "requires": { "tweetnacl": "^0.14.3" } @@ -2855,7 +2906,8 @@ "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true }, "chai": { "version": "4.2.0", @@ -3286,6 +3338,7 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, "requires": { "delayed-stream": "~1.0.0" } @@ -4055,6 +4108,11 @@ } } }, + "crypto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz", + "integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==" + }, "crypto-browserify": { "version": "3.12.0", "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", @@ -4256,6 +4314,7 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, "requires": { "assert-plus": "^1.0.0" } @@ -4474,7 +4533,8 @@ "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true }, "delegates": { "version": "1.0.0", @@ -4786,6 +4846,7 @@ "version": "0.1.2", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "dev": true, "requires": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" @@ -4794,7 +4855,8 @@ "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true } } }, @@ -6089,12 +6151,14 @@ "extsprintf": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true }, "fast-glob": { "version": "3.2.4", @@ -6158,7 +6222,8 @@ "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true }, "fast-levenshtein": { "version": "2.0.6", @@ -6600,12 +6665,14 @@ "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true }, "form-data": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "dev": true, "requires": { "asynckit": "^0.4.0", "combined-stream": "^1.0.6", @@ -6893,6 +6960,7 @@ "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, "requires": { "assert-plus": "^1.0.0" } @@ -7736,12 +7804,14 @@ "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true }, "har-validator": { "version": "5.1.5", "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "dev": true, "requires": { "ajv": "^6.12.3", "har-schema": "^2.0.0" @@ -8018,6 +8088,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, "requires": { "assert-plus": "^1.0.0", "jsprim": "^1.2.2", @@ -8917,7 +8988,8 @@ "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true }, "is-unc-path": { "version": "1.0.0", @@ -8984,7 +9056,8 @@ "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true }, "istanbul": { "version": "0.4.5", @@ -9678,12 +9751,14 @@ "json-schema": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true }, "json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -9756,9 +9831,9 @@ } }, "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" } } }, @@ -9766,6 +9841,7 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", @@ -10349,12 +10425,12 @@ "lodash.includes": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", - "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=" + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==" }, "lodash.isboolean": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", - "integrity": "sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=" + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==" }, "lodash.isempty": { "version": "4.4.0", @@ -10375,12 +10451,12 @@ "lodash.isinteger": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", - "integrity": "sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=" + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==" }, "lodash.isnumber": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", - "integrity": "sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=" + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==" }, "lodash.isobject": { "version": "3.0.2", @@ -10424,8 +10500,7 @@ "lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", - "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" }, "lodash.noop": { "version": "3.0.1", @@ -10435,7 +10510,7 @@ "lodash.once": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", - "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=" + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==" }, "lodash.partial": { "version": "4.2.1", @@ -11545,11 +11620,6 @@ "integrity": "sha1-WuVUHQJGRdMqWPzdyc7s6nrjrC8=", "dev": true }, - "nonce": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/nonce/-/nonce-1.0.4.tgz", - "integrity": "sha1-7nMCrejBvvR28wG4yR9cxRpIdhI=" - }, "noop-logger": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz", @@ -11636,7 +11706,8 @@ "oauth-sign": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", + "dev": true }, "object-assign": { "version": "4.1.1", @@ -11812,27 +11883,6 @@ "mimic-fn": "^2.1.0" } }, - "opentok": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/opentok/-/opentok-2.10.0.tgz", - "integrity": "sha512-i1CMHXe4f0az2NLzE3zTeOk8p/DF35bbKV7riVMRUHry2HBQRqfKMWeepg+18rLOO1t6eXfDXhvj+0ozJ1UbGw==", - "requires": { - "jsonwebtoken": "^8.2.0", - "lodash": "^4.17.11", - "opentok-token": "^1.1.1", - "request": "^2.88.1" - } - }, - "opentok-token": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/opentok-token/-/opentok-token-1.1.1.tgz", - "integrity": "sha512-/uMsmUMiGWT95zemuE9H3OWSb+1NcDmZSDzjum1oKk2KLLGkjqlPsEo8NWarH2q1rfd+cBWP8Pu+dwJS0uNHcg==", - "requires": { - "lodash": "^4.17.11", - "nonce": "^1.0.3", - "unix-timestamp": "^0.1.2" - } - }, "opn": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/opn/-/opn-6.0.0.tgz", @@ -12180,7 +12230,8 @@ "performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true }, "picomatch": { "version": "2.2.2", @@ -12619,7 +12670,8 @@ "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", - "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==", + "dev": true }, "public-encrypt": { "version": "4.0.3", @@ -13148,6 +13200,7 @@ "version": "2.88.2", "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "dev": true, "requires": { "aws-sign2": "~0.7.0", "aws4": "^1.8.0", @@ -13174,7 +13227,8 @@ "qs": { "version": "6.5.2", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==", + "dev": true } } }, @@ -14180,6 +14234,7 @@ "version": "1.16.1", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "dev": true, "requires": { "asn1": "~0.2.3", "assert-plus": "^1.0.0", @@ -14195,7 +14250,8 @@ "jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true } } }, @@ -15208,6 +15264,7 @@ "version": "2.5.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "dev": true, "requires": { "psl": "^1.1.28", "punycode": "^2.1.1" @@ -15216,7 +15273,8 @@ "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true } } }, @@ -15291,7 +15349,8 @@ "tweetnacl": { "version": "0.14.5", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true }, "type-check": { "version": "0.4.0", @@ -15422,11 +15481,6 @@ "integrity": "sha512-rb6X1W158d7pRQBg5gkR8uPaSfiids68LTJQYOtEUhoJUWBdaQHsuT/EUduxXYxcrt4r5PJ4fuHW1MHT6p0qug==", "dev": true }, - "unix-timestamp": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/unix-timestamp/-/unix-timestamp-0.1.2.tgz", - "integrity": "sha1-w3HeCSqxSRolxc48B1jSwl5748M=" - }, "unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", @@ -15484,6 +15538,7 @@ "version": "4.4.0", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==", + "dev": true, "requires": { "punycode": "^2.1.0" }, @@ -15491,7 +15546,8 @@ "punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true } } }, @@ -15569,7 +15625,8 @@ "uuid": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "dev": true }, "v8-compile-cache": { "version": "2.2.0", @@ -15604,6 +15661,7 @@ "version": "1.10.0", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, "requires": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", diff --git a/package.json b/package.json index 530a31741..6bdb8ea6e 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "http2": "^3.3.7", "ioredis": "^4.17.3", "lodash": "^4.17.20", - "opentok": "^2.10.0", + "@vonage/video": "^0.7.0", "qs": "^6.9.4", "swagger-boilerplate": "^0.1.6", "yamljs": "^0.3.0" diff --git a/server/serverConstants.js b/server/serverConstants.js index 17e5d7065..1cde68c21 100644 --- a/server/serverConstants.js +++ b/server/serverConstants.js @@ -31,6 +31,10 @@ E.OPENTOK_PRECALL_API_KEY = { envVar: 'TB_PRECALL_API_KEY', jsonPath: 'precallTe E.OPENTOK_PRECALL_API_SECRET = { envVar: 'TB_PRECALL_API_SECRET', jsonPath: 'precallTest.apiSecret' }; +E.VONAGE_APPLICATION_ID = { envVar: 'VONAGE_APPLICATION_ID', jsonPath: 'Vonage.applicationId', required: true }; + +E.VONAGE_PRIVATE_KEY = { envVar: 'VONAGE_PRIVATE_KEY', jsonPath: 'Vonage.privateKey', required: true }; + E.OPENTOK_JS_URL = { envVar: 'TB_JS_URL', jsonPath: 'OpenTok.jsUrl', required: false, defaultValue: 'https://static.opentok.com/v2/js/opentok.min.js', }; diff --git a/server/serverMethods.js b/server/serverMethods.js index ce0842c1b..11ceada91 100644 --- a/server/serverMethods.js +++ b/server/serverMethods.js @@ -74,10 +74,8 @@ function ServerMethods(aLogLevel, aModules) { const { Utils } = SwaggerBP; const Logger = Utils.MultiLevelLogger; - const { promisify } = Utils; - - const Opentok = aModules.Opentok || require('opentok'); // eslint-disable-line global-require + const Vonage = aModules.Vonage || require('@vonage/video'); // eslint-disable-line global-require let roomBlackList; const logger = new Logger('ServerMethods', aLogLevel); @@ -93,11 +91,11 @@ function ServerMethods(aLogLevel, aModules) { let sipUri; let googleAuth; - // Opentok API instance, which will be configured only after tbConfigPromise + // @vonage/video API instance, which will be configured only after tbConfigPromise // is resolved let tbConfigPromise; - // Initiates polling from the Opentok servers for changes on the status of an archive. + // Initiates polling from the Vonage Video servers for changes on the status of an archive. // This is a *very* specific polling since we expect the archive will have already been stopped // by the time this launches and we're just waiting for it to be available or uploaded. // To try to balance not polling to often with trying to get a result fast, the polling time @@ -108,7 +106,7 @@ function ServerMethods(aLogLevel, aModules) { let timeout = aTimeout; const pollArchive = function _pollArchive() { logger.log('Poll [', aArchiveId, ']: polling...'); - aOtInstance.getArchive_P(aArchiveId).then((aArchive) => { + aOtInstance.getArchive(aArchiveId).then((aArchive) => { if (aArchive.status === 'available' || aArchive.status === 'uploaded') { logger.log('Poll [', aArchiveId, ']: Resolving with', aArchive.status); resolve(aArchive); @@ -129,19 +127,30 @@ function ServerMethods(aLogLevel, aModules) { // This will hold the configuration read from Redis const defaultTemplate = config.get(C.DEFAULT_TEMPLATE); const templatingSecret = config.get(C.TEMPLATING_SECRET); - const apiKey = config.get(C.OPENTOK_API_KEY); - const apiSecret = config.get(C.OPENTOK_API_SECRET); - const precallApiKey = config.get(C.OPENTOK_PRECALL_API_KEY) || config.get(C.OPENTOK_API_KEY); - const precallApiSecret = config.get(C.OPENTOK_PRECALL_API_SECRET) - || config.get(C.OPENTOK_API_SECRET); + const apiKey = config.get(C.VONAGE_APPLICATION_ID) || config.get(C.OPENTOK_API_KEY); + const apiSecret = config.get(C.VONAGE_PRIVATE_KEY); + const precallApiKey = config.get(C.VONAGE_APPLICATION_ID); + const precallApiSecret = config.get(C.VONAGE_PRIVATE_KEY); const opentokJsUrl = config.get(C.OPENTOK_JS_URL); const useGoogleFonts = config.get(C.USE_GOOGLE_FONTS); const jqueryUrl = config.get(C.JQUERY_URL); - logger.log('apiSecret', apiSecret); + const archivePollingTO = config.get(C.ARCHIVE_POLLING_INITIAL_TIMEOUT); const archivePollingTOMultiplier = config.get(C.ARCHIVE_POLLING_TIMEOUT_MULTIPLIER); - const otInstance = Utils.CachifiedObject(Opentok, apiKey, apiSecret); - const precallOtInstance = Utils.CachifiedObject(Opentok, precallApiKey, precallApiSecret); + const vonageVideoInstance = Utils.CachifiedObject( + Vonage.Video, + { + applicationId: apiKey, + privateKey: apiSecret, + }, + ); + const precallVonageVideoInstance = Utils.CachifiedObject( + Vonage.Video, + { + applicationId: precallApiKey, + privateKey: precallApiSecret, + }, + ); const allowIframing = config.get(C.ALLOW_IFRAMING); const archiveAlways = config.get(C.ARCHIVE_ALWAYS); @@ -162,14 +171,6 @@ function ServerMethods(aLogLevel, aModules) { } else { googleAuth = new GoogleAuth.DisabledGoogleAuthStategy(); } - // This isn't strictly necessary... but since we're using promises all over the place, it - // makes sense. The _P are just a promisified version of the methods. We could have - // overwritten the original methods but this way we make it explicit. That's also why we're - // breaking camelCase here, to make it patent to the reader that those aren't standard - // methods of the API. - ['startArchive', 'stopArchive', 'getArchive', 'listArchives', 'deleteArchive', 'dial', - 'forceDisconnect'] - .forEach((method) => otInstance[`${method}_P`] = promisify(otInstance[method])); // eslint-disable-line no-return-assign const maxSessionAge = config.get(C.OPENTOK_MAX_SESSION_AGE); const maxSessionAgeMs = maxSessionAge * 24 * 60 * 60 * 1000; @@ -221,8 +222,8 @@ function ServerMethods(aLogLevel, aModules) { ? `?icid=${config.get(C.CONTACT_US_ICID)}` : ''; return { - otInstance, - precallOtInstance, + vonageVideoInstance, + precallVonageVideoInstance, apiKey, apiSecret, precallApiKey, @@ -360,7 +361,7 @@ function ServerMethods(aLogLevel, aModules) { } serverPersistence .getKey(redisRoomPrefix + roomName) - .then(_getUsableSessionInfo.bind(tbConfig.otInstance, + .then(_getUsableSessionInfo.bind(tbConfig.vonageVideoInstance, tbConfig.maxSessionAgeMs, tbConfig.archiveAlways, tbConfig.mediaMode)) @@ -368,7 +369,7 @@ function ServerMethods(aLogLevel, aModules) { serverPersistence.setKeyEx(Math.round(tbConfig.maxSessionAgeMs / 1000), redisRoomPrefix + roomName, JSON.stringify(usableSessionInfo)); const { sessionId } = usableSessionInfo; - tbConfig.otInstance.listArchives_P({ offset: 0, count: 1000 }) + tbConfig.vonageVideoInstance.searchArchives({ offset: 0, count: 1000 }) .then((aArchives) => { const archive = aArchives .reduce((aLastArch, aCurrArch) => aCurrArch.sessionId === sessionId @@ -449,7 +450,7 @@ function ServerMethods(aLogLevel, aModules) { const country = getUserCountry(aReq); // Create a session ID and token for the network test - tbConfig.precallOtInstance.createSession({ mediaMode: 'routed' }, (error, testSession) => { + tbConfig.precallVonageVideoInstance.createSession({ mediaMode: 'routed' }).then((testSession) => { // We really don't want to cache this aRes.set('Cache-Control', 'no-cache, no-store, must-revalidate'); aRes.set('Pragma', 'no-cache'); @@ -484,9 +485,10 @@ function ServerMethods(aLogLevel, aModules) { precallSessionId: testSession.sessionId, apiKey: tbConfig.apiKey, precallApiKey: tbConfig.precallApiKey, - precallToken: tbConfig.precallOtInstance.generateToken(testSession.sessionId, { - role: 'publisher', - }), + precallToken: tbConfig.precallVonageVideoInstance.generateClientToken( + testSession.sessionId, + { role: 'publisher' }, + ), hasSip: tbConfig.enableSip, showTos: tbConfig.showTos, showUnavailable: !meetingAllowed, @@ -524,7 +526,7 @@ function ServerMethods(aLogLevel, aModules) { aRes.send(html); } }); - }); + }).catch((err) => console.log(33377, err)); } // Given a sessionInfo (which might be empty or non usable) returns a promise than will fullfill @@ -554,16 +556,14 @@ function ServerMethods(aLogLevel, aModules) { setAppUsage(usage.lastUpdate, ++usage.meetings); } }); - this - .createSession(sessionOptions, (error, session) => { - resolve({ - sessionId: session.sessionId, - lastUsage: Date.now(), - inProgressArchiveId: undefined, - isLocked: false, - }); - }); + .createSession(sessionOptions) + .then((session) => resolve({ + sessionId: session.sessionId, + lastUsage: Date.now(), + inProgressArchiveId: undefined, + isLocked: false, + })); } else { // We only need to update the last usage data... aSessionInfo.lastUsage = Date.now(); @@ -662,7 +662,7 @@ function ServerMethods(aLogLevel, aModules) { // Note that we do not persist tokens. serverPersistence .getKey(redisRoomPrefix + roomName) - .then(_getUsableSessionInfo.bind(tbConfig.otInstance, tbConfig.maxSessionAgeMs, + .then(_getUsableSessionInfo.bind(tbConfig.vonageVideoInstance, tbConfig.maxSessionAgeMs, tbConfig.archiveAlways, tbConfig.mediaMode)) .then((usableSessionInfo) => { // Update the database. We could do this on getUsable... @@ -672,8 +672,8 @@ function ServerMethods(aLogLevel, aModules) { // and finally, answer... const answer = { apiKey: tbConfig.apiKey, - token: tbConfig.otInstance - .generateToken(usableSessionInfo.sessionId, { + token: tbConfig.vonageVideoInstance + .generateClientToken(usableSessionInfo.sessionId, { role: 'publisher', data: JSON.stringify({ userName }), }), @@ -715,8 +715,8 @@ function ServerMethods(aLogLevel, aModules) { // be sure logger.log('_getUpdatedArchiveInfo: Getting update info for archive: ', aSessionInfo.inProgressArchiveId); - return aTbConfig.otInstance - .getArchive_P(aSessionInfo.inProgressArchiveId) + return aTbConfig.vonageVideoInstance + .getArchive(aSessionInfo.inProgressArchiveId) .then((aArchiveInfo) => { if (aArchiveInfo.status === 'started') { throw new ErrorInfo(102, 'Recording already in progress'); @@ -733,7 +733,7 @@ function ServerMethods(aLogLevel, aModules) { return aSessionInfo; }); } if (aOperation.startsWith('stop') && !aSessionInfo.inProgressArchiveId) { - return aTbConfig.otInstance.listArchives_P({ offset: 0, count: 100 }) + return aTbConfig.vonageVideoInstance.searchArchives({ offset: 0, count: 100 }) .then((aArch) => aArch.filter((aArchive) => aArchive.sessionId === aSessionInfo.sessionId)) .then((aArchives) => { const recordingInProgress = aArchives[0] && aArchives[0].status === 'started'; @@ -763,7 +763,7 @@ function ServerMethods(aLogLevel, aModules) { const roomName = aReq.params.roomName.toLowerCase(); const { userName } = body; const { operation } = body; - const { otInstance } = tbConfig; + const { vonageVideoInstance } = tbConfig; if (isInBlacklist(roomName)) { logger.log('postRoomArchive error:', `Blacklist found '${roomName}'`); @@ -792,12 +792,12 @@ function ServerMethods(aLogLevel, aModules) { case 'startComposite': logger.log('Binding archiveOp to startArchive with sessionId:', sessionInfo.sessionId); archiveOptions.resolution = '1280x720'; - archiveOp = otInstance - .startArchive_P.bind(otInstance, sessionInfo.sessionId, archiveOptions); + archiveOp = vonageVideoInstance + .startArchive(sessionInfo.sessionId, archiveOptions); break; case 'stop': - archiveOp = otInstance - .stopArchive_P.bind(otInstance, sessionInfo.inProgressArchiveId); + archiveOp = vonageVideoInstance + .stopArchive(sessionInfo.inProgressArchiveId); break; default: // no-op @@ -814,13 +814,13 @@ function ServerMethods(aLogLevel, aModules) { // or poll for the information. Since polling is less efficient, we do so only when // required by the configuration. const readyToUpdateDb = (operation === 'stop' && tbConfig.archivePollingTO - && _launchArchivePolling(otInstance, aArchive.id, + && _launchArchivePolling(vonageVideoInstance, aArchive.id, tbConfig.archivePollingTO, tbConfig.archivePollingTOMultiplier)) || Promise.resolve(aArchive); const roomArchiveStorage = new ArchiveLocalStorage( - otInstance, redisRoomPrefix + roomName, aArchive.sessionId, aLogLevel, + vonageVideoInstance, redisRoomPrefix + roomName, aArchive.sessionId, aLogLevel, ); readyToUpdateDb .then((aUpdatedArchive) => { @@ -847,8 +847,8 @@ function ServerMethods(aLogLevel, aModules) { const generatePreview = (aReq.query && aReq.query.generatePreview !== undefined); logger.log('getAchive:', archiveId, generatePreview); - aReq.tbConfig.otInstance - .getArchive_P(archiveId) + aReq.tbConfig.vonageVideoInstance + .getArchive(archiveId) .then((aArchive) => { if (!generatePreview) { aRes.redirect(301, aArchive.url); @@ -883,23 +883,23 @@ function ServerMethods(aLogLevel, aModules) { const { archiveId } = aReq.params; logger.log('deleteArchive:', archiveId); const { tbConfig } = aReq; - const { otInstance } = tbConfig; + const { vonageVideoInstance } = tbConfig; let sessionId; let type; const roomName = getRoomNameFromHeaders(aReq.headers); let roomArchiveStorage; - otInstance - .getArchive_P(archiveId) // This is only needed so we can get the sesionId + vonageVideoInstance + .getArchive(archiveId) // This is only needed so we can get the sesionId .then((aArchive) => { sessionId = aArchive.sessionId; type = aArchive.outputMode; roomArchiveStorage = new ArchiveLocalStorage( - otInstance, redisRoomPrefix + roomName, sessionId, aLogLevel, + vonageVideoInstance, redisRoomPrefix + roomName, sessionId, aLogLevel, ); return archiveId; }) - .then(otInstance.deleteArchive_P) + .then(vonageVideoInstance.deleteArchive) .then(() => roomArchiveStorage.removeArchive(archiveId)) .then(() => aRes.send({ id: archiveId, type })) .catch((e) => { @@ -932,7 +932,7 @@ function ServerMethods(aLogLevel, aModules) { .getKey(redisRoomPrefix + roomName, true) .then((sessionInfo) => { const { sessionId } = sessionInfo; - const token = tbConfig.otInstance.generateToken(sessionId, { + const token = tbConfig.vonageVideoInstance.generateClientToken(sessionId, { role: 'publisher', data: `{"sip":true, "role":"client", "name":"${phoneNumber}"}`, }); @@ -944,7 +944,7 @@ function ServerMethods(aLogLevel, aModules) { }, secure: false, }; - tbConfig.otInstance.dial_P(sessionId, token, sipUri, options) + tbConfig.vonageVideoInstance.dial(sessionId, token, sipUri, options) .then((sipCallData) => { const dialedNumberInfo = {}; dialedNumberInfo.sessionId = sipCallData.sessionId; @@ -976,7 +976,7 @@ function ServerMethods(aLogLevel, aModules) { if (!dialedNumberInfo || dialedNumberInfo.googleIdToken !== googleIdToken) { return aRes.status(400).send(new ErrorInfo(400, 'Unknown phone number.')); } - return tbConfig.otInstance.forceDisconnect_P(dialedNumberInfo.sessionId, + return tbConfig.vonageVideoInstance.disconnectClient(dialedNumberInfo.sessionId, dialedNumberInfo.connectionId).then(() => { serverPersistence.delKey(redisPhonePrefix + phoneNumber); return aRes.send({}); From 203dd2ad14c78558d97d1e10f0a0f757686df5d1 Mon Sep 17 00:00:00 2001 From: Jeff Swartz Date: Tue, 16 Aug 2022 12:28:02 -0700 Subject: [PATCH 02/26] README edits for Vonage application --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 74c504649..6c78cd3da 100644 --- a/README.md +++ b/README.md @@ -115,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 Vonage application ID and private key. -For example, the following shell commands export these values for use by the app -(replace `` and `` 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 +these values for use by the app (replace `` and `` with your +Vonage application ID and private key): ```sh -export TB_API_KEY= -export TB_API_SECRET= +export VONAGE_APPLICATION_ID= +export VONAGE_PRIVATE_KEY= ``` You can set other environment variables to enable and configure other options, From 710ba3a3169fa8af2bc5245b0e6e69ad73aeb2d9 Mon Sep 17 00:00:00 2001 From: Jeff Swartz Date: Tue, 16 Aug 2022 14:27:03 -0700 Subject: [PATCH 03/26] Update @vonage/video version --- package-lock.json | 48 ++++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1062232a6..44c9994fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -803,18 +803,17 @@ "dev": true }, "@vonage/auth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@vonage/auth/-/auth-0.2.0.tgz", - "integrity": "sha512-wJFUJM6vffutFDywaeumo2x2xEpTqRWHtPWi7JP2ynxA5D37TkTnJ0m6VBBMBkMoZ5u4MjtM19EwTIpipcJuaw==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@vonage/auth/-/auth-0.6.0.tgz", + "integrity": "sha512-vQ/h8P4srSBsYP8mmPtEHNw/gUMl5fVGV3snXSNinxSHlCz05n1Hiee+1ksrcRrIELu3+3rq2AyIUHWfSNrgDw==", "requires": { - "@vonage/jwt": "^0.2.0", - "crypto": "^1.0.1" + "@vonage/jwt": "^0.3.0" } }, "@vonage/jwt": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@vonage/jwt/-/jwt-0.2.0.tgz", - "integrity": "sha512-QcBWwpCydz6YAqI+DH2n/5OAYbbAd3GR/gueR+n9Zkj+R8Jr0jo999ypTNY9f/Ws+coWgJ+kmJhmLh/SCjf49w==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@vonage/jwt/-/jwt-0.3.0.tgz", + "integrity": "sha512-lhf9ykgwtROY8CRoB2lT2dY+YixiuxTrc8SCc+uvSwMo/tWGqtFWZMhnuZt84xD/QLgtOdnDCUxqiekZ/N21Iw==", "requires": { "jsonwebtoken": "^8.5.1", "uuid": "^8.3.2" @@ -827,23 +826,31 @@ } } }, + "@vonage/server-client": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@vonage/server-client/-/server-client-0.4.1.tgz", + "integrity": "sha512-eHB81WfsGzbQ9UiD4NNkwic2zIwSRbUB8rar72k9DkD6xQvUGAr51U+P2aW/3ziDVyxGkaNqkoa0Rr7AL0mjzA==", + "requires": { + "@vonage/auth": "^0.6.0", + "@vonage/jwt": "^0.3.0", + "@vonage/vetch": "^0.2.0" + } + }, "@vonage/vetch": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@vonage/vetch/-/vetch-0.1.0.tgz", - "integrity": "sha512-2wOUUyrKwjHR8NBICU8+/SeG9lBtkt0KOzqiTF6PrUNtKBE1pF8gtpgL5aTnfExxd4bf8goilpcb/FQPrfQ5tA==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@vonage/vetch/-/vetch-0.2.0.tgz", + "integrity": "sha512-GW1NHyyuiks2bPTOdACGu3SSaZ3Z+YVVkrm6as9MY4GhXFHbug7n8YNPhZCds76i0iw97PFt3xeqgS2qGQopPg==", "requires": { "lodash.merge": "^4.6.2", - "node-fetch": "^2.6.1" + "node-fetch": "^2.6" } }, "@vonage/video": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@vonage/video/-/video-0.7.0.tgz", - "integrity": "sha512-vUzWauuYSPY1Dkx7jQ0laZLMpjD/1H0U+JFU/RqkISWpsxuUMRHkHjIUcyRzOXkCH5bVoWkDwddZ9yCTnHcEQw==", + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/@vonage/video/-/video-0.8.3.tgz", + "integrity": "sha512-ernKCyue4Z0FuhcaGUn0VNsoMKBaw/b6RSdZhbe95AZwvts8M3RDcBTWLL3xfIgE9v7jAXG6Z5lMVLcdqvlKNA==", "requires": { - "@vonage/auth": "^0.2.0", - "@vonage/jwt": "^0.2.0", - "@vonage/vetch": "^0.1.0" + "@vonage/server-client": "^0.4.1" } }, "@wdio/cli": { @@ -4108,11 +4115,6 @@ } } }, - "crypto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/crypto/-/crypto-1.0.1.tgz", - "integrity": "sha512-VxBKmeNcqQdiUQUW2Tzq0t377b54N2bMtXO/qiLa+6eRRmmC4qT3D4OnTGoT/U6O9aklQ/jTwbOtRMTTY8G0Ig==" - }, "crypto-browserify": { "version": "3.12.0", "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", diff --git a/package.json b/package.json index 6bdb8ea6e..083393e0e 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ }, "homepage": "https://github.com/opentok/opentok-rtc/", "dependencies": { + "@vonage/video": "^0.8.3", "accepts": "^1.3.7", "bower": "^1.6.5", "cors": "^2.8.5", @@ -61,7 +62,6 @@ "http2": "^3.3.7", "ioredis": "^4.17.3", "lodash": "^4.17.20", - "@vonage/video": "^0.7.0", "qs": "^6.9.4", "swagger-boilerplate": "^0.1.6", "yamljs": "^0.3.0" From 6935eccde94e666d4e28e913fa38d91dfbc4dbf4 Mon Sep 17 00:00:00 2001 From: Jeff Swartz Date: Tue, 16 Aug 2022 14:27:56 -0700 Subject: [PATCH 04/26] Change the Vonage Video web client URL --- README.md | 7 +++---- server/serverConstants.js | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6c78cd3da..334efafad 100644 --- a/README.md +++ b/README.md @@ -204,10 +204,9 @@ There are other Vonage Video API configuration settings (each of which are optio 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`. diff --git a/server/serverConstants.js b/server/serverConstants.js index 1cde68c21..c61341b36 100644 --- a/server/serverConstants.js +++ b/server/serverConstants.js @@ -36,7 +36,7 @@ E.VONAGE_APPLICATION_ID = { envVar: 'VONAGE_APPLICATION_ID', jsonPath: 'Vonage.a E.VONAGE_PRIVATE_KEY = { envVar: 'VONAGE_PRIVATE_KEY', jsonPath: 'Vonage.privateKey', required: true }; E.OPENTOK_JS_URL = { - envVar: 'TB_JS_URL', jsonPath: 'OpenTok.jsUrl', required: false, defaultValue: 'https://static.opentok.com/v2/js/opentok.min.js', + envVar: 'TB_JS_URL', jsonPath: 'OpenTok.jsUrl', required: false, defaultValue: 'https://unpkg.com/@vonage/video-client@2/dist/js/opentok.js', }; // Sessions should not live forever. So we'll store the last time a session was used and if when From ea8f4a4071aef077a112073dc25a9e6d72f1bfcd Mon Sep 17 00:00:00 2001 From: Jeff Swartz Date: Thu, 18 Aug 2022 14:25:47 -0700 Subject: [PATCH 05/26] API tests for Vonage applications --- package.json | 1 + server/serverMethods.js | 2 +- test/api/server_spec.js | 11 +++---- test/mocks/mock_vonage.js | 68 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 8 deletions(-) create mode 100644 test/mocks/mock_vonage.js diff --git a/package.json b/package.json index 083393e0e..1f7665a80 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "dev": "concurrently \"npm run start\" \"grunt clientDev\"", "postinstall": "bower install && grunt clientBuild", "test": "grunt test", + "api-test": "grunt apiTest", "regression-test": "wdio run wdio.conf.js", "karma-test": "karma start karma.conf.js", "lint": "./node_modules/.bin/eslint .", diff --git a/server/serverMethods.js b/server/serverMethods.js index 11ceada91..e9d95d8b3 100644 --- a/server/serverMethods.js +++ b/server/serverMethods.js @@ -803,7 +803,7 @@ function ServerMethods(aLogLevel, aModules) { // no-op } logger.log('postRoomArchive: Invoking archiveOp. SessionInfo', sessionInfo); - return archiveOp().then((aArchive) => { + return archiveOp.then((aArchive) => { sessionInfo.inProgressArchiveId = aArchive.status === 'started' ? aArchive.id : undefined; // Update the internal database serverPersistence.setKey(redisRoomPrefix + roomName, JSON.stringify(sessionInfo)); diff --git a/test/api/server_spec.js b/test/api/server_spec.js index 27f947b34..d907f46e1 100644 --- a/test/api/server_spec.js +++ b/test/api/server_spec.js @@ -2,24 +2,24 @@ var chai = require('chai'); var request = require('supertest'); var { expect } = chai; +var MockVonage = require('../mocks/mock_vonage.js'); const TEST_LOG_LEVEL = 0; describe('OpenTokRTC server', () => { 'use strict'; - var app, MockOpentok; + var app; // Note that since everything is in api.yml, we could just parse // that and generate the test cases automatically. At the moment // it's more work than doing it manually though, so not worth it. before((done) => { - MockOpentok = require('../mocks/mock_opentok.js'); process.env.TEMPLATING_SECRET = '123456'; var mocks = { - Opentok: MockOpentok, + Vonage: MockVonage, }; // Note that this actually executes on the level where the Grunt file is @@ -44,15 +44,12 @@ describe('OpenTokRTC server', () => { }); }); - after(() => { - MockOpentok.restoreInstances(); - }); - // Note that everything needed to test this is actually in api.json, but it's not // really worth it at this point to try to do this generic. So for now we'll just do // it manually. function checkForAttributes(aAttributes, aRes) { var aObject = aRes.body; + // console.log(888, aAttributes[i], aRes.body) for (var i = 0, l = aAttributes.length; i < l; i++) { if (!aObject[aAttributes[i]]) { throw new Error('Missing required attribute: ' + aAttributes[i] diff --git a/test/mocks/mock_vonage.js b/test/mocks/mock_vonage.js new file mode 100644 index 000000000..8d10fc6dd --- /dev/null +++ b/test/mocks/mock_vonage.js @@ -0,0 +1,68 @@ +'use strict'; + +var sinon = require('sinon'); +var Vonage = require('@vonage/video'); + +var _archives = {}; + +function FakeArchive(aSessionId, aOptions, aStatus) { + var newArchive = { + createdAt: Date.now(), + duration: '100000', + id: aOptions.archiveId || String(Math.random() + '').replace('.', '_'), + name: aOptions.name || 'unnamed', + parnerId: '0xdeadcafe', + reason: 'unknown', + sessionId: aSessionId, + size: 1000, + status: aStatus, + hasAudio: true, + hasVideo: true, + outputMode: aOptions.outputMode || 'composite', + url: 'http://nothing.to.see/here', + }; + _archives[newArchive.id] = newArchive; + + return newArchive; +} + +var Video = function (applicationId, privateKey) { + return { + createSession: (aOptions) => { + var sessionInfo = { + sessionId: '1' + Math.random(), + }; + return Promise.resolve(sessionInfo); + }, + + generateClientToken: (aOptions) => 'tokentoken', + + getArchive: (aArchiveId) => { + if (_archives[aArchiveId]) { + return Promise.resolve(_archives[aArchiveId]); + } + return Promise.reject(new Error('test getArchive error')); + }, + + deleteArchive: (aArchiveId) => { + var archive = _archives[aArchiveId]; + if (archive) { + archive.status = 'deleted'; + return Promise.resolve(_archives[aArchiveId]); + } + return Promise.reject(new Error('test deleteArchive error')); + }, + + startArchive: (aSessionId, aArchiveOptions) => new Promise((resolve) => { + var archive = new FakeArchive(aSessionId, aArchiveOptions, 'started'); + setTimeout(resolve(archive), 100); + }), + + stopArchive: (aArchiveId) => new Promise((resolve) => { + var archive = new FakeArchive('testSessionId', {}, 'stopped'); + setTimeout(resolve(archive), 100); + }), + }; +}; + +module.exports = { Video }; From 4c08e1d382e08f64b7dff6b6f02c5d628cfb6bcd Mon Sep 17 00:00:00 2001 From: Jeff Swartz Date: Tue, 4 Oct 2022 18:18:44 -0700 Subject: [PATCH 06/26] README info on OpenTok.js URL (to https://unpkg.com/@vonage...) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 334efafad..7e614bcf7 100644 --- a/README.md +++ b/README.md @@ -234,7 +234,7 @@ The config.json setting is `mediaMode`. The environment variable name is `MEDIA_ "apiKey": "", "apiSecret": "", "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" @@ -245,7 +245,7 @@ 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"; ``` From aa347718cffba6d29ddd78ea051ad85925a09dd4 Mon Sep 17 00:00:00 2001 From: Jeff Swartz Date: Tue, 4 Oct 2022 18:31:57 -0700 Subject: [PATCH 07/26] update to latest @vonage/video SDK Requires Node 14+. Fixes fixes missing connection data in web client. --- .nvmrc | 2 +- package-lock.json | 22 +++++++++++----------- package.json | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.nvmrc b/.nvmrc index dae199aec..958b5a36e 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v12 +v14 diff --git a/package-lock.json b/package-lock.json index 44c9994fb..6c0eb8a09 100644 --- a/package-lock.json +++ b/package-lock.json @@ -827,30 +827,30 @@ } }, "@vonage/server-client": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@vonage/server-client/-/server-client-0.4.1.tgz", - "integrity": "sha512-eHB81WfsGzbQ9UiD4NNkwic2zIwSRbUB8rar72k9DkD6xQvUGAr51U+P2aW/3ziDVyxGkaNqkoa0Rr7AL0mjzA==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@vonage/server-client/-/server-client-0.5.0.tgz", + "integrity": "sha512-IwEhlSnEPaKAz86G5dTrVotDulOLuNz99cTtVdAnkivbt10cErwHnKGLTXlxQYgW8EpJ0DvXNnYzeryrc3AmMw==", "requires": { "@vonage/auth": "^0.6.0", "@vonage/jwt": "^0.3.0", - "@vonage/vetch": "^0.2.0" + "@vonage/vetch": "^0.3.1" } }, "@vonage/vetch": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@vonage/vetch/-/vetch-0.2.0.tgz", - "integrity": "sha512-GW1NHyyuiks2bPTOdACGu3SSaZ3Z+YVVkrm6as9MY4GhXFHbug7n8YNPhZCds76i0iw97PFt3xeqgS2qGQopPg==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@vonage/vetch/-/vetch-0.3.1.tgz", + "integrity": "sha512-cXXsMQlNTJhsCMfM17zoyBo5NLdXtu+BX6tBaLyGF/rx/p9bBMTxemuJBk/ljjGFpg7KgYhpVnFolbXIlPa5Gg==", "requires": { "lodash.merge": "^4.6.2", "node-fetch": "^2.6" } }, "@vonage/video": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/@vonage/video/-/video-0.8.3.tgz", - "integrity": "sha512-ernKCyue4Z0FuhcaGUn0VNsoMKBaw/b6RSdZhbe95AZwvts8M3RDcBTWLL3xfIgE9v7jAXG6Z5lMVLcdqvlKNA==", + "version": "0.8.9", + "resolved": "https://registry.npmjs.org/@vonage/video/-/video-0.8.9.tgz", + "integrity": "sha512-lCprTZaHpQs/lBJjEqacqkkEDQwGZmzTl4GkOm5iZlM75zvdmcYuezNURuKvXHg/PwEXMxJ0Indke51eYEvUWg==", "requires": { - "@vonage/server-client": "^0.4.1" + "@vonage/server-client": "^0.5.0" } }, "@wdio/cli": { diff --git a/package.json b/package.json index 1f7665a80..92044e1f8 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ }, "homepage": "https://github.com/opentok/opentok-rtc/", "dependencies": { - "@vonage/video": "^0.8.3", + "@vonage/video": "^0.8.9", "accepts": "^1.3.7", "bower": "^1.6.5", "cors": "^2.8.5", From 7eb656172fa20146f6775708f9269091016a569c Mon Sep 17 00:00:00 2001 From: Jeff Swartz Date: Tue, 4 Oct 2022 19:04:24 -0700 Subject: [PATCH 08/26] Remove separate App ID for precall test And remove incorrect info in README about precall test not being supported. --- README.md | 20 -------------------- server/serverConstants.js | 4 ---- server/serverMethods.js | 9 ++------- views/room.ejs | 1 - web/js/precallController.js | 2 +- 5 files changed, 3 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 7e614bcf7..f208c5e37 100644 --- a/README.md +++ b/README.md @@ -521,26 +521,6 @@ export ENABLE_FEEDBACK=true; ### Pre-call test -**Important:** The pre-call test is not currently supported for Vonage applications. - -Set the the `TB_PRECALL_API_KEY` and `TB_PRECALL_API_SECRET` environment variables -to the the Vonage application ID and private keys 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": "", - "apiSecret": "", - } -} -``` - -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: diff --git a/server/serverConstants.js b/server/serverConstants.js index c61341b36..9f55f781c 100644 --- a/server/serverConstants.js +++ b/server/serverConstants.js @@ -27,10 +27,6 @@ E.OPENTOK_API_KEY = { envVar: 'TB_API_KEY', jsonPath: 'OpenTok.apiKey', required E.OPENTOK_API_SECRET = { envVar: 'TB_API_SECRET', jsonPath: 'OpenTok.apiSecret', required: true }; -E.OPENTOK_PRECALL_API_KEY = { envVar: 'TB_PRECALL_API_KEY', jsonPath: 'precallTest.apiKey' }; - -E.OPENTOK_PRECALL_API_SECRET = { envVar: 'TB_PRECALL_API_SECRET', jsonPath: 'precallTest.apiSecret' }; - E.VONAGE_APPLICATION_ID = { envVar: 'VONAGE_APPLICATION_ID', jsonPath: 'Vonage.applicationId', required: true }; E.VONAGE_PRIVATE_KEY = { envVar: 'VONAGE_PRIVATE_KEY', jsonPath: 'Vonage.privateKey', required: true }; diff --git a/server/serverMethods.js b/server/serverMethods.js index e9d95d8b3..8a614d721 100644 --- a/server/serverMethods.js +++ b/server/serverMethods.js @@ -129,8 +129,6 @@ function ServerMethods(aLogLevel, aModules) { const templatingSecret = config.get(C.TEMPLATING_SECRET); const apiKey = config.get(C.VONAGE_APPLICATION_ID) || config.get(C.OPENTOK_API_KEY); const apiSecret = config.get(C.VONAGE_PRIVATE_KEY); - const precallApiKey = config.get(C.VONAGE_APPLICATION_ID); - const precallApiSecret = config.get(C.VONAGE_PRIVATE_KEY); const opentokJsUrl = config.get(C.OPENTOK_JS_URL); const useGoogleFonts = config.get(C.USE_GOOGLE_FONTS); const jqueryUrl = config.get(C.JQUERY_URL); @@ -147,8 +145,8 @@ function ServerMethods(aLogLevel, aModules) { const precallVonageVideoInstance = Utils.CachifiedObject( Vonage.Video, { - applicationId: precallApiKey, - privateKey: precallApiSecret, + applicationId: apiKey, + privateKey: apiSecret, }, ); @@ -226,8 +224,6 @@ function ServerMethods(aLogLevel, aModules) { precallVonageVideoInstance, apiKey, apiSecret, - precallApiKey, - precallApiSecret, archivePollingTO, archivePollingTOMultiplier, maxSessionAgeMs, @@ -484,7 +480,6 @@ function ServerMethods(aLogLevel, aModules) { feedbackUrl: tbConfig.feedbackUrl, precallSessionId: testSession.sessionId, apiKey: tbConfig.apiKey, - precallApiKey: tbConfig.precallApiKey, precallToken: tbConfig.precallVonageVideoInstance.generateClientToken( testSession.sessionId, { role: 'publisher' }, diff --git a/views/room.ejs b/views/room.ejs index 15c6ef703..da16a4c5f 100755 --- a/views/room.ejs +++ b/views/room.ejs @@ -70,7 +70,6 @@ <% } %> <% } %>