@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
@@ -368,7 +368,7 @@ class CallSession {
368
368
 
369
369
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
370
370
  set answered(value ) {
371
- this.answerTime = value ? new Date() : null;
371
+ this.answerTime = value ? this.answerTime || new Date() : null;
372
372
  }
373
373
 
374
374
  get answered() {
@@ -2042,7 +2042,7 @@ class CallSession {
2042
2042
 
2043
2043
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
2044
2044
  set answered(value ) {
2045
- this.answerTime = value ? new Date() : null;
2045
+ this.answerTime = value ? this.answerTime || new Date() : null;
2046
2046
  }
2047
2047
 
2048
2048
  get answered() {
@@ -390,7 +390,7 @@ class CallSession {
390
390
 
391
391
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
392
392
  set answered(value ) {
393
- this.answerTime = value ? new Date() : null;
393
+ this.answerTime = value ? this.answerTime || new Date() : null;
394
394
  }
395
395
 
396
396
  get answered() {
@@ -1504,6 +1504,7 @@ class WebRTCPhone extends Emitter {
1504
1504
  }
1505
1505
 
1506
1506
  callSession.answerTime = new Date();
1507
+ this._updateCallSession(callSession);
1507
1508
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
1508
1509
 
1509
1510
  return callSession;
@@ -1720,6 +1721,7 @@ class WebRTCPhone extends Emitter {
1720
1721
 
1721
1722
  this.shouldSendReinvite = false;
1722
1723
  callSession.answerTime = new Date();
1724
+ this._updateCallSession(callSession);
1723
1725
  this.acceptedSessions[callSession.getId()] = true;
1724
1726
 
1725
1727
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -1819,7 +1821,7 @@ class WebRTCPhone extends Emitter {
1819
1821
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
1820
1822
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
1821
1823
  logger.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
1822
- this.holdSipSession(this.currentSipSession, callSession);
1824
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
1823
1825
  }
1824
1826
 
1825
1827
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -2030,6 +2032,7 @@ class WebRTCPhone extends Emitter {
2030
2032
  }
2031
2033
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
2032
2034
  callSession.creationTime = new Date();
2035
+ this._updateCallSession(callSession);
2033
2036
 
2034
2037
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
2035
2038
 
@@ -2309,6 +2312,8 @@ class WebRTCPhone extends Emitter {
2309
2312
  }
2310
2313
 
2311
2314
  callSession.creationTime = new Date();
2315
+ this._updateCallSession(callSession);
2316
+
2312
2317
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
2313
2318
  });
2314
2319
 
@@ -2352,6 +2357,8 @@ class WebRTCPhone extends Emitter {
2352
2357
  logger.info('WebRTC call rejected', session.id);
2353
2358
  const callSession = this._createCallSession(session);
2354
2359
  callSession.endTime = new Date();
2360
+ this._updateCallSession(callSession);
2361
+
2355
2362
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
2356
2363
  });
2357
2364
 
@@ -2576,6 +2583,7 @@ class WebRTCPhone extends Emitter {
2576
2583
  displayName: identity ? identity.displayName || number : number,
2577
2584
  startTime: fromSession ? fromSession.startTime : new Date(),
2578
2585
  creationTime: fromSession ? fromSession.creationTime : null,
2586
+ answerTime: fromSession ? fromSession.answerTime : null,
2579
2587
  endTime: fromSession ? fromSession.endTime : null,
2580
2588
  answered: state === SessionState.Established,
2581
2589
  paused: this.client.isCallHeld(sipSession),
@@ -368,7 +368,7 @@ class CallSession {
368
368
 
369
369
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
370
370
  set answered(value ) {
371
- this.answerTime = value ? new Date() : null;
371
+ this.answerTime = value ? this.answerTime || new Date() : null;
372
372
  }
373
373
 
374
374
  get answered() {
@@ -368,7 +368,7 @@ class CallSession {
368
368
 
369
369
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
370
370
  set answered(value ) {
371
- this.answerTime = value ? new Date() : null;
371
+ this.answerTime = value ? this.answerTime || new Date() : null;
372
372
  }
373
373
 
374
374
  get answered() {
@@ -368,7 +368,7 @@ class CallSession {
368
368
 
369
369
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
370
370
  set answered(value ) {
371
- this.answerTime = value ? new Date() : null;
371
+ this.answerTime = value ? this.answerTime || new Date() : null;
372
372
  }
373
373
 
374
374
  get answered() {
package/esm/index.js CHANGED
@@ -3585,7 +3585,7 @@ class CallSession {
3585
3585
 
3586
3586
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
3587
3587
  set answered(value ) {
3588
- this.answerTime = value ? new Date() : null;
3588
+ this.answerTime = value ? this.answerTime || new Date() : null;
3589
3589
  }
3590
3590
 
3591
3591
  get answered() {
@@ -9820,6 +9820,7 @@ class WebRTCPhone extends Emitter {
9820
9820
  }
9821
9821
 
9822
9822
  callSession.answerTime = new Date();
9823
+ this._updateCallSession(callSession);
9823
9824
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9824
9825
 
9825
9826
  return callSession;
@@ -10036,6 +10037,7 @@ class WebRTCPhone extends Emitter {
10036
10037
 
10037
10038
  this.shouldSendReinvite = false;
10038
10039
  callSession.answerTime = new Date();
10040
+ this._updateCallSession(callSession);
10039
10041
  this.acceptedSessions[callSession.getId()] = true;
10040
10042
 
10041
10043
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -10135,7 +10137,7 @@ class WebRTCPhone extends Emitter {
10135
10137
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
10136
10138
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
10137
10139
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
10138
- this.holdSipSession(this.currentSipSession, callSession);
10140
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
10139
10141
  }
10140
10142
 
10141
10143
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -10346,6 +10348,7 @@ class WebRTCPhone extends Emitter {
10346
10348
  }
10347
10349
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
10348
10350
  callSession.creationTime = new Date();
10351
+ this._updateCallSession(callSession);
10349
10352
 
10350
10353
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
10351
10354
 
@@ -10625,6 +10628,8 @@ class WebRTCPhone extends Emitter {
10625
10628
  }
10626
10629
 
10627
10630
  callSession.creationTime = new Date();
10631
+ this._updateCallSession(callSession);
10632
+
10628
10633
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10629
10634
  });
10630
10635
 
@@ -10668,6 +10673,8 @@ class WebRTCPhone extends Emitter {
10668
10673
  logger$7.info('WebRTC call rejected', session.id);
10669
10674
  const callSession = this._createCallSession(session);
10670
10675
  callSession.endTime = new Date();
10676
+ this._updateCallSession(callSession);
10677
+
10671
10678
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10672
10679
  });
10673
10680
 
@@ -10892,6 +10899,7 @@ class WebRTCPhone extends Emitter {
10892
10899
  displayName: identity ? identity.displayName || number : number,
10893
10900
  startTime: fromSession ? fromSession.startTime : new Date(),
10894
10901
  creationTime: fromSession ? fromSession.creationTime : null,
10902
+ answerTime: fromSession ? fromSession.answerTime : null,
10895
10903
  endTime: fromSession ? fromSession.endTime : null,
10896
10904
  answered: state === SessionState.Established,
10897
10905
  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() {
@@ -9093,6 +9093,7 @@ class WebRTCPhone extends Emitter {
9093
9093
  }
9094
9094
 
9095
9095
  callSession.answerTime = new Date();
9096
+ this._updateCallSession(callSession);
9096
9097
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9097
9098
 
9098
9099
  return callSession;
@@ -9309,6 +9310,7 @@ class WebRTCPhone extends Emitter {
9309
9310
 
9310
9311
  this.shouldSendReinvite = false;
9311
9312
  callSession.answerTime = new Date();
9313
+ this._updateCallSession(callSession);
9312
9314
  this.acceptedSessions[callSession.getId()] = true;
9313
9315
 
9314
9316
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9408,7 +9410,7 @@ class WebRTCPhone extends Emitter {
9408
9410
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9409
9411
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9410
9412
  logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9411
- this.holdSipSession(this.currentSipSession, callSession);
9413
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9412
9414
  }
9413
9415
 
9414
9416
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9619,6 +9621,7 @@ class WebRTCPhone extends Emitter {
9619
9621
  }
9620
9622
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9621
9623
  callSession.creationTime = new Date();
9624
+ this._updateCallSession(callSession);
9622
9625
 
9623
9626
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9624
9627
 
@@ -9898,6 +9901,8 @@ class WebRTCPhone extends Emitter {
9898
9901
  }
9899
9902
 
9900
9903
  callSession.creationTime = new Date();
9904
+ this._updateCallSession(callSession);
9905
+
9901
9906
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
9902
9907
  });
9903
9908
 
@@ -9941,6 +9946,8 @@ class WebRTCPhone extends Emitter {
9941
9946
  logger$8.info('WebRTC call rejected', session.id);
9942
9947
  const callSession = this._createCallSession(session);
9943
9948
  callSession.endTime = new Date();
9949
+ this._updateCallSession(callSession);
9950
+
9944
9951
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
9945
9952
  });
9946
9953
 
@@ -10165,6 +10172,7 @@ class WebRTCPhone extends Emitter {
10165
10172
  displayName: identity ? identity.displayName || number : number,
10166
10173
  startTime: fromSession ? fromSession.startTime : new Date(),
10167
10174
  creationTime: fromSession ? fromSession.creationTime : null,
10175
+ answerTime: fromSession ? fromSession.answerTime : null,
10168
10176
  endTime: fromSession ? fromSession.endTime : null,
10169
10177
  answered: state === SessionState.Established,
10170
10178
  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() {
@@ -9093,6 +9093,7 @@ class WebRTCPhone extends Emitter {
9093
9093
  }
9094
9094
 
9095
9095
  callSession.answerTime = new Date();
9096
+ this._updateCallSession(callSession);
9096
9097
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9097
9098
 
9098
9099
  return callSession;
@@ -9309,6 +9310,7 @@ class WebRTCPhone extends Emitter {
9309
9310
 
9310
9311
  this.shouldSendReinvite = false;
9311
9312
  callSession.answerTime = new Date();
9313
+ this._updateCallSession(callSession);
9312
9314
  this.acceptedSessions[callSession.getId()] = true;
9313
9315
 
9314
9316
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9408,7 +9410,7 @@ class WebRTCPhone extends Emitter {
9408
9410
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9409
9411
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9410
9412
  logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9411
- this.holdSipSession(this.currentSipSession, callSession);
9413
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9412
9414
  }
9413
9415
 
9414
9416
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9619,6 +9621,7 @@ class WebRTCPhone extends Emitter {
9619
9621
  }
9620
9622
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9621
9623
  callSession.creationTime = new Date();
9624
+ this._updateCallSession(callSession);
9622
9625
 
9623
9626
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9624
9627
 
@@ -9898,6 +9901,8 @@ class WebRTCPhone extends Emitter {
9898
9901
  }
9899
9902
 
9900
9903
  callSession.creationTime = new Date();
9904
+ this._updateCallSession(callSession);
9905
+
9901
9906
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
9902
9907
  });
9903
9908
 
@@ -9941,6 +9946,8 @@ class WebRTCPhone extends Emitter {
9941
9946
  logger$8.info('WebRTC call rejected', session.id);
9942
9947
  const callSession = this._createCallSession(session);
9943
9948
  callSession.endTime = new Date();
9949
+ this._updateCallSession(callSession);
9950
+
9944
9951
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
9945
9952
  });
9946
9953
 
@@ -10165,6 +10172,7 @@ class WebRTCPhone extends Emitter {
10165
10172
  displayName: identity ? identity.displayName || number : number,
10166
10173
  startTime: fromSession ? fromSession.startTime : new Date(),
10167
10174
  creationTime: fromSession ? fromSession.creationTime : null,
10175
+ answerTime: fromSession ? fromSession.answerTime : null,
10168
10176
  endTime: fromSession ? fromSession.endTime : null,
10169
10177
  answered: state === SessionState.Established,
10170
10178
  paused: this.client.isCallHeld(sipSession),
@@ -584,7 +584,7 @@ class CallSession {
584
584
 
585
585
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
586
586
  set answered(value ) {
587
- this.answerTime = value ? new Date() : null;
587
+ this.answerTime = value ? this.answerTime || new Date() : null;
588
588
  }
589
589
 
590
590
  get answered() {
@@ -9093,6 +9093,7 @@ class WebRTCPhone extends Emitter {
9093
9093
  }
9094
9094
 
9095
9095
  callSession.answerTime = new Date();
9096
+ this._updateCallSession(callSession);
9096
9097
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9097
9098
 
9098
9099
  return callSession;
@@ -9309,6 +9310,7 @@ class WebRTCPhone extends Emitter {
9309
9310
 
9310
9311
  this.shouldSendReinvite = false;
9311
9312
  callSession.answerTime = new Date();
9313
+ this._updateCallSession(callSession);
9312
9314
  this.acceptedSessions[callSession.getId()] = true;
9313
9315
 
9314
9316
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9408,7 +9410,7 @@ class WebRTCPhone extends Emitter {
9408
9410
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9409
9411
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9410
9412
  logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9411
- this.holdSipSession(this.currentSipSession, callSession);
9413
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9412
9414
  }
9413
9415
 
9414
9416
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9619,6 +9621,7 @@ class WebRTCPhone extends Emitter {
9619
9621
  }
9620
9622
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9621
9623
  callSession.creationTime = new Date();
9624
+ this._updateCallSession(callSession);
9622
9625
 
9623
9626
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9624
9627
 
@@ -9898,6 +9901,8 @@ class WebRTCPhone extends Emitter {
9898
9901
  }
9899
9902
 
9900
9903
  callSession.creationTime = new Date();
9904
+ this._updateCallSession(callSession);
9905
+
9901
9906
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
9902
9907
  });
9903
9908
 
@@ -9941,6 +9946,8 @@ class WebRTCPhone extends Emitter {
9941
9946
  logger$8.info('WebRTC call rejected', session.id);
9942
9947
  const callSession = this._createCallSession(session);
9943
9948
  callSession.endTime = new Date();
9949
+ this._updateCallSession(callSession);
9950
+
9944
9951
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
9945
9952
  });
9946
9953
 
@@ -10165,6 +10172,7 @@ class WebRTCPhone extends Emitter {
10165
10172
  displayName: identity ? identity.displayName || number : number,
10166
10173
  startTime: fromSession ? fromSession.startTime : new Date(),
10167
10174
  creationTime: fromSession ? fromSession.creationTime : null,
10175
+ answerTime: fromSession ? fromSession.answerTime : null,
10168
10176
  endTime: fromSession ? fromSession.endTime : null,
10169
10177
  answered: state === SessionState.Established,
10170
10178
  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),
@@ -3610,7 +3610,7 @@ class CallSession {
3610
3610
 
3611
3611
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
3612
3612
  set answered(value ) {
3613
- this.answerTime = value ? new Date() : null;
3613
+ this.answerTime = value ? this.answerTime || new Date() : null;
3614
3614
  }
3615
3615
 
3616
3616
  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),
@@ -3610,7 +3610,7 @@ class CallSession {
3610
3610
 
3611
3611
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
3612
3612
  set answered(value ) {
3613
- this.answerTime = value ? new Date() : null;
3613
+ this.answerTime = value ? this.answerTime || new Date() : null;
3614
3614
  }
3615
3615
 
3616
3616
  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),