mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
config: fixes from bargein testing
This commit is contained in:
@@ -12,11 +12,12 @@ class TaskConfig extends Task {
|
||||
'bargeIn'
|
||||
].forEach((k) => this[k] = this.data[k] || {});
|
||||
|
||||
if (this.hasBargeIn && this.bargeIn.enable === true) {
|
||||
if (this.bargeIn.enable) {
|
||||
this.gatherOpts = {
|
||||
verb: 'gather',
|
||||
timeout: 0,
|
||||
bargein: true
|
||||
bargein: true,
|
||||
input: ['speech']
|
||||
};
|
||||
[
|
||||
'finishOnKey', 'input', 'numDigits', 'minDigits', 'maxDigits',
|
||||
@@ -24,9 +25,9 @@ class TaskConfig extends Task {
|
||||
].forEach((k) => {
|
||||
if (this.bargeIn[k]) this.gatherOpts[k] = this.bargeIn[k];
|
||||
});
|
||||
if (this.bargeIn.sticky) this.autoEnable = true;
|
||||
}
|
||||
this.preconditions = this.hasBargeIn ? TaskPreconditions.Endpoint : TaskPreconditions.None;
|
||||
if (this.bargeIn.sticky) this.autoEnable = true;
|
||||
this.preconditions = this.bargeIn.enable ? TaskPreconditions.Endpoint : TaskPreconditions.None;
|
||||
}
|
||||
|
||||
get name() { return TaskName.Config; }
|
||||
@@ -35,11 +36,9 @@ class TaskConfig extends Task {
|
||||
|
||||
get hasRecognizer() { return Object.keys(this.recognizer).length; }
|
||||
|
||||
get hasBargeIn() { return Object.keys(this.bargeIn).length; }
|
||||
|
||||
get summary() {
|
||||
const phrase = [];
|
||||
if (this.hasBargeIn) phrase.push('enable barge-in');
|
||||
if (this.bargeIn.enable) phrase.push('enable barge-in');
|
||||
if (this.hasSynthesizer) {
|
||||
const {vendor:v, language:l, voice} = this.synthesizer;
|
||||
const s = `{${v},${l},${voice}}`;
|
||||
@@ -75,16 +74,21 @@ class TaskConfig extends Task {
|
||||
cs.speechRecognizerLanguage = this.recognizer.language !== 'default'
|
||||
? this.recognizer.language
|
||||
: cs.speechRecognizerLanguage;
|
||||
this.gatherOpts.recognizer = this.recognizer;
|
||||
this.logger.info({recognizer: this.recognizer}, 'Config: updated recognizer');
|
||||
}
|
||||
if (this.hasBargeIn) {
|
||||
if ('enable' in this.bargeIn) {
|
||||
if (this.gatherOpts) {
|
||||
this.logger.debug({opts: this.gatherOpts}, 'Config: enabling bargeIn');
|
||||
this.gatherOpts.recognizer = this.hasRecognizer ?
|
||||
this.recognizer :
|
||||
{
|
||||
vendor: cs.speechRecognizerVendor,
|
||||
language: cs.speechRecognizerLanguage
|
||||
};
|
||||
this.logger.info({opts: this.gatherOpts}, 'Config: enabling bargeIn');
|
||||
cs.enableBotMode(this.gatherOpts, this.autoEnable);
|
||||
}
|
||||
else {
|
||||
this.logger.debug('Config: disabling bargeIn');
|
||||
this.logger.info('Config: disabling bargeIn');
|
||||
cs.disableBotMode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ class TaskGather extends Task {
|
||||
GOOGLE_SPEECH_USE_ENHANCED: true,
|
||||
GOOGLE_SPEECH_SINGLE_UTTERANCE: true,
|
||||
GOOGLE_SPEECH_MODEL: 'command_and_search',
|
||||
GOOGLE_SPEECH_ENABLE_AUTOMATIC_PUNCTUATION: this.punctuation
|
||||
GOOGLE_SPEECH_ENABLE_AUTOMATIC_PUNCTUATION: !!this.punctuation
|
||||
});
|
||||
if (this.hints && this.hints.length > 1) {
|
||||
opts.GOOGLE_SPEECH_HINTS = this.hints.map((h) => h.trim()).join(',');
|
||||
|
||||
Reference in New Issue
Block a user