@routr/common 2.0.5-alpha.2 → 2.0.5-alpha.20
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.d.ts +6 -0
- package/dist/assertions.js +37 -0
- package/dist/auth.d.ts +15 -0
- package/dist/auth.js +37 -0
- package/dist/connect/data_api.d.ts +11 -0
- package/dist/connect/data_api.js +79 -0
- package/dist/connect/grpc_client.d.ts +1 -0
- package/dist/connect/grpc_client.js +56 -0
- package/dist/connect/index.d.ts +3 -0
- package/dist/connect/index.js +37 -0
- package/dist/connect/types.d.ts +36 -0
- package/dist/connect/types.js +39 -0
- package/dist/errors.d.ts +21 -0
- package/dist/errors.js +55 -24
- package/dist/helper.d.ts +7 -0
- package/dist/helper.js +42 -0
- package/dist/index.d.ts +13 -3
- package/dist/index.js +25 -5
- package/dist/ip_utils.d.ts +4 -0
- package/dist/ip_utils.js +43 -0
- package/dist/protos/common.proto +20 -2
- package/dist/protos/location.proto +25 -10
- package/dist/protos/processor.proto +49 -6
- package/dist/protos/requester.proto +47 -0
- package/dist/protos/resources.proto +107 -0
- package/dist/protos/sipmessage.proto +81 -8
- package/dist/redis.d.ts +8 -0
- package/dist/redis.js +10 -0
- package/dist/requester/grpc_client.d.ts +1 -0
- package/dist/requester/grpc_client.js +56 -0
- package/dist/requester/index.d.ts +1 -0
- package/dist/requester/index.js +35 -0
- package/dist/service.d.ts +13 -2
- package/dist/service.js +57 -19
- package/dist/tracer.d.ts +7 -0
- package/dist/tracer.js +53 -0
- package/dist/types.d.ts +254 -10
- package/dist/types.js +85 -0
- package/package.json +14 -5
package/dist/service.js
CHANGED
|
@@ -1,47 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
26
|
exports.getObjectProto = exports.LOCATION_OBJECT_PROTO = exports.PROCESSOR_OBJECT_PROTO = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
27
|
+
const errors_1 = require("./errors");
|
|
28
|
+
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
29
|
+
const protoLoader = __importStar(require("@grpc/proto-loader"));
|
|
30
|
+
const logger_1 = require("@fonoster/logger");
|
|
31
|
+
const logger = (0, logger_1.getLogger)({ service: "common", filePath: __filename });
|
|
32
|
+
const loadOptions = {
|
|
33
|
+
keepCase: false,
|
|
13
34
|
longs: String,
|
|
14
35
|
enums: String,
|
|
15
36
|
defaults: true,
|
|
16
37
|
oneofs: true
|
|
17
38
|
};
|
|
39
|
+
// TODO: Get version from the proto or package
|
|
40
|
+
const API_VERSION = "v2draft1";
|
|
18
41
|
// We currenly don't have a way to obtain the proto type
|
|
19
42
|
exports.PROCESSOR_OBJECT_PROTO = getObjectProto({
|
|
20
43
|
name: "processor",
|
|
21
|
-
version:
|
|
22
|
-
path: __dirname +
|
|
44
|
+
version: API_VERSION,
|
|
45
|
+
path: __dirname + "/protos/processor.proto"
|
|
23
46
|
});
|
|
24
47
|
exports.LOCATION_OBJECT_PROTO = getObjectProto({
|
|
25
48
|
name: "location",
|
|
26
|
-
version:
|
|
27
|
-
path: __dirname +
|
|
49
|
+
version: API_VERSION,
|
|
50
|
+
path: __dirname + "/protos/location.proto"
|
|
28
51
|
});
|
|
52
|
+
/**
|
|
53
|
+
* Gets the proto definition for the given object.
|
|
54
|
+
*
|
|
55
|
+
* @param {ObjectProt} objectProto - The object proto to load.
|
|
56
|
+
* @return {A} The proto definition.
|
|
57
|
+
*/
|
|
29
58
|
function getObjectProto(objectProto) {
|
|
30
59
|
var _a, _b;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
60
|
+
const definitions = protoLoader.loadSync(objectProto.path, loadOptions);
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
|
+
const objProto = (_b = (_a = grpc.loadPackageDefinition(definitions)) === null || _a === void 0 ? void 0 : _a.fonoster) === null || _b === void 0 ? void 0 : _b.routr[objectProto.name];
|
|
63
|
+
return (objProto === null || objProto === void 0 ? void 0 : objProto[objectProto.version])
|
|
34
64
|
? objProto[objectProto.version]
|
|
35
65
|
: new errors_1.ServiceDefinitionNotFound(objectProto.name, objectProto.version);
|
|
36
66
|
}
|
|
37
67
|
exports.getObjectProto = getObjectProto;
|
|
68
|
+
/**
|
|
69
|
+
* Creates a new service using the given service definition.
|
|
70
|
+
*
|
|
71
|
+
* @param {ServiceInfo} serviceInfo - The service info to create the service from.
|
|
72
|
+
*/
|
|
38
73
|
function createService(serviceInfo) {
|
|
39
|
-
|
|
40
|
-
|
|
74
|
+
const cb = () => {
|
|
75
|
+
logger.info("starting routr service", {
|
|
76
|
+
name: serviceInfo.name,
|
|
77
|
+
bindAddr: serviceInfo.bindAddr
|
|
78
|
+
});
|
|
41
79
|
server.start();
|
|
42
80
|
};
|
|
43
|
-
|
|
44
|
-
|
|
81
|
+
const credentials = grpc.ServerCredentials.createInsecure();
|
|
82
|
+
const server = new grpc.Server();
|
|
45
83
|
server.addService(serviceInfo.service, serviceInfo.handlers);
|
|
46
84
|
server.bindAsync(serviceInfo.bindAddr, credentials, cb);
|
|
47
85
|
}
|
package/dist/tracer.d.ts
ADDED
package/dist/tracer.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.init = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* Copyright (C) 2022 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 api_1 = __importDefault(require("@opentelemetry/api"));
|
|
26
|
+
const instrumentation_1 = require("@opentelemetry/instrumentation");
|
|
27
|
+
const sdk_trace_node_1 = require("@opentelemetry/sdk-trace-node");
|
|
28
|
+
const resources_1 = require("@opentelemetry/resources");
|
|
29
|
+
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
30
|
+
const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
|
|
31
|
+
const exporter_jaeger_1 = require("@opentelemetry/exporter-jaeger");
|
|
32
|
+
const instrumentation_grpc_1 = require("@opentelemetry/instrumentation-grpc");
|
|
33
|
+
/**
|
|
34
|
+
* This function registers the instrumentations for the service.
|
|
35
|
+
*
|
|
36
|
+
* @param {string} serviceName - The name of the service.
|
|
37
|
+
* @return {Tracer} The tracer object.
|
|
38
|
+
*/
|
|
39
|
+
function init(serviceName) {
|
|
40
|
+
const provider = new sdk_trace_node_1.NodeTracerProvider({
|
|
41
|
+
resource: new resources_1.Resource({
|
|
42
|
+
[semantic_conventions_1.SemanticResourceAttributes.SERVICE_NAME]: serviceName
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
const exporter = new exporter_jaeger_1.JaegerExporter();
|
|
46
|
+
provider.addSpanProcessor(new sdk_trace_base_1.SimpleSpanProcessor(exporter));
|
|
47
|
+
provider.register();
|
|
48
|
+
(0, instrumentation_1.registerInstrumentations)({
|
|
49
|
+
instrumentations: [new instrumentation_grpc_1.GrpcInstrumentation()]
|
|
50
|
+
});
|
|
51
|
+
return api_1.default.trace.getTracer("routr-tracer");
|
|
52
|
+
}
|
|
53
|
+
exports.init = init;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
export declare
|
|
3
|
-
|
|
1
|
+
import { ServiceDefinition } from "@grpc/proto-loader";
|
|
2
|
+
export declare enum Method {
|
|
3
|
+
UNKNOWN = "UNKNOWN",
|
|
4
|
+
REGISTER = "REGISTER",
|
|
5
|
+
INVITE = "INVITE",
|
|
6
|
+
MESSAGE = "MESSAGE",
|
|
7
|
+
PUBLISH = "PUBLISH",
|
|
8
|
+
NOTIFY = "NOTIFY",
|
|
9
|
+
SUBSCRIBE = "SUBSCRIBE",
|
|
10
|
+
ACK = "ACK",
|
|
11
|
+
BYE = "BYE",
|
|
12
|
+
CANCEL = "CANCEL",
|
|
13
|
+
OPTIONS = "OPTIONS"
|
|
14
|
+
}
|
|
15
|
+
export declare enum Transport {
|
|
16
|
+
TCP = "TCP",
|
|
17
|
+
UDP = "UDP",
|
|
18
|
+
TLS = "TLS",
|
|
19
|
+
SCTP = "SCTP",
|
|
20
|
+
WS = "WS",
|
|
21
|
+
WSS = "WSS"
|
|
22
|
+
}
|
|
4
23
|
export interface NetInterface {
|
|
5
24
|
host: string;
|
|
6
25
|
port: number;
|
|
@@ -8,27 +27,252 @@ export interface NetInterface {
|
|
|
8
27
|
}
|
|
9
28
|
export interface MessageRequest {
|
|
10
29
|
ref: string;
|
|
11
|
-
|
|
30
|
+
edgePortRef: string;
|
|
12
31
|
method: Method;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
32
|
+
sender: NetInterface;
|
|
33
|
+
listeningPoint: NetInterface;
|
|
34
|
+
externalIps: string[];
|
|
35
|
+
localnets: string[];
|
|
36
|
+
message: SIPMessage;
|
|
37
|
+
}
|
|
38
|
+
export interface MessageResponse {
|
|
39
|
+
message: Record<string, unknown>;
|
|
16
40
|
}
|
|
17
41
|
export interface ProcessorConfig {
|
|
18
42
|
ref: string;
|
|
19
43
|
addr: string;
|
|
20
44
|
methods: Array<Method>;
|
|
21
|
-
isFallback?: boolean;
|
|
22
45
|
matchFunc?: (request: MessageRequest) => boolean;
|
|
23
46
|
}
|
|
47
|
+
export interface MiddlewareConfig {
|
|
48
|
+
ref: string;
|
|
49
|
+
addr: string;
|
|
50
|
+
}
|
|
24
51
|
export interface ServiceInfo {
|
|
25
52
|
name: string;
|
|
26
53
|
bindAddr: string;
|
|
27
|
-
service:
|
|
28
|
-
handlers: Record<string, (call: unknown, callback:
|
|
54
|
+
service: ServiceDefinition;
|
|
55
|
+
handlers: Record<string, (call: unknown, callback: (error: Error, result: unknown) => void) => unknown>;
|
|
29
56
|
}
|
|
30
57
|
export interface ObjectProto {
|
|
31
58
|
name: string;
|
|
32
59
|
path: string;
|
|
33
60
|
version: string;
|
|
34
61
|
}
|
|
62
|
+
export interface AuthChallengeRequest {
|
|
63
|
+
realm: string;
|
|
64
|
+
domain: string;
|
|
65
|
+
scheme: string;
|
|
66
|
+
nonce: string;
|
|
67
|
+
algorithm: string;
|
|
68
|
+
qop: string;
|
|
69
|
+
opaque: string;
|
|
70
|
+
stale: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface AuthChallengeResponse {
|
|
73
|
+
realm: string;
|
|
74
|
+
domain: string;
|
|
75
|
+
scheme: string;
|
|
76
|
+
cNonce: string;
|
|
77
|
+
nonceCount: number;
|
|
78
|
+
response: string;
|
|
79
|
+
username: string;
|
|
80
|
+
nonce: string;
|
|
81
|
+
algorithm: string;
|
|
82
|
+
qop: string;
|
|
83
|
+
opaque: string;
|
|
84
|
+
stale: boolean;
|
|
85
|
+
uri: string;
|
|
86
|
+
method: string;
|
|
87
|
+
}
|
|
88
|
+
export interface HeaderModifier {
|
|
89
|
+
name: string;
|
|
90
|
+
value?: string;
|
|
91
|
+
action: "add" | "remove";
|
|
92
|
+
}
|
|
93
|
+
export interface Route {
|
|
94
|
+
user: string;
|
|
95
|
+
host: string;
|
|
96
|
+
port: number;
|
|
97
|
+
transport: Transport;
|
|
98
|
+
registeredOn?: number;
|
|
99
|
+
sessionCount?: number;
|
|
100
|
+
expires?: number;
|
|
101
|
+
edgePortRef: string;
|
|
102
|
+
listeningPoint: NetInterface;
|
|
103
|
+
labels?: Map<string, string>;
|
|
104
|
+
headers?: HeaderModifier[];
|
|
105
|
+
}
|
|
106
|
+
export declare enum ResponseType {
|
|
107
|
+
UNKNOWN = 0,
|
|
108
|
+
TRYING = 1,
|
|
109
|
+
RINGING = 2,
|
|
110
|
+
CALL_IS_BEING_FORWARDED = 3,
|
|
111
|
+
QUEUED = 4,
|
|
112
|
+
SESSION_PROGRESS = 5,
|
|
113
|
+
SUCCESS = 6,
|
|
114
|
+
OK = 7,
|
|
115
|
+
ACCEPTED = 8,
|
|
116
|
+
REDIRECTION = 9,
|
|
117
|
+
MULTIPLE_CHOICES = 10,
|
|
118
|
+
MOVED_PERMANENTLY = 11,
|
|
119
|
+
MOVED_TEMPORARILY = 12,
|
|
120
|
+
USE_PROXY = 13,
|
|
121
|
+
ALTERNATIVE_SERVICE = 14,
|
|
122
|
+
CLIENT_ERROR = 15,
|
|
123
|
+
BAD_REQUEST = 16,
|
|
124
|
+
UNAUTHORIZED = 17,
|
|
125
|
+
PAYMENT_REQUIRED = 18,
|
|
126
|
+
FORBIDDEN = 19,
|
|
127
|
+
NOT_FOUND = 20,
|
|
128
|
+
METHOD_NOT_ALLOWED = 21,
|
|
129
|
+
NOT_ACCEPTABLE = 22,
|
|
130
|
+
PROXY_AUTHENTICATION_REQUIRED = 23,
|
|
131
|
+
REQUEST_TIMEOUT = 24,
|
|
132
|
+
GONE = 25,
|
|
133
|
+
REQUEST_ENTITY_TOO_LARGE = 26,
|
|
134
|
+
REQUEST_URI_TOO_LONG = 27,
|
|
135
|
+
UNSUPPORTED_MEDIA_TYPE = 28,
|
|
136
|
+
UNSUPPORTED_URI_SCHEME = 29,
|
|
137
|
+
BAD_EXTENSION = 30,
|
|
138
|
+
EXTENSION_REQUIRED = 31,
|
|
139
|
+
INTERVAL_TOO_BRIEF = 32,
|
|
140
|
+
TEMPORARILY_UNAVAILABLE = 33,
|
|
141
|
+
CALL_OR_TRANSACTION_DOES_NOT_EXIST = 34,
|
|
142
|
+
LOOP_DETECTED = 35,
|
|
143
|
+
TOO_MANY_HOPS = 36,
|
|
144
|
+
ADDRESS_INCOMPLETE = 37,
|
|
145
|
+
AMBIGUOUS = 38,
|
|
146
|
+
BUSY_HERE = 39,
|
|
147
|
+
REQUEST_TERMINATED = 40,
|
|
148
|
+
NOT_ACCEPTABLE_HERE = 41,
|
|
149
|
+
BAD_EVENT = 42,
|
|
150
|
+
REQUEST_PENDING = 43,
|
|
151
|
+
UNDECIPHERABLE = 44,
|
|
152
|
+
SERVER_ERROR = 45,
|
|
153
|
+
SERVER_INTERNAL_ERROR = 46,
|
|
154
|
+
NOT_IMPLEMENTED = 47,
|
|
155
|
+
BAD_GATEWAY = 48,
|
|
156
|
+
SERVICE_UNAVAILABLE = 49,
|
|
157
|
+
SERVER_TIMEOUT = 50,
|
|
158
|
+
VERSION_NOT_SUPPORTED = 51,
|
|
159
|
+
MESSAGE_TOO_LARGE = 52,
|
|
160
|
+
GLOBAL_ERROR = 53,
|
|
161
|
+
BUSY_EVERYWHERE = 54,
|
|
162
|
+
DECLINE = 55,
|
|
163
|
+
DOES_NOT_EXIST_ANYWHERE = 56,
|
|
164
|
+
SESSION_NOT_ACCEPTABLE = 57
|
|
165
|
+
}
|
|
166
|
+
export interface WWWAuthenticate {
|
|
167
|
+
realm: string;
|
|
168
|
+
domain: string;
|
|
169
|
+
nonce: string;
|
|
170
|
+
scheme: string;
|
|
171
|
+
algorithm: string;
|
|
172
|
+
qop: string;
|
|
173
|
+
opaque: string;
|
|
174
|
+
stale: boolean;
|
|
175
|
+
}
|
|
176
|
+
export interface Authorization {
|
|
177
|
+
realm: string;
|
|
178
|
+
scheme: string;
|
|
179
|
+
nonce: string;
|
|
180
|
+
cNonce: string;
|
|
181
|
+
nonceCount: number;
|
|
182
|
+
response: string;
|
|
183
|
+
username: string;
|
|
184
|
+
uri: string;
|
|
185
|
+
algorithm: string;
|
|
186
|
+
qop: string;
|
|
187
|
+
opaque: string;
|
|
188
|
+
method?: string;
|
|
189
|
+
}
|
|
190
|
+
export interface CallID {
|
|
191
|
+
callId: string;
|
|
192
|
+
}
|
|
193
|
+
export interface ContentLength {
|
|
194
|
+
contentLength: number;
|
|
195
|
+
}
|
|
196
|
+
export interface Extension {
|
|
197
|
+
name: string;
|
|
198
|
+
value: string;
|
|
199
|
+
}
|
|
200
|
+
export interface Via {
|
|
201
|
+
host: string;
|
|
202
|
+
port: number;
|
|
203
|
+
branch?: string;
|
|
204
|
+
transport: Transport;
|
|
205
|
+
}
|
|
206
|
+
export interface SipURI {
|
|
207
|
+
user?: string;
|
|
208
|
+
host: string;
|
|
209
|
+
port?: number;
|
|
210
|
+
transportParam: string;
|
|
211
|
+
mAddrParam?: string;
|
|
212
|
+
userParam?: string;
|
|
213
|
+
ttlParam?: number;
|
|
214
|
+
lrParam?: boolean;
|
|
215
|
+
methodParam?: string;
|
|
216
|
+
secure?: boolean;
|
|
217
|
+
userPassword?: string;
|
|
218
|
+
}
|
|
219
|
+
export interface Address {
|
|
220
|
+
uri: SipURI;
|
|
221
|
+
displayName?: string;
|
|
222
|
+
wildcard?: boolean;
|
|
223
|
+
}
|
|
224
|
+
export interface MaxForwards {
|
|
225
|
+
maxForwards: number;
|
|
226
|
+
}
|
|
227
|
+
export interface RouteHeader {
|
|
228
|
+
address: Address;
|
|
229
|
+
parameters?: Record<string, string>;
|
|
230
|
+
}
|
|
231
|
+
export interface RecordRoute {
|
|
232
|
+
address: Address;
|
|
233
|
+
parameters?: Record<string, string>;
|
|
234
|
+
}
|
|
235
|
+
export interface From {
|
|
236
|
+
address: Address;
|
|
237
|
+
tag: string;
|
|
238
|
+
parameters?: Record<string, string>;
|
|
239
|
+
}
|
|
240
|
+
export interface To {
|
|
241
|
+
address: Address;
|
|
242
|
+
tag?: string;
|
|
243
|
+
parameters?: Record<string, string>;
|
|
244
|
+
}
|
|
245
|
+
export interface Contact {
|
|
246
|
+
address: Address;
|
|
247
|
+
expires: number;
|
|
248
|
+
qValue: number;
|
|
249
|
+
}
|
|
250
|
+
export interface Expires {
|
|
251
|
+
expires: number;
|
|
252
|
+
}
|
|
253
|
+
export interface SIPMessage {
|
|
254
|
+
messageType: "responseType" | "requestUri";
|
|
255
|
+
responseType?: ResponseType;
|
|
256
|
+
requestUri?: SipURI;
|
|
257
|
+
from: From;
|
|
258
|
+
to: To;
|
|
259
|
+
contact?: Contact;
|
|
260
|
+
callId: CallID;
|
|
261
|
+
contentLength: ContentLength;
|
|
262
|
+
expires?: Expires;
|
|
263
|
+
wwwAuthenticate?: WWWAuthenticate;
|
|
264
|
+
maxForwards: MaxForwards;
|
|
265
|
+
authorization?: Authorization;
|
|
266
|
+
extensions?: Extension[];
|
|
267
|
+
via?: Via[];
|
|
268
|
+
route?: RouteHeader[];
|
|
269
|
+
recordRoute?: RecordRoute[];
|
|
270
|
+
}
|
|
271
|
+
export interface GrpcCallback {
|
|
272
|
+
(error: Error | {
|
|
273
|
+
code: number;
|
|
274
|
+
} | null, response?: unknown): void;
|
|
275
|
+
}
|
|
276
|
+
export interface GrpcCall {
|
|
277
|
+
request: Record<string, any>;
|
|
278
|
+
}
|
package/dist/types.js
CHANGED
|
@@ -1,2 +1,87 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResponseType = exports.Transport = exports.Method = void 0;
|
|
4
|
+
var Method;
|
|
5
|
+
(function (Method) {
|
|
6
|
+
Method["UNKNOWN"] = "UNKNOWN";
|
|
7
|
+
Method["REGISTER"] = "REGISTER";
|
|
8
|
+
Method["INVITE"] = "INVITE";
|
|
9
|
+
Method["MESSAGE"] = "MESSAGE";
|
|
10
|
+
Method["PUBLISH"] = "PUBLISH";
|
|
11
|
+
Method["NOTIFY"] = "NOTIFY";
|
|
12
|
+
Method["SUBSCRIBE"] = "SUBSCRIBE";
|
|
13
|
+
Method["ACK"] = "ACK";
|
|
14
|
+
Method["BYE"] = "BYE";
|
|
15
|
+
Method["CANCEL"] = "CANCEL";
|
|
16
|
+
Method["OPTIONS"] = "OPTIONS";
|
|
17
|
+
})(Method = exports.Method || (exports.Method = {}));
|
|
18
|
+
var Transport;
|
|
19
|
+
(function (Transport) {
|
|
20
|
+
Transport["TCP"] = "TCP";
|
|
21
|
+
Transport["UDP"] = "UDP";
|
|
22
|
+
Transport["TLS"] = "TLS";
|
|
23
|
+
Transport["SCTP"] = "SCTP";
|
|
24
|
+
Transport["WS"] = "WS";
|
|
25
|
+
Transport["WSS"] = "WSS";
|
|
26
|
+
})(Transport = exports.Transport || (exports.Transport = {}));
|
|
27
|
+
var ResponseType;
|
|
28
|
+
(function (ResponseType) {
|
|
29
|
+
ResponseType[ResponseType["UNKNOWN"] = 0] = "UNKNOWN";
|
|
30
|
+
ResponseType[ResponseType["TRYING"] = 1] = "TRYING";
|
|
31
|
+
ResponseType[ResponseType["RINGING"] = 2] = "RINGING";
|
|
32
|
+
ResponseType[ResponseType["CALL_IS_BEING_FORWARDED"] = 3] = "CALL_IS_BEING_FORWARDED";
|
|
33
|
+
ResponseType[ResponseType["QUEUED"] = 4] = "QUEUED";
|
|
34
|
+
ResponseType[ResponseType["SESSION_PROGRESS"] = 5] = "SESSION_PROGRESS";
|
|
35
|
+
ResponseType[ResponseType["SUCCESS"] = 6] = "SUCCESS";
|
|
36
|
+
ResponseType[ResponseType["OK"] = 7] = "OK";
|
|
37
|
+
ResponseType[ResponseType["ACCEPTED"] = 8] = "ACCEPTED";
|
|
38
|
+
ResponseType[ResponseType["REDIRECTION"] = 9] = "REDIRECTION";
|
|
39
|
+
ResponseType[ResponseType["MULTIPLE_CHOICES"] = 10] = "MULTIPLE_CHOICES";
|
|
40
|
+
ResponseType[ResponseType["MOVED_PERMANENTLY"] = 11] = "MOVED_PERMANENTLY";
|
|
41
|
+
ResponseType[ResponseType["MOVED_TEMPORARILY"] = 12] = "MOVED_TEMPORARILY";
|
|
42
|
+
ResponseType[ResponseType["USE_PROXY"] = 13] = "USE_PROXY";
|
|
43
|
+
ResponseType[ResponseType["ALTERNATIVE_SERVICE"] = 14] = "ALTERNATIVE_SERVICE";
|
|
44
|
+
ResponseType[ResponseType["CLIENT_ERROR"] = 15] = "CLIENT_ERROR";
|
|
45
|
+
ResponseType[ResponseType["BAD_REQUEST"] = 16] = "BAD_REQUEST";
|
|
46
|
+
ResponseType[ResponseType["UNAUTHORIZED"] = 17] = "UNAUTHORIZED";
|
|
47
|
+
ResponseType[ResponseType["PAYMENT_REQUIRED"] = 18] = "PAYMENT_REQUIRED";
|
|
48
|
+
ResponseType[ResponseType["FORBIDDEN"] = 19] = "FORBIDDEN";
|
|
49
|
+
ResponseType[ResponseType["NOT_FOUND"] = 20] = "NOT_FOUND";
|
|
50
|
+
ResponseType[ResponseType["METHOD_NOT_ALLOWED"] = 21] = "METHOD_NOT_ALLOWED";
|
|
51
|
+
ResponseType[ResponseType["NOT_ACCEPTABLE"] = 22] = "NOT_ACCEPTABLE";
|
|
52
|
+
ResponseType[ResponseType["PROXY_AUTHENTICATION_REQUIRED"] = 23] = "PROXY_AUTHENTICATION_REQUIRED";
|
|
53
|
+
ResponseType[ResponseType["REQUEST_TIMEOUT"] = 24] = "REQUEST_TIMEOUT";
|
|
54
|
+
ResponseType[ResponseType["GONE"] = 25] = "GONE";
|
|
55
|
+
ResponseType[ResponseType["REQUEST_ENTITY_TOO_LARGE"] = 26] = "REQUEST_ENTITY_TOO_LARGE";
|
|
56
|
+
ResponseType[ResponseType["REQUEST_URI_TOO_LONG"] = 27] = "REQUEST_URI_TOO_LONG";
|
|
57
|
+
ResponseType[ResponseType["UNSUPPORTED_MEDIA_TYPE"] = 28] = "UNSUPPORTED_MEDIA_TYPE";
|
|
58
|
+
ResponseType[ResponseType["UNSUPPORTED_URI_SCHEME"] = 29] = "UNSUPPORTED_URI_SCHEME";
|
|
59
|
+
ResponseType[ResponseType["BAD_EXTENSION"] = 30] = "BAD_EXTENSION";
|
|
60
|
+
ResponseType[ResponseType["EXTENSION_REQUIRED"] = 31] = "EXTENSION_REQUIRED";
|
|
61
|
+
ResponseType[ResponseType["INTERVAL_TOO_BRIEF"] = 32] = "INTERVAL_TOO_BRIEF";
|
|
62
|
+
ResponseType[ResponseType["TEMPORARILY_UNAVAILABLE"] = 33] = "TEMPORARILY_UNAVAILABLE";
|
|
63
|
+
ResponseType[ResponseType["CALL_OR_TRANSACTION_DOES_NOT_EXIST"] = 34] = "CALL_OR_TRANSACTION_DOES_NOT_EXIST";
|
|
64
|
+
ResponseType[ResponseType["LOOP_DETECTED"] = 35] = "LOOP_DETECTED";
|
|
65
|
+
ResponseType[ResponseType["TOO_MANY_HOPS"] = 36] = "TOO_MANY_HOPS";
|
|
66
|
+
ResponseType[ResponseType["ADDRESS_INCOMPLETE"] = 37] = "ADDRESS_INCOMPLETE";
|
|
67
|
+
ResponseType[ResponseType["AMBIGUOUS"] = 38] = "AMBIGUOUS";
|
|
68
|
+
ResponseType[ResponseType["BUSY_HERE"] = 39] = "BUSY_HERE";
|
|
69
|
+
ResponseType[ResponseType["REQUEST_TERMINATED"] = 40] = "REQUEST_TERMINATED";
|
|
70
|
+
ResponseType[ResponseType["NOT_ACCEPTABLE_HERE"] = 41] = "NOT_ACCEPTABLE_HERE";
|
|
71
|
+
ResponseType[ResponseType["BAD_EVENT"] = 42] = "BAD_EVENT";
|
|
72
|
+
ResponseType[ResponseType["REQUEST_PENDING"] = 43] = "REQUEST_PENDING";
|
|
73
|
+
ResponseType[ResponseType["UNDECIPHERABLE"] = 44] = "UNDECIPHERABLE";
|
|
74
|
+
ResponseType[ResponseType["SERVER_ERROR"] = 45] = "SERVER_ERROR";
|
|
75
|
+
ResponseType[ResponseType["SERVER_INTERNAL_ERROR"] = 46] = "SERVER_INTERNAL_ERROR";
|
|
76
|
+
ResponseType[ResponseType["NOT_IMPLEMENTED"] = 47] = "NOT_IMPLEMENTED";
|
|
77
|
+
ResponseType[ResponseType["BAD_GATEWAY"] = 48] = "BAD_GATEWAY";
|
|
78
|
+
ResponseType[ResponseType["SERVICE_UNAVAILABLE"] = 49] = "SERVICE_UNAVAILABLE";
|
|
79
|
+
ResponseType[ResponseType["SERVER_TIMEOUT"] = 50] = "SERVER_TIMEOUT";
|
|
80
|
+
ResponseType[ResponseType["VERSION_NOT_SUPPORTED"] = 51] = "VERSION_NOT_SUPPORTED";
|
|
81
|
+
ResponseType[ResponseType["MESSAGE_TOO_LARGE"] = 52] = "MESSAGE_TOO_LARGE";
|
|
82
|
+
ResponseType[ResponseType["GLOBAL_ERROR"] = 53] = "GLOBAL_ERROR";
|
|
83
|
+
ResponseType[ResponseType["BUSY_EVERYWHERE"] = 54] = "BUSY_EVERYWHERE";
|
|
84
|
+
ResponseType[ResponseType["DECLINE"] = 55] = "DECLINE";
|
|
85
|
+
ResponseType[ResponseType["DOES_NOT_EXIST_ANYWHERE"] = 56] = "DOES_NOT_EXIST_ANYWHERE";
|
|
86
|
+
ResponseType[ResponseType["SESSION_NOT_ACCEPTABLE"] = 57] = "SESSION_NOT_ACCEPTABLE";
|
|
87
|
+
})(ResponseType = exports.ResponseType || (exports.ResponseType = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routr/common",
|
|
3
|
-
"version": "2.0.5-alpha.
|
|
3
|
+
"version": "2.0.5-alpha.20",
|
|
4
4
|
"description": "Common package",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/routr#readme",
|
|
@@ -13,10 +13,19 @@
|
|
|
13
13
|
"postbuild": "mkdir -p dist/protos && cp src/protos/* dist/protos"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@fonoster/logger": "
|
|
17
|
-
"@grpc/grpc-js": "^1.5.
|
|
16
|
+
"@fonoster/logger": "0.3.17-alpha.2",
|
|
17
|
+
"@grpc/grpc-js": "^1.5.9",
|
|
18
18
|
"@grpc/proto-loader": "^0.6.9",
|
|
19
|
-
"
|
|
19
|
+
"@opentelemetry/api": "^1.0.4",
|
|
20
|
+
"@opentelemetry/exporter-jaeger": "^1.0.4",
|
|
21
|
+
"@opentelemetry/instrumentation": "^0.27.0",
|
|
22
|
+
"@opentelemetry/instrumentation-grpc": "^0.27.0",
|
|
23
|
+
"@opentelemetry/resources": "^1.0.4",
|
|
24
|
+
"@opentelemetry/sdk-trace-base": "^1.0.4",
|
|
25
|
+
"@opentelemetry/sdk-trace-node": "^1.0.4",
|
|
26
|
+
"@opentelemetry/semantic-conventions": "^1.0.4",
|
|
27
|
+
"fp-ts": "^2.11.8",
|
|
28
|
+
"ip-utils": "^2.4.0"
|
|
20
29
|
},
|
|
21
30
|
"directories": {
|
|
22
31
|
"src": "src",
|
|
@@ -35,5 +44,5 @@
|
|
|
35
44
|
"bugs": {
|
|
36
45
|
"url": "https://github.com/fonoster/routr/issues"
|
|
37
46
|
},
|
|
38
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "be3a515d8c24aaae86ef076b65880c2e89415dcb"
|
|
39
48
|
}
|