@fonoster/common 0.5.5 → 0.6.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/README.md +3 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.js +6 -0
- package/dist/errors.d.ts +8 -0
- package/dist/errors.js +95 -0
- package/dist/grpcStatusMap.d.ts +4 -0
- package/dist/{envs.js → grpcStatusMap.js} +8 -6
- package/dist/index.d.ts +7 -8
- package/dist/index.js +38 -14
- package/dist/notifications/compileTemplate.d.ts +6 -0
- package/dist/{env_is_set.js → notifications/compileTemplate.js} +12 -14
- package/dist/notifications/createEmailSender.d.ts +17 -0
- package/dist/notifications/createEmailSender.js +55 -0
- package/dist/notifications/index.d.ts +2 -0
- package/dist/notifications/index.js +36 -0
- package/dist/protos/acls.proto +119 -0
- package/dist/protos/agents.proto +155 -0
- package/dist/protos/applications.proto +154 -0
- package/dist/protos/calls.proto +162 -0
- package/dist/protos/credentials.proto +119 -0
- package/dist/protos/domains.proto +127 -0
- package/dist/protos/identity.proto +286 -0
- package/dist/protos/numbers.proto +155 -0
- package/dist/protos/secrets.proto +113 -0
- package/dist/protos/trunks.proto +164 -0
- package/dist/protos/voice.proto +421 -0
- package/dist/tts/AzureVoices.d.ts +523 -0
- package/dist/tts/AzureVoices.js +3622 -0
- package/dist/tts/GoogleVoices.d.ts +475 -0
- package/dist/tts/GoogleVoices.js +3284 -0
- package/dist/tts/index.d.ts +3 -0
- package/dist/tts/index.js +37 -0
- package/dist/tts/types.d.ts +164 -0
- package/dist/tts/types.js +186 -0
- package/dist/utils/assertEnvsAreSet.d.ts +7 -0
- package/dist/utils/assertEnvsAreSet.js +37 -0
- package/dist/utils/assertFileExists.d.ts +5 -0
- package/dist/utils/assertFileExists.js +38 -0
- package/dist/utils/createInterceptingCall.d.ts +7 -0
- package/dist/utils/createInterceptingCall.js +9 -0
- package/dist/utils/createService.d.ts +9 -0
- package/dist/{service_runner.js → utils/createService.js} +15 -40
- package/dist/utils/datesMapper.d.ts +9 -0
- package/dist/utils/datesMapper.js +8 -0
- package/dist/utils/getServerCredentials.d.ts +10 -0
- package/dist/{trust_util.js → utils/getServerCredentials.js} +33 -37
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.js +42 -0
- package/dist/utils/toCamelCase.d.ts +2 -0
- package/dist/utils/toCamelCase.js +27 -0
- package/dist/utils/toPascalCase.d.ts +2 -0
- package/dist/{speech/plugin.js → utils/toPascalCase.js} +9 -13
- package/dist/voice/Dial.d.ts +23 -0
- package/dist/voice/Dial.js +19 -0
- package/dist/voice/Gather.d.ts +18 -0
- package/dist/voice/Gather.js +9 -0
- package/dist/voice/Mute.d.ts +13 -0
- package/dist/voice/Mute.js +9 -0
- package/dist/voice/Play.d.ts +12 -0
- package/dist/voice/PlayDtmf.d.ts +5 -0
- package/dist/voice/PlaybackControl.d.ts +13 -0
- package/dist/voice/PlaybackControl.js +11 -0
- package/dist/voice/Record.d.ts +18 -0
- package/dist/voice/Record.js +7 -0
- package/dist/voice/Say.d.ts +15 -0
- package/dist/voice/Say.js +2 -0
- package/dist/voice/Stream.d.ts +41 -0
- package/dist/voice/Stream.js +39 -0
- package/dist/voice/Verb.d.ts +9 -0
- package/dist/{healthcheck.js → voice/Verb.js} +2 -5
- package/dist/voice/index.d.ts +11 -0
- package/dist/voice/index.js +45 -0
- package/dist/voice/voice.d.ts +101 -0
- package/dist/voice/voice.js +44 -0
- package/package.json +28 -25
- package/LICENSE +0 -21
- package/dist/api_client.d.ts +0 -27
- package/dist/api_client.js +0 -110
- package/dist/env_is_set.d.ts +0 -1
- package/dist/envs.d.ts +0 -4
- package/dist/healthcheck.d.ts +0 -2
- package/dist/service_runner.d.ts +0 -13
- package/dist/speech/plugin.d.ts +0 -6
- package/dist/speech/types.d.ts +0 -17
- package/dist/trust_util.d.ts +0 -4
- package/dist/types.d.ts +0 -6
- /package/dist/{speech/types.js → voice/Play.js} +0 -0
- /package/dist/{types.js → voice/PlayDtmf.js} +0 -0
|
@@ -22,13 +22,19 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var
|
|
26
|
-
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
27
33
|
};
|
|
28
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.getServerCredentials =
|
|
35
|
+
exports.getServerCredentials = void 0;
|
|
30
36
|
/*
|
|
31
|
-
* Copyright (C)
|
|
37
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
32
38
|
* http://github.com/fonoster/fonoster
|
|
33
39
|
*
|
|
34
40
|
* This file is part of Fonoster
|
|
@@ -45,41 +51,31 @@ exports.getServerCredentials = exports.getClientCredentials = void 0;
|
|
|
45
51
|
* See the License for the specific language governing permissions and
|
|
46
52
|
* limitations under the License.
|
|
47
53
|
*/
|
|
48
|
-
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
49
|
-
const os = __importStar(require("os"));
|
|
50
54
|
const fs = __importStar(require("fs"));
|
|
51
55
|
const logger_1 = require("@fonoster/logger");
|
|
52
|
-
const
|
|
53
|
-
const atob_1 = __importDefault(require("atob"));
|
|
54
|
-
const envs_1 = require("./envs");
|
|
55
|
-
const prepCert = (cert) => Buffer.from((0, atob_1.default)(cert), "utf-8");
|
|
56
|
+
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
56
57
|
const logger = (0, logger_1.getLogger)({ service: "common", filePath: __filename });
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
logger.info("starting server in insecure mode");
|
|
58
|
+
function getServerCredentials(config) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const { tlsOn, verifyClientCert, caCert, serverCert, serverKey } = config;
|
|
61
|
+
logger.verbose("get server credentials", {
|
|
62
|
+
tlsOn,
|
|
63
|
+
verifyClientCert,
|
|
64
|
+
caCert,
|
|
65
|
+
serverCert,
|
|
66
|
+
serverKey
|
|
67
|
+
});
|
|
68
|
+
if (tlsOn) {
|
|
69
|
+
// TODO: Assert that all the required fields are present
|
|
70
|
+
const cacert = verifyClientCert ? fs.readFileSync(caCert) : null;
|
|
71
|
+
return grpc.ServerCredentials.createSsl(cacert, [
|
|
72
|
+
{
|
|
73
|
+
private_key: yield fs.promises.readFile(serverKey),
|
|
74
|
+
cert_chain: yield fs.promises.readFile(serverCert)
|
|
75
|
+
}
|
|
76
|
+
]);
|
|
77
|
+
}
|
|
78
78
|
return grpc.ServerCredentials.createInsecure();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
81
|
exports.getServerCredentials = getServerCredentials;
|
|
82
|
-
const getClientCredentials = () => envs_1.GRPC_ALLOW_INSECURE === "true"
|
|
83
|
-
? grpc.credentials.createInsecure()
|
|
84
|
-
: grpc.credentials.createSsl();
|
|
85
|
-
exports.getClientCredentials = getClientCredentials;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./assertEnvsAreSet";
|
|
2
|
+
export * from "./assertFileExists";
|
|
3
|
+
export * from "./createService";
|
|
4
|
+
export * from "./createInterceptingCall";
|
|
5
|
+
export * from "./datesMapper";
|
|
6
|
+
export * from "./getServerCredentials";
|
|
7
|
+
export * from "./toPascalCase";
|
|
8
|
+
export * from "./toCamelCase";
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/*
|
|
18
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
19
|
+
* http://github.com/fonoster/fonoster
|
|
20
|
+
*
|
|
21
|
+
* This file is part of Fonoster
|
|
22
|
+
*
|
|
23
|
+
* Licensed under the MIT License (the "License");
|
|
24
|
+
* you may not use this file except in compliance with
|
|
25
|
+
* the License. You may obtain a copy of the License at
|
|
26
|
+
*
|
|
27
|
+
* https://opensource.org/licenses/MIT
|
|
28
|
+
*
|
|
29
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
30
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
31
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
32
|
+
* See the License for the specific language governing permissions and
|
|
33
|
+
* limitations under the License.
|
|
34
|
+
*/
|
|
35
|
+
__exportStar(require("./assertEnvsAreSet"), exports);
|
|
36
|
+
__exportStar(require("./assertFileExists"), exports);
|
|
37
|
+
__exportStar(require("./createService"), exports);
|
|
38
|
+
__exportStar(require("./createInterceptingCall"), exports);
|
|
39
|
+
__exportStar(require("./datesMapper"), exports);
|
|
40
|
+
__exportStar(require("./getServerCredentials"), exports);
|
|
41
|
+
__exportStar(require("./toPascalCase"), exports);
|
|
42
|
+
__exportStar(require("./toCamelCase"), exports);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toCamelCase = void 0;
|
|
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 toPascalCase_1 = require("./toPascalCase");
|
|
23
|
+
function toCamelCase(str) {
|
|
24
|
+
const pascalCase = (0, toPascalCase_1.toPascalCase)(str);
|
|
25
|
+
return pascalCase.charAt(0).toLowerCase() + pascalCase.slice(1);
|
|
26
|
+
}
|
|
27
|
+
exports.toCamelCase = toCamelCase;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.toPascalCase = void 0;
|
|
4
4
|
/*
|
|
5
|
-
* Copyright (C)
|
|
5
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/fonoster
|
|
7
7
|
*
|
|
8
8
|
* This file is part of Fonoster
|
|
@@ -19,15 +19,11 @@ exports.Plugin = void 0;
|
|
|
19
19
|
* See the License for the specific language governing permissions and
|
|
20
20
|
* limitations under the License.
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
getType() {
|
|
30
|
-
return this.type;
|
|
31
|
-
}
|
|
22
|
+
function toPascalCase(str) {
|
|
23
|
+
return str
|
|
24
|
+
.replace(/(?:^\w|[A-Z]|\b\w)/g, (word) => {
|
|
25
|
+
return word.toUpperCase();
|
|
26
|
+
})
|
|
27
|
+
.replace(/\s+/g, "");
|
|
32
28
|
}
|
|
33
|
-
exports.
|
|
29
|
+
exports.toPascalCase = toPascalCase;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { VerbRequest } from "./Verb";
|
|
2
|
+
declare enum DialRecordDirection {
|
|
3
|
+
IN = "IN",
|
|
4
|
+
OUT = "OUT",
|
|
5
|
+
BOTH = "BOTH"
|
|
6
|
+
}
|
|
7
|
+
declare enum DialStatus {
|
|
8
|
+
TRYING = "TRYING",
|
|
9
|
+
CANCEL = "CANCEL",
|
|
10
|
+
ANSWER = "ANSWER",
|
|
11
|
+
BUSY = "BUSY",
|
|
12
|
+
PROGRESS = "PROGRESS",
|
|
13
|
+
NOANSWER = "NOANSWER",
|
|
14
|
+
FAILED = "FAILED"
|
|
15
|
+
}
|
|
16
|
+
type DialOptions = {
|
|
17
|
+
timeout?: number;
|
|
18
|
+
recordDirection?: DialRecordDirection;
|
|
19
|
+
};
|
|
20
|
+
type DialRequest = VerbRequest & DialOptions & {
|
|
21
|
+
destination: string;
|
|
22
|
+
};
|
|
23
|
+
export { DialRequest, DialOptions, DialStatus, DialRecordDirection };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DialRecordDirection = exports.DialStatus = void 0;
|
|
4
|
+
var DialRecordDirection;
|
|
5
|
+
(function (DialRecordDirection) {
|
|
6
|
+
DialRecordDirection["IN"] = "IN";
|
|
7
|
+
DialRecordDirection["OUT"] = "OUT";
|
|
8
|
+
DialRecordDirection["BOTH"] = "BOTH";
|
|
9
|
+
})(DialRecordDirection || (exports.DialRecordDirection = DialRecordDirection = {}));
|
|
10
|
+
var DialStatus;
|
|
11
|
+
(function (DialStatus) {
|
|
12
|
+
DialStatus["TRYING"] = "TRYING";
|
|
13
|
+
DialStatus["CANCEL"] = "CANCEL";
|
|
14
|
+
DialStatus["ANSWER"] = "ANSWER";
|
|
15
|
+
DialStatus["BUSY"] = "BUSY";
|
|
16
|
+
DialStatus["PROGRESS"] = "PROGRESS";
|
|
17
|
+
DialStatus["NOANSWER"] = "NOANSWER";
|
|
18
|
+
DialStatus["FAILED"] = "FAILED";
|
|
19
|
+
})(DialStatus || (exports.DialStatus = DialStatus = {}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { VerbRequest, VerbResponse } from "./Verb";
|
|
2
|
+
declare enum GatherSource {
|
|
3
|
+
SPEECH = "speech",
|
|
4
|
+
DTMF = "dtmf",
|
|
5
|
+
SPEECH_AND_DTMF = "speech,dtmf"
|
|
6
|
+
}
|
|
7
|
+
type GatherOptions = {
|
|
8
|
+
finishOnKey?: string;
|
|
9
|
+
maxDigits?: number;
|
|
10
|
+
timeout?: number;
|
|
11
|
+
source?: GatherSource;
|
|
12
|
+
};
|
|
13
|
+
type GatherRequest = VerbRequest & GatherOptions;
|
|
14
|
+
type GatherResponse = VerbResponse & {
|
|
15
|
+
speech?: string;
|
|
16
|
+
digits?: string;
|
|
17
|
+
};
|
|
18
|
+
export { GatherOptions, GatherRequest, GatherResponse, GatherSource };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GatherSource = void 0;
|
|
4
|
+
var GatherSource;
|
|
5
|
+
(function (GatherSource) {
|
|
6
|
+
GatherSource["SPEECH"] = "speech";
|
|
7
|
+
GatherSource["DTMF"] = "dtmf";
|
|
8
|
+
GatherSource["SPEECH_AND_DTMF"] = "speech,dtmf";
|
|
9
|
+
})(GatherSource || (exports.GatherSource = GatherSource = {}));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { VerbRequest } from "./Verb";
|
|
2
|
+
type MuteOptions = {
|
|
3
|
+
direction?: MuteDirection;
|
|
4
|
+
};
|
|
5
|
+
declare enum MuteDirection {
|
|
6
|
+
IN = "IN",
|
|
7
|
+
OUT = "OUT",
|
|
8
|
+
BOTH = "BOTH"
|
|
9
|
+
}
|
|
10
|
+
type MuteRequest = VerbRequest & {
|
|
11
|
+
direction: MuteDirection;
|
|
12
|
+
};
|
|
13
|
+
export { MuteOptions, MuteRequest, MuteDirection };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MuteDirection = void 0;
|
|
4
|
+
var MuteDirection;
|
|
5
|
+
(function (MuteDirection) {
|
|
6
|
+
MuteDirection["IN"] = "IN";
|
|
7
|
+
MuteDirection["OUT"] = "OUT";
|
|
8
|
+
MuteDirection["BOTH"] = "BOTH";
|
|
9
|
+
})(MuteDirection || (exports.MuteDirection = MuteDirection = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VerbRequest } from "./Verb";
|
|
2
|
+
type PlayOptions = {
|
|
3
|
+
playbackRef?: string;
|
|
4
|
+
};
|
|
5
|
+
type PlayRequest = VerbRequest & {
|
|
6
|
+
url: string;
|
|
7
|
+
} & PlayOptions;
|
|
8
|
+
type PlayResponse = {
|
|
9
|
+
sessionRef: string;
|
|
10
|
+
playbackRef: string;
|
|
11
|
+
};
|
|
12
|
+
export { PlayRequest, PlayResponse, PlayOptions };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { VerbRequest } from "./Verb";
|
|
2
|
+
declare enum PlaybackControlAction {
|
|
3
|
+
STOP = "stop",
|
|
4
|
+
RESTART = "restart",
|
|
5
|
+
PAUSE = "pause",
|
|
6
|
+
UNPAUSE = "unpause",
|
|
7
|
+
FORWARD = "forward"
|
|
8
|
+
}
|
|
9
|
+
type PlaybackControlRequest = VerbRequest & {
|
|
10
|
+
playbackRef: string;
|
|
11
|
+
action: PlaybackControlAction;
|
|
12
|
+
};
|
|
13
|
+
export { PlaybackControlRequest, PlaybackControlAction };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlaybackControlAction = void 0;
|
|
4
|
+
var PlaybackControlAction;
|
|
5
|
+
(function (PlaybackControlAction) {
|
|
6
|
+
PlaybackControlAction["STOP"] = "stop";
|
|
7
|
+
PlaybackControlAction["RESTART"] = "restart";
|
|
8
|
+
PlaybackControlAction["PAUSE"] = "pause";
|
|
9
|
+
PlaybackControlAction["UNPAUSE"] = "unpause";
|
|
10
|
+
PlaybackControlAction["FORWARD"] = "forward";
|
|
11
|
+
})(PlaybackControlAction || (exports.PlaybackControlAction = PlaybackControlAction = {}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { VerbRequest } from "./Verb";
|
|
2
|
+
declare enum RecordFormat {
|
|
3
|
+
WAV = "wav"
|
|
4
|
+
}
|
|
5
|
+
type RecordOptions = {
|
|
6
|
+
maxDuration?: number;
|
|
7
|
+
maxSilence?: number;
|
|
8
|
+
beep?: boolean;
|
|
9
|
+
finishOnKey?: string;
|
|
10
|
+
};
|
|
11
|
+
type RecordRequest = VerbRequest & RecordOptions;
|
|
12
|
+
type RecordResponse = {
|
|
13
|
+
sessionRef: string;
|
|
14
|
+
name: string;
|
|
15
|
+
duration: number;
|
|
16
|
+
format: RecordFormat;
|
|
17
|
+
};
|
|
18
|
+
export { RecordOptions, RecordRequest, RecordResponse, RecordFormat };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Struct } from "pb-util";
|
|
2
|
+
import { VerbRequest } from "./Verb";
|
|
3
|
+
type SayRequest = VerbRequest & {
|
|
4
|
+
text: string;
|
|
5
|
+
playbackRef?: string;
|
|
6
|
+
options?: Struct;
|
|
7
|
+
};
|
|
8
|
+
type SayResponse = {
|
|
9
|
+
playbackRef: string;
|
|
10
|
+
};
|
|
11
|
+
type SayOptions = {
|
|
12
|
+
playbackRef?: string;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
};
|
|
15
|
+
export { SayRequest, SayResponse, SayOptions };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { VerbRequest, VerbResponse } from "./Verb";
|
|
3
|
+
declare enum StreamDirection {
|
|
4
|
+
IN = "IN",
|
|
5
|
+
OUT = "OUT",
|
|
6
|
+
BOTH = "BOTH"
|
|
7
|
+
}
|
|
8
|
+
declare enum StreamAudioFormat {
|
|
9
|
+
WAV = "WAV"
|
|
10
|
+
}
|
|
11
|
+
declare enum StreamMessageType {
|
|
12
|
+
AUDIO_IN = "AUDIO_IN",
|
|
13
|
+
AUDIO_OUT = "AUDIO_OUT",
|
|
14
|
+
ERROR = "ERROR",
|
|
15
|
+
VOICE_ACTIVITY_START = "VOICE_ACTIVITY_START",
|
|
16
|
+
VOICE_ACTIVITY_STOP = "VOICE_ACTIVITY_STOP"
|
|
17
|
+
}
|
|
18
|
+
type StreamOptions = {
|
|
19
|
+
direction: StreamDirection;
|
|
20
|
+
format: StreamAudioFormat;
|
|
21
|
+
enableVad: boolean;
|
|
22
|
+
};
|
|
23
|
+
type StartStreamRequest = VerbRequest & StreamOptions;
|
|
24
|
+
type StartStreamResponse = VerbResponse & {
|
|
25
|
+
streamRef: string;
|
|
26
|
+
};
|
|
27
|
+
type StopStreamRequest = VerbRequest & {
|
|
28
|
+
streamRef: string;
|
|
29
|
+
};
|
|
30
|
+
type StreamPayload = {
|
|
31
|
+
sessionRef: string;
|
|
32
|
+
streamRef: string;
|
|
33
|
+
direction: StreamDirection;
|
|
34
|
+
format: StreamAudioFormat;
|
|
35
|
+
type: StreamMessageType;
|
|
36
|
+
enableVad?: boolean;
|
|
37
|
+
data?: Buffer;
|
|
38
|
+
code?: string;
|
|
39
|
+
message?: string;
|
|
40
|
+
};
|
|
41
|
+
export { StreamDirection, StreamAudioFormat, StreamMessageType, StreamOptions, StartStreamRequest, StartStreamResponse, StopStreamRequest, StreamPayload };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StreamMessageType = exports.StreamAudioFormat = exports.StreamDirection = void 0;
|
|
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
|
+
var StreamDirection;
|
|
23
|
+
(function (StreamDirection) {
|
|
24
|
+
StreamDirection["IN"] = "IN";
|
|
25
|
+
StreamDirection["OUT"] = "OUT";
|
|
26
|
+
StreamDirection["BOTH"] = "BOTH";
|
|
27
|
+
})(StreamDirection || (exports.StreamDirection = StreamDirection = {}));
|
|
28
|
+
var StreamAudioFormat;
|
|
29
|
+
(function (StreamAudioFormat) {
|
|
30
|
+
StreamAudioFormat["WAV"] = "WAV";
|
|
31
|
+
})(StreamAudioFormat || (exports.StreamAudioFormat = StreamAudioFormat = {}));
|
|
32
|
+
var StreamMessageType;
|
|
33
|
+
(function (StreamMessageType) {
|
|
34
|
+
StreamMessageType["AUDIO_IN"] = "AUDIO_IN";
|
|
35
|
+
StreamMessageType["AUDIO_OUT"] = "AUDIO_OUT";
|
|
36
|
+
StreamMessageType["ERROR"] = "ERROR";
|
|
37
|
+
StreamMessageType["VOICE_ACTIVITY_START"] = "VOICE_ACTIVITY_START";
|
|
38
|
+
StreamMessageType["VOICE_ACTIVITY_STOP"] = "VOICE_ACTIVITY_STOP";
|
|
39
|
+
})(StreamMessageType || (exports.StreamMessageType = StreamMessageType = {}));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
2
|
/*
|
|
4
|
-
* Copyright (C)
|
|
3
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
5
4
|
* http://github.com/fonoster/fonoster
|
|
6
5
|
*
|
|
7
6
|
* This file is part of Fonoster
|
|
@@ -18,6 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
17
|
* See the License for the specific language governing permissions and
|
|
19
18
|
* limitations under the License.
|
|
20
19
|
*/
|
|
21
|
-
|
|
22
|
-
const grpc_health_check_1 = require("@fonoster/grpc-health-check");
|
|
23
|
-
exports.default = async () => (0, grpc_health_check_1.checker)("", `localhost:50052`);
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./voice";
|
|
2
|
+
export * from "./Dial";
|
|
3
|
+
export * from "./Gather";
|
|
4
|
+
export * from "./Verb";
|
|
5
|
+
export * from "./Mute";
|
|
6
|
+
export * from "./Play";
|
|
7
|
+
export * from "./PlaybackControl";
|
|
8
|
+
export * from "./PlayDtmf";
|
|
9
|
+
export * from "./Record";
|
|
10
|
+
export * from "./Say";
|
|
11
|
+
export * from "./Stream";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/*
|
|
18
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
19
|
+
* http://github.com/fonoster/fonoster
|
|
20
|
+
*
|
|
21
|
+
* This file is part of Fonoster
|
|
22
|
+
*
|
|
23
|
+
* Licensed under the MIT License (the "License");
|
|
24
|
+
* you may not use this file except in compliance with
|
|
25
|
+
* the License. You may obtain a copy of the License at
|
|
26
|
+
*
|
|
27
|
+
* https://opensource.org/licenses/MIT
|
|
28
|
+
*
|
|
29
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
30
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
31
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
32
|
+
* See the License for the specific language governing permissions and
|
|
33
|
+
* limitations under the License.
|
|
34
|
+
*/
|
|
35
|
+
__exportStar(require("./voice"), exports);
|
|
36
|
+
__exportStar(require("./Dial"), exports);
|
|
37
|
+
__exportStar(require("./Gather"), exports);
|
|
38
|
+
__exportStar(require("./Verb"), exports);
|
|
39
|
+
__exportStar(require("./Mute"), exports);
|
|
40
|
+
__exportStar(require("./Play"), exports);
|
|
41
|
+
__exportStar(require("./PlaybackControl"), exports);
|
|
42
|
+
__exportStar(require("./PlayDtmf"), exports);
|
|
43
|
+
__exportStar(require("./Record"), exports);
|
|
44
|
+
__exportStar(require("./Say"), exports);
|
|
45
|
+
__exportStar(require("./Stream"), exports);
|