ringcentral-softphone 1.4.0-beta.2 → 1.4.0-beta.3

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.
@@ -9,11 +9,15 @@ class ResponseMessage extends index_js_1.default {
9
9
  constructor(inboundMessage, responseCode, headers = {}, body = "") {
10
10
  super(undefined, { ...headers }, body);
11
11
  this.subject = `SIP/2.0 ${responseCode} ${response_codes_js_1.default[responseCode]}`;
12
- // server-side sometimes uses "Call-Id" instead of "Call-ID"
13
- const keys = ["Via", "From", "To", "Call-ID", "Call-Id", "CSeq"];
14
- for (const key of keys) {
15
- if (inboundMessage.headers[key]) {
16
- this.headers[key] = inboundMessage.headers[key];
12
+ const requiredKeys = new Set(["via", "from", "to", "call-id", "cseq"]);
13
+ const allKeys = Object.keys(inboundMessage.headers).reduce((acc, key) => {
14
+ acc[key.toLowerCase()] = key;
15
+ return acc;
16
+ }, {});
17
+ for (const key of requiredKeys) {
18
+ if (allKeys[key]) {
19
+ const originalKey = allKeys[key];
20
+ this.headers[originalKey] = inboundMessage.headers[originalKey];
17
21
  }
18
22
  }
19
23
  }
@@ -4,11 +4,15 @@ class ResponseMessage extends OutboundMessage {
4
4
  constructor(inboundMessage, responseCode, headers = {}, body = "") {
5
5
  super(undefined, { ...headers }, body);
6
6
  this.subject = `SIP/2.0 ${responseCode} ${responseCodes[responseCode]}`;
7
- // server-side sometimes uses "Call-Id" instead of "Call-ID"
8
- const keys = ["Via", "From", "To", "Call-ID", "Call-Id", "CSeq"];
9
- for (const key of keys) {
10
- if (inboundMessage.headers[key]) {
11
- this.headers[key] = inboundMessage.headers[key];
7
+ const requiredKeys = new Set(["via", "from", "to", "call-id", "cseq"]);
8
+ const allKeys = Object.keys(inboundMessage.headers).reduce((acc, key) => {
9
+ acc[key.toLowerCase()] = key;
10
+ return acc;
11
+ }, {});
12
+ for (const key of requiredKeys) {
13
+ if (allKeys[key]) {
14
+ const originalKey = allKeys[key];
15
+ this.headers[originalKey] = inboundMessage.headers[originalKey];
12
16
  }
13
17
  }
14
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ringcentral-softphone",
3
- "version": "1.4.0-beta.2",
3
+ "version": "1.4.0-beta.3",
4
4
  "homepage": "https://github.com/ringcentral/ringcentral-softphone-ts",
5
5
  "license": "MIT",
6
6
  "types": "dist/esm/index.d.ts",