@onereach/step-voice 7.0.2-processttschunk.1 → 7.0.2-processttschunk.10
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
|
@@ -13,16 +13,11 @@ class ProcessTtsChunk extends voice_1.default {
|
|
|
13
13
|
isFinal
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
const sensitiveData = {
|
|
17
|
-
muteStep: false,
|
|
18
|
-
muteUser: false,
|
|
19
|
-
muteBot: false,
|
|
20
|
-
};
|
|
21
16
|
this.triggers.local(`in/voice/${call.id}`, async (event) => {
|
|
22
17
|
this.log.info('Received event from voicer', event);
|
|
23
18
|
});
|
|
24
19
|
this.triggers.otherwise(async () => {
|
|
25
|
-
await this.
|
|
20
|
+
await this.sendCommands({ ...call, type: 'tts-chunk' }, [command]);
|
|
26
21
|
this.exitStep('next');
|
|
27
22
|
});
|
|
28
23
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import VoiceStep, { TODO, VoiceEvent } from './voice';
|
|
2
|
+
interface INPUT {
|
|
3
|
+
voiceId: string;
|
|
4
|
+
infiniteProcessing: boolean;
|
|
5
|
+
asr: TODO;
|
|
6
|
+
}
|
|
7
|
+
interface EVENT extends VoiceEvent {
|
|
8
|
+
digit?: string;
|
|
9
|
+
digits?: string;
|
|
10
|
+
phrases?: TODO[];
|
|
11
|
+
}
|
|
12
|
+
export default class StartTTSChunksProcessing extends VoiceStep<INPUT, {}, EVENT> {
|
|
13
|
+
runStep(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
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 } = this.data;
|
|
9
|
+
const grammar = {
|
|
10
|
+
id: this.currentStepId,
|
|
11
|
+
asr: asr.getSettings(call.asr),
|
|
12
|
+
};
|
|
13
|
+
const command = {
|
|
14
|
+
name: 'start-TTS-chunks-processing',
|
|
15
|
+
params: {
|
|
16
|
+
voiceId,
|
|
17
|
+
infiniteProcessing,
|
|
18
|
+
grammar
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
this.triggers.local(`in/voice/${call.id}`, async (event) => {
|
|
22
|
+
this.log.info('Received event from voicer', event);
|
|
23
|
+
switch (event.params.type) {
|
|
24
|
+
case 'tts-chunks-playback-done': {
|
|
25
|
+
return this.exitStep('next', {}, false);
|
|
26
|
+
}
|
|
27
|
+
case 'recognition': {
|
|
28
|
+
const params = event.params;
|
|
29
|
+
// const phrases = params.phrases
|
|
30
|
+
const exitId = 'interruption';
|
|
31
|
+
return this.exitStep(exitId, this.exitChoiceData('voice', params), false);
|
|
32
|
+
}
|
|
33
|
+
case 'hangup': {
|
|
34
|
+
await this.handleHangup(call);
|
|
35
|
+
return await this.waitConvEnd();
|
|
36
|
+
}
|
|
37
|
+
case 'cancel': {
|
|
38
|
+
return this.handleCancel();
|
|
39
|
+
}
|
|
40
|
+
case 'error':
|
|
41
|
+
return this.throwError(event.params.error);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
this.triggers.otherwise(async () => {
|
|
45
|
+
await this.pauseRecording(call, command);
|
|
46
|
+
return this.exitFlow();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.default = StartTTSChunksProcessing;
|
package/dst/voice.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICallback,
|
|
1
|
+
import { ICallback, IPromtpSection, ITypedEvent, IVoiceReporterTranscriptEventArgs } 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' | 'tts-chunks-playback-done';
|
|
34
34
|
export declare class VoiceStepError extends BasicError {
|
|
35
35
|
}
|
|
36
36
|
export type VoicerError = Error & {
|