mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
add channel to transcribe, gather, and dtmf spans (#376)
This commit is contained in:
@@ -817,7 +817,11 @@ class TaskGather extends Task {
|
||||
this.logger.debug({evt}, 'TaskGather:resolve buffered results');
|
||||
}
|
||||
|
||||
this.span.setAttributes({'stt.resolve': reason, 'stt.result': JSON.stringify(evt)});
|
||||
this.span.setAttributes({
|
||||
channel: 1,
|
||||
'stt.resolve': reason,
|
||||
'stt.result': JSON.stringify(evt)
|
||||
});
|
||||
if (this.needsStt && this.ep && this.ep.connected) {
|
||||
this.ep.stopTranscription({vendor: this.vendor})
|
||||
.catch((err) => this.logger.error({err}, 'Error stopping transcription'));
|
||||
|
||||
@@ -181,7 +181,11 @@ class TaskListen extends Task {
|
||||
/* add a child span for the dtmf event */
|
||||
const msDuration = Math.floor((duration / 8000) * 1000);
|
||||
const {span} = this.startChildSpan(`${DTMF_SPAN_NAME}:${dtmf}`);
|
||||
span.setAttributes({dtmf, duration: `${msDuration}ms`});
|
||||
span.setAttributes({
|
||||
channel: 1,
|
||||
dtmf,
|
||||
duration: `${msDuration}ms`
|
||||
});
|
||||
span.end();
|
||||
|
||||
if (evt.dtmf === this.finishOnKey) {
|
||||
|
||||
@@ -298,7 +298,11 @@ class TaskTranscribe extends Task {
|
||||
|
||||
/* we've got a transcript, so end the otel child span for this channel */
|
||||
if (this.childSpan[channel - 1] && this.childSpan[channel - 1].span) {
|
||||
this.childSpan[channel - 1].span.setAttributes({'stt.resolve': 'transcript', 'stt.result': JSON.stringify(evt)});
|
||||
this.childSpan[channel - 1].span.setAttributes({
|
||||
channel,
|
||||
'stt.resolve': 'transcript',
|
||||
'stt.result': JSON.stringify(evt)
|
||||
});
|
||||
this.childSpan[channel - 1].span.end();
|
||||
}
|
||||
|
||||
@@ -342,7 +346,10 @@ class TaskTranscribe extends Task {
|
||||
_onNoAudio(cs, ep, channel) {
|
||||
this.logger.debug(`TaskTranscribe:_onNoAudio restarting transcription on channel ${channel}`);
|
||||
if (this.childSpan[channel - 1] && this.childSpan[channel - 1].span) {
|
||||
this.childSpan[channel - 1].span.setAttributes({'stt.resolve': 'timeout'});
|
||||
this.childSpan[channel - 1].span.setAttributes({
|
||||
channel,
|
||||
'stt.resolve': 'timeout'
|
||||
});
|
||||
this.childSpan[channel - 1].span.end();
|
||||
}
|
||||
this._transcribe(ep);
|
||||
@@ -355,7 +362,10 @@ class TaskTranscribe extends Task {
|
||||
_onMaxDurationExceeded(cs, ep, channel) {
|
||||
this.logger.debug(`TaskTranscribe:_onMaxDurationExceeded restarting transcription on channel ${channel}`);
|
||||
if (this.childSpan[channel - 1] && this.childSpan[channel - 1].span) {
|
||||
this.childSpan[channel - 1].span.setAttributes({'stt.resolve': 'max duration exceeded'});
|
||||
this.childSpan[channel - 1].span.setAttributes({
|
||||
channel,
|
||||
'stt.resolve': 'max duration exceeded'
|
||||
});
|
||||
this.childSpan[channel - 1].span.end();
|
||||
}
|
||||
|
||||
@@ -389,7 +399,10 @@ class TaskTranscribe extends Task {
|
||||
this.notifyError(`Failed connecting to speech vendor deepgram: ${reason}`);
|
||||
|
||||
if (this.childSpan[channel - 1] && this.childSpan[channel - 1].span) {
|
||||
this.childSpan[channel - 1].span.setAttributes({'stt.resolve': 'connection failure'});
|
||||
this.childSpan[channel - 1].span.setAttributes({
|
||||
channel,
|
||||
'stt.resolve': 'connection failure'
|
||||
});
|
||||
this.childSpan[channel - 1].span.end();
|
||||
}
|
||||
this.notifyTaskDone();
|
||||
@@ -412,7 +425,10 @@ class TaskTranscribe extends Task {
|
||||
this.notifyError(`Failed connecting to speech vendor IBM: ${reason}`);
|
||||
|
||||
if (this.childSpan[channel - 1] && this.childSpan[channel - 1].span) {
|
||||
this.childSpan[channel - 1].span.setAttributes({'stt.resolve': 'connection failure'});
|
||||
this.childSpan[channel - 1].span.setAttributes({
|
||||
channel,
|
||||
'stt.resolve': 'connection failure'
|
||||
});
|
||||
this.childSpan[channel - 1].span.end();
|
||||
}
|
||||
this.notifyTaskDone();
|
||||
|
||||
Reference in New Issue
Block a user