Compare commits

...

4 Commits

Author SHA1 Message Date
Hoan Luu Huu
10159a0ba6 fix azure tts test from speech-utils (#272)
* fix azure tts test from speech-utils

* wip
2023-12-06 22:10:55 -05:00
Hoan Luu Huu
7a558c7349 update speech utils version (#270) 2023-12-05 20:48:19 -05:00
Hoan Luu Huu
4dbe7af9db fix list registered user does not have registered_status field (#268) 2023-12-05 07:44:43 -05:00
Hoan Luu Huu
4ec34faa29 support inband dtmf (#261)
* support inband dtmf

* support inband dtmf

* wip
2023-12-02 11:31:07 -05:00
6 changed files with 2356 additions and 47 deletions

2
app.js
View File

@@ -53,7 +53,7 @@ const {
getTtsSize,
purgeTtsCache,
synthAudio
} = require('@jambonz/speech-utils')({redis_client: client}, logger);
} = require('@jambonz/speech-utils')({}, logger);
const {
lookupAppBySid,
lookupAccountBySid,

View File

@@ -187,13 +187,12 @@ router.post('/:sid/RegisteredSipUsers', async(req, res) => {
name: u,
contact: null,
expiryTime: 0,
protocol: null,
registered_status: 'inactive'
protocol: null
};
delete user.sbcAddress;
ret.push({
name: u,
...user
...user,
registered_status: user.expiryTime > 0 ? 'active' : 'inactive',
});
}
res.status(200).json(ret);
@@ -265,7 +264,8 @@ function validateUpdateCall(opts) {
'mute_status',
'sip_request',
'record',
'tag'
'tag',
'dtmf'
]
.reduce((acc, prop) => (opts[prop] ? ++acc : acc), 0);
@@ -307,6 +307,9 @@ function validateUpdateCall(opts) {
if (opts.record && !opts.record.action) {
throw new DbErrorBadRequest('record requires action property');
}
if (opts.dtmf && !opts.dtmf.digit) {
throw new DbErrorBadRequest('invalid dtmf');
}
if ('startCallRecording' === opts.record?.action && !opts.record.siprecServerURL) {
throw new DbErrorBadRequest('record requires siprecServerURL property when starting recording');
}

View File

@@ -556,7 +556,7 @@ router.get('/:sid/test', async(req, res) => {
} = credential;
if (cred.use_for_tts) {
try {
await testMicrosoftTts(logger, {
await testMicrosoftTts(logger, synthAudio, {
api_key,
region,
use_custom_tts,

View File

@@ -150,38 +150,19 @@ const testAwsStt = async(logger, credentials) => {
}
};
const testMicrosoftTts = async(logger, credentials) => {
const {
api_key,
region,
// eslint-disable-next-line no-unused-vars
use_custom_tts,
// eslint-disable-next-line no-unused-vars
custom_tts_endpoint,
// eslint-disable-next-line no-unused-vars
use_custom_stt,
// eslint-disable-next-line no-unused-vars
custom_stt_endpoint
} = credentials;
logger.info({
api_key,
region,
use_custom_tts,
custom_tts_endpoint,
use_custom_stt,
custom_stt_endpoint
}, 'testing microsoft tts');
if (!api_key) throw new Error('testMicrosoftTts: credentials are missing api_key');
if (!region) throw new Error('testMicrosoftTts: credentials are missing region');
const testMicrosoftTts = async(logger, synthAudio, credentials) => {
try {
const getJSON = bent('json', {
'Ocp-Apim-Subscription-Key': api_key
});
const response = await getJSON(`https://${region}.tts.speech.microsoft.com/cognitiveservices/voices/list`);
return response;
await synthAudio({increment: () => {}, histogram: () => {}},
{
vendor: 'microsoft',
credentials,
language: 'en-US',
voice: 'en-US-JennyMultilingualNeural',
text: 'Hi there and welcome to jambones!'
}
);
} catch (err) {
logger.info({err}, `testMicrosoftTts - failed to list voices for region ${region}`);
logger.info({err}, 'testMicrosoftTts returned error');
throw err;
}
};

2343
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -29,7 +29,7 @@
"@jambonz/lamejs": "^1.2.2",
"@jambonz/mw-registrar": "^0.2.7",
"@jambonz/realtimedb-helpers": "^0.8.7",
"@jambonz/speech-utils": "^0.0.26",
"@jambonz/speech-utils": "^0.0.31",
"@jambonz/time-series": "^0.2.8",
"@jambonz/verb-specifications": "^0.0.45",
"@soniox/soniox-node": "^1.1.1",