@onereach/step-voice 2.0.3 → 4.0.1

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.
@@ -1,5 +1,6 @@
1
1
  export default class GlobalCommand 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
+ get autoCancel(): undefined;
3
4
  runStep(): Promise<void>;
4
5
  globThread(): Promise<void>;
5
6
  hangup(channel: any, event: any): Promise<unknown>;
@@ -8,6 +8,9 @@ class GlobalCommand extends voice_1.default {
8
8
  get isGlobal() {
9
9
  return true;
10
10
  }
11
+ get autoCancel() {
12
+ return undefined;
13
+ }
11
14
  async runStep() {
12
15
  const channel = await this.fetchData();
13
16
  // if (recordCall || _.includes(['bot', 'both'], processHangUp)) {
@@ -1,6 +1,7 @@
1
1
  export default class InitiateCall 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
- get conversation(): string | undefined;
3
+ get conversation(): string;
4
+ get autoCancel(): undefined;
4
5
  runStep(): Promise<void>;
5
6
  waitForCall(): Promise<void>;
6
7
  error: {
@@ -8,7 +8,10 @@ const uuid = require('uuid');
8
8
  const defaultSessionTimeout = 5 * 60 * 1000;
9
9
  class InitiateCall extends voice_1.default {
10
10
  get conversation() {
11
- return this.step.dataOut.name;
11
+ return this.step.dataOut?.name ?? 'conversation';
12
+ }
13
+ get autoCancel() {
14
+ return undefined;
12
15
  }
13
16
  async runStep() {
14
17
  const { from: botNumber, endUserNumber, sipHost, sipUser, sipPassword, timeout, headers, originationId = uuid.v4(), enableSpoofCallerId, spoofCallerId } = this.data;
@@ -57,13 +57,15 @@ class SayMessage extends voice_1.default {
57
57
  actionFromBot: true
58
58
  });
59
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
- }] : [],
60
+ ...channel.recordCall && sensitiveData?.muteStep
61
+ ? [{
62
+ name: 'stop-record-session',
63
+ params: {
64
+ muteUser: sensitiveData.muteUser,
65
+ muteBot: sensitiveData.muteBot
66
+ }
67
+ }]
68
+ : [],
67
69
  command
68
70
  ]);
69
71
  return this.exitFlow();
package/dst/Transfer.js CHANGED
@@ -58,6 +58,7 @@ class Transfer extends voice_1.default {
58
58
  const command = {
59
59
  name: destinationIsSip ? (refer ? 'refer' : 'bridge_sip') : (destinationIsUser ? 'bridge_user' : 'bridge'),
60
60
  params: {
61
+ botNumber: channel.botNumber,
61
62
  transferFrom: callerID,
62
63
  transferTo: destination,
63
64
  headers,
@@ -1,6 +1,7 @@
1
1
  export default class WaitForCall 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
3
  get conversation(): string | undefined;
4
+ get autoCancel(): boolean;
4
5
  runStep(): Promise<void>;
5
6
  onCall(event: any): Promise<unknown>;
6
7
  }
@@ -8,6 +8,9 @@ class WaitForCall extends voice_1.default {
8
8
  get conversation() {
9
9
  return this.step.dataOut.name;
10
10
  }
11
+ get autoCancel() {
12
+ return false;
13
+ }
11
14
  async runStep() {
12
15
  const selectedNumbers = this.data.selectedNumbers;
13
16
  _.forEach(selectedNumbers, number => {
package/dst/voice.d.ts CHANGED
@@ -19,6 +19,8 @@ export interface IVoiceChannel {
19
19
  export declare class VoiceStepError extends BasicError {
20
20
  }
21
21
  export default class VoiceStep<TIn = unknown, TOut = unknown> extends ConvStep<IVoiceChannel, TIn, TOut> {
22
+ get autoCancel(): boolean | undefined;
23
+ onCancel(): Promise<void>;
22
24
  sendCommands({ id, type, callback }: IVoiceChannel, commands: any[]): Promise<any>;
23
25
  extractSectionMessages(sections: IPromtpSection[]): string;
24
26
  extractSectionFiles(sections: IPromtpSection[]): Array<{
package/dst/voice.js CHANGED
@@ -12,6 +12,13 @@ class VoiceStepError extends base_1.default {
12
12
  exports.VoiceStepError = VoiceStepError;
13
13
  class VoiceStep extends step_1.default {
14
14
  // static Error = VoiceStepError
15
+ get autoCancel() {
16
+ return true;
17
+ }
18
+ async onCancel() {
19
+ await super.onCancel();
20
+ this.exitStep('cancel');
21
+ }
15
22
  async sendCommands({ id, type, callback }, commands) {
16
23
  if (lodash_1.default.isEmpty(commands))
17
24
  return;
@@ -20,6 +27,7 @@ class VoiceStep extends step_1.default {
20
27
  name: `out/voice/${type}`,
21
28
  params: {
22
29
  id,
30
+ cancel: this.autoCancel,
23
31
  commands
24
32
  },
25
33
  reporting: this.session.getSessionRef()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "2.0.3",
3
+ "version": "4.0.1",
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.22",
16
+ "@onereach/step-conversation": "^1.0.31",
17
17
  "lodash": "^4.17.21",
18
18
  "uuid": "^8.3.2"
19
19
  },
20
20
  "devDependencies": {
21
- "@onereach/flow-sdk": "^2.7.103",
21
+ "@onereach/flow-sdk": "^3.0.5",
22
22
  "@swc/cli": "^0.1.57",
23
- "@swc/core": "^1.2.186",
23
+ "@swc/core": "^1.2.196",
24
24
  "@swc/jest": "^0.2.21",
25
- "@types/jest": "^27.5.1",
25
+ "@types/jest": "^28.1.0",
26
26
  "@types/lodash": "^4.14.182",
27
27
  "@types/uuid": "^8.3.4",
28
- "aws-sdk": "^2.1137.0",
28
+ "aws-sdk": "^2.1147.0",
29
29
  "babel-runtime": "^6.26.0",
30
30
  "docdash": "^1.2.0",
31
31
  "husky": "^8.0.1",
32
32
  "jest": "^28.1.0",
33
33
  "pinst": "^3.0.0",
34
34
  "ts-standard": "^11.0.0",
35
- "typescript": "^4.6.4"
35
+ "typescript": "^4.7.2"
36
36
  },
37
37
  "files": [
38
38
  "/dst"