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);
|
||||
if (evt.data) this.config.update(evt.data);
|
||||
if (text) {
|
||||
|
||||
this._enqueueTask((async() => {
|
||||
this.logger.info({text}, 'received text');
|
||||
const sayTask = this._makeSayTask(text);
|
||||
@@ -272,24 +271,23 @@ class Cognigy extends Task {
|
||||
this._enqueueTask((async() => {
|
||||
this.performAction({cognigyResult: 'hangup Succeeded'});
|
||||
this.reportedFinalAction = true;
|
||||
const hangupTask = this._makeHangupTask(evt.data.reason);
|
||||
await hangupTask.exec(cs, ep, this);
|
||||
cs.replaceApplication([{hangup: {
|
||||
headers: {
|
||||
'X-Reason': evt.data.reason
|
||||
}
|
||||
}}]);
|
||||
this.taskQueue.end();
|
||||
}).bind(this));
|
||||
|
||||
return;
|
||||
case 'refer':
|
||||
this._enqueueTask((async() => {
|
||||
const referTask = this._makeReferTask(evt.data.number);
|
||||
await referTask.exect(cs, ep, this);
|
||||
this.performAction({cognigyResult: 'refer succeeded'});
|
||||
this.reportedFinalAction = true;
|
||||
this.notifyTaskDone();
|
||||
this.kill(cs);
|
||||
cs.replaceApplication([{'sip:refer': {
|
||||
referTo: number,
|
||||
referredBy: 'cognigy'
|
||||
}}]);
|
||||
}).bind(this));
|
||||
return;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user