mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2026-02-14 02:09:22 +00:00
Compare commits
2 Commits
v0.9.6-rc2
...
feat/v092_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de1f8e7b1a | ||
|
|
6889f0e4ab |
@@ -500,8 +500,10 @@ class TaskDial extends Task {
|
|||||||
'X-Account-Sid': cs.accountSid,
|
'X-Account-Sid': cs.accountSid,
|
||||||
...(req && req.has('X-CID') && {'X-CID': req.get('X-CID')}),
|
...(req && req.has('X-CID') && {'X-CID': req.get('X-CID')}),
|
||||||
...(direction === 'outbound' && callInfo.sbcCallid && {'X-CID': callInfo.sbcCallid}),
|
...(direction === 'outbound' && callInfo.sbcCallid && {'X-CID': callInfo.sbcCallid}),
|
||||||
...(req && req.has('P-Asserted-Identity') && !JAMBONZ_DISABLE_DIAL_PAI_HEADER &&
|
...(!JAMBONZ_DISABLE_DIAL_PAI_HEADER && req && {
|
||||||
{'P-Asserted-Identity': req.get('P-Asserted-Identity')}),
|
...(req.has('P-Asserted-Identity') && {'P-Asserted-Identity': req.get('P-Asserted-Identity')}),
|
||||||
|
...(req.has('Privacy') && {'Privacy': req.get('Privacy')}),
|
||||||
|
}),
|
||||||
...(req && req.has('X-Voip-Carrier-Sid') && {'X-Voip-Carrier-Sid': req.get('X-Voip-Carrier-Sid')}),
|
...(req && req.has('X-Voip-Carrier-Sid') && {'X-Voip-Carrier-Sid': req.get('X-Voip-Carrier-Sid')}),
|
||||||
// Put headers at the end to make sure opt.headers override all default behavior.
|
// Put headers at the end to make sure opt.headers override all default behavior.
|
||||||
...this.headers
|
...this.headers
|
||||||
|
|||||||
@@ -757,10 +757,16 @@ class TaskGather extends SttTask {
|
|||||||
this.logger.debug('Gather:_onTranscription - got UtteranceEnd event from deepgram but no buffered transcripts');
|
this.logger.debug('Gather:_onTranscription - got UtteranceEnd event from deepgram but no buffered transcripts');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.logger.debug('Gather:_onTranscription - got UtteranceEnd event from deepgram, return buffered transcript');
|
const utteranceTime = evt.last_word_end;
|
||||||
evt = this.consolidateTranscripts(this._bufferedTranscripts, 1, this.language, this.vendor);
|
if (utteranceTime && this._dgTimeOfLastUnprocessedWord && utteranceTime < this._dgTimeOfLastUnprocessedWord) {
|
||||||
this._bufferedTranscripts = [];
|
this.logger.debug('Gather:_onTranscription - got UtteranceEnd with unprocessed words, continue listening');
|
||||||
this._resolve('speech', evt);
|
}
|
||||||
|
else {
|
||||||
|
this.logger.debug('Gather:_onTranscription - got UtteranceEnd from deepgram, return buffered transcript');
|
||||||
|
evt = this.consolidateTranscripts(this._bufferedTranscripts, 1, this.language, this.vendor);
|
||||||
|
this._bufferedTranscripts = [];
|
||||||
|
this._resolve('speech', evt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -893,8 +899,21 @@ class TaskGather extends SttTask {
|
|||||||
if (originalEvent.is_final && evt.alternatives[0].transcript !== '') {
|
if (originalEvent.is_final && evt.alternatives[0].transcript !== '') {
|
||||||
this.logger.debug({evt}, 'Gather:_onTranscription - buffering a completed (partial) deepgram transcript');
|
this.logger.debug({evt}, 'Gather:_onTranscription - buffering a completed (partial) deepgram transcript');
|
||||||
this._bufferedTranscripts.push(evt);
|
this._bufferedTranscripts.push(evt);
|
||||||
|
this._dgTimeOfLastUnprocessedWord = null;
|
||||||
|
}
|
||||||
|
if (evt.alternatives[0].transcript === '') {
|
||||||
|
emptyTranscript = true;
|
||||||
|
}
|
||||||
|
else if (!originalEvent.is_final) {
|
||||||
|
/* Deepgram: we have unprocessed words-save last word end time so we can later compare to UtteranceEnd */
|
||||||
|
const words = originalEvent.channel.alternatives[0].words;
|
||||||
|
if (words?.length > 0) {
|
||||||
|
this._dgTimeOfLastUnprocessedWord = words.slice(-1)[0].end;
|
||||||
|
this.logger.debug(
|
||||||
|
`TaskGather:_onTranscription - saving word end time: ${this._dgTimeOfLastUnprocessedWord}`);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (evt.alternatives[0].transcript === '') emptyTranscript = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!emptyTranscript) {
|
if (!emptyTranscript) {
|
||||||
|
|||||||
Reference in New Issue
Block a user