@onereach/step-voice 7.0.9 → 7.0.11-VOIC1606.2
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/Global Command.d.ts +4 -0
- package/dst/Global Command.js +8 -0
- package/dst/Initiate Call.d.ts +5 -0
- package/dst/Initiate Call.js +37 -5
- package/dst/Say Message.js +2 -1
- package/dst/Transfer.js +2 -1
- package/dst/step.d.ts +1 -0
- package/dst/step.js +4 -0
- package/dst/voice.d.ts +4 -0
- package/package.json +1 -1
package/dst/Global Command.d.ts
CHANGED
package/dst/Global Command.js
CHANGED
|
@@ -115,6 +115,14 @@ class GlobalCommand extends voice_1.default {
|
|
|
115
115
|
call.recordCall = true;
|
|
116
116
|
await this.updateData();
|
|
117
117
|
}
|
|
118
|
+
// Set loop prevention settings on call object
|
|
119
|
+
if (this.data.loopPrevention?.enabled) {
|
|
120
|
+
call.loopPrevention = {
|
|
121
|
+
enabled: this.data.loopPrevention.enabled,
|
|
122
|
+
maxLoops: this.data.loopPrevention.maxLoops
|
|
123
|
+
};
|
|
124
|
+
await this.updateData();
|
|
125
|
+
}
|
|
118
126
|
// set grammar on voicer
|
|
119
127
|
await this.sendCommands(call, [
|
|
120
128
|
{
|
package/dst/Initiate Call.d.ts
CHANGED
|
@@ -19,6 +19,11 @@ interface INPUT {
|
|
|
19
19
|
enableSpoofCallerId?: boolean;
|
|
20
20
|
spoofCallerId?: string;
|
|
21
21
|
isAMD?: boolean;
|
|
22
|
+
enableWhisperTransfer?: boolean;
|
|
23
|
+
whisperAnnounceAudio?: TODO[];
|
|
24
|
+
textType?: string;
|
|
25
|
+
whisperCustomerConversation?: string;
|
|
26
|
+
whisperCustomerConversationThread?: string;
|
|
22
27
|
}
|
|
23
28
|
export default class InitiateCall extends VoiceStep<INPUT, TODO, CallStartEvent> {
|
|
24
29
|
get conversation(): string | import("@onereach/flow-sdk/types").IMergeField;
|
package/dst/Initiate Call.js
CHANGED
|
@@ -47,7 +47,7 @@ class InitiateCall extends voice_1.default {
|
|
|
47
47
|
this.exitStep('cancel');
|
|
48
48
|
}
|
|
49
49
|
async waitForCall() {
|
|
50
|
-
const { asr, tts, from: botNumber, endUserNumber, sipHost, sipUser, sipPassword, timeout, headers, enableSpoofCallerId, spoofCallerId, isAMD, otherCallRef, otherCallRefThread, handleCancel } = this.data;
|
|
50
|
+
const { asr, tts, from: botNumber, endUserNumber, sipHost, sipUser, sipPassword, timeout, headers, enableSpoofCallerId, spoofCallerId, isAMD, otherCallRef, otherCallRefThread, handleCancel, enableWhisperTransfer, whisperAnnounceAudio, textType, whisperCustomerConversation, } = this.data;
|
|
51
51
|
const call = await this.fetchData();
|
|
52
52
|
this.triggers.once(`in/voice/${call.id}/event`, async (event) => {
|
|
53
53
|
switch (event.params.type) {
|
|
@@ -84,7 +84,7 @@ class InitiateCall extends voice_1.default {
|
|
|
84
84
|
reportingSettingsKey: 'transcript',
|
|
85
85
|
actionFromBot: true
|
|
86
86
|
});
|
|
87
|
-
|
|
87
|
+
const commands = [
|
|
88
88
|
...isAMD
|
|
89
89
|
? [{
|
|
90
90
|
name: 'start-avmd',
|
|
@@ -100,8 +100,39 @@ class InitiateCall extends voice_1.default {
|
|
|
100
100
|
type: asr.serverSettings.engine
|
|
101
101
|
}
|
|
102
102
|
}]
|
|
103
|
-
: []
|
|
104
|
-
]
|
|
103
|
+
: [],
|
|
104
|
+
];
|
|
105
|
+
if (enableWhisperTransfer === true) {
|
|
106
|
+
const ttsSettings = tts.getSettings(call.tts);
|
|
107
|
+
const announceSpeechSections = whisperAnnounceAudio?.map(section => ({
|
|
108
|
+
text: section.voiceTextMsg,
|
|
109
|
+
url: section.audioUrl,
|
|
110
|
+
bargeInVoice: false,
|
|
111
|
+
bargeInKeypad: false,
|
|
112
|
+
textType,
|
|
113
|
+
provider: ttsSettings.provider,
|
|
114
|
+
...ttsSettings
|
|
115
|
+
}));
|
|
116
|
+
const announceMessageCommand = {
|
|
117
|
+
name: 'speak',
|
|
118
|
+
params: {
|
|
119
|
+
sections: announceSpeechSections,
|
|
120
|
+
reporterTranscriptEventId: '',
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const customerCall = await this.getConversationByName(whisperCustomerConversation ?? '');
|
|
124
|
+
const transferCommand = {
|
|
125
|
+
name: 'defer_replaces',
|
|
126
|
+
params: {
|
|
127
|
+
callerId: customerCall['id']
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
commands.push(...[
|
|
131
|
+
announceMessageCommand,
|
|
132
|
+
transferCommand,
|
|
133
|
+
]);
|
|
134
|
+
}
|
|
135
|
+
await this.sendCommands(newCall, commands);
|
|
105
136
|
return this.exitStep('success');
|
|
106
137
|
}
|
|
107
138
|
case 'hangup': {
|
|
@@ -178,7 +209,8 @@ class InitiateCall extends voice_1.default {
|
|
|
178
209
|
: undefined,
|
|
179
210
|
timeout: originateTimeout,
|
|
180
211
|
version: 2,
|
|
181
|
-
sessionExpireTime: this.session.expireTime
|
|
212
|
+
sessionExpireTime: this.session.expireTime,
|
|
213
|
+
loopPrevention: call.loopPrevention
|
|
182
214
|
};
|
|
183
215
|
if (otherCallRef) {
|
|
184
216
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
package/dst/Say Message.js
CHANGED
package/dst/Transfer.js
CHANGED
package/dst/step.d.ts
CHANGED
|
@@ -25,6 +25,7 @@ export default class ConvStep<TData extends IConversationData, TIn = unknown, TO
|
|
|
25
25
|
get useQueue(): boolean;
|
|
26
26
|
fetchData(): Promise<TData>;
|
|
27
27
|
getConversation(): Promise<IConversation>;
|
|
28
|
+
getConversationByName(conversation: string): Promise<IConversation>;
|
|
28
29
|
updateData(): Promise<void>;
|
|
29
30
|
hasConversation(): Promise<boolean>;
|
|
30
31
|
runBefore(): Promise<void>;
|
package/dst/step.js
CHANGED
|
@@ -51,6 +51,10 @@ class ConvStep extends step_1.default {
|
|
|
51
51
|
async getConversation() {
|
|
52
52
|
return (await this.fetchData())._conv;
|
|
53
53
|
}
|
|
54
|
+
async getConversationByName(conversation) {
|
|
55
|
+
const convDataThread = this.process.getSafeThread(this.dataThreadId);
|
|
56
|
+
return await convDataThread.get(conversation);
|
|
57
|
+
}
|
|
54
58
|
async updateData() {
|
|
55
59
|
if (this.convDataCache == null)
|
|
56
60
|
throw new Error(`missing conversation cache in state ${this.state.name}`);
|
package/dst/voice.d.ts
CHANGED