improve hangup

This commit is contained in:
akirilyuk
2022-02-01 16:35:44 +01:00
parent 4ea9707e4e
commit 6dbbbf8c9e
2 changed files with 10 additions and 16 deletions

View File

@@ -196,15 +196,6 @@ class Cognigy extends Task {
return say;
}
_makeHangupTask(reason) {
const hangup = makeTask(this.logger, {hangup: {
headers: {
'X-REASON': reason
}
}}, this);
return hangup;
}
_makeReferTask(number) {
const refer = makeTask(this.logger, {'sip:refer': {
referTo: number,
@@ -279,12 +270,15 @@ class Cognigy extends Task {
switch (evt.data.type) {
case 'hangup':
this._enqueueTask((async() => {
const hangupTask = this._makeHangupTask(evt.data.reason);
await hangupTask.exec(cs, ep, this);
this.performAction({cognigyResult: 'hangup Succeeded'});
this.reportedFinalAction = true;
this.notifyTaskDone();
this.kill(cs);
const hangupTask = this._makeHangupTask(evt.data.reason);
await hangupTask.exec(cs, ep, this);
cs.replaceApplication([{hangup: {
headers: {
'X-Reason': evt.data.reason
}
}}]);
}).bind(this));
return;

View File

@@ -93,12 +93,12 @@ class SpeechConfig extends Emitter {
this.turnConfig = {};
const finalConfig = final;
if(sayConfig){
if (sayConfig) {
finalConfig.say = sayConfig;
}else if(playConfig){
} else if (playConfig) {
finalConfig.play = playConfig;
}
this.logger.info({finalConfig}, "created gather config");
this.logger.info({finalConfig}, 'created gather config');
return finalConfig;
}
}