mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
lex changes
This commit is contained in:
@@ -15,7 +15,8 @@ class Lex extends Task {
|
|||||||
this.alias = this.data.botAlias;
|
this.alias = this.data.botAlias;
|
||||||
this.region = this.data.region;
|
this.region = this.data.region;
|
||||||
this.locale = this.data.locale || 'en_US';
|
this.locale = this.data.locale || 'en_US';
|
||||||
this.intent = this.data.intent;
|
this.intent = this.data.intent || {};
|
||||||
|
this.metadata = this.data.metadata;
|
||||||
this.welcomeMessage = this.data.welcomeMessage;
|
this.welcomeMessage = this.data.welcomeMessage;
|
||||||
this.bargein = this.data.bargein || false;
|
this.bargein = this.data.bargein || false;
|
||||||
this.passDtmf = this.data.passDtmf || false;
|
this.passDtmf = this.data.passDtmf || false;
|
||||||
@@ -49,10 +50,20 @@ class Lex extends Task {
|
|||||||
try {
|
try {
|
||||||
await this.init(cs, ep);
|
await this.init(cs, ep);
|
||||||
|
|
||||||
this.logger.debug(`starting lex bot ${this.botName} with locale ${this.locale}`);
|
|
||||||
|
|
||||||
// kick it off
|
// kick it off
|
||||||
this.ep.api('aws_lex_start', `${this.ep.uuid} ${this.bot} ${this.alias} ${this.region} ${this.locale}`)
|
const obj = {};
|
||||||
|
let cmd = `${this.ep.uuid} ${this.bot} ${this.alias} ${this.region} ${this.locale} `;
|
||||||
|
|
||||||
|
if (this.metadata) Object.assign(obj, this.metadata);
|
||||||
|
if (this.intent.name) {
|
||||||
|
cmd += this.intent.name;
|
||||||
|
if (this.intent.slots) Object.assign(obj, {slots: this.intent.slots});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Object.keys(obj).length > 0) cmd += ` '${JSON.stringify(obj)}'`;
|
||||||
|
|
||||||
|
this.logger.debug({cmd}, `starting lex bot ${this.botName} with locale ${this.locale}`);
|
||||||
|
this.ep.api('aws_lex_start', cmd)
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
this.logger.error({err}, `Error starting lex bot ${this.botName}`);
|
this.logger.error({err}, `Error starting lex bot ${this.botName}`);
|
||||||
this.notifyTaskDone();
|
this.notifyTaskDone();
|
||||||
@@ -114,7 +125,7 @@ class Lex extends Task {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (this.vendor) Object.assign(channelVars, {LEX_USE_TTS: 1});
|
if (this.vendor) Object.assign(channelVars, {LEX_USE_TTS: 1});
|
||||||
if (this.intent && this.intent.length) Object.assign(channelVars, {LEX_WELCOME_INTENT: this.intent});
|
//if (this.intent.name) Object.assign(channelVars, {LEX_WELCOME_INTENT: this.intent});
|
||||||
if (this.welcomeMessage && this.welcomeMessage.length) {
|
if (this.welcomeMessage && this.welcomeMessage.length) {
|
||||||
Object.assign(channelVars, {LEX_WELCOME_MESSAGE: this.welcomeMessage});
|
Object.assign(channelVars, {LEX_WELCOME_MESSAGE: this.welcomeMessage});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,8 +157,9 @@
|
|||||||
"credentials": "object",
|
"credentials": "object",
|
||||||
"region": "string",
|
"region": "string",
|
||||||
"locale": "string",
|
"locale": "string",
|
||||||
"intent": "string",
|
"intent": "#lexIntent",
|
||||||
"welcomeMessage": "string",
|
"welcomeMessage": "string",
|
||||||
|
"metadata": "object",
|
||||||
"bargein": "boolean",
|
"bargein": "boolean",
|
||||||
"passDtmf": "boolean",
|
"passDtmf": "boolean",
|
||||||
"actionHook": "object|string",
|
"actionHook": "object|string",
|
||||||
@@ -336,5 +337,14 @@
|
|||||||
"required": [
|
"required": [
|
||||||
"vendor"
|
"vendor"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"lexIntent": {
|
||||||
|
"properties": {
|
||||||
|
"name": "string",
|
||||||
|
"slots": "object"
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"name"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user