mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
minor cleanup
This commit is contained in:
@@ -216,8 +216,14 @@ class TaskDial extends Task {
|
|||||||
this.sd = null;
|
this.sd = null;
|
||||||
}
|
}
|
||||||
if (this.callSid) sessionTracker.remove(this.callSid);
|
if (this.callSid) sessionTracker.remove(this.callSid);
|
||||||
if (this.listenTask) await this.listenTask.kill(cs);
|
if (this.listenTask) {
|
||||||
if (this.transcribeTask) await this.transcribeTask.kill(cs);
|
await this.listenTask.kill(cs);
|
||||||
|
this.listenTask = null;
|
||||||
|
}
|
||||||
|
if (this.transcribeTask) {
|
||||||
|
await this.transcribeTask.kill(cs);
|
||||||
|
this.transcribeTask = null;
|
||||||
|
}
|
||||||
this.notifyTaskDone();
|
this.notifyTaskDone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,14 +60,21 @@ class TaskListen extends Task {
|
|||||||
this._clearTimer();
|
this._clearTimer();
|
||||||
if (this.ep && this.ep.connected) {
|
if (this.ep && this.ep.connected) {
|
||||||
this.logger.debug('TaskListen:kill closing websocket');
|
this.logger.debug('TaskListen:kill closing websocket');
|
||||||
await this.ep.forkAudioStop()
|
try {
|
||||||
.catch((err) => this.logger.info(err, 'TaskListen:kill'));
|
await this.ep.forkAudioStop()
|
||||||
|
this.logger.debug('TaskListen:kill successfully closed websocket');
|
||||||
|
} catch (err) {
|
||||||
|
this.logger.info(err, 'TaskListen:kill'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (this.recordStartTime) {
|
if (this.recordStartTime) {
|
||||||
const duration = moment().diff(this.recordStartTime, 'seconds');
|
const duration = moment().diff(this.recordStartTime, 'seconds');
|
||||||
this.results.dialCallDuration = duration;
|
this.results.dialCallDuration = duration;
|
||||||
}
|
}
|
||||||
if (this.transcribeTask) await this.transcribeTask.kill(cs);
|
if (this.transcribeTask) {
|
||||||
|
await this.transcribeTask.kill(cs);
|
||||||
|
this.transcribeTask = null;
|
||||||
|
}
|
||||||
this.ep && this._removeListeners(this.ep);
|
this.ep && this._removeListeners(this.ep);
|
||||||
this.notifyTaskDone();
|
this.notifyTaskDone();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ class HttpRequestor extends BaseRequestor {
|
|||||||
err.statusCode = statusCode;
|
err.statusCode = statusCode;
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
if (headers['content-type'].includes('application/json')) {
|
if (headers['content-type']?.includes('application/json')) {
|
||||||
buf = await body.json();
|
buf = await body.json();
|
||||||
}
|
}
|
||||||
if (newClient) newClient.close();
|
if (newClient) newClient.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user