mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-02-15 10:49:07 +00:00
wip
This commit is contained in:
@@ -94,7 +94,7 @@ class Dialogflow extends Task {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await this.init(cs, ep);
|
await this.init(cs, ep);
|
||||||
await this.startBot();
|
await this.startBot('default');
|
||||||
await this.awaitTaskDone();
|
await this.awaitTaskDone();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.logger.error({err}, 'Dialogflow:exec error');
|
this.logger.error({err}, 'Dialogflow:exec error');
|
||||||
@@ -166,12 +166,12 @@ class Dialogflow extends Task {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async startBot() {
|
async startBot(intent) {
|
||||||
if (this.isCX) {
|
if (this.isCX) {
|
||||||
await this.startBotCX();
|
await this.startBotCX(intent);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
await this.startBotES();
|
await this.startBotES(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ class Dialogflow extends Task {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async startBotCX() {
|
async startBotCX(intent) {
|
||||||
const baseArgs = [
|
const baseArgs = [
|
||||||
this.ep.uuid,
|
this.ep.uuid,
|
||||||
this.region,
|
this.region,
|
||||||
@@ -198,9 +198,14 @@ class Dialogflow extends Task {
|
|||||||
this.environment,
|
this.environment,
|
||||||
this.lang,
|
this.lang,
|
||||||
];
|
];
|
||||||
|
if (intent) {
|
||||||
|
baseArgs.push(intent);
|
||||||
|
}
|
||||||
|
/*
|
||||||
if (Object.keys(this.queryInput).length > 0) {
|
if (Object.keys(this.queryInput).length > 0) {
|
||||||
baseArgs.push(`'${JSON.stringify(this.queryInput)}'`);
|
baseArgs.push(`'${JSON.stringify(this.queryInput)}'`);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
this.logger.info({args: baseArgs}, 'starting dialogflow CX bot');
|
this.logger.info({args: baseArgs}, 'starting dialogflow CX bot');
|
||||||
|
|
||||||
await this.ep.api(this.cmd, `${baseArgs.join(' ')}`);
|
await this.ep.api(this.cmd, `${baseArgs.join(' ')}`);
|
||||||
@@ -444,8 +449,9 @@ class Dialogflow extends Task {
|
|||||||
// if ES start a new intent (for CX we do not set single_utterance on),
|
// if ES start a new intent (for CX we do not set single_utterance on),
|
||||||
// (we want to continue to listen during the audio playback)
|
// (we want to continue to listen during the audio playback)
|
||||||
// _unless_ we are transferring or ending the session
|
// _unless_ we are transferring or ending the session
|
||||||
if (this.isES && !this.hangupAfterPlayDone) {
|
if (!this.hangupAfterPlayDone) {
|
||||||
ep.api(this.cmd, `${ep.uuid} ${this.project} ${this.lang}`);
|
this.startBot();
|
||||||
|
//ep.api(this.cmd, `${ep.uuid} ${this.project} ${this.lang}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.playInProgress = true;
|
this.playInProgress = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user