@routr/common 2.0.5-alpha.1 → 2.0.5-alpha.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/index.d.ts +2 -2
- package/dist/index.js +2 -1
- package/dist/protos/common.proto +19 -0
- package/dist/protos/location.proto +56 -0
- package/dist/protos/processor.proto +17 -36
- package/dist/protos/sipmessage.proto +137 -0
- package/dist/service.d.ts +1 -0
- package/dist/service.js +6 -1
- package/package.json +4 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import createService, { PROCESSOR_OBJECT_PROTO, getObjectProto } from "./service";
|
|
1
|
+
import createService, { PROCESSOR_OBJECT_PROTO, LOCATION_OBJECT_PROTO, getObjectProto } from "./service";
|
|
2
2
|
import { Transport, ProcessorConfig, MessageRequest, NetInterface, Method, Direction, ObjectProto, ServiceInfo } from "./types";
|
|
3
|
-
export { createService, getObjectProto, Transport, ProcessorConfig, MessageRequest, NetInterface, Method, Direction, ObjectProto, ServiceInfo, PROCESSOR_OBJECT_PROTO };
|
|
3
|
+
export { createService, getObjectProto, Transport, ProcessorConfig, MessageRequest, NetInterface, Method, Direction, ObjectProto, ServiceInfo, PROCESSOR_OBJECT_PROTO, LOCATION_OBJECT_PROTO };
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.PROCESSOR_OBJECT_PROTO = exports.getObjectProto = exports.createService = void 0;
|
|
22
|
+
exports.LOCATION_OBJECT_PROTO = exports.PROCESSOR_OBJECT_PROTO = exports.getObjectProto = exports.createService = void 0;
|
|
23
23
|
/*
|
|
24
24
|
* Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
|
|
25
25
|
* http://github.com/fonoster/routr
|
|
@@ -41,4 +41,5 @@ exports.PROCESSOR_OBJECT_PROTO = exports.getObjectProto = exports.createService
|
|
|
41
41
|
var service_1 = __importStar(require("./service"));
|
|
42
42
|
exports.createService = service_1.default;
|
|
43
43
|
Object.defineProperty(exports, "PROCESSOR_OBJECT_PROTO", { enumerable: true, get: function () { return service_1.PROCESSOR_OBJECT_PROTO; } });
|
|
44
|
+
Object.defineProperty(exports, "LOCATION_OBJECT_PROTO", { enumerable: true, get: function () { return service_1.LOCATION_OBJECT_PROTO; } });
|
|
44
45
|
Object.defineProperty(exports, "getObjectProto", { enumerable: true, get: function () { return service_1.getObjectProto; } });
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package fonoster.routr.common.v2draft1;
|
|
4
|
+
|
|
5
|
+
option java_multiple_files = true;
|
|
6
|
+
option java_package = "io.routr.common";
|
|
7
|
+
option java_outer_classname = "CommonProto";
|
|
8
|
+
option objc_class_prefix = "CM";
|
|
9
|
+
|
|
10
|
+
enum Transport {
|
|
11
|
+
TCP = 0;
|
|
12
|
+
UDP = 1;
|
|
13
|
+
TLS = 2;
|
|
14
|
+
SCTP = 3;
|
|
15
|
+
WS = 4;
|
|
16
|
+
WSS = 5;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
message Empty {}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package fonoster.routr.location.v2draft1;
|
|
4
|
+
|
|
5
|
+
option java_multiple_files = true;
|
|
6
|
+
option java_package = "io.routr.location";
|
|
7
|
+
option java_outer_classname = "LocationProto";
|
|
8
|
+
option objc_class_prefix = "LC";
|
|
9
|
+
|
|
10
|
+
import "common.proto";
|
|
11
|
+
|
|
12
|
+
service Location {
|
|
13
|
+
rpc AddRoute (AddRouteRequest) returns (fonoster.routr.common.v2draft1.Empty) {}
|
|
14
|
+
rpc FindRoutes (FindRoutesRequest) returns (FindRoutesResponse) {}
|
|
15
|
+
rpc RemoveRoutes (RemoveRoutesRequest) returns (fonoster.routr.common.v2draft1.Empty) {}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// A binding create by an actual endpoint (Softphone, PBX, Conference System, etc.)
|
|
19
|
+
message Route {
|
|
20
|
+
string user = 1;
|
|
21
|
+
string host = 2;
|
|
22
|
+
string port = 3;
|
|
23
|
+
fonoster.routr.common.v2draft1.Transport transport = 4;
|
|
24
|
+
int32 registered_on = 5;
|
|
25
|
+
int32 expires = 6;
|
|
26
|
+
int32 session_count = 7;
|
|
27
|
+
string edge_port_ref = 8;
|
|
28
|
+
// During route creation, an endpoint can requet to add labels than can later be
|
|
29
|
+
// used as selector. For example, a Softphone can add a label `priority=1` to indicate
|
|
30
|
+
// that it is the prefer endpoint for the given AOR.
|
|
31
|
+
//
|
|
32
|
+
// Another use case is to use the label to determine which endpoint will back certain
|
|
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;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
message AddRouteRequest {
|
|
40
|
+
// Address of record for the endpoint or trunk
|
|
41
|
+
string aor = 1;
|
|
42
|
+
Route route = 2;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
message FindRoutesRequest {
|
|
46
|
+
string aor = 1;
|
|
47
|
+
map<string, string> labels = 2;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
message FindRoutesResponse {
|
|
51
|
+
repeated Route routes = 1;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
message RemoveRoutesRequest {
|
|
55
|
+
string aor = 1;
|
|
56
|
+
}
|
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
syntax = "proto3";
|
|
2
2
|
|
|
3
|
+
package fonoster.routr.processor.v2draft1;
|
|
4
|
+
|
|
3
5
|
option java_multiple_files = true;
|
|
4
|
-
option java_package = "io.routr";
|
|
6
|
+
option java_package = "io.routr.processor";
|
|
5
7
|
option java_outer_classname = "ProcessorProto";
|
|
6
8
|
option objc_class_prefix = "PR";
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
import "common.proto";
|
|
11
|
+
import "sipmessage.proto";
|
|
9
12
|
|
|
10
13
|
// Processor service
|
|
11
14
|
service Processor {
|
|
12
15
|
// Process Message Request
|
|
13
|
-
rpc ProcessMessage (MessageRequest) returns (
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Message process IN or OUT
|
|
17
|
-
enum Direction {
|
|
18
|
-
IN = 0;
|
|
19
|
-
OUT = 1;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Message process IN or OUT
|
|
23
|
-
enum Type {
|
|
24
|
-
REQUEST = 0;
|
|
25
|
-
RESPONSE = 1;
|
|
16
|
+
rpc ProcessMessage (MessageRequest) returns (MessageResponse) {}
|
|
26
17
|
}
|
|
27
18
|
|
|
28
19
|
enum Method {
|
|
@@ -35,32 +26,22 @@ enum Method {
|
|
|
35
26
|
SUBSCRIBE = 6;
|
|
36
27
|
}
|
|
37
28
|
|
|
38
|
-
enum Transport {
|
|
39
|
-
TCP = 0;
|
|
40
|
-
UDP = 1;
|
|
41
|
-
TLS = 2;
|
|
42
|
-
SCTP = 3;
|
|
43
|
-
WS = 4;
|
|
44
|
-
WSS = 5;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
29
|
message NetInterface {
|
|
48
30
|
string host = 1;
|
|
49
31
|
int32 port = 2;
|
|
50
|
-
Transport transport = 3;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
message SIPMessage {
|
|
54
|
-
string call_id = 1;
|
|
32
|
+
fonoster.routr.common.v2draft1.Transport transport = 3;
|
|
55
33
|
}
|
|
56
34
|
|
|
57
35
|
message MessageRequest {
|
|
58
36
|
string ref = 1;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
37
|
+
Method method = 2;
|
|
38
|
+
NetInterface sender = 3;
|
|
39
|
+
repeated NetInterface external_addrs = 4;
|
|
40
|
+
repeated string localnets = 5;
|
|
41
|
+
fonoster.routr.sipmessage.v2draft1.SIPMessage message = 6;
|
|
42
|
+
// .google.protobuf.Struct metadata = 7;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
message MessageResponse {
|
|
46
|
+
fonoster.routr.sipmessage.v2draft1.SIPMessage message = 1;
|
|
66
47
|
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package fonoster.routr.sipmessage.v2draft1;
|
|
4
|
+
|
|
5
|
+
option java_multiple_files = true;
|
|
6
|
+
option java_package = "io.routr.message";
|
|
7
|
+
option java_outer_classname = "SIPMessageProto";
|
|
8
|
+
option objc_class_prefix = "SM";
|
|
9
|
+
|
|
10
|
+
enum ResponseType {
|
|
11
|
+
UNKNOWN = 0;
|
|
12
|
+
TRYING = 1;
|
|
13
|
+
RINGING = 2;
|
|
14
|
+
CALL_IS_BEING_FORWARDED = 3;
|
|
15
|
+
QUEUED = 4;
|
|
16
|
+
SESSION_PROGRESS = 5;
|
|
17
|
+
SUCCESS = 6;
|
|
18
|
+
OK = 7;
|
|
19
|
+
ACCEPTED = 8;
|
|
20
|
+
REDIRECTION = 9;
|
|
21
|
+
MULTIPLE_CHOICES = 10;
|
|
22
|
+
MOVED_PERMANENTLY = 11;
|
|
23
|
+
MOVED_TEMPORARILY = 12;
|
|
24
|
+
USE_PROXY = 13;
|
|
25
|
+
ALTERNATIVE_SERVICE = 14;
|
|
26
|
+
CLIENT_ERROR = 15;
|
|
27
|
+
BAD_REQUEST = 16;
|
|
28
|
+
UNAUTHORIZED = 17;
|
|
29
|
+
PAYMENT_REQUIRED = 18;
|
|
30
|
+
FORBIDDEN = 19;
|
|
31
|
+
NOT_FOUND = 20;
|
|
32
|
+
METHOD_NOT_ALLOWED = 21;
|
|
33
|
+
NOT_ACCEPTABLE = 22;
|
|
34
|
+
PROXY_AUTHENTICATION_REQUIRED = 23;
|
|
35
|
+
REQUEST_TIMEOUT = 24;
|
|
36
|
+
GONE = 25;
|
|
37
|
+
REQUEST_ENTITY_TOO_LARGE = 26;
|
|
38
|
+
REQUEST_URI_TOO_LONG = 27;
|
|
39
|
+
UNSUPPORTED_MEDIA_TYPE = 28;
|
|
40
|
+
UNSUPPORTED_URI_SCHEME = 29;
|
|
41
|
+
BAD_EXTENSION = 30;
|
|
42
|
+
EXTENSION_REQUIRED = 31;
|
|
43
|
+
INTERVAL_TOO_BRIEF = 32;
|
|
44
|
+
TEMPORARILY_UNAVAILABLE = 33;
|
|
45
|
+
CALL_OR_TRANSACTION_DOES_NOT_EXIST = 34;
|
|
46
|
+
LOOP_DETECTED = 35;
|
|
47
|
+
TOO_MANY_HOPS = 36;
|
|
48
|
+
ADDRESS_INCOMPLETE = 37;
|
|
49
|
+
AMBIGUOUS = 38;
|
|
50
|
+
BUSY_HERE = 39;
|
|
51
|
+
REQUEST_TERMINATED = 40;
|
|
52
|
+
NOT_ACCEPTABLE_HERE = 41;
|
|
53
|
+
BAD_EVENT = 42;
|
|
54
|
+
REQUEST_PENDING = 43;
|
|
55
|
+
UNDECIPHERABLE = 44;
|
|
56
|
+
SERVER_ERROR =45;
|
|
57
|
+
SERVER_INTERNAL_ERROR = 46;
|
|
58
|
+
NOT_IMPLEMENTED = 47;
|
|
59
|
+
BAD_GATEWAY = 48;
|
|
60
|
+
SERVICE_UNAVAILABLE = 49;
|
|
61
|
+
SERVER_TIMEOUT = 50;
|
|
62
|
+
VERSION_NOT_SUPPORTED = 51;
|
|
63
|
+
MESSAGE_TOO_LARGE = 52;
|
|
64
|
+
GLOBAL_ERROR = 53;
|
|
65
|
+
BUSY_EVERYWHERE = 54;
|
|
66
|
+
DECLINE = 55;
|
|
67
|
+
DOES_NOT_EXIST_ANYWHERE = 56;
|
|
68
|
+
SESSION_NOT_ACCEPTABLE = 57;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
message CallID {
|
|
72
|
+
string call_id = 1;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
message ContentLength {
|
|
76
|
+
int32 content_length = 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
message Extension {
|
|
80
|
+
string name = 1;
|
|
81
|
+
string value = 2;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
message Via {
|
|
85
|
+
string host = 1;
|
|
86
|
+
int32 port = 2;
|
|
87
|
+
string branch = 3;
|
|
88
|
+
string transport = 4;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
message SipURI {
|
|
92
|
+
string user = 1;
|
|
93
|
+
string user_password = 2;
|
|
94
|
+
string host = 3;
|
|
95
|
+
string transport_param = 4;
|
|
96
|
+
string m_addr_param = 5;
|
|
97
|
+
string method_param = 6;
|
|
98
|
+
string user_param = 7;
|
|
99
|
+
int32 t_t_l_param = 8;
|
|
100
|
+
int32 port = 9;
|
|
101
|
+
bool lr_param = 10;
|
|
102
|
+
bool secure = 11;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
message Address {
|
|
106
|
+
SipURI uri = 1;
|
|
107
|
+
string display_name = 2;
|
|
108
|
+
bool wildcard = 3;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
message From {
|
|
112
|
+
Address address = 1;
|
|
113
|
+
string tag = 2;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
message To {
|
|
117
|
+
Address address = 1;
|
|
118
|
+
string tag = 2;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
message Expires {
|
|
122
|
+
int32 expires = 1;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
message SIPMessage {
|
|
126
|
+
oneof message_type {
|
|
127
|
+
ResponseType response_type = 1;
|
|
128
|
+
SipURI request_uri = 2;
|
|
129
|
+
}
|
|
130
|
+
From from = 3;
|
|
131
|
+
To to = 4;
|
|
132
|
+
CallID call_id = 5;
|
|
133
|
+
ContentLength content_length = 6;
|
|
134
|
+
Expires expires = 7;
|
|
135
|
+
repeated Via via = 8;
|
|
136
|
+
repeated Extension extensions = 9;
|
|
137
|
+
}
|
package/dist/service.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ObjectProto, ServiceInfo } from "./types";
|
|
2
2
|
import { ServiceDefinitionNotFound } from "./errors";
|
|
3
3
|
export declare const PROCESSOR_OBJECT_PROTO: any;
|
|
4
|
+
export declare const LOCATION_OBJECT_PROTO: any;
|
|
4
5
|
export declare function getObjectProto<A>(objectProto: ObjectProto): A | ServiceDefinitionNotFound;
|
|
5
6
|
export default function createService(serviceInfo: ServiceInfo): void;
|
package/dist/service.js
CHANGED
|
@@ -3,7 +3,7 @@ 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.getObjectProto = exports.PROCESSOR_OBJECT_PROTO = void 0;
|
|
6
|
+
exports.getObjectProto = exports.LOCATION_OBJECT_PROTO = exports.PROCESSOR_OBJECT_PROTO = void 0;
|
|
7
7
|
var errors_1 = require("./errors");
|
|
8
8
|
var logger_1 = __importDefault(require("@fonoster/logger"));
|
|
9
9
|
var protoLoader = require('@grpc/proto-loader');
|
|
@@ -21,6 +21,11 @@ exports.PROCESSOR_OBJECT_PROTO = getObjectProto({
|
|
|
21
21
|
version: "v2draft1",
|
|
22
22
|
path: __dirname + '/protos/processor.proto'
|
|
23
23
|
});
|
|
24
|
+
exports.LOCATION_OBJECT_PROTO = getObjectProto({
|
|
25
|
+
name: "location",
|
|
26
|
+
version: "v2draft1",
|
|
27
|
+
path: __dirname + '/protos/location.proto'
|
|
28
|
+
});
|
|
24
29
|
function getObjectProto(objectProto) {
|
|
25
30
|
var _a, _b;
|
|
26
31
|
var definitions = protoLoader.loadSync(objectProto.path, loadOptions);
|
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.2",
|
|
4
4
|
"description": "Common package",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/routr#readme",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@fonoster/logger": "^0.3.3",
|
|
17
17
|
"@grpc/grpc-js": "^1.5.5",
|
|
18
|
-
"@grpc/proto-loader": "^0.6.9"
|
|
18
|
+
"@grpc/proto-loader": "^0.6.9",
|
|
19
|
+
"fp-ts": "^2.11.8"
|
|
19
20
|
},
|
|
20
21
|
"directories": {
|
|
21
22
|
"src": "src",
|
|
@@ -34,5 +35,5 @@
|
|
|
34
35
|
"bugs": {
|
|
35
36
|
"url": "https://github.com/fonoster/routr/issues"
|
|
36
37
|
},
|
|
37
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "3570106be9a96cb6672de4a850a377bfa7d9bb3e"
|
|
38
39
|
}
|