@routr/common 2.0.8-alpha.8 → 2.0.9

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.
Files changed (103) hide show
  1. package/dist/assertions.js +2 -2
  2. package/dist/auth.d.ts +18 -11
  3. package/dist/auth.js +34 -12
  4. package/dist/connect/api/client.d.ts +3 -0
  5. package/dist/connect/api/client.js +158 -0
  6. package/dist/connect/api/index.d.ts +2 -0
  7. package/dist/connect/api/index.js +36 -0
  8. package/dist/connect/api/types.d.ts +51 -0
  9. package/dist/connect/api/types.js +2 -0
  10. package/dist/connect/assertions.d.ts +37 -0
  11. package/dist/connect/assertions.js +112 -0
  12. package/dist/connect/client.d.ts +8 -0
  13. package/dist/connect/client.js +94 -0
  14. package/dist/connect/config.d.ts +113 -0
  15. package/dist/connect/config.js +2 -0
  16. package/dist/connect/connect_error.d.ts +21 -0
  17. package/dist/connect/connect_error.js +44 -0
  18. package/dist/connect/index.d.ts +7 -2
  19. package/dist/connect/index.js +8 -3
  20. package/dist/connect/mappers/acl.d.ts +3 -0
  21. package/dist/connect/mappers/acl.js +19 -0
  22. package/dist/connect/mappers/agent.d.ts +3 -0
  23. package/dist/connect/mappers/agent.js +42 -0
  24. package/dist/connect/mappers/assertions.d.ts +3 -0
  25. package/dist/connect/mappers/assertions.js +43 -0
  26. package/dist/connect/mappers/credentials.d.ts +3 -0
  27. package/dist/connect/mappers/credentials.js +18 -0
  28. package/dist/connect/mappers/domain.d.ts +3 -0
  29. package/dist/connect/mappers/domain.js +19 -0
  30. package/dist/connect/mappers/index.d.ts +7 -0
  31. package/dist/connect/mappers/index.js +41 -0
  32. package/dist/connect/mappers/number.d.ts +3 -0
  33. package/dist/connect/mappers/number.js +26 -0
  34. package/dist/connect/mappers/peer.d.ts +3 -0
  35. package/dist/connect/mappers/peer.js +26 -0
  36. package/dist/connect/mappers/trunk.d.ts +3 -0
  37. package/dist/connect/mappers/trunk.js +34 -0
  38. package/dist/connect/protos/acl.proto +112 -0
  39. package/dist/connect/protos/agents.proto +153 -0
  40. package/dist/connect/protos/credentials.proto +114 -0
  41. package/dist/connect/protos/domains.proto +146 -0
  42. package/dist/connect/protos/numbers.proto +166 -0
  43. package/dist/connect/protos/peers.proto +174 -0
  44. package/dist/connect/protos/trunks.proto +178 -0
  45. package/dist/connect/schemas/acl.d.ts +66 -0
  46. package/dist/connect/schemas/acl.js +85 -0
  47. package/dist/connect/schemas/agent.d.ts +61 -0
  48. package/dist/connect/schemas/agent.js +80 -0
  49. package/dist/connect/schemas/crendentials.d.ts +59 -0
  50. package/dist/connect/schemas/crendentials.js +78 -0
  51. package/dist/connect/schemas/domain.d.ts +72 -0
  52. package/dist/connect/schemas/domain.js +91 -0
  53. package/dist/connect/schemas/index.d.ts +1 -0
  54. package/dist/connect/schemas/index.js +35 -0
  55. package/dist/connect/schemas/number.d.ts +81 -0
  56. package/dist/connect/schemas/number.js +100 -0
  57. package/dist/connect/schemas/peer.d.ts +84 -0
  58. package/dist/connect/schemas/peer.js +103 -0
  59. package/dist/connect/schemas/trunk.d.ts +125 -0
  60. package/dist/connect/schemas/trunk.js +157 -0
  61. package/dist/connect/schemas/validators.d.ts +2 -0
  62. package/dist/connect/schemas/validators.js +43 -0
  63. package/dist/connect/types.d.ts +89 -23
  64. package/dist/connect/types.js +7 -29
  65. package/dist/connect/validations.d.ts +43 -0
  66. package/dist/connect/validations.js +272 -0
  67. package/dist/envs.d.ts +2 -0
  68. package/dist/envs.js +23 -0
  69. package/dist/errors.d.ts +35 -1
  70. package/dist/errors.js +52 -6
  71. package/dist/healthcheck.d.ts +1 -0
  72. package/dist/healthcheck.js +24 -0
  73. package/dist/helper.d.ts +13 -0
  74. package/dist/helper.js +78 -4
  75. package/dist/index.d.ts +8 -4
  76. package/dist/index.js +9 -6
  77. package/dist/ip_utils.js +1 -1
  78. package/dist/protos/common.proto +2 -4
  79. package/dist/protos/location.proto +21 -8
  80. package/dist/protos/processor.proto +8 -6
  81. package/dist/protos/requester.proto +6 -6
  82. package/dist/protos/sipmessage.proto +9 -2
  83. package/dist/protos/verifier.proto +39 -0
  84. package/dist/requester/grpc_client.js +1 -1
  85. package/dist/requester/index.js +1 -1
  86. package/dist/service.d.ts +2 -2
  87. package/dist/service.js +27 -5
  88. package/dist/tracer.js +1 -1
  89. package/dist/types.d.ts +119 -87
  90. package/dist/types.js +79 -69
  91. package/dist/verifier/grpc_client.d.ts +1 -0
  92. package/dist/{connect → verifier}/grpc_client.js +4 -4
  93. package/dist/verifier/index.d.ts +2 -0
  94. package/dist/verifier/index.js +36 -0
  95. package/dist/verifier/types.d.ts +10 -0
  96. package/dist/verifier/types.js +2 -0
  97. package/dist/verifier/verifier.d.ts +3 -0
  98. package/dist/verifier/verifier.js +64 -0
  99. package/package.json +17 -7
  100. package/dist/connect/data_api.d.ts +0 -11
  101. package/dist/connect/data_api.js +0 -91
  102. package/dist/connect/grpc_client.d.ts +0 -1
  103. package/dist/protos/resources.proto +0 -108
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
2
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
3
3
  * http://github.com/fonoster/routr
4
4
  *
5
5
  * This file is part of Routr
@@ -18,7 +18,7 @@
18
18
  */
19
19
  syntax = "proto3";
20
20
 
21
- package fonoster.routr.common.v2draft1;
21
+ package fonoster.routr.common.v2beta1;
22
22
 
23
23
  option java_multiple_files = true;
24
24
  option java_package = "io.routr.common";
@@ -33,5 +33,3 @@ enum Transport {
33
33
  WS = 4;
34
34
  WSS = 5;
35
35
  }
36
-
37
- message Empty {}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
2
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
3
3
  * http://github.com/fonoster/routr
4
4
  *
5
5
  * This file is part of Routr
@@ -18,20 +18,21 @@
18
18
  */
19
19
  syntax = "proto3";
20
20
 
21
- package fonoster.routr.location.v2draft1;
21
+ package fonoster.routr.location.v2beta1;
22
22
 
23
23
  option java_multiple_files = true;
24
24
  option java_package = "io.routr.location";
25
25
  option java_outer_classname = "LocationProto";
26
26
  option objc_class_prefix = "LC";
27
27
 
28
+ import "google/protobuf/empty.proto";
28
29
  import "common.proto";
29
30
  import "processor.proto";
30
31
 
31
32
  service Location {
32
- rpc AddRoute (AddRouteRequest) returns (fonoster.routr.common.v2draft1.Empty) {}
33
+ rpc AddRoute (AddRouteRequest) returns (.google.protobuf.Empty) {}
33
34
  rpc FindRoutes (FindRoutesRequest) returns (FindRoutesResponse) {}
34
- rpc RemoveRoutes (RemoveRoutesRequest) returns (fonoster.routr.common.v2draft1.Empty) {}
35
+ rpc RemoveRoutes (RemoveRoutesRequest) returns (.google.protobuf.Empty) {}
35
36
  }
36
37
 
37
38
  // A binding created by an actual endpoint (Softphone, PBX, Conference System, etc.)
@@ -39,12 +40,12 @@ message Route {
39
40
  string user = 1;
40
41
  string host = 2;
41
42
  string port = 3;
42
- fonoster.routr.common.v2draft1.Transport transport = 4;
43
+ fonoster.routr.common.v2beta1.Transport transport = 4;
43
44
  int64 registered_on = 5;
44
45
  int32 expires = 6;
45
46
  int32 session_count = 7;
46
47
  string edge_port_ref = 8;
47
- repeated fonoster.routr.processor.v2draft1.NetInterface listening_points = 9;
48
+ repeated fonoster.routr.processor.v2beta1.NetInterface listening_points = 9;
48
49
  repeated string localnets = 10;
49
50
  repeated string external_addrs = 11;
50
51
  // During route creation, an endpoint can request to add labels than can later be
@@ -60,8 +61,20 @@ message AddRouteRequest {
60
61
  }
61
62
 
62
63
  message FindRoutesRequest {
63
- string aor = 1;
64
- map<string, string> labels = 2;
64
+ message Backend {
65
+ enum Algoritm {
66
+ ROUND_ROBIN = 0;
67
+ LEAST_SESSIONS = 1;
68
+ }
69
+ string ref = 1;
70
+ bool with_session_affinity = 2;
71
+ Algoritm algorithm = 3;
72
+ }
73
+ string call_id = 1;
74
+ string aor = 2;
75
+ string session_affinity_ref = 3;
76
+ Backend backend = 4;
77
+ map<string, string> labels = 5;
65
78
  }
66
79
 
67
80
  message FindRoutesResponse {
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
2
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
3
3
  * http://github.com/fonoster/routr
4
4
  *
5
5
  * This file is part of Routr
@@ -18,7 +18,7 @@
18
18
  */
19
19
  syntax = "proto3";
20
20
 
21
- package fonoster.routr.processor.v2draft1;
21
+ package fonoster.routr.processor.v2beta1;
22
22
 
23
23
  option java_multiple_files = true;
24
24
  option java_package = "io.routr.processor";
@@ -69,7 +69,7 @@ enum Method {
69
69
  message NetInterface {
70
70
  string host = 1;
71
71
  int32 port = 2;
72
- fonoster.routr.common.v2draft1.Transport transport = 3;
72
+ fonoster.routr.common.v2beta1.Transport transport = 3;
73
73
  }
74
74
 
75
75
  message MessageRequest {
@@ -81,10 +81,12 @@ message MessageRequest {
81
81
  repeated NetInterface listening_points = 5;
82
82
  repeated string external_addrs = 6;
83
83
  repeated string localnets = 7;
84
- fonoster.routr.sipmessage.v2draft1.SIPMessage message = 8;
85
- // .google.protobuf.Struct metadata = 9;
84
+ fonoster.routr.sipmessage.v2beta1.SIPMessage message = 8;
85
+ map<string, string> metadata = 9;
86
86
  }
87
87
 
88
88
  message MessageResponse {
89
- fonoster.routr.sipmessage.v2draft1.SIPMessage message = 1;
89
+ NetInterface sender = 1;
90
+ fonoster.routr.sipmessage.v2beta1.SIPMessage message = 2;
91
+ map<string, string> metadata = 3;
90
92
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
2
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
3
3
  * http://github.com/fonoster/routr
4
4
  *
5
5
  * This file is part of Routr
@@ -18,7 +18,7 @@
18
18
  */
19
19
  syntax = "proto3";
20
20
 
21
- package fonoster.routr.requester.v2draft1;
21
+ package fonoster.routr.requester.v2beta1;
22
22
 
23
23
  option java_multiple_files = true;
24
24
  option java_package = "io.routr.requester";
@@ -37,11 +37,11 @@ service Requester {
37
37
 
38
38
  message SendMessageRequest {
39
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;
40
+ fonoster.routr.processor.v2beta1.Method method = 2;
41
+ fonoster.routr.common.v2beta1.Transport transport = 3;
42
+ fonoster.routr.sipmessage.v2beta1.SIPMessage message = 4;
43
43
  }
44
44
 
45
45
  message SendMessageResponse {
46
- fonoster.routr.sipmessage.v2draft1.SIPMessage message = 1;
46
+ fonoster.routr.sipmessage.v2beta1.SIPMessage message = 1;
47
47
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright (C) 2022 by Fonoster Inc (https://fonoster.com)
2
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
3
3
  * http://github.com/fonoster/routr
4
4
  *
5
5
  * This file is part of Routr
@@ -18,7 +18,7 @@
18
18
  */
19
19
  syntax = "proto3";
20
20
 
21
- package fonoster.routr.sipmessage.v2draft1;
21
+ package fonoster.routr.sipmessage.v2beta1;
22
22
 
23
23
  option java_multiple_files = true;
24
24
  option java_package = "io.routr.message";
@@ -130,6 +130,11 @@ message Via {
130
130
  int32 port = 2;
131
131
  string branch = 3;
132
132
  string transport = 4;
133
+ bool r_port_flag = 5;
134
+ int32 r_port = 6;
135
+ string received = 7;
136
+ string m_addr = 8;
137
+ int32 ttl = 9;
133
138
  }
134
139
 
135
140
  message SipURI {
@@ -207,4 +212,6 @@ message SIPMessage {
207
212
  repeated Via via = 13;
208
213
  repeated Route route = 14;
209
214
  repeated RecordRoute record_route = 15;
215
+ string reason_phrase = 16;
216
+ string body = 17;
210
217
  }
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Copyright (C) 2023 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.verifier;
22
+
23
+ // JWT Verifier service
24
+ service Verifier {
25
+ // Verifies a JWT token
26
+ rpc Verify (VerifyRequest) returns (VerifyResponse) {}
27
+ }
28
+
29
+ // The request message containing the JWT token
30
+ message VerifyRequest {
31
+ // The JWT token
32
+ string token = 1;
33
+ }
34
+
35
+ // The response message containing the JWT payload
36
+ message VerifyResponse {
37
+ // The JWT payload
38
+ map<string, string> payload = 2;
39
+ }
@@ -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) 2022 by Fonoster Inc (https://fonoster.com)
28
+ * Copyright (C) 2023 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) 2022 by Fonoster Inc (https://fonoster.com)
18
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
19
19
  * http://github.com/fonoster
20
20
  *
21
21
  * This file is part of Routr.
package/dist/service.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ObjectProto, ServiceInfo } from "./types";
2
- import { ServiceDefinitionNotFound } from "./errors";
2
+ import { ServiceDefinitionNotFoundError } from "./errors";
3
3
  export declare const PROCESSOR_OBJECT_PROTO: unknown;
4
4
  export declare const LOCATION_OBJECT_PROTO: unknown;
5
5
  /**
@@ -8,7 +8,7 @@ export declare const LOCATION_OBJECT_PROTO: unknown;
8
8
  * @param {ObjectProt} objectProto - The object proto to load.
9
9
  * @return {A} The proto definition.
10
10
  */
11
- export declare function getObjectProto<A>(objectProto: ObjectProto): A | ServiceDefinitionNotFound;
11
+ export declare function getObjectProto<A>(objectProto: ObjectProto): A | ServiceDefinitionNotFoundError;
12
12
  /**
13
13
  * Creates a new service using the given service definition.
14
14
  *
package/dist/service.js CHANGED
@@ -24,10 +24,31 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.getObjectProto = exports.LOCATION_OBJECT_PROTO = exports.PROCESSOR_OBJECT_PROTO = void 0;
27
- const errors_1 = require("./errors");
27
+ /*
28
+ * Copyright (C) 2023 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
+ */
28
45
  const grpc = __importStar(require("@grpc/grpc-js"));
29
46
  const protoLoader = __importStar(require("@grpc/proto-loader"));
47
+ const errors_1 = require("./errors");
30
48
  const logger_1 = require("@fonoster/logger");
49
+ const grpc_health_check_1 = require("@fonoster/grpc-health-check");
50
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
51
+ const interceptor = require("grpc-interceptors");
31
52
  const logger = (0, logger_1.getLogger)({ service: "common", filePath: __filename });
32
53
  const loadOptions = {
33
54
  keepCase: false,
@@ -37,7 +58,7 @@ const loadOptions = {
37
58
  oneofs: true
38
59
  };
39
60
  // TODO: Get version from the proto or package
40
- const API_VERSION = "v2draft1";
61
+ const API_VERSION = "v2beta1";
41
62
  // We currenly don't have a way to obtain the proto type
42
63
  exports.PROCESSOR_OBJECT_PROTO = getObjectProto({
43
64
  name: "processor",
@@ -62,7 +83,7 @@ function getObjectProto(objectProto) {
62
83
  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
84
  return (objProto === null || objProto === void 0 ? void 0 : objProto[objectProto.version])
64
85
  ? objProto[objectProto.version]
65
- : new errors_1.ServiceDefinitionNotFound(objectProto.name, objectProto.version);
86
+ : new errors_1.ServiceDefinitionNotFoundError(objectProto.name, objectProto.version);
66
87
  }
67
88
  exports.getObjectProto = getObjectProto;
68
89
  /**
@@ -76,11 +97,12 @@ function createService(serviceInfo) {
76
97
  name: serviceInfo.name,
77
98
  bindAddr: serviceInfo.bindAddr
78
99
  });
79
- server.start();
100
+ withHealthChecks.start();
80
101
  };
81
102
  const credentials = grpc.ServerCredentials.createInsecure();
82
103
  const server = new grpc.Server();
83
104
  server.addService(serviceInfo.service, serviceInfo.handlers);
84
- server.bindAsync(serviceInfo.bindAddr, credentials, cb);
105
+ const withHealthChecks = interceptor.serverProxy((0, grpc_health_check_1.useHealth)(server));
106
+ withHealthChecks.bindAsync(serviceInfo.bindAddr, credentials, cb);
85
107
  }
86
108
  exports.default = createService;
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) 2022 by Fonoster Inc (https://fonoster.com)
8
+ * Copyright (C) 2023 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/types.d.ts CHANGED
@@ -1,4 +1,8 @@
1
+ import * as grpc from "@grpc/grpc-js";
1
2
  import { ServiceDefinition } from "@grpc/proto-loader";
3
+ import { JsonArray, JsonValue, Struct } from "pb-util/build";
4
+ export type JsonData = Record<string, string | number | boolean | JsonValue | JsonArray | Struct>;
5
+ export declare const ANONYMOUS = "anonymous";
2
6
  export declare enum Method {
3
7
  UNKNOWN = "UNKNOWN",
4
8
  REGISTER = "REGISTER",
@@ -13,23 +17,34 @@ export declare enum Method {
13
17
  OPTIONS = "OPTIONS"
14
18
  }
15
19
  export declare enum Transport {
16
- TCP = "tcp",
17
- UDP = "udp",
18
- TLS = "tls",
19
- SCTP = "sctp",
20
- WS = "ws",
21
- WSS = "wss"
20
+ TCP = "TCP",
21
+ UDP = "UDP",
22
+ TLS = "TLS",
23
+ SCTP = "SCTP",
24
+ WS = "WS",
25
+ WSS = "WSS"
26
+ }
27
+ export declare enum LoadBalancingAlgorithm {
28
+ UNSPECIFIED = "UNSPECIFIED",
29
+ ROUND_ROBIN = "ROUND_ROBIN",
30
+ LEAST_SESSIONS = "LEAST_SESSIONS"
22
31
  }
23
32
  export declare enum ExtraHeader {
24
33
  REQUEST_URI = "X-Request-Uri",
25
34
  GATEWAY_AUTH = "X-Gateway-Auth",
26
35
  EDGEPORT_REF = "X-Edgeport-Ref",
27
- SESSION_COUNT = "X-Session-Count"
36
+ SESSION_COUNT = "X-Session-Count",
37
+ DOD_NUMBER = "X-DOD-Number",
38
+ DOD_PRIVACY = "X-DOD-Privacy",
39
+ CONNECT_TOKEN = "X-Connect-Token"
28
40
  }
29
41
  export declare enum Privacy {
30
- NONE = "none",
31
- PRIVATE = "id"
42
+ NONE = "NONE",
43
+ PRIVATE = "ID"
32
44
  }
45
+ export type AuthorizationAlgorithm = "MD5";
46
+ export type AuthorizationScheme = "Digest";
47
+ export type Qop = "auth" | "auth-int" | "";
33
48
  export interface NetInterface {
34
49
  host: string;
35
50
  port: number;
@@ -44,6 +59,7 @@ export interface MessageRequest {
44
59
  externalAddrs: string[];
45
60
  localnets: string[];
46
61
  message: SIPMessage;
62
+ metadata?: Record<string, string>;
47
63
  }
48
64
  export interface MessageResponse {
49
65
  message: Record<string, unknown>;
@@ -57,6 +73,7 @@ export interface ProcessorConfig {
57
73
  export interface MiddlewareConfig {
58
74
  ref: string;
59
75
  addr: string;
76
+ postProcessor: boolean;
60
77
  }
61
78
  export interface ServiceInfo {
62
79
  name: string;
@@ -72,32 +89,32 @@ export interface ObjectProto {
72
89
  export interface AuthChallengeRequest {
73
90
  realm: string;
74
91
  domain: string;
75
- scheme: string;
76
- nonce: string;
77
- algorithm: string;
78
- qop: string;
79
92
  opaque: string;
80
93
  stale: boolean;
94
+ nonce: string;
95
+ scheme: AuthorizationScheme;
96
+ algorithm: AuthorizationAlgorithm;
97
+ qop: Qop;
81
98
  }
82
99
  export interface AuthChallengeResponse {
83
100
  realm: string;
84
101
  domain: string;
85
- scheme: string;
86
102
  cNonce: string;
103
+ nonce: string;
87
104
  nonceCount: number;
88
105
  response: string;
89
106
  username: string;
90
- nonce: string;
91
- algorithm: string;
92
- qop: string;
93
107
  opaque: string;
94
108
  stale: boolean;
95
109
  uri: string;
96
- method: string;
110
+ method: Method;
111
+ scheme: AuthorizationScheme;
112
+ algorithm: AuthorizationAlgorithm;
113
+ qop: Qop;
97
114
  }
98
115
  export declare enum HeaderModifierAction {
99
- ADD = "add",
100
- REMOVE = "remove"
116
+ ADD = 0,
117
+ REMOVE = 1
101
118
  }
102
119
  export interface HeaderModifier {
103
120
  name: string;
@@ -110,6 +127,13 @@ export interface Route {
110
127
  port: number;
111
128
  transport: Transport;
112
129
  registeredOn?: number;
130
+ /**
131
+ * Number of active sessions. This is used to determine if a route is
132
+ * overloaded and for load balancing.
133
+ *
134
+ * This value is reported by the endpoint during the REGISTER request,
135
+ * using the X-Session-Count header.
136
+ */
113
137
  sessionCount?: number;
114
138
  expires?: number;
115
139
  edgePortRef: string;
@@ -118,66 +142,67 @@ export interface Route {
118
142
  externalAddrs: string[];
119
143
  labels?: Map<string, string>;
120
144
  headers?: HeaderModifier[];
145
+ metadata?: Record<string, string>;
121
146
  }
122
147
  export declare enum ResponseType {
123
- UNKNOWN = 0,
124
- TRYING = 1,
125
- RINGING = 2,
126
- CALL_IS_BEING_FORWARDED = 3,
127
- QUEUED = 4,
128
- SESSION_PROGRESS = 5,
129
- SUCCESS = 6,
130
- OK = 7,
131
- ACCEPTED = 8,
132
- REDIRECTION = 9,
133
- MULTIPLE_CHOICES = 10,
134
- MOVED_PERMANENTLY = 11,
135
- MOVED_TEMPORARILY = 12,
136
- USE_PROXY = 13,
137
- ALTERNATIVE_SERVICE = 14,
138
- CLIENT_ERROR = 15,
139
- BAD_REQUEST = 16,
140
- UNAUTHORIZED = 17,
141
- PAYMENT_REQUIRED = 18,
142
- FORBIDDEN = 19,
143
- NOT_FOUND = 20,
144
- METHOD_NOT_ALLOWED = 21,
145
- NOT_ACCEPTABLE = 22,
146
- PROXY_AUTHENTICATION_REQUIRED = 23,
147
- REQUEST_TIMEOUT = 24,
148
- GONE = 25,
149
- REQUEST_ENTITY_TOO_LARGE = 26,
150
- REQUEST_URI_TOO_LONG = 27,
151
- UNSUPPORTED_MEDIA_TYPE = 28,
152
- UNSUPPORTED_URI_SCHEME = 29,
153
- BAD_EXTENSION = 30,
154
- EXTENSION_REQUIRED = 31,
155
- INTERVAL_TOO_BRIEF = 32,
156
- TEMPORARILY_UNAVAILABLE = 33,
157
- CALL_OR_TRANSACTION_DOES_NOT_EXIST = 34,
158
- LOOP_DETECTED = 35,
159
- TOO_MANY_HOPS = 36,
160
- ADDRESS_INCOMPLETE = 37,
161
- AMBIGUOUS = 38,
162
- BUSY_HERE = 39,
163
- REQUEST_TERMINATED = 40,
164
- NOT_ACCEPTABLE_HERE = 41,
165
- BAD_EVENT = 42,
166
- REQUEST_PENDING = 43,
167
- UNDECIPHERABLE = 44,
168
- SERVER_ERROR = 45,
169
- SERVER_INTERNAL_ERROR = 46,
170
- NOT_IMPLEMENTED = 47,
171
- BAD_GATEWAY = 48,
172
- SERVICE_UNAVAILABLE = 49,
173
- SERVER_TIMEOUT = 50,
174
- VERSION_NOT_SUPPORTED = 51,
175
- MESSAGE_TOO_LARGE = 52,
176
- GLOBAL_ERROR = 53,
177
- BUSY_EVERYWHERE = 54,
178
- DECLINE = 55,
179
- DOES_NOT_EXIST_ANYWHERE = 56,
180
- SESSION_NOT_ACCEPTABLE = 57
148
+ UNKNOWN = "UNKNOWN",
149
+ TRYING = "TRYING",
150
+ RINGING = "RINGING",
151
+ CALL_IS_BEING_FORWARDED = "CALL_IS_BEING_FORWARDED",
152
+ QUEUED = "QUEUED",
153
+ SESSION_PROGRESS = "SESSION_PROGRESS",
154
+ SUCCESS = "SUCCESS",
155
+ OK = "OK",
156
+ ACCEPTED = "ACCEPTED",
157
+ REDIRECTION = "REDIRECTION",
158
+ MULTIPLE_CHOICES = "MULTIPLE_CHOICES",
159
+ MOVED_PERMANENTLY = "MOVED_PERMANENTLY",
160
+ MOVED_TEMPORARILY = "MOVED_TEMPORARILY",
161
+ USE_PROXY = "USE_PROXY",
162
+ ALTERNATIVE_SERVICE = "ALTERNATIVE_SERVICE",
163
+ CLIENT_ERROR = "CLIENT_ERROR",
164
+ BAD_REQUEST = "BAD_REQUEST",
165
+ UNAUTHORIZED = "UNAUTHORIZED",
166
+ PAYMENT_REQUIRED = "PAYMENT_REQUIRED",
167
+ FORBIDDEN = "FORBIDDEN",
168
+ NOT_FOUND = "NOT_FOUND",
169
+ METHOD_NOT_ALLOWED = "METHOD_NOT_ALLOWED",
170
+ NOT_ACCEPTABLE = "NOT_ACCEPTABLE",
171
+ PROXY_AUTHENTICATION_REQUIRED = "PROXY_AUTHENTICATION_REQUIRED",
172
+ REQUEST_TIMEOUT = "REQUEST_TIMEOUT",
173
+ GONE = "GONE",
174
+ REQUEST_ENTITY_TOO_LARGE = "REQUEST_ENTITY_TOO_LARGE",
175
+ REQUEST_URI_TOO_LONG = "REQUEST_URI_TOO_LONG",
176
+ UNSUPPORTED_MEDIA_TYPE = "UNSUPPORTED_MEDIA_TYPE",
177
+ UNSUPPORTED_URI_SCHEME = "UNSUPPORTED_URI_SCHEME",
178
+ BAD_EXTENSION = "BAD_EXTENSION",
179
+ EXTENSION_REQUIRED = "EXTENSION_REQUIRED",
180
+ INTERVAL_TOO_BRIEF = "INTERVAL_TOO_BRIEF",
181
+ TEMPORARILY_UNAVAILABLE = "TEMPORARILY_UNAVAILABLE",
182
+ CALL_OR_TRANSACTION_DOES_NOT_EXIST = "CALL_OR_TRANSACTION_DOES_NOT_EXIST",
183
+ LOOP_DETECTED = "LOOP_DETECTED",
184
+ TOO_MANY_HOPS = "TOO_MANY_HOPS",
185
+ ADDRESS_INCOMPLETE = "ADDRESS_INCOMPLETE",
186
+ AMBIGUOUS = "AMBIGUOUS",
187
+ BUSY_HERE = "BUSY_HERE",
188
+ REQUEST_TERMINATED = "REQUEST_TERMINATED",
189
+ NOT_ACCEPTABLE_HERE = "NOT_ACCEPTABLE_HERE",
190
+ BAD_EVENT = "BAD_EVENT",
191
+ REQUEST_PENDING = "REQUEST_PENDING",
192
+ UNDECIPHERABLE = "UNDECIPHERABLE",
193
+ SERVER_ERROR = "SERVER_ERROR",
194
+ SERVER_INTERNAL_ERROR = "SERVER_INTERNAL_ERROR",
195
+ NOT_IMPLEMENTED = "NOT_IMPLEMENTED",
196
+ BAD_GATEWAY = "BAD_GATEWAY",
197
+ SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
198
+ SERVER_TIMEOUT = "SERVER_TIMEOUT",
199
+ VERSION_NOT_SUPPORTED = "VERSION_NOT_SUPPORTED",
200
+ MESSAGE_TOO_LARGE = "MESSAGE_TOO_LARGE",
201
+ GLOBAL_ERROR = "GLOBAL_ERROR",
202
+ BUSY_EVERYWHERE = "BUSY_EVERYWHERE",
203
+ DECLINE = "DECLINE",
204
+ DOES_NOT_EXIST_ANYWHERE = "DOES_NOT_EXIST_ANYWHERE",
205
+ SESSION_NOT_ACCEPTABLE = "SESSION_NOT_ACCEPTABLE"
181
206
  }
182
207
  export interface WWWAuthenticate {
183
208
  realm: string;
@@ -191,17 +216,17 @@ export interface WWWAuthenticate {
191
216
  }
192
217
  export interface Authorization {
193
218
  realm: string;
194
- scheme: string;
219
+ scheme: AuthorizationScheme;
195
220
  nonce: string;
196
221
  cNonce: string;
197
222
  nonceCount: number;
198
223
  response: string;
199
224
  username: string;
200
225
  uri: string;
201
- algorithm: string;
202
- qop: string;
226
+ algorithm: AuthorizationAlgorithm;
227
+ qop: Qop;
203
228
  opaque: string;
204
- method?: string;
229
+ method?: Method;
205
230
  }
206
231
  export interface CallID {
207
232
  callId: string;
@@ -218,12 +243,17 @@ export interface Via {
218
243
  port: number;
219
244
  branch?: string;
220
245
  transport: Transport;
246
+ received?: string;
247
+ rPortFlag?: boolean;
248
+ rPort?: number;
249
+ ttl?: number;
250
+ mAddr?: string;
221
251
  }
222
252
  export interface SipURI {
223
253
  user?: string;
224
254
  host: string;
225
255
  port?: number;
226
- transportParam: string;
256
+ transportParam: Transport;
227
257
  mAddrParam?: string;
228
258
  userParam?: string;
229
259
  ttlParam?: number;
@@ -283,10 +313,11 @@ export interface SIPMessage {
283
313
  wwwAuthenticate?: WWWAuthenticate;
284
314
  maxForwards: MaxForwards;
285
315
  authorization?: Authorization;
286
- extensions?: Extension[];
287
- via?: Via[];
288
- route?: RouteHeader[];
289
- recordRoute?: RecordRoute[];
316
+ extensions: Extension[];
317
+ via: Via[];
318
+ route: RouteHeader[];
319
+ recordRoute: RecordRoute[];
320
+ body?: string;
290
321
  }
291
322
  export interface GrpcCallback {
292
323
  (error: Error | {
@@ -295,4 +326,5 @@ export interface GrpcCallback {
295
326
  }
296
327
  export interface GrpcCall {
297
328
  request: Record<string, any>;
329
+ metadata?: grpc.Metadata;
298
330
  }