@routr/processor 2.26.0 → 2.28.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.js +1 -30
- package/package.json +3 -3
package/dist/alterations.js
CHANGED
|
@@ -22,6 +22,7 @@ exports.swapIdentityFromRouteSet = exports.identityRewriteParameters = exports.r
|
|
|
22
22
|
const common_1 = require("@routr/common");
|
|
23
23
|
const phone_1 = require("phone");
|
|
24
24
|
const helper_1 = require("./helper");
|
|
25
|
+
const { IDENTITY_PARAMETERS, encodeIdentity, decodeIdentity } = common_1.Identity;
|
|
25
26
|
// Forces the requestURI to be the same as the trunk uri.
|
|
26
27
|
// This is a workaround for Twilio.
|
|
27
28
|
const fixRequestURI = (route) => (request) => {
|
|
@@ -372,36 +373,6 @@ const rewriteFromWithNumber = (route) => (request) => {
|
|
|
372
373
|
return req;
|
|
373
374
|
};
|
|
374
375
|
exports.rewriteFromWithNumber = rewriteFromWithNumber;
|
|
375
|
-
// The Record-Route parameter names: [r]ewritten [f]rom or [c]allee (To),
|
|
376
|
-
// [o]riginal/[n]ew. Not "rto": a parser that looks for a header by searching
|
|
377
|
-
// for its name (SIPp does) finds "To" inside "rto=" on the Record-Route line.
|
|
378
|
-
const IDENTITY_PARAMETERS = {
|
|
379
|
-
fromOriginal: "rfo",
|
|
380
|
-
fromNew: "rfn",
|
|
381
|
-
toOriginal: "rco",
|
|
382
|
-
toNew: "rcn"
|
|
383
|
-
};
|
|
384
|
-
// Base64url keeps the value a SIP token (RFC 3261 section 25.1), so it needs no
|
|
385
|
-
// quoting in the header and survives every hop unchanged
|
|
386
|
-
const encodeIdentity = (uri) => {
|
|
387
|
-
var _a;
|
|
388
|
-
return Buffer.from(`${(_a = uri.user) !== null && _a !== void 0 ? _a : ""}@${uri.host}${uri.userParam ? `;user=${uri.userParam}` : ""}`).toString("base64url");
|
|
389
|
-
};
|
|
390
|
-
const decodeIdentity = (value) => {
|
|
391
|
-
if (!value)
|
|
392
|
-
return undefined;
|
|
393
|
-
const decoded = Buffer.from(value, "base64url").toString("utf8");
|
|
394
|
-
const [address, userParam] = decoded.split(";user=");
|
|
395
|
-
const at = address.lastIndexOf("@");
|
|
396
|
-
if (at < 0)
|
|
397
|
-
return undefined;
|
|
398
|
-
const user = address.slice(0, at);
|
|
399
|
-
return {
|
|
400
|
-
user: user || undefined,
|
|
401
|
-
host: address.slice(at + 1),
|
|
402
|
-
userParam: userParam || undefined
|
|
403
|
-
};
|
|
404
|
-
};
|
|
405
376
|
const sameIdentity = (uri, identity) => {
|
|
406
377
|
var _a, _b, _c;
|
|
407
378
|
return !!identity &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routr/processor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.28.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.28.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": "bc70bbfe4a4c7086e71991302bb8e53533a0c8c8"
|
|
40
40
|
}
|