fix setting initial config

This commit is contained in:
akirilyuk
2022-02-04 08:12:53 +01:00
parent eb418a42e9
commit 418baa20df
3 changed files with 29 additions and 32 deletions

View File

@@ -99,7 +99,6 @@ class Cognigy extends Task {
await super.exec(cs);
const opts = {
session: {
synthesizer: this.data.synthesizer || {
vendor: 'default',
language: 'default',
@@ -113,7 +112,6 @@ class Cognigy extends Task {
bot: this.data.bot || {},
user: this.data.user || {},
dtmf: this.data.dtmf || {}
}
};
this.config = new SpeechConfig({logger: this.logger, ep, opts});
this.ep = ep;

View File

@@ -7,9 +7,6 @@ const stripNulls = (obj) => {
return obj;
};
const defaultSpeechConfig
class SpeechConfig extends Emitter {
constructor({logger, ep, opts = {}}) {
super();
@@ -19,7 +16,7 @@ class SpeechConfig extends Emitter {
this.update(opts);
}
_mergeConfig(changedConfig = {}){
_mergeConfig(changedConfig = {}) {
const merged = lodash.merge(
{},
this.sessionConfig,

View File

@@ -318,7 +318,9 @@ class TaskGather extends Task {
}
if (evt.is_final) this._resolve('speech', evt);
else {
if (evt.stability > 0.70 && this.bargein && evt.alternatives[0].transcript.split(' ').length >= this.minBargeinWordCount) {
if (evt.stability > 0.70 &&
this.bargein &&
evt.alternatives[0].transcript.split(' ').length >= this.minBargeinWordCount) {
this.logger.debug('Gather:_onTranscription - killing audio due to bargein');
this._killAudio(cs);
this._resolve('speech', evt);