@onereach/step-voice 1.2202.33 → 2.0.3
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/Choice.js +21 -7
- package/dst/Hangup.js +3 -3
- package/dst/Initiate Call.js +11 -3
- package/dst/Keypad Input.js +23 -5
- package/dst/Say Message.js +25 -6
- package/dst/Voice Recording.js +19 -8
- package/package.json +14 -14
package/dst/Choice.js
CHANGED
|
@@ -86,15 +86,20 @@ class Choice extends voice_1.default {
|
|
|
86
86
|
name: 'speak',
|
|
87
87
|
params: {
|
|
88
88
|
grammar,
|
|
89
|
-
global: channel.global,
|
|
90
89
|
sections: []
|
|
91
90
|
}
|
|
92
91
|
};
|
|
93
92
|
// There's a specific need to do so. There might be ${variable} section
|
|
94
93
|
return this.triggers
|
|
95
94
|
.once(`in/voice/${channel.id}/event`, async (event) => {
|
|
96
|
-
if (channel.recordCall && sensitiveData) {
|
|
97
|
-
await this.sendCommands(channel, [{
|
|
95
|
+
if (channel.recordCall && sensitiveData?.muteStep) {
|
|
96
|
+
await this.sendCommands(channel, [{
|
|
97
|
+
name: 'resume-record-session',
|
|
98
|
+
params: {
|
|
99
|
+
muteUser: sensitiveData.muteUser,
|
|
100
|
+
muteBot: sensitiveData.muteBot
|
|
101
|
+
}
|
|
102
|
+
}]);
|
|
98
103
|
}
|
|
99
104
|
const reportingSettingsKey = this.rptsStarted ? 'transcriptRepromptResponse' : 'transcriptResponse';
|
|
100
105
|
switch (event.params.type) {
|
|
@@ -228,9 +233,9 @@ class Choice extends voice_1.default {
|
|
|
228
233
|
await this.handleHangup(channel);
|
|
229
234
|
return this.end();
|
|
230
235
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
236
|
+
case 'cancel': {
|
|
237
|
+
return this.exitStep('cancel');
|
|
238
|
+
}
|
|
234
239
|
case 'error':
|
|
235
240
|
return this.throwError(event.params.error);
|
|
236
241
|
default:
|
|
@@ -250,7 +255,16 @@ class Choice extends voice_1.default {
|
|
|
250
255
|
});
|
|
251
256
|
command.params.sections = speechSections;
|
|
252
257
|
command.params.timeout = this.rptsTimeout({ noReplyDelay, repromptsList });
|
|
253
|
-
await this.sendCommands(channel,
|
|
258
|
+
await this.sendCommands(channel, [
|
|
259
|
+
...channel.recordCall && sensitiveData?.muteStep ? [{
|
|
260
|
+
name: 'stop-record-session',
|
|
261
|
+
params: {
|
|
262
|
+
muteUser: sensitiveData.muteUser,
|
|
263
|
+
muteBot: sensitiveData.muteBot
|
|
264
|
+
}
|
|
265
|
+
}] : [],
|
|
266
|
+
command
|
|
267
|
+
]);
|
|
254
268
|
return this.exitFlow();
|
|
255
269
|
});
|
|
256
270
|
}
|
package/dst/Hangup.js
CHANGED
|
@@ -12,9 +12,9 @@ class Hangup extends voice_1.default {
|
|
|
12
12
|
return this.exitStep('next');
|
|
13
13
|
case 'error':
|
|
14
14
|
return this.throwError(event.params.error);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
case 'cancel': {
|
|
16
|
+
return this.exitStep('cancel');
|
|
17
|
+
}
|
|
18
18
|
default:
|
|
19
19
|
return this.exitFlow();
|
|
20
20
|
}
|
package/dst/Initiate Call.js
CHANGED
|
@@ -11,7 +11,7 @@ class InitiateCall extends voice_1.default {
|
|
|
11
11
|
return this.step.dataOut.name;
|
|
12
12
|
}
|
|
13
13
|
async runStep() {
|
|
14
|
-
const { from: botNumber, endUserNumber, sipHost, sipUser, sipPassword, timeout, headers, originationId = uuid.v4() } = this.data;
|
|
14
|
+
const { from: botNumber, endUserNumber, sipHost, sipUser, sipPassword, timeout, headers, originationId = uuid.v4(), enableSpoofCallerId, spoofCallerId } = this.data;
|
|
15
15
|
const originateTimeout = timestring(`${timeout || 30} sec`, 'ms'); // timeout or 30 seconds
|
|
16
16
|
const customHeaders = _.reduce(headers, (memo, header) => {
|
|
17
17
|
memo[header.name] = `${header.value}`;
|
|
@@ -26,10 +26,14 @@ class InitiateCall extends voice_1.default {
|
|
|
26
26
|
from: botNumber,
|
|
27
27
|
to: endUserNumber,
|
|
28
28
|
headers: customHeaders,
|
|
29
|
+
spoofCallerId: {
|
|
30
|
+
enableSpoofCallerId,
|
|
31
|
+
spoofCallerId
|
|
32
|
+
},
|
|
29
33
|
gateway: sipHost
|
|
30
34
|
? {
|
|
31
35
|
host: sipHost,
|
|
32
|
-
|
|
36
|
+
username: sipUser,
|
|
33
37
|
password: sipPassword
|
|
34
38
|
}
|
|
35
39
|
: undefined,
|
|
@@ -47,10 +51,14 @@ class InitiateCall extends voice_1.default {
|
|
|
47
51
|
from: botNumber,
|
|
48
52
|
to: endUserNumber,
|
|
49
53
|
headers: customHeaders,
|
|
54
|
+
spoofCallerId: {
|
|
55
|
+
enableSpoofCallerId,
|
|
56
|
+
spoofCallerId
|
|
57
|
+
},
|
|
50
58
|
gateway: sipHost
|
|
51
59
|
? {
|
|
52
60
|
host: sipHost,
|
|
53
|
-
|
|
61
|
+
username: sipUser,
|
|
54
62
|
password: sipPassword
|
|
55
63
|
}
|
|
56
64
|
: undefined,
|
package/dst/Keypad Input.js
CHANGED
|
@@ -26,7 +26,7 @@ const validateInput = ({ input = '', type, regex, expectedLength }) => {
|
|
|
26
26
|
class KeypadInput extends voice_1.default {
|
|
27
27
|
async runStep() {
|
|
28
28
|
const channel = await this.fetchData();
|
|
29
|
-
const { interTimeout, asr, tts, noReplyDelay, textType, keypadBargeIn, endInput, terminationKey, endUserInputValidationOther, expectedNumberOfDigits, regExToValidate, mfVersion } = this.data;
|
|
29
|
+
const { interTimeout, asr, tts, noReplyDelay, textType, keypadBargeIn, endInput, terminationKey, endUserInputValidationOther, expectedNumberOfDigits, regExToValidate, mfVersion, sensitiveData } = this.data;
|
|
30
30
|
const interDigitTimeout = Number(interTimeout) * 1000;
|
|
31
31
|
const ttsSettings = tts.getSettings(channel.tts);
|
|
32
32
|
const asrSettings = asr.getSettings(channel.asr);
|
|
@@ -68,6 +68,15 @@ class KeypadInput extends voice_1.default {
|
|
|
68
68
|
return this.triggers
|
|
69
69
|
.once(`in/voice/${channel.id}/event`, async (event) => {
|
|
70
70
|
const reportingSettingsKey = this.rptsStarted ? 'transcriptRepromptResponse' : 'transcriptResponse';
|
|
71
|
+
if (channel.recordCall && sensitiveData?.muteStep) {
|
|
72
|
+
await this.sendCommands(channel, [{
|
|
73
|
+
name: 'resume-record-session',
|
|
74
|
+
params: {
|
|
75
|
+
muteUser: sensitiveData.muteUser,
|
|
76
|
+
muteBot: sensitiveData.muteBot
|
|
77
|
+
}
|
|
78
|
+
}]);
|
|
79
|
+
}
|
|
71
80
|
switch (event.params.type) {
|
|
72
81
|
case 'digits': {
|
|
73
82
|
const digits = event.params.digits;
|
|
@@ -145,9 +154,9 @@ class KeypadInput extends voice_1.default {
|
|
|
145
154
|
await this.handleHangup(channel);
|
|
146
155
|
return this.end();
|
|
147
156
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
157
|
+
case 'cancel': {
|
|
158
|
+
return this.exitStep('cancel');
|
|
159
|
+
}
|
|
151
160
|
case 'error':
|
|
152
161
|
return this.throwError(event.params.error);
|
|
153
162
|
default:
|
|
@@ -167,7 +176,16 @@ class KeypadInput extends voice_1.default {
|
|
|
167
176
|
});
|
|
168
177
|
command.params.firstDigitTimeout = this.rptsTimeout({ noReplyDelay, repromptsList });
|
|
169
178
|
command.params.sections = speechSections;
|
|
170
|
-
await this.sendCommands(channel, [
|
|
179
|
+
await this.sendCommands(channel, [
|
|
180
|
+
...channel.recordCall && sensitiveData?.muteStep ? [{
|
|
181
|
+
name: 'stop-record-session',
|
|
182
|
+
params: {
|
|
183
|
+
muteUser: sensitiveData.muteUser,
|
|
184
|
+
muteBot: sensitiveData.muteBot
|
|
185
|
+
}
|
|
186
|
+
}] : [],
|
|
187
|
+
command
|
|
188
|
+
]);
|
|
171
189
|
return this.exitFlow();
|
|
172
190
|
});
|
|
173
191
|
}
|
package/dst/Say Message.js
CHANGED
|
@@ -5,9 +5,18 @@ const voice_1 = tslib_1.__importDefault(require("./voice"));
|
|
|
5
5
|
const _ = require('lodash');
|
|
6
6
|
class SayMessage extends voice_1.default {
|
|
7
7
|
async runStep() {
|
|
8
|
-
const { audio, textType, tts } = this.data;
|
|
8
|
+
const { audio, textType, tts, sensitiveData, interSpeechTimeout } = this.data;
|
|
9
9
|
const channel = await this.fetchData();
|
|
10
10
|
this.triggers.once(`in/voice/${channel.id}/event`, async (event) => {
|
|
11
|
+
if (channel.recordCall && sensitiveData?.muteStep) {
|
|
12
|
+
await this.sendCommands(channel, [{
|
|
13
|
+
name: 'resume-record-session',
|
|
14
|
+
params: {
|
|
15
|
+
muteUser: sensitiveData.muteUser,
|
|
16
|
+
muteBot: sensitiveData.muteBot
|
|
17
|
+
}
|
|
18
|
+
}]);
|
|
19
|
+
}
|
|
11
20
|
switch (event.params.type) {
|
|
12
21
|
case 'hangup':
|
|
13
22
|
await this.handleHangup(channel);
|
|
@@ -16,9 +25,9 @@ class SayMessage extends voice_1.default {
|
|
|
16
25
|
return this.exitStep('next');
|
|
17
26
|
case 'error':
|
|
18
27
|
return this.throwError(event.params.error);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
28
|
+
case 'cancel': {
|
|
29
|
+
return this.exitStep('cancel');
|
|
30
|
+
}
|
|
22
31
|
default:
|
|
23
32
|
return this.exitFlow();
|
|
24
33
|
}
|
|
@@ -28,7 +37,8 @@ class SayMessage extends voice_1.default {
|
|
|
28
37
|
const command = {
|
|
29
38
|
name: 'speak',
|
|
30
39
|
params: {
|
|
31
|
-
|
|
40
|
+
dictation: true,
|
|
41
|
+
interSpeechTimeout: interSpeechTimeout * 1000,
|
|
32
42
|
sections: _.map(audio, (section) => ({
|
|
33
43
|
text: section.voiceTextMsg,
|
|
34
44
|
url: section.audioUrl,
|
|
@@ -46,7 +56,16 @@ class SayMessage extends voice_1.default {
|
|
|
46
56
|
reportingSettingsKey: 'transcript',
|
|
47
57
|
actionFromBot: true
|
|
48
58
|
});
|
|
49
|
-
await this.sendCommands(channel, [
|
|
59
|
+
await this.sendCommands(channel, [
|
|
60
|
+
...channel.recordCall && sensitiveData?.muteStep ? [{
|
|
61
|
+
name: 'stop-record-session',
|
|
62
|
+
params: {
|
|
63
|
+
muteUser: sensitiveData.muteUser,
|
|
64
|
+
muteBot: sensitiveData.muteBot
|
|
65
|
+
}
|
|
66
|
+
}] : [],
|
|
67
|
+
command
|
|
68
|
+
]);
|
|
50
69
|
return this.exitFlow();
|
|
51
70
|
});
|
|
52
71
|
}
|
package/dst/Voice Recording.js
CHANGED
|
@@ -20,12 +20,20 @@ class Recording extends voice_1.default {
|
|
|
20
20
|
params: {
|
|
21
21
|
terminator: this.data.terminationKey,
|
|
22
22
|
duration: parseInt(this.data.recordDurationSeconds),
|
|
23
|
-
global: channel.global,
|
|
24
23
|
sections
|
|
25
24
|
}
|
|
26
25
|
};
|
|
27
26
|
return this.triggers
|
|
28
27
|
.once(`in/voice/${channel.id}/event`, async (event) => {
|
|
28
|
+
if (channel.recordCall && sensitiveData?.muteStep) {
|
|
29
|
+
await this.sendCommands(channel, [{
|
|
30
|
+
name: 'resume-record-session',
|
|
31
|
+
params: {
|
|
32
|
+
muteUser: sensitiveData.muteUser,
|
|
33
|
+
muteBot: sensitiveData.muteBot
|
|
34
|
+
}
|
|
35
|
+
}]);
|
|
36
|
+
}
|
|
29
37
|
const url = event.params.mediaPath;
|
|
30
38
|
switch (event.params.type) {
|
|
31
39
|
case 'hangup':
|
|
@@ -34,9 +42,6 @@ class Recording extends voice_1.default {
|
|
|
34
42
|
await this.handleHangup(channel);
|
|
35
43
|
return this.exitFlow();
|
|
36
44
|
case 'record':
|
|
37
|
-
if (channel.recordCall && sensitiveData) {
|
|
38
|
-
await this.sendCommands(channel, [{ name: 'record-session' }]);
|
|
39
|
-
}
|
|
40
45
|
if (url) {
|
|
41
46
|
await this.transcript(channel, {
|
|
42
47
|
message: 'Voicemail',
|
|
@@ -71,10 +76,16 @@ class Recording extends voice_1.default {
|
|
|
71
76
|
action: 'Call Prompt',
|
|
72
77
|
actionFromBot: true
|
|
73
78
|
});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
await this.sendCommands(channel, [
|
|
80
|
+
...channel.recordCall && sensitiveData?.muteStep ? [{
|
|
81
|
+
name: 'stop-record-session',
|
|
82
|
+
params: {
|
|
83
|
+
muteUser: sensitiveData.muteUser,
|
|
84
|
+
muteBot: sensitiveData.muteBot
|
|
85
|
+
}
|
|
86
|
+
}] : [],
|
|
87
|
+
command
|
|
88
|
+
]);
|
|
78
89
|
return this.exitFlow();
|
|
79
90
|
});
|
|
80
91
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/step-voice",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Roman Zolotarov",
|
|
@@ -13,26 +13,26 @@
|
|
|
13
13
|
"npm": ">= 6.0.0"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@onereach/step-conversation": "^1.0.
|
|
16
|
+
"@onereach/step-conversation": "^1.0.22",
|
|
17
17
|
"lodash": "^4.17.21",
|
|
18
18
|
"uuid": "^8.3.2"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@onereach/flow-sdk": "^2.7.
|
|
22
|
-
"@swc/cli": "^0.1.
|
|
23
|
-
"@swc/core": "^1.2.
|
|
24
|
-
"@swc/jest": "^0.2.
|
|
25
|
-
"@types/jest": "^27.
|
|
26
|
-
"@types/lodash": "^4.14.
|
|
21
|
+
"@onereach/flow-sdk": "^2.7.103",
|
|
22
|
+
"@swc/cli": "^0.1.57",
|
|
23
|
+
"@swc/core": "^1.2.186",
|
|
24
|
+
"@swc/jest": "^0.2.21",
|
|
25
|
+
"@types/jest": "^27.5.1",
|
|
26
|
+
"@types/lodash": "^4.14.182",
|
|
27
27
|
"@types/uuid": "^8.3.4",
|
|
28
|
-
"aws-sdk": "^2.
|
|
28
|
+
"aws-sdk": "^2.1137.0",
|
|
29
29
|
"babel-runtime": "^6.26.0",
|
|
30
30
|
"docdash": "^1.2.0",
|
|
31
|
-
"husky": "^
|
|
32
|
-
"jest": "^
|
|
33
|
-
"pinst": "^
|
|
31
|
+
"husky": "^8.0.1",
|
|
32
|
+
"jest": "^28.1.0",
|
|
33
|
+
"pinst": "^3.0.0",
|
|
34
34
|
"ts-standard": "^11.0.0",
|
|
35
|
-
"typescript": "^4.6.
|
|
35
|
+
"typescript": "^4.6.4"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"/dst"
|
|
@@ -72,4 +72,4 @@
|
|
|
72
72
|
"node_modules"
|
|
73
73
|
]
|
|
74
74
|
}
|
|
75
|
-
}
|
|
75
|
+
}
|