mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-02-13 09:49:30 +00:00
support noise isolation
This commit is contained in:
@@ -49,6 +49,9 @@ class BackgroundTaskManager extends Emitter {
|
||||
case 'ttsStream':
|
||||
task = await this._initTtsStream(opts);
|
||||
break;
|
||||
case 'noiseIsolation':
|
||||
task = await this._initNoiseIsolation(opts);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -194,6 +197,25 @@ class BackgroundTaskManager extends Emitter {
|
||||
return task;
|
||||
}
|
||||
|
||||
// Initiate Noise Isolation
|
||||
async _initNoiseIsolation(opts) {
|
||||
let task;
|
||||
try {
|
||||
const t = normalizeJambones(this.logger, [opts]);
|
||||
task = makeTask(this.logger, t[0]);
|
||||
const resources = await this.cs._evaluatePreconditions(task);
|
||||
const {span, ctx} = this.rootSpan.startChildSpan(`background-noiseIsolation:${task.summary}`);
|
||||
task.span = span;
|
||||
task.ctx = ctx;
|
||||
task.exec(this.cs, resources)
|
||||
.then(this._taskCompleted.bind(this, 'noiseIsolation', task))
|
||||
.catch(this._taskError.bind(this, 'noiseIsolation', task));
|
||||
} catch (err) {
|
||||
this.logger.info(err, 'BackgroundTaskManager:_initNoiseIsolation - Error creating noiseIsolation task');
|
||||
}
|
||||
return task;
|
||||
}
|
||||
|
||||
_taskCompleted(type, task) {
|
||||
this.logger.debug({type, task}, `BackgroundTaskManager:_taskCompleted: task completed, sticky: ${task.sticky}`);
|
||||
task.removeAllListeners();
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
"SayLegacy": "say:legacy",
|
||||
"Stream": "stream",
|
||||
"Tag": "tag",
|
||||
"Transcribe": "transcribe"
|
||||
"Transcribe": "transcribe",
|
||||
"NoiseIsolation": "noiseIsolation"
|
||||
},
|
||||
"AllowedSipRecVerbs": ["answer", "config", "gather", "transcribe", "listen", "tag", "hangup", "sip:decline"],
|
||||
"AllowedConfirmSessionVerbs": ["config", "gather", "plays", "say", "tag"],
|
||||
|
||||
Reference in New Issue
Block a user