support noise isolation

This commit is contained in:
xquanluu
2026-01-27 13:28:40 +07:00
parent 325af42946
commit f070f262db
5 changed files with 132 additions and 2 deletions

View File

@@ -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();

View File

@@ -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"],