@routr/registry 2.0.8-alpha.0 → 2.0.8-alpha.10
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/config/get_config.js +3 -3
- package/dist/request.js +2 -0
- package/dist/types.d.ts +2 -2
- package/dist/types.js +6 -6
- package/dist/utils.js +10 -7
- package/package.json +4 -4
|
@@ -62,13 +62,13 @@ const getConfig = (path) => {
|
|
|
62
62
|
const config = c.spec;
|
|
63
63
|
if (!((_a = config === null || config === void 0 ? void 0 : config.cache) === null || _a === void 0 ? void 0 : _a.provider)) {
|
|
64
64
|
config.cache = {
|
|
65
|
-
provider: types_1.
|
|
65
|
+
provider: types_1.CacheProvider.MEMORY
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
if (((_b = config === null || config === void 0 ? void 0 : config.cache) === null || _b === void 0 ? void 0 : _b.provider) === types_1.
|
|
68
|
+
if (((_b = config === null || config === void 0 ? void 0 : config.cache) === null || _b === void 0 ? void 0 : _b.provider) === types_1.CacheProvider.REDIS &&
|
|
69
69
|
!((_c = config === null || config === void 0 ? void 0 : config.cache) === null || _c === void 0 ? void 0 : _c.parameters)) {
|
|
70
70
|
config.cache = {
|
|
71
|
-
provider: types_1.
|
|
71
|
+
provider: types_1.CacheProvider.REDIS,
|
|
72
72
|
parameters: "host=localhost,port=6379"
|
|
73
73
|
};
|
|
74
74
|
}
|
package/dist/request.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Method, Transport } from "@routr/common";
|
|
|
2
2
|
import { SIPMessage } from "@routr/common/src/types";
|
|
3
3
|
export declare const DEFAULT_MAX_FORWARDS = 70;
|
|
4
4
|
export declare const DEFAULT_EXPIRES = 600;
|
|
5
|
-
export declare enum
|
|
5
|
+
export declare enum CacheProvider {
|
|
6
6
|
MEMORY = "memory",
|
|
7
7
|
REDIS = "redis"
|
|
8
8
|
}
|
|
@@ -21,7 +21,7 @@ export interface RegistryConfig {
|
|
|
21
21
|
registerInterval: number;
|
|
22
22
|
methods: Method[];
|
|
23
23
|
cache?: {
|
|
24
|
-
provider:
|
|
24
|
+
provider: CacheProvider;
|
|
25
25
|
parameters?: string;
|
|
26
26
|
};
|
|
27
27
|
}
|
package/dist/types.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RegistrationEntryStatus = exports.
|
|
3
|
+
exports.RegistrationEntryStatus = exports.CacheProvider = exports.DEFAULT_EXPIRES = exports.DEFAULT_MAX_FORWARDS = void 0;
|
|
4
4
|
exports.DEFAULT_MAX_FORWARDS = 70;
|
|
5
5
|
exports.DEFAULT_EXPIRES = 600;
|
|
6
|
-
var
|
|
7
|
-
(function (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
})(
|
|
6
|
+
var CacheProvider;
|
|
7
|
+
(function (CacheProvider) {
|
|
8
|
+
CacheProvider["MEMORY"] = "memory";
|
|
9
|
+
CacheProvider["REDIS"] = "redis";
|
|
10
|
+
})(CacheProvider = exports.CacheProvider || (exports.CacheProvider = {}));
|
|
11
11
|
var RegistrationEntryStatus;
|
|
12
12
|
(function (RegistrationEntryStatus) {
|
|
13
13
|
RegistrationEntryStatus["REGISTERED"] = "registered";
|
package/dist/utils.js
CHANGED
|
@@ -50,7 +50,7 @@ exports.getUnregisteredTrunks = getUnregisteredTrunks;
|
|
|
50
50
|
function findTrunks(dataAPI) {
|
|
51
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
52
|
return yield dataAPI.findBy({
|
|
53
|
-
kind: common_2.CommonConnect.
|
|
53
|
+
kind: common_2.CommonConnect.Kind.TRUNK,
|
|
54
54
|
criteria: common_2.CommonConnect.FindCriteria.FIND_TRUNKS_WITH_SEND_REGISTER,
|
|
55
55
|
parameters: {}
|
|
56
56
|
});
|
|
@@ -80,7 +80,7 @@ const configFromString = (params, allowedKeys) => {
|
|
|
80
80
|
};
|
|
81
81
|
exports.configFromString = configFromString;
|
|
82
82
|
const buildStore = (config) => {
|
|
83
|
-
if (config.cache.provider === types_1.
|
|
83
|
+
if (config.cache.provider === types_1.CacheProvider.REDIS) {
|
|
84
84
|
const allowedParameters = ["host", "port", "username", "password", "secure"];
|
|
85
85
|
return new redis_store_1.default((0, exports.configFromString)(config.cache.parameters, allowedParameters));
|
|
86
86
|
}
|
|
@@ -90,25 +90,28 @@ const buildStore = (config) => {
|
|
|
90
90
|
};
|
|
91
91
|
exports.buildStore = buildStore;
|
|
92
92
|
const convertResourceToTrunk = (dataAPI, resource) => __awaiter(void 0, void 0, void 0, function* () {
|
|
93
|
-
var _a, _b, _c
|
|
93
|
+
var _a, _b, _c;
|
|
94
94
|
const metadata = resource.metadata;
|
|
95
95
|
const trunkSpec = resource.spec;
|
|
96
|
-
|
|
96
|
+
if (!trunkSpec.outbound) {
|
|
97
|
+
throw new Error(`trunk ${resource.ref} has no outbound settings`);
|
|
98
|
+
}
|
|
99
|
+
const uri = trunkSpec.outbound.uris[0].uri;
|
|
97
100
|
// WARNING: Perhaps we should bring this on a single API call
|
|
98
|
-
const cred = yield dataAPI.get(
|
|
101
|
+
const cred = yield dataAPI.get(trunkSpec.outbound.credentialsRef);
|
|
99
102
|
const usernameAndPassword = cred === null || cred === void 0 ? void 0 : cred.spec.credentials;
|
|
100
103
|
return {
|
|
101
104
|
ref: resource.ref,
|
|
102
105
|
name: resource.metadata.name,
|
|
103
106
|
region: metadata.region,
|
|
104
107
|
host: uri.host,
|
|
105
|
-
port: (
|
|
108
|
+
port: (_a = uri.port) !== null && _a !== void 0 ? _a : 5060,
|
|
106
109
|
user: uri.user,
|
|
107
110
|
credentials: {
|
|
108
111
|
username: usernameAndPassword === null || usernameAndPassword === void 0 ? void 0 : usernameAndPassword.username,
|
|
109
112
|
secret: usernameAndPassword === null || usernameAndPassword === void 0 ? void 0 : usernameAndPassword.password
|
|
110
113
|
},
|
|
111
|
-
transport: (
|
|
114
|
+
transport: (_c = (_b = uri.transport) === null || _b === void 0 ? void 0 : _b.toLowerCase()) !== null && _c !== void 0 ? _c : common_1.Transport.UDP
|
|
112
115
|
};
|
|
113
116
|
});
|
|
114
117
|
exports.convertResourceToTrunk = convertResourceToTrunk;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routr/registry",
|
|
3
|
-
"version": "2.0.8-alpha.
|
|
3
|
+
"version": "2.0.8-alpha.10",
|
|
4
4
|
"description": "Sends trunks registrations and maintains their bindings",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/routr#readme",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@opentelemetry/sdk-trace-base": "^1.0.4",
|
|
35
35
|
"@opentelemetry/sdk-trace-node": "^1.0.4",
|
|
36
36
|
"@opentelemetry/semantic-conventions": "^1.0.4",
|
|
37
|
-
"@routr/common": "^2.0.8-alpha.
|
|
38
|
-
"@routr/processor": "^2.0.8-alpha.
|
|
37
|
+
"@routr/common": "^2.0.8-alpha.10",
|
|
38
|
+
"@routr/processor": "^2.0.8-alpha.10",
|
|
39
39
|
"ajv": "^6.12.6",
|
|
40
40
|
"fp-ts": "^2.11.8",
|
|
41
41
|
"pb-util": "^1.0.3",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/uniqid": "^5.3.2"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "5082233fb155ddb8535f934550fa4013da87468e"
|
|
56
56
|
}
|