@onereach/step-voice 7.0.18-development.0 → 7.0.18
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/Transfer.js +35 -11
- package/package.json +1 -1
package/dst/Transfer.js
CHANGED
|
@@ -59,13 +59,22 @@ class Transfer extends voice_1.default {
|
|
|
59
59
|
const timeout = Number(sessionTimeout);
|
|
60
60
|
const inheritGatewaySetting = gatewaySettingsMode === 'inherit';
|
|
61
61
|
const headers = Object.fromEntries(sipHeaders.map(({ name, value }) => [name, value]));
|
|
62
|
-
|
|
63
|
-
let
|
|
62
|
+
let transferFrom = callerID;
|
|
63
|
+
let transferTo = destination;
|
|
64
|
+
let replacesDialog;
|
|
64
65
|
if (refer && withReplaces && replacesConversation) {
|
|
65
|
-
const
|
|
66
|
+
const replacesCall = replacesConversationThread
|
|
66
67
|
? await this.process.getSafeThread(replacesConversationThread).get(replacesConversation)
|
|
67
68
|
: await this.getConversationByName(replacesConversation);
|
|
68
|
-
|
|
69
|
+
// For attended transfer: transferFrom becomes current call's ID,
|
|
70
|
+
// and replacesDialog carries the dialog identifiers for Replaces header
|
|
71
|
+
transferFrom = call.id;
|
|
72
|
+
replacesDialog = {
|
|
73
|
+
callId: replacesCall['toCallId'],
|
|
74
|
+
toTag: replacesCall['toTag'],
|
|
75
|
+
fromTag: replacesCall['fromTag'],
|
|
76
|
+
uri: replacesCall['toUri'],
|
|
77
|
+
};
|
|
69
78
|
}
|
|
70
79
|
// GET SIP PROFILE SETTINGS
|
|
71
80
|
let gateway;
|
|
@@ -84,21 +93,36 @@ class Transfer extends voice_1.default {
|
|
|
84
93
|
gateway = gateway = profile != null ? { profile } : undefined;
|
|
85
94
|
break;
|
|
86
95
|
}
|
|
96
|
+
let commandName = 'bridge';
|
|
97
|
+
if (destinationIsSip) {
|
|
98
|
+
commandName = refer ? 'refer' : 'bridge_sip';
|
|
99
|
+
}
|
|
100
|
+
else if (destinationIsUser) {
|
|
101
|
+
commandName = 'bridge_user';
|
|
102
|
+
}
|
|
103
|
+
const botNumber = inheritGatewaySetting ? from : call.botNumber;
|
|
104
|
+
const maxLoops = this.session.data?.loopPrevention?.enabled
|
|
105
|
+
? this.session.data.loopPrevention.maxLoops
|
|
106
|
+
: undefined;
|
|
87
107
|
const command = {
|
|
88
|
-
name:
|
|
108
|
+
name: commandName,
|
|
89
109
|
params: {
|
|
90
|
-
botNumber
|
|
91
|
-
transferFrom
|
|
92
|
-
transferTo
|
|
110
|
+
botNumber,
|
|
111
|
+
transferFrom,
|
|
112
|
+
transferTo,
|
|
93
113
|
headers,
|
|
94
114
|
gateway,
|
|
95
115
|
timeout,
|
|
96
|
-
maxLoops
|
|
97
|
-
|
|
116
|
+
maxLoops,
|
|
117
|
+
...(replacesDialog && { replacesDialog }),
|
|
98
118
|
}
|
|
99
119
|
};
|
|
100
120
|
const muteAfterTransfer = !!muteRecording;
|
|
101
|
-
await this.pauseRecording(call, command, {
|
|
121
|
+
await this.pauseRecording(call, command, {
|
|
122
|
+
muteStep: muteAfterTransfer,
|
|
123
|
+
muteBot: muteAfterTransfer,
|
|
124
|
+
muteUser: muteAfterTransfer
|
|
125
|
+
});
|
|
102
126
|
await this.transcript(call, {
|
|
103
127
|
action: 'Transfer Start',
|
|
104
128
|
actionFromBot: true,
|