mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-21 17:17:58 +00:00
exec the tasks
This commit is contained in:
@@ -256,9 +256,11 @@ class Cognigy extends Task {
|
|||||||
const text = parseBotText(evt);
|
const text = parseBotText(evt);
|
||||||
if (evt.data) this.config.update(evt.data);
|
if (evt.data) this.config.update(evt.data);
|
||||||
if (text) {
|
if (text) {
|
||||||
this.logger.info({text}, "received text");
|
|
||||||
await this._enqueueTask((async() => {
|
await this._enqueueTask((async() => {
|
||||||
await this._makeSayTask(text);
|
this.logger.info({text}, "received text");
|
||||||
|
const sayTask = this._makeSayTask(text).exec();
|
||||||
|
await sayTask.exec(cs, ep, this);
|
||||||
}).bind(this));
|
}).bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,7 +270,8 @@ class Cognigy extends Task {
|
|||||||
switch (evt.data.type) {
|
switch (evt.data.type) {
|
||||||
case 'hangup':
|
case 'hangup':
|
||||||
await this._enqueueTask((async() => {
|
await this._enqueueTask((async() => {
|
||||||
await this._makeHangupTask(evt.data.reason);
|
const hangupTask = this._makeHangupTask(evt.data.reason);
|
||||||
|
await hangupTask.exec(cs, ep, this);
|
||||||
this.performAction({cognigyResult: 'hangup Succeeded'});
|
this.performAction({cognigyResult: 'hangup Succeeded'});
|
||||||
this.reportedFinalAction = true;
|
this.reportedFinalAction = true;
|
||||||
this.notifyTaskDone();
|
this.notifyTaskDone();
|
||||||
@@ -278,7 +281,8 @@ class Cognigy extends Task {
|
|||||||
return;
|
return;
|
||||||
case 'refer':
|
case 'refer':
|
||||||
await this._enqueueTask(async() => {
|
await this._enqueueTask(async() => {
|
||||||
await this._makeReferTask(evt.data.number);
|
const referTask = this._makeReferTask(evt.data.number);
|
||||||
|
await referTask.exect(cs, ep, this);
|
||||||
this.performAction({cognigyResult: 'refer succeeded'});
|
this.performAction({cognigyResult: 'refer succeeded'});
|
||||||
this.reportedFinalAction = true;
|
this.reportedFinalAction = true;
|
||||||
this.notifyTaskDone();
|
this.notifyTaskDone();
|
||||||
|
|||||||
Reference in New Issue
Block a user