@onereach/step-voice 6.0.8 → 6.0.9
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.js +19 -11
- package/dst/voice.d.ts +6 -1
- package/package.json +1 -1
package/dst/Initiate Call.js
CHANGED
|
@@ -110,30 +110,38 @@ class InitiateCall extends voice_1.default {
|
|
|
110
110
|
break;
|
|
111
111
|
}
|
|
112
112
|
case 'error': {
|
|
113
|
-
const error =
|
|
113
|
+
const error = event.params.error;
|
|
114
|
+
const errorStatus = error?.originateStatus ?? 'UNKNOWN';
|
|
114
115
|
const errorCall = {
|
|
115
116
|
botNumber,
|
|
116
117
|
endUserNumber
|
|
117
118
|
};
|
|
118
|
-
switch (
|
|
119
|
+
switch (errorStatus) {
|
|
119
120
|
case 'USER_BUSY':
|
|
120
|
-
await this.transcript(errorCall, {
|
|
121
|
+
await this.transcript(errorCall, {
|
|
122
|
+
action: 'Call Busy',
|
|
123
|
+
actionFromBot: true
|
|
124
|
+
});
|
|
121
125
|
await this.updateData();
|
|
122
126
|
return this.exitStep('busy', errorCall);
|
|
123
127
|
case 'NO_ANSWER':
|
|
124
|
-
await this.transcript(errorCall, { action: 'Call No Answer' });
|
|
125
|
-
await this.updateData();
|
|
126
|
-
return this.exitStep('no answer', errorCall);
|
|
127
128
|
case 'NO_USER_RESPONSE':
|
|
128
|
-
await this.transcript(errorCall, {
|
|
129
|
+
await this.transcript(errorCall, {
|
|
130
|
+
action: 'Call No Answer',
|
|
131
|
+
actionFromBot: true
|
|
132
|
+
});
|
|
129
133
|
await this.updateData();
|
|
130
134
|
return this.exitStep('no answer', errorCall);
|
|
135
|
+
default:
|
|
136
|
+
break;
|
|
131
137
|
}
|
|
132
|
-
await this.transcript(errorCall, {
|
|
133
|
-
|
|
138
|
+
await this.transcript(errorCall, {
|
|
139
|
+
action: 'Call Error',
|
|
140
|
+
actionFromBot: true
|
|
141
|
+
});
|
|
134
142
|
return this.throwError({
|
|
135
|
-
name:
|
|
136
|
-
message: `${
|
|
143
|
+
name: error?.name ?? 'VoiceError',
|
|
144
|
+
message: `${String(error?.date)}: ${errorStatus}`
|
|
137
145
|
});
|
|
138
146
|
}
|
|
139
147
|
default:
|
package/dst/voice.d.ts
CHANGED
|
@@ -28,9 +28,14 @@ export interface IVoiceCall extends IConversationData {
|
|
|
28
28
|
export type EventType = 'hangup' | 'error' | 'cancel' | 'background' | 'avm-detected' | 'recognition' | 'digit' | 'digits' | 'conference-start' | 'conference-end' | 'playback' | 'timeout' | 'record' | 'bridge' | 'bridge/ended' | 'is_flow_ready' | 'call' | 'dtmf-sent';
|
|
29
29
|
export declare class VoiceStepError extends BasicError {
|
|
30
30
|
}
|
|
31
|
-
export type VoicerError = Error
|
|
31
|
+
export type VoicerError = Error & {
|
|
32
|
+
originateStatus?: string;
|
|
33
|
+
date?: string;
|
|
34
|
+
} | string & {
|
|
32
35
|
message?: never;
|
|
33
36
|
name?: never;
|
|
37
|
+
date?: never;
|
|
38
|
+
originateStatus?: never;
|
|
34
39
|
};
|
|
35
40
|
export interface VoiceEvent {
|
|
36
41
|
type: EventType;
|