Compare commits

...

30 Commits

Author SHA1 Message Date
Dave Horton
480e1155f3 0.7.2 version 2022-01-28 09:16:51 -05:00
Dave Horton
75e7c1058b lint 2022-01-27 15:31:11 -05:00
Dave Horton
a5e4fafda4 minor 2022-01-27 15:26:09 -05:00
Dave Horton
2e041df6e4 update deps 2022-01-27 09:04:54 -05:00
Snyk bot
3ee82d6c8c fix: upgrade passport from 0.5.0 to 0.5.2 (#24)
Snyk has created this PR to upgrade passport from 0.5.0 to 0.5.2.

See this package in npm:
https://www.npmjs.com/package/passport

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-27 08:33:19 -05:00
Snyk bot
d396c5b252 fix: upgrade aws-sdk from 2.1048.0 to 2.1049.0 (#26)
Snyk has created this PR to upgrade aws-sdk from 2.1048.0 to 2.1049.0.

See this package in npm:
https://www.npmjs.com/package/aws-sdk

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-27 08:32:04 -05:00
Snyk bot
daef0ee215 fix: upgrade form-urlencoded from 6.0.4 to 6.0.5 (#27)
Snyk has created this PR to upgrade form-urlencoded from 6.0.4 to 6.0.5.

See this package in npm:
https://www.npmjs.com/package/form-urlencoded

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-27 08:30:45 -05:00
Snyk bot
1d168e93e1 fix: package.json & package-lock.json to reduce vulnerabilities (#28)
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-SWAGGERUIDIST-2314884
2022-01-27 08:30:30 -05:00
dependabot[bot]
605a0e762f Bump node-fetch from 2.6.1 to 2.6.7 (#30)
Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.1 to 2.6.7.
- [Release notes](https://github.com/node-fetch/node-fetch/releases)
- [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.1...v2.6.7)

---
updated-dependencies:
- dependency-name: node-fetch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-27 08:30:16 -05:00
Dave Horton
c9bf943656 initial changes to support wellsaid tts (#29) 2022-01-27 08:17:51 -05:00
Snyk bot
3aac11560a fix: upgrade mysql2 from 2.2.5 to 2.3.3 (#20)
Snyk has created this PR to upgrade mysql2 from 2.2.5 to 2.3.3.

See this package in npm:
https://www.npmjs.com/package/mysql2

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-23 19:53:19 -05:00
Snyk bot
bb4a20a375 fix: upgrade form-data from 2.3.3 to 2.5.1 (#22)
Snyk has created this PR to upgrade form-data from 2.3.3 to 2.5.1.

See this package in npm:
https://www.npmjs.com/package/form-data

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-23 19:52:55 -05:00
Snyk bot
45c4c626f2 fix: upgrade @google-cloud/text-to-speech from 3.2.2 to 3.4.0 (#19)
Snyk has created this PR to upgrade @google-cloud/text-to-speech from 3.2.2 to 3.4.0.

See this package in npm:
https://www.npmjs.com/package/@google-cloud/text-to-speech

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-23 19:52:39 -05:00
Snyk bot
65e6d75f72 fix: upgrade debug from 4.3.1 to 4.3.3 (#23)
Snyk has created this PR to upgrade debug from 4.3.1 to 4.3.3.

See this package in npm:
https://www.npmjs.com/package/debug

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-23 19:52:15 -05:00
Snyk bot
c6bb273aa0 fix: upgrade aws-sdk from 2.929.0 to 2.1048.0 (#14)
Snyk has created this PR to upgrade aws-sdk from 2.929.0 to 2.1048.0.

See this package in npm:
https://www.npmjs.com/package/aws-sdk

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-22 20:34:31 -05:00
Snyk bot
256b295be1 fix: upgrade stripe from 8.155.0 to 8.195.0 (#15)
Snyk has created this PR to upgrade stripe from 8.155.0 to 8.195.0.

See this package in npm:
https://www.npmjs.com/package/stripe

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-22 20:34:14 -05:00
Snyk bot
693ba51339 fix: upgrade mailgun.js from 3.4.0 to 3.7.3 (#16)
Snyk has created this PR to upgrade mailgun.js from 3.4.0 to 3.7.3.

See this package in npm:
https://www.npmjs.com/package/mailgun.js

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-22 20:33:58 -05:00
Snyk bot
531366ee58 fix: upgrade @google-cloud/speech from 4.5.2 to 4.9.0 (#17)
Snyk has created this PR to upgrade @google-cloud/speech from 4.5.2 to 4.9.0.

See this package in npm:
https://www.npmjs.com/package/@google-cloud/speech

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-22 20:33:14 -05:00
Snyk bot
a36604029c fix: upgrade @jambonz/realtimedb-helpers from 0.4.3 to 0.4.14 (#18)
Snyk has created this PR to upgrade @jambonz/realtimedb-helpers from 0.4.3 to 0.4.14.

See this package in npm:
https://www.npmjs.com/package/@jambonz/realtimedb-helpers

See this project in Snyk:
https://app.snyk.io/org/davehorton/project/b7e09765-19b2-4aa5-90ba-10432e250041?utm_source=github&utm_medium=referral&page=upgrade-pr
2022-01-22 20:32:36 -05:00
Dave Horton
63a88844aa add package-lock.json 2022-01-21 22:04:30 -05:00
Dave Horton
24f6833493 fix test on mac 2022-01-21 09:58:49 -05:00
Dave Horton
4119d766d5 Dockerfile change 2021-12-21 20:51:02 -05:00
Dave Horton
936a9da887 dockerfile change 2021-12-21 09:52:27 -05:00
Dave Horton
77098f273d bump version 2021-12-21 09:43:27 -05:00
Dave Horton
e27b5a39a6 Dockerfile 2021-12-17 13:49:59 -05:00
Dave Horton
66872494f9 added docker publish 2021-12-13 14:27:23 -05:00
Dave Horton
4557b32804 added docker publish 2021-12-13 14:18:34 -05:00
Dave Horton
e55fe77171 version bump 2021-12-13 09:54:53 -05:00
Dave Horton
0fd87a732f need to provide status ENABLED when creating a subspace teleport 2021-12-08 20:11:15 -05:00
Dave Horton
f6d358d3df Subspace (#12)
* changes for subspace (via nimbleape)

* changes from more testing

* working api to subspace

* more subspace fixes

* further subspace fixes
2021-12-07 07:40:50 -05:00
16 changed files with 11018 additions and 38 deletions

View File

@@ -0,0 +1,51 @@
name: Docker
on:
push:
# Publish `main` as Docker `latest` image.
branches:
- main
# Publish `v1.2.3` tags as releases.
tags:
- v*
env:
IMAGE_NAME: db-create
jobs:
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Build image
run: docker build . --file Dockerfile.db-create --tag $IMAGE_NAME
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION

51
.github/workflows/docker-publish.yml vendored Normal file
View File

@@ -0,0 +1,51 @@
name: Docker
on:
push:
# Publish `main` as Docker `latest` image.
branches:
- main
# Publish `v1.2.3` tags as releases.
tags:
- v*
env:
IMAGE_NAME: api-server
jobs:
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v2
- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION

1
.gitignore vendored
View File

@@ -1,7 +1,6 @@
# Logs
logs
*.log
package-lock.json
# Runtime data
pids

View File

@@ -1,4 +1,4 @@
FROM node:16
FROM node:17
WORKDIR /opt/app/
COPY package.json ./
RUN npm install

View File

@@ -1,4 +1,4 @@
FROM node:16
FROM node:17
WORKDIR /opt/app/
COPY package.json ./
RUN npm install

View File

@@ -418,6 +418,10 @@ disable_cdrs BOOLEAN NOT NULL DEFAULT 0,
trial_end_date DATETIME,
deactivated_reason VARCHAR(255),
device_to_call_ratio INTEGER NOT NULL DEFAULT 5,
subspace_client_id VARCHAR(255),
subspace_client_secret VARCHAR(255),
subspace_sip_teleport_id VARCHAR(255),
subspace_sip_teleport_destinations VARCHAR(255),
PRIMARY KEY (account_sid)
) COMMENT='An enterprise that uses the platform for comm services';

File diff suppressed because one or more lines are too long

View File

@@ -296,7 +296,23 @@ Account.fields = [
{
name: 'disable_cdrs',
type: 'number',
}
},
{
name: 'subspace_client_id',
type: 'string',
},
{
name: 'subspace_client_secret',
type: 'string',
},
{
name: 'subspace_sip_teleport_id',
type: 'string',
},
{
name: 'subspace_sip_teleport_destinations',
type: 'string',
},
];
module.exports = Account;

View File

@@ -12,7 +12,7 @@ const uuidv4 = require('uuid/v4');
const snakeCase = require('../../utils/snake-case');
const sysError = require('../error');
const {promisePool} = require('../../db');
const {hasAccountPermissions, parseAccountSid} = require('./utils');
const {hasAccountPermissions, parseAccountSid, enableSubspace, disableSubspace} = require('./utils');
const short = require('short-uuid');
const VoipCarrier = require('../../models/voip-carrier');
const translator = short();
@@ -371,6 +371,58 @@ router.get('/:sid/WebhookSecret', async(req, res) => {
}
});
router.post('/:sid/SubspaceTeleport', async(req, res) => {
const logger = req.app.locals.logger;
try {
const service_provider_sid = req.user.hasServiceProviderAuth ? req.user.service_provider_sid : null;
const results = await Account.retrieve(req.params.sid, service_provider_sid);
if (results.length === 0) return res.status(404).end();
const {subspace_client_id, subspace_client_secret} = results[0];
const {destination} = req.body;
const arr = /^(.*):\d+$/.exec(destination);
const dest = arr ? `sip:${arr[1]}` : `sip:${destination}`;
const teleport = await enableSubspace({
subspace_client_id,
subspace_client_secret,
destination: dest
});
logger.info({destination, teleport}, 'SubspaceTeleport - create teleport');
await Account.update(req.params.sid, {
subspace_sip_teleport_id: teleport.id,
subspace_sip_teleport_destinations: JSON.stringify(teleport.teleport_entry_points)//hacky
});
return res.status(200).json({
subspace_sip_teleport_id: teleport.id,
subspace_sip_teleport_destinations: teleport.teleport_entry_points
});
}
catch (err) {
sysError(logger, res, err);
}
});
router.delete('/:sid/SubspaceTeleport', async(req, res) => {
const logger = req.app.locals.logger;
try {
const service_provider_sid = req.user.hasServiceProviderAuth ? req.user.service_provider_sid : null;
const results = await Account.retrieve(req.params.sid, service_provider_sid);
if (results.length === 0) return res.status(404).end();
const {subspace_client_id, subspace_client_secret, subspace_sip_teleport_id} = results[0];
await disableSubspace({subspace_client_id, subspace_client_secret, subspace_sip_teleport_id});
await Account.update(req.params.sid, {
subspace_sip_teleport_id: null,
subspace_sip_teleport_destinations: null
});
return res.sendStatus(204);
}
catch (err) {
sysError(logger, res, err);
}
});
/* update */
router.put('/:sid', async(req, res) => {
const sid = req.params.sid;

View File

@@ -10,7 +10,8 @@ const {
testAwsTts,
testAwsStt,
testMicrosoftStt,
testMicrosoftTts
testMicrosoftTts,
testWellSaidTts
} = require('../../utils/speech-utils');
router.post('/', async(req, res) => {
@@ -66,6 +67,12 @@ router.post('/', async(req, res) => {
});
encrypted_credential = encrypt(data);
}
else if (vendor === 'wellsaid') {
const data = JSON.stringify({
api_key
});
encrypted_credential = encrypt(data);
}
else throw new DbErrorBadRequest(`invalid speech vendor ${vendor}`);
const uuid = await SpeechCredential.make({
account_sid,
@@ -109,6 +116,10 @@ router.get('/', async(req, res) => {
obj.api_key = o.api_key;
obj.region = o.region;
}
else if ('wellsaid' === obj.vendor) {
const o = decrypt(credential);
obj.api_key = o.api_key;
}
return obj;
}));
} catch (err) {
@@ -291,6 +302,19 @@ router.get('/:sid/test', async(req, res) => {
}
}
}
else if (cred.vendor === 'wellsaid') {
const {api_key} = credential;
if (cred.use_for_tts) {
try {
await testWellSaidTts(logger, {api_key});
results.tts.status = 'ok';
SpeechCredential.ttsTestResult(sid, true);
} catch (err) {
results.tts = {status: 'fail', reason: err.message};
SpeechCredential.ttsTestResult(sid, false);
}
}
}
res.status(200).json(results);
} catch (err) {
sysError(logger, res, err);

View File

@@ -1,4 +1,5 @@
const uuid = require('uuid').v4;
const bent = require('bent');
const Account = require('../../models/account');
const {promisePool} = require('../../db');
const {cancelSubscription, detachPaymentMethod} = require('../../utils/stripe-utils');
@@ -9,6 +10,8 @@ values (?, ?)`;
const replaceOldSubscriptionSql = `UPDATE account_subscriptions
SET effective_end_date = CURRENT_TIMESTAMP, change_reason = ?
WHERE account_subscription_sid = ?`;
//const request = require('request');
//require('request-debug')(request);
const setupFreeTrial = async(logger, account_sid, isReturningUser) => {
const sid = uuid();
@@ -224,6 +227,52 @@ const checkLimits = async(req, res, next) => {
next();
};
const getSubspaceJWT = async(id, secret) => {
const postJwt = bent('https://id.subspace.com', 'POST', 'json', 200);
const jwt = await postJwt('/oauth/token',
{
client_id: id,
client_secret: secret,
audience: 'https://api.subspace.com/',
grant_type: 'client_credentials',
}
);
return jwt.access_token;
};
const enableSubspace = async(opts) => {
const {subspace_client_id, subspace_client_secret, destination} = opts;
const accessToken = await getSubspaceJWT(subspace_client_id, subspace_client_secret);
const postTeleport = bent('https://api.subspace.com', 'POST', 'json', 200);
const teleport = await postTeleport('/v1/sipteleport',
{
name: 'Jambonz',
destination,
status: 'ENABLED'
},
{
'Content-Type': 'application/json',
Authorization: `Bearer ${accessToken}`
}
);
return teleport;
};
const disableSubspace = async(opts) => {
const {subspace_client_id, subspace_client_secret, subspace_sip_teleport_id} = opts;
const accessToken = await getSubspaceJWT(subspace_client_id, subspace_client_secret);
const relativeUrl = `/v1/sipteleport/${subspace_sip_teleport_id}`;
const deleteTeleport = bent('https://api.subspace.com', 'DELETE', 'json', 200);
await deleteTeleport(relativeUrl, {},
{
Authorization: `Bearer ${accessToken}`
}
);
return;
};
module.exports = {
setupFreeTrial,
createTestCdrs,
@@ -232,5 +281,7 @@ module.exports = {
parseServiceProviderSid,
hasAccountPermissions,
hasServiceProviderPermissions,
checkLimits
checkLimits,
enableSubspace,
disableSubspace
};

View File

@@ -75,11 +75,37 @@ const testMicrosoftStt = async(logger, credentials) => {
return true;
};
const testWellSaidTts = async(logger, credentials) => {
const {api_key} = credentials;
try {
const post = bent('https://api.wellsaidlabs.com', 'POST', 'buffer', {
'X-Api-Key': api_key,
'Accept': 'audio/mpeg',
'Content-Type': 'application/json'
});
const mp3 = await post('/v1/tts/stream', {
text: 'Hello, world',
speaker_id: '3'
});
return mp3;
} catch (err) {
logger.info({err}, 'testWellSaidTts returned error');
throw err;
}
};
const testWellSaidStt = async(logger, credentials) => {
//TODO
return true;
};
module.exports = {
testGoogleTts,
testGoogleStt,
testAwsTts,
testWellSaidTts,
testAwsStt,
testMicrosoftTts,
testMicrosoftStt
testMicrosoftStt,
testWellSaidStt,
};

10660
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,11 @@
{
"name": "jambonz-api-server",
"version": "v0.6.7-rc8",
"version": "v0.7.2",
"description": "",
"main": "app.js",
"scripts": {
"start": "node app.js",
"test": "NODE_ENV=test APPLY_JAMBONZ_DB_LIMITS=1 JWT_SECRET=foobarbazzle JAMBONES_MYSQL_HOST=127.0.0.1 JAMBONES_MYSQL_PORT=3360 JAMBONES_MYSQL_USER=jambones_test JAMBONES_MYSQL_PASSWORD=jambones_test JAMBONES_MYSQL_DATABASE=jambones_test JAMBONES_REDIS_HOST=localhost JAMBONES_REDIS_PORT=16379 JAMBONES_TIME_SERIES_HOST=127.0.0.1 JAMBONES_LOGLEVEL=error JAMBONES_CREATE_CALL_URL=http://localhost/v1/createCall node test/ ",
"test": "NODE_ENV=test APPLY_JAMBONZ_DB_LIMITS=1 JWT_SECRET=foobarbazzle JAMBONES_MYSQL_HOST=127.0.0.1 JAMBONES_MYSQL_PORT=3360 JAMBONES_MYSQL_USER=jambones_test JAMBONES_MYSQL_PASSWORD=jambones_test JAMBONES_MYSQL_DATABASE=jambones_test JAMBONES_REDIS_HOST=localhost JAMBONES_REDIS_PORT=16379 JAMBONES_TIME_SERIES_HOST=127.0.0.1 JAMBONES_LOGLEVEL=info JAMBONES_CREATE_CALL_URL=http://localhost/v1/createCall node test/ ",
"integration-test": "NODE_ENV=test JAMBONES_TIME_SERIES_HOST=127.0.0.1 AWS_REGION='us-east-1' JAMBONES_CURRENCY=USD JWT_SECRET=foobarbazzle JAMBONES_MYSQL_HOST=127.0.0.1 JAMBONES_MYSQL_PORT=3360 JAMBONES_MYSQL_USER=jambones_test JAMBONES_MYSQL_PASSWORD=jambones_test JAMBONES_MYSQL_DATABASE=jambones_test JAMBONES_REDIS_HOST=localhost JAMBONES_REDIS_PORT=16379 JAMBONES_LOGLEVEL=debug JAMBONES_CREATE_CALL_URL=http://localhost/v1/createCall node test/serve-integration.js",
"upgrade-db": "node ./db/upgrade-jambonz-db.js",
"coverage": "./node_modules/.bin/nyc --reporter html --report-dir ./coverage npm run test",
@@ -17,29 +17,30 @@
"url": "https://github.com/jambonz/jambonz-api-server.git"
},
"dependencies": {
"@google-cloud/speech": "^4.2.0",
"@google-cloud/text-to-speech": "^3.1.3",
"microsoft-cognitiveservices-speech-sdk": "^1.19.0",
"@jambonz/db-helpers": "^0.6.12",
"@jambonz/realtimedb-helpers": "^0.4.3",
"@jambonz/time-series": "^0.1.5",
"@google-cloud/speech": "^4.9.0",
"@google-cloud/text-to-speech": "^3.4.0",
"@jambonz/db-helpers": "^0.6.16",
"@jambonz/realtimedb-helpers": "^0.4.17",
"@jambonz/time-series": "^0.1.6",
"argon2-ffi": "^2.0.0",
"aws-sdk": "^2.839.0",
"aws-sdk": "^2.1049.0",
"bent": "^7.3.12",
"cors": "^2.8.5",
"debug": "^4.3.1",
"debug": "^4.3.3",
"express": "^4.17.1",
"form-data": "^2.3.3",
"form-urlencoded": "^6.0.4",
"form-data": "^2.5.1",
"form-urlencoded": "^6.0.5",
"jsonwebtoken": "^8.5.1",
"mailgun.js": "^3.3.0",
"mysql2": "^2.2.5",
"passport": "^0.5.0",
"mailgun.js": "^3.7.3",
"microsoft-cognitiveservices-speech-sdk": "^1.19.0",
"mysql2": "^2.3.3",
"passport": "^0.5.2",
"passport-http-bearer": "^1.0.1",
"pino": "^5.17.0",
"request-debug": "^0.2.0",
"short-uuid": "^4.1.0",
"stripe": "^8.138.0",
"swagger-ui-express": "^4.1.6",
"stripe": "^8.195.0",
"swagger-ui-express": "^4.3.0",
"uuid": "^3.4.0",
"yamljs": "^0.3.0"
},

View File

@@ -10,6 +10,7 @@ networks:
services:
mysql:
platform: linux/x86_64
image: mysql:5.7
ports:
- "3360:3306"
@@ -35,7 +36,8 @@ services:
ipv4_address: 172.58.0.3
influxdb:
image: influxdb:1.8-alpine
platform: linux/x86_64
image: influxdb:1.8
ports:
- "8086:8086"
networks:

View File

@@ -133,6 +133,30 @@ test('speech credentials tests', async(t) => {
json: true,
});
console.log(JSON.stringify(result));
}
/* add a credential for wellsaid */
if (process.env.WELLSAID_API_KEY) {
result = await request.post(`/Accounts/${account_sid}/SpeechCredentials`, {
resolveWithFullResponse: true,
auth: authUser,
json: true,
body: {
vendor: 'wellsaid',
use_for_tts: true,
api_key: process.env.WELLSAID_API_KEY
}
});
t.ok(result.statusCode === 201, 'successfully added speech credential');
const ms_sid = result.body.sid;
/* test the speech credential */
result = await request.get(`/Accounts/${account_sid}/SpeechCredentials/${ms_sid}/test`, {
resolveWithFullResponse: true,
auth: authUser,
json: true,
});
console.log(JSON.stringify(result));
/* delete the credential */
result = await request.delete(`/Accounts/${account_sid}/SpeechCredentials/${ms_sid}`, {
@@ -144,7 +168,6 @@ test('speech credentials tests', async(t) => {
await deleteObjectBySid(request, '/Accounts', account_sid);
await deleteObjectBySid(request, '/ServiceProviders', service_provider_sid);
//t.end();
}
catch (err) {