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

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.
@@ -10,7 +10,7 @@ import Codec from "./codec.js";
10
10
  * This is the main entry point for making and receiving calls.
11
11
  * It orchestrates the SIP transport, registration, and call control.
12
12
  */
13
- declare class Softphone extends EventEmitter {
13
+ export declare class Softphone extends EventEmitter {
14
14
  readonly sipInfo: SoftPhoneOptions;
15
15
  readonly codec: Codec;
16
16
  private readonly transport;
package/dist/cjs/index.js CHANGED
@@ -17,6 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.Softphone = void 0;
20
21
  const node_events_1 = __importDefault(require("node:events"));
21
22
  const inbound_js_1 = __importDefault(require("./call-session/inbound.js"));
22
23
  const outbound_js_1 = __importDefault(require("./call-session/outbound.js"));
@@ -200,5 +201,6 @@ class Softphone extends node_events_1.default {
200
201
  return session;
201
202
  }
202
203
  }
204
+ exports.Softphone = Softphone;
203
205
  exports.default = Softphone;
204
206
  __exportStar(require("./errors/index.js"), exports);
@@ -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
  }
@@ -10,7 +10,7 @@ import Codec from "./codec.js";
10
10
  * This is the main entry point for making and receiving calls.
11
11
  * It orchestrates the SIP transport, registration, and call control.
12
12
  */
13
- declare class Softphone extends EventEmitter {
13
+ export declare class Softphone extends EventEmitter {
14
14
  readonly sipInfo: SoftPhoneOptions;
15
15
  readonly codec: Codec;
16
16
  private readonly transport;
package/dist/esm/index.js CHANGED
@@ -13,7 +13,7 @@ import Codec from "./codec.js";
13
13
  * This is the main entry point for making and receiving calls.
14
14
  * It orchestrates the SIP transport, registration, and call control.
15
15
  */
16
- class Softphone extends EventEmitter {
16
+ export class Softphone extends EventEmitter {
17
17
  sipInfo;
18
18
  codec;
19
19
  transport;
@@ -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.4",
4
4
  "homepage": "https://github.com/ringcentral/ringcentral-softphone-ts",
5
5
  "license": "MIT",
6
6
  "types": "dist/esm/index.d.ts",