@voicenter-team/opensips-js 1.0.11 → 1.0.13

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) {
@@ -665,16 +664,17 @@ class OpenSIPSJS extends UA_1.default {
665
664
  incomingInProgress: false,
666
665
  roomId
667
666
  });
667
+ this.deleteRoomIfEmpty(roomId);
668
668
  }
669
669
  });
670
670
  }
671
- else if (session.direction === RTCSession_1.SessionDirection.OUTGOING) {
671
+ else if (session.direction === 'outgoing') {
672
672
  this._startCallTimer(session.id);
673
673
  }
674
674
  const call = session;
675
675
  call.roomId = roomId;
676
676
  call.localMuted = false;
677
- const doAutoAnswer = call.direction === RTCSession_1.SessionDirection.INCOMING && this.autoAnswer;
677
+ const doAutoAnswer = call.direction === 'incoming' && this.autoAnswer;
678
678
  if (doAutoAnswer) {
679
679
  this._addCall(call, false);
680
680
  }
@@ -720,7 +720,9 @@ class OpenSIPSJS extends UA_1.default {
720
720
  session.on('ended', (event) => {
721
721
  this._triggerListener({ listenerType: call_event_listener_type_1.CALL_EVENT_LISTENER_TYPE.CALL_ENDED, session, event });
722
722
  const s = this.getActiveCalls[session.id];
723
- this._activeCallListRemove(s);
723
+ if (s) {
724
+ this._activeCallListRemove(s);
725
+ }
724
726
  this._stopCallTimer(session.id);
725
727
  this._removeCallStatus(session.id);
726
728
  this._removeCallMetrics(session.id);
@@ -737,7 +739,9 @@ class OpenSIPSJS extends UA_1.default {
737
739
  this.callAddingInProgress = undefined;
738
740
  }
739
741
  const s = this.getActiveCalls[session.id];
740
- this._activeCallListRemove(s);
742
+ if (s) {
743
+ this._activeCallListRemove(s);
744
+ }
741
745
  this._stopCallTimer(session.id);
742
746
  this._removeCallStatus(session.id);
743
747
  this._removeCallMetrics(session.id);
@@ -753,7 +757,7 @@ class OpenSIPSJS extends UA_1.default {
753
757
  }
754
758
  });
755
759
  this.addCall(session);
756
- if (session.direction === RTCSession_1.SessionDirection.OUTGOING) {
760
+ if (session.direction === 'outgoing') {
757
761
  const roomId = this.getActiveCalls[session.id].roomId;
758
762
  this.setCurrentActiveRoomId(roomId);
759
763
  }
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.13",
4
4
  "description": "The JS package for opensips",
5
5
  "default": "src/index.ts",
6
6
  "main": "build/index.js",