@onereach/step-voice 7.0.10 → 7.0.11-VOIC1604.0
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 +13 -0
- package/dst/Initiate Call.js +22 -9
- package/dst/Transfer.d.ts +13 -1
- package/dst/Transfer.js +22 -10
- package/package.json +1 -1
package/dst/Initiate Call.d.ts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import VoiceStep, { CallStartEvent, TODO } from './voice';
|
|
2
|
+
declare const enum GATEWAY_SETTINGS_MODE {
|
|
3
|
+
DEFAULT = "default",
|
|
4
|
+
CUSTOM = "custom",
|
|
5
|
+
INHERIT = "inherit",
|
|
6
|
+
PROFILE = "profile"
|
|
7
|
+
}
|
|
8
|
+
declare const enum SIP_PROFILE {
|
|
9
|
+
DEFAULT = "default",
|
|
10
|
+
INTERNAL = "internal",
|
|
11
|
+
EXTERNAL = "external"
|
|
12
|
+
}
|
|
2
13
|
interface INPUT {
|
|
3
14
|
callId?: string;
|
|
4
15
|
sessionTimeout?: number | string;
|
|
@@ -8,9 +19,11 @@ interface INPUT {
|
|
|
8
19
|
tts: TODO;
|
|
9
20
|
from: string;
|
|
10
21
|
endUserNumber: string;
|
|
22
|
+
gatewaySettingsMode?: GATEWAY_SETTINGS_MODE;
|
|
11
23
|
sipHost?: string;
|
|
12
24
|
sipUser?: string;
|
|
13
25
|
sipPassword?: string;
|
|
26
|
+
sipProfile?: SIP_PROFILE;
|
|
14
27
|
timeout?: number | string;
|
|
15
28
|
headers?: Array<{
|
|
16
29
|
name: string;
|
package/dst/Initiate Call.js
CHANGED
|
@@ -47,7 +47,7 @@ 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, enableWhisperTransfer, whisperAnnounceAudio, textType, whisperCustomerConversation, } = this.data;
|
|
50
|
+
const { asr, tts, from: botNumber, endUserNumber, gatewaySettingsMode, sipHost, sipUser, sipPassword, sipProfile, timeout, headers, enableSpoofCallerId, spoofCallerId, isAMD, otherCallRef, otherCallRefThread, handleCancel, enableWhisperTransfer, whisperAnnounceAudio, textType, whisperCustomerConversation, } = this.data;
|
|
51
51
|
const call = await this.fetchData();
|
|
52
52
|
this.triggers.once(`in/voice/${call.id}/event`, async (event) => {
|
|
53
53
|
switch (event.params.type) {
|
|
@@ -191,6 +191,25 @@ class InitiateCall extends voice_1.default {
|
|
|
191
191
|
memo[header.name] = `${header.value}`;
|
|
192
192
|
return memo;
|
|
193
193
|
}, {});
|
|
194
|
+
// GET SIP PROFILE SETTINGS
|
|
195
|
+
let gateway;
|
|
196
|
+
const profile = sipProfile !== "default" /* SIP_PROFILE.DEFAULT */ ? sipProfile : undefined;
|
|
197
|
+
switch (gatewaySettingsMode) {
|
|
198
|
+
case "custom" /* GATEWAY_SETTINGS_MODE.CUSTOM */:
|
|
199
|
+
gateway = {
|
|
200
|
+
host: sipHost,
|
|
201
|
+
user: sipUser,
|
|
202
|
+
username: sipUser,
|
|
203
|
+
password: sipPassword,
|
|
204
|
+
profile
|
|
205
|
+
};
|
|
206
|
+
break;
|
|
207
|
+
case "profile" /* GATEWAY_SETTINGS_MODE.PROFILE */:
|
|
208
|
+
gateway = {
|
|
209
|
+
profile
|
|
210
|
+
};
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
194
213
|
const params = {
|
|
195
214
|
id: call.id,
|
|
196
215
|
from: botNumber,
|
|
@@ -200,16 +219,10 @@ class InitiateCall extends voice_1.default {
|
|
|
200
219
|
enableSpoofCallerId,
|
|
201
220
|
spoofCallerId
|
|
202
221
|
},
|
|
203
|
-
gateway: sipHost
|
|
204
|
-
? {
|
|
205
|
-
host: sipHost,
|
|
206
|
-
username: sipUser,
|
|
207
|
-
password: sipPassword
|
|
208
|
-
}
|
|
209
|
-
: undefined,
|
|
210
222
|
timeout: originateTimeout,
|
|
211
223
|
version: 2,
|
|
212
|
-
sessionExpireTime: this.session.expireTime
|
|
224
|
+
sessionExpireTime: this.session.expireTime,
|
|
225
|
+
gateway,
|
|
213
226
|
};
|
|
214
227
|
if (otherCallRef) {
|
|
215
228
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
package/dst/Transfer.d.ts
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import VoiceStep, { VoiceEvent } from './voice';
|
|
2
|
+
declare const enum GATEWAY_SETTINGS_MODE {
|
|
3
|
+
DEFAULT = "default",
|
|
4
|
+
CUSTOM = "custom",
|
|
5
|
+
INHERIT = "inherit",
|
|
6
|
+
PROFILE = "profile"
|
|
7
|
+
}
|
|
8
|
+
declare const enum SIP_PROFILE {
|
|
9
|
+
DEFAULT = "default",
|
|
10
|
+
INTERNAL = "internal",
|
|
11
|
+
EXTERNAL = "external"
|
|
12
|
+
}
|
|
2
13
|
interface INPUT {
|
|
3
14
|
destination: string;
|
|
4
15
|
phoneNumber: string;
|
|
@@ -8,11 +19,12 @@ interface INPUT {
|
|
|
8
19
|
value: string;
|
|
9
20
|
}>;
|
|
10
21
|
refer: boolean;
|
|
11
|
-
gatewaySettigsMode?: string;
|
|
12
22
|
from?: string;
|
|
23
|
+
gatewaySettingsMode?: GATEWAY_SETTINGS_MODE;
|
|
13
24
|
sipHost?: string;
|
|
14
25
|
sipUser?: string;
|
|
15
26
|
sipPassword?: string;
|
|
27
|
+
sipProfile?: SIP_PROFILE;
|
|
16
28
|
muteRecording?: boolean;
|
|
17
29
|
}
|
|
18
30
|
interface EVENT extends VoiceEvent {
|
package/dst/Transfer.js
CHANGED
|
@@ -52,13 +52,32 @@ class Transfer extends voice_1.default {
|
|
|
52
52
|
return this.exitFlow();
|
|
53
53
|
});
|
|
54
54
|
this.triggers.otherwise(async () => {
|
|
55
|
-
const { phoneNumber, sessionTimeout, destination, sipHeaders = [], sipHost, sipUser, sipPassword, refer,
|
|
55
|
+
const { phoneNumber, sessionTimeout, destination, sipHeaders = [], sipHost, sipUser, sipPassword, sipProfile, refer, gatewaySettingsMode, from, muteRecording } = this.data;
|
|
56
56
|
const destinationIsSip = (/^sip:/i).test(destination);
|
|
57
57
|
const destinationIsUser = (/^user:/i).test(destination);
|
|
58
58
|
const callerID = phoneNumber;
|
|
59
59
|
const timeout = Number(sessionTimeout);
|
|
60
|
-
const inheritGatewaySetting =
|
|
60
|
+
const inheritGatewaySetting = gatewaySettingsMode === 'inherit';
|
|
61
61
|
const headers = Object.fromEntries(sipHeaders.map(({ name, value }) => [name, value]));
|
|
62
|
+
// GET SIP PROFILE SETTINGS
|
|
63
|
+
let gateway;
|
|
64
|
+
const profile = sipProfile !== "default" /* SIP_PROFILE.DEFAULT */ ? sipProfile : undefined;
|
|
65
|
+
switch (gatewaySettingsMode) {
|
|
66
|
+
case "custom" /* GATEWAY_SETTINGS_MODE.CUSTOM */:
|
|
67
|
+
gateway = {
|
|
68
|
+
host: sipHost,
|
|
69
|
+
user: sipUser,
|
|
70
|
+
username: sipUser,
|
|
71
|
+
password: sipPassword,
|
|
72
|
+
profile
|
|
73
|
+
};
|
|
74
|
+
break;
|
|
75
|
+
case "profile" /* GATEWAY_SETTINGS_MODE.PROFILE */:
|
|
76
|
+
gateway = {
|
|
77
|
+
profile
|
|
78
|
+
};
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
62
81
|
const command = {
|
|
63
82
|
name: destinationIsSip ? (refer ? 'refer' : 'bridge_sip') : (destinationIsUser ? 'bridge_user' : 'bridge'),
|
|
64
83
|
params: {
|
|
@@ -66,14 +85,7 @@ class Transfer extends voice_1.default {
|
|
|
66
85
|
transferFrom: callerID,
|
|
67
86
|
transferTo: destination,
|
|
68
87
|
headers,
|
|
69
|
-
gateway
|
|
70
|
-
? {
|
|
71
|
-
host: sipHost,
|
|
72
|
-
user: sipUser,
|
|
73
|
-
username: sipUser,
|
|
74
|
-
password: sipPassword
|
|
75
|
-
}
|
|
76
|
-
: undefined,
|
|
88
|
+
gateway,
|
|
77
89
|
timeout
|
|
78
90
|
}
|
|
79
91
|
};
|