@onereach/step-voice 1.2202.32 → 2.0.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/Cancel.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export default class VoiceCancel extends VoiceStep<any, any> {
2
2
  constructor(thread: import("@onereach/flow-sdk/dst/types").IThread, stepData: import("@onereach/flow-sdk/dst/types").IStepData<any>);
3
- runStep(): Promise<import("@onereach/flow-sdk/dst/types").ITriggers>;
3
+ runStep(): Promise<unknown>;
4
4
  }
5
5
  import VoiceStep from "./voice";
package/dst/Cancel.js CHANGED
@@ -8,22 +8,9 @@ class VoiceCancel extends voice_1.default {
8
8
  }
9
9
  async runStep() {
10
10
  const channel = await this.fetchData();
11
- return this.triggers
12
- .once(`in/voice/${channel.id}/event`, async (event) => {
13
- switch (event.params.type) {
14
- case 'cancel': {
15
- return this.exitStep('next');
16
- }
17
- case 'hangup': {
18
- await this.handleHangup(channel);
19
- return this.end();
20
- }
21
- }
22
- })
23
- .otherwise(async () => {
24
- await this.cancel();
25
- await this.sendCommands(channel, [{ name: 'cancel' }]);
26
- });
11
+ await this.cancel();
12
+ await this.sendCommands(channel, [{ name: 'cancel' }]);
13
+ return this.exitStep('next');
27
14
  }
28
15
  }
29
16
  exports.default = VoiceCancel;
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, [{ name: 'record-session' }]);
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) {
@@ -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, channel.recordCall && sensitiveData ? [{ name: 'stop-record-session' }, command] : [command]);
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
  }
@@ -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
- user: sipUser,
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
- user: sipUser,
61
+ username: sipUser,
54
62
  password: sipPassword
55
63
  }
56
64
  : undefined,
@@ -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;
@@ -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, [command]);
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
  }
@@ -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);
@@ -28,7 +37,8 @@ class SayMessage extends voice_1.default {
28
37
  const command = {
29
38
  name: 'speak',
30
39
  params: {
31
- global: channel.global,
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, [command]);
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
  }
@@ -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
- if (channel.recordCall && sensitiveData) {
75
- await this.sendCommands(channel, [{ name: 'stop-record-session' }]);
76
- }
77
- await this.sendCommands(channel, [command]);
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": "1.2202.32",
3
+ "version": "2.0.2",
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.19",
16
+ "@onereach/step-conversation": "^1.0.21",
17
17
  "lodash": "^4.17.21",
18
18
  "uuid": "^8.3.2"
19
19
  },
20
20
  "devDependencies": {
21
- "@onereach/flow-sdk": "^2.7.88",
22
- "@swc/cli": "^0.1.55",
23
- "@swc/core": "^1.2.151",
24
- "@swc/jest": "^0.2.20",
25
- "@types/jest": "^27.4.1",
26
- "@types/lodash": "^4.14.179",
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.1088.0",
28
+ "aws-sdk": "^2.1137.0",
29
29
  "babel-runtime": "^6.26.0",
30
30
  "docdash": "^1.2.0",
31
- "husky": "^7.0.4",
32
- "jest": "^27.5.1",
33
- "pinst": "^2.1.6",
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.2"
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
+ }