@routr/common 2.6.1 → 2.7.2
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/assertions.js +1 -1
- package/dist/auth.d.ts +2 -40
- package/dist/auth.js +5 -72
- package/dist/connect/api/client.js +1 -1
- package/dist/connect/api/index.js +1 -1
- package/dist/connect/assertions.d.ts +0 -2
- package/dist/connect/assertions.js +2 -9
- package/dist/connect/client.js +4 -4
- package/dist/connect/config.d.ts +4 -0
- package/dist/connect/connect_error.js +1 -1
- package/dist/connect/index.js +1 -1
- package/dist/connect/mappers/agent.js +4 -2
- package/dist/connect/mappers/assertions.d.ts +0 -1
- package/dist/connect/mappers/assertions.js +2 -14
- package/dist/connect/mappers/index.js +1 -1
- package/dist/connect/mappers/peer.js +3 -2
- package/dist/connect/protos/acl.proto +1 -1
- package/dist/connect/protos/agents.proto +14 -2
- package/dist/connect/protos/credentials.proto +1 -1
- package/dist/connect/protos/domains.proto +1 -1
- package/dist/connect/protos/numbers.proto +1 -1
- package/dist/connect/protos/peers.proto +13 -1
- package/dist/connect/protos/trunks.proto +1 -1
- package/dist/connect/schemas/acl.js +1 -1
- package/dist/connect/schemas/agent.d.ts +8 -0
- package/dist/connect/schemas/agent.js +9 -1
- package/dist/connect/schemas/crendentials.js +1 -1
- package/dist/connect/schemas/domain.js +1 -1
- package/dist/connect/schemas/index.js +1 -1
- package/dist/connect/schemas/number.js +1 -1
- package/dist/connect/schemas/peer.d.ts +8 -0
- package/dist/connect/schemas/peer.js +9 -1
- package/dist/connect/schemas/trunk.js +1 -1
- package/dist/connect/schemas/validators.js +1 -1
- package/dist/connect/types.d.ts +4 -0
- package/dist/connect/validations.d.ts +0 -2
- package/dist/connect/validations.js +2 -16
- package/dist/envs.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/helper.d.ts +1 -1
- package/dist/helper.js +6 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -2
- package/dist/ip_utils.js +1 -1
- package/dist/protos/common.proto +1 -1
- package/dist/protos/location.proto +2 -1
- package/dist/protos/processor.proto +1 -1
- package/dist/protos/requester.proto +1 -1
- package/dist/protos/sipmessage.proto +1 -1
- package/dist/protos/verifier.proto +1 -1
- package/dist/requester/grpc_client.js +1 -1
- package/dist/requester/index.js +1 -1
- package/dist/response.d.ts +40 -0
- package/dist/response.js +71 -0
- package/dist/service.js +1 -1
- package/dist/tracer.js +1 -1
- package/dist/verifier/grpc_client.js +1 -1
- package/dist/verifier/index.js +1 -1
- package/dist/verifier/types.d.ts +1 -0
- package/dist/verifier/verifier.js +1 -1
- package/package.json +2 -2
package/dist/assertions.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.assertFileExist = exports.assertEnvsAreSet = void 0;
|
|
7
7
|
/*
|
|
8
|
-
* Copyright (C)
|
|
8
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
9
9
|
* http://github.com/fonoster/routr
|
|
10
10
|
*
|
|
11
11
|
* This file is part of Routr
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AuthChallengeResponse
|
|
1
|
+
import { AuthChallengeResponse } from "./types";
|
|
2
|
+
export declare const DEFAULT_ALGORITHM = "MD5";
|
|
2
3
|
export declare const generateNonce: (algorithm?: string) => string;
|
|
3
4
|
export declare const calculateAuthResponse: (res: AuthChallengeResponse, credentials: {
|
|
4
5
|
username: string;
|
|
@@ -11,42 +12,3 @@ export declare const getCredentials: (username: string, users: {
|
|
|
11
12
|
username: string;
|
|
12
13
|
secret: string;
|
|
13
14
|
};
|
|
14
|
-
export declare const createUnauthorizedResponse: (realm: string, params?: {
|
|
15
|
-
qop: string;
|
|
16
|
-
algorithm: string;
|
|
17
|
-
}) => {
|
|
18
|
-
message: {
|
|
19
|
-
responseType: ResponseType;
|
|
20
|
-
reasonPhrase: string;
|
|
21
|
-
wwwAuthenticate: {
|
|
22
|
-
scheme: string;
|
|
23
|
-
realm: string;
|
|
24
|
-
qop: string;
|
|
25
|
-
opaque: string;
|
|
26
|
-
stale: boolean;
|
|
27
|
-
nonce: string;
|
|
28
|
-
algorithm: string;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
export declare const createUnauthorizedResponseWithoutChallenge: (metadata?: Record<string, string>) => {
|
|
33
|
-
metadata: Record<string, string>;
|
|
34
|
-
message: {
|
|
35
|
-
responseType: ResponseType;
|
|
36
|
-
reasonPhrase: string;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export declare const createServerInternalErrorResponse: (metadata?: Record<string, string>) => {
|
|
40
|
-
metadata: Record<string, string>;
|
|
41
|
-
message: {
|
|
42
|
-
responseType: ResponseType;
|
|
43
|
-
reasonPhrase: string;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
export declare const createForbideenResponse: (metadata?: Record<string, string>) => {
|
|
47
|
-
metadata: Record<string, string>;
|
|
48
|
-
message: {
|
|
49
|
-
responseType: ResponseType;
|
|
50
|
-
reasonPhrase: string;
|
|
51
|
-
};
|
|
52
|
-
};
|
package/dist/auth.js
CHANGED
|
@@ -3,31 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
/*
|
|
8
|
-
* Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
|
|
9
|
-
* http://github.com/fonoster/routr
|
|
10
|
-
*
|
|
11
|
-
* This file is part of Routr
|
|
12
|
-
*
|
|
13
|
-
* Licensed under the MIT License (the "License");
|
|
14
|
-
* you may not use this file except in compliance with
|
|
15
|
-
* the License. You may obtain a copy of the License at
|
|
16
|
-
*
|
|
17
|
-
* https://opensource.org/licenses/MIT
|
|
18
|
-
*
|
|
19
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
20
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
-
* See the License for the specific language governing permissions and
|
|
23
|
-
* limitations under the License.
|
|
24
|
-
*/
|
|
25
|
-
const types_1 = require("./types");
|
|
6
|
+
exports.getCredentials = exports.calculateAuthResponse = exports.generateNonce = exports.DEFAULT_ALGORITHM = void 0;
|
|
26
7
|
const crypto_1 = __importDefault(require("crypto"));
|
|
27
|
-
|
|
28
|
-
const md5hex = (str, algorithm = DEFAULT_ALGORITHM) => crypto_1.default.createHash(algorithm).update(str).digest("hex");
|
|
29
|
-
const decToHex = (dec) => (dec + Math.pow(16, 8)).toString(16).
|
|
30
|
-
const generateNonce = (algorithm = DEFAULT_ALGORITHM) => md5hex(`${new Date().getTime()}${Math.random()}`, algorithm);
|
|
8
|
+
exports.DEFAULT_ALGORITHM = "MD5";
|
|
9
|
+
const md5hex = (str, algorithm = exports.DEFAULT_ALGORITHM) => crypto_1.default.createHash(algorithm).update(str).digest("hex");
|
|
10
|
+
const decToHex = (dec) => (dec + Math.pow(16, 8)).toString(16).slice(-8);
|
|
11
|
+
const generateNonce = (algorithm = exports.DEFAULT_ALGORITHM) => md5hex(`${new Date().getTime()}${Math.random()}`, algorithm);
|
|
31
12
|
exports.generateNonce = generateNonce;
|
|
32
13
|
const calculateAuthResponse = (res, credentials) => {
|
|
33
14
|
if (!credentials)
|
|
@@ -43,51 +24,3 @@ const calculateAuthResponse = (res, credentials) => {
|
|
|
43
24
|
exports.calculateAuthResponse = calculateAuthResponse;
|
|
44
25
|
const getCredentials = (username, users) => users.find((user) => user.username === username);
|
|
45
26
|
exports.getCredentials = getCredentials;
|
|
46
|
-
const createUnauthorizedResponse = (realm, params = { qop: "auth", algorithm: DEFAULT_ALGORITHM }) => {
|
|
47
|
-
return {
|
|
48
|
-
message: {
|
|
49
|
-
responseType: types_1.ResponseType.UNAUTHORIZED,
|
|
50
|
-
reasonPhrase: "Unauthorized",
|
|
51
|
-
wwwAuthenticate: {
|
|
52
|
-
scheme: "Digest",
|
|
53
|
-
realm: realm,
|
|
54
|
-
qop: params.qop,
|
|
55
|
-
opaque: "",
|
|
56
|
-
stale: false,
|
|
57
|
-
nonce: (0, exports.generateNonce)(),
|
|
58
|
-
algorithm: params.algorithm
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
exports.createUnauthorizedResponse = createUnauthorizedResponse;
|
|
64
|
-
const createUnauthorizedResponseWithoutChallenge = (metadata) => {
|
|
65
|
-
return {
|
|
66
|
-
metadata,
|
|
67
|
-
message: {
|
|
68
|
-
responseType: types_1.ResponseType.UNAUTHORIZED,
|
|
69
|
-
reasonPhrase: "Unauthorized"
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
exports.createUnauthorizedResponseWithoutChallenge = createUnauthorizedResponseWithoutChallenge;
|
|
74
|
-
const createServerInternalErrorResponse = (metadata) => {
|
|
75
|
-
return {
|
|
76
|
-
metadata,
|
|
77
|
-
message: {
|
|
78
|
-
responseType: types_1.ResponseType.SERVER_INTERNAL_ERROR,
|
|
79
|
-
reasonPhrase: "Server Internal Error"
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
exports.createServerInternalErrorResponse = createServerInternalErrorResponse;
|
|
84
|
-
const createForbideenResponse = (metadata) => {
|
|
85
|
-
return {
|
|
86
|
-
metadata,
|
|
87
|
-
message: {
|
|
88
|
-
responseType: types_1.ResponseType.FORBIDDEN,
|
|
89
|
-
reasonPhrase: "Forbidden"
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
exports.createForbideenResponse = createForbideenResponse;
|
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.serviceAPI = exports.apiClient = void 0;
|
|
27
27
|
/*
|
|
28
|
-
* Copyright (C)
|
|
28
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
29
29
|
* http://github.com/fonoster/routr
|
|
30
30
|
*
|
|
31
31
|
* This file is part of Routr
|
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/*
|
|
18
|
-
* Copyright (C)
|
|
18
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
19
19
|
* http://github.com/fonoster/routr
|
|
20
20
|
*
|
|
21
21
|
* This file is part of Routr.
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { LoadBalancingAlgorithm } from "../types";
|
|
2
1
|
import { TrunkURI } from "./types";
|
|
3
2
|
export declare const hasValidHeadersOrThrow: (headers: {
|
|
4
3
|
name: string;
|
|
5
4
|
value: string;
|
|
6
5
|
}[]) => void;
|
|
7
|
-
export declare const isValidBalancingAlgorithmOrThrow: (aor: string, algorithm: LoadBalancingAlgorithm) => void;
|
|
8
6
|
export declare const hasACLRulesOrThrow: (acl: {
|
|
9
7
|
deny: string[];
|
|
10
8
|
allow: string[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasValidOutboundUrisOrThrow = exports.isValidE164OrThrow = exports.isValidContactAddressOrThrow = exports.isValidAORLinkOrThrow = exports.hasAORLinkOrThrow = exports.isValidAOROrThrow = exports.hasAOROrThrow = exports.isValidInboundUriOrThrow = exports.hasInboundUriOrThrow = exports.hasCountryISOCodeOrThrow = exports.hasCountryOrThrow = exports.hasCityOrThrow = exports.isValidSessionAffinityHeaderOrThrow = exports.hasTelUrlOrThrow = exports.isValidDomainUriOrThrow = exports.hasDomainUriOrThrow = exports.hasPasswordOrThrow = exports.isValidUsernameOrThrow = exports.hasUsernameOrThrow = exports.isValidNameOrThrow = exports.hasNameOrThrow = exports.hasRefenceOrThrow = exports.hasValidACLRulesOrThrow = exports.hasACLRulesOrThrow = exports.
|
|
3
|
+
exports.hasValidOutboundUrisOrThrow = exports.isValidE164OrThrow = exports.isValidContactAddressOrThrow = exports.isValidAORLinkOrThrow = exports.hasAORLinkOrThrow = exports.isValidAOROrThrow = exports.hasAOROrThrow = exports.isValidInboundUriOrThrow = exports.hasInboundUriOrThrow = exports.hasCountryISOCodeOrThrow = exports.hasCountryOrThrow = exports.hasCityOrThrow = exports.isValidSessionAffinityHeaderOrThrow = exports.hasTelUrlOrThrow = exports.isValidDomainUriOrThrow = exports.hasDomainUriOrThrow = exports.hasPasswordOrThrow = exports.isValidUsernameOrThrow = exports.hasUsernameOrThrow = exports.isValidNameOrThrow = exports.hasNameOrThrow = exports.hasRefenceOrThrow = exports.hasValidACLRulesOrThrow = exports.hasACLRulesOrThrow = exports.hasValidHeadersOrThrow = void 0;
|
|
4
4
|
/*
|
|
5
|
-
* Copyright (C)
|
|
5
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/routr
|
|
7
7
|
*
|
|
8
8
|
* This file is part of Routr.
|
|
@@ -34,13 +34,6 @@ const hasValidHeadersOrThrow = (headers) => {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
exports.hasValidHeadersOrThrow = hasValidHeadersOrThrow;
|
|
37
|
-
const isValidBalancingAlgorithmOrThrow = (aor, algorithm) => {
|
|
38
|
-
const E = (0, validations_1.isValidBalancingAlgorithm)(aor, algorithm);
|
|
39
|
-
if (E instanceof errors_1.BadRequestError) {
|
|
40
|
-
throw E;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
exports.isValidBalancingAlgorithmOrThrow = isValidBalancingAlgorithmOrThrow;
|
|
44
37
|
const hasACLRulesOrThrow = (acl) => validOrThrow(validations_1.hasACLRules, acl);
|
|
45
38
|
exports.hasACLRulesOrThrow = hasACLRulesOrThrow;
|
|
46
39
|
const hasValidACLRulesOrThrow = (acl) => validOrThrow(validations_1.hasValidACLRules, acl);
|
package/dist/connect/client.js
CHANGED
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.createConnectService = exports.createConnectClient = void 0;
|
|
27
27
|
/*
|
|
28
|
-
* Copyright (C)
|
|
28
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
29
29
|
* http://github.com/fonoster/routr
|
|
30
30
|
*
|
|
31
31
|
* This file is part of Routr
|
|
@@ -44,9 +44,9 @@ exports.createConnectService = exports.createConnectClient = void 0;
|
|
|
44
44
|
*/
|
|
45
45
|
/* eslint-disable require-jsdoc */
|
|
46
46
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
47
|
-
const protoLoader = require("@grpc/proto-loader");
|
|
48
47
|
const helper_1 = require("../helper");
|
|
49
48
|
const types_1 = require("./types");
|
|
49
|
+
const protoLoader = require("@grpc/proto-loader");
|
|
50
50
|
const protoOptions = {
|
|
51
51
|
keepCase: false,
|
|
52
52
|
longs: String,
|
|
@@ -74,7 +74,7 @@ function createConnectClient(options) {
|
|
|
74
74
|
case types_1.Kind.CREDENTIALS:
|
|
75
75
|
return new base.credentials.v2beta1.CredentialsService(options.apiAddr, options.credentials);
|
|
76
76
|
default:
|
|
77
|
-
return new base[options.kind + "s"].v2beta1[(0, helper_1.
|
|
77
|
+
return new base[options.kind + "s"].v2beta1[(0, helper_1.toPascalCase)(options.kind) + "s"](options.apiAddr, options.credentials);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
exports.createConnectClient = createConnectClient;
|
|
@@ -88,7 +88,7 @@ function createConnectService(kind) {
|
|
|
88
88
|
case types_1.Kind.CREDENTIALS:
|
|
89
89
|
return base.credentials.v2beta1.CredentialsService.service;
|
|
90
90
|
default:
|
|
91
|
-
return base[kind + "s"].v2beta1[(0, helper_1.
|
|
91
|
+
return base[kind + "s"].v2beta1[(0, helper_1.toPascalCase)(kind) + "s"].service;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
exports.createConnectService = createConnectService;
|
package/dist/connect/config.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export interface AgentConfig extends ConfigBase {
|
|
|
23
23
|
domainRef: string;
|
|
24
24
|
credentialsRef: string;
|
|
25
25
|
privacy: Privacy;
|
|
26
|
+
maxContacts?: number;
|
|
27
|
+
expires?: number;
|
|
26
28
|
enabled: boolean;
|
|
27
29
|
};
|
|
28
30
|
}
|
|
@@ -34,6 +36,8 @@ export interface PeerConfig extends ConfigBase {
|
|
|
34
36
|
credentialsRef?: string;
|
|
35
37
|
contactAddr?: string;
|
|
36
38
|
enabled?: boolean;
|
|
39
|
+
maxContacts?: number;
|
|
40
|
+
expires?: number;
|
|
37
41
|
loadBalancing?: {
|
|
38
42
|
algorithm: LoadBalancingAlgorithm;
|
|
39
43
|
withSessionAffinity: boolean;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertToErrorResponse = exports.CodeToResponseTypeMap = void 0;
|
|
4
4
|
/*
|
|
5
|
-
* Copyright (C)
|
|
5
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/routr
|
|
7
7
|
*
|
|
8
8
|
* This file is part of Routr.
|
package/dist/connect/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/*
|
|
18
|
-
* Copyright (C)
|
|
18
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
19
19
|
* http://github.com/fonoster/routr
|
|
20
20
|
*
|
|
21
21
|
* This file is part of Routr.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mapToAgent = void 0;
|
|
4
4
|
/*
|
|
5
|
-
* Copyright (C)
|
|
5
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/routr
|
|
7
7
|
*
|
|
8
8
|
* This file is part of Routr.
|
|
@@ -36,7 +36,9 @@ function mapToAgent(config) {
|
|
|
36
36
|
privacy: (_a = config.spec.privacy) !== null && _a !== void 0 ? _a : types_1.Privacy.NONE,
|
|
37
37
|
enabled: config.spec.enabled,
|
|
38
38
|
domainRef: config.spec.domainRef,
|
|
39
|
-
credentialsRef: config.spec.credentialsRef
|
|
39
|
+
credentialsRef: config.spec.credentialsRef,
|
|
40
|
+
maxContacts: config.spec.maxContacts,
|
|
41
|
+
expires: config.spec.expires
|
|
40
42
|
};
|
|
41
43
|
}
|
|
42
44
|
exports.mapToAgent = mapToAgent;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.assertValidSchema = void 0;
|
|
4
4
|
/*
|
|
5
|
-
* Copyright (C)
|
|
5
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/routr
|
|
7
7
|
*
|
|
8
8
|
* This file is part of Routr.
|
|
@@ -29,15 +29,3 @@ const assertValidSchema = (config, valid) => {
|
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
31
|
exports.assertValidSchema = assertValidSchema;
|
|
32
|
-
const assertValidAorSchema = (config) => {
|
|
33
|
-
const spec = config.spec;
|
|
34
|
-
if (spec.aor.startsWith("backend:") && !spec.loadBalancing) {
|
|
35
|
-
logger.error("found a bad resource: balancing algorithm is required for `backend:` aors");
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
if (spec.aor.startsWith("sip:") && spec.loadBalancing) {
|
|
39
|
-
logger.error("found a bad resource: balancing algorithm is not allowed for `sip:` aors");
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
exports.assertValidAorSchema = assertValidAorSchema;
|
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/*
|
|
18
|
-
* Copyright (C)
|
|
18
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
19
19
|
* http://github.com/fonoster/routr
|
|
20
20
|
*
|
|
21
21
|
* This file is part of Routr.
|
|
@@ -8,7 +8,6 @@ const valid = schemas_1.schemaValidators.get(types_1.Kind.PEER);
|
|
|
8
8
|
function mapToPeer(config) {
|
|
9
9
|
var _a, _b;
|
|
10
10
|
(0, assertions_1.assertValidSchema)(config, valid);
|
|
11
|
-
(0, assertions_1.assertValidAorSchema)(config);
|
|
12
11
|
const normalizeAlgorithm = (algorithm) => algorithm === null || algorithm === void 0 ? void 0 : algorithm.replace(/-/g, "_").toUpperCase();
|
|
13
12
|
return {
|
|
14
13
|
apiVersion: config.apiVersion,
|
|
@@ -20,7 +19,9 @@ function mapToPeer(config) {
|
|
|
20
19
|
enabled: config.spec.enabled,
|
|
21
20
|
credentialsRef: config.spec.credentialsRef,
|
|
22
21
|
balancingAlgorithm: normalizeAlgorithm((_a = config.spec.loadBalancing) === null || _a === void 0 ? void 0 : _a.algorithm),
|
|
23
|
-
withSessionAffinity: (_b = config.spec.loadBalancing) === null || _b === void 0 ? void 0 : _b.withSessionAffinity
|
|
22
|
+
withSessionAffinity: (_b = config.spec.loadBalancing) === null || _b === void 0 ? void 0 : _b.withSessionAffinity,
|
|
23
|
+
maxContacts: config.spec.maxContacts,
|
|
24
|
+
expires: config.spec.expires
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
27
|
exports.mapToPeer = mapToPeer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
3
3
|
* http://github.com/fonoster/routr
|
|
4
4
|
*
|
|
5
5
|
* This file is part of Routr
|
|
@@ -64,6 +64,10 @@ message Agent {
|
|
|
64
64
|
int32 created_at = 7;
|
|
65
65
|
// The updated_at timestamp of the Agent
|
|
66
66
|
int32 updated_at = 8;
|
|
67
|
+
// The maximum number of contacts that can be created for this Agent
|
|
68
|
+
int32 max_contacts = 12;
|
|
69
|
+
// Value to override the expires requested by the Agent
|
|
70
|
+
int32 expires = 13;
|
|
67
71
|
// The domain of the Agent
|
|
68
72
|
fonoster.routr.connect.domains.v2beta1.Domain domain = 9;
|
|
69
73
|
// The credentials of the Agent
|
|
@@ -86,8 +90,12 @@ message CreateAgentRequest {
|
|
|
86
90
|
string domain_ref = 5;
|
|
87
91
|
// Reference to the Credentials of the Agent
|
|
88
92
|
string credentials_ref = 6;
|
|
93
|
+
// The maximum number of contacts that can be created for this Agent
|
|
94
|
+
int32 max_contacts = 8;
|
|
95
|
+
// Value to override the expires requested by the Agent
|
|
96
|
+
int32 expires = 9;
|
|
89
97
|
// The extended attributes of the Agent
|
|
90
|
-
.google.protobuf.Struct extended = 7;
|
|
98
|
+
.google.protobuf.Struct extended = 7;
|
|
91
99
|
}
|
|
92
100
|
|
|
93
101
|
// The request message for the Agents.Update method
|
|
@@ -104,6 +112,10 @@ message UpdateAgentRequest {
|
|
|
104
112
|
string domain_ref = 5;
|
|
105
113
|
// Reference to the Credentials of the Agent
|
|
106
114
|
string credentials_ref = 6;
|
|
115
|
+
// The maximum number of contacts that can be created for this Agent
|
|
116
|
+
int32 max_contacts = 8;
|
|
117
|
+
// Value to override the expires requested by the Agent
|
|
118
|
+
int32 expires = 9;
|
|
107
119
|
// The extended attributes of the Agent
|
|
108
120
|
.google.protobuf.Struct extended = 7;
|
|
109
121
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
3
3
|
* http://github.com/fonoster/routr
|
|
4
4
|
*
|
|
5
5
|
* This file is part of Routr
|
|
@@ -79,6 +79,10 @@ message Peer {
|
|
|
79
79
|
fonoster.routr.connect.acl.v2beta1.AccessControlList access_control_list = 12;
|
|
80
80
|
// The credentials of the Peer
|
|
81
81
|
fonoster.routr.connect.credentials.v2beta1.Credentials credentials = 13;
|
|
82
|
+
// The maximum number of contacts that can be created for this Peer
|
|
83
|
+
int32 max_contacts = 15;
|
|
84
|
+
// Value to override the expires requested by the Peer
|
|
85
|
+
int32 expires = 16;
|
|
82
86
|
// The extended attributes of the Peer
|
|
83
87
|
.google.protobuf.Struct extended = 14;
|
|
84
88
|
}
|
|
@@ -103,6 +107,10 @@ message CreatePeerRequest {
|
|
|
103
107
|
string credentials_ref = 8;
|
|
104
108
|
// The status of the Peer
|
|
105
109
|
bool enabled = 9;
|
|
110
|
+
// The maximum number of contacts that can be created for this Peer
|
|
111
|
+
int32 max_contacts = 11;
|
|
112
|
+
// Value to override the expires requested by the Peer
|
|
113
|
+
int32 expires = 12;
|
|
106
114
|
// The extended attributes of the Peer
|
|
107
115
|
.google.protobuf.Struct extended = 10;
|
|
108
116
|
}
|
|
@@ -127,6 +135,10 @@ message UpdatePeerRequest {
|
|
|
127
135
|
string credentials_ref = 8;
|
|
128
136
|
// The status of the Peer
|
|
129
137
|
bool enabled = 9;
|
|
138
|
+
// The maximum number of contacts that can be created for this Peer
|
|
139
|
+
int32 max_contacts = 11;
|
|
140
|
+
// Value to override the expires requested by the Peer
|
|
141
|
+
int32 expires = 12;
|
|
130
142
|
// The extended attributes of the Peer
|
|
131
143
|
.google.protobuf.Struct extended = 10;
|
|
132
144
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/*
|
|
4
|
-
* Copyright (C)
|
|
4
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
5
5
|
* http://github.com/fonoster/routr
|
|
6
6
|
*
|
|
7
7
|
* This file is part of Routr.
|
|
@@ -45,6 +45,14 @@ declare const _default: {
|
|
|
45
45
|
description: string;
|
|
46
46
|
type: string;
|
|
47
47
|
};
|
|
48
|
+
maxContacts: {
|
|
49
|
+
description: string;
|
|
50
|
+
type: string;
|
|
51
|
+
};
|
|
52
|
+
expires: {
|
|
53
|
+
description: string;
|
|
54
|
+
type: string;
|
|
55
|
+
};
|
|
48
56
|
enabled: {
|
|
49
57
|
description: string;
|
|
50
58
|
type: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/*
|
|
4
|
-
* Copyright (C)
|
|
4
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
5
5
|
* http://github.com/fonoster/routr
|
|
6
6
|
*
|
|
7
7
|
* This file is part of Routr.
|
|
@@ -65,6 +65,14 @@ exports.default = {
|
|
|
65
65
|
description: "The credential the Agent uses to authenticate",
|
|
66
66
|
type: "string"
|
|
67
67
|
},
|
|
68
|
+
maxContacts: {
|
|
69
|
+
description: "The maximum number of contacts acceptable for this Agent",
|
|
70
|
+
type: "integer"
|
|
71
|
+
},
|
|
72
|
+
expires: {
|
|
73
|
+
description: "Time, in seconds, to override the expires requested by the Agent",
|
|
74
|
+
type: "integer"
|
|
75
|
+
},
|
|
68
76
|
enabled: {
|
|
69
77
|
description: "Whether the Agent is enabled (reserved for future use)",
|
|
70
78
|
type: "boolean"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/*
|
|
4
|
-
* Copyright (C)
|
|
4
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
5
5
|
* http://github.com/fonoster/routr
|
|
6
6
|
*
|
|
7
7
|
* This file is part of Routr.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/*
|
|
4
|
-
* Copyright (C)
|
|
4
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
5
5
|
* http://github.com/fonoster/routr
|
|
6
6
|
*
|
|
7
7
|
* This file is part of Routr.
|
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/*
|
|
18
|
-
* Copyright (C)
|
|
18
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
19
19
|
* http://github.com/fonoster/routr
|
|
20
20
|
*
|
|
21
21
|
* This file is part of Routr.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/*
|
|
4
|
-
* Copyright (C)
|
|
4
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
5
5
|
* http://github.com/fonoster/routr
|
|
6
6
|
*
|
|
7
7
|
* This file is part of Routr.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/*
|
|
4
|
-
* Copyright (C)
|
|
4
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
5
5
|
* http://github.com/fonoster/routr
|
|
6
6
|
*
|
|
7
7
|
* This file is part of Routr.
|
|
@@ -91,6 +91,14 @@ exports.default = {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
|
+
maxContacts: {
|
|
95
|
+
description: "The maximum number of contacts acceptable for this Peer",
|
|
96
|
+
type: "integer"
|
|
97
|
+
},
|
|
98
|
+
expires: {
|
|
99
|
+
description: "Time, in seconds, to override the expires requested by the Peer",
|
|
100
|
+
type: "integer"
|
|
101
|
+
},
|
|
94
102
|
enabled: {
|
|
95
103
|
description: "Whether the Peer is enabled",
|
|
96
104
|
type: "boolean"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/*
|
|
4
|
-
* Copyright (C)
|
|
4
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
5
5
|
* http://github.com/fonoster/routr
|
|
6
6
|
*
|
|
7
7
|
* This file is part of Routr.
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.schemaValidators = void 0;
|
|
7
7
|
/*
|
|
8
|
-
* Copyright (C)
|
|
8
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
9
9
|
* http://github.com/fonoster/routr
|
|
10
10
|
*
|
|
11
11
|
* This file is part of Routr.
|
package/dist/connect/types.d.ts
CHANGED
|
@@ -44,6 +44,8 @@ export interface Agent extends BaseConnectModel {
|
|
|
44
44
|
enabled: boolean;
|
|
45
45
|
domainRef?: string;
|
|
46
46
|
domain?: Domain;
|
|
47
|
+
maxContacts: number;
|
|
48
|
+
expires?: number;
|
|
47
49
|
credentialsRef?: string;
|
|
48
50
|
credentials?: Credentials;
|
|
49
51
|
}
|
|
@@ -96,6 +98,8 @@ export interface Peer extends BaseConnectModel {
|
|
|
96
98
|
accessControlList?: AccessControlList;
|
|
97
99
|
credentialsRef?: string;
|
|
98
100
|
credentials?: Credentials;
|
|
101
|
+
maxContacts: number;
|
|
102
|
+
expires?: number;
|
|
99
103
|
balancingAlgorithm?: LoadBalancingAlgorithm;
|
|
100
104
|
withSessionAffinity?: boolean;
|
|
101
105
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BadRequestError } from "../errors";
|
|
2
|
-
import { LoadBalancingAlgorithm } from "../types";
|
|
3
2
|
export declare const hasReference: (ref: string) => true | BadRequestError;
|
|
4
3
|
export declare const hasName: (name: string) => true | BadRequestError;
|
|
5
4
|
export declare const isValidName: (name: string) => true | BadRequestError;
|
|
@@ -33,7 +32,6 @@ export declare const hasValidACLRules: (acl: {
|
|
|
33
32
|
}) => true | BadRequestError;
|
|
34
33
|
export declare const hasInboundUri: (inboundUri: string) => true | BadRequestError;
|
|
35
34
|
export declare const isValidInboundUri: (inboundUri: string) => true | BadRequestError;
|
|
36
|
-
export declare const isValidBalancingAlgorithm: (aor: string, algorithm: LoadBalancingAlgorithm) => BadRequestError;
|
|
37
35
|
export declare const isValidPort: (port: string) => BadRequestError;
|
|
38
36
|
export declare const hasHost: (host: string) => true | BadRequestError;
|
|
39
37
|
export declare const isValidHost: (host: string) => true | BadRequestError;
|
|
@@ -23,9 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.isValidE164 = exports.isValidWeight = exports.isValidPriority = exports.isValidContactAddress = exports.isValidHost = exports.hasHost = exports.isValidPort = exports.
|
|
26
|
+
exports.isValidE164 = exports.isValidWeight = exports.isValidPriority = exports.isValidContactAddress = exports.isValidHost = exports.hasHost = exports.isValidPort = exports.isValidInboundUri = exports.hasInboundUri = exports.hasValidACLRules = exports.isValidACLRule = exports.hasACLRules = exports.hasCountryISOCode = exports.hasCountry = exports.hasCity = exports.isValidAORLink = exports.hasAORLink = exports.isValidAOR = exports.hasAOR = exports.hasValidHeaders = exports.isValidHeader = exports.isValidSessionAffinityHeader = exports.hasTelUrl = exports.isValidDomainUri = exports.hasDomainUri = exports.hasPassword = exports.isValidUsername = exports.hasUsername = exports.isValidName = exports.hasName = exports.hasReference = void 0;
|
|
27
27
|
/*
|
|
28
|
-
* Copyright (C)
|
|
28
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
29
29
|
* http://github.com/fonoster/routr
|
|
30
30
|
*
|
|
31
31
|
* This file is part of Routr.
|
|
@@ -44,7 +44,6 @@ exports.isValidE164 = exports.isValidWeight = exports.isValidPriority = exports.
|
|
|
44
44
|
*/
|
|
45
45
|
const Validator = __importStar(require("validator"));
|
|
46
46
|
const errors_1 = require("../errors");
|
|
47
|
-
const types_1 = require("../types");
|
|
48
47
|
const phone_1 = require("phone");
|
|
49
48
|
const hasReference = (ref) => ref ? true : new errors_1.BadRequestError("the reference to the resource is required");
|
|
50
49
|
exports.hasReference = hasReference;
|
|
@@ -190,19 +189,6 @@ const isValidInboundUri = (inboundUri) => {
|
|
|
190
189
|
return true;
|
|
191
190
|
};
|
|
192
191
|
exports.isValidInboundUri = isValidInboundUri;
|
|
193
|
-
const isValidBalancingAlgorithm = (aor, algorithm) => {
|
|
194
|
-
if (aor.startsWith("backend:")) {
|
|
195
|
-
if (!algorithm || algorithm === types_1.LoadBalancingAlgorithm.UNSPECIFIED) {
|
|
196
|
-
return new errors_1.BadRequestError("when the aor schema is `backend:`, the balancing algorithm is required");
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
if (algorithm && algorithm !== types_1.LoadBalancingAlgorithm.UNSPECIFIED) {
|
|
201
|
-
return new errors_1.BadRequestError("when the aor schema is `sip:`, the balancing algorithm is not allowed");
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
exports.isValidBalancingAlgorithm = isValidBalancingAlgorithm;
|
|
206
192
|
const isValidPort = (port) => {
|
|
207
193
|
if (port) {
|
|
208
194
|
if (!Validator.default.isPort(port)) {
|
package/dist/envs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ENFORCE_E164_WITH_MOBILE_PREFIX = exports.ENFORCE_E164 = void 0;
|
|
4
4
|
/*
|
|
5
|
-
* Copyright (C)
|
|
5
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/routr
|
|
7
7
|
*
|
|
8
8
|
* This file is part of Routr.
|
package/dist/errors.js
CHANGED
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.BadRequestError = exports.ResourceNotFoundError = exports.UnimplementedError = exports.ClientConnectionError = exports.ServiceUnavailableError = exports.ServiceDefinitionNotFoundError = void 0;
|
|
27
27
|
/*
|
|
28
|
-
* Copyright (C)
|
|
28
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
29
29
|
* http://github.com/fonoster/routr
|
|
30
30
|
*
|
|
31
31
|
* This file is part of Routr
|
package/dist/helper.d.ts
CHANGED
|
@@ -26,4 +26,4 @@ export declare const getListeningPoint: (listeningPoints: NetInterface[], transp
|
|
|
26
26
|
* @throws {Error} If the file is empty.
|
|
27
27
|
*/
|
|
28
28
|
export declare const readConfigFile: (path: string) => Record<string, any>;
|
|
29
|
-
export declare const
|
|
29
|
+
export declare const toPascalCase: (str: string) => string;
|
package/dist/helper.js
CHANGED
|
@@ -26,9 +26,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.toPascalCase = exports.readConfigFile = exports.getListeningPoint = exports.deepCopy = void 0;
|
|
30
30
|
/*
|
|
31
|
-
* Copyright (C)
|
|
31
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
32
32
|
* http://github.com/fonoster/routr
|
|
33
33
|
*
|
|
34
34
|
* This file is part of Routr
|
|
@@ -124,11 +124,11 @@ const readConfigFile = (path) => {
|
|
|
124
124
|
}
|
|
125
125
|
};
|
|
126
126
|
exports.readConfigFile = readConfigFile;
|
|
127
|
-
const
|
|
127
|
+
const toPascalCase = (str) => {
|
|
128
128
|
return str
|
|
129
|
-
.replace(/(?:^\w|[A-Z]|\b\w)/g, (word
|
|
130
|
-
return
|
|
129
|
+
.replace(/(?:^\w|[A-Z]|\b\w)/g, (word) => {
|
|
130
|
+
return word.toUpperCase();
|
|
131
131
|
})
|
|
132
132
|
.replace(/\s+/g, "");
|
|
133
133
|
};
|
|
134
|
-
exports.
|
|
134
|
+
exports.toPascalCase = toPascalCase;
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * as Tracer from "./tracer";
|
|
|
9
9
|
export * as Assertions from "./assertions";
|
|
10
10
|
export * as CommonConnect from "./connect";
|
|
11
11
|
export * as CommonRequester from "./requester";
|
|
12
|
+
export * as CommonResponse from "./response";
|
|
12
13
|
export * as CommonTypes from "./types";
|
|
13
14
|
export * as CommonErrors from "./errors";
|
|
14
15
|
export * as ConnectSchemas from "./connect/schemas";
|
package/dist/index.js
CHANGED
|
@@ -23,9 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Verifier = exports.Environment = exports.ConnectSchemas = exports.CommonErrors = exports.CommonTypes = exports.CommonRequester = exports.CommonConnect = exports.Assertions = exports.Tracer = exports.IpUtils = exports.Helper = exports.Redis = exports.Auth = exports.LOCATION_OBJECT_PROTO = exports.PROCESSOR_OBJECT_PROTO = exports.Method = exports.Transport = exports.getObjectProto = exports.createService = void 0;
|
|
26
|
+
exports.Verifier = exports.Environment = exports.ConnectSchemas = exports.CommonErrors = exports.CommonTypes = exports.CommonResponse = exports.CommonRequester = exports.CommonConnect = exports.Assertions = exports.Tracer = exports.IpUtils = exports.Helper = exports.Redis = exports.Auth = exports.LOCATION_OBJECT_PROTO = exports.PROCESSOR_OBJECT_PROTO = exports.Method = exports.Transport = exports.getObjectProto = exports.createService = void 0;
|
|
27
27
|
/*
|
|
28
|
-
* Copyright (C)
|
|
28
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
29
29
|
* http://github.com/fonoster/routr
|
|
30
30
|
*
|
|
31
31
|
* This file is part of Routr
|
|
@@ -58,6 +58,7 @@ exports.Tracer = __importStar(require("./tracer"));
|
|
|
58
58
|
exports.Assertions = __importStar(require("./assertions"));
|
|
59
59
|
exports.CommonConnect = __importStar(require("./connect"));
|
|
60
60
|
exports.CommonRequester = __importStar(require("./requester"));
|
|
61
|
+
exports.CommonResponse = __importStar(require("./response"));
|
|
61
62
|
exports.CommonTypes = __importStar(require("./types"));
|
|
62
63
|
exports.CommonErrors = __importStar(require("./errors"));
|
|
63
64
|
exports.ConnectSchemas = __importStar(require("./connect/schemas"));
|
package/dist/ip_utils.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getLocalnetIp = exports.isLocalnet = exports.addressCount = exports.hasIp = exports.formatNet = void 0;
|
|
4
4
|
/*
|
|
5
|
-
* Copyright (C)
|
|
5
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/routr
|
|
7
7
|
*
|
|
8
8
|
* This file is part of Routr
|
package/dist/protos/common.proto
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (C)
|
|
2
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
3
3
|
* http://github.com/fonoster/routr
|
|
4
4
|
*
|
|
5
5
|
* This file is part of Routr
|
|
@@ -60,6 +60,7 @@ message AddRouteRequest {
|
|
|
60
60
|
// Address of record for the endpoint or trunk
|
|
61
61
|
string aor = 1;
|
|
62
62
|
Route route = 2;
|
|
63
|
+
int32 max_contacts = 3;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
message FindRoutesRequest {
|
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.REQUESTER_PROTO = void 0;
|
|
27
27
|
/*
|
|
28
|
-
* Copyright (C)
|
|
28
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
29
29
|
* http://github.com/fonoster/routr
|
|
30
30
|
*
|
|
31
31
|
* This file is part of Routr
|
package/dist/requester/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/*
|
|
18
|
-
* Copyright (C)
|
|
18
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
19
19
|
* http://github.com/fonoster/routr
|
|
20
20
|
*
|
|
21
21
|
* This file is part of Routr.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ResponseType } from "./types";
|
|
2
|
+
export declare const createUnauthorizedResponse: (realm: string, params?: {
|
|
3
|
+
qop: string;
|
|
4
|
+
algorithm: string;
|
|
5
|
+
}) => {
|
|
6
|
+
message: {
|
|
7
|
+
responseType: ResponseType;
|
|
8
|
+
reasonPhrase: string;
|
|
9
|
+
wwwAuthenticate: {
|
|
10
|
+
scheme: string;
|
|
11
|
+
realm: string;
|
|
12
|
+
qop: string;
|
|
13
|
+
opaque: string;
|
|
14
|
+
stale: boolean;
|
|
15
|
+
nonce: string;
|
|
16
|
+
algorithm: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare const createUnauthorizedResponseWithoutChallenge: (metadata?: Record<string, string>) => {
|
|
21
|
+
metadata: Record<string, string>;
|
|
22
|
+
message: {
|
|
23
|
+
responseType: ResponseType;
|
|
24
|
+
reasonPhrase: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare const createServerInternalErrorResponse: (metadata?: Record<string, string>) => {
|
|
28
|
+
metadata: Record<string, string>;
|
|
29
|
+
message: {
|
|
30
|
+
responseType: ResponseType;
|
|
31
|
+
reasonPhrase: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare const createForbideenResponse: (metadata?: Record<string, string>) => {
|
|
35
|
+
metadata: Record<string, string>;
|
|
36
|
+
message: {
|
|
37
|
+
responseType: ResponseType;
|
|
38
|
+
reasonPhrase: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
package/dist/response.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createForbideenResponse = exports.createServerInternalErrorResponse = exports.createUnauthorizedResponseWithoutChallenge = exports.createUnauthorizedResponse = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
6
|
+
* http://github.com/fonoster/routr
|
|
7
|
+
*
|
|
8
|
+
* This file is part of Routr.
|
|
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 auth_1 = require("./auth");
|
|
23
|
+
const types_1 = require("./types");
|
|
24
|
+
const createUnauthorizedResponse = (realm, params = { qop: "auth", algorithm: auth_1.DEFAULT_ALGORITHM }) => {
|
|
25
|
+
return {
|
|
26
|
+
message: {
|
|
27
|
+
responseType: types_1.ResponseType.UNAUTHORIZED,
|
|
28
|
+
reasonPhrase: "Unauthorized",
|
|
29
|
+
wwwAuthenticate: {
|
|
30
|
+
scheme: "Digest",
|
|
31
|
+
realm: realm,
|
|
32
|
+
qop: params.qop,
|
|
33
|
+
opaque: "",
|
|
34
|
+
stale: false,
|
|
35
|
+
nonce: (0, auth_1.generateNonce)(),
|
|
36
|
+
algorithm: params.algorithm
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
exports.createUnauthorizedResponse = createUnauthorizedResponse;
|
|
42
|
+
const createUnauthorizedResponseWithoutChallenge = (metadata) => {
|
|
43
|
+
return {
|
|
44
|
+
metadata,
|
|
45
|
+
message: {
|
|
46
|
+
responseType: types_1.ResponseType.UNAUTHORIZED,
|
|
47
|
+
reasonPhrase: "Unauthorized"
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
exports.createUnauthorizedResponseWithoutChallenge = createUnauthorizedResponseWithoutChallenge;
|
|
52
|
+
const createServerInternalErrorResponse = (metadata) => {
|
|
53
|
+
return {
|
|
54
|
+
metadata,
|
|
55
|
+
message: {
|
|
56
|
+
responseType: types_1.ResponseType.SERVER_INTERNAL_ERROR,
|
|
57
|
+
reasonPhrase: "Server Internal Error"
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
exports.createServerInternalErrorResponse = createServerInternalErrorResponse;
|
|
62
|
+
const createForbideenResponse = (metadata) => {
|
|
63
|
+
return {
|
|
64
|
+
metadata,
|
|
65
|
+
message: {
|
|
66
|
+
responseType: types_1.ResponseType.FORBIDDEN,
|
|
67
|
+
reasonPhrase: "Forbidden"
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
exports.createForbideenResponse = createForbideenResponse;
|
package/dist/service.js
CHANGED
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.getObjectProto = exports.LOCATION_OBJECT_PROTO = exports.PROCESSOR_OBJECT_PROTO = void 0;
|
|
27
27
|
/*
|
|
28
|
-
* Copyright (C)
|
|
28
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
29
29
|
* http://github.com/fonoster/routr
|
|
30
30
|
*
|
|
31
31
|
* This file is part of Routr
|
package/dist/tracer.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.init = void 0;
|
|
7
7
|
/*
|
|
8
|
-
* Copyright (C)
|
|
8
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
9
9
|
* http://github.com/fonoster/routr
|
|
10
10
|
*
|
|
11
11
|
* This file is part of Routr
|
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.VERIFIER_PROTO = void 0;
|
|
27
27
|
/*
|
|
28
|
-
* Copyright (C)
|
|
28
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
29
29
|
* http://github.com/fonoster/routr
|
|
30
30
|
*
|
|
31
31
|
* This file is part of Routr
|
package/dist/verifier/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/*
|
|
18
|
-
* Copyright (C)
|
|
18
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
19
19
|
* http://github.com/fonoster/routr
|
|
20
20
|
*
|
|
21
21
|
* This file is part of Routr.
|
package/dist/verifier/types.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.verifier = void 0;
|
|
27
27
|
/*
|
|
28
|
-
* Copyright (C)
|
|
28
|
+
* Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
|
|
29
29
|
* http://github.com/fonoster/routr
|
|
30
30
|
*
|
|
31
31
|
* This file is part of Routr
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routr/common",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.2",
|
|
4
4
|
"description": "Common package",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/routr#readme",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/js-yaml": "^4.0.5"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "01dfded02d52434ae789257b069b3bba1949878f"
|
|
59
59
|
}
|