@fonoster/apiserver 0.6.2 → 0.7.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/dist/applications/buildService.d.ts +3 -3
- package/dist/applications/createApplication.d.ts +2 -2
- package/dist/applications/createGetFnUtil.d.ts +2 -2
- package/dist/applications/deleteApplication.d.ts +3 -3
- package/dist/applications/getApplication.d.ts +2 -2
- package/dist/applications/getApplication.js +1 -3
- package/dist/applications/types.d.ts +1 -1
- package/dist/applications/utils/applicationWithEncodedStruct.js +20 -1
- package/dist/applications/utils/convertToApplicationData.js +1 -1
- package/dist/applications/utils/getApplicationValidationSchema.d.ts +3 -3
- package/dist/applications/utils/getApplicationValidationSchema.js +6 -3
- package/dist/applications/utils/prepareForValidation.js +1 -1
- package/dist/calls/ListCallsRequestSchema.d.ts +1 -4
- package/dist/calls/ListCallsRequestSchema.js +0 -4
- package/dist/calls/buildService.d.ts +2 -2
- package/dist/calls/buildService.js +6 -5
- package/dist/calls/createCall.d.ts +6 -4
- package/dist/calls/createCall.js +18 -8
- package/dist/calls/createFetchCalls.js +3 -7
- package/dist/calls/createFetchSingleCall.js +9 -2
- package/dist/calls/{trackCall.d.ts → makeTrackCall.d.ts} +3 -3
- package/dist/calls/makeTrackCall.js +67 -0
- package/dist/calls/runCallManager.js +12 -13
- package/dist/calls/types.d.ts +8 -42
- package/dist/calls/types.js +5 -38
- package/dist/core/seed.js +20 -0
- package/dist/core/services.d.ts +24 -25
- package/dist/envs.d.ts +0 -2
- package/dist/envs.js +1 -3
- package/dist/events/createInfluxDbPub.js +2 -1
- package/dist/events/mapCallDirectionToEnum.d.ts +3 -0
- package/dist/events/mapCallDirectionToEnum.js +37 -0
- package/dist/events/nats.js +5 -6
- package/dist/events/transformEvent.d.ts +2 -0
- package/dist/events/transformEvent.js +72 -0
- package/dist/index.js +4 -5
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/makeHandleDialEventsWithNats.d.ts +5 -0
- package/dist/{voice/handlers/StasisEnd.js → utils/makeHandleDialEventsWithNats.js} +10 -15
- package/dist/utils/makeHandleDialEventsWithVoiceClient.d.ts +5 -0
- package/dist/{voice/handlers/dial/handleDialEvents.js → utils/makeHandleDialEventsWithVoiceClient.js} +6 -17
- package/dist/utils/mapDialStatus.d.ts +3 -0
- package/dist/utils/mapDialStatus.js +38 -0
- package/dist/voice/VoiceClientImpl.d.ts +10 -1
- package/dist/voice/VoiceClientImpl.js +47 -7
- package/dist/voice/VoiceDispatcher.d.ts +6 -2
- package/dist/voice/VoiceDispatcher.js +50 -37
- package/dist/voice/connectToAri.js +3 -1
- package/dist/voice/createExternalMediaConfig.d.ts +3 -0
- package/dist/voice/createExternalMediaConfig.js +4 -1
- package/dist/voice/handlers/Answer.js +1 -1
- package/dist/voice/handlers/Hangup.js +1 -1
- package/dist/voice/handlers/Mute.js +1 -1
- package/dist/voice/handlers/Play.js +2 -2
- package/dist/voice/handlers/PlayDtmf.js +1 -1
- package/dist/voice/handlers/PlaybackControl.js +1 -1
- package/dist/voice/handlers/Record.js +2 -2
- package/dist/voice/handlers/Say.js +2 -2
- package/dist/voice/handlers/StreamGather.d.ts +3 -0
- package/dist/voice/handlers/StreamGather.js +66 -0
- package/dist/voice/handlers/Unmute.js +1 -1
- package/dist/voice/handlers/dial/Dial.js +10 -6
- package/dist/voice/handlers/gather/Gather.js +5 -4
- package/dist/voice/handlers/index.d.ts +12 -0
- package/dist/voice/handlers/index.js +46 -0
- package/dist/voice/handlers/{awaitForPlaybackFinished.js → utils/awaitForPlaybackFinished.js} +1 -1
- package/dist/voice/handlers/{awaitForRecordingFinished.js → utils/awaitForRecordingFinished.js} +1 -1
- package/dist/voice/handlers/utils/index.d.ts +3 -0
- package/dist/voice/handlers/utils/index.js +37 -0
- package/dist/voice/handlers/utils/isDtmf.d.ts +2 -0
- package/dist/voice/handlers/utils/isDtmf.js +24 -0
- package/dist/voice/integrations/findIntegrationsCredentials.d.ts +1 -1
- package/dist/voice/integrations/findIntegrationsCredentials.js +2 -1
- package/dist/voice/integrations/getSttConfig.d.ts +4 -2
- package/dist/voice/integrations/getSttConfig.js +4 -1
- package/dist/voice/integrations/getTtsConfig.d.ts +2 -1
- package/dist/voice/integrations/getTtsConfig.js +5 -1
- package/dist/voice/integrations/makeCreateContainer.js +1 -1
- package/dist/voice/integrations/types.d.ts +1 -1
- package/dist/voice/makeCreateVoiceClient.js +4 -10
- package/dist/voice/makeGetChannelVar.d.ts +2 -1
- package/dist/voice/makeGetChannelVar.js +13 -0
- package/dist/voice/stt/AbstractSpeechToText.d.ts +4 -3
- package/dist/voice/stt/Deepgram.d.ts +18 -0
- package/dist/voice/stt/Deepgram.js +156 -0
- package/dist/voice/stt/Google.d.ts +5 -6
- package/dist/voice/stt/Google.js +13 -13
- package/dist/voice/stt/SpeechToTextFactory.js +2 -0
- package/dist/voice/stt/types.d.ts +22 -10
- package/dist/voice/stt/types.js +7 -0
- package/dist/voice/tts/Deepgram.d.ts +25 -0
- package/dist/voice/tts/Deepgram.js +122 -0
- package/dist/voice/tts/Google.d.ts +2 -1
- package/dist/voice/tts/Google.js +7 -8
- package/dist/voice/tts/TextToSpeechFactory.js +2 -0
- package/dist/voice/types/ari.d.ts +2 -1
- package/dist/voice/types/ari.js +1 -0
- package/dist/voice/types/voice.d.ts +9 -1
- package/package.json +10 -9
- package/dist/calls/createTrackCallSubscriber.d.ts +0 -5
- package/dist/calls/createTrackCallSubscriber.js +0 -52
- package/dist/calls/trackCall.js +0 -63
- package/dist/voice/handlers/StasisEnd.d.ts +0 -4
- package/dist/voice/handlers/dial/handleDialEvents.d.ts +0 -5
- /package/dist/voice/handlers/{awaitForPlaybackFinished.d.ts → utils/awaitForPlaybackFinished.d.ts} +0 -0
- /package/dist/voice/handlers/{awaitForRecordingFinished.d.ts → utils/awaitForRecordingFinished.d.ts} +0 -0
- /package/dist/voice/handlers/{withErrorHandling.d.ts → utils/withErrorHandling.d.ts} +0 -0
- /package/dist/voice/handlers/{withErrorHandling.js → utils/withErrorHandling.js} +0 -0
package/dist/calls/types.js
CHANGED
|
@@ -1,42 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CallDirection = exports.CallStatus = exports.CallType = exports.CALL_DETAIL_RECORD_MEASUREMENT = void 0;
|
|
4
|
+
const types_1 = require("@fonoster/types");
|
|
5
|
+
Object.defineProperty(exports, "CallDirection", { enumerable: true, get: function () { return types_1.CallDirection; } });
|
|
6
|
+
Object.defineProperty(exports, "CallStatus", { enumerable: true, get: function () { return types_1.CallStatus; } });
|
|
7
|
+
Object.defineProperty(exports, "CallType", { enumerable: true, get: function () { return types_1.CallType; } });
|
|
4
8
|
const CALL_DETAIL_RECORD_MEASUREMENT = "cdr";
|
|
5
9
|
exports.CALL_DETAIL_RECORD_MEASUREMENT = CALL_DETAIL_RECORD_MEASUREMENT;
|
|
6
|
-
var CallType;
|
|
7
|
-
(function (CallType) {
|
|
8
|
-
CallType["PROGRAMMABLE"] = "PROGRAMMABLE";
|
|
9
|
-
CallType["SIP_TRUNKING"] = "SIP_TRUNKING";
|
|
10
|
-
})(CallType || (exports.CallType = CallType = {}));
|
|
11
|
-
var HangupCause;
|
|
12
|
-
(function (HangupCause) {
|
|
13
|
-
HangupCause["NORMAL_CLEARING"] = "NORMAL_CLEARING";
|
|
14
|
-
HangupCause["CALL_REJECTED"] = "CALL_REJECTED";
|
|
15
|
-
HangupCause["UNALLOCATED"] = "UNALLOCATED";
|
|
16
|
-
HangupCause["NO_USER_RESPONSE"] = "NO_USER_RESPONSE";
|
|
17
|
-
HangupCause["NO_ROUTE_DESTINATION"] = "NO_ROUTE_DESTINATION";
|
|
18
|
-
HangupCause["NO_ANSWER"] = "NO_ANSWER";
|
|
19
|
-
HangupCause["USER_BUSY"] = "USER_BUSY";
|
|
20
|
-
HangupCause["NOT_ACCEPTABLE_HERE"] = "NOT_ACCEPTABLE_HERE";
|
|
21
|
-
HangupCause["SERVICE_UNAVAILABLE"] = "SERVICE_UNAVAILABLE";
|
|
22
|
-
HangupCause["INVALID_NUMBER_FORMAT"] = "INVALID_NUMBER_FORMAT";
|
|
23
|
-
})(HangupCause || (exports.HangupCause = HangupCause = {}));
|
|
24
|
-
var CallStatus;
|
|
25
|
-
(function (CallStatus) {
|
|
26
|
-
CallStatus["QUEUED"] = "QUEUED";
|
|
27
|
-
CallStatus["RINGING"] = "RINGING";
|
|
28
|
-
CallStatus["IN_PROGRESS"] = "IN_PROGRESS";
|
|
29
|
-
CallStatus["COMPLETED"] = "COMPLETED";
|
|
30
|
-
CallStatus["FAILED"] = "FAILED";
|
|
31
|
-
CallStatus["BUSY"] = "BUSY";
|
|
32
|
-
CallStatus["NO_ANSWER"] = "NO_ANSWER";
|
|
33
|
-
CallStatus["CANCELED"] = "CANCELED";
|
|
34
|
-
CallStatus["REJECTED"] = "REJECTED";
|
|
35
|
-
CallStatus["TIMEOUT"] = "TIMEOUT";
|
|
36
|
-
CallStatus["UNKNOWN"] = "UNKNOWN";
|
|
37
|
-
})(CallStatus || (exports.CallStatus = CallStatus = {}));
|
|
38
|
-
var CallDirection;
|
|
39
|
-
(function (CallDirection) {
|
|
40
|
-
CallDirection["INBOUND"] = "INBOUND";
|
|
41
|
-
CallDirection["OUTBOUND"] = "OUTBOUND";
|
|
42
|
-
})(CallDirection || (exports.CallDirection = CallDirection = {}));
|
package/dist/core/seed.js
CHANGED
|
@@ -53,6 +53,26 @@ function main() {
|
|
|
53
53
|
type: "STT"
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
+
yield prisma.product.upsert({
|
|
57
|
+
where: { ref: "stt.deepgram" },
|
|
58
|
+
update: {},
|
|
59
|
+
create: {
|
|
60
|
+
ref: "stt.deepgram",
|
|
61
|
+
name: "Deepgram Speech-to-Text",
|
|
62
|
+
vendor: "DEEPGRAM",
|
|
63
|
+
type: "STT"
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
yield prisma.product.upsert({
|
|
67
|
+
where: { ref: "tts.deepgram" },
|
|
68
|
+
update: {},
|
|
69
|
+
create: {
|
|
70
|
+
ref: "tts.deepgram",
|
|
71
|
+
name: "Deepgram Text-to-Speech",
|
|
72
|
+
vendor: "DEEPGRAM",
|
|
73
|
+
type: "TTS"
|
|
74
|
+
}
|
|
75
|
+
});
|
|
56
76
|
yield prisma.product.upsert({
|
|
57
77
|
where: { ref: "nlu.dialogflowcx" },
|
|
58
78
|
update: {},
|
package/dist/core/services.d.ts
CHANGED
|
@@ -8,15 +8,15 @@ declare const services: Promise<[{
|
|
|
8
8
|
handlers: {
|
|
9
9
|
createApplication: (call: {
|
|
10
10
|
request: import("@fonoster/types").CreateApplicationRequest;
|
|
11
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").
|
|
11
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").BaseApiObject) => void) => Promise<void>;
|
|
12
12
|
getApplication: (call: {
|
|
13
|
-
request: import("@fonoster/types").
|
|
13
|
+
request: import("@fonoster/types").BaseApiObject;
|
|
14
14
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").Application) => void) => Promise<void>;
|
|
15
15
|
listApplications: (call: {
|
|
16
16
|
request: import("@fonoster/types").ListApplicationsRequest;
|
|
17
17
|
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").ListApplicationsResponse) => void) => Promise<void>;
|
|
18
18
|
deleteApplication: (call: {
|
|
19
|
-
request: import("@fonoster/types").
|
|
19
|
+
request: import("@fonoster/types").BaseApiObject;
|
|
20
20
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").BaseApiObject) => void) => Promise<void>;
|
|
21
21
|
updateApplication: (call: {
|
|
22
22
|
request: import("@fonoster/types").UpdateApplicationRequest;
|
|
@@ -59,8 +59,8 @@ declare const services: Promise<[{
|
|
|
59
59
|
};
|
|
60
60
|
handlers: {
|
|
61
61
|
createCall: (call: {
|
|
62
|
-
request: import("
|
|
63
|
-
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("
|
|
62
|
+
request: import("@fonoster/types").CreateCallRequest;
|
|
63
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/common").BaseApiObject) => void) => Promise<void>;
|
|
64
64
|
listCalls: (call: {
|
|
65
65
|
request: import("../calls/types").ListCallsRequest;
|
|
66
66
|
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("../calls/types").ListCallsResponse) => void) => Promise<void>;
|
|
@@ -95,7 +95,7 @@ declare const services: Promise<[{
|
|
|
95
95
|
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").BaseApiObject) => void) => Promise<void>;
|
|
96
96
|
listWorkspaces: (call: {
|
|
97
97
|
request: unknown;
|
|
98
|
-
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").ListWorkspacesResponse) => void) => Promise<
|
|
98
|
+
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").ListWorkspacesResponse) => void) => Promise<void>;
|
|
99
99
|
inviteUserToWorkspace: (call: {
|
|
100
100
|
request: import("@fonoster/types").InviteUserToWorkspaceRequest;
|
|
101
101
|
}, callback: (error: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").InviteUserToWorkspaceResponse) => void) => Promise<void>;
|
|
@@ -174,13 +174,13 @@ declare const services: Promise<[{
|
|
|
174
174
|
request: import("@fonoster/types").CreateAgentRequestExtended;
|
|
175
175
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").AgentExtended) => void) => Promise<void>;
|
|
176
176
|
updateAgent: (call: {
|
|
177
|
-
request: import("@fonoster/types").
|
|
177
|
+
request: import("@fonoster/types/dist/utils").Flatten<import("@fonoster/types").BaseApiObject & Omit<Partial<import("@fonoster/types").CreateAgentRequest>, "username" | "extended">>;
|
|
178
178
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").AgentExtended) => void) => Promise<void>;
|
|
179
179
|
getAgent: (call: {
|
|
180
180
|
request: import("@fonoster/types").BaseApiObject;
|
|
181
181
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").AgentExtended) => void) => Promise<void>;
|
|
182
182
|
listAgents: (call: {
|
|
183
|
-
request: import("@fonoster/types").
|
|
183
|
+
request: import("@fonoster/types").ListRequest;
|
|
184
184
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
185
185
|
nextPageToken?: string;
|
|
186
186
|
items: import("@fonoster/types").AgentExtended[];
|
|
@@ -201,13 +201,15 @@ declare const services: Promise<[{
|
|
|
201
201
|
request: import("@fonoster/types").CreateCredentialsRequestExtended;
|
|
202
202
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").CredentialsExtended) => void) => Promise<void>;
|
|
203
203
|
updateCredentials: (call: {
|
|
204
|
-
request: import("@fonoster/types").
|
|
204
|
+
request: import("@fonoster/types/dist/utils").Flatten<import("@fonoster/types").BaseApiObject & {
|
|
205
|
+
name: string;
|
|
206
|
+
}>;
|
|
205
207
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").CredentialsExtended) => void) => Promise<void>;
|
|
206
208
|
getCredentials: (call: {
|
|
207
209
|
request: import("@fonoster/types").BaseApiObject;
|
|
208
210
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").CredentialsExtended) => void) => Promise<void>;
|
|
209
211
|
listCredentials: (call: {
|
|
210
|
-
request: import("@fonoster/types").
|
|
212
|
+
request: import("@fonoster/types").ListRequest;
|
|
211
213
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
212
214
|
nextPageToken?: string;
|
|
213
215
|
items: import("@fonoster/types").CredentialsExtended[];
|
|
@@ -228,13 +230,13 @@ declare const services: Promise<[{
|
|
|
228
230
|
request: import("@fonoster/types").CreateAclRequest;
|
|
229
231
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").AclExtended) => void) => Promise<void>;
|
|
230
232
|
updateAcl: (call: {
|
|
231
|
-
request: import("@fonoster/types").
|
|
233
|
+
request: import("@fonoster/types/dist/utils").Flatten<import("@fonoster/types").BaseApiObject & Partial<import("@fonoster/types").CreateAclRequest>>;
|
|
232
234
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").AclExtended) => void) => Promise<void>;
|
|
233
235
|
getAcl: (call: {
|
|
234
236
|
request: import("@fonoster/types").BaseApiObject;
|
|
235
237
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").AclExtended) => void) => Promise<void>;
|
|
236
238
|
listAcls: (call: {
|
|
237
|
-
request: import("@fonoster/types").
|
|
239
|
+
request: import("@fonoster/types").ListRequest;
|
|
238
240
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
239
241
|
nextPageToken?: string;
|
|
240
242
|
items: import("@fonoster/types").AclExtended[];
|
|
@@ -252,20 +254,17 @@ declare const services: Promise<[{
|
|
|
252
254
|
};
|
|
253
255
|
handlers: {
|
|
254
256
|
createNumber: (call: {
|
|
255
|
-
request: import("@fonoster/types").
|
|
257
|
+
request: import("@fonoster/types").CreateNumberRequest;
|
|
256
258
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").BaseApiObject) => void) => Promise<void>;
|
|
257
259
|
updateNumber: (call: {
|
|
258
|
-
request: import("@fonoster/types").
|
|
260
|
+
request: import("@fonoster/types").UpdateNumberRequest;
|
|
259
261
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").BaseApiObject) => void) => Promise<void>;
|
|
260
262
|
getNumber: (call: {
|
|
261
263
|
request: import("@fonoster/types").BaseApiObject;
|
|
262
|
-
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").
|
|
264
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").BaseApiObject) => void) => Promise<void>;
|
|
263
265
|
listNumbers: (call: {
|
|
264
266
|
request: import("@fonoster/types").ListNumbersRequest;
|
|
265
|
-
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?:
|
|
266
|
-
nextPageToken?: string;
|
|
267
|
-
items: import("@fonoster/types").INumberExtended[];
|
|
268
|
-
}) => void) => Promise<void>;
|
|
267
|
+
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").ListNumbersResponse) => void) => Promise<void>;
|
|
269
268
|
deleteNumber: (call: {
|
|
270
269
|
request: import("@fonoster/types").BaseApiObject;
|
|
271
270
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").INumberExtended) => void) => Promise<void>;
|
|
@@ -282,19 +281,19 @@ declare const services: Promise<[{
|
|
|
282
281
|
request: import("@fonoster/types").CreateTrunkRequestExtended;
|
|
283
282
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").TrunkExtended) => void) => Promise<void>;
|
|
284
283
|
updateTrunk: (call: {
|
|
285
|
-
request: import("@fonoster/types").
|
|
284
|
+
request: import("@fonoster/types/dist/utils").Flatten<import("@fonoster/types").BaseApiObject & Partial<import("@fonoster/types").CreateTrunkRequest>>;
|
|
286
285
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").TrunkExtended) => void) => Promise<void>;
|
|
287
286
|
getTrunk: (call: {
|
|
288
|
-
request: import("@fonoster/types").
|
|
287
|
+
request: import("@fonoster/types").BaseApiObject;
|
|
289
288
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").TrunkExtended) => void) => Promise<void>;
|
|
290
289
|
listTrunks: (call: {
|
|
291
|
-
request: import("@fonoster/types").
|
|
290
|
+
request: import("@fonoster/types").ListRequest;
|
|
292
291
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
293
292
|
nextPageToken?: string;
|
|
294
293
|
items: import("@fonoster/types").TrunkExtended[];
|
|
295
294
|
}) => void) => Promise<void>;
|
|
296
295
|
deleteTrunk: (call: {
|
|
297
|
-
request: import("@fonoster/types").
|
|
296
|
+
request: import("@fonoster/types").BaseApiObject;
|
|
298
297
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").TrunkExtended) => void) => Promise<void>;
|
|
299
298
|
};
|
|
300
299
|
}, {
|
|
@@ -309,13 +308,13 @@ declare const services: Promise<[{
|
|
|
309
308
|
request: import("@fonoster/types").CreateDomainRequestExtended;
|
|
310
309
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").DomainExtended) => void) => Promise<void>;
|
|
311
310
|
updateDomain: (call: {
|
|
312
|
-
request: import("@fonoster/types").
|
|
311
|
+
request: import("@fonoster/types/dist/utils").Flatten<import("@fonoster/types").BaseApiObject & Omit<Partial<import("@fonoster/types").CreateDomainRequest>, "domainUri">>;
|
|
313
312
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").DomainExtended) => void) => Promise<void>;
|
|
314
313
|
getDomain: (call: {
|
|
315
314
|
request: import("@fonoster/types").BaseApiObject;
|
|
316
315
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: import("@fonoster/types").DomainExtended) => void) => Promise<void>;
|
|
317
316
|
listDomains: (call: {
|
|
318
|
-
request: import("@fonoster/types").
|
|
317
|
+
request: import("@fonoster/types").ListRequest;
|
|
319
318
|
}, callback: (error?: import("@fonoster/common").GrpcErrorMessage, response?: {
|
|
320
319
|
nextPageToken?: string;
|
|
321
320
|
items: import("@fonoster/types").DomainExtended[];
|
package/dist/envs.d.ts
CHANGED
|
@@ -34,8 +34,6 @@ export declare const NATS_URL: string;
|
|
|
34
34
|
export declare const DEFAULT_NATS_QUEUE_GROUP = "apiserver";
|
|
35
35
|
export declare const CALLS_CREATE_SUBJECT = "calls.create";
|
|
36
36
|
export declare const CALLS_TRACK_CALL_SUBJECT = "calls.track";
|
|
37
|
-
export declare const ASTERISK_CONTEXT = "local-ctx";
|
|
38
|
-
export declare const ASTERISK_EXTENSION = "voice";
|
|
39
37
|
export declare const ASTERISK_TRUNK = "routr";
|
|
40
38
|
export declare const ASTERISK_ARI_PROXY_URL: string;
|
|
41
39
|
export declare const ASTERISK_ARI_USERNAME: string;
|
package/dist/envs.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.INTEGRATIONS_FILE = exports.FILES_SERVER_PORT = exports.TTS_PATH_TO_FILES = exports.ASTERISK_SYSTEM_DOMAIN = exports.ASTERISK_ARI_SECRET = exports.ASTERISK_ARI_USERNAME = exports.ASTERISK_ARI_PROXY_URL = exports.ASTERISK_TRUNK = exports.
|
|
7
|
+
exports.INTEGRATIONS_FILE = exports.FILES_SERVER_PORT = exports.TTS_PATH_TO_FILES = exports.ASTERISK_SYSTEM_DOMAIN = exports.ASTERISK_ARI_SECRET = exports.ASTERISK_ARI_USERNAME = exports.ASTERISK_ARI_PROXY_URL = exports.ASTERISK_TRUNK = exports.CALLS_TRACK_CALL_SUBJECT = exports.CALLS_CREATE_SUBJECT = exports.DEFAULT_NATS_QUEUE_GROUP = exports.NATS_URL = exports.APISERVER_HOST = exports.APISERVER_BIND_ADDR = exports.ROUTR_DEFAULT_PEER_PASSWORD = exports.ROUTR_DEFAULT_PEER_AOR = exports.ROUTR_DEFAULT_PEER_USERNAME = exports.ROUTR_DEFAULT_PEER_NAME = exports.ROUTR_API_ENDPOINT = exports.CLOAK_ENCRYPTION_KEY = exports.INFLUXDB_TOKEN = exports.INFLUXDB_BUCKET = exports.INFLUXDB_ORG = exports.INFLUXDB_PASSWORD = exports.INFLUXDB_USERNAME = exports.INFLUXDB_URL = exports.OWNER_PASSWORD = exports.OWNER_EMAIL = exports.OWNER_NAME = exports.EMAIL_TEMPLATES_DIR = exports.SMTP_SENDER = exports.SMTP_AUTH_PASS = exports.SMTP_AUTH_USER = exports.SMTP_SECURE = exports.SMTP_PORT = exports.SMTP_HOST = exports.IDENTITY_REFRESH_TOKEN_EXPIRES_IN = exports.IDENTITY_ACCESS_TOKEN_EXPIRES_IN = exports.IDENTITY_ID_TOKEN_EXPIRES_IN = exports.IDENTITY_PUBLIC_KEY = exports.IDENTITY_PRIVATE_KEY = exports.IDENTITY_AUDIENCE = exports.IDENTITY_ISSUER = exports.APP_URL = void 0;
|
|
8
8
|
/*
|
|
9
9
|
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
10
10
|
* http://github.com/fonoster/fonoster
|
|
@@ -99,8 +99,6 @@ exports.NATS_URL = e.NATS_URL;
|
|
|
99
99
|
exports.DEFAULT_NATS_QUEUE_GROUP = "apiserver";
|
|
100
100
|
exports.CALLS_CREATE_SUBJECT = "calls.create";
|
|
101
101
|
exports.CALLS_TRACK_CALL_SUBJECT = "calls.track";
|
|
102
|
-
exports.ASTERISK_CONTEXT = "local-ctx";
|
|
103
|
-
exports.ASTERISK_EXTENSION = "voice";
|
|
104
102
|
exports.ASTERISK_TRUNK = "routr";
|
|
105
103
|
exports.ASTERISK_ARI_PROXY_URL = e.ASTERISK_ARI_PROXY_URL;
|
|
106
104
|
exports.ASTERISK_ARI_USERNAME = e.ASTERISK_ARI_USERNAME;
|
|
@@ -24,10 +24,11 @@ const influxdb_client_1 = require("@influxdata/influxdb-client");
|
|
|
24
24
|
const logger = (0, logger_1.getLogger)({ service: "apiserver", filePath: __filename });
|
|
25
25
|
function createInfluxDbPub(config) {
|
|
26
26
|
const { url, token, org, bucket } = config;
|
|
27
|
+
logger.info("creating influxdb client", { url, org, bucket });
|
|
27
28
|
const client = new influxdb_client_1.InfluxDB({ url, token });
|
|
28
29
|
const writeClient = client.getWriteApi(org, bucket, "ns");
|
|
29
30
|
return (event) => {
|
|
30
|
-
const point = new influxdb_client_1.Point(event.name).tag("
|
|
31
|
+
const point = new influxdb_client_1.Point(event.name).tag("callId", event.tag);
|
|
31
32
|
Object.entries(event.data).forEach(([key, value]) => {
|
|
32
33
|
if (typeof value === "number") {
|
|
33
34
|
point.intField(key, value); // Or floatField for floating-point numbers
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapCallDirectionToEnum = mapCallDirectionToEnum;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
|
+
* http://github.com/fonoster/fonoster
|
|
7
|
+
*
|
|
8
|
+
* This file is part of Fonoster
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the MIT License (the "License");
|
|
11
|
+
* you may not use this file except in compliance with
|
|
12
|
+
* the License. You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* https://opensource.org/licenses/MIT
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
const types_1 = require("../calls/types");
|
|
23
|
+
function mapCallDirectionToEnum(direction) {
|
|
24
|
+
switch (direction) {
|
|
25
|
+
case "from-pstn":
|
|
26
|
+
return types_1.CallDirection.FROM_PSTN;
|
|
27
|
+
case "peer-to-pstn":
|
|
28
|
+
case "agent-to-pstn":
|
|
29
|
+
return types_1.CallDirection.TO_PSTN;
|
|
30
|
+
case "agent-to-agent":
|
|
31
|
+
case "agent-to-peer":
|
|
32
|
+
case "peer-to-agent":
|
|
33
|
+
return types_1.CallDirection.INTRA_NETWORK;
|
|
34
|
+
default:
|
|
35
|
+
throw new Error(`Invalid call direction: ${direction}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
package/dist/events/nats.js
CHANGED
|
@@ -38,8 +38,8 @@ exports.watchNats = watchNats;
|
|
|
38
38
|
const logger_1 = require("@fonoster/logger");
|
|
39
39
|
const nats_1 = require("nats");
|
|
40
40
|
const logger = (0, logger_1.getLogger)({ service: "apiserver", filePath: __filename });
|
|
41
|
-
const
|
|
42
|
-
const
|
|
41
|
+
// const ROUTR_REGISTRATION_SUBJECT = "routr.endpoint.registered";
|
|
42
|
+
const ROUTR_CALL_SUBJECT = "routr.call.*";
|
|
43
43
|
function streamEvents(subscription, callback) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
45
|
var _a, subscription_1, subscription_1_1;
|
|
@@ -73,12 +73,11 @@ function streamEvents(subscription, callback) {
|
|
|
73
73
|
function watchNats(natsUrl, callback) {
|
|
74
74
|
(() => __awaiter(this, void 0, void 0, function* () {
|
|
75
75
|
const nc = yield (0, nats_1.connect)({ servers: natsUrl });
|
|
76
|
-
const
|
|
77
|
-
const f = nc.subscribe("foo");
|
|
76
|
+
const a = nc.subscribe(ROUTR_CALL_SUBJECT);
|
|
78
77
|
logger.verbose("connected to nats", { natsUrl });
|
|
79
78
|
logger.verbose("subscribed to subjects", {
|
|
80
|
-
subjects: [
|
|
79
|
+
subjects: [ROUTR_CALL_SUBJECT]
|
|
81
80
|
});
|
|
82
|
-
yield Promise.all([streamEvents(
|
|
81
|
+
yield Promise.all([streamEvents(a, callback)]);
|
|
83
82
|
}))();
|
|
84
83
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformEvent = transformEvent;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
|
+
* http://github.com/fonoster/fonoster
|
|
7
|
+
*
|
|
8
|
+
* This file is part of Fonoster
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the MIT License (the "License");
|
|
11
|
+
* you may not use this file except in compliance with
|
|
12
|
+
* the License. You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* https://opensource.org/licenses/MIT
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
const types_1 = require("@fonoster/types");
|
|
23
|
+
const mapCallDirectionToEnum_1 = require("./mapCallDirectionToEnum");
|
|
24
|
+
const ACCESS_KEY_ID_HEADER = "X-Access-Key-Id";
|
|
25
|
+
const CALL_REF_HEADER = "X-Call-Ref";
|
|
26
|
+
const CALL_DIRECTION_HEADER = "X-Call-Direction";
|
|
27
|
+
const DOD_NUMBER_HEADER = "X-Dod-Number";
|
|
28
|
+
const API_ORIGINATED_TYPE_HEADER = "X-Is-Api-Originated-Type";
|
|
29
|
+
function transformEvent(event) {
|
|
30
|
+
const transformedEvent = Object.assign({}, event);
|
|
31
|
+
if (event.startTime) {
|
|
32
|
+
const time = new Date(event.startTime).getTime() / 1000;
|
|
33
|
+
transformedEvent.startedAt = time;
|
|
34
|
+
transformedEvent.endedAt = time;
|
|
35
|
+
delete transformedEvent.startTime;
|
|
36
|
+
}
|
|
37
|
+
if (event.endTime) {
|
|
38
|
+
transformedEvent.endedAt =
|
|
39
|
+
new Date(event.endTime).getTime() / 1000;
|
|
40
|
+
delete transformedEvent.endTime;
|
|
41
|
+
}
|
|
42
|
+
if (event.hangupCause) {
|
|
43
|
+
transformedEvent.status = event.hangupCause;
|
|
44
|
+
delete transformedEvent.hangupCause;
|
|
45
|
+
}
|
|
46
|
+
if (event.to) {
|
|
47
|
+
const to = event.to;
|
|
48
|
+
transformedEvent.to = to.split("@")[0].replace("sip:", "");
|
|
49
|
+
}
|
|
50
|
+
const extraHeaders = event.extraHeaders;
|
|
51
|
+
if (extraHeaders) {
|
|
52
|
+
if (extraHeaders[ACCESS_KEY_ID_HEADER]) {
|
|
53
|
+
transformedEvent.accessKeyId = extraHeaders[ACCESS_KEY_ID_HEADER];
|
|
54
|
+
}
|
|
55
|
+
if (extraHeaders[CALL_REF_HEADER]) {
|
|
56
|
+
transformedEvent.ref = extraHeaders[CALL_REF_HEADER];
|
|
57
|
+
}
|
|
58
|
+
if (extraHeaders[DOD_NUMBER_HEADER]) {
|
|
59
|
+
transformedEvent.from = extraHeaders[DOD_NUMBER_HEADER];
|
|
60
|
+
}
|
|
61
|
+
if (extraHeaders[API_ORIGINATED_TYPE_HEADER]) {
|
|
62
|
+
transformedEvent.type = types_1.CallType.API_ORIGINATED;
|
|
63
|
+
}
|
|
64
|
+
if (extraHeaders[CALL_DIRECTION_HEADER]) {
|
|
65
|
+
transformedEvent.direction = (0, mapCallDirectionToEnum_1.mapCallDirectionToEnum)(extraHeaders[CALL_DIRECTION_HEADER]);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// Delete the extra headers as they may contain sensitive information
|
|
69
|
+
delete transformedEvent.extraHeaders;
|
|
70
|
+
delete transformedEvent.callId;
|
|
71
|
+
return transformedEvent;
|
|
72
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -62,6 +62,7 @@ const upsertDefaultPeer_1 = require("./core/upsertDefaultPeer");
|
|
|
62
62
|
const envs_1 = require("./envs");
|
|
63
63
|
const createInfluxDbPub_1 = require("./events/createInfluxDbPub");
|
|
64
64
|
const nats_1 = require("./events/nats");
|
|
65
|
+
const transformEvent_1 = require("./events/transformEvent");
|
|
65
66
|
Promise.resolve().then(() => __importStar(require("./core/removeSwaggerNotice")));
|
|
66
67
|
function main() {
|
|
67
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -85,13 +86,11 @@ function main() {
|
|
|
85
86
|
});
|
|
86
87
|
// Subscribe to NATs events
|
|
87
88
|
(0, nats_1.watchNats)(envs_1.NATS_URL, (event) => {
|
|
88
|
-
logger.
|
|
89
|
-
// FIXME: Remember to re-map callRef from callId
|
|
90
|
-
const callRecord = event;
|
|
89
|
+
logger.verbose("received nats event", Object.assign({}, event));
|
|
91
90
|
pubToInfluxDb({
|
|
92
91
|
name: types_1.CALL_DETAIL_RECORD_MEASUREMENT,
|
|
93
|
-
tag:
|
|
94
|
-
data: event
|
|
92
|
+
tag: event.callId,
|
|
93
|
+
data: (0, transformEvent_1.transformEvent)(event)
|
|
95
94
|
});
|
|
96
95
|
});
|
|
97
96
|
});
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -33,3 +33,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
33
33
|
* limitations under the License.
|
|
34
34
|
*/
|
|
35
35
|
__exportStar(require("./makeCheckNumberPreconditions"), exports);
|
|
36
|
+
__exportStar(require("./makeHandleDialEventsWithNats"), exports);
|
|
37
|
+
__exportStar(require("./makeHandleDialEventsWithVoiceClient"), exports);
|
|
@@ -9,19 +9,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
muteResponse: {
|
|
23
|
-
sessionRef
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}));
|
|
12
|
+
exports.makeHandleDialEventsWithNats = makeHandleDialEventsWithNats;
|
|
13
|
+
const mapDialStatus_1 = require("./mapDialStatus");
|
|
14
|
+
const envs_1 = require("../envs");
|
|
15
|
+
function makeHandleDialEventsWithNats(nc) {
|
|
16
|
+
return (callRef, event) => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const mappedStatus = (0, mapDialStatus_1.mapDialStatus)(event.dialstatus);
|
|
18
|
+
if (!mappedStatus)
|
|
19
|
+
return; // Ignore the event if status is not mapped
|
|
20
|
+
nc.publish(envs_1.CALLS_TRACK_CALL_SUBJECT, JSON.stringify({ ref: callRef, status: mappedStatus }));
|
|
21
|
+
});
|
|
27
22
|
}
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.makeHandleDialEventsWithVoiceClient = makeHandleDialEventsWithVoiceClient;
|
|
13
13
|
/*
|
|
14
14
|
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
15
15
|
* http://github.com/fonoster/fonoster
|
|
@@ -28,23 +28,12 @@ exports.handleDialEvents = handleDialEvents;
|
|
|
28
28
|
* See the License for the specific language governing permissions and
|
|
29
29
|
* limitations under the License.
|
|
30
30
|
*/
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
function handleDialEvents(voiceClient) {
|
|
31
|
+
const mapDialStatus_1 = require("./mapDialStatus");
|
|
32
|
+
function makeHandleDialEventsWithVoiceClient(voiceClient) {
|
|
34
33
|
return (event) => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (FailedStatus.includes(status)) {
|
|
39
|
-
mappedStatus = common_1.DialStatus.FAILED;
|
|
40
|
-
}
|
|
41
|
-
else if (dialStatusArray.includes(status)) {
|
|
42
|
-
mappedStatus = common_1.DialStatus[status];
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
// If the status is not in the DialStatus enum, we ignore the event
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
34
|
+
const mappedStatus = (0, mapDialStatus_1.mapDialStatus)(event.dialstatus);
|
|
35
|
+
if (!mappedStatus)
|
|
36
|
+
return; // Ignore the event if status is not mapped
|
|
48
37
|
voiceClient.sendResponse({
|
|
49
38
|
dialResponse: {
|
|
50
39
|
status: mappedStatus
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mapDialStatus = mapDialStatus;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
|
+
* http://github.com/fonoster/fonoster
|
|
7
|
+
*
|
|
8
|
+
* This file is part of Fonoster
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the MIT License (the "License");
|
|
11
|
+
* you may not use this file except in compliance with
|
|
12
|
+
* the License. You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* https://opensource.org/licenses/MIT
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
const common_1 = require("@fonoster/common");
|
|
23
|
+
const FailedStatus = ["CHANUNAVAIL", "CONGESTION"];
|
|
24
|
+
function mapDialStatus(status) {
|
|
25
|
+
if (status === "") {
|
|
26
|
+
return common_1.DialStatus.TRYING;
|
|
27
|
+
}
|
|
28
|
+
const normalizedStatus = status.toUpperCase();
|
|
29
|
+
const dialStatusArray = Object.keys(common_1.DialStatus).map((key) => common_1.DialStatus[key]);
|
|
30
|
+
if (FailedStatus.includes(normalizedStatus)) {
|
|
31
|
+
return common_1.DialStatus.FAILED;
|
|
32
|
+
}
|
|
33
|
+
else if (dialStatusArray.includes(normalizedStatus)) {
|
|
34
|
+
return common_1.DialStatus[normalizedStatus];
|
|
35
|
+
}
|
|
36
|
+
// If the status is not in the DialStatus enum, return undefined
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
@@ -6,7 +6,8 @@ import { SpeechResult } from "./stt/types";
|
|
|
6
6
|
import { GRPCClient, SpeechToText, TextToSpeech, VoiceClient } from "./types";
|
|
7
7
|
declare class VoiceClientImpl implements VoiceClient {
|
|
8
8
|
config: VoiceClientConfig;
|
|
9
|
-
|
|
9
|
+
verbsStream: Stream;
|
|
10
|
+
transcriptionsStream: Stream;
|
|
10
11
|
voice: VoiceSessionStreamClient;
|
|
11
12
|
tts: TextToSpeech;
|
|
12
13
|
stt: SpeechToText;
|
|
@@ -27,6 +28,14 @@ declare class VoiceClientImpl implements VoiceClient {
|
|
|
27
28
|
sendResponse(response: VoiceIn): void;
|
|
28
29
|
synthesize(text: string, options: SayOptions): Promise<string>;
|
|
29
30
|
transcribe(): Promise<SpeechResult>;
|
|
31
|
+
startSpeechGather(callback: (stream: {
|
|
32
|
+
speech?: string;
|
|
33
|
+
digit?: string;
|
|
34
|
+
}) => void): Promise<void>;
|
|
35
|
+
startDtmfGather(sessionRef: string, callback: (event: {
|
|
36
|
+
digit: string;
|
|
37
|
+
}) => void): Promise<void>;
|
|
38
|
+
stopStreamGather(): Promise<void>;
|
|
30
39
|
waitForDtmf(params: {
|
|
31
40
|
sessionRef: string;
|
|
32
41
|
finishOnKey: string;
|