@voicenter-team/opensips-js 1.0.11 → 1.0.12

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.
@@ -0,0 +1,2 @@
1
+ import { SessionDirection } from 'jssip/lib/RTCSession';
2
+ export { SessionDirection };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SessionDirection = void 0;
4
+ const RTCSession_1 = require("jssip/lib/RTCSession");
5
+ Object.defineProperty(exports, "SessionDirection", { enumerable: true, get: function () { return RTCSession_1.SessionDirection; } });
package/build/index.js CHANGED
@@ -14,7 +14,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const jssip_1 = __importDefault(require("jssip"));
16
16
  const UA_1 = __importDefault(require("./helpers/UA"));
17
- const RTCSession_1 = require("jssip/lib/RTCSession");
18
17
  const p_iteration_1 = require("p-iteration");
19
18
  const time_helper_1 = require("./helpers/time.helper");
20
19
  const filter_helper_1 = require("./helpers/filter.helper");
@@ -272,7 +271,7 @@ class OpenSIPSJS extends UA_1.default {
272
271
  }
273
272
  _cancelAllOutgoingUnanswered() {
274
273
  Object.values(this.getActiveCalls).filter(call => {
275
- return call.direction === RTCSession_1.SessionDirection.OUTGOING
274
+ return call.direction === 'outgoing'
276
275
  && call.status === CALL_STATUS_UNANSWERED;
277
276
  }).forEach(call => this.callTerminate(call._id));
278
277
  }
@@ -413,7 +412,7 @@ class OpenSIPSJS extends UA_1.default {
413
412
  if (Object.values(activeCalls).filter(call => call.roomId === roomId).length === 0) {
414
413
  this.removeRoom(roomId);
415
414
  if (this.currentActiveRoomId === roomId) {
416
- this.currentActiveRoomId = roomId;
415
+ this.currentActiveRoomId = undefined;
417
416
  }
418
417
  }
419
418
  }
@@ -648,7 +647,7 @@ class OpenSIPSJS extends UA_1.default {
648
647
  incomingInProgress: false,
649
648
  roomId
650
649
  };
651
- if (session.direction === RTCSession_1.SessionDirection.INCOMING) {
650
+ if (session.direction === 'incoming') {
652
651
  newRoomInfo.incomingInProgress = true;
653
652
  this.subscribe(call_event_listener_type_1.CALL_EVENT_LISTENER_TYPE.CALL_CONFIRMED, (call) => {
654
653
  if (session.id === call.id) {
@@ -668,13 +667,13 @@ class OpenSIPSJS extends UA_1.default {
668
667
  }
669
668
  });
670
669
  }
671
- else if (session.direction === RTCSession_1.SessionDirection.OUTGOING) {
670
+ else if (session.direction === 'outgoing') {
672
671
  this._startCallTimer(session.id);
673
672
  }
674
673
  const call = session;
675
674
  call.roomId = roomId;
676
675
  call.localMuted = false;
677
- const doAutoAnswer = call.direction === RTCSession_1.SessionDirection.INCOMING && this.autoAnswer;
676
+ const doAutoAnswer = call.direction === 'incoming' && this.autoAnswer;
678
677
  if (doAutoAnswer) {
679
678
  this._addCall(call, false);
680
679
  }
@@ -720,6 +719,8 @@ class OpenSIPSJS extends UA_1.default {
720
719
  session.on('ended', (event) => {
721
720
  this._triggerListener({ listenerType: call_event_listener_type_1.CALL_EVENT_LISTENER_TYPE.CALL_ENDED, session, event });
722
721
  const s = this.getActiveCalls[session.id];
722
+ if (!s)
723
+ return;
723
724
  this._activeCallListRemove(s);
724
725
  this._stopCallTimer(session.id);
725
726
  this._removeCallStatus(session.id);
@@ -753,7 +754,7 @@ class OpenSIPSJS extends UA_1.default {
753
754
  }
754
755
  });
755
756
  this.addCall(session);
756
- if (session.direction === RTCSession_1.SessionDirection.OUTGOING) {
757
+ if (session.direction === 'outgoing') {
757
758
  const roomId = this.getActiveCalls[session.id].roomId;
758
759
  this.setCurrentActiveRoomId(roomId);
759
760
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voicenter-team/opensips-js",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "The JS package for opensips",
5
5
  "default": "src/index.ts",
6
6
  "main": "build/index.js",