@onereach/step-voice 7.0.9-VOIC1575.2 → 7.0.9-VOIC1575.20
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/Initiate Call.d.ts +5 -0
- package/dst/Initiate Call.js +56 -5
- package/dst/step.d.ts +1 -0
- package/dst/step.js +4 -0
- package/package.json +1 -1
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,8 +47,9 @@ 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, whisperCustomerConversationThread, } = this.data;
|
|
51
51
|
const call = await this.fetchData();
|
|
52
|
+
const callALegId = headers?.find(h => h.name === 'X-Leg-A')?.value;
|
|
52
53
|
this.triggers.once(`in/voice/${call.id}/event`, async (event) => {
|
|
53
54
|
switch (event.params.type) {
|
|
54
55
|
case 'is_flow_ready': {
|
|
@@ -84,7 +85,7 @@ class InitiateCall extends voice_1.default {
|
|
|
84
85
|
reportingSettingsKey: 'transcript',
|
|
85
86
|
actionFromBot: true
|
|
86
87
|
});
|
|
87
|
-
|
|
88
|
+
const commands = [
|
|
88
89
|
...isAMD
|
|
89
90
|
? [{
|
|
90
91
|
name: 'start-avmd',
|
|
@@ -100,8 +101,58 @@ class InitiateCall extends voice_1.default {
|
|
|
100
101
|
type: asr.serverSettings.engine
|
|
101
102
|
}
|
|
102
103
|
}]
|
|
103
|
-
: []
|
|
104
|
-
|
|
104
|
+
: [],
|
|
105
|
+
/* {
|
|
106
|
+
name: 'whisper.hold',
|
|
107
|
+
params: {
|
|
108
|
+
id: callALegId
|
|
109
|
+
}
|
|
110
|
+
}, */
|
|
111
|
+
/* {
|
|
112
|
+
name: 'whisper.hold_off',
|
|
113
|
+
params: {
|
|
114
|
+
id: callALegId
|
|
115
|
+
}
|
|
116
|
+
}, */
|
|
117
|
+
];
|
|
118
|
+
if (enableWhisperTransfer === true) {
|
|
119
|
+
const ttsSettings = tts.getSettings(call.tts);
|
|
120
|
+
const announceSpeechSections = whisperAnnounceAudio?.map(section => ({
|
|
121
|
+
text: section.voiceTextMsg,
|
|
122
|
+
url: section.audioUrl,
|
|
123
|
+
bargeInVoice: false,
|
|
124
|
+
bargeInKeypad: false,
|
|
125
|
+
textType,
|
|
126
|
+
provider: ttsSettings.provider,
|
|
127
|
+
...ttsSettings
|
|
128
|
+
}));
|
|
129
|
+
const announceMessageCommand = {
|
|
130
|
+
name: 'speak',
|
|
131
|
+
params: {
|
|
132
|
+
sections: announceSpeechSections,
|
|
133
|
+
reporterTranscriptEventId: '',
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const customerCall = await this.getConversationByName(whisperCustomerConversation ?? '');
|
|
137
|
+
// const customerCallId = customerCall.dummy
|
|
138
|
+
// const customerCall = this.config.mergeFields[whisperCustomerConversation ?? '']
|
|
139
|
+
// customerCall.
|
|
140
|
+
const transferCommand = {
|
|
141
|
+
name: 'whisper.transfer',
|
|
142
|
+
params: {
|
|
143
|
+
id: callALegId,
|
|
144
|
+
whisperCustomerConversation,
|
|
145
|
+
whisperCustomerConversationThread,
|
|
146
|
+
customerCall
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
commands.push(...[
|
|
150
|
+
announceMessageCommand,
|
|
151
|
+
transferCommand,
|
|
152
|
+
{ name: 'hangup' }
|
|
153
|
+
]);
|
|
154
|
+
}
|
|
155
|
+
await this.sendCommands(newCall, commands);
|
|
105
156
|
return this.exitStep('success');
|
|
106
157
|
}
|
|
107
158
|
case 'hangup': {
|
|
@@ -179,7 +230,7 @@ class InitiateCall extends voice_1.default {
|
|
|
179
230
|
timeout: originateTimeout,
|
|
180
231
|
version: 2,
|
|
181
232
|
sessionExpireTime: this.session.expireTime,
|
|
182
|
-
useWhisperFeature:
|
|
233
|
+
useWhisperFeature: false
|
|
183
234
|
};
|
|
184
235
|
if (otherCallRef) {
|
|
185
236
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
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}`);
|