@routr/connect 2.0.8-alpha.41 → 2.0.8-alpha.42
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/access.d.ts +16 -3
- package/dist/handlers.js +5 -5
- package/dist/router.js +17 -8
- package/package.json +5 -5
package/dist/access.d.ts
CHANGED
@@ -8,9 +8,6 @@ export declare const checkAccess: (accessRequest: {
|
|
8
8
|
routingDirection: RoutingDirection;
|
9
9
|
}) => Promise<Record<string, unknown>>;
|
10
10
|
export declare const checkAgentOrPeerAccess: (request: MessageRequest, caller: CC.RoutableResourceUnion) => Promise<{
|
11
|
-
metadata: {
|
12
|
-
accessKeyId: string;
|
13
|
-
};
|
14
11
|
message: {
|
15
12
|
responseType: CT.ResponseType;
|
16
13
|
reasonPhrase: string;
|
@@ -28,5 +25,21 @@ export declare const checkAgentOrPeerAccess: (request: MessageRequest, caller: C
|
|
28
25
|
export declare const checkAccessFromPSTN: (apiClient: CC.APIClient, request: MessageRequest, callee: CC.INumber) => Promise<{
|
29
26
|
message: {
|
30
27
|
responseType: CT.ResponseType;
|
28
|
+
reasonPhrase: string;
|
29
|
+
wwwAuthenticate: {
|
30
|
+
scheme: string;
|
31
|
+
realm: string;
|
32
|
+
qop: string;
|
33
|
+
opaque: string;
|
34
|
+
stale: boolean;
|
35
|
+
nonce: string;
|
36
|
+
algorithm: string;
|
37
|
+
};
|
38
|
+
};
|
39
|
+
} | {
|
40
|
+
metadata: Record<string, string>;
|
41
|
+
message: {
|
42
|
+
responseType: CT.ResponseType;
|
43
|
+
reasonPhrase: string;
|
31
44
|
};
|
32
45
|
}>;
|
package/dist/handlers.js
CHANGED
@@ -101,14 +101,13 @@ exports.handleRegistry = handleRegistry;
|
|
101
101
|
const handleRequest = (location, apiClient) => (request, res) => __awaiter(void 0, void 0, void 0, function* () {
|
102
102
|
try {
|
103
103
|
const req = common_1.Environment.ENFORCE_E164 ? enforceE164(request) : request;
|
104
|
-
|
105
|
-
accessKeyId: "xxxxxxxxx"
|
106
|
-
};
|
104
|
+
// Must get the metadata here before the request is forwarded
|
107
105
|
const route = processor_1.Extensions.getHeaderValue(req, common_1.CommonTypes.ExtraHeader.EDGEPORT_REF)
|
108
106
|
? location_1.Helper.createRouteFromLastMessage(req)
|
109
107
|
: yield (0, router_1.router)(location, apiClient)(req);
|
110
108
|
if (!route)
|
111
109
|
return res.sendNotFound();
|
110
|
+
logger.error(JSON.stringify({ route }, null, 2));
|
112
111
|
// If route is not type Route then return
|
113
112
|
if (!("listeningPoints" in route)) {
|
114
113
|
return res.send(route);
|
@@ -120,13 +119,14 @@ const handleRequest = (location, apiClient) => (request, res) => __awaiter(void
|
|
120
119
|
// The order of the routes is important
|
121
120
|
processor_1.Alterations.addRouteToPeerEdgePort(route), processor_1.Alterations.addRouteToNextHop(route), processor_1.Alterations.addXEdgePortRef, processor_1.Alterations.decreaseMaxForwards));
|
122
121
|
}
|
122
|
+
// TODO: We should add this the Tailor API
|
123
|
+
req.metadata = route.metadata;
|
123
124
|
res.send((0, tailor_1.tailor)(route, req));
|
124
125
|
}
|
125
126
|
}
|
126
127
|
catch (err) {
|
127
|
-
res.sendInternalServerError();
|
128
128
|
logger.error(err);
|
129
|
-
|
129
|
+
res.sendInternalServerError();
|
130
130
|
}
|
131
131
|
});
|
132
132
|
exports.handleRequest = handleRequest;
|
package/dist/router.js
CHANGED
@@ -104,15 +104,24 @@ function router(location, apiClient) {
|
|
104
104
|
return failedCheck;
|
105
105
|
}
|
106
106
|
}
|
107
|
+
// We add metadata to the route object so we can use it later to link to an account
|
107
108
|
switch (routingDirection) {
|
108
|
-
case types_1.RoutingDirection.AGENT_TO_AGENT:
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
case types_1.RoutingDirection.
|
113
|
-
|
114
|
-
|
115
|
-
|
109
|
+
case types_1.RoutingDirection.AGENT_TO_AGENT: {
|
110
|
+
const route = yield agentToAgent(location, request);
|
111
|
+
return Object.assign(Object.assign({}, route), { metadata: caller.extended });
|
112
|
+
}
|
113
|
+
case types_1.RoutingDirection.AGENT_TO_PEER: {
|
114
|
+
const route = yield agentToPeer(location, callee, request);
|
115
|
+
return Object.assign(Object.assign({}, route), { metadata: caller.extended });
|
116
|
+
}
|
117
|
+
case types_1.RoutingDirection.AGENT_TO_PSTN: {
|
118
|
+
const route = yield agentToPSTN(request, caller, requestURI.user);
|
119
|
+
return Object.assign(Object.assign({}, route), { metadata: caller.extended });
|
120
|
+
}
|
121
|
+
case types_1.RoutingDirection.FROM_PSTN: {
|
122
|
+
const route = yield fromPSTN(apiClient, location, callee, request);
|
123
|
+
return Object.assign(Object.assign({}, route), { metadata: callee.extended });
|
124
|
+
}
|
116
125
|
case types_1.RoutingDirection.PEER_TO_PSTN:
|
117
126
|
return yield peerToPSTN(apiClient, request);
|
118
127
|
default:
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@routr/connect",
|
3
|
-
"version": "2.0.8-alpha.
|
3
|
+
"version": "2.0.8-alpha.42",
|
4
4
|
"description": "Default processor",
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
6
6
|
"homepage": "https://github.com/fonoster/routr#readme",
|
@@ -29,9 +29,9 @@
|
|
29
29
|
"@opentelemetry/sdk-trace-base": "^1.0.4",
|
30
30
|
"@opentelemetry/sdk-trace-node": "^1.0.4",
|
31
31
|
"@opentelemetry/semantic-conventions": "^1.0.4",
|
32
|
-
"@routr/common": "^2.0.8-alpha.
|
33
|
-
"@routr/location": "^2.0.8-alpha.
|
34
|
-
"@routr/processor": "^2.0.8-alpha.
|
32
|
+
"@routr/common": "^2.0.8-alpha.42",
|
33
|
+
"@routr/location": "^2.0.8-alpha.42",
|
34
|
+
"@routr/processor": "^2.0.8-alpha.42",
|
35
35
|
"jsonwebtoken": "^9.0.0"
|
36
36
|
},
|
37
37
|
"devDependencies": {
|
@@ -50,5 +50,5 @@
|
|
50
50
|
"bugs": {
|
51
51
|
"url": "https://github.com/fonoster/routr/issues"
|
52
52
|
},
|
53
|
-
"gitHead": "
|
53
|
+
"gitHead": "d52dbb834a74e0d0630521d5f9074ca25b0104c0"
|
54
54
|
}
|