@routr/connect 2.14.0 → 2.15.1
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/handlers/register.js +2 -1
- package/dist/handlers/request.js +13 -1
- package/dist/router.js +11 -3
- package/package.json +5 -5
|
@@ -71,6 +71,7 @@ const logger = (0, logger_1.getLogger)({ service: "connect", filePath: __filenam
|
|
|
71
71
|
const jwtVerifier = (0, utils_1.getVerifierImpl)();
|
|
72
72
|
const handleRegister = (apiClient, location) => {
|
|
73
73
|
return (request, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
74
|
+
var _a;
|
|
74
75
|
// Calculate and return challenge
|
|
75
76
|
if (request.message.authorization) {
|
|
76
77
|
const auth = Object.assign({}, request.message.authorization);
|
|
@@ -118,7 +119,7 @@ const handleRegister = (apiClient, location) => {
|
|
|
118
119
|
yield location.addRoute({
|
|
119
120
|
aor: payload.aor,
|
|
120
121
|
route: location_1.Helper.createRoute(request),
|
|
121
|
-
maxContacts: payload.maxContacts
|
|
122
|
+
maxContacts: (_a = payload.maxContacts) !== null && _a !== void 0 ? _a : -1
|
|
122
123
|
});
|
|
123
124
|
res.sendRegisterOk(request);
|
|
124
125
|
}
|
package/dist/handlers/request.js
CHANGED
|
@@ -76,7 +76,19 @@ const handleRequest = (location, apiClient) => (request, res) => __awaiter(void
|
|
|
76
76
|
try {
|
|
77
77
|
const req = common_1.Environment.ENFORCE_E164 ? enforceE164(request) : request;
|
|
78
78
|
let route;
|
|
79
|
-
|
|
79
|
+
// A CANCEL must follow the exact path its INVITE took (RFC 3261 §9.1) — it is
|
|
80
|
+
// never a new call to route. edgeport already forwards it correctly, straight
|
|
81
|
+
// from the INVITE's own client transaction (GRPCSipListener#sendCancel), which
|
|
82
|
+
// does not use the route this handler computes for CANCEL at all; it only needs
|
|
83
|
+
// a non-error response to reach that logic. Routing it fresh through
|
|
84
|
+
// peerToPSTN/agentToPSTN re-applies checks meant for a NEW call — chiefly
|
|
85
|
+
// peerToPSTN's required X-DOD-Number header, which Asterisk's CANCEL does not
|
|
86
|
+
// carry (only the original INVITE does) — and rejects it with a 400 that never
|
|
87
|
+
// reaches edgeport's already-correct CANCEL handling. The result: the CANCEL is
|
|
88
|
+
// silently dropped, the call keeps ringing, and if the callee answers a moment
|
|
89
|
+
// later they connect into a line the caller has already abandoned.
|
|
90
|
+
if (processor_1.Extensions.getHeaderValue(req, common_1.CommonTypes.ExtraHeader.EDGEPORT_REF) ||
|
|
91
|
+
req.method === common_1.CommonTypes.Method.CANCEL) {
|
|
80
92
|
route = location_1.Helper.createRouteFromLastMessage(req);
|
|
81
93
|
}
|
|
82
94
|
else {
|
package/dist/router.js
CHANGED
|
@@ -145,8 +145,13 @@ function router(location, apiClient) {
|
|
|
145
145
|
const route = yield fromPSTN(apiClient, location, callee, request);
|
|
146
146
|
return result(routingDirection, route, callee.extended);
|
|
147
147
|
}
|
|
148
|
-
case types_1.RoutingDirection.PEER_TO_PSTN:
|
|
149
|
-
|
|
148
|
+
case types_1.RoutingDirection.PEER_TO_PSTN: {
|
|
149
|
+
const routeOrResponse = yield peerToPSTN(apiClient, request);
|
|
150
|
+
// An error response (e.g. Bad Request, Not Found) is returned as-is
|
|
151
|
+
return "message" in routeOrResponse
|
|
152
|
+
? routeOrResponse
|
|
153
|
+
: result(routingDirection, routeOrResponse, callee === null || callee === void 0 ? void 0 : callee.extended);
|
|
154
|
+
}
|
|
150
155
|
default:
|
|
151
156
|
throw new errors_1.UnsupportedRoutingError(routingDirection);
|
|
152
157
|
}
|
|
@@ -277,9 +282,12 @@ function peerToPSTN(apiClient, req) {
|
|
|
277
282
|
return __awaiter(this, void 0, void 0, function* () {
|
|
278
283
|
const numberTel = processor_1.Extensions.getHeaderValue(req, common_1.CommonTypes.ExtraHeader.DOD_NUMBER);
|
|
279
284
|
const privacy = processor_1.Extensions.getHeaderValue(req, common_1.CommonTypes.ExtraHeader.DOD_PRIVACY);
|
|
285
|
+
if (!numberTel) {
|
|
286
|
+
return common_1.CommonResponse.createBadRequestResponse(`Missing or empty '${common_1.CommonTypes.ExtraHeader.DOD_NUMBER}' header required for peer-to-pstn routing`);
|
|
287
|
+
}
|
|
280
288
|
const number = yield (0, utils_1.findNumberByTelUrl)(apiClient, `tel:${numberTel}`);
|
|
281
289
|
if (!number) {
|
|
282
|
-
|
|
290
|
+
return common_1.CommonResponse.createNotFoundResponse(`No Number found for tel:${numberTel}`);
|
|
283
291
|
}
|
|
284
292
|
if (!number.trunk) {
|
|
285
293
|
// TODO: Create custom error
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routr/connect",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.1",
|
|
4
4
|
"description": "Default processor",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/routr#readme",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"@opentelemetry/sdk-trace-base": "^1.0.4",
|
|
29
29
|
"@opentelemetry/sdk-trace-node": "^1.0.4",
|
|
30
30
|
"@opentelemetry/semantic-conventions": "^1.0.4",
|
|
31
|
-
"@routr/common": "^2.
|
|
32
|
-
"@routr/location": "^2.
|
|
33
|
-
"@routr/processor": "^2.
|
|
31
|
+
"@routr/common": "^2.15.0",
|
|
32
|
+
"@routr/location": "^2.15.1",
|
|
33
|
+
"@routr/processor": "^2.15.1",
|
|
34
34
|
"jsonwebtoken": "^9.0.3"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"bugs": {
|
|
50
50
|
"url": "https://github.com/fonoster/routr/issues"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "2784f886cab933977feed3fe50edcaec0e6f7dac"
|
|
53
53
|
}
|