mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
@@ -64,6 +64,16 @@ class CallSession extends Emitter {
|
||||
this.notifiedComplete = false;
|
||||
this.rootSpan = rootSpan;
|
||||
|
||||
this._origRecognizerSettings = {
|
||||
vendor: this.application?.speech_recognizer_vendor,
|
||||
language: this.application?.speech_recognizer_language,
|
||||
};
|
||||
this._origSynthesizerSettings = {
|
||||
vendor: this.application?.speech_synthesis_vendor,
|
||||
language: this.application?.speech_synthesis_language,
|
||||
voice: this.application?.speech_synthesis_voice,
|
||||
};
|
||||
|
||||
assert(rootSpan);
|
||||
|
||||
this._recordState = RecordState.RecordingOff;
|
||||
@@ -324,6 +334,22 @@ class CallSession extends Emitter {
|
||||
return this._globalSttPunctuation !== undefined;
|
||||
}
|
||||
|
||||
resetRecognizer() {
|
||||
this._globalSttHints = undefined;
|
||||
this._globalSttPunctuation = undefined;
|
||||
this._globalAltLanguages = undefined;
|
||||
this.isContinuousAsr = false;
|
||||
this.asrDtmfTerminationDigits = undefined;
|
||||
this.speechRecognizerLanguage = this._origRecognizerSettings.language;
|
||||
this.speechRecognizerVendor = this._origRecognizerSettings.vendor;
|
||||
}
|
||||
|
||||
resetSynthesizer() {
|
||||
this.speechSynthesisLanguage = this._origSynthesizerSettings.language;
|
||||
this.speechSynthesisVendor = this._origSynthesizerSettings.vendor;
|
||||
this.speechSynthesisVoice = this._origSynthesizerSettings.voice;
|
||||
}
|
||||
|
||||
async notifyRecordOptions(opts) {
|
||||
const {action} = opts;
|
||||
this.logger.debug({opts}, 'CallSession:notifyRecordOptions');
|
||||
@@ -680,6 +706,12 @@ class CallSession extends Emitter {
|
||||
stt_region: credential.stt_region
|
||||
};
|
||||
}
|
||||
else if ('nvidia' === vendor) {
|
||||
return {
|
||||
speech_credential_sid: credential.speech_credential_sid,
|
||||
riva_server_uri: credential.riva_server_uri
|
||||
};
|
||||
}
|
||||
else if (vendor.startsWith('custom:')) {
|
||||
return {
|
||||
speech_credential_sid: credential.speech_credential_sid,
|
||||
|
||||
@@ -45,6 +45,14 @@ class TaskConfig extends Task {
|
||||
|
||||
get summary() {
|
||||
const phrase = [];
|
||||
|
||||
/* reset recognizer and/or synthesizer to default values? */
|
||||
if (this.data.reset) {
|
||||
if (typeof this.data.reset === 'string') this.data.reset = [this.data.reset];
|
||||
phrase.push(`reset ${this.data.reset.join(',')}`);
|
||||
}
|
||||
else this.data.reset = [];
|
||||
|
||||
if (this.bargeIn.enable) phrase.push('enable barge-in');
|
||||
if (this.hasSynthesizer) {
|
||||
const {vendor:v, language:l, voice} = this.synthesizer;
|
||||
@@ -86,6 +94,11 @@ class TaskConfig extends Task {
|
||||
}
|
||||
}
|
||||
|
||||
this.data.reset.forEach((k) => {
|
||||
if (k === 'synthesizer') cs.resetSynthesizer();
|
||||
else if (k === 'recognizer') cs.resetRecognizer();
|
||||
});
|
||||
|
||||
if (this.hasSynthesizer) {
|
||||
cs.speechSynthesisVendor = this.synthesizer.vendor !== 'default'
|
||||
? this.synthesizer.vendor
|
||||
|
||||
@@ -78,6 +78,10 @@ const speechMapper = (cred) => {
|
||||
const o = JSON.parse(decrypt(credential));
|
||||
obj.api_key = o.api_key;
|
||||
}
|
||||
else if ('nvidia' === obj.vendor) {
|
||||
const o = JSON.parse(decrypt(credential));
|
||||
obj.riva_server_uri = o.riva_server_uri;
|
||||
}
|
||||
else if (obj.vendor.startsWith('custom:')) {
|
||||
const o = JSON.parse(decrypt(credential));
|
||||
obj.auth_token = o.auth_token;
|
||||
|
||||
Reference in New Issue
Block a user