@fonoster/apiserver 0.8.25 → 0.8.27
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.js +10 -10
- package/dist/applications/{createApplication.d.ts → createCreateApplication.d.ts} +2 -2
- package/dist/applications/{createApplication.js → createCreateApplication.js} +14 -7
- package/dist/applications/{getApplication.d.ts → createDeleteApplication.d.ts} +2 -2
- package/dist/applications/{deleteApplication.js → createDeleteApplication.js} +4 -4
- package/dist/applications/{updateApplication.d.ts → createGetApplication.d.ts} +2 -2
- package/dist/applications/{getApplication.js → createGetApplication.js} +4 -4
- package/dist/applications/createGetFnUtil.d.ts +2 -0
- package/dist/applications/{listApplications.d.ts → createListApplications.d.ts} +2 -2
- package/dist/applications/{listApplications.js → createListApplications.js} +5 -6
- package/dist/applications/{deleteApplication.d.ts → createUpdateApplication.d.ts} +2 -2
- package/dist/applications/{updateApplication.js → createUpdateApplication.js} +7 -7
- package/dist/applications/utils/applicationWithEncodedStruct.js +2 -0
- package/dist/applications/utils/convertToApplicationData.d.ts +2 -2
- package/dist/applications/validation/assistantWithoutApiKeySchema.d.ts +671 -0
- package/dist/applications/validation/assistantWithoutApiKeySchema.js +35 -0
- package/dist/applications/validation/createValidationSchema.d.ts +1107 -0
- package/dist/applications/validation/createValidationSchema.js +67 -0
- package/dist/applications/validation/speechValidators.d.ts +29 -0
- package/dist/applications/{utils/getApplicationValidationSchema.js → validation/speechValidators.js} +3 -28
- package/dist/applications/{utils → validation}/validOrThrow.js +3 -2
- package/dist/calls/buildService.js +2 -2
- package/dist/calls/createCall.js +1 -2
- package/dist/calls/{makeTrackCall.d.ts → createTrackCall.d.ts} +2 -2
- package/dist/calls/{makeTrackCall.js → createTrackCall.js} +4 -4
- package/dist/calls/getCall.js +1 -2
- package/dist/calls/listCalls.js +1 -2
- package/dist/core/httpBridge.js +1 -1
- package/dist/core/runServices.js +2 -3
- package/dist/core/seed.js +11 -1
- package/dist/core/services.js +1 -1
- package/dist/envs.d.ts +1 -0
- package/dist/envs.js +3 -2
- package/dist/secrets/createGetFnUtil.js +12 -10
- package/dist/secrets/createSecret.js +1 -2
- package/dist/secrets/listSecrets.js +1 -2
- package/dist/secrets/updateSecret.js +1 -2
- package/dist/utils/createCheckNumberPreconditions.d.ts +6 -0
- package/dist/utils/{makeCheckNumberPreconditions.js → createCheckNumberPreconditions.js} +4 -4
- package/dist/utils/createHandleDialEventsWithNats.d.ts +5 -0
- package/dist/utils/{makeHandleDialEventsWithNats.js → createHandleDialEventsWithNats.js} +10 -8
- package/dist/utils/createHandleDialEventsWithVoiceClient.d.ts +5 -0
- package/dist/utils/{makeHandleDialEventsWithVoiceClient.js → createHandleDialEventsWithVoiceClient.js} +13 -11
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.js +3 -3
- package/dist/voice/VoiceClientImpl.js +13 -7
- package/dist/voice/VoiceDispatcher.js +16 -17
- package/dist/voice/connectToAri.js +3 -3
- package/dist/voice/{makeCreateVoiceClient.d.ts → createCreateVoiceClient.d.ts} +2 -2
- package/dist/voice/createCreateVoiceClient.js +76 -0
- package/dist/voice/handlers/createAnswerHandler.d.ts +5 -0
- package/dist/voice/handlers/{Answer.js → createAnswerHandler.js} +2 -2
- package/dist/voice/handlers/createHangupHandler.d.ts +5 -0
- package/dist/voice/handlers/{Hangup.js → createHangupHandler.js} +2 -2
- package/dist/voice/handlers/createMuteHandler.d.ts +4 -0
- package/dist/voice/handlers/{Mute.js → createMuteHandler.js} +2 -2
- package/dist/voice/handlers/createPlayDtmfHandler.d.ts +4 -0
- package/dist/voice/handlers/{PlayDtmf.js → createPlayDtmfHandler.js} +2 -2
- package/dist/voice/handlers/createPlayHandler.d.ts +4 -0
- package/dist/voice/handlers/{Play.js → createPlayHandler.js} +2 -2
- package/dist/voice/handlers/createPlaybackControlHandler.d.ts +4 -0
- package/dist/voice/handlers/{PlaybackControl.js → createPlaybackControlHandler.js} +2 -2
- package/dist/voice/handlers/createRecordHandler.d.ts +4 -0
- package/dist/voice/handlers/{Record.js → createRecordHandler.js} +2 -2
- package/dist/voice/handlers/createSayHandler.d.ts +4 -0
- package/dist/voice/handlers/{Say.js → createSayHandler.js} +2 -2
- package/dist/voice/handlers/createStreamGatherHandler.d.ts +3 -0
- package/dist/voice/handlers/{StreamGather.js → createStreamGatherHandler.js} +2 -2
- package/dist/voice/handlers/{StreamGather.d.ts → createStreamHandler.d.ts} +2 -2
- package/dist/voice/handlers/{Stream.js → createStreamHandler.js} +2 -2
- package/dist/voice/handlers/createUnmuteHandler.d.ts +4 -0
- package/dist/voice/handlers/{Unmute.js → createUnmuteHandler.js} +2 -2
- package/dist/voice/handlers/dial/createDialHandler.d.ts +5 -0
- package/dist/voice/handlers/dial/createDialHandler.js +78 -0
- package/dist/voice/handlers/dial/index.d.ts +1 -0
- package/dist/voice/handlers/dial/index.js +35 -0
- package/dist/voice/handlers/gather/createGatherHandler.d.ts +3 -0
- package/dist/voice/handlers/gather/{Gather.js → createGatherHandler.js} +2 -2
- package/dist/voice/handlers/index.d.ts +13 -12
- package/dist/voice/handlers/index.js +13 -12
- package/dist/voice/integrations/createCreateContainer.d.ts +4 -0
- package/dist/voice/integrations/{makeCreateContainer.js → createCreateContainer.js} +28 -26
- package/dist/voice/integrations/getSttConfig.js +20 -2
- package/dist/voice/integrations/getTtsConfig.js +2 -2
- package/dist/voice/integrations/index.d.ts +1 -1
- package/dist/voice/integrations/index.js +1 -1
- package/dist/voice/stt/types.d.ts +1 -1
- package/dist/voice/utils/createGetChannelVar.d.ts +4 -0
- package/dist/voice/utils/{makeGetChannelVar.js → createGetChannelVar.js} +14 -12
- package/dist/voice/utils/createGetChannelVarWithoutThrow.d.ts +4 -0
- package/dist/voice/utils/{makeGetChannelVarWithoutThrow.js → createGetChannelVarWithoutThrow.js} +14 -12
- package/dist/voice/utils/index.d.ts +2 -2
- package/dist/voice/utils/index.js +2 -2
- package/package.json +9 -9
- package/dist/applications/utils/getApplicationValidationSchema.d.ts +0 -64
- package/dist/utils/makeCheckNumberPreconditions.d.ts +0 -6
- package/dist/utils/makeHandleDialEventsWithNats.d.ts +0 -5
- package/dist/utils/makeHandleDialEventsWithVoiceClient.d.ts +0 -5
- package/dist/voice/handlers/Answer.d.ts +0 -5
- package/dist/voice/handlers/Hangup.d.ts +0 -5
- package/dist/voice/handlers/Mute.d.ts +0 -4
- package/dist/voice/handlers/Play.d.ts +0 -4
- package/dist/voice/handlers/PlayDtmf.d.ts +0 -4
- package/dist/voice/handlers/PlaybackControl.d.ts +0 -4
- package/dist/voice/handlers/Record.d.ts +0 -4
- package/dist/voice/handlers/Say.d.ts +0 -4
- package/dist/voice/handlers/Stream.d.ts +0 -3
- package/dist/voice/handlers/Unmute.d.ts +0 -4
- package/dist/voice/handlers/dial/Dial.d.ts +0 -5
- package/dist/voice/handlers/dial/Dial.js +0 -76
- package/dist/voice/handlers/gather/Gather.d.ts +0 -3
- package/dist/voice/integrations/findIntegrationsCredentials.d.ts +0 -3
- package/dist/voice/integrations/findIntegrationsCredentials.js +0 -7
- package/dist/voice/integrations/makeCreateContainer.d.ts +0 -4
- package/dist/voice/makeCreateVoiceClient.js +0 -74
- package/dist/voice/utils/makeGetChannelVar.d.ts +0 -4
- package/dist/voice/utils/makeGetChannelVarWithoutThrow.d.ts +0 -4
- /package/dist/applications/{utils → validation}/prepareForValidation.d.ts +0 -0
- /package/dist/applications/{utils → validation}/prepareForValidation.js +0 -0
- /package/dist/applications/{utils → validation}/validOrThrow.d.ts +0 -0
|
@@ -32,15 +32,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
32
|
* See the License for the specific language governing permissions and
|
|
33
33
|
* limitations under the License.
|
|
34
34
|
*/
|
|
35
|
-
__exportStar(require("./
|
|
36
|
-
__exportStar(require("./
|
|
37
|
-
__exportStar(require("./
|
|
38
|
-
__exportStar(require("./
|
|
39
|
-
__exportStar(require("./
|
|
40
|
-
__exportStar(require("./
|
|
41
|
-
__exportStar(require("./
|
|
42
|
-
__exportStar(require("./
|
|
43
|
-
__exportStar(require("./
|
|
44
|
-
__exportStar(require("./
|
|
45
|
-
__exportStar(require("./
|
|
46
|
-
__exportStar(require("./
|
|
35
|
+
__exportStar(require("./createAnswerHandler"), exports);
|
|
36
|
+
__exportStar(require("./createHangupHandler"), exports);
|
|
37
|
+
__exportStar(require("./createMuteHandler"), exports);
|
|
38
|
+
__exportStar(require("./createStreamHandler"), exports);
|
|
39
|
+
__exportStar(require("./createPlayHandler"), exports);
|
|
40
|
+
__exportStar(require("./createPlayDtmfHandler"), exports);
|
|
41
|
+
__exportStar(require("./createPlaybackControlHandler"), exports);
|
|
42
|
+
__exportStar(require("./createRecordHandler"), exports);
|
|
43
|
+
__exportStar(require("./createSayHandler"), exports);
|
|
44
|
+
__exportStar(require("./createStreamGatherHandler"), exports);
|
|
45
|
+
__exportStar(require("./createUnmuteHandler"), exports);
|
|
46
|
+
__exportStar(require("./dial/createDialHandler"), exports);
|
|
47
|
+
__exportStar(require("./gather/createGatherHandler"), exports);
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.createCreateContainer = createCreateContainer;
|
|
16
16
|
/*
|
|
17
17
|
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
18
18
|
* http://github.com/fonoster/fonoster
|
|
@@ -44,10 +44,10 @@ const logger = (0, logger_1.getLogger)({ service: "apiserver", filePath: __filen
|
|
|
44
44
|
const integrationsConfigSchema = zod_1.z.array(zod_1.z.object({
|
|
45
45
|
name: zod_1.z.string(),
|
|
46
46
|
productRef: zod_1.z.string(),
|
|
47
|
-
type: zod_1.z.enum(["tts", "stt"]),
|
|
47
|
+
type: zod_1.z.enum(["tts", "stt", "llm"]),
|
|
48
48
|
credentials: zod_1.z.record(zod_1.z.unknown())
|
|
49
49
|
}));
|
|
50
|
-
function
|
|
50
|
+
function createCreateContainer(prisma, pathToIntegrations) {
|
|
51
51
|
logger.verbose("loading integrations config", { pathToIntegrations });
|
|
52
52
|
const integrationsFile = fs_1.default.readFileSync(pathToIntegrations, "utf8");
|
|
53
53
|
const integrations = JSON.parse(integrationsFile);
|
|
@@ -60,29 +60,31 @@ function makeCreateContainer(prisma, pathToIntegrations) {
|
|
|
60
60
|
logger.error("integrations config is invalid", { message });
|
|
61
61
|
process.exit(1);
|
|
62
62
|
}
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
return function createContainer(appRef) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
logger.verbose("creating integrations container", { appRef });
|
|
66
|
+
const app = yield prisma.application.findUnique({
|
|
67
|
+
where: { ref: appRef },
|
|
68
|
+
include: {
|
|
69
|
+
textToSpeech: true,
|
|
70
|
+
speechToText: true,
|
|
71
|
+
intelligence: true
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
if (!app) {
|
|
75
|
+
throw new ApplicationNotFoundError_1.ApplicationNotFoundError(appRef);
|
|
71
76
|
}
|
|
77
|
+
const ttsConfig = (0, getTtsConfig_1.getTtsConfig)(integrations, app);
|
|
78
|
+
const sttConfig = (0, getSttConfig_1.getSttConfig)(integrations, app);
|
|
79
|
+
const tts = TextToSpeechFactory_1.TextToSpeechFactory.getEngine(app.textToSpeech.productRef, ttsConfig);
|
|
80
|
+
const stt = SpeechToTextFactory_1.SpeechToTextFactory.getEngine(app.speechToText.productRef, sttConfig);
|
|
81
|
+
return {
|
|
82
|
+
ref: appRef,
|
|
83
|
+
accessKeyId: app.accessKeyId,
|
|
84
|
+
endpoint: app.endpoint,
|
|
85
|
+
tts,
|
|
86
|
+
stt
|
|
87
|
+
};
|
|
72
88
|
});
|
|
73
|
-
|
|
74
|
-
throw new ApplicationNotFoundError_1.ApplicationNotFoundError(appRef);
|
|
75
|
-
}
|
|
76
|
-
const ttsConfig = (0, getTtsConfig_1.getTtsConfig)(integrations, app);
|
|
77
|
-
const sttConfig = (0, getSttConfig_1.getSttConfig)(integrations, app);
|
|
78
|
-
const tts = TextToSpeechFactory_1.TextToSpeechFactory.getEngine(app.textToSpeech.productRef, ttsConfig);
|
|
79
|
-
const stt = SpeechToTextFactory_1.SpeechToTextFactory.getEngine(app.speechToText.productRef, sttConfig);
|
|
80
|
-
return {
|
|
81
|
-
ref: appRef,
|
|
82
|
-
accessKeyId: app.accessKeyId,
|
|
83
|
-
endpoint: app.endpoint,
|
|
84
|
-
tts,
|
|
85
|
-
stt
|
|
86
|
-
};
|
|
87
|
-
});
|
|
89
|
+
};
|
|
88
90
|
}
|
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSttConfig = getSttConfig;
|
|
4
|
-
|
|
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");
|
|
5
23
|
function getSttConfig(integrations, app) {
|
|
6
24
|
const config = app.speechToText.config;
|
|
7
|
-
const credentials = (0,
|
|
25
|
+
const credentials = (0, common_1.findIntegrationsCredentials)(integrations, app.speechToText.productRef);
|
|
8
26
|
return {
|
|
9
27
|
config,
|
|
10
28
|
credentials
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTtsConfig = getTtsConfig;
|
|
4
|
-
const
|
|
4
|
+
const common_1 = require("@fonoster/common");
|
|
5
5
|
function getTtsConfig(integrations, app) {
|
|
6
6
|
const config = app.textToSpeech.config;
|
|
7
|
-
const credentials = (0,
|
|
7
|
+
const credentials = (0, common_1.findIntegrationsCredentials)(integrations, app.textToSpeech.productRef);
|
|
8
8
|
return {
|
|
9
9
|
config,
|
|
10
10
|
credentials
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./createCreateContainer";
|
|
@@ -32,4 +32,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
32
|
* See the License for the specific language governing permissions and
|
|
33
33
|
* limitations under the License.
|
|
34
34
|
*/
|
|
35
|
-
__exportStar(require("./
|
|
35
|
+
__exportStar(require("./createCreateContainer"), exports);
|
|
@@ -9,17 +9,19 @@ 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.createGetChannelVar = createGetChannelVar;
|
|
13
13
|
const ChannelVarNotFoundError_1 = require("../errors/ChannelVarNotFoundError");
|
|
14
|
-
function
|
|
15
|
-
return
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
function createGetChannelVar(channel) {
|
|
15
|
+
return function getChannelVar(variable) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
try {
|
|
18
|
+
return yield channel.getChannelVar({
|
|
19
|
+
variable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
catch (e) {
|
|
23
|
+
throw new ChannelVarNotFoundError_1.ChannelVarNotFoundError(variable);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
};
|
|
25
27
|
}
|
package/dist/voice/utils/{makeGetChannelVarWithoutThrow.js → createGetChannelVarWithoutThrow.js}
RENAMED
|
@@ -9,16 +9,18 @@ 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
|
-
function
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
exports.createGetChannelVarWithoutThrow = createGetChannelVarWithoutThrow;
|
|
13
|
+
function createGetChannelVarWithoutThrow(channel) {
|
|
14
|
+
return function getChannelVarWithoutThrow(variable) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
try {
|
|
17
|
+
return yield channel.getChannelVar({
|
|
18
|
+
variable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
24
26
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from "./VoiceServiceClientConstructor";
|
|
2
2
|
export * from "./createExternalMediaConfig";
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
3
|
+
export * from "./createGetChannelVar";
|
|
4
|
+
export * from "./createGetChannelVarWithoutThrow";
|
|
@@ -34,5 +34,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
34
34
|
*/
|
|
35
35
|
__exportStar(require("./VoiceServiceClientConstructor"), exports);
|
|
36
36
|
__exportStar(require("./createExternalMediaConfig"), exports);
|
|
37
|
-
__exportStar(require("./
|
|
38
|
-
__exportStar(require("./
|
|
37
|
+
__exportStar(require("./createGetChannelVar"), exports);
|
|
38
|
+
__exportStar(require("./createGetChannelVarWithoutThrow"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/apiserver",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.27",
|
|
4
4
|
"description": "APIServer for Fonoster",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/fonoster#readme",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@deepgram/sdk": "^3.5.1",
|
|
24
|
-
"@fonoster/authz": "^0.8.
|
|
25
|
-
"@fonoster/common": "^0.8.
|
|
26
|
-
"@fonoster/identity": "^0.8.
|
|
27
|
-
"@fonoster/logger": "^0.8.
|
|
28
|
-
"@fonoster/sipnet": "^0.8.
|
|
29
|
-
"@fonoster/streams": "^0.8.
|
|
30
|
-
"@fonoster/types": "^0.8.
|
|
24
|
+
"@fonoster/authz": "^0.8.27",
|
|
25
|
+
"@fonoster/common": "^0.8.27",
|
|
26
|
+
"@fonoster/identity": "^0.8.27",
|
|
27
|
+
"@fonoster/logger": "^0.8.27",
|
|
28
|
+
"@fonoster/sipnet": "^0.8.27",
|
|
29
|
+
"@fonoster/streams": "^0.8.27",
|
|
30
|
+
"@fonoster/types": "^0.8.27",
|
|
31
31
|
"@google-cloud/speech": "^6.6.0",
|
|
32
32
|
"@google-cloud/text-to-speech": "^5.3.0",
|
|
33
33
|
"@grpc/grpc-js": "~1.10.6",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"@types/uuid": "^10.0.0",
|
|
74
74
|
"@types/validator": "^13.12.0"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "3c50badbc1b7043d1525603ad3386b9f70d53b28"
|
|
77
77
|
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
declare function getApplicationValidationSchema(request: {
|
|
3
|
-
ttsEngineName: string;
|
|
4
|
-
sttEngineName: string;
|
|
5
|
-
}): z.ZodObject<{
|
|
6
|
-
name: z.ZodString;
|
|
7
|
-
type: z.ZodNativeEnum<{
|
|
8
|
-
EXTERNAL: "EXTERNAL";
|
|
9
|
-
}>;
|
|
10
|
-
endpoint: z.ZodEffects<z.ZodOptional<z.ZodString>, string, string>;
|
|
11
|
-
textToSpeech: z.ZodObject<{
|
|
12
|
-
productRef: z.ZodString;
|
|
13
|
-
config: any;
|
|
14
|
-
}, "strip", z.ZodTypeAny, {
|
|
15
|
-
[x: string]: any;
|
|
16
|
-
productRef?: unknown;
|
|
17
|
-
config?: unknown;
|
|
18
|
-
}, {
|
|
19
|
-
[x: string]: any;
|
|
20
|
-
productRef?: unknown;
|
|
21
|
-
config?: unknown;
|
|
22
|
-
}> | z.ZodUndefined;
|
|
23
|
-
speechToText: z.ZodUndefined | z.ZodObject<{
|
|
24
|
-
productRef: z.ZodString;
|
|
25
|
-
config: any;
|
|
26
|
-
}, "strip", z.ZodTypeAny, {
|
|
27
|
-
[x: string]: any;
|
|
28
|
-
productRef?: unknown;
|
|
29
|
-
config?: unknown;
|
|
30
|
-
}, {
|
|
31
|
-
[x: string]: any;
|
|
32
|
-
productRef?: unknown;
|
|
33
|
-
config?: unknown;
|
|
34
|
-
}>;
|
|
35
|
-
}, "strip", z.ZodTypeAny, {
|
|
36
|
-
textToSpeech?: {
|
|
37
|
-
[x: string]: any;
|
|
38
|
-
productRef?: unknown;
|
|
39
|
-
config?: unknown;
|
|
40
|
-
};
|
|
41
|
-
speechToText?: {
|
|
42
|
-
[x: string]: any;
|
|
43
|
-
productRef?: unknown;
|
|
44
|
-
config?: unknown;
|
|
45
|
-
};
|
|
46
|
-
name?: string;
|
|
47
|
-
type?: "EXTERNAL";
|
|
48
|
-
endpoint?: string;
|
|
49
|
-
}, {
|
|
50
|
-
textToSpeech?: {
|
|
51
|
-
[x: string]: any;
|
|
52
|
-
productRef?: unknown;
|
|
53
|
-
config?: unknown;
|
|
54
|
-
};
|
|
55
|
-
speechToText?: {
|
|
56
|
-
[x: string]: any;
|
|
57
|
-
productRef?: unknown;
|
|
58
|
-
config?: unknown;
|
|
59
|
-
};
|
|
60
|
-
name?: string;
|
|
61
|
-
type?: "EXTERNAL";
|
|
62
|
-
endpoint?: string;
|
|
63
|
-
}>;
|
|
64
|
-
export { getApplicationValidationSchema };
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.dialHandler = dialHandler;
|
|
13
|
-
/*
|
|
14
|
-
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
15
|
-
* http://github.com/fonoster/fonoster
|
|
16
|
-
*
|
|
17
|
-
* This file is part of Fonoster
|
|
18
|
-
*
|
|
19
|
-
* Licensed under the MIT License (the "License");
|
|
20
|
-
* you may not use this file except in compliance with
|
|
21
|
-
* the License. You may obtain a copy of the License at
|
|
22
|
-
*
|
|
23
|
-
* https://opensource.org/licenses/MIT
|
|
24
|
-
*
|
|
25
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
26
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
27
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
28
|
-
* See the License for the specific language governing permissions and
|
|
29
|
-
* limitations under the License.
|
|
30
|
-
*/
|
|
31
|
-
const common_1 = require("@fonoster/common");
|
|
32
|
-
const uuid_1 = require("uuid");
|
|
33
|
-
const handleChannelLeftBridge_1 = require("./handleChannelLeftBridge");
|
|
34
|
-
const handleStasisEnd_1 = require("./handleStasisEnd");
|
|
35
|
-
const handleStasisStart_1 = require("./handleStasisStart");
|
|
36
|
-
const envs_1 = require("../../../envs");
|
|
37
|
-
const utils_1 = require("../../../utils");
|
|
38
|
-
const types_1 = require("../../types");
|
|
39
|
-
const makeGetChannelVar_1 = require("../../utils/makeGetChannelVar");
|
|
40
|
-
// TODO: Needs request validation
|
|
41
|
-
function dialHandler(ari, voiceClient) {
|
|
42
|
-
return (request) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
const { sessionRef: channelId, destination, timeout } = request;
|
|
44
|
-
const bridge = yield ari.bridges.create({
|
|
45
|
-
type: "mixing"
|
|
46
|
-
});
|
|
47
|
-
// eslint-disable-next-line new-cap
|
|
48
|
-
const dialed = ari.Channel();
|
|
49
|
-
yield bridge.addChannel({ channel: channelId });
|
|
50
|
-
const callerChannel = yield ari.channels.get({ channelId });
|
|
51
|
-
const getChannelVar = (0, makeGetChannelVar_1.makeGetChannelVar)(callerChannel);
|
|
52
|
-
const ingressNumber = (yield getChannelVar(types_1.ChannelVar.INGRESS_NUMBER))
|
|
53
|
-
.value;
|
|
54
|
-
const ref = (0, uuid_1.v4)();
|
|
55
|
-
yield dialed.originate({
|
|
56
|
-
app: common_1.STASIS_APP_NAME,
|
|
57
|
-
endpoint: `PJSIP/${envs_1.ASTERISK_TRUNK}/sip:${destination}@${envs_1.ASTERISK_SYSTEM_DOMAIN}`,
|
|
58
|
-
timeout,
|
|
59
|
-
variables: {
|
|
60
|
-
"PJSIP_HEADER(add,X-Call-Ref)": ref,
|
|
61
|
-
"PJSIP_HEADER(add,X-Dod-Number)": ingressNumber,
|
|
62
|
-
"PJSIP_HEADER(add,X-Is-Api-Originated-Type)": "true"
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
yield ari.channels.ring({ channelId });
|
|
66
|
-
dialed.once(types_1.AriEvent.STASIS_START, (0, handleStasisStart_1.handleStasisStart)({ ari, request, bridge, dialed }));
|
|
67
|
-
dialed.once(types_1.AriEvent.CHANNEL_LEFT_BRIDGE, (0, handleChannelLeftBridge_1.handleChannelLeftBridge)({ bridge, dialed }));
|
|
68
|
-
dialed.once(types_1.AriEvent.STASIS_END, (0, handleStasisEnd_1.handleStasisEnd)(request));
|
|
69
|
-
dialed.on(types_1.AriEvent.DIAL, (0, utils_1.makeHandleDialEventsWithVoiceClient)(voiceClient));
|
|
70
|
-
voiceClient.sendResponse({
|
|
71
|
-
dialResponse: {
|
|
72
|
-
status: common_1.DialStatus.TRYING
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findIntegrationsCredentials = findIntegrationsCredentials;
|
|
4
|
-
function findIntegrationsCredentials(integrations, engine) {
|
|
5
|
-
var _a;
|
|
6
|
-
return (_a = integrations.find((i) => i.productRef === engine)) === null || _a === void 0 ? void 0 : _a.credentials;
|
|
7
|
-
}
|