mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-02-13 09:49:30 +00:00
wip (#830)
* wip * wip * wip * wip * update deps * update test to use latest freeswitch image
This commit is contained in:
@@ -566,9 +566,7 @@ class CallSession extends Emitter {
|
|||||||
//this.logger.debug('CallSession:clearOrRestoreActionHookDelayProcessor - ahd settings');
|
//this.logger.debug('CallSession:clearOrRestoreActionHookDelayProcessor - ahd settings');
|
||||||
//await this.clearActionHookDelayProcessor();
|
//await this.clearActionHookDelayProcessor();
|
||||||
}
|
}
|
||||||
else {
|
this.logger.debug('CallSession:clearOrRestoreActionHookDelayProcessor - say or play action completed');
|
||||||
this.logger.debug('CallSession:clearOrRestoreActionHookDelayProcessor - restore ahd after gather override');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1069,7 +1067,7 @@ class CallSession extends Emitter {
|
|||||||
try {
|
try {
|
||||||
await this._awaitCommandsOrHangup();
|
await this._awaitCommandsOrHangup();
|
||||||
|
|
||||||
await this.clearOrRestoreActionHookDelayProcessor();
|
//await this.clearOrRestoreActionHookDelayProcessor();
|
||||||
|
|
||||||
//TODO: remove filler noise code and simply create as action hook delay
|
//TODO: remove filler noise code and simply create as action hook delay
|
||||||
if (this._isPlayingFillerNoise) {
|
if (this._isPlayingFillerNoise) {
|
||||||
|
|||||||
@@ -141,12 +141,12 @@ class TaskSay extends TtsTask {
|
|||||||
await this.playToConfMember(ep, memberId, confName, confUuid, filepath[segment]);
|
await this.playToConfMember(ep, memberId, confName, confUuid, filepath[segment]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let tts_cache_filename;
|
const isStreaming = filepath[segment].startsWith('say:{');
|
||||||
if (filepath[segment].startsWith('say:{')) {
|
if (isStreaming) {
|
||||||
const arr = /^say:\{.*\}\s*(.*)$/.exec(filepath[segment]);
|
const arr = /^say:\{.*\}\s*(.*)$/.exec(filepath[segment]);
|
||||||
if (arr) this.logger.debug(`Say:exec sending streaming tts request: ${arr[1].substring(0, 64)}..`);
|
if (arr) this.logger.debug(`Say:exec sending streaming tts request: ${arr[1].substring(0, 64)}..`);
|
||||||
}
|
}
|
||||||
else this.logger.debug(`Say:exec sending ${filepath[segment].substring(0, 64)}`);
|
else this.logger.debug(`Say:exec sending ${filepath[segment].substring(0, 64)}`);
|
||||||
ep.once('playback-start', (evt) => {
|
ep.once('playback-start', (evt) => {
|
||||||
this.logger.debug({evt}, 'Say got playback-start');
|
this.logger.debug({evt}, 'Say got playback-start');
|
||||||
if (this.otelSpan) {
|
if (this.otelSpan) {
|
||||||
@@ -154,17 +154,19 @@ class TaskSay extends TtsTask {
|
|||||||
this.otelSpan.end();
|
this.otelSpan.end();
|
||||||
this.otelSpan = null;
|
this.otelSpan = null;
|
||||||
if (evt.variable_tts_cache_filename) {
|
if (evt.variable_tts_cache_filename) {
|
||||||
tts_cache_filename = evt.variable_tts_cache_filename;
|
|
||||||
cs.trackTmpFile(evt.variable_tts_cache_filename);
|
cs.trackTmpFile(evt.variable_tts_cache_filename);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
this.logger.info('No tts_cache_filename in playback-start event');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ep.once('playback-stop', (evt) => {
|
ep.once('playback-stop', (evt) => {
|
||||||
if (!tts_cache_filename || evt.variable_tts_cache_filename !== tts_cache_filename) {
|
this.logger.debug({evt}, 'Say got playback-stop');
|
||||||
this.logger.info({evt}, 'Say: discarding playback-stop from other say verb');
|
if (evt.variable_tts_error) {
|
||||||
|
writeAlerts({
|
||||||
|
account_sid,
|
||||||
|
alert_type: AlertType.TTS_FAILURE,
|
||||||
|
vendor,
|
||||||
|
detail: evt.variable_tts_error
|
||||||
|
}).catch((err) => this.logger.info({err}, 'Error generating alert for no tts'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.logger.debug({evt}, 'Say got playback-stop');
|
this.logger.debug({evt}, 'Say got playback-stop');
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ class ActionHookDelayProcessor extends Emitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async stop() {
|
async stop() {
|
||||||
this.logger.debug('ActionHookDelayProcessor#stop');
|
|
||||||
this._active = false;
|
this._active = false;
|
||||||
|
|
||||||
if (this._noResponseTimer) {
|
if (this._noResponseTimer) {
|
||||||
@@ -91,25 +90,19 @@ class ActionHookDelayProcessor extends Emitter {
|
|||||||
this._noResponseGiveUpTimer = null;
|
this._noResponseGiveUpTimer = null;
|
||||||
}
|
}
|
||||||
if (this._taskInProgress) {
|
if (this._taskInProgress) {
|
||||||
this.logger.debug(`ActionHookDelayProcessor#stop: killing task in progress: ${this._taskInProgress.name}`);
|
this.logger.debug(`ActionHookDelayProcessor#stop: stopping ${this._taskInProgress.name}`);
|
||||||
|
|
||||||
/** if we are doing a play, kill it immediately
|
this._sayResolver = () => {
|
||||||
* if we are doing a say, wait for it to finish
|
this.logger.debug('ActionHookDelayProcessor#stop: play/say is done, continue on..');
|
||||||
*/
|
//this._taskInProgress.kill(this.cs);
|
||||||
if (TaskName.Say === this._taskInProgress.name) {
|
|
||||||
this._sayResolver = () => {
|
|
||||||
this.logger.debug('ActionHookDelayProcessor#stop: say is done, continue on..');
|
|
||||||
this._taskInProgress.kill(this.cs);
|
|
||||||
this._taskInProgress = null;
|
|
||||||
};
|
|
||||||
this.logger.debug('ActionHookDelayProcessor#stop returning promise');
|
|
||||||
return new Promise((resolve) => this._sayResolver = resolve);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* play */
|
|
||||||
this._taskInProgress.kill(this.cs);
|
|
||||||
this._taskInProgress = null;
|
this._taskInProgress = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* we let Say finish, but interrupt Play */
|
||||||
|
if (TaskName.Play === this._taskInProgress.name) {
|
||||||
|
await this._taskInProgress.kill(this.cs);
|
||||||
}
|
}
|
||||||
|
return new Promise((resolve) => this._sayResolver = resolve);
|
||||||
}
|
}
|
||||||
this.logger.debug('ActionHookDelayProcessor#stop returning');
|
this.logger.debug('ActionHookDelayProcessor#stop returning');
|
||||||
}
|
}
|
||||||
@@ -147,7 +140,7 @@ class ActionHookDelayProcessor extends Emitter {
|
|||||||
this._taskInProgress = null;
|
this._taskInProgress = null;
|
||||||
if (this._sayResolver) {
|
if (this._sayResolver) {
|
||||||
/* we were waiting for the play to finish before continuing to next task */
|
/* we were waiting for the play to finish before continuing to next task */
|
||||||
this.logger.debug({evt}, 'got playback-stop');
|
this.logger.debug({evt}, 'ActionHookDelayProcessor#_onNoResponseTimer got playback-stop');
|
||||||
this._sayResolver();
|
this._sayResolver();
|
||||||
this._sayResolver = null;
|
this._sayResolver = null;
|
||||||
}
|
}
|
||||||
|
|||||||
30
package-lock.json
generated
30
package-lock.json
generated
@@ -45,10 +45,10 @@
|
|||||||
"short-uuid": "^5.1.0",
|
"short-uuid": "^5.1.0",
|
||||||
"sinon": "^17.0.1",
|
"sinon": "^17.0.1",
|
||||||
"to-snake-case": "^1.0.0",
|
"to-snake-case": "^1.0.0",
|
||||||
"undici": "^6.19.2",
|
"undici": "^6.19.4",
|
||||||
"uuid-random": "^1.3.2",
|
"uuid-random": "^1.3.2",
|
||||||
"verify-aws-sns-signature": "^0.1.0",
|
"verify-aws-sns-signature": "^0.1.0",
|
||||||
"ws": "^8.17.1",
|
"ws": "^8.18.0",
|
||||||
"xml2js": "^0.6.2"
|
"xml2js": "^0.6.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -8831,10 +8831,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici": {
|
"node_modules/undici": {
|
||||||
"version": "6.19.2",
|
"version": "6.19.4",
|
||||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/undici/-/undici-6.19.4.tgz",
|
||||||
"integrity": "sha512-JfjKqIauur3Q6biAtHJ564e3bWa8VvT+7cSiOJHFbX4Erv6CLGDpg8z+Fmg/1OI/47RA+GI2QZaF48SSaLvyBA==",
|
"integrity": "sha512-i3uaEUwNdkRq2qtTRRJb13moW5HWqviu7Vl7oYRYz++uPtGHJj+x7TGjcEuwS5Mt2P4nA0U9dhIX3DdB6JGY0g==",
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.17"
|
"node": ">=18.17"
|
||||||
}
|
}
|
||||||
@@ -9193,10 +9192,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ws": {
|
"node_modules/ws": {
|
||||||
"version": "8.17.1",
|
"version": "8.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
|
||||||
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
|
"integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.0.0"
|
"node": ">=10.0.0"
|
||||||
},
|
},
|
||||||
@@ -16056,9 +16054,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"undici": {
|
"undici": {
|
||||||
"version": "6.19.2",
|
"version": "6.19.4",
|
||||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/undici/-/undici-6.19.4.tgz",
|
||||||
"integrity": "sha512-JfjKqIauur3Q6biAtHJ564e3bWa8VvT+7cSiOJHFbX4Erv6CLGDpg8z+Fmg/1OI/47RA+GI2QZaF48SSaLvyBA=="
|
"integrity": "sha512-i3uaEUwNdkRq2qtTRRJb13moW5HWqviu7Vl7oYRYz++uPtGHJj+x7TGjcEuwS5Mt2P4nA0U9dhIX3DdB6JGY0g=="
|
||||||
},
|
},
|
||||||
"undici-types": {
|
"undici-types": {
|
||||||
"version": "5.26.5",
|
"version": "5.26.5",
|
||||||
@@ -16329,9 +16327,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ws": {
|
"ws": {
|
||||||
"version": "8.17.1",
|
"version": "8.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
|
||||||
"integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
|
"integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
|
||||||
"requires": {}
|
"requires": {}
|
||||||
},
|
},
|
||||||
"xml2js": {
|
"xml2js": {
|
||||||
|
|||||||
@@ -61,10 +61,10 @@
|
|||||||
"short-uuid": "^5.1.0",
|
"short-uuid": "^5.1.0",
|
||||||
"sinon": "^17.0.1",
|
"sinon": "^17.0.1",
|
||||||
"to-snake-case": "^1.0.0",
|
"to-snake-case": "^1.0.0",
|
||||||
"undici": "^6.19.2",
|
"undici": "^6.19.4",
|
||||||
"uuid-random": "^1.3.2",
|
"uuid-random": "^1.3.2",
|
||||||
"verify-aws-sns-signature": "^0.1.0",
|
"verify-aws-sns-signature": "^0.1.0",
|
||||||
"ws": "^8.17.1",
|
"ws": "^8.18.0",
|
||||||
"xml2js": "^0.6.2"
|
"xml2js": "^0.6.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ services:
|
|||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|
||||||
freeswitch:
|
freeswitch:
|
||||||
image: drachtio/drachtio-freeswitch-mrf:0.7.3
|
image: drachtio/drachtio-freeswitch-mrf:latest
|
||||||
restart: always
|
restart: always
|
||||||
command: freeswitch --rtp-range-start 20000 --rtp-range-end 20100
|
command: freeswitch --rtp-range-start 20000 --rtp-range-end 20100
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
Reference in New Issue
Block a user