@routr/processor 2.23.0 → 2.24.0
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/alterations.d.ts +1 -1
- package/dist/alterations.js +13 -12
- package/package.json +3 -3
package/dist/alterations.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare const removeTopVia: (request: MessageRequest) => MessageRequest;
|
|
|
16
16
|
export declare const decreaseMaxForwards: (request: MessageRequest) => MessageRequest;
|
|
17
17
|
export declare const fixInvalidContact: (request: MessageRequest) => MessageRequest;
|
|
18
18
|
export declare const overwriteContactWithSenderInfo: (request: MessageRequest) => MessageRequest;
|
|
19
|
-
export declare const
|
|
19
|
+
export declare const normalizeToE164: (normalizeToE164: boolean) => (request: MessageRequest) => MessageRequest;
|
|
20
20
|
/**
|
|
21
21
|
* Whether a From is the anonymous identity (RFC 3323, SIP Connect 1.1 section 9).
|
|
22
22
|
* A caller that asked for privacy keeps it, so such a From is never rewritten.
|
package/dist/alterations.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.swapIdentityFromRouteSet = exports.identityRewriteParameters = exports.rewriteFromWithNumber = exports.isAnonymous = exports.
|
|
3
|
+
exports.swapIdentityFromRouteSet = exports.identityRewriteParameters = exports.rewriteFromWithNumber = exports.isAnonymous = exports.normalizeToE164 = exports.overwriteContactWithSenderInfo = exports.fixInvalidContact = exports.decreaseMaxForwards = exports.removeTopVia = exports.removeSelfRoutes = exports.removeAuthorization = exports.removeHeaders = exports.removeXEdgePortRef = exports.addXEdgePortRef = exports.addSelfRecordRoute = exports.applyXHeaders = exports.addRouteToPeerEdgePort = exports.addRouteToNextHop = exports.addSelfViaUsingExternalAddrs = exports.addSelfViaUsingTheRouteHeaders = exports.addSelfVia = exports.fixRequestURI = void 0;
|
|
4
4
|
/*
|
|
5
5
|
* Copyright (C) 2026 by Fonoster Inc (https://fonoster.com)
|
|
6
6
|
* http://github.com/fonoster/routr
|
|
@@ -298,11 +298,16 @@ const overwriteContactWithSenderInfo = (request) => {
|
|
|
298
298
|
};
|
|
299
299
|
exports.overwriteContactWithSenderInfo = overwriteContactWithSenderInfo;
|
|
300
300
|
// Will do the best effort to normalize from/to/requestUri users as e164 values.
|
|
301
|
-
// Connect applies it per Trunk (spec.
|
|
301
|
+
// Connect applies it per Trunk (spec.normalizeToE164), on the way in before routing
|
|
302
302
|
// and on the way out through the tailor.
|
|
303
|
-
|
|
303
|
+
//
|
|
304
|
+
// The phone library validates mobile prefixes by default, which rejects
|
|
305
|
+
// landlines; that check is off everywhere, so any valid number is normalized.
|
|
306
|
+
// (The first version did the same; a later port turned it on for From alone.)
|
|
307
|
+
const normalize = (user) => (0, phone_1.phone)(`+${user}`, { validateMobilePrefix: false });
|
|
308
|
+
const normalizeToE164 = (normalizeToE164) => (request) => {
|
|
304
309
|
var _a, _b, _c;
|
|
305
|
-
if (!
|
|
310
|
+
if (!normalizeToE164)
|
|
306
311
|
return request;
|
|
307
312
|
const req = common_1.Helper.deepCopy(request);
|
|
308
313
|
// Removes the + to ensure not having duplicates
|
|
@@ -310,13 +315,9 @@ const enforceE164 = (enforceE164, validateMobilePrefix) => (request) => {
|
|
|
310
315
|
const toUser = (_b = req.message.to.address.uri.user) === null || _b === void 0 ? void 0 : _b.replace("+", "");
|
|
311
316
|
const requestUriUser = (_c = req.message.requestUri.user) === null || _c === void 0 ? void 0 : _c.replace("+", "");
|
|
312
317
|
// Normalizing as e164
|
|
313
|
-
const normalizedTo = (
|
|
314
|
-
const normalizedFrom = (
|
|
315
|
-
|
|
316
|
-
});
|
|
317
|
-
const normalizedReqUri = (0, phone_1.phone)(`+${requestUriUser}`, {
|
|
318
|
-
validateMobilePrefix
|
|
319
|
-
});
|
|
318
|
+
const normalizedTo = normalize(toUser);
|
|
319
|
+
const normalizedFrom = normalize(fromUser);
|
|
320
|
+
const normalizedReqUri = normalize(requestUriUser);
|
|
320
321
|
// If the normalization worked we overwrite the original values
|
|
321
322
|
if (normalizedFrom.isValid) {
|
|
322
323
|
req.message.from.address.uri.user = normalizedFrom.phoneNumber;
|
|
@@ -329,7 +330,7 @@ const enforceE164 = (enforceE164, validateMobilePrefix) => (request) => {
|
|
|
329
330
|
}
|
|
330
331
|
return req;
|
|
331
332
|
};
|
|
332
|
-
exports.
|
|
333
|
+
exports.normalizeToE164 = normalizeToE164;
|
|
333
334
|
/**
|
|
334
335
|
* Whether a From is the anonymous identity (RFC 3323, SIP Connect 1.1 section 9).
|
|
335
336
|
* A caller that asked for privacy keeps it, so such a From is never rewritten.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routr/processor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.0",
|
|
4
4
|
"description": "Processor server and API",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/routr#readme",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@fonoster/logger": "0.6.0",
|
|
16
16
|
"@grpc/grpc-js": "~1.14.6",
|
|
17
17
|
"@grpc/proto-loader": "~0.7.10",
|
|
18
|
-
"@routr/common": "^2.
|
|
18
|
+
"@routr/common": "^2.24.0",
|
|
19
19
|
"fp-ts": "^2.11.8",
|
|
20
20
|
"phone": "^3.1.68"
|
|
21
21
|
},
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"bugs": {
|
|
37
37
|
"url": "https://github.com/fonoster/routr/issues"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "168637a54c6390bb7c79dc77a6e9f763d2ce2da2"
|
|
40
40
|
}
|