@onereach/step-voice 7.0.18-VOIC1641.8 → 7.0.18-development.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/Transfer.js +11 -35
- package/dst/step.js +0 -2
- package/package.json +1 -1
package/dst/Transfer.js
CHANGED
|
@@ -59,22 +59,13 @@ 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
|
|
64
|
-
let replacesDialog;
|
|
62
|
+
// When replaces is enabled, fetch the customer call and use its ID as transferTo
|
|
63
|
+
let finalTransferTo = destination;
|
|
65
64
|
if (refer && withReplaces && replacesConversation) {
|
|
66
|
-
const
|
|
65
|
+
const customerCall = replacesConversationThread
|
|
67
66
|
? await this.process.getSafeThread(replacesConversationThread).get(replacesConversation)
|
|
68
67
|
: await this.getConversationByName(replacesConversation);
|
|
69
|
-
|
|
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
|
-
};
|
|
68
|
+
finalTransferTo = customerCall['id'];
|
|
78
69
|
}
|
|
79
70
|
// GET SIP PROFILE SETTINGS
|
|
80
71
|
let gateway;
|
|
@@ -93,36 +84,21 @@ class Transfer extends voice_1.default {
|
|
|
93
84
|
gateway = gateway = profile != null ? { profile } : undefined;
|
|
94
85
|
break;
|
|
95
86
|
}
|
|
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;
|
|
107
87
|
const command = {
|
|
108
|
-
name:
|
|
88
|
+
name: destinationIsSip ? (refer ? 'refer' : 'bridge_sip') : (destinationIsUser ? 'bridge_user' : 'bridge'),
|
|
109
89
|
params: {
|
|
110
|
-
botNumber,
|
|
111
|
-
transferFrom,
|
|
112
|
-
transferTo,
|
|
90
|
+
botNumber: inheritGatewaySetting ? from : call.botNumber,
|
|
91
|
+
transferFrom: callerID,
|
|
92
|
+
transferTo: finalTransferTo,
|
|
113
93
|
headers,
|
|
114
94
|
gateway,
|
|
115
95
|
timeout,
|
|
116
|
-
maxLoops,
|
|
117
|
-
|
|
96
|
+
maxLoops: this.session.data?.loopPrevention?.enabled ? this.session.data.loopPrevention.maxLoops : undefined,
|
|
97
|
+
withReplaces
|
|
118
98
|
}
|
|
119
99
|
};
|
|
120
100
|
const muteAfterTransfer = !!muteRecording;
|
|
121
|
-
await this.pauseRecording(call, command, {
|
|
122
|
-
muteStep: muteAfterTransfer,
|
|
123
|
-
muteBot: muteAfterTransfer,
|
|
124
|
-
muteUser: muteAfterTransfer
|
|
125
|
-
});
|
|
101
|
+
await this.pauseRecording(call, command, { muteStep: muteAfterTransfer, muteBot: muteAfterTransfer, muteUser: muteAfterTransfer });
|
|
126
102
|
await this.transcript(call, {
|
|
127
103
|
action: 'Transfer Start',
|
|
128
104
|
actionFromBot: true,
|
package/dst/step.js
CHANGED
|
@@ -60,7 +60,6 @@ class ConvStep extends step_1.default {
|
|
|
60
60
|
throw new Error(`missing conversation cache in state ${this.state.name}`);
|
|
61
61
|
// console.log('UPDATE', this.conversation, this.thread.id, this.step.label, this.convDataCache?._conv.que)
|
|
62
62
|
const convDataThread = this.process.getSafeThread(this.dataThreadId);
|
|
63
|
-
this.log.error({ conversation: this.conversation, thread: this.thread.id, step: this.step.label, convDataCache: this.convDataCache }, 'Updating conversation data');
|
|
64
63
|
await convDataThread.set(this.conversation, this.convDataCache);
|
|
65
64
|
}
|
|
66
65
|
async hasConversation() {
|
|
@@ -158,7 +157,6 @@ class ConvStep extends step_1.default {
|
|
|
158
157
|
const convDataThread = this.process.getSafeThread(this.dataThreadId);
|
|
159
158
|
this.convDataCache = await convDataThread.get(this.conversation);
|
|
160
159
|
// console.log('FETCH', this.conversation, this.thread.id, this.step.label, this.convDataCache?._conv.que)
|
|
161
|
-
this.log.error({ conversation: this.conversation, thread: this.thread.id, step: this.step.label, convDataCache: this.convDataCache }, 'Fetched conversation data');
|
|
162
160
|
return this.convDataCache;
|
|
163
161
|
}
|
|
164
162
|
_clearCache() {
|