Feat/902: executing giveUpAction when noResponseGiveupTimeout is reached (#908)

* feat/893: made noResponseTimeout and noResponseGiveUpTimout independent

* support for giveUpActions implemented

* feat/902: using makeTask and exec of task to execute the giveUpActions

* feat/902: changed version of verb-specifications and speech-utils

* feat/902: fixed jslint errors

* feat/902: modified log

* feat/902: using a new event giveupWithTasks for processing giveUpActions

* feat/902: removed check for wakeupResolver and replaceApplication already taking care of wakeupResolver, also updated the verb-specifications version

* feat/902: removed sync for _onNoResponseGiveUpTimer function
This commit is contained in:
rammohan-y
2024-09-26 19:10:30 +05:30
committed by GitHub
parent 7c24208067
commit 68fa3c013d
4 changed files with 36 additions and 20 deletions

View File

@@ -544,6 +544,17 @@ class CallSession extends Emitter {
this.wakeupResolver = null;
}
});
this._actionHookDelayProcessor.on('giveupWithTasks', (tasks) => {
this.logger.info('CallSession: ActionHookDelayProcessor: giveupWithTasks event');
const giveUpTasks = normalizeJambones(this.logger, tasks).map((tdata) => makeTask(this.logger, tdata));
this.logger.info({tasks: listTaskNames(giveUpTasks)}, 'CallSession:giveupWithTasks task list');
// we need to clear the ahd, as we do not want to execute actionHookDelay actions again
this.clearActionHookDelayProcessor();
// replace the application with giveUpTasks
this.replaceApplication(giveUpTasks);
});
} catch (err) {
this.logger.error({err}, 'CallSession: Error creating ActionHookDelayProcessor');
}

View File

@@ -52,6 +52,7 @@ class ActionHookDelayProcessor extends Emitter {
this.retries = opts.retries || 0;
this.noResponseTimeout = opts.noResponseTimeout;
this.noResponseGiveUpTimeout = opts.noResponseGiveUpTimeout;
this.giveUpActions = opts.giveUpActions;
// return false if these options actually disable the ahdp
return ('enable' in opts && opts.enable === true) ||
@@ -165,9 +166,14 @@ class ActionHookDelayProcessor extends Emitter {
_onNoResponseGiveUpTimer() {
this._active = false;
if (!this.giveUpActions) {
this.logger.info('ActionHookDelayProcessor#_onNoResponseGiveUpTimer');
this.stop().catch((err) => {});
this.emit('giveup');
} else {
this.logger.info('ActionHookDelayProcessor#_onNoResponseGiveUpTimer - giveUpActions');
this.emit('giveupWithTasks', this.giveUpActions);
}
}
}

29
package-lock.json generated
View File

@@ -15,10 +15,10 @@
"@jambonz/http-health-check": "^0.0.1",
"@jambonz/mw-registrar": "^0.2.7",
"@jambonz/realtimedb-helpers": "^0.8.8",
"@jambonz/speech-utils": "^0.1.15",
"@jambonz/speech-utils": "^0.1.16",
"@jambonz/stats-collector": "^0.1.10",
"@jambonz/time-series": "^0.2.9",
"@jambonz/verb-specifications": "^0.0.76",
"@jambonz/verb-specifications": "^0.0.81",
"@opentelemetry/api": "^1.8.0",
"@opentelemetry/exporter-jaeger": "^1.23.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.50.0",
@@ -1536,10 +1536,9 @@
}
},
"node_modules/@jambonz/speech-utils": {
"version": "0.1.15",
"resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.1.15.tgz",
"integrity": "sha512-TICSKVqFqjc1Ty08Wr+byMQv1g/Piku0x/4cuw25JB3nrOolW/sLABRxoPOUUpbY5EGjXhaVT52FpazCopiIxg==",
"license": "MIT",
"version": "0.1.16",
"resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.1.16.tgz",
"integrity": "sha512-en1ZwDbjDJkeQJ9Ro1l3arYDPYrLnK9OTXQQ7ZjTfqzUipgu0mkTnaUCTzW9taozaBJ4+YelSA1PNg2MtLzVAw==",
"dependencies": {
"@aws-sdk/client-polly": "^3.496.0",
"@aws-sdk/client-sts": "^3.496.0",
@@ -1575,9 +1574,9 @@
}
},
"node_modules/@jambonz/verb-specifications": {
"version": "0.0.76",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.76.tgz",
"integrity": "sha512-7s61qAsG07xLLaEAHW236rSYzEoh9Qg0aRWHPbTfxCsuTKDNeq+5EwGAShDU5R5ZpjgweZJLhArQm8Ym+4xJ2A==",
"version": "0.0.81",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.81.tgz",
"integrity": "sha512-lufYMLpwaejF3zl8FNy1SvmsxFHXNXU8p7I+GoiwbgOHmFeOX4bQla4RD7bNLFvfjSXPRc2u9h5fceicVa9dcg==",
"dependencies": {
"debug": "^4.3.4",
"pino": "^8.8.0"
@@ -10500,9 +10499,9 @@
}
},
"@jambonz/speech-utils": {
"version": "0.1.15",
"resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.1.15.tgz",
"integrity": "sha512-TICSKVqFqjc1Ty08Wr+byMQv1g/Piku0x/4cuw25JB3nrOolW/sLABRxoPOUUpbY5EGjXhaVT52FpazCopiIxg==",
"version": "0.1.16",
"resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.1.16.tgz",
"integrity": "sha512-en1ZwDbjDJkeQJ9Ro1l3arYDPYrLnK9OTXQQ7ZjTfqzUipgu0mkTnaUCTzW9taozaBJ4+YelSA1PNg2MtLzVAw==",
"requires": {
"@aws-sdk/client-polly": "^3.496.0",
"@aws-sdk/client-sts": "^3.496.0",
@@ -10538,9 +10537,9 @@
}
},
"@jambonz/verb-specifications": {
"version": "0.0.76",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.76.tgz",
"integrity": "sha512-7s61qAsG07xLLaEAHW236rSYzEoh9Qg0aRWHPbTfxCsuTKDNeq+5EwGAShDU5R5ZpjgweZJLhArQm8Ym+4xJ2A==",
"version": "0.0.81",
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.81.tgz",
"integrity": "sha512-lufYMLpwaejF3zl8FNy1SvmsxFHXNXU8p7I+GoiwbgOHmFeOX4bQla4RD7bNLFvfjSXPRc2u9h5fceicVa9dcg==",
"requires": {
"debug": "^4.3.4",
"pino": "^8.8.0"

View File

@@ -31,10 +31,10 @@
"@jambonz/http-health-check": "^0.0.1",
"@jambonz/mw-registrar": "^0.2.7",
"@jambonz/realtimedb-helpers": "^0.8.8",
"@jambonz/speech-utils": "^0.1.15",
"@jambonz/speech-utils": "^0.1.16",
"@jambonz/stats-collector": "^0.1.10",
"@jambonz/time-series": "^0.2.9",
"@jambonz/verb-specifications": "^0.0.76",
"@jambonz/verb-specifications": "^0.0.81",
"@opentelemetry/api": "^1.8.0",
"@opentelemetry/exporter-jaeger": "^1.23.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.50.0",