@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
@@ -594,7 +594,7 @@ class CallSession {
594
594
 
595
595
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
596
596
  set answered(value ) {
597
- this.answerTime = value ? new Date() : null;
597
+ this.answerTime = value ? this.answerTime || new Date() : null;
598
598
  }
599
599
 
600
600
  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),
@@ -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() {
@@ -9367,6 +9367,7 @@ class WebRTCPhone extends Emitter {
9367
9367
  }
9368
9368
 
9369
9369
  callSession.answerTime = new Date();
9370
+ this._updateCallSession(callSession);
9370
9371
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9371
9372
 
9372
9373
  return callSession;
@@ -9583,6 +9584,7 @@ class WebRTCPhone extends Emitter {
9583
9584
 
9584
9585
  this.shouldSendReinvite = false;
9585
9586
  callSession.answerTime = new Date();
9587
+ this._updateCallSession(callSession);
9586
9588
  this.acceptedSessions[callSession.getId()] = true;
9587
9589
 
9588
9590
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9682,7 +9684,7 @@ class WebRTCPhone extends Emitter {
9682
9684
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9683
9685
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9684
9686
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9685
- this.holdSipSession(this.currentSipSession, callSession);
9687
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9686
9688
  }
9687
9689
 
9688
9690
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9893,6 +9895,7 @@ class WebRTCPhone extends Emitter {
9893
9895
  }
9894
9896
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9895
9897
  callSession.creationTime = new Date();
9898
+ this._updateCallSession(callSession);
9896
9899
 
9897
9900
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9898
9901
 
@@ -10172,6 +10175,8 @@ class WebRTCPhone extends Emitter {
10172
10175
  }
10173
10176
 
10174
10177
  callSession.creationTime = new Date();
10178
+ this._updateCallSession(callSession);
10179
+
10175
10180
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10176
10181
  });
10177
10182
 
@@ -10215,6 +10220,8 @@ class WebRTCPhone extends Emitter {
10215
10220
  logger$7.info('WebRTC call rejected', session.id);
10216
10221
  const callSession = this._createCallSession(session);
10217
10222
  callSession.endTime = new Date();
10223
+ this._updateCallSession(callSession);
10224
+
10218
10225
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10219
10226
  });
10220
10227
 
@@ -10439,6 +10446,7 @@ class WebRTCPhone extends Emitter {
10439
10446
  displayName: identity ? identity.displayName || number : number,
10440
10447
  startTime: fromSession ? fromSession.startTime : new Date(),
10441
10448
  creationTime: fromSession ? fromSession.creationTime : null,
10449
+ answerTime: fromSession ? fromSession.answerTime : null,
10442
10450
  endTime: fromSession ? fromSession.endTime : null,
10443
10451
  answered: state === sessionState.SessionState.Established,
10444
10452
  paused: this.client.isCallHeld(sipSession),
@@ -3620,7 +3620,7 @@ class CallSession {
3620
3620
 
3621
3621
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
3622
3622
  set answered(value ) {
3623
- this.answerTime = value ? new Date() : null;
3623
+ this.answerTime = value ? this.answerTime || new Date() : null;
3624
3624
  }
3625
3625
 
3626
3626
  get answered() {
@@ -9367,6 +9367,7 @@ class WebRTCPhone extends Emitter {
9367
9367
  }
9368
9368
 
9369
9369
  callSession.answerTime = new Date();
9370
+ this._updateCallSession(callSession);
9370
9371
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9371
9372
 
9372
9373
  return callSession;
@@ -9583,6 +9584,7 @@ class WebRTCPhone extends Emitter {
9583
9584
 
9584
9585
  this.shouldSendReinvite = false;
9585
9586
  callSession.answerTime = new Date();
9587
+ this._updateCallSession(callSession);
9586
9588
  this.acceptedSessions[callSession.getId()] = true;
9587
9589
 
9588
9590
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9682,7 +9684,7 @@ class WebRTCPhone extends Emitter {
9682
9684
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9683
9685
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9684
9686
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9685
- this.holdSipSession(this.currentSipSession, callSession);
9687
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9686
9688
  }
9687
9689
 
9688
9690
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9893,6 +9895,7 @@ class WebRTCPhone extends Emitter {
9893
9895
  }
9894
9896
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9895
9897
  callSession.creationTime = new Date();
9898
+ this._updateCallSession(callSession);
9896
9899
 
9897
9900
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9898
9901
 
@@ -10172,6 +10175,8 @@ class WebRTCPhone extends Emitter {
10172
10175
  }
10173
10176
 
10174
10177
  callSession.creationTime = new Date();
10178
+ this._updateCallSession(callSession);
10179
+
10175
10180
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10176
10181
  });
10177
10182
 
@@ -10215,6 +10220,8 @@ class WebRTCPhone extends Emitter {
10215
10220
  logger$7.info('WebRTC call rejected', session.id);
10216
10221
  const callSession = this._createCallSession(session);
10217
10222
  callSession.endTime = new Date();
10223
+ this._updateCallSession(callSession);
10224
+
10218
10225
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10219
10226
  });
10220
10227
 
@@ -10439,6 +10446,7 @@ class WebRTCPhone extends Emitter {
10439
10446
  displayName: identity ? identity.displayName || number : number,
10440
10447
  startTime: fromSession ? fromSession.startTime : new Date(),
10441
10448
  creationTime: fromSession ? fromSession.creationTime : null,
10449
+ answerTime: fromSession ? fromSession.answerTime : null,
10442
10450
  endTime: fromSession ? fromSession.endTime : null,
10443
10451
  answered: state === sessionState.SessionState.Established,
10444
10452
  paused: this.client.isCallHeld(sipSession),
@@ -3620,7 +3620,7 @@ class CallSession {
3620
3620
 
3621
3621
  // Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
3622
3622
  set answered(value ) {
3623
- this.answerTime = value ? new Date() : null;
3623
+ this.answerTime = value ? this.answerTime || new Date() : null;
3624
3624
  }
3625
3625
 
3626
3626
  get answered() {
@@ -9367,6 +9367,7 @@ class WebRTCPhone extends Emitter {
9367
9367
  }
9368
9368
 
9369
9369
  callSession.answerTime = new Date();
9370
+ this._updateCallSession(callSession);
9370
9371
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9371
9372
 
9372
9373
  return callSession;
@@ -9583,6 +9584,7 @@ class WebRTCPhone extends Emitter {
9583
9584
 
9584
9585
  this.shouldSendReinvite = false;
9585
9586
  callSession.answerTime = new Date();
9587
+ this._updateCallSession(callSession);
9586
9588
  this.acceptedSessions[callSession.getId()] = true;
9587
9589
 
9588
9590
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9682,7 +9684,7 @@ class WebRTCPhone extends Emitter {
9682
9684
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9683
9685
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9684
9686
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9685
- this.holdSipSession(this.currentSipSession, callSession);
9687
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9686
9688
  }
9687
9689
 
9688
9690
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9893,6 +9895,7 @@ class WebRTCPhone extends Emitter {
9893
9895
  }
9894
9896
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9895
9897
  callSession.creationTime = new Date();
9898
+ this._updateCallSession(callSession);
9896
9899
 
9897
9900
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9898
9901
 
@@ -10172,6 +10175,8 @@ class WebRTCPhone extends Emitter {
10172
10175
  }
10173
10176
 
10174
10177
  callSession.creationTime = new Date();
10178
+ this._updateCallSession(callSession);
10179
+
10175
10180
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10176
10181
  });
10177
10182
 
@@ -10215,6 +10220,8 @@ class WebRTCPhone extends Emitter {
10215
10220
  logger$7.info('WebRTC call rejected', session.id);
10216
10221
  const callSession = this._createCallSession(session);
10217
10222
  callSession.endTime = new Date();
10223
+ this._updateCallSession(callSession);
10224
+
10218
10225
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10219
10226
  });
10220
10227
 
@@ -10439,6 +10446,7 @@ class WebRTCPhone extends Emitter {
10439
10446
  displayName: identity ? identity.displayName || number : number,
10440
10447
  startTime: fromSession ? fromSession.startTime : new Date(),
10441
10448
  creationTime: fromSession ? fromSession.creationTime : null,
10449
+ answerTime: fromSession ? fromSession.answerTime : null,
10442
10450
  endTime: fromSession ? fromSession.endTime : null,
10443
10451
  answered: state === sessionState.SessionState.Established,
10444
10452
  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() {
@@ -9367,6 +9367,7 @@ class WebRTCPhone extends Emitter {
9367
9367
  }
9368
9368
 
9369
9369
  callSession.answerTime = new Date();
9370
+ this._updateCallSession(callSession);
9370
9371
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9371
9372
 
9372
9373
  return callSession;
@@ -9583,6 +9584,7 @@ class WebRTCPhone extends Emitter {
9583
9584
 
9584
9585
  this.shouldSendReinvite = false;
9585
9586
  callSession.answerTime = new Date();
9587
+ this._updateCallSession(callSession);
9586
9588
  this.acceptedSessions[callSession.getId()] = true;
9587
9589
 
9588
9590
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9682,7 +9684,7 @@ class WebRTCPhone extends Emitter {
9682
9684
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9683
9685
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9684
9686
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9685
- this.holdSipSession(this.currentSipSession, callSession);
9687
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9686
9688
  }
9687
9689
 
9688
9690
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9893,6 +9895,7 @@ class WebRTCPhone extends Emitter {
9893
9895
  }
9894
9896
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9895
9897
  callSession.creationTime = new Date();
9898
+ this._updateCallSession(callSession);
9896
9899
 
9897
9900
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9898
9901
 
@@ -10172,6 +10175,8 @@ class WebRTCPhone extends Emitter {
10172
10175
  }
10173
10176
 
10174
10177
  callSession.creationTime = new Date();
10178
+ this._updateCallSession(callSession);
10179
+
10175
10180
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10176
10181
  });
10177
10182
 
@@ -10215,6 +10220,8 @@ class WebRTCPhone extends Emitter {
10215
10220
  logger$7.info('WebRTC call rejected', session.id);
10216
10221
  const callSession = this._createCallSession(session);
10217
10222
  callSession.endTime = new Date();
10223
+ this._updateCallSession(callSession);
10224
+
10218
10225
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10219
10226
  });
10220
10227
 
@@ -10439,6 +10446,7 @@ class WebRTCPhone extends Emitter {
10439
10446
  displayName: identity ? identity.displayName || number : number,
10440
10447
  startTime: fromSession ? fromSession.startTime : new Date(),
10441
10448
  creationTime: fromSession ? fromSession.creationTime : null,
10449
+ answerTime: fromSession ? fromSession.answerTime : null,
10442
10450
  endTime: fromSession ? fromSession.endTime : null,
10443
10451
  answered: state === sessionState.SessionState.Established,
10444
10452
  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() {
@@ -9369,6 +9369,7 @@ class WebRTCPhone extends Emitter {
9369
9369
  }
9370
9370
 
9371
9371
  callSession.answerTime = new Date();
9372
+ this._updateCallSession(callSession);
9372
9373
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9373
9374
 
9374
9375
  return callSession;
@@ -9585,6 +9586,7 @@ class WebRTCPhone extends Emitter {
9585
9586
 
9586
9587
  this.shouldSendReinvite = false;
9587
9588
  callSession.answerTime = new Date();
9589
+ this._updateCallSession(callSession);
9588
9590
  this.acceptedSessions[callSession.getId()] = true;
9589
9591
 
9590
9592
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9684,7 +9686,7 @@ class WebRTCPhone extends Emitter {
9684
9686
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9685
9687
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9686
9688
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9687
- this.holdSipSession(this.currentSipSession, callSession);
9689
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9688
9690
  }
9689
9691
 
9690
9692
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9895,6 +9897,7 @@ class WebRTCPhone extends Emitter {
9895
9897
  }
9896
9898
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9897
9899
  callSession.creationTime = new Date();
9900
+ this._updateCallSession(callSession);
9898
9901
 
9899
9902
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9900
9903
 
@@ -10174,6 +10177,8 @@ class WebRTCPhone extends Emitter {
10174
10177
  }
10175
10178
 
10176
10179
  callSession.creationTime = new Date();
10180
+ this._updateCallSession(callSession);
10181
+
10177
10182
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10178
10183
  });
10179
10184
 
@@ -10217,6 +10222,8 @@ class WebRTCPhone extends Emitter {
10217
10222
  logger$7.info('WebRTC call rejected', session.id);
10218
10223
  const callSession = this._createCallSession(session);
10219
10224
  callSession.endTime = new Date();
10225
+ this._updateCallSession(callSession);
10226
+
10220
10227
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10221
10228
  });
10222
10229
 
@@ -10441,6 +10448,7 @@ class WebRTCPhone extends Emitter {
10441
10448
  displayName: identity ? identity.displayName || number : number,
10442
10449
  startTime: fromSession ? fromSession.startTime : new Date(),
10443
10450
  creationTime: fromSession ? fromSession.creationTime : null,
10451
+ answerTime: fromSession ? fromSession.answerTime : null,
10444
10452
  endTime: fromSession ? fromSession.endTime : null,
10445
10453
  answered: state === sessionState.SessionState.Established,
10446
10454
  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() {
@@ -9367,6 +9367,7 @@ class WebRTCPhone extends Emitter {
9367
9367
  }
9368
9368
 
9369
9369
  callSession.answerTime = new Date();
9370
+ this._updateCallSession(callSession);
9370
9371
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9371
9372
 
9372
9373
  return callSession;
@@ -9583,6 +9584,7 @@ class WebRTCPhone extends Emitter {
9583
9584
 
9584
9585
  this.shouldSendReinvite = false;
9585
9586
  callSession.answerTime = new Date();
9587
+ this._updateCallSession(callSession);
9586
9588
  this.acceptedSessions[callSession.getId()] = true;
9587
9589
 
9588
9590
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9682,7 +9684,7 @@ class WebRTCPhone extends Emitter {
9682
9684
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9683
9685
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9684
9686
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9685
- this.holdSipSession(this.currentSipSession, callSession);
9687
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9686
9688
  }
9687
9689
 
9688
9690
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9893,6 +9895,7 @@ class WebRTCPhone extends Emitter {
9893
9895
  }
9894
9896
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9895
9897
  callSession.creationTime = new Date();
9898
+ this._updateCallSession(callSession);
9896
9899
 
9897
9900
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9898
9901
 
@@ -10172,6 +10175,8 @@ class WebRTCPhone extends Emitter {
10172
10175
  }
10173
10176
 
10174
10177
  callSession.creationTime = new Date();
10178
+ this._updateCallSession(callSession);
10179
+
10175
10180
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10176
10181
  });
10177
10182
 
@@ -10215,6 +10220,8 @@ class WebRTCPhone extends Emitter {
10215
10220
  logger$7.info('WebRTC call rejected', session.id);
10216
10221
  const callSession = this._createCallSession(session);
10217
10222
  callSession.endTime = new Date();
10223
+ this._updateCallSession(callSession);
10224
+
10218
10225
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10219
10226
  });
10220
10227
 
@@ -10439,6 +10446,7 @@ class WebRTCPhone extends Emitter {
10439
10446
  displayName: identity ? identity.displayName || number : number,
10440
10447
  startTime: fromSession ? fromSession.startTime : new Date(),
10441
10448
  creationTime: fromSession ? fromSession.creationTime : null,
10449
+ answerTime: fromSession ? fromSession.answerTime : null,
10442
10450
  endTime: fromSession ? fromSession.endTime : null,
10443
10451
  answered: state === sessionState.SessionState.Established,
10444
10452
  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() {
@@ -9367,6 +9367,7 @@ class WebRTCPhone extends Emitter {
9367
9367
  }
9368
9368
 
9369
9369
  callSession.answerTime = new Date();
9370
+ this._updateCallSession(callSession);
9370
9371
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9371
9372
 
9372
9373
  return callSession;
@@ -9583,6 +9584,7 @@ class WebRTCPhone extends Emitter {
9583
9584
 
9584
9585
  this.shouldSendReinvite = false;
9585
9586
  callSession.answerTime = new Date();
9587
+ this._updateCallSession(callSession);
9586
9588
  this.acceptedSessions[callSession.getId()] = true;
9587
9589
 
9588
9590
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9682,7 +9684,7 @@ class WebRTCPhone extends Emitter {
9682
9684
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9683
9685
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9684
9686
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9685
- this.holdSipSession(this.currentSipSession, callSession);
9687
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9686
9688
  }
9687
9689
 
9688
9690
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9893,6 +9895,7 @@ class WebRTCPhone extends Emitter {
9893
9895
  }
9894
9896
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9895
9897
  callSession.creationTime = new Date();
9898
+ this._updateCallSession(callSession);
9896
9899
 
9897
9900
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9898
9901
 
@@ -10172,6 +10175,8 @@ class WebRTCPhone extends Emitter {
10172
10175
  }
10173
10176
 
10174
10177
  callSession.creationTime = new Date();
10178
+ this._updateCallSession(callSession);
10179
+
10175
10180
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10176
10181
  });
10177
10182
 
@@ -10215,6 +10220,8 @@ class WebRTCPhone extends Emitter {
10215
10220
  logger$7.info('WebRTC call rejected', session.id);
10216
10221
  const callSession = this._createCallSession(session);
10217
10222
  callSession.endTime = new Date();
10223
+ this._updateCallSession(callSession);
10224
+
10218
10225
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10219
10226
  });
10220
10227
 
@@ -10439,6 +10446,7 @@ class WebRTCPhone extends Emitter {
10439
10446
  displayName: identity ? identity.displayName || number : number,
10440
10447
  startTime: fromSession ? fromSession.startTime : new Date(),
10441
10448
  creationTime: fromSession ? fromSession.creationTime : null,
10449
+ answerTime: fromSession ? fromSession.answerTime : null,
10442
10450
  endTime: fromSession ? fromSession.endTime : null,
10443
10451
  answered: state === sessionState.SessionState.Established,
10444
10452
  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() {
@@ -9367,6 +9367,7 @@ class WebRTCPhone extends Emitter {
9367
9367
  }
9368
9368
 
9369
9369
  callSession.answerTime = new Date();
9370
+ this._updateCallSession(callSession);
9370
9371
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9371
9372
 
9372
9373
  return callSession;
@@ -9583,6 +9584,7 @@ class WebRTCPhone extends Emitter {
9583
9584
 
9584
9585
  this.shouldSendReinvite = false;
9585
9586
  callSession.answerTime = new Date();
9587
+ this._updateCallSession(callSession);
9586
9588
  this.acceptedSessions[callSession.getId()] = true;
9587
9589
 
9588
9590
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9682,7 +9684,7 @@ class WebRTCPhone extends Emitter {
9682
9684
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9683
9685
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9684
9686
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9685
- this.holdSipSession(this.currentSipSession, callSession);
9687
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9686
9688
  }
9687
9689
 
9688
9690
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9893,6 +9895,7 @@ class WebRTCPhone extends Emitter {
9893
9895
  }
9894
9896
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9895
9897
  callSession.creationTime = new Date();
9898
+ this._updateCallSession(callSession);
9896
9899
 
9897
9900
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9898
9901
 
@@ -10172,6 +10175,8 @@ class WebRTCPhone extends Emitter {
10172
10175
  }
10173
10176
 
10174
10177
  callSession.creationTime = new Date();
10178
+ this._updateCallSession(callSession);
10179
+
10175
10180
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10176
10181
  });
10177
10182
 
@@ -10215,6 +10220,8 @@ class WebRTCPhone extends Emitter {
10215
10220
  logger$7.info('WebRTC call rejected', session.id);
10216
10221
  const callSession = this._createCallSession(session);
10217
10222
  callSession.endTime = new Date();
10223
+ this._updateCallSession(callSession);
10224
+
10218
10225
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10219
10226
  });
10220
10227
 
@@ -10439,6 +10446,7 @@ class WebRTCPhone extends Emitter {
10439
10446
  displayName: identity ? identity.displayName || number : number,
10440
10447
  startTime: fromSession ? fromSession.startTime : new Date(),
10441
10448
  creationTime: fromSession ? fromSession.creationTime : null,
10449
+ answerTime: fromSession ? fromSession.answerTime : null,
10442
10450
  endTime: fromSession ? fromSession.endTime : null,
10443
10451
  answered: state === sessionState.SessionState.Established,
10444
10452
  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() {
@@ -9369,6 +9369,7 @@ class WebRTCPhone extends Emitter {
9369
9369
  }
9370
9370
 
9371
9371
  callSession.answerTime = new Date();
9372
+ this._updateCallSession(callSession);
9372
9373
  this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
9373
9374
 
9374
9375
  return callSession;
@@ -9585,6 +9586,7 @@ class WebRTCPhone extends Emitter {
9585
9586
 
9586
9587
  this.shouldSendReinvite = false;
9587
9588
  callSession.answerTime = new Date();
9589
+ this._updateCallSession(callSession);
9588
9590
  this.acceptedSessions[callSession.getId()] = true;
9589
9591
 
9590
9592
  this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
@@ -9684,7 +9686,7 @@ class WebRTCPhone extends Emitter {
9684
9686
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9685
9687
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9686
9688
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9687
- this.holdSipSession(this.currentSipSession, callSession);
9689
+ this.holdSipSession(this.currentSipSession, this.currentCallSession);
9688
9690
  }
9689
9691
 
9690
9692
  const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
@@ -9895,6 +9897,7 @@ class WebRTCPhone extends Emitter {
9895
9897
  }
9896
9898
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9897
9899
  callSession.creationTime = new Date();
9900
+ this._updateCallSession(callSession);
9898
9901
 
9899
9902
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9900
9903
 
@@ -10174,6 +10177,8 @@ class WebRTCPhone extends Emitter {
10174
10177
  }
10175
10178
 
10176
10179
  callSession.creationTime = new Date();
10180
+ this._updateCallSession(callSession);
10181
+
10177
10182
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10178
10183
  });
10179
10184
 
@@ -10217,6 +10222,8 @@ class WebRTCPhone extends Emitter {
10217
10222
  logger$7.info('WebRTC call rejected', session.id);
10218
10223
  const callSession = this._createCallSession(session);
10219
10224
  callSession.endTime = new Date();
10225
+ this._updateCallSession(callSession);
10226
+
10220
10227
  this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10221
10228
  });
10222
10229
 
@@ -10441,6 +10448,7 @@ class WebRTCPhone extends Emitter {
10441
10448
  displayName: identity ? identity.displayName || number : number,
10442
10449
  startTime: fromSession ? fromSession.startTime : new Date(),
10443
10450
  creationTime: fromSession ? fromSession.creationTime : null,
10451
+ answerTime: fromSession ? fromSession.answerTime : null,
10444
10452
  endTime: fromSession ? fromSession.endTime : null,
10445
10453
  answered: state === sessionState.SessionState.Established,
10446
10454
  paused: this.client.isCallHeld(sipSession),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wazo/sdk",
3
- "version": "0.37.30",
3
+ "version": "0.37.31",
4
4
  "description": "Wazo's JavaScript Software Development Kit.",
5
5
  "main": "dist/wazo-sdk.js",
6
6
  "author": "Wazo (http://wazo.io)",