@wazo/sdk 0.37.30 → 0.37.31

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.
Files changed (42) hide show
  1. package/dist/wazo-sdk.js +4 -4
  2. package/esm/domain/CallSession.js +1 -1
  3. package/esm/domain/Phone/CTIPhone.js +1 -1
  4. package/esm/domain/Phone/WebRTCPhone.js +10 -2
  5. package/esm/domain/__tests__/CallSession.test.js +1 -1
  6. package/esm/domain/__tests__/IndirectTransfer.test.js +1 -1
  7. package/esm/domain/__tests__/Room.test.js +1 -1
  8. package/esm/index.js +10 -2
  9. package/esm/simple/Auth.js +10 -2
  10. package/esm/simple/Configuration.js +10 -2
  11. package/esm/simple/Phone.js +10 -2
  12. package/esm/simple/index.js +10 -2
  13. package/esm/simple/room/LocalParticipant.js +10 -2
  14. package/esm/simple/room/Participant.js +10 -2
  15. package/esm/simple/room/RemoteParticipant.js +10 -2
  16. package/esm/simple/room/Room.js +10 -2
  17. package/esm/simple/room/SipRoom.js +10 -2
  18. package/esm/simple/room/Stream.js +10 -2
  19. package/esm/simple/room/__tests__/RemoteParticipant.test.js +10 -2
  20. package/esm/simple/utils.js +10 -2
  21. package/lib/domain/CallSession.js +1 -1
  22. package/lib/domain/Phone/CTIPhone.js +1 -1
  23. package/lib/domain/Phone/WebRTCPhone.js +10 -2
  24. package/lib/domain/__tests__/CallSession.test.js +1 -1
  25. package/lib/domain/__tests__/IndirectTransfer.test.js +1 -1
  26. package/lib/domain/__tests__/Room.test.js +1 -1
  27. package/lib/index.js +10 -2
  28. package/lib/simple/Auth.js +10 -2
  29. package/lib/simple/Configuration.js +10 -2
  30. package/lib/simple/Phone.js +10 -2
  31. package/lib/simple/index.js +10 -2
  32. package/lib/simple/room/LocalParticipant.js +10 -2
  33. package/lib/simple/room/Participant.js +10 -2
  34. package/lib/simple/room/RemoteParticipant.js +10 -2
  35. package/lib/simple/room/Room.js +10 -2
  36. package/lib/simple/room/SipRoom.js +10 -2
  37. package/lib/simple/room/Stream.js +10 -2
  38. package/lib/simple/room/__tests__/RemoteParticipant.test.js +10 -2
  39. package/lib/simple/utils.js +10 -2
  40. package/package.json +1 -1
  41. package/src/domain/CallSession.js +1 -1
  42. package/src/domain/Phone/WebRTCPhone.js +9 -1
@@ -3584,7 +3584,7 @@ class CallSession {
3584
3584
 
3585
3585
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
3586
3586
  set answered(value ) {
3587
- this.answerTime = value ? new Date() : null;
3587
+ this.answerTime = value ? this.answerTime || new Date() : null;
3588
3588
  }
3589
3589
 
3590
3590
  get answered() {
@@ -9357,6 +9357,7 @@ class WebRTCPhone extends Emitter {
9357
9357
  }
9358
9358
 
9359
9359
  callSession.answerTime = new Date();
9360
+ this._updateCallSession(callSession);
9360
9361
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9361
9362
 
9362
9363
  return callSession;
@@ -9573,6 +9574,7 @@ class WebRTCPhone extends Emitter {
9573
9574
 
9574
9575
  this.shouldSendReinvite = false;
9575
9576
  callSession.answerTime = new Date();
9577
+ this._updateCallSession(callSession);
9576
9578
  this.acceptedSessions[callSession.getId()] = true;
9577
9579
 
9578
9580
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9672,7 +9674,7 @@ class WebRTCPhone extends Emitter {
9672
9674
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9673
9675
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9674
9676
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9675
- this.holdSipSession(this.currentSipSession, callSession);
9677
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9676
9678
  }
9677
9679
 
9678
9680
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9883,6 +9885,7 @@ class WebRTCPhone extends Emitter {
9883
9885
  }
9884
9886
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9885
9887
  callSession.creationTime = new Date();
9888
+ this._updateCallSession(callSession);
9886
9889
 
9887
9890
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9888
9891
 
@@ -10162,6 +10165,8 @@ class WebRTCPhone extends Emitter {
10162
10165
  }
10163
10166
 
10164
10167
  callSession.creationTime = new Date();
10168
+ this._updateCallSession(callSession);
10169
+
10165
10170
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10166
10171
  });
10167
10172
 
@@ -10205,6 +10210,8 @@ class WebRTCPhone extends Emitter {
10205
10210
  logger$7.info('WebRTC call rejected', session.id);
10206
10211
  const callSession = this._createCallSession(session);
10207
10212
  callSession.endTime = new Date();
10213
+ this._updateCallSession(callSession);
10214
+
10208
10215
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10209
10216
  });
10210
10217
 
@@ -10429,6 +10436,7 @@ class WebRTCPhone extends Emitter {
10429
10436
  displayName: identity ? identity.displayName || number : number,
10430
10437
  startTime: fromSession ? fromSession.startTime : new Date(),
10431
10438
  creationTime: fromSession ? fromSession.creationTime : null,
10439
+ answerTime: fromSession ? fromSession.answerTime : null,
10432
10440
  endTime: fromSession ? fromSession.endTime : null,
10433
10441
  answered: state === SessionState.Established,
10434
10442
  paused: this.client.isCallHeld(sipSession),
@@ -3584,7 +3584,7 @@ class CallSession {
3584
3584
 
3585
3585
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
3586
3586
  set answered(value ) {
3587
- this.answerTime = value ? new Date() : null;
3587
+ this.answerTime = value ? this.answerTime || new Date() : null;
3588
3588
  }
3589
3589
 
3590
3590
  get answered() {
@@ -9357,6 +9357,7 @@ class WebRTCPhone extends Emitter {
9357
9357
  }
9358
9358
 
9359
9359
  callSession.answerTime = new Date();
9360
+ this._updateCallSession(callSession);
9360
9361
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9361
9362
 
9362
9363
  return callSession;
@@ -9573,6 +9574,7 @@ class WebRTCPhone extends Emitter {
9573
9574
 
9574
9575
  this.shouldSendReinvite = false;
9575
9576
  callSession.answerTime = new Date();
9577
+ this._updateCallSession(callSession);
9576
9578
  this.acceptedSessions[callSession.getId()] = true;
9577
9579
 
9578
9580
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9672,7 +9674,7 @@ class WebRTCPhone extends Emitter {
9672
9674
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9673
9675
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9674
9676
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9675
- this.holdSipSession(this.currentSipSession, callSession);
9677
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9676
9678
  }
9677
9679
 
9678
9680
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9883,6 +9885,7 @@ class WebRTCPhone extends Emitter {
9883
9885
  }
9884
9886
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9885
9887
  callSession.creationTime = new Date();
9888
+ this._updateCallSession(callSession);
9886
9889
 
9887
9890
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9888
9891
 
@@ -10162,6 +10165,8 @@ class WebRTCPhone extends Emitter {
10162
10165
  }
10163
10166
 
10164
10167
  callSession.creationTime = new Date();
10168
+ this._updateCallSession(callSession);
10169
+
10165
10170
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10166
10171
  });
10167
10172
 
@@ -10205,6 +10210,8 @@ class WebRTCPhone extends Emitter {
10205
10210
  logger$7.info('WebRTC call rejected', session.id);
10206
10211
  const callSession = this._createCallSession(session);
10207
10212
  callSession.endTime = new Date();
10213
+ this._updateCallSession(callSession);
10214
+
10208
10215
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10209
10216
  });
10210
10217
 
@@ -10429,6 +10436,7 @@ class WebRTCPhone extends Emitter {
10429
10436
  displayName: identity ? identity.displayName || number : number,
10430
10437
  startTime: fromSession ? fromSession.startTime : new Date(),
10431
10438
  creationTime: fromSession ? fromSession.creationTime : null,
10439
+ answerTime: fromSession ? fromSession.answerTime : null,
10432
10440
  endTime: fromSession ? fromSession.endTime : null,
10433
10441
  answered: state === SessionState.Established,
10434
10442
  paused: this.client.isCallHeld(sipSession),
@@ -3584,7 +3584,7 @@ class CallSession {
3584
3584
 
3585
3585
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
3586
3586
  set answered(value ) {
3587
- this.answerTime = value ? new Date() : null;
3587
+ this.answerTime = value ? this.answerTime || new Date() : null;
3588
3588
  }
3589
3589
 
3590
3590
  get answered() {
@@ -9357,6 +9357,7 @@ class WebRTCPhone extends Emitter {
9357
9357
  }
9358
9358
 
9359
9359
  callSession.answerTime = new Date();
9360
+ this._updateCallSession(callSession);
9360
9361
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9361
9362
 
9362
9363
  return callSession;
@@ -9573,6 +9574,7 @@ class WebRTCPhone extends Emitter {
9573
9574
 
9574
9575
  this.shouldSendReinvite = false;
9575
9576
  callSession.answerTime = new Date();
9577
+ this._updateCallSession(callSession);
9576
9578
  this.acceptedSessions[callSession.getId()] = true;
9577
9579
 
9578
9580
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9672,7 +9674,7 @@ class WebRTCPhone extends Emitter {
9672
9674
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9673
9675
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9674
9676
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9675
- this.holdSipSession(this.currentSipSession, callSession);
9677
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9676
9678
  }
9677
9679
 
9678
9680
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9883,6 +9885,7 @@ class WebRTCPhone extends Emitter {
9883
9885
  }
9884
9886
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9885
9887
  callSession.creationTime = new Date();
9888
+ this._updateCallSession(callSession);
9886
9889
 
9887
9890
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9888
9891
 
@@ -10162,6 +10165,8 @@ class WebRTCPhone extends Emitter {
10162
10165
  }
10163
10166
 
10164
10167
  callSession.creationTime = new Date();
10168
+ this._updateCallSession(callSession);
10169
+
10165
10170
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10166
10171
  });
10167
10172
 
@@ -10205,6 +10210,8 @@ class WebRTCPhone extends Emitter {
10205
10210
  logger$7.info('WebRTC call rejected', session.id);
10206
10211
  const callSession = this._createCallSession(session);
10207
10212
  callSession.endTime = new Date();
10213
+ this._updateCallSession(callSession);
10214
+
10208
10215
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10209
10216
  });
10210
10217
 
@@ -10429,6 +10436,7 @@ class WebRTCPhone extends Emitter {
10429
10436
  displayName: identity ? identity.displayName || number : number,
10430
10437
  startTime: fromSession ? fromSession.startTime : new Date(),
10431
10438
  creationTime: fromSession ? fromSession.creationTime : null,
10439
+ answerTime: fromSession ? fromSession.answerTime : null,
10432
10440
  endTime: fromSession ? fromSession.endTime : null,
10433
10441
  answered: state === SessionState.Established,
10434
10442
  paused: this.client.isCallHeld(sipSession),
@@ -3584,7 +3584,7 @@ class CallSession {
3584
3584
 
3585
3585
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
3586
3586
  set answered(value ) {
3587
- this.answerTime = value ? new Date() : null;
3587
+ this.answerTime = value ? this.answerTime || new Date() : null;
3588
3588
  }
3589
3589
 
3590
3590
  get answered() {
@@ -9357,6 +9357,7 @@ class WebRTCPhone extends Emitter {
9357
9357
  }
9358
9358
 
9359
9359
  callSession.answerTime = new Date();
9360
+ this._updateCallSession(callSession);
9360
9361
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9361
9362
 
9362
9363
  return callSession;
@@ -9573,6 +9574,7 @@ class WebRTCPhone extends Emitter {
9573
9574
 
9574
9575
  this.shouldSendReinvite = false;
9575
9576
  callSession.answerTime = new Date();
9577
+ this._updateCallSession(callSession);
9576
9578
  this.acceptedSessions[callSession.getId()] = true;
9577
9579
 
9578
9580
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9672,7 +9674,7 @@ class WebRTCPhone extends Emitter {
9672
9674
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9673
9675
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9674
9676
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9675
- this.holdSipSession(this.currentSipSession, callSession);
9677
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9676
9678
  }
9677
9679
 
9678
9680
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9883,6 +9885,7 @@ class WebRTCPhone extends Emitter {
9883
9885
  }
9884
9886
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9885
9887
  callSession.creationTime = new Date();
9888
+ this._updateCallSession(callSession);
9886
9889
 
9887
9890
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9888
9891
 
@@ -10162,6 +10165,8 @@ class WebRTCPhone extends Emitter {
10162
10165
  }
10163
10166
 
10164
10167
  callSession.creationTime = new Date();
10168
+ this._updateCallSession(callSession);
10169
+
10165
10170
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10166
10171
  });
10167
10172
 
@@ -10205,6 +10210,8 @@ class WebRTCPhone extends Emitter {
10205
10210
  logger$7.info('WebRTC call rejected', session.id);
10206
10211
  const callSession = this._createCallSession(session);
10207
10212
  callSession.endTime = new Date();
10213
+ this._updateCallSession(callSession);
10214
+
10208
10215
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10209
10216
  });
10210
10217
 
@@ -10429,6 +10436,7 @@ class WebRTCPhone extends Emitter {
10429
10436
  displayName: identity ? identity.displayName || number : number,
10430
10437
  startTime: fromSession ? fromSession.startTime : new Date(),
10431
10438
  creationTime: fromSession ? fromSession.creationTime : null,
10439
+ answerTime: fromSession ? fromSession.answerTime : null,
10432
10440
  endTime: fromSession ? fromSession.endTime : null,
10433
10441
  answered: state === SessionState.Established,
10434
10442
  paused: this.client.isCallHeld(sipSession),
@@ -3584,7 +3584,7 @@ class CallSession {
3584
3584
 
3585
3585
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
3586
3586
  set answered(value ) {
3587
- this.answerTime = value ? new Date() : null;
3587
+ this.answerTime = value ? this.answerTime || new Date() : null;
3588
3588
  }
3589
3589
 
3590
3590
  get answered() {
@@ -9357,6 +9357,7 @@ class WebRTCPhone extends Emitter {
9357
9357
  }
9358
9358
 
9359
9359
  callSession.answerTime = new Date();
9360
+ this._updateCallSession(callSession);
9360
9361
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9361
9362
 
9362
9363
  return callSession;
@@ -9573,6 +9574,7 @@ class WebRTCPhone extends Emitter {
9573
9574
 
9574
9575
  this.shouldSendReinvite = false;
9575
9576
  callSession.answerTime = new Date();
9577
+ this._updateCallSession(callSession);
9576
9578
  this.acceptedSessions[callSession.getId()] = true;
9577
9579
 
9578
9580
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9672,7 +9674,7 @@ class WebRTCPhone extends Emitter {
9672
9674
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9673
9675
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9674
9676
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9675
- this.holdSipSession(this.currentSipSession, callSession);
9677
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9676
9678
  }
9677
9679
 
9678
9680
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9883,6 +9885,7 @@ class WebRTCPhone extends Emitter {
9883
9885
  }
9884
9886
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9885
9887
  callSession.creationTime = new Date();
9888
+ this._updateCallSession(callSession);
9886
9889
 
9887
9890
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9888
9891
 
@@ -10162,6 +10165,8 @@ class WebRTCPhone extends Emitter {
10162
10165
  }
10163
10166
 
10164
10167
  callSession.creationTime = new Date();
10168
+ this._updateCallSession(callSession);
10169
+
10165
10170
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10166
10171
  });
10167
10172
 
@@ -10205,6 +10210,8 @@ class WebRTCPhone extends Emitter {
10205
10210
  logger$7.info('WebRTC call rejected', session.id);
10206
10211
  const callSession = this._createCallSession(session);
10207
10212
  callSession.endTime = new Date();
10213
+ this._updateCallSession(callSession);
10214
+
10208
10215
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10209
10216
  });
10210
10217
 
@@ -10429,6 +10436,7 @@ class WebRTCPhone extends Emitter {
10429
10436
  displayName: identity ? identity.displayName || number : number,
10430
10437
  startTime: fromSession ? fromSession.startTime : new Date(),
10431
10438
  creationTime: fromSession ? fromSession.creationTime : null,
10439
+ answerTime: fromSession ? fromSession.answerTime : null,
10432
10440
  endTime: fromSession ? fromSession.endTime : null,
10433
10441
  answered: state === SessionState.Established,
10434
10442
  paused: this.client.isCallHeld(sipSession),
@@ -370,7 +370,7 @@ class CallSession {
370
370
 
371
371
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
372
372
  set answered(value ) {
373
- this.answerTime = value ? new Date() : null;
373
+ this.answerTime = value ? this.answerTime || new Date() : null;
374
374
  }
375
375
 
376
376
  get answered() {
@@ -2051,7 +2051,7 @@ class CallSession {
2051
2051
 
2052
2052
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
2053
2053
  set answered(value ) {
2054
- this.answerTime = value ? new Date() : null;
2054
+ this.answerTime = value ? this.answerTime || new Date() : null;
2055
2055
  }
2056
2056
 
2057
2057
  get answered() {
@@ -399,7 +399,7 @@ class CallSession {
399
399
 
400
400
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
401
401
  set answered(value ) {
402
- this.answerTime = value ? new Date() : null;
402
+ this.answerTime = value ? this.answerTime || new Date() : null;
403
403
  }
404
404
 
405
405
  get answered() {
@@ -1513,6 +1513,7 @@ class WebRTCPhone extends Emitter {
1513
1513
  }
1514
1514
 
1515
1515
  callSession.answerTime = new Date();
1516
+ this._updateCallSession(callSession);
1516
1517
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
1517
1518
 
1518
1519
  return callSession;
@@ -1729,6 +1730,7 @@ class WebRTCPhone extends Emitter {
1729
1730
 
1730
1731
  this.shouldSendReinvite = false;
1731
1732
  callSession.answerTime = new Date();
1733
+ this._updateCallSession(callSession);
1732
1734
  this.acceptedSessions[callSession.getId()] = true;
1733
1735
 
1734
1736
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -1828,7 +1830,7 @@ class WebRTCPhone extends Emitter {
1828
1830
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
1829
1831
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
1830
1832
  logger.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
1831
- this.holdSipSession(this.currentSipSession, callSession);
1833
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
1832
1834
  }
1833
1835
 
1834
1836
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -2039,6 +2041,7 @@ class WebRTCPhone extends Emitter {
2039
2041
  }
2040
2042
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
2041
2043
  callSession.creationTime = new Date();
2044
+ this._updateCallSession(callSession);
2042
2045
 
2043
2046
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
2044
2047
 
@@ -2318,6 +2321,8 @@ class WebRTCPhone extends Emitter {
2318
2321
  }
2319
2322
 
2320
2323
  callSession.creationTime = new Date();
2324
+ this._updateCallSession(callSession);
2325
+
2321
2326
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
2322
2327
  });
2323
2328
 
@@ -2361,6 +2366,8 @@ class WebRTCPhone extends Emitter {
2361
2366
  logger.info('WebRTC call rejected', session.id);
2362
2367
  const callSession = this._createCallSession(session);
2363
2368
  callSession.endTime = new Date();
2369
+ this._updateCallSession(callSession);
2370
+
2364
2371
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
2365
2372
  });
2366
2373
 
@@ -2585,6 +2592,7 @@ class WebRTCPhone extends Emitter {
2585
2592
  displayName: identity ? identity.displayName || number : number,
2586
2593
  startTime: fromSession ? fromSession.startTime : new Date(),
2587
2594
  creationTime: fromSession ? fromSession.creationTime : null,
2595
+ answerTime: fromSession ? fromSession.answerTime : null,
2588
2596
  endTime: fromSession ? fromSession.endTime : null,
2589
2597
  answered: state === sessionState.SessionState.Established,
2590
2598
  paused: this.client.isCallHeld(sipSession),
@@ -370,7 +370,7 @@ class CallSession {
370
370
 
371
371
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
372
372
  set answered(value ) {
373
- this.answerTime = value ? new Date() : null;
373
+ this.answerTime = value ? this.answerTime || new Date() : null;
374
374
  }
375
375
 
376
376
  get answered() {
@@ -370,7 +370,7 @@ class CallSession {
370
370
 
371
371
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
372
372
  set answered(value ) {
373
- this.answerTime = value ? new Date() : null;
373
+ this.answerTime = value ? this.answerTime || new Date() : null;
374
374
  }
375
375
 
376
376
  get answered() {
@@ -370,7 +370,7 @@ class CallSession {
370
370
 
371
371
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
372
372
  set answered(value ) {
373
- this.answerTime = value ? new Date() : null;
373
+ this.answerTime = value ? this.answerTime || new Date() : null;
374
374
  }
375
375
 
376
376
  get answered() {
package/lib/index.js CHANGED
@@ -3596,7 +3596,7 @@ class CallSession {
3596
3596
 
3597
3597
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
3598
3598
  set answered(value ) {
3599
- this.answerTime = value ? new Date() : null;
3599
+ this.answerTime = value ? this.answerTime || new Date() : null;
3600
3600
  }
3601
3601
 
3602
3602
  get answered() {
@@ -9831,6 +9831,7 @@ class WebRTCPhone extends Emitter {
9831
9831
  }
9832
9832
 
9833
9833
  callSession.answerTime = new Date();
9834
+ this._updateCallSession(callSession);
9834
9835
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9835
9836
 
9836
9837
  return callSession;
@@ -10047,6 +10048,7 @@ class WebRTCPhone extends Emitter {
10047
10048
 
10048
10049
  this.shouldSendReinvite = false;
10049
10050
  callSession.answerTime = new Date();
10051
+ this._updateCallSession(callSession);
10050
10052
  this.acceptedSessions[callSession.getId()] = true;
10051
10053
 
10052
10054
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -10146,7 +10148,7 @@ class WebRTCPhone extends Emitter {
10146
10148
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
10147
10149
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
10148
10150
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
10149
- this.holdSipSession(this.currentSipSession, callSession);
10151
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
10150
10152
  }
10151
10153
 
10152
10154
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -10357,6 +10359,7 @@ class WebRTCPhone extends Emitter {
10357
10359
  }
10358
10360
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
10359
10361
  callSession.creationTime = new Date();
10362
+ this._updateCallSession(callSession);
10360
10363
 
10361
10364
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
10362
10365
 
@@ -10636,6 +10639,8 @@ class WebRTCPhone extends Emitter {
10636
10639
  }
10637
10640
 
10638
10641
  callSession.creationTime = new Date();
10642
+ this._updateCallSession(callSession);
10643
+
10639
10644
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10640
10645
  });
10641
10646
 
@@ -10679,6 +10684,8 @@ class WebRTCPhone extends Emitter {
10679
10684
  logger$7.info('WebRTC call rejected', session.id);
10680
10685
  const callSession = this._createCallSession(session);
10681
10686
  callSession.endTime = new Date();
10687
+ this._updateCallSession(callSession);
10688
+
10682
10689
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10683
10690
  });
10684
10691
 
@@ -10903,6 +10910,7 @@ class WebRTCPhone extends Emitter {
10903
10910
  displayName: identity ? identity.displayName || number : number,
10904
10911
  startTime: fromSession ? fromSession.startTime : new Date(),
10905
10912
  creationTime: fromSession ? fromSession.creationTime : null,
10913
+ answerTime: fromSession ? fromSession.answerTime : null,
10906
10914
  endTime: fromSession ? fromSession.endTime : null,
10907
10915
  answered: state === sessionState.SessionState.Established,
10908
10916
  paused: this.client.isCallHeld(sipSession),
@@ -3596,7 +3596,7 @@ class CallSession {
3596
3596
 
3597
3597
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
3598
3598
  set answered(value ) {
3599
- this.answerTime = value ? new Date() : null;
3599
+ this.answerTime = value ? this.answerTime || new Date() : null;
3600
3600
  }
3601
3601
 
3602
3602
  get answered() {
@@ -9105,6 +9105,7 @@ class WebRTCPhone extends Emitter {
9105
9105
  }
9106
9106
 
9107
9107
  callSession.answerTime = new Date();
9108
+ this._updateCallSession(callSession);
9108
9109
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9109
9110
 
9110
9111
  return callSession;
@@ -9321,6 +9322,7 @@ class WebRTCPhone extends Emitter {
9321
9322
 
9322
9323
  this.shouldSendReinvite = false;
9323
9324
  callSession.answerTime = new Date();
9325
+ this._updateCallSession(callSession);
9324
9326
  this.acceptedSessions[callSession.getId()] = true;
9325
9327
 
9326
9328
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9420,7 +9422,7 @@ class WebRTCPhone extends Emitter {
9420
9422
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9421
9423
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9422
9424
  logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9423
- this.holdSipSession(this.currentSipSession, callSession);
9425
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9424
9426
  }
9425
9427
 
9426
9428
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9631,6 +9633,7 @@ class WebRTCPhone extends Emitter {
9631
9633
  }
9632
9634
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9633
9635
  callSession.creationTime = new Date();
9636
+ this._updateCallSession(callSession);
9634
9637
 
9635
9638
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9636
9639
 
@@ -9910,6 +9913,8 @@ class WebRTCPhone extends Emitter {
9910
9913
  }
9911
9914
 
9912
9915
  callSession.creationTime = new Date();
9916
+ this._updateCallSession(callSession);
9917
+
9913
9918
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
9914
9919
  });
9915
9920
 
@@ -9953,6 +9958,8 @@ class WebRTCPhone extends Emitter {
9953
9958
  logger$8.info('WebRTC call rejected', session.id);
9954
9959
  const callSession = this._createCallSession(session);
9955
9960
  callSession.endTime = new Date();
9961
+ this._updateCallSession(callSession);
9962
+
9956
9963
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
9957
9964
  });
9958
9965
 
@@ -10177,6 +10184,7 @@ class WebRTCPhone extends Emitter {
10177
10184
  displayName: identity ? identity.displayName || number : number,
10178
10185
  startTime: fromSession ? fromSession.startTime : new Date(),
10179
10186
  creationTime: fromSession ? fromSession.creationTime : null,
10187
+ answerTime: fromSession ? fromSession.answerTime : null,
10180
10188
  endTime: fromSession ? fromSession.endTime : null,
10181
10189
  answered: state === sessionState.SessionState.Established,
10182
10190
  paused: this.client.isCallHeld(sipSession),
@@ -3594,7 +3594,7 @@ class CallSession {
3594
3594
 
3595
3595
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
3596
3596
  set answered(value ) {
3597
- this.answerTime = value ? new Date() : null;
3597
+ this.answerTime = value ? this.answerTime || new Date() : null;
3598
3598
  }
3599
3599
 
3600
3600
  get answered() {
@@ -9103,6 +9103,7 @@ class WebRTCPhone extends Emitter {
9103
9103
  }
9104
9104
 
9105
9105
  callSession.answerTime = new Date();
9106
+ this._updateCallSession(callSession);
9106
9107
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9107
9108
 
9108
9109
  return callSession;
@@ -9319,6 +9320,7 @@ class WebRTCPhone extends Emitter {
9319
9320
 
9320
9321
  this.shouldSendReinvite = false;
9321
9322
  callSession.answerTime = new Date();
9323
+ this._updateCallSession(callSession);
9322
9324
  this.acceptedSessions[callSession.getId()] = true;
9323
9325
 
9324
9326
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9418,7 +9420,7 @@ class WebRTCPhone extends Emitter {
9418
9420
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9419
9421
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9420
9422
  logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9421
- this.holdSipSession(this.currentSipSession, callSession);
9423
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9422
9424
  }
9423
9425
 
9424
9426
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9629,6 +9631,7 @@ class WebRTCPhone extends Emitter {
9629
9631
  }
9630
9632
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9631
9633
  callSession.creationTime = new Date();
9634
+ this._updateCallSession(callSession);
9632
9635
 
9633
9636
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9634
9637
 
@@ -9908,6 +9911,8 @@ class WebRTCPhone extends Emitter {
9908
9911
  }
9909
9912
 
9910
9913
  callSession.creationTime = new Date();
9914
+ this._updateCallSession(callSession);
9915
+
9911
9916
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
9912
9917
  });
9913
9918
 
@@ -9951,6 +9956,8 @@ class WebRTCPhone extends Emitter {
9951
9956
  logger$8.info('WebRTC call rejected', session.id);
9952
9957
  const callSession = this._createCallSession(session);
9953
9958
  callSession.endTime = new Date();
9959
+ this._updateCallSession(callSession);
9960
+
9954
9961
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
9955
9962
  });
9956
9963
 
@@ -10175,6 +10182,7 @@ class WebRTCPhone extends Emitter {
10175
10182
  displayName: identity ? identity.displayName || number : number,
10176
10183
  startTime: fromSession ? fromSession.startTime : new Date(),
10177
10184
  creationTime: fromSession ? fromSession.creationTime : null,
10185
+ answerTime: fromSession ? fromSession.answerTime : null,
10178
10186
  endTime: fromSession ? fromSession.endTime : null,
10179
10187
  answered: state === sessionState.SessionState.Established,
10180
10188
  paused: this.client.isCallHeld(sipSession),