@onereach/step-voice 7.0.6 → 7.0.8-VOIC1510.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/Global Command.js +21 -21
- package/dst/Wait For Call.js +9 -2
- package/dst/voice.js +6 -3
- package/package.json +1 -1
package/dst/Global Command.js
CHANGED
|
@@ -73,27 +73,30 @@ class GlobalCommand extends voice_1.default {
|
|
|
73
73
|
if (this.thread.id === this.workerThreadId) {
|
|
74
74
|
throw new Error('gc worker should not use runStep, is another gc on hangup leg?');
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
this.triggers.otherwise(async () => {
|
|
77
|
+
const worker = this.process.newThread(this.workerThreadId, thread => {
|
|
78
|
+
thread.state = {
|
|
79
|
+
name: this.worker.name,
|
|
80
|
+
step: this.step.id,
|
|
81
|
+
thread: this.dataThreadId,
|
|
82
|
+
acktrd: allowAck ? this.thread.id : undefined
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
if (worker.isNewThread) {
|
|
86
|
+
worker.activate();
|
|
87
|
+
await worker.run();
|
|
88
|
+
await this._refreshCache();
|
|
89
|
+
}
|
|
90
|
+
else if (worker.state.acktrd == null) {
|
|
91
|
+
worker.state.step = this.step.id;
|
|
92
|
+
worker.state.acktrd = allowAck ? this.thread.id : undefined;
|
|
93
|
+
await this.initGrammar(call);
|
|
94
|
+
}
|
|
83
95
|
});
|
|
84
|
-
if (worker.isNewThread) {
|
|
85
|
-
worker.activate();
|
|
86
|
-
await worker.run();
|
|
87
|
-
await this._refreshCache();
|
|
88
|
-
}
|
|
89
|
-
else if (worker.state.acktrd == null) {
|
|
90
|
-
worker.state.step = this.step.id;
|
|
91
|
-
worker.state.acktrd = allowAck ? this.thread.id : undefined;
|
|
92
|
-
await this.initGrammar(call);
|
|
93
|
-
}
|
|
94
96
|
if (allowAck) {
|
|
95
97
|
this.triggers.local('ack', ({ params: { ack } }) => {
|
|
96
|
-
|
|
98
|
+
const worker = this.process.getThread(this.workerThreadId);
|
|
99
|
+
delete worker?.state.acktrd;
|
|
97
100
|
if (ack)
|
|
98
101
|
this.exitStep('no commands');
|
|
99
102
|
else
|
|
@@ -107,9 +110,6 @@ class GlobalCommand extends voice_1.default {
|
|
|
107
110
|
async initGrammar(call) {
|
|
108
111
|
const choices = this.buildChoices({ choices: this.data.choices });
|
|
109
112
|
const grammar = await this.buildGrammar(call, choices);
|
|
110
|
-
// set grammar into voice conversation
|
|
111
|
-
// this was required by nexmo integrations, could be skipped for now
|
|
112
|
-
// channel.global = grammar;
|
|
113
113
|
const recordSession = this.data.recordCall && !call.recordCall;
|
|
114
114
|
if (recordSession) {
|
|
115
115
|
call.recordCall = true;
|
package/dst/Wait For Call.js
CHANGED
|
@@ -36,13 +36,20 @@ class WaitForCall extends voice_1.default {
|
|
|
36
36
|
delete call.from;
|
|
37
37
|
delete call.to;
|
|
38
38
|
const presetTime = (Number(endOfInputTimeout) || 0) * 60 * 1000;
|
|
39
|
+
const { sessionId: previousSessionId = '', beginningSessionId = '', } = event?.reporting ?? {};
|
|
39
40
|
await this.session.start({
|
|
40
41
|
timeout: presetTime || defaultSessionTimeout,
|
|
41
42
|
reporting: {
|
|
42
43
|
settingsKey: 'session',
|
|
43
44
|
startedBy: 'Visitor',
|
|
44
|
-
sessionType: 'Phone'
|
|
45
|
-
|
|
45
|
+
sessionType: 'Phone',
|
|
46
|
+
previousSessionId,
|
|
47
|
+
beginningSessionId
|
|
48
|
+
},
|
|
49
|
+
reportingSessions: [{
|
|
50
|
+
previousSessionId,
|
|
51
|
+
beginningSessionId
|
|
52
|
+
}]
|
|
46
53
|
});
|
|
47
54
|
await this.startConversation(call);
|
|
48
55
|
await this.transcript(call, {
|
package/dst/voice.js
CHANGED
|
@@ -51,7 +51,7 @@ class VoiceStep extends step_1.default {
|
|
|
51
51
|
async sendCommands({ id, type, callback }, commands) {
|
|
52
52
|
if (lodash_1.default.isEmpty(commands))
|
|
53
53
|
return;
|
|
54
|
-
const
|
|
54
|
+
const event = {
|
|
55
55
|
target: this.helpers.providersAccountId,
|
|
56
56
|
name: `out/voice/${type}`,
|
|
57
57
|
params: {
|
|
@@ -62,8 +62,11 @@ class VoiceStep extends step_1.default {
|
|
|
62
62
|
commands,
|
|
63
63
|
step: { key: this.session.key, trd: this.isGlobal ? this.workerThreadId : this.thread.id } // response should be sent to this session
|
|
64
64
|
},
|
|
65
|
-
reporting:
|
|
66
|
-
|
|
65
|
+
reporting: {
|
|
66
|
+
...this.session.getSessionRef(),
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const result = await this.thread.eventManager.emit(event, {
|
|
67
70
|
target: callback,
|
|
68
71
|
invocationType: 'async',
|
|
69
72
|
timeout: 5000
|