@wazo/sdk 0.37.27 → 0.37.28

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 (49) hide show
  1. package/README.md +1 -1
  2. package/dist/wazo-sdk.js +2 -2
  3. package/esm/domain/CallSession.js +15 -0
  4. package/esm/domain/Phone/CTIPhone.js +15 -0
  5. package/esm/domain/Phone/WebRTCPhone.js +32 -1
  6. package/esm/domain/SFUNotAvailableError.js +9 -0
  7. package/esm/domain/__tests__/CallSession.test.js +15 -0
  8. package/esm/domain/__tests__/IndirectTransfer.test.js +15 -0
  9. package/esm/domain/__tests__/Room.test.js +15 -0
  10. package/esm/index.js +43 -1
  11. package/esm/simple/Auth.js +42 -1
  12. package/esm/simple/Configuration.js +42 -1
  13. package/esm/simple/Phone.js +42 -1
  14. package/esm/simple/index.js +42 -1
  15. package/esm/simple/room/LocalParticipant.js +42 -1
  16. package/esm/simple/room/Participant.js +42 -1
  17. package/esm/simple/room/RemoteParticipant.js +42 -1
  18. package/esm/simple/room/Room.js +42 -1
  19. package/esm/simple/room/SipRoom.js +42 -1
  20. package/esm/simple/room/Stream.js +42 -1
  21. package/esm/simple/room/__tests__/RemoteParticipant.test.js +42 -1
  22. package/esm/simple/utils.js +42 -1
  23. package/lib/domain/CallSession.js +15 -0
  24. package/lib/domain/Phone/CTIPhone.js +15 -0
  25. package/lib/domain/Phone/WebRTCPhone.js +32 -0
  26. package/lib/domain/SFUNotAvailableError.js +11 -0
  27. package/lib/domain/__tests__/CallSession.test.js +15 -0
  28. package/lib/domain/__tests__/IndirectTransfer.test.js +15 -0
  29. package/lib/domain/__tests__/Room.test.js +15 -0
  30. package/lib/index.js +43 -1
  31. package/lib/simple/Auth.js +42 -1
  32. package/lib/simple/Configuration.js +42 -1
  33. package/lib/simple/Phone.js +42 -1
  34. package/lib/simple/index.js +42 -1
  35. package/lib/simple/room/LocalParticipant.js +42 -1
  36. package/lib/simple/room/Participant.js +42 -1
  37. package/lib/simple/room/RemoteParticipant.js +42 -1
  38. package/lib/simple/room/Room.js +42 -1
  39. package/lib/simple/room/SipRoom.js +42 -1
  40. package/lib/simple/room/Stream.js +42 -1
  41. package/lib/simple/room/__tests__/RemoteParticipant.test.js +42 -1
  42. package/lib/simple/utils.js +42 -1
  43. package/package.json +1 -1
  44. package/src/domain/CallSession.js +16 -0
  45. package/src/domain/Phone/WebRTCPhone.js +16 -0
  46. package/src/domain/SFUNotAvailableError.js +7 -0
  47. package/src/index.js +2 -0
  48. package/src/simple/Phone.js +2 -1
  49. package/src/simple/index.js +2 -0
@@ -3279,8 +3279,10 @@ var updateFrom = (instance , from ) => {
3279
3279
 
3280
3280
 
3281
3281
 
3282
+
3282
3283
 
3283
3284
 
3285
+
3284
3286
 
3285
3287
 
3286
3288
 
@@ -3297,6 +3299,7 @@ var updateFrom = (instance , from ) => {
3297
3299
 
3298
3300
 
3299
3301
 
3302
+
3300
3303
 
3301
3304
 
3302
3305
  class CallSession {
@@ -3316,8 +3319,12 @@ class CallSession {
3316
3319
 
3317
3320
 
3318
3321
 
3322
+
3323
+
3319
3324
 
3320
3325
 
3326
+
3327
+
3321
3328
 
3322
3329
 
3323
3330
 
@@ -3355,6 +3362,8 @@ class CallSession {
3355
3362
 
3356
3363
 
3357
3364
 
3365
+
3366
+
3358
3367
 
3359
3368
  constructor({
3360
3369
  answered,
@@ -3368,6 +3377,8 @@ class CallSession {
3368
3377
  paused,
3369
3378
  ringing,
3370
3379
  startTime,
3380
+ creationTime,
3381
+ endTime,
3371
3382
  cameraEnabled,
3372
3383
  dialedExtension,
3373
3384
  sipCallId,
@@ -3380,12 +3391,15 @@ class CallSession {
3380
3391
  recording,
3381
3392
  recordingPaused,
3382
3393
  videoRemotelyDowngraded,
3394
+ sipSession,
3383
3395
  } ) {
3384
3396
  this.callId = callId;
3385
3397
  this.sipCallId = sipCallId;
3386
3398
  this.displayName = displayName;
3387
3399
  this.number = number;
3400
+ this.creationTime = creationTime;
3388
3401
  this.startTime = startTime;
3402
+ this.endTime = endTime;
3389
3403
  this.isCaller = isCaller;
3390
3404
  this.answered = answered;
3391
3405
  this.answeredBySystem = answeredBySystem;
@@ -3404,6 +3418,7 @@ class CallSession {
3404
3418
  this.recording = recording || false;
3405
3419
  this.recordingPaused = recordingPaused || false;
3406
3420
  this.videoRemotelyDowngraded = videoRemotelyDowngraded;
3421
+ this.sipSession = sipSession;
3407
3422
 
3408
3423
  // Useful to compare instead of instanceof with minified code
3409
3424
  this.type = 'CallSession';
@@ -8723,6 +8738,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
8723
8738
  const ON_CAMERA_RESUMED = 'onCameraResumed';
8724
8739
  const ON_CALL_CANCELED = 'onCallCanceled';
8725
8740
  const ON_CALL_FAILED = 'onCallFailed';
8741
+ const ON_CALL_REJECTED = 'onCallRejected';
8726
8742
  const ON_CALL_ENDED = 'onCallEnded';
8727
8743
  const ON_CALL_ENDING = 'onCallEnding';
8728
8744
  const ON_MESSAGE = 'onMessage';
@@ -8767,6 +8783,7 @@ const events = [
8767
8783
  ON_CAMERA_DISABLED,
8768
8784
  ON_CALL_FAILED,
8769
8785
  ON_CALL_ENDED,
8786
+ ON_CALL_REJECTED,
8770
8787
  ON_MESSAGE,
8771
8788
  ON_REINVITE,
8772
8789
  ON_TRACK,
@@ -9123,6 +9140,7 @@ class WebRTCPhone extends Emitter {
9123
9140
 
9124
9141
  // Should be called before `_onCallTerminated` or the callCount will not decrement...
9125
9142
  const callSession = this._createCallSession(sipSession);
9143
+ callSession.endTime = new Date();
9126
9144
  const wasCurrentSession = this._onCallTerminated(sipSession);
9127
9145
 
9128
9146
  return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
@@ -9842,6 +9860,7 @@ class WebRTCPhone extends Emitter {
9842
9860
  return Promise.resolve(null);
9843
9861
  }
9844
9862
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9863
+ callSession.creationTime = new Date();
9845
9864
 
9846
9865
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9847
9866
 
@@ -10120,6 +10139,7 @@ class WebRTCPhone extends Emitter {
10120
10139
  callSession);
10121
10140
  }
10122
10141
 
10142
+ callSession.creationTime = new Date();
10123
10143
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10124
10144
  });
10125
10145
 
@@ -10159,6 +10179,13 @@ class WebRTCPhone extends Emitter {
10159
10179
  this.eventEmitter.emit(ON_CALL_ERROR, e);
10160
10180
  });
10161
10181
 
10182
+ this.client.on(this.client.REJECTED, session => {
10183
+ logger$7.info('WebRTC call rejected', session.id);
10184
+ const callSession = this._createCallSession(session);
10185
+ callSession.endTime = new Date();
10186
+ this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10187
+ });
10188
+
10162
10189
  this.client.on(this.client.UNREGISTERED, () => {
10163
10190
  logger$7.info('WebRTC unregistered');
10164
10191
  this.eventEmitter.emit(ON_UNREGISTERED);
@@ -10371,6 +10398,7 @@ class WebRTCPhone extends Emitter {
10371
10398
  const number = identity ? identity.uri._normal.user : null;
10372
10399
  const { state } = sipSession || {};
10373
10400
  const sessionId = this.getSipSessionId(sipSession);
10401
+ fromSession = fromSession || this.callSessions[sessionId];
10374
10402
 
10375
10403
  const callSession = new CallSession({
10376
10404
  callId: fromSession && fromSession.callId,
@@ -10378,6 +10406,8 @@ class WebRTCPhone extends Emitter {
10378
10406
  sipStatus: state,
10379
10407
  displayName: identity ? identity.displayName || number : number,
10380
10408
  startTime: fromSession ? fromSession.startTime : new Date(),
10409
+ creationTime: fromSession ? fromSession.creationTime : null,
10410
+ endTime: fromSession ? fromSession.endTime : null,
10381
10411
  answered: state === SessionState.Established,
10382
10412
  paused: this.client.isCallHeld(sipSession),
10383
10413
  isCaller: 'incoming' in extra ? !extra.incoming : false,
@@ -10388,6 +10418,7 @@ class WebRTCPhone extends Emitter {
10388
10418
  videoMuted: fromSession ? fromSession.isVideoMuted() : false,
10389
10419
  recording: fromSession ? fromSession.isRecording() : false,
10390
10420
  recordingPaused: false, // @TODO
10421
+ sipSession,
10391
10422
  ...extra,
10392
10423
  });
10393
10424
 
@@ -10416,6 +10447,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10416
10447
  ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
10417
10448
  ON_CALL_CANCELED: ON_CALL_CANCELED,
10418
10449
  ON_CALL_FAILED: ON_CALL_FAILED,
10450
+ ON_CALL_REJECTED: ON_CALL_REJECTED,
10419
10451
  ON_CALL_ENDED: ON_CALL_ENDED,
10420
10452
  ON_CALL_ENDING: ON_CALL_ENDING,
10421
10453
  ON_MESSAGE: ON_MESSAGE,
@@ -10445,6 +10477,14 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10445
10477
  'default': WebRTCPhone
10446
10478
  });
10447
10479
 
10480
+ /* */
10481
+ class SFUNotAvailableError extends Error {
10482
+ constructor(message = 'Sorry your user is not configured to support video conference') {
10483
+ super(message);
10484
+ this.name = 'SFUNotAvailableError';
10485
+ }
10486
+ }
10487
+
10448
10488
  //
10449
10489
 
10450
10490
  const logger$6 = IssueReporter$1.loggerFor('simple-phone');
@@ -10829,7 +10869,7 @@ class Phone extends Emitter {
10829
10869
 
10830
10870
  checkSfu() {
10831
10871
  if (!this.hasSfu()) {
10832
- throw new Error('Sorry your user is not configured to support video conference');
10872
+ throw new SFUNotAvailableError();
10833
10873
  }
10834
10874
  }
10835
10875
 
@@ -12616,6 +12656,7 @@ const Wazo = {
12616
12656
  InvalidSubscription,
12617
12657
  InvalidAuthorization,
12618
12658
  CanceledCallError,
12659
+ SFUNotAvailableError,
12619
12660
  };
12620
12661
 
12621
12662
  if (window) {
@@ -3253,8 +3253,10 @@ var updateFrom = (instance , from ) => {
3253
3253
 
3254
3254
 
3255
3255
 
3256
+
3256
3257
 
3257
3258
 
3259
+
3258
3260
 
3259
3261
 
3260
3262
 
@@ -3271,6 +3273,7 @@ var updateFrom = (instance , from ) => {
3271
3273
 
3272
3274
 
3273
3275
 
3276
+
3274
3277
 
3275
3278
 
3276
3279
  class CallSession {
@@ -3290,8 +3293,12 @@ class CallSession {
3290
3293
 
3291
3294
 
3292
3295
 
3296
+
3297
+
3293
3298
 
3294
3299
 
3300
+
3301
+
3295
3302
 
3296
3303
 
3297
3304
 
@@ -3329,6 +3336,8 @@ class CallSession {
3329
3336
 
3330
3337
 
3331
3338
 
3339
+
3340
+
3332
3341
 
3333
3342
  constructor({
3334
3343
  answered,
@@ -3342,6 +3351,8 @@ class CallSession {
3342
3351
  paused,
3343
3352
  ringing,
3344
3353
  startTime,
3354
+ creationTime,
3355
+ endTime,
3345
3356
  cameraEnabled,
3346
3357
  dialedExtension,
3347
3358
  sipCallId,
@@ -3354,12 +3365,15 @@ class CallSession {
3354
3365
  recording,
3355
3366
  recordingPaused,
3356
3367
  videoRemotelyDowngraded,
3368
+ sipSession,
3357
3369
  } ) {
3358
3370
  this.callId = callId;
3359
3371
  this.sipCallId = sipCallId;
3360
3372
  this.displayName = displayName;
3361
3373
  this.number = number;
3374
+ this.creationTime = creationTime;
3362
3375
  this.startTime = startTime;
3376
+ this.endTime = endTime;
3363
3377
  this.isCaller = isCaller;
3364
3378
  this.answered = answered;
3365
3379
  this.answeredBySystem = answeredBySystem;
@@ -3378,6 +3392,7 @@ class CallSession {
3378
3392
  this.recording = recording || false;
3379
3393
  this.recordingPaused = recordingPaused || false;
3380
3394
  this.videoRemotelyDowngraded = videoRemotelyDowngraded;
3395
+ this.sipSession = sipSession;
3381
3396
 
3382
3397
  // Useful to compare instead of instanceof with minified code
3383
3398
  this.type = 'CallSession';
@@ -8723,6 +8738,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
8723
8738
  const ON_CAMERA_RESUMED = 'onCameraResumed';
8724
8739
  const ON_CALL_CANCELED = 'onCallCanceled';
8725
8740
  const ON_CALL_FAILED = 'onCallFailed';
8741
+ const ON_CALL_REJECTED = 'onCallRejected';
8726
8742
  const ON_CALL_ENDED = 'onCallEnded';
8727
8743
  const ON_CALL_ENDING = 'onCallEnding';
8728
8744
  const ON_MESSAGE = 'onMessage';
@@ -8767,6 +8783,7 @@ const events = [
8767
8783
  ON_CAMERA_DISABLED,
8768
8784
  ON_CALL_FAILED,
8769
8785
  ON_CALL_ENDED,
8786
+ ON_CALL_REJECTED,
8770
8787
  ON_MESSAGE,
8771
8788
  ON_REINVITE,
8772
8789
  ON_TRACK,
@@ -9123,6 +9140,7 @@ class WebRTCPhone extends Emitter {
9123
9140
 
9124
9141
  // Should be called before `_onCallTerminated` or the callCount will not decrement...
9125
9142
  const callSession = this._createCallSession(sipSession);
9143
+ callSession.endTime = new Date();
9126
9144
  const wasCurrentSession = this._onCallTerminated(sipSession);
9127
9145
 
9128
9146
  return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
@@ -9842,6 +9860,7 @@ class WebRTCPhone extends Emitter {
9842
9860
  return Promise.resolve(null);
9843
9861
  }
9844
9862
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9863
+ callSession.creationTime = new Date();
9845
9864
 
9846
9865
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9847
9866
 
@@ -10120,6 +10139,7 @@ class WebRTCPhone extends Emitter {
10120
10139
  callSession);
10121
10140
  }
10122
10141
 
10142
+ callSession.creationTime = new Date();
10123
10143
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10124
10144
  });
10125
10145
 
@@ -10159,6 +10179,13 @@ class WebRTCPhone extends Emitter {
10159
10179
  this.eventEmitter.emit(ON_CALL_ERROR, e);
10160
10180
  });
10161
10181
 
10182
+ this.client.on(this.client.REJECTED, session => {
10183
+ logger$7.info('WebRTC call rejected', session.id);
10184
+ const callSession = this._createCallSession(session);
10185
+ callSession.endTime = new Date();
10186
+ this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10187
+ });
10188
+
10162
10189
  this.client.on(this.client.UNREGISTERED, () => {
10163
10190
  logger$7.info('WebRTC unregistered');
10164
10191
  this.eventEmitter.emit(ON_UNREGISTERED);
@@ -10371,6 +10398,7 @@ class WebRTCPhone extends Emitter {
10371
10398
  const number = identity ? identity.uri._normal.user : null;
10372
10399
  const { state } = sipSession || {};
10373
10400
  const sessionId = this.getSipSessionId(sipSession);
10401
+ fromSession = fromSession || this.callSessions[sessionId];
10374
10402
 
10375
10403
  const callSession = new CallSession({
10376
10404
  callId: fromSession && fromSession.callId,
@@ -10378,6 +10406,8 @@ class WebRTCPhone extends Emitter {
10378
10406
  sipStatus: state,
10379
10407
  displayName: identity ? identity.displayName || number : number,
10380
10408
  startTime: fromSession ? fromSession.startTime : new Date(),
10409
+ creationTime: fromSession ? fromSession.creationTime : null,
10410
+ endTime: fromSession ? fromSession.endTime : null,
10381
10411
  answered: state === SessionState.Established,
10382
10412
  paused: this.client.isCallHeld(sipSession),
10383
10413
  isCaller: 'incoming' in extra ? !extra.incoming : false,
@@ -10388,6 +10418,7 @@ class WebRTCPhone extends Emitter {
10388
10418
  videoMuted: fromSession ? fromSession.isVideoMuted() : false,
10389
10419
  recording: fromSession ? fromSession.isRecording() : false,
10390
10420
  recordingPaused: false, // @TODO
10421
+ sipSession,
10391
10422
  ...extra,
10392
10423
  });
10393
10424
 
@@ -10416,6 +10447,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10416
10447
  ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
10417
10448
  ON_CALL_CANCELED: ON_CALL_CANCELED,
10418
10449
  ON_CALL_FAILED: ON_CALL_FAILED,
10450
+ ON_CALL_REJECTED: ON_CALL_REJECTED,
10419
10451
  ON_CALL_ENDED: ON_CALL_ENDED,
10420
10452
  ON_CALL_ENDING: ON_CALL_ENDING,
10421
10453
  ON_MESSAGE: ON_MESSAGE,
@@ -10445,6 +10477,14 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10445
10477
  'default': WebRTCPhone
10446
10478
  });
10447
10479
 
10480
+ /* */
10481
+ class SFUNotAvailableError extends Error {
10482
+ constructor(message = 'Sorry your user is not configured to support video conference') {
10483
+ super(message);
10484
+ this.name = 'SFUNotAvailableError';
10485
+ }
10486
+ }
10487
+
10448
10488
  //
10449
10489
 
10450
10490
  const logger$6 = IssueReporter$1.loggerFor('simple-phone');
@@ -10829,7 +10869,7 @@ class Phone extends Emitter {
10829
10869
 
10830
10870
  checkSfu() {
10831
10871
  if (!this.hasSfu()) {
10832
- throw new Error('Sorry your user is not configured to support video conference');
10872
+ throw new SFUNotAvailableError();
10833
10873
  }
10834
10874
  }
10835
10875
 
@@ -12895,6 +12935,7 @@ const Wazo = {
12895
12935
  InvalidSubscription,
12896
12936
  InvalidAuthorization,
12897
12937
  CanceledCallError,
12938
+ SFUNotAvailableError,
12898
12939
  };
12899
12940
 
12900
12941
  if (window) {
@@ -3253,8 +3253,10 @@ var updateFrom = (instance , from ) => {
3253
3253
 
3254
3254
 
3255
3255
 
3256
+
3256
3257
 
3257
3258
 
3259
+
3258
3260
 
3259
3261
 
3260
3262
 
@@ -3271,6 +3273,7 @@ var updateFrom = (instance , from ) => {
3271
3273
 
3272
3274
 
3273
3275
 
3276
+
3274
3277
 
3275
3278
 
3276
3279
  class CallSession {
@@ -3290,8 +3293,12 @@ class CallSession {
3290
3293
 
3291
3294
 
3292
3295
 
3296
+
3297
+
3293
3298
 
3294
3299
 
3300
+
3301
+
3295
3302
 
3296
3303
 
3297
3304
 
@@ -3329,6 +3336,8 @@ class CallSession {
3329
3336
 
3330
3337
 
3331
3338
 
3339
+
3340
+
3332
3341
 
3333
3342
  constructor({
3334
3343
  answered,
@@ -3342,6 +3351,8 @@ class CallSession {
3342
3351
  paused,
3343
3352
  ringing,
3344
3353
  startTime,
3354
+ creationTime,
3355
+ endTime,
3345
3356
  cameraEnabled,
3346
3357
  dialedExtension,
3347
3358
  sipCallId,
@@ -3354,12 +3365,15 @@ class CallSession {
3354
3365
  recording,
3355
3366
  recordingPaused,
3356
3367
  videoRemotelyDowngraded,
3368
+ sipSession,
3357
3369
  } ) {
3358
3370
  this.callId = callId;
3359
3371
  this.sipCallId = sipCallId;
3360
3372
  this.displayName = displayName;
3361
3373
  this.number = number;
3374
+ this.creationTime = creationTime;
3362
3375
  this.startTime = startTime;
3376
+ this.endTime = endTime;
3363
3377
  this.isCaller = isCaller;
3364
3378
  this.answered = answered;
3365
3379
  this.answeredBySystem = answeredBySystem;
@@ -3378,6 +3392,7 @@ class CallSession {
3378
3392
  this.recording = recording || false;
3379
3393
  this.recordingPaused = recordingPaused || false;
3380
3394
  this.videoRemotelyDowngraded = videoRemotelyDowngraded;
3395
+ this.sipSession = sipSession;
3381
3396
 
3382
3397
  // Useful to compare instead of instanceof with minified code
3383
3398
  this.type = 'CallSession';
@@ -8723,6 +8738,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
8723
8738
  const ON_CAMERA_RESUMED = 'onCameraResumed';
8724
8739
  const ON_CALL_CANCELED = 'onCallCanceled';
8725
8740
  const ON_CALL_FAILED = 'onCallFailed';
8741
+ const ON_CALL_REJECTED = 'onCallRejected';
8726
8742
  const ON_CALL_ENDED = 'onCallEnded';
8727
8743
  const ON_CALL_ENDING = 'onCallEnding';
8728
8744
  const ON_MESSAGE = 'onMessage';
@@ -8767,6 +8783,7 @@ const events = [
8767
8783
  ON_CAMERA_DISABLED,
8768
8784
  ON_CALL_FAILED,
8769
8785
  ON_CALL_ENDED,
8786
+ ON_CALL_REJECTED,
8770
8787
  ON_MESSAGE,
8771
8788
  ON_REINVITE,
8772
8789
  ON_TRACK,
@@ -9123,6 +9140,7 @@ class WebRTCPhone extends Emitter {
9123
9140
 
9124
9141
  // Should be called before `_onCallTerminated` or the callCount will not decrement...
9125
9142
  const callSession = this._createCallSession(sipSession);
9143
+ callSession.endTime = new Date();
9126
9144
  const wasCurrentSession = this._onCallTerminated(sipSession);
9127
9145
 
9128
9146
  return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
@@ -9842,6 +9860,7 @@ class WebRTCPhone extends Emitter {
9842
9860
  return Promise.resolve(null);
9843
9861
  }
9844
9862
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9863
+ callSession.creationTime = new Date();
9845
9864
 
9846
9865
  this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
9847
9866
 
@@ -10120,6 +10139,7 @@ class WebRTCPhone extends Emitter {
10120
10139
  callSession);
10121
10140
  }
10122
10141
 
10142
+ callSession.creationTime = new Date();
10123
10143
  this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
10124
10144
  });
10125
10145
 
@@ -10159,6 +10179,13 @@ class WebRTCPhone extends Emitter {
10159
10179
  this.eventEmitter.emit(ON_CALL_ERROR, e);
10160
10180
  });
10161
10181
 
10182
+ this.client.on(this.client.REJECTED, session => {
10183
+ logger$7.info('WebRTC call rejected', session.id);
10184
+ const callSession = this._createCallSession(session);
10185
+ callSession.endTime = new Date();
10186
+ this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
10187
+ });
10188
+
10162
10189
  this.client.on(this.client.UNREGISTERED, () => {
10163
10190
  logger$7.info('WebRTC unregistered');
10164
10191
  this.eventEmitter.emit(ON_UNREGISTERED);
@@ -10371,6 +10398,7 @@ class WebRTCPhone extends Emitter {
10371
10398
  const number = identity ? identity.uri._normal.user : null;
10372
10399
  const { state } = sipSession || {};
10373
10400
  const sessionId = this.getSipSessionId(sipSession);
10401
+ fromSession = fromSession || this.callSessions[sessionId];
10374
10402
 
10375
10403
  const callSession = new CallSession({
10376
10404
  callId: fromSession && fromSession.callId,
@@ -10378,6 +10406,8 @@ class WebRTCPhone extends Emitter {
10378
10406
  sipStatus: state,
10379
10407
  displayName: identity ? identity.displayName || number : number,
10380
10408
  startTime: fromSession ? fromSession.startTime : new Date(),
10409
+ creationTime: fromSession ? fromSession.creationTime : null,
10410
+ endTime: fromSession ? fromSession.endTime : null,
10381
10411
  answered: state === SessionState.Established,
10382
10412
  paused: this.client.isCallHeld(sipSession),
10383
10413
  isCaller: 'incoming' in extra ? !extra.incoming : false,
@@ -10388,6 +10418,7 @@ class WebRTCPhone extends Emitter {
10388
10418
  videoMuted: fromSession ? fromSession.isVideoMuted() : false,
10389
10419
  recording: fromSession ? fromSession.isRecording() : false,
10390
10420
  recordingPaused: false, // @TODO
10421
+ sipSession,
10391
10422
  ...extra,
10392
10423
  });
10393
10424
 
@@ -10416,6 +10447,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10416
10447
  ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
10417
10448
  ON_CALL_CANCELED: ON_CALL_CANCELED,
10418
10449
  ON_CALL_FAILED: ON_CALL_FAILED,
10450
+ ON_CALL_REJECTED: ON_CALL_REJECTED,
10419
10451
  ON_CALL_ENDED: ON_CALL_ENDED,
10420
10452
  ON_CALL_ENDING: ON_CALL_ENDING,
10421
10453
  ON_MESSAGE: ON_MESSAGE,
@@ -10445,6 +10477,14 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10445
10477
  'default': WebRTCPhone
10446
10478
  });
10447
10479
 
10480
+ /* */
10481
+ class SFUNotAvailableError extends Error {
10482
+ constructor(message = 'Sorry your user is not configured to support video conference') {
10483
+ super(message);
10484
+ this.name = 'SFUNotAvailableError';
10485
+ }
10486
+ }
10487
+
10448
10488
  //
10449
10489
 
10450
10490
  const logger$6 = IssueReporter$1.loggerFor('simple-phone');
@@ -10829,7 +10869,7 @@ class Phone extends Emitter {
10829
10869
 
10830
10870
  checkSfu() {
10831
10871
  if (!this.hasSfu()) {
10832
- throw new Error('Sorry your user is not configured to support video conference');
10872
+ throw new SFUNotAvailableError();
10833
10873
  }
10834
10874
  }
10835
10875
 
@@ -12906,6 +12946,7 @@ const Wazo = {
12906
12946
  InvalidSubscription,
12907
12947
  InvalidAuthorization,
12908
12948
  CanceledCallError,
12949
+ SFUNotAvailableError,
12909
12950
  };
12910
12951
 
12911
12952
  if (window) {