Compare commits

...

6 Commits

6 changed files with 24 additions and 13 deletions

View File

@@ -698,7 +698,7 @@ class CallSession extends Emitter {
let skip = false;
this.currentTask = task;
if (TaskName.Gather === task.name && this.isBotModeEnabled) {
if (this.backgroundGatherTask.updateTaskInProgress(task)) {
if (this.backgroundGatherTask.updateTaskInProgress(task) !== false) {
this.logger.info(`CallSession:exec skipping #${stackNum}:${taskNum}: ${task.name}`);
skip = true;
}

View File

@@ -70,6 +70,11 @@ class TaskGather extends Task {
if (this.asrTimeout > 0) this.asrDtmfTerminationDigit = recognizer.asrDtmfTerminationDigit;
this.isContinuousAsr = this.asrTimeout > 0;
if (Array.isArray(this.data.recognizer.hints) &&
0 == this.data.recognizer.hints.length && process.env.JAMBONES_GATHER_CLEAR_GLOBAL_HINTS_ON_EMPTY_HINTS) {
logger.debug('Gather: an empty hints array was supplied, so we will mask global hints');
this.maskGlobalSttHints = true;
}
this.data.recognizer.hints = this.data.recognizer.hints || [];
this.data.recognizer.altLanguages = this.data.recognizer.altLanguages || [];
}
@@ -125,7 +130,7 @@ class TaskGather extends Task {
const {updateSpeechCredentialLastUsed} = require('../utils/db-utils')(this.logger, cs.srf);
const {getNuanceAccessToken, getIbmAccessToken} = cs.srf.locals.dbHelpers;
if (cs.hasGlobalSttHints) {
if (cs.hasGlobalSttHints && !this.maskGlobalSttHints) {
const {hints, hintsBoost} = cs.globalSttHints;
const setOfHints = new Set(this.data.recognizer.hints
.concat(hints)
@@ -310,6 +315,7 @@ class TaskGather extends Task {
const {timeout} = opts;
this.timeout = timeout;
this._startTimer();
return true;
}
_onDtmf(cs, ep, evt) {
@@ -655,9 +661,14 @@ class TaskGather extends Task {
this._killAudio(cs);
}
// DCH: commenting out because my experience is that the google STT engine
// will keep listening after it detects end of utterance, and will return a final transcript
// My earlier understanding that we needed to stop and restart the recognizer appears incorrect.
/*
if (!this.resolved && !this.killed && !this._bufferedTranscripts.length) {
this._startTranscribing(ep);
}
*/
}
_onStartOfSpeech(cs, ep) {

View File

@@ -378,7 +378,7 @@ module.exports = (logger) => {
...(typeof rOpts.hintsBoost === 'number' &&
{GOOGLE_SPEECH_HINTS_BOOST: rOpts.hintsBoost}),
...(rOpts.altLanguages.length > 0 &&
{GOOGLE_SPEECH_ALTERNATIVE_LANGUAGE_CODES: rOpts.altLanguages.join(',')}),
{GOOGLE_SPEECH_ALTERNATIVE_LANGUAGE_CODES: [...new Set(rOpts.altLanguages)].join(',')}),
...(rOpts.interactionType &&
{GOOGLE_SPEECH_METADATA_INTERACTION_TYPE: rOpts.interactionType}),
...{GOOGLE_SPEECH_MODEL: rOpts.model || (task.name === TaskName.Gather ? 'latest_short' : 'phone_call')},
@@ -407,7 +407,7 @@ module.exports = (logger) => {
...(rOpts.hints.length > 0 && typeof rOpts.hints[0] === 'object' &&
{AZURE_SPEECH_HINTS: rOpts.hints.map((h) => h.phrase).join(',')}),
...(rOpts.altLanguages && rOpts.altLanguages.length > 0 &&
{AZURE_SERVICE_ENDPOINT_ID: rOpts.sttCredentials}),
{AZURE_SPEECH_ALTERNATIVE_LANGUAGE_CODES: [...new Set(rOpts.altLanguages)].join(',')}),
...(rOpts.requestSnr && {AZURE_REQUEST_SNR: 1}),
...(rOpts.profanityOption && {AZURE_PROFANITY_OPTION: rOpts.profanityOption}),
...(rOpts.azureServiceEndpoint && {AZURE_SERVICE_ENDPOINT: rOpts.azureServiceEndpoint}),

View File

@@ -346,7 +346,7 @@ class WsRequestor extends BaseRequestor {
_recvCommand(msgid, command, call_sid, queueCommand, data) {
// TODO: validate command
//this.logger.debug({msgid, command, call_sid, queueCommand, data}, 'received command');
this.logger.debug({msgid, command, call_sid, queueCommand, data}, 'received command');
this.emit('command', {msgid, command, call_sid, queueCommand, data});
}
}

14
package-lock.json generated
View File

@@ -12,7 +12,7 @@
"@jambonz/db-helpers": "^0.7.4",
"@jambonz/http-health-check": "^0.0.1",
"@jambonz/realtimedb-helpers": "^0.7.0",
"@jambonz/speech-utils": "^0.0.5",
"@jambonz/speech-utils": "^0.0.6",
"@jambonz/stats-collector": "^0.1.6",
"@jambonz/time-series": "^0.2.5",
"@jambonz/verb-specifications": "^0.0.11",
@@ -1633,9 +1633,9 @@
}
},
"node_modules/@jambonz/speech-utils": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.0.5.tgz",
"integrity": "sha512-gbmLBmeNrZGn715JWC/ThxJfQH3oIhm4cJB3dpFDxrSdjT7Vw0jP0WOBgXeSuYrdXtc1hR2BHZ30+6oseUAKRw==",
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.0.6.tgz",
"integrity": "sha512-cZckiUe2tKUB93aXjvZAXSeyuMbLp/fvT4GQqRh5u7BriA/CS2r+hTFMxzSpboNlnni30M/pM0/Jjta6gzFPgw==",
"dependencies": {
"@aws-sdk/client-polly": "^3.276.0",
"@google-cloud/text-to-speech": "^4.2.0",
@@ -9971,9 +9971,9 @@
}
},
"@jambonz/speech-utils": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.0.5.tgz",
"integrity": "sha512-gbmLBmeNrZGn715JWC/ThxJfQH3oIhm4cJB3dpFDxrSdjT7Vw0jP0WOBgXeSuYrdXtc1hR2BHZ30+6oseUAKRw==",
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.0.6.tgz",
"integrity": "sha512-cZckiUe2tKUB93aXjvZAXSeyuMbLp/fvT4GQqRh5u7BriA/CS2r+hTFMxzSpboNlnni30M/pM0/Jjta6gzFPgw==",
"requires": {
"@aws-sdk/client-polly": "^3.276.0",
"@google-cloud/text-to-speech": "^4.2.0",

View File

@@ -27,7 +27,7 @@
"@jambonz/db-helpers": "^0.7.4",
"@jambonz/http-health-check": "^0.0.1",
"@jambonz/realtimedb-helpers": "^0.7.0",
"@jambonz/speech-utils": "^0.0.5",
"@jambonz/speech-utils": "^0.0.6",
"@jambonz/stats-collector": "^0.1.6",
"@jambonz/time-series": "^0.2.5",
"@jambonz/verb-specifications": "^0.0.11",