@routr/rtprelay 2.2.0 → 2.4.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/client.js CHANGED
@@ -19,7 +19,7 @@ function offer(config) {
19
19
  return (request) => __awaiter(this, void 0, void 0, function* () {
20
20
  const direction = (0, utils_1.getDirectionFromRequest)(request);
21
21
  const sdpModifiers = (0, utils_1.getRTPEParamsByDirection)(direction);
22
- return yield rtpe.offer(config, Object.assign(Object.assign({}, sdpModifiers), { sdp: request.message.body, "call-id": request.message.callId.callId, "from-tag": request.message.from.tag, "to-tag": request.message.to.tag }));
22
+ return yield rtpe.offer(config, Object.assign(Object.assign({}, sdpModifiers), { sdp: request.message.body, "call-id": request.message.callId.callId, "from-tag": request.message.from.tag }));
23
23
  });
24
24
  }
25
25
  exports.offer = offer;
package/dist/service.js CHANGED
@@ -79,17 +79,11 @@ function rtprelay(bindAddr, rtpeConfig) {
79
79
  ? (0, utils_1.getDirectionFromResponse)(req)
80
80
  : (0, utils_1.getDirectionFromRequest)(req);
81
81
  const sendRequest = (f) => __awaiter(this, void 0, void 0, function* () {
82
- var _a;
83
82
  const r = yield f(rtpeConfig)(req);
84
83
  if (r.result === "error") {
85
84
  throw new common_1.CommonErrors.BadRequestError(r["error-reason"]);
86
85
  }
87
- if ((0, utils_1.callInvolvesWebRTC)(direction)) {
88
- req.message.body = (_a = r.sdp) === null || _a === void 0 ? void 0 : _a.replaceAll("a=crypto:", "a=ignore:").replaceAll("a=sendrecv", "a=sendrecv\na=rtcp-mux");
89
- }
90
- else {
91
- req.message.body = r.sdp;
92
- }
86
+ req.message.body = r.sdp;
93
87
  return res.send(req);
94
88
  });
95
89
  if (processor_1.Helper.isInviteOrAckWithSDP(req)) {
package/dist/utils.d.ts CHANGED
@@ -6,21 +6,21 @@ export declare function getDirection(srcTransport: CT.Transport, dstTransport: C
6
6
  export declare function getRTPEParamsByDirection(dir: Direction): {
7
7
  ICE: string;
8
8
  SDES: string;
9
- flags: string;
9
+ flags: string[];
10
10
  "transport-protocol"?: undefined;
11
11
  "rtcp-mux"?: undefined;
12
12
  } | {
13
13
  "transport-protocol": string;
14
14
  "rtcp-mux": string;
15
15
  ICE: string;
16
- flags: string;
16
+ flags: string[];
17
17
  SDES?: undefined;
18
18
  } | {
19
19
  "transport-protocol": string;
20
20
  "rtcp-mux": string;
21
21
  ICE: string;
22
22
  SDES: string;
23
- flags: string;
23
+ flags: string[];
24
24
  };
25
25
  export declare const callInvolvesWebRTC: (direction: Direction) => boolean;
26
26
  export declare const shouldNotHandleRequest: (req: MessageRequest) => boolean;
package/dist/utils.js CHANGED
@@ -9,7 +9,8 @@ function getDirectionFromResponse(request) {
9
9
  return getDirection(srcTransport, dstTransport);
10
10
  }
11
11
  exports.getDirectionFromResponse = getDirectionFromResponse;
12
- // Will be able to determine the direction with Request-URI and Route header
12
+ // Will should be able to determine the direction with Request-URI and Route header
13
+ // WARNING: Seems like a duplicated code
13
14
  function getDirectionFromRequest(request) {
14
15
  const srcTransport = request.sender.transport;
15
16
  const dstTransport = request.message.via[0].transport;
@@ -35,14 +36,14 @@ function getRTPEParamsByDirection(dir) {
35
36
  return {
36
37
  ICE: "force",
37
38
  SDES: "off",
38
- flags: "trust-address replace-origin replace-session-connection"
39
+ flags: ["trust-address", "replace-origin", "replace-session-connection"]
39
40
  };
40
41
  case types_1.Direction.WEB_TO_PHONE:
41
42
  return {
42
43
  "transport-protocol": "RTP/AVP",
43
44
  "rtcp-mux": "demux",
44
45
  ICE: "remove",
45
- flags: "trust-address replace-origin replace-session-connection"
46
+ flags: ["trust-address", "replace-origin", "replace-session-connection"]
46
47
  };
47
48
  case types_1.Direction.PHONE_TO_WEB:
48
49
  return {
@@ -50,14 +51,19 @@ function getRTPEParamsByDirection(dir) {
50
51
  "rtcp-mux": "required",
51
52
  ICE: "force",
52
53
  SDES: "off",
53
- flags: "trust-address replace-origin replace-session-connection generate-mid"
54
+ flags: [
55
+ "trust-address",
56
+ "replace-origin",
57
+ "replace-session-connection",
58
+ "generate-mid"
59
+ ]
54
60
  };
55
61
  case types_1.Direction.PHONE_TO_PHONE:
56
62
  return {
57
63
  "transport-protocol": "RTP/AVP",
58
64
  "rtcp-mux": "demux",
59
65
  ICE: "remove",
60
- flags: "trust-address replace-origin replace-session-connection"
66
+ flags: ["trust-address", "replace-origin", "replace-session-connection"]
61
67
  };
62
68
  }
63
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routr/rtprelay",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "Media Relay for Routr using RTPengine",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/routr#readme",
@@ -28,8 +28,8 @@
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.2.0",
32
- "@routr/processor": "^2.2.0",
31
+ "@routr/common": "^2.4.0",
32
+ "@routr/processor": "^2.4.0",
33
33
  "rtpengine-client": "^0.4.11"
34
34
  },
35
35
  "files": [
@@ -45,5 +45,5 @@
45
45
  "bugs": {
46
46
  "url": "https://github.com/fonoster/routr/issues"
47
47
  },
48
- "gitHead": "924c7d8711a7855635e52184d8ece28587febf48"
48
+ "gitHead": "704808be190e0fc8b07ceb3d98c15758c5c6c33c"
49
49
  }