@routr/common 2.0.5-alpha.2 → 2.0.5-alpha.21
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/ip_utils.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isLocalnet = exports.addressCount = exports.hasIp = exports.formatNet = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (C) 2022 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 ip_utils_1 = require("ip-utils");
|
|
23
|
+
const formatNet = (net) => {
|
|
24
|
+
if (net.split("/").length === 1) {
|
|
25
|
+
if ((0, ip_utils_1.isValidIpv4)(net))
|
|
26
|
+
return `${net}/32`;
|
|
27
|
+
if ((0, ip_utils_1.isValidIpv6)(net))
|
|
28
|
+
return `${net}/128`;
|
|
29
|
+
throw new Error("Invalid address! Must be a valid Ipv4 or Ipv6");
|
|
30
|
+
}
|
|
31
|
+
const p1 = net.split("/")[0];
|
|
32
|
+
const p2 = net.split("/")[1];
|
|
33
|
+
return (0, ip_utils_1.isValidIpv4)(p2)
|
|
34
|
+
? `${p1}/${(0, ip_utils_1.subnetInfo)(p1, p2).cidrMask}`
|
|
35
|
+
: `${p1}/${p2}`;
|
|
36
|
+
};
|
|
37
|
+
exports.formatNet = formatNet;
|
|
38
|
+
const hasIp = (net, addr) => (0, ip_utils_1.subnet)((0, exports.formatNet)(net)).contains(addr);
|
|
39
|
+
exports.hasIp = hasIp;
|
|
40
|
+
const addressCount = (net) => (0, ip_utils_1.cidrInfo)((0, exports.formatNet)(net)).inclusiveNumberHosts;
|
|
41
|
+
exports.addressCount = addressCount;
|
|
42
|
+
const isLocalnet = (nets, addr) => nets && nets.length > 0 && nets.filter((net) => (0, exports.hasIp)(net, addr)).length > 0;
|
|
43
|
+
exports.isLocalnet = isLocalnet;
|
package/dist/protos/common.proto
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/routr
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Routr
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
1
19
|
syntax = "proto3";
|
|
2
20
|
|
|
3
21
|
package fonoster.routr.common.v2draft1;
|
|
@@ -8,8 +26,8 @@ option java_outer_classname = "CommonProto";
|
|
|
8
26
|
option objc_class_prefix = "CM";
|
|
9
27
|
|
|
10
28
|
enum Transport {
|
|
11
|
-
|
|
12
|
-
|
|
29
|
+
UDP = 0;
|
|
30
|
+
TCP = 1;
|
|
13
31
|
TLS = 2;
|
|
14
32
|
SCTP = 3;
|
|
15
33
|
WS = 4;
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/routr
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Routr
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
1
19
|
syntax = "proto3";
|
|
2
20
|
|
|
3
21
|
package fonoster.routr.location.v2draft1;
|
|
@@ -8,6 +26,7 @@ option java_outer_classname = "LocationProto";
|
|
|
8
26
|
option objc_class_prefix = "LC";
|
|
9
27
|
|
|
10
28
|
import "common.proto";
|
|
29
|
+
import "processor.proto";
|
|
11
30
|
|
|
12
31
|
service Location {
|
|
13
32
|
rpc AddRoute (AddRouteRequest) returns (fonoster.routr.common.v2draft1.Empty) {}
|
|
@@ -21,19 +40,15 @@ message Route {
|
|
|
21
40
|
string host = 2;
|
|
22
41
|
string port = 3;
|
|
23
42
|
fonoster.routr.common.v2draft1.Transport transport = 4;
|
|
24
|
-
|
|
43
|
+
int64 registered_on = 5;
|
|
25
44
|
int32 expires = 6;
|
|
26
45
|
int32 session_count = 7;
|
|
27
46
|
string edge_port_ref = 8;
|
|
28
|
-
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
// feature. For example, we could use the label `backend=voice` to indicate that this
|
|
34
|
-
// route can serve voice applications. If the FindRoutes method includes the label the
|
|
35
|
-
// Location Service will only return routes that includes such label.
|
|
36
|
-
map<string, string> labels = 9;
|
|
47
|
+
fonoster.routr.processor.v2draft1.NetInterface listening_point = 9;
|
|
48
|
+
// During route creation, an endpoint can request to add labels than can later be
|
|
49
|
+
// used as selectors. For example, a Softphone can add a label `priority=1` to indicate
|
|
50
|
+
// that it is the prefered endpoint for the given AOR.
|
|
51
|
+
map<string, string> labels = 10;
|
|
37
52
|
}
|
|
38
53
|
|
|
39
54
|
message AddRouteRequest {
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/routr
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Routr
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
1
19
|
syntax = "proto3";
|
|
2
20
|
|
|
3
21
|
package fonoster.routr.processor.v2draft1;
|
|
@@ -18,12 +36,34 @@ service Processor {
|
|
|
18
36
|
|
|
19
37
|
enum Method {
|
|
20
38
|
UNKNOWN = 0;
|
|
39
|
+
// Communicates user location (host name, IP)
|
|
21
40
|
REGISTER = 1;
|
|
41
|
+
// Establishes a session
|
|
22
42
|
INVITE = 2;
|
|
43
|
+
// Transports Instant Messages
|
|
23
44
|
MESSAGE = 3;
|
|
45
|
+
// Publishes an event to the Server
|
|
24
46
|
PUBLISH = 4;
|
|
47
|
+
// Notifies the subscriber of a new event
|
|
25
48
|
NOTIFY = 5;
|
|
49
|
+
// Subscribes for Notification from the notifier
|
|
26
50
|
SUBSCRIBE = 6;
|
|
51
|
+
// Confirms an INVITE request
|
|
52
|
+
ACK = 7;
|
|
53
|
+
// Terminates a session
|
|
54
|
+
BYE = 8;
|
|
55
|
+
// Cancels establishing of a session
|
|
56
|
+
CANCEL = 9;
|
|
57
|
+
// Communicates information about the capabilities of the calling and receiving SIP phones
|
|
58
|
+
OPTIONS = 10;
|
|
59
|
+
// Provisional Acknowledgement
|
|
60
|
+
PRACK = 11;
|
|
61
|
+
// Sends mid session information
|
|
62
|
+
INFO = 12;
|
|
63
|
+
// Asks the recipient to issue call transfer
|
|
64
|
+
REFER = 13;
|
|
65
|
+
// Modifies the state of a session
|
|
66
|
+
UPDATE = 14;
|
|
27
67
|
}
|
|
28
68
|
|
|
29
69
|
message NetInterface {
|
|
@@ -33,13 +73,16 @@ message NetInterface {
|
|
|
33
73
|
}
|
|
34
74
|
|
|
35
75
|
message MessageRequest {
|
|
76
|
+
// Same as the Call-Id header
|
|
36
77
|
string ref = 1;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
78
|
+
string edge_port_ref = 2;
|
|
79
|
+
Method method = 3;
|
|
80
|
+
NetInterface sender = 4;
|
|
81
|
+
NetInterface listening_point = 5;
|
|
82
|
+
repeated string external_ips = 6;
|
|
83
|
+
repeated string localnets = 7;
|
|
84
|
+
fonoster.routr.sipmessage.v2draft1.SIPMessage message = 8;
|
|
85
|
+
// .google.protobuf.Struct metadata = 8;
|
|
43
86
|
}
|
|
44
87
|
|
|
45
88
|
message MessageResponse {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/routr
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Routr
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
syntax = "proto3";
|
|
20
|
+
|
|
21
|
+
package fonoster.routr.requester.v2draft1;
|
|
22
|
+
|
|
23
|
+
option java_multiple_files = true;
|
|
24
|
+
option java_package = "io.routr.requester";
|
|
25
|
+
option java_outer_classname = "RequesterProto";
|
|
26
|
+
option objc_class_prefix = "RP";
|
|
27
|
+
|
|
28
|
+
import "common.proto";
|
|
29
|
+
import "sipmessage.proto";
|
|
30
|
+
import "processor.proto";
|
|
31
|
+
|
|
32
|
+
// Requester service
|
|
33
|
+
service Requester {
|
|
34
|
+
// Send Message Request
|
|
35
|
+
rpc SendMessage (SendMessageRequest) returns (SendMessageResponse) {}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
message SendMessageRequest {
|
|
39
|
+
string target = 1;
|
|
40
|
+
fonoster.routr.processor.v2draft1.Method method = 2;
|
|
41
|
+
fonoster.routr.common.v2draft1.Transport transport = 3;
|
|
42
|
+
fonoster.routr.sipmessage.v2draft1.SIPMessage message = 4;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
message SendMessageResponse {
|
|
46
|
+
fonoster.routr.sipmessage.v2draft1.SIPMessage message = 1;
|
|
47
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// TODO: Show a link to were this proto was downloaded from
|
|
2
|
+
syntax = "proto3";
|
|
3
|
+
|
|
4
|
+
package fonoster.routr.resources.v2draft1;
|
|
5
|
+
|
|
6
|
+
import "google/protobuf/struct.proto";
|
|
7
|
+
|
|
8
|
+
// Resources service
|
|
9
|
+
service Resources {
|
|
10
|
+
rpc Create (CreateRequest) returns (Resource) {}
|
|
11
|
+
rpc Update (UpdateRequest) returns (Resource) {}
|
|
12
|
+
rpc Get (GetRequest) returns (Resource) {}
|
|
13
|
+
rpc Delete (DeleteRequest) returns (Empty) {}
|
|
14
|
+
rpc List (ListRequest) returns (ListResponse) {}
|
|
15
|
+
rpc FindBy (FindByRequest) returns (FindByResponse) {}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
message Metadata {
|
|
19
|
+
string ref = 1;
|
|
20
|
+
// The resource's name
|
|
21
|
+
string name = 2;
|
|
22
|
+
// Link to dependencies of this resource
|
|
23
|
+
repeated string depends_on = 3;
|
|
24
|
+
// Created at
|
|
25
|
+
int32 create_time = 4;
|
|
26
|
+
// Updated at
|
|
27
|
+
int32 update_time = 5;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
message Resource {
|
|
31
|
+
// The resources's metadata
|
|
32
|
+
|
|
33
|
+
// The resource's metadata
|
|
34
|
+
Metadata metadata = 1;
|
|
35
|
+
// The resource's data
|
|
36
|
+
.google.protobuf.Struct spec = 2;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
message CreateRequest {
|
|
40
|
+
Metadata metadata = 1;
|
|
41
|
+
.google.protobuf.Struct spec = 2;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
message UpdateRequest {
|
|
45
|
+
Metadata metadata = 1;
|
|
46
|
+
.google.protobuf.Struct spec = 2;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
message DeleteRequest {
|
|
50
|
+
string ref = 1;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
message GetRequest {
|
|
54
|
+
string ref = 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
message ListRequest {
|
|
58
|
+
// The maximum number of items in the list
|
|
59
|
+
int32 page_size = 1;
|
|
60
|
+
|
|
61
|
+
// The next_page_token value returned from the previous request, if any
|
|
62
|
+
string page_token = 2;
|
|
63
|
+
|
|
64
|
+
// The filter to apply to the list
|
|
65
|
+
string filter = 3;
|
|
66
|
+
|
|
67
|
+
// The type of resource to list
|
|
68
|
+
string kind = 4;
|
|
69
|
+
|
|
70
|
+
// Level of detail of the individual entities (reserved)
|
|
71
|
+
View view = 5;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
message ListResponse {
|
|
75
|
+
// List of Resources
|
|
76
|
+
repeated Resource resources = 1;
|
|
77
|
+
|
|
78
|
+
// Token to retrieve the next page of results, or empty if there are no more results in the list
|
|
79
|
+
string next_page_token = 2;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
message FindByRequest {
|
|
83
|
+
// The type of resource to find
|
|
84
|
+
string kind = 1;
|
|
85
|
+
|
|
86
|
+
// Search criteria for the request
|
|
87
|
+
string criteria = 2;
|
|
88
|
+
|
|
89
|
+
// Parameters to apply in combination with the search criteria
|
|
90
|
+
.google.protobuf.Struct parameters = 3;
|
|
91
|
+
|
|
92
|
+
// Level of detail of the individual entities (reserved)
|
|
93
|
+
View view = 4;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
message FindByResponse {
|
|
97
|
+
// List of Resources
|
|
98
|
+
repeated Resource resources = 1;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
enum View {
|
|
102
|
+
BASIC = 0;
|
|
103
|
+
STANDARD = 1;
|
|
104
|
+
FULL = 2;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
message Empty {}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/routr
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Routr
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
1
19
|
syntax = "proto3";
|
|
2
20
|
|
|
3
21
|
package fonoster.routr.sipmessage.v2draft1;
|
|
@@ -53,7 +71,7 @@ enum ResponseType {
|
|
|
53
71
|
BAD_EVENT = 42;
|
|
54
72
|
REQUEST_PENDING = 43;
|
|
55
73
|
UNDECIPHERABLE = 44;
|
|
56
|
-
SERVER_ERROR =45;
|
|
74
|
+
SERVER_ERROR = 45;
|
|
57
75
|
SERVER_INTERNAL_ERROR = 46;
|
|
58
76
|
NOT_IMPLEMENTED = 47;
|
|
59
77
|
BAD_GATEWAY = 48;
|
|
@@ -68,6 +86,32 @@ enum ResponseType {
|
|
|
68
86
|
SESSION_NOT_ACCEPTABLE = 57;
|
|
69
87
|
}
|
|
70
88
|
|
|
89
|
+
message WWWAuthenticate {
|
|
90
|
+
string realm = 1;
|
|
91
|
+
string domain = 2;
|
|
92
|
+
string scheme = 3;
|
|
93
|
+
string nonce = 4;
|
|
94
|
+
string algorithm = 5;
|
|
95
|
+
string qop = 6;
|
|
96
|
+
string opaque = 7;
|
|
97
|
+
bool stale = 8;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
message Authorization {
|
|
101
|
+
string realm = 1;
|
|
102
|
+
string scheme = 2;
|
|
103
|
+
string c_nonce = 3;
|
|
104
|
+
string nonce = 4;
|
|
105
|
+
string algorithm = 5;
|
|
106
|
+
string qop = 6;
|
|
107
|
+
string opaque = 7;
|
|
108
|
+
string response = 8;
|
|
109
|
+
string username = 9;
|
|
110
|
+
string uri = 10;
|
|
111
|
+
string method = 11;
|
|
112
|
+
int32 nonce_count = 12;
|
|
113
|
+
}
|
|
114
|
+
|
|
71
115
|
message CallID {
|
|
72
116
|
string call_id = 1;
|
|
73
117
|
}
|
|
@@ -96,10 +140,11 @@ message SipURI {
|
|
|
96
140
|
string m_addr_param = 5;
|
|
97
141
|
string method_param = 6;
|
|
98
142
|
string user_param = 7;
|
|
99
|
-
int32
|
|
143
|
+
int32 ttl_param = 8;
|
|
100
144
|
int32 port = 9;
|
|
101
145
|
bool lr_param = 10;
|
|
102
|
-
bool
|
|
146
|
+
bool bnc_param = 11;
|
|
147
|
+
bool secure = 12;
|
|
103
148
|
}
|
|
104
149
|
|
|
105
150
|
message Address {
|
|
@@ -108,14 +153,36 @@ message Address {
|
|
|
108
153
|
bool wildcard = 3;
|
|
109
154
|
}
|
|
110
155
|
|
|
156
|
+
message MaxForwards {
|
|
157
|
+
int32 max_forwards = 1;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
message Route {
|
|
161
|
+
Address address = 1;
|
|
162
|
+
map<string, string> parameters = 2;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
message RecordRoute {
|
|
166
|
+
Address address = 1;
|
|
167
|
+
map<string, string> parameters = 2;
|
|
168
|
+
}
|
|
169
|
+
|
|
111
170
|
message From {
|
|
112
171
|
Address address = 1;
|
|
113
172
|
string tag = 2;
|
|
173
|
+
map<string, string> parameters = 3;
|
|
114
174
|
}
|
|
115
175
|
|
|
116
176
|
message To {
|
|
117
177
|
Address address = 1;
|
|
118
178
|
string tag = 2;
|
|
179
|
+
map<string, string> parameters = 3;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
message Contact {
|
|
183
|
+
Address address = 1;
|
|
184
|
+
int32 expires = 2;
|
|
185
|
+
float q_value = 3;
|
|
119
186
|
}
|
|
120
187
|
|
|
121
188
|
message Expires {
|
|
@@ -129,9 +196,15 @@ message SIPMessage {
|
|
|
129
196
|
}
|
|
130
197
|
From from = 3;
|
|
131
198
|
To to = 4;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
199
|
+
Contact contact = 5;
|
|
200
|
+
CallID call_id = 6;
|
|
201
|
+
ContentLength content_length = 7;
|
|
202
|
+
Expires expires = 8;
|
|
203
|
+
WWWAuthenticate www_authenticate = 9;
|
|
204
|
+
MaxForwards max_forwards = 10;
|
|
205
|
+
Authorization authorization = 11;
|
|
206
|
+
repeated Extension extensions = 12;
|
|
207
|
+
repeated Via via = 13;
|
|
208
|
+
repeated Route route = 14;
|
|
209
|
+
repeated RecordRoute record_route = 15;
|
|
137
210
|
}
|
package/dist/redis.d.ts
ADDED
package/dist/redis.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRedisUrlFromConfig = void 0;
|
|
4
|
+
const getRedisUrlFromConfig = (config) => {
|
|
5
|
+
return (`redis${config.secure ? "s" : ""}` +
|
|
6
|
+
`://${config.username ? config.username : ""}` +
|
|
7
|
+
`${config.password ? ":" + config.password + "@" : ""}` +
|
|
8
|
+
`${config.host}:${config.port}`);
|
|
9
|
+
};
|
|
10
|
+
exports.getRedisUrlFromConfig = getRedisUrlFromConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const REQUESTER_PROTO: any;
|
|
@@ -0,0 +1,56 @@
|
|
|
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 __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;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.REQUESTER_PROTO = void 0;
|
|
27
|
+
/*
|
|
28
|
+
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
|
|
29
|
+
* http://github.com/fonoster/routr
|
|
30
|
+
*
|
|
31
|
+
* This file is part of Routr
|
|
32
|
+
*
|
|
33
|
+
* Licensed under the MIT License (the "License");
|
|
34
|
+
* you may not use this file except in compliance with
|
|
35
|
+
* the License. You may obtain a copy of the License at
|
|
36
|
+
*
|
|
37
|
+
* https://opensource.org/licenses/MIT
|
|
38
|
+
*
|
|
39
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
40
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
41
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
42
|
+
* See the License for the specific language governing permissions and
|
|
43
|
+
* limitations under the License.
|
|
44
|
+
*/
|
|
45
|
+
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
46
|
+
const protoLoader = require("@grpc/proto-loader");
|
|
47
|
+
const packageDefinition = protoLoader.loadSync(__dirname + "/../protos/requester.proto", {
|
|
48
|
+
keepCase: false,
|
|
49
|
+
longs: String,
|
|
50
|
+
enums: String,
|
|
51
|
+
defaults: true,
|
|
52
|
+
oneofs: true
|
|
53
|
+
});
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
|
+
const protoDescriptor = grpc.loadPackageDefinition(packageDefinition);
|
|
56
|
+
exports.REQUESTER_PROTO = protoDescriptor.fonoster.routr.requester;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./grpc_client";
|
|
@@ -0,0 +1,35 @@
|
|
|
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) 2022 by Fonoster Inc (https://fonoster.com)
|
|
19
|
+
* http://github.com/fonoster
|
|
20
|
+
*
|
|
21
|
+
* This file is part of Routr.
|
|
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("./grpc_client"), exports);
|
package/dist/service.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { ObjectProto, ServiceInfo } from "./types";
|
|
2
2
|
import { ServiceDefinitionNotFound } from "./errors";
|
|
3
|
-
export declare const PROCESSOR_OBJECT_PROTO:
|
|
4
|
-
export declare const LOCATION_OBJECT_PROTO:
|
|
3
|
+
export declare const PROCESSOR_OBJECT_PROTO: unknown;
|
|
4
|
+
export declare const LOCATION_OBJECT_PROTO: unknown;
|
|
5
|
+
/**
|
|
6
|
+
* Gets the proto definition for the given object.
|
|
7
|
+
*
|
|
8
|
+
* @param {ObjectProt} objectProto - The object proto to load.
|
|
9
|
+
* @return {A} The proto definition.
|
|
10
|
+
*/
|
|
5
11
|
export declare function getObjectProto<A>(objectProto: ObjectProto): A | ServiceDefinitionNotFound;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new service using the given service definition.
|
|
14
|
+
*
|
|
15
|
+
* @param {ServiceInfo} serviceInfo - The service info to create the service from.
|
|
16
|
+
*/
|
|
6
17
|
export default function createService(serviceInfo: ServiceInfo): void;
|