@onereach/step-voice 4.0.35 → 4.0.37

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.
@@ -143,33 +143,27 @@ class GlobalCommand extends voice_1.default {
143
143
  async exitThread(event, type, stepExit) {
144
144
  this.log.debug('exitThread', type, stepExit);
145
145
  const params = event.params;
146
- const data = { type };
146
+ const result = { type };
147
147
  if (!lodash_1.default.isEmpty(params.tags)) {
148
- data.tags = params.tags;
148
+ result.tags = params.tags;
149
149
  }
150
150
  if (!lodash_1.default.isEmpty(params.out)) {
151
- data.out = params.out;
151
+ result.out = params.out;
152
152
  }
153
153
  const digits = params.digits ?? params.digit;
154
154
  if (!lodash_1.default.isEmpty(digits)) {
155
- data.digit = digits;
156
- data.value = digits;
155
+ result.digit = digits;
156
+ result.value = digits;
157
157
  }
158
158
  if (!lodash_1.default.isEmpty(params.phrases)) {
159
159
  const phrases = params.phrases;
160
- data.value = phrases[0].text;
161
- data.interpretation = phrases;
160
+ result.value = phrases[0].text;
161
+ result.interpretation = phrases;
162
162
  }
163
163
  // add information about call recording to a merge field
164
164
  if (!lodash_1.default.isEmpty(params.callRecording)) {
165
- data.callRecording = params.callRecording;
165
+ result.callRecording = params.callRecording;
166
166
  }
167
- // await this.sendCommands(channel, [{
168
- // name: 'grammar',
169
- // params: {}
170
- // }])
171
- // channel.global = null;
172
- // await this.updateData()
173
167
  const exitLabel = lodash_1.default.replace(this.getExitStepLabel(stepExit) ?? stepExit, /\W+/g, '');
174
168
  await this.process.runThread({
175
169
  id: `${exitLabel}_${(0, nanoid_1.nanoid)(8)}`,
@@ -178,7 +172,8 @@ class GlobalCommand extends voice_1.default {
178
172
  direct: true,
179
173
  result: {
180
174
  conversation: this.conversation,
181
- conversationThreadId: this.dataThreadId
175
+ conversationThreadId: this.dataThreadId,
176
+ ...result
182
177
  },
183
178
  exitStep: stepExit,
184
179
  step: this.currentStepId
package/dst/Transfer.d.ts CHANGED
@@ -8,6 +8,11 @@ interface INPUT {
8
8
  value: string;
9
9
  }>;
10
10
  refer: boolean;
11
+ gatewaySettigsMode?: string;
12
+ identifierForInheritance?: string;
13
+ sipHost?: string;
14
+ sipUser?: string;
15
+ sipPassword?: string;
11
16
  }
12
17
  interface EVENT {
13
18
  type: EventType;
package/dst/Transfer.js CHANGED
@@ -48,19 +48,26 @@ class Transfer extends voice_1.default {
48
48
  return this.exitFlow();
49
49
  });
50
50
  this.triggers.otherwise(async () => {
51
- const { phoneNumber, sessionTimeout, destination, sipHeaders = [], refer } = this.data;
51
+ const { phoneNumber, sessionTimeout, destination, sipHeaders = [], sipHost, sipUser, sipPassword, refer, gatewaySettigsMode, identifierForInheritance } = this.data;
52
52
  const destinationIsSip = (/^sip:/i).test(destination);
53
53
  const destinationIsUser = (/^user:/i).test(destination);
54
54
  const callerID = phoneNumber;
55
55
  const timeout = Number(sessionTimeout);
56
+ const inheritGatewaySetting = gatewaySettigsMode === 'inherit';
56
57
  const headers = Object.fromEntries(sipHeaders.map(({ name, value }) => [name, value]));
57
58
  const command = {
58
59
  name: destinationIsSip ? (refer ? 'refer' : 'bridge_sip') : (destinationIsUser ? 'bridge_user' : 'bridge'),
59
60
  params: {
60
- botNumber: channel.botNumber,
61
+ botNumber: inheritGatewaySetting ? identifierForInheritance : channel.botNumber,
61
62
  transferFrom: callerID,
62
63
  transferTo: destination,
63
64
  headers,
65
+ gateway: sipHost ? {
66
+ host: sipHost,
67
+ user: sipUser,
68
+ username: sipUser,
69
+ password: sipPassword
70
+ } : undefined,
64
71
  timeout
65
72
  }
66
73
  };
package/dst/step.d.ts CHANGED
@@ -1,10 +1,18 @@
1
1
  import Step from '@onereach/flow-sdk/dst/step';
2
2
  import { IThreadId, IEvent, IStepResult, IMergeField, IMergeFieldKey } from '@onereach/flow-sdk/dst/types';
3
- import { IConversationData, IConversation, IConversationStep } from '@onereach/step-conversation/dst/types';
3
+ import { IConversationStep } from '@onereach/step-conversation/dst/types';
4
4
  export interface ConvStepDataIn {
5
5
  conversation?: IMergeFieldKey | IMergeField;
6
6
  conversationThread?: string;
7
7
  }
8
+ interface IConversation {
9
+ glb: IConversationStep[];
10
+ lcl: IConversationStep[];
11
+ trg: Record<string, {}>;
12
+ }
13
+ interface IConversationData {
14
+ _conv: IConversation;
15
+ }
8
16
  export default class ConvStep<TData = unknown, TIn = unknown, TOut = unknown, TParams = any> extends Step<TIn & ConvStepDataIn, TOut, TParams> {
9
17
  convDataCache?: TData & IConversationData;
10
18
  get conversation(): IMergeFieldKey | IMergeField;
@@ -52,3 +60,4 @@ export default class ConvStep<TData = unknown, TIn = unknown, TOut = unknown, TP
52
60
  _fetchData(): Promise<(TData & IConversationData) | undefined>;
53
61
  _clearCache(): void;
54
62
  }
63
+ export {};
package/package.json CHANGED
@@ -1,8 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "4.0.35",
4
- "pkg_version": "4",
5
- "dep_version": "^$[__package.pkg_version]",
3
+ "version": "4.0.37",
6
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
7
5
  "contributors": [
8
6
  "Roman Zolotarov",
@@ -44,12 +42,13 @@
44
42
  "clean": "rm -rf dst",
45
43
  "build": "npm run clean && tsc -p ./tsconfig.build.json",
46
44
  "build-fast": "npm run clean && swc ./src -d ./dst",
47
- "deploy": "sh scripts/deploy.sh",
48
- "download-prod": "sh scripts/download.sh prod",
49
- "download-dev": "sh scripts/download.sh dev",
50
- "upload-prod": "sh scripts/upload.sh prod",
51
- "upload-dev": "sh scripts/upload.sh dev",
45
+ "deploy": "./scripts/deploy.sh",
46
+ "download-prod": "./scripts/download.sh prod",
47
+ "download-dev": "s./scripts/download.sh dev",
48
+ "upload-prod": "./scripts/upload.sh prod",
49
+ "upload-dev": "./scripts/upload.sh dev",
52
50
  "publish-patch": "npm run build && npm version patch && npm publish",
51
+ "publish-beta": "./scripts/publish-beta.sh",
53
52
  "test": "jest"
54
53
  },
55
54
  "repository": {