@onereach/step-voice 7.0.2-processttschunk.15 → 7.0.2-processttschunk.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dst/Process TTS Chunk.js
CHANGED
|
@@ -5,19 +5,26 @@ const voice_1 = tslib_1.__importDefault(require("./voice"));
|
|
|
5
5
|
class ProcessTtsChunk extends voice_1.default {
|
|
6
6
|
async runStep() {
|
|
7
7
|
const call = await this.fetchData();
|
|
8
|
-
const { textChunk, isFinal } = this.data;
|
|
8
|
+
const { textChunk, isFinal, flush, voiceSettings } = this.data;
|
|
9
9
|
const command = {
|
|
10
10
|
name: 'process-tts-chunk',
|
|
11
11
|
params: {
|
|
12
12
|
chunk: textChunk,
|
|
13
|
-
isFinal
|
|
13
|
+
isFinal,
|
|
14
|
+
flush,
|
|
15
|
+
voiceSettings,
|
|
14
16
|
}
|
|
15
17
|
};
|
|
18
|
+
const sensitiveData = {
|
|
19
|
+
muteStep: false,
|
|
20
|
+
muteUser: false,
|
|
21
|
+
muteBot: false,
|
|
22
|
+
};
|
|
16
23
|
this.triggers.local(`in/voice/${call.id}`, async (event) => {
|
|
17
24
|
this.log.info('Received event from voicer', event);
|
|
18
25
|
});
|
|
19
26
|
this.triggers.otherwise(async () => {
|
|
20
|
-
await this.
|
|
27
|
+
await this.pauseRecording(call, command, sensitiveData);
|
|
21
28
|
this.exitStep('next');
|
|
22
29
|
});
|
|
23
30
|
}
|
package/dst/voice.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICallback, IPromtpSection, ITypedEvent
|
|
1
|
+
import { ICallback, IVoiceReporterTranscriptEventArgs, IPromtpSection, ITypedEvent } from '@onereach/flow-sdk/dst/types';
|
|
2
2
|
import ConvStep, { IConversationData } from './step';
|
|
3
3
|
import BasicError from '@onereach/flow-sdk/dst/errors/base';
|
|
4
4
|
export type TODO = any;
|
|
@@ -30,7 +30,7 @@ export interface IVoiceCall extends IConversationData {
|
|
|
30
30
|
user: string;
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
export type EventType = 'hangup' | 'ack' | 'error' | 'cancel' | 'background' | 'avm-detected' | 'recognition' | 'digit' | 'digits' | 'conference-start' | 'conference-end' | 'playback' | 'timeout' | 'record' | 'bridge' | 'bridge/ended' | 'is_flow_ready' | 'call' | 'dtmf-sent'
|
|
33
|
+
export type EventType = 'hangup' | 'ack' | 'error' | 'cancel' | 'background' | 'avm-detected' | 'recognition' | 'digit' | 'digits' | 'conference-start' | 'conference-end' | 'playback' | 'timeout' | 'record' | 'bridge' | 'bridge/ended' | 'is_flow_ready' | 'call' | 'dtmf-sent';
|
|
34
34
|
export declare class VoiceStepError extends BasicError {
|
|
35
35
|
}
|
|
36
36
|
export type VoicerError = Error & {
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import VoiceStep, { TODO, VoiceEvent } from './voice';
|
|
2
|
-
interface INPUT {
|
|
3
|
-
voiceId: string;
|
|
4
|
-
infiniteProcessing: boolean;
|
|
5
|
-
asr: TODO;
|
|
6
|
-
endpointing: number;
|
|
7
|
-
}
|
|
8
|
-
interface EVENT extends VoiceEvent {
|
|
9
|
-
phrases?: TODO[];
|
|
10
|
-
}
|
|
11
|
-
export default class StartTTSChunksProcessing extends VoiceStep<INPUT, {}, EVENT> {
|
|
12
|
-
runStep(): Promise<void>;
|
|
13
|
-
}
|
|
14
|
-
export {};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const voice_1 = tslib_1.__importDefault(require("./voice"));
|
|
5
|
-
class StartTTSChunksProcessing extends voice_1.default {
|
|
6
|
-
async runStep() {
|
|
7
|
-
const call = await this.fetchData();
|
|
8
|
-
const { voiceId, infiniteProcessing, asr, endpointing } = this.data;
|
|
9
|
-
const grammar = {
|
|
10
|
-
id: this.currentStepId,
|
|
11
|
-
asr: {
|
|
12
|
-
...asr.getSettings(call.asr),
|
|
13
|
-
config: {
|
|
14
|
-
endpointing
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
const command = {
|
|
19
|
-
name: 'start-TTS-chunks-processing',
|
|
20
|
-
params: {
|
|
21
|
-
voiceId,
|
|
22
|
-
infiniteProcessing,
|
|
23
|
-
grammar
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
this.triggers.local(`in/voice/${call.id}`, async (event) => {
|
|
27
|
-
this.log.info('Received event from voicer', event);
|
|
28
|
-
switch (event.params.type) {
|
|
29
|
-
case 'tts-chunks-playback-done': {
|
|
30
|
-
this.log.info('tts-chunks-playback-done', event.params);
|
|
31
|
-
return this.exitStep('next', {}, false);
|
|
32
|
-
}
|
|
33
|
-
case 'timeout': {
|
|
34
|
-
this.log.info('timeout', event.params);
|
|
35
|
-
return this.exitStep(event.params.type, {}, false);
|
|
36
|
-
}
|
|
37
|
-
case 'recognition': {
|
|
38
|
-
this.log.info('recognition', event.params);
|
|
39
|
-
const params = event.params;
|
|
40
|
-
const exitData = this.exitChoiceData('voice', params);
|
|
41
|
-
this.log.info('exitData', exitData);
|
|
42
|
-
return this.exitStep(event.params.type, exitData, false);
|
|
43
|
-
}
|
|
44
|
-
case 'hangup': {
|
|
45
|
-
await this.handleHangup(call);
|
|
46
|
-
return await this.waitConvEnd();
|
|
47
|
-
}
|
|
48
|
-
case 'cancel': {
|
|
49
|
-
return this.handleCancel();
|
|
50
|
-
}
|
|
51
|
-
case 'error':
|
|
52
|
-
return this.throwError(event.params.error);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
this.triggers.otherwise(async () => {
|
|
56
|
-
await this.pauseRecording(call, command);
|
|
57
|
-
return this.exitFlow();
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.default = StartTTSChunksProcessing;
|