mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-21 17:17:58 +00:00
add refer and hangup
This commit is contained in:
@@ -256,7 +256,6 @@ 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._enqueueTask((async() => {
|
this._enqueueTask((async() => {
|
||||||
this.logger.info({text}, 'received text');
|
this.logger.info({text}, 'received text');
|
||||||
const sayTask = this._makeSayTask(text);
|
const sayTask = this._makeSayTask(text);
|
||||||
@@ -272,24 +271,23 @@ class Cognigy extends Task {
|
|||||||
this._enqueueTask((async() => {
|
this._enqueueTask((async() => {
|
||||||
this.performAction({cognigyResult: 'hangup Succeeded'});
|
this.performAction({cognigyResult: 'hangup Succeeded'});
|
||||||
this.reportedFinalAction = true;
|
this.reportedFinalAction = true;
|
||||||
const hangupTask = this._makeHangupTask(evt.data.reason);
|
|
||||||
await hangupTask.exec(cs, ep, this);
|
|
||||||
cs.replaceApplication([{hangup: {
|
cs.replaceApplication([{hangup: {
|
||||||
headers: {
|
headers: {
|
||||||
'X-Reason': evt.data.reason
|
'X-Reason': evt.data.reason
|
||||||
}
|
}
|
||||||
}}]);
|
}}]);
|
||||||
|
this.taskQueue.end();
|
||||||
}).bind(this));
|
}).bind(this));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case 'refer':
|
case 'refer':
|
||||||
this._enqueueTask((async() => {
|
this._enqueueTask((async() => {
|
||||||
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();
|
cs.replaceApplication([{'sip:refer': {
|
||||||
this.kill(cs);
|
referTo: number,
|
||||||
|
referredBy: 'cognigy'
|
||||||
|
}}]);
|
||||||
}).bind(this));
|
}).bind(this));
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user