@wazo/sdk 0.37.25 → 0.37.29
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.
- package/README.md +96 -58
- package/dist/wazo-sdk.js +3 -3
- package/esm/__tests__/api-client.test.js +2 -2
- package/esm/__tests__/web-rtc-client.test.js +10 -5
- package/esm/api/agentd.js +1 -1
- package/esm/api/amid.js +1 -1
- package/esm/api/application.js +1 -1
- package/esm/api/auth.js +1 -1
- package/esm/api/call-logd.js +1 -1
- package/esm/api/calld.js +1 -1
- package/esm/api/chatd.js +1 -1
- package/esm/api/confd.js +1 -1
- package/esm/api/ctid-ng.js +1 -1
- package/esm/api/dird.js +2 -2
- package/esm/api/webhookd.js +1 -1
- package/esm/api-client.js +2 -2
- package/esm/checker/Checker.js +10 -5
- package/esm/checker/checks/aor.js +2 -2
- package/esm/checker/checks/api.js +2 -2
- package/esm/checker/checks/index.js +10 -5
- package/esm/checker/checks/wazo-websocket.js +1 -1
- package/esm/checker/checks/webrtc-transport.js +10 -5
- package/esm/checker/checks/webrtc.js +10 -5
- package/esm/domain/AdHocAPIConference.js +2 -2
- package/esm/domain/CallSession.js +29 -2
- package/esm/domain/Contact.js +1 -1
- package/esm/domain/Features.js +2 -2
- package/esm/domain/Phone/CTIPhone.js +31 -4
- package/esm/domain/Phone/WebRTCPhone.js +55 -6
- package/esm/domain/SFUNotAvailableError.js +9 -0
- package/esm/domain/__tests__/CallSession.test.js +46 -2
- package/esm/domain/__tests__/Contact.test.js +1 -1
- package/esm/domain/__tests__/IndirectTransfer.test.js +29 -2
- package/esm/domain/__tests__/Room.test.js +29 -2
- package/esm/index.js +75 -10
- package/esm/lib/WazoSessionDescriptionHandler.js +9 -4
- package/esm/service/CallApi.js +2 -2
- package/esm/service/IssueReporter.js +1 -1
- package/esm/service/__tests__/IssueReporter.test.js +1 -1
- package/esm/service/getApiClient.js +2 -2
- package/esm/simple/Auth.js +74 -10
- package/esm/simple/Configuration.js +74 -10
- package/esm/simple/Directory.js +2 -2
- package/esm/simple/Phone.js +74 -10
- package/esm/simple/Websocket.js +1 -1
- package/esm/simple/index.js +74 -10
- package/esm/simple/room/LocalParticipant.js +74 -10
- package/esm/simple/room/Participant.js +74 -10
- package/esm/simple/room/RemoteParticipant.js +74 -10
- package/esm/simple/room/Room.js +74 -10
- package/esm/simple/room/SipRoom.js +74 -10
- package/esm/simple/room/Stream.js +74 -10
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +74 -10
- package/esm/simple/utils.js +74 -10
- package/esm/utils/__tests__/api-requester.test.js +1 -1
- package/esm/utils/api-requester.js +1 -1
- package/esm/web-rtc-client.js +10 -5
- package/esm/websocket-client.js +1 -1
- package/lib/__tests__/api-client.test.js +2 -2
- package/lib/__tests__/web-rtc-client.test.js +10 -5
- package/lib/api/agentd.js +1 -1
- package/lib/api/amid.js +1 -1
- package/lib/api/application.js +1 -1
- package/lib/api/auth.js +1 -1
- package/lib/api/call-logd.js +1 -1
- package/lib/api/calld.js +1 -1
- package/lib/api/chatd.js +1 -1
- package/lib/api/confd.js +1 -1
- package/lib/api/ctid-ng.js +1 -1
- package/lib/api/dird.js +2 -2
- package/lib/api/webhookd.js +1 -1
- package/lib/api-client.js +2 -2
- package/lib/checker/Checker.js +10 -5
- package/lib/checker/checks/aor.js +2 -2
- package/lib/checker/checks/api.js +2 -2
- package/lib/checker/checks/index.js +10 -5
- package/lib/checker/checks/wazo-websocket.js +1 -1
- package/lib/checker/checks/webrtc-transport.js +10 -5
- package/lib/checker/checks/webrtc.js +10 -5
- package/lib/domain/AdHocAPIConference.js +2 -2
- package/lib/domain/CallSession.js +29 -2
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +2 -2
- package/lib/domain/Phone/CTIPhone.js +31 -4
- package/lib/domain/Phone/WebRTCPhone.js +55 -5
- package/lib/domain/SFUNotAvailableError.js +11 -0
- package/lib/domain/__tests__/CallSession.test.js +46 -2
- package/lib/domain/__tests__/Contact.test.js +1 -1
- package/lib/domain/__tests__/IndirectTransfer.test.js +29 -2
- package/lib/domain/__tests__/Room.test.js +29 -2
- package/lib/index.js +75 -10
- package/lib/lib/WazoSessionDescriptionHandler.js +9 -4
- package/lib/service/CallApi.js +2 -2
- package/lib/service/IssueReporter.js +1 -1
- package/lib/service/__tests__/IssueReporter.test.js +1 -1
- package/lib/service/getApiClient.js +2 -2
- package/lib/simple/Auth.js +74 -10
- package/lib/simple/Configuration.js +74 -10
- package/lib/simple/Directory.js +2 -2
- package/lib/simple/Phone.js +74 -10
- package/lib/simple/Websocket.js +1 -1
- package/lib/simple/index.js +74 -10
- package/lib/simple/room/LocalParticipant.js +74 -10
- package/lib/simple/room/Participant.js +74 -10
- package/lib/simple/room/RemoteParticipant.js +74 -10
- package/lib/simple/room/Room.js +74 -10
- package/lib/simple/room/SipRoom.js +74 -10
- package/lib/simple/room/Stream.js +74 -10
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +74 -10
- package/lib/simple/utils.js +74 -10
- package/lib/utils/__tests__/api-requester.test.js +1 -1
- package/lib/utils/api-requester.js +1 -1
- package/lib/web-rtc-client.js +10 -5
- package/lib/websocket-client.js +1 -1
- package/package.json +1 -1
- package/src/domain/CallSession.js +32 -4
- package/src/domain/Contact.js +1 -1
- package/src/domain/Phone/WebRTCPhone.js +24 -2
- package/src/domain/SFUNotAvailableError.js +7 -0
- package/src/domain/__tests__/CallSession.test.js +17 -0
- package/src/index.js +2 -0
- package/src/lib/WazoSessionDescriptionHandler.js +8 -3
- package/src/simple/Phone.js +2 -1
- package/src/simple/index.js +2 -0
- package/src/utils/api-requester.js +1 -1
package/esm/simple/utils.js
CHANGED
|
@@ -1236,7 +1236,7 @@ class Contact {
|
|
|
1236
1236
|
this[key] = old[key] || this[key];
|
|
1237
1237
|
});
|
|
1238
1238
|
|
|
1239
|
-
if (old.lineState
|
|
1239
|
+
if (old.lineState) {
|
|
1240
1240
|
this.lineState = old.lineState;
|
|
1241
1241
|
}
|
|
1242
1242
|
|
|
@@ -1951,7 +1951,7 @@ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
1951
1951
|
|
|
1952
1952
|
// Use a function here to be able to mock it in tests
|
|
1953
1953
|
const realFetch = () => {
|
|
1954
|
-
if (typeof document !== 'undefined') {
|
|
1954
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
1955
1955
|
// Browser
|
|
1956
1956
|
return window.fetch;
|
|
1957
1957
|
}
|
|
@@ -3248,13 +3248,16 @@ var updateFrom = (instance , from ) => {
|
|
|
3248
3248
|
|
|
3249
3249
|
|
|
3250
3250
|
|
|
3251
|
+
|
|
3251
3252
|
|
|
3252
3253
|
|
|
3253
3254
|
|
|
3254
3255
|
|
|
3255
3256
|
|
|
3257
|
+
|
|
3256
3258
|
|
|
3257
3259
|
|
|
3260
|
+
|
|
3258
3261
|
|
|
3259
3262
|
|
|
3260
3263
|
|
|
@@ -3271,6 +3274,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3271
3274
|
|
|
3272
3275
|
|
|
3273
3276
|
|
|
3277
|
+
|
|
3274
3278
|
|
|
3275
3279
|
|
|
3276
3280
|
class CallSession {
|
|
@@ -3290,10 +3294,14 @@ class CallSession {
|
|
|
3290
3294
|
|
|
3291
3295
|
|
|
3292
3296
|
|
|
3293
|
-
|
|
3297
|
+
|
|
3298
|
+
|
|
3299
|
+
// = creationTime
|
|
3294
3300
|
|
|
3295
3301
|
|
|
3296
3302
|
|
|
3303
|
+
|
|
3304
|
+
|
|
3297
3305
|
|
|
3298
3306
|
|
|
3299
3307
|
|
|
@@ -3329,6 +3337,8 @@ class CallSession {
|
|
|
3329
3337
|
|
|
3330
3338
|
|
|
3331
3339
|
|
|
3340
|
+
|
|
3341
|
+
|
|
3332
3342
|
|
|
3333
3343
|
constructor({
|
|
3334
3344
|
answered,
|
|
@@ -3342,6 +3352,8 @@ class CallSession {
|
|
|
3342
3352
|
paused,
|
|
3343
3353
|
ringing,
|
|
3344
3354
|
startTime,
|
|
3355
|
+
creationTime,
|
|
3356
|
+
endTime,
|
|
3345
3357
|
cameraEnabled,
|
|
3346
3358
|
dialedExtension,
|
|
3347
3359
|
sipCallId,
|
|
@@ -3354,12 +3366,16 @@ class CallSession {
|
|
|
3354
3366
|
recording,
|
|
3355
3367
|
recordingPaused,
|
|
3356
3368
|
videoRemotelyDowngraded,
|
|
3369
|
+
sipSession,
|
|
3370
|
+
answerTime,
|
|
3357
3371
|
} ) {
|
|
3358
3372
|
this.callId = callId;
|
|
3359
3373
|
this.sipCallId = sipCallId;
|
|
3360
3374
|
this.displayName = displayName;
|
|
3361
3375
|
this.number = number;
|
|
3376
|
+
this.creationTime = creationTime;
|
|
3362
3377
|
this.startTime = startTime;
|
|
3378
|
+
this.endTime = endTime;
|
|
3363
3379
|
this.isCaller = isCaller;
|
|
3364
3380
|
this.answered = answered;
|
|
3365
3381
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -3378,6 +3394,8 @@ class CallSession {
|
|
|
3378
3394
|
this.recording = recording || false;
|
|
3379
3395
|
this.recordingPaused = recordingPaused || false;
|
|
3380
3396
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3397
|
+
this.sipSession = sipSession;
|
|
3398
|
+
this.answerTime = answerTime || this.answerTime;
|
|
3381
3399
|
|
|
3382
3400
|
// Useful to compare instead of instanceof with minified code
|
|
3383
3401
|
this.type = 'CallSession';
|
|
@@ -3408,7 +3426,7 @@ class CallSession {
|
|
|
3408
3426
|
}
|
|
3409
3427
|
|
|
3410
3428
|
answer() {
|
|
3411
|
-
this.
|
|
3429
|
+
this.answerTime = new Date();
|
|
3412
3430
|
}
|
|
3413
3431
|
|
|
3414
3432
|
systemAnswer() {
|
|
@@ -3564,6 +3582,15 @@ class CallSession {
|
|
|
3564
3582
|
return newFrom(callSession, CallSession);
|
|
3565
3583
|
}
|
|
3566
3584
|
|
|
3585
|
+
// Retro-compatibility: `answered` was a boolean before. We can reproduce the behaviour with a getter/setter
|
|
3586
|
+
set answered(value ) {
|
|
3587
|
+
this.answerTime = value ? new Date() : null;
|
|
3588
|
+
}
|
|
3589
|
+
|
|
3590
|
+
get answered() {
|
|
3591
|
+
return !!this.answerTime;
|
|
3592
|
+
}
|
|
3593
|
+
|
|
3567
3594
|
static parseCall(call ) {
|
|
3568
3595
|
return new CallSession({
|
|
3569
3596
|
callId: call.id,
|
|
@@ -6062,11 +6089,16 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6062
6089
|
|
|
6063
6090
|
// $FlowFixMe
|
|
6064
6091
|
setRemoteSessionDescription(sessionDescription ) {
|
|
6065
|
-
|
|
6092
|
+
try {
|
|
6093
|
+
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
6066
6094
|
|
|
6067
|
-
|
|
6095
|
+
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
6068
6096
|
|
|
6069
|
-
|
|
6097
|
+
return result;
|
|
6098
|
+
} catch (error) {
|
|
6099
|
+
this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
|
|
6100
|
+
throw error;
|
|
6101
|
+
}
|
|
6070
6102
|
}
|
|
6071
6103
|
|
|
6072
6104
|
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
@@ -8718,6 +8750,7 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8718
8750
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8719
8751
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8720
8752
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8753
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8721
8754
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8722
8755
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8723
8756
|
const ON_MESSAGE = 'onMessage';
|
|
@@ -8762,6 +8795,7 @@ const events = [
|
|
|
8762
8795
|
ON_CAMERA_DISABLED,
|
|
8763
8796
|
ON_CALL_FAILED,
|
|
8764
8797
|
ON_CALL_ENDED,
|
|
8798
|
+
ON_CALL_REJECTED,
|
|
8765
8799
|
ON_MESSAGE,
|
|
8766
8800
|
ON_REINVITE,
|
|
8767
8801
|
ON_TRACK,
|
|
@@ -9118,6 +9152,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9118
9152
|
|
|
9119
9153
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9120
9154
|
const callSession = this._createCallSession(sipSession);
|
|
9155
|
+
callSession.endTime = new Date();
|
|
9121
9156
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9122
9157
|
|
|
9123
9158
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -9313,6 +9348,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9313
9348
|
this.removeIncomingSessions(sipSessionId);
|
|
9314
9349
|
}
|
|
9315
9350
|
|
|
9351
|
+
callSession.answerTime = new Date();
|
|
9316
9352
|
this.eventEmitter.emit(ON_CALL_ACCEPTED, callSession, cameraEnabled);
|
|
9317
9353
|
|
|
9318
9354
|
return callSession;
|
|
@@ -9370,6 +9406,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9370
9406
|
_onCallTerminated(sipSession ) {
|
|
9371
9407
|
logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9372
9408
|
|
|
9409
|
+
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9373
9410
|
const callSession = this._createCallSession(sipSession);
|
|
9374
9411
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
9375
9412
|
const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
|
|
@@ -9387,7 +9424,6 @@ class WebRTCPhone extends Emitter {
|
|
|
9387
9424
|
}, 5);
|
|
9388
9425
|
}
|
|
9389
9426
|
|
|
9390
|
-
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9391
9427
|
if (sipSessionId) {
|
|
9392
9428
|
this.removeIncomingSessions(sipSessionId);
|
|
9393
9429
|
}
|
|
@@ -9528,6 +9564,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9528
9564
|
}
|
|
9529
9565
|
|
|
9530
9566
|
this.shouldSendReinvite = false;
|
|
9567
|
+
callSession.answerTime = new Date();
|
|
9531
9568
|
this.acceptedSessions[callSession.getId()] = true;
|
|
9532
9569
|
|
|
9533
9570
|
this.eventEmitter.emit(ON_CALL_ANSWERED, callSession);
|
|
@@ -9837,6 +9874,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9837
9874
|
return Promise.resolve(null);
|
|
9838
9875
|
}
|
|
9839
9876
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9877
|
+
callSession.creationTime = new Date();
|
|
9840
9878
|
|
|
9841
9879
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9842
9880
|
|
|
@@ -10032,8 +10070,12 @@ class WebRTCPhone extends Emitter {
|
|
|
10032
10070
|
}
|
|
10033
10071
|
|
|
10034
10072
|
const sessionId = this.incomingSessions[0];
|
|
10073
|
+
const sipSession = this.client.getSipSession(sessionId);
|
|
10074
|
+
if (!sipSession) {
|
|
10075
|
+
return null;
|
|
10076
|
+
}
|
|
10035
10077
|
|
|
10036
|
-
return this._createCallSession(
|
|
10078
|
+
return this._createCallSession(sipSession);
|
|
10037
10079
|
}
|
|
10038
10080
|
|
|
10039
10081
|
sendMessage(sipSession = null, body , contentType = 'text/plain') {
|
|
@@ -10111,6 +10153,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10111
10153
|
callSession);
|
|
10112
10154
|
}
|
|
10113
10155
|
|
|
10156
|
+
callSession.creationTime = new Date();
|
|
10114
10157
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
10115
10158
|
});
|
|
10116
10159
|
|
|
@@ -10150,6 +10193,13 @@ class WebRTCPhone extends Emitter {
|
|
|
10150
10193
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10151
10194
|
});
|
|
10152
10195
|
|
|
10196
|
+
this.client.on(this.client.REJECTED, session => {
|
|
10197
|
+
logger$7.info('WebRTC call rejected', session.id);
|
|
10198
|
+
const callSession = this._createCallSession(session);
|
|
10199
|
+
callSession.endTime = new Date();
|
|
10200
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
10201
|
+
});
|
|
10202
|
+
|
|
10153
10203
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10154
10204
|
logger$7.info('WebRTC unregistered');
|
|
10155
10205
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
@@ -10362,6 +10412,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10362
10412
|
const number = identity ? identity.uri._normal.user : null;
|
|
10363
10413
|
const { state } = sipSession || {};
|
|
10364
10414
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10415
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10365
10416
|
|
|
10366
10417
|
const callSession = new CallSession({
|
|
10367
10418
|
callId: fromSession && fromSession.callId,
|
|
@@ -10369,6 +10420,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10369
10420
|
sipStatus: state,
|
|
10370
10421
|
displayName: identity ? identity.displayName || number : number,
|
|
10371
10422
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10423
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10424
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10372
10425
|
answered: state === SessionState.Established,
|
|
10373
10426
|
paused: this.client.isCallHeld(sipSession),
|
|
10374
10427
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10379,6 +10432,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10379
10432
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10380
10433
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10381
10434
|
recordingPaused: false, // @TODO
|
|
10435
|
+
sipSession,
|
|
10382
10436
|
...extra,
|
|
10383
10437
|
});
|
|
10384
10438
|
|
|
@@ -10407,6 +10461,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10407
10461
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10408
10462
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10409
10463
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10464
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10410
10465
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10411
10466
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10412
10467
|
ON_MESSAGE: ON_MESSAGE,
|
|
@@ -10436,6 +10491,14 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10436
10491
|
'default': WebRTCPhone
|
|
10437
10492
|
});
|
|
10438
10493
|
|
|
10494
|
+
/* */
|
|
10495
|
+
class SFUNotAvailableError extends Error {
|
|
10496
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10497
|
+
super(message);
|
|
10498
|
+
this.name = 'SFUNotAvailableError';
|
|
10499
|
+
}
|
|
10500
|
+
}
|
|
10501
|
+
|
|
10439
10502
|
//
|
|
10440
10503
|
|
|
10441
10504
|
const logger$6 = IssueReporter$1.loggerFor('simple-phone');
|
|
@@ -10820,7 +10883,7 @@ class Phone extends Emitter {
|
|
|
10820
10883
|
|
|
10821
10884
|
checkSfu() {
|
|
10822
10885
|
if (!this.hasSfu()) {
|
|
10823
|
-
throw new
|
|
10886
|
+
throw new SFUNotAvailableError();
|
|
10824
10887
|
}
|
|
10825
10888
|
}
|
|
10826
10889
|
|
|
@@ -13717,6 +13780,7 @@ const Wazo = {
|
|
|
13717
13780
|
InvalidSubscription,
|
|
13718
13781
|
InvalidAuthorization,
|
|
13719
13782
|
CanceledCallError,
|
|
13783
|
+
SFUNotAvailableError,
|
|
13720
13784
|
};
|
|
13721
13785
|
|
|
13722
13786
|
if (window) {
|
|
@@ -440,7 +440,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
440
440
|
|
|
441
441
|
// Use a function here to be able to mock it in tests
|
|
442
442
|
const realFetch = () => {
|
|
443
|
-
if (typeof document !== 'undefined') {
|
|
443
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
444
444
|
// Browser
|
|
445
445
|
return window.fetch;
|
|
446
446
|
}
|
|
@@ -440,7 +440,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
440
440
|
|
|
441
441
|
// Use a function here to be able to mock it in tests
|
|
442
442
|
const realFetch = () => {
|
|
443
|
-
if (typeof document !== 'undefined') {
|
|
443
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
444
444
|
// Browser
|
|
445
445
|
return window.fetch;
|
|
446
446
|
}
|
package/esm/web-rtc-client.js
CHANGED
|
@@ -104,7 +104,7 @@ const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
104
104
|
|
|
105
105
|
// Use a function here to be able to mock it in tests
|
|
106
106
|
const realFetch = () => {
|
|
107
|
-
if (typeof document !== 'undefined') {
|
|
107
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
108
108
|
// Browser
|
|
109
109
|
return window.fetch;
|
|
110
110
|
}
|
|
@@ -823,11 +823,16 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
823
823
|
|
|
824
824
|
// $FlowFixMe
|
|
825
825
|
setRemoteSessionDescription(sessionDescription ) {
|
|
826
|
-
|
|
826
|
+
try {
|
|
827
|
+
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
827
828
|
|
|
828
|
-
|
|
829
|
+
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
829
830
|
|
|
830
|
-
|
|
831
|
+
return result;
|
|
832
|
+
} catch (error) {
|
|
833
|
+
this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
|
|
834
|
+
throw error;
|
|
835
|
+
}
|
|
831
836
|
}
|
|
832
837
|
|
|
833
838
|
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
@@ -2447,7 +2452,7 @@ class Contact {
|
|
|
2447
2452
|
this[key] = old[key] || this[key];
|
|
2448
2453
|
});
|
|
2449
2454
|
|
|
2450
|
-
if (old.lineState
|
|
2455
|
+
if (old.lineState) {
|
|
2451
2456
|
this.lineState = old.lineState;
|
|
2452
2457
|
}
|
|
2453
2458
|
|
package/esm/websocket-client.js
CHANGED
|
@@ -39,7 +39,7 @@ IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
39
39
|
|
|
40
40
|
// Use a function here to be able to mock it in tests
|
|
41
41
|
const realFetch = () => {
|
|
42
|
-
if (typeof document !== 'undefined') {
|
|
42
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
43
43
|
// Browser
|
|
44
44
|
return window.fetch;
|
|
45
45
|
}
|
|
@@ -450,7 +450,7 @@ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
450
450
|
|
|
451
451
|
// Use a function here to be able to mock it in tests
|
|
452
452
|
const realFetch = () => {
|
|
453
|
-
if (typeof document !== 'undefined') {
|
|
453
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
454
454
|
// Browser
|
|
455
455
|
return window.fetch;
|
|
456
456
|
}
|
|
@@ -1910,7 +1910,7 @@ class Contact {
|
|
|
1910
1910
|
this[key] = old[key] || this[key];
|
|
1911
1911
|
});
|
|
1912
1912
|
|
|
1913
|
-
if (old.lineState
|
|
1913
|
+
if (old.lineState) {
|
|
1914
1914
|
this.lineState = old.lineState;
|
|
1915
1915
|
}
|
|
1916
1916
|
|
|
@@ -113,7 +113,7 @@ const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
113
113
|
|
|
114
114
|
// Use a function here to be able to mock it in tests
|
|
115
115
|
const realFetch = () => {
|
|
116
|
-
if (typeof document !== 'undefined') {
|
|
116
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
117
117
|
// Browser
|
|
118
118
|
return window.fetch;
|
|
119
119
|
}
|
|
@@ -832,11 +832,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
832
832
|
|
|
833
833
|
// $FlowFixMe
|
|
834
834
|
setRemoteSessionDescription(sessionDescription ) {
|
|
835
|
-
|
|
835
|
+
try {
|
|
836
|
+
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
836
837
|
|
|
837
|
-
|
|
838
|
+
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
838
839
|
|
|
839
|
-
|
|
840
|
+
return result;
|
|
841
|
+
} catch (error) {
|
|
842
|
+
this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
|
|
843
|
+
throw error;
|
|
844
|
+
}
|
|
840
845
|
}
|
|
841
846
|
|
|
842
847
|
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
@@ -2456,7 +2461,7 @@ class Contact {
|
|
|
2456
2461
|
this[key] = old[key] || this[key];
|
|
2457
2462
|
});
|
|
2458
2463
|
|
|
2459
|
-
if (old.lineState
|
|
2464
|
+
if (old.lineState) {
|
|
2460
2465
|
this.lineState = old.lineState;
|
|
2461
2466
|
}
|
|
2462
2467
|
|
package/lib/api/agentd.js
CHANGED
|
@@ -446,7 +446,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
446
446
|
|
|
447
447
|
// Use a function here to be able to mock it in tests
|
|
448
448
|
const realFetch = () => {
|
|
449
|
-
if (typeof document !== 'undefined') {
|
|
449
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
450
450
|
// Browser
|
|
451
451
|
return window.fetch;
|
|
452
452
|
}
|
package/lib/api/amid.js
CHANGED
|
@@ -374,7 +374,7 @@ IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
374
374
|
|
|
375
375
|
// Use a function here to be able to mock it in tests
|
|
376
376
|
const realFetch = () => {
|
|
377
|
-
if (typeof document !== 'undefined') {
|
|
377
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
378
378
|
// Browser
|
|
379
379
|
return window.fetch;
|
|
380
380
|
}
|
package/lib/api/application.js
CHANGED
|
@@ -446,7 +446,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
446
446
|
|
|
447
447
|
// Use a function here to be able to mock it in tests
|
|
448
448
|
const realFetch = () => {
|
|
449
|
-
if (typeof document !== 'undefined') {
|
|
449
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
450
450
|
// Browser
|
|
451
451
|
return window.fetch;
|
|
452
452
|
}
|
package/lib/api/auth.js
CHANGED
|
@@ -449,7 +449,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
449
449
|
|
|
450
450
|
// Use a function here to be able to mock it in tests
|
|
451
451
|
const realFetch = () => {
|
|
452
|
-
if (typeof document !== 'undefined') {
|
|
452
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
453
453
|
// Browser
|
|
454
454
|
return window.fetch;
|
|
455
455
|
}
|
package/lib/api/call-logd.js
CHANGED
|
@@ -375,7 +375,7 @@ IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
375
375
|
|
|
376
376
|
// Use a function here to be able to mock it in tests
|
|
377
377
|
const realFetch = () => {
|
|
378
|
-
if (typeof document !== 'undefined') {
|
|
378
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
379
379
|
// Browser
|
|
380
380
|
return window.fetch;
|
|
381
381
|
}
|
package/lib/api/calld.js
CHANGED
|
@@ -447,7 +447,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
447
447
|
|
|
448
448
|
// Use a function here to be able to mock it in tests
|
|
449
449
|
const realFetch = () => {
|
|
450
|
-
if (typeof document !== 'undefined') {
|
|
450
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
451
451
|
// Browser
|
|
452
452
|
return window.fetch;
|
|
453
453
|
}
|
package/lib/api/chatd.js
CHANGED
|
@@ -446,7 +446,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
446
446
|
|
|
447
447
|
// Use a function here to be able to mock it in tests
|
|
448
448
|
const realFetch = () => {
|
|
449
|
-
if (typeof document !== 'undefined') {
|
|
449
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
450
450
|
// Browser
|
|
451
451
|
return window.fetch;
|
|
452
452
|
}
|
package/lib/api/confd.js
CHANGED
|
@@ -446,7 +446,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
446
446
|
|
|
447
447
|
// Use a function here to be able to mock it in tests
|
|
448
448
|
const realFetch = () => {
|
|
449
|
-
if (typeof document !== 'undefined') {
|
|
449
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
450
450
|
// Browser
|
|
451
451
|
return window.fetch;
|
|
452
452
|
}
|
package/lib/api/ctid-ng.js
CHANGED
|
@@ -450,7 +450,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
450
450
|
|
|
451
451
|
// Use a function here to be able to mock it in tests
|
|
452
452
|
const realFetch = () => {
|
|
453
|
-
if (typeof document !== 'undefined') {
|
|
453
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
454
454
|
// Browser
|
|
455
455
|
return window.fetch;
|
|
456
456
|
}
|
package/lib/api/dird.js
CHANGED
|
@@ -448,7 +448,7 @@ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
448
448
|
|
|
449
449
|
// Use a function here to be able to mock it in tests
|
|
450
450
|
const realFetch = () => {
|
|
451
|
-
if (typeof document !== 'undefined') {
|
|
451
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
452
452
|
// Browser
|
|
453
453
|
return window.fetch;
|
|
454
454
|
}
|
|
@@ -1394,7 +1394,7 @@ class Contact {
|
|
|
1394
1394
|
this[key] = old[key] || this[key];
|
|
1395
1395
|
});
|
|
1396
1396
|
|
|
1397
|
-
if (old.lineState
|
|
1397
|
+
if (old.lineState) {
|
|
1398
1398
|
this.lineState = old.lineState;
|
|
1399
1399
|
}
|
|
1400
1400
|
|
package/lib/api/webhookd.js
CHANGED
|
@@ -374,7 +374,7 @@ IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
374
374
|
|
|
375
375
|
// Use a function here to be able to mock it in tests
|
|
376
376
|
const realFetch = () => {
|
|
377
|
-
if (typeof document !== 'undefined') {
|
|
377
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
378
378
|
// Browser
|
|
379
379
|
return window.fetch;
|
|
380
380
|
}
|
package/lib/api-client.js
CHANGED
|
@@ -450,7 +450,7 @@ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
450
450
|
|
|
451
451
|
// Use a function here to be able to mock it in tests
|
|
452
452
|
const realFetch = () => {
|
|
453
|
-
if (typeof document !== 'undefined') {
|
|
453
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
454
454
|
// Browser
|
|
455
455
|
return window.fetch;
|
|
456
456
|
}
|
|
@@ -1910,7 +1910,7 @@ class Contact {
|
|
|
1910
1910
|
this[key] = old[key] || this[key];
|
|
1911
1911
|
});
|
|
1912
1912
|
|
|
1913
|
-
if (old.lineState
|
|
1913
|
+
if (old.lineState) {
|
|
1914
1914
|
this.lineState = old.lineState;
|
|
1915
1915
|
}
|
|
1916
1916
|
|
package/lib/checker/Checker.js
CHANGED
|
@@ -472,7 +472,7 @@ const logger$4 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
472
472
|
|
|
473
473
|
// Use a function here to be able to mock it in tests
|
|
474
474
|
const realFetch = () => {
|
|
475
|
-
if (typeof document !== 'undefined') {
|
|
475
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
476
476
|
// Browser
|
|
477
477
|
return window.fetch;
|
|
478
478
|
}
|
|
@@ -1932,7 +1932,7 @@ class Contact {
|
|
|
1932
1932
|
this[key] = old[key] || this[key];
|
|
1933
1933
|
});
|
|
1934
1934
|
|
|
1935
|
-
if (old.lineState
|
|
1935
|
+
if (old.lineState) {
|
|
1936
1936
|
this.lineState = old.lineState;
|
|
1937
1937
|
}
|
|
1938
1938
|
|
|
@@ -5489,11 +5489,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5489
5489
|
|
|
5490
5490
|
// $FlowFixMe
|
|
5491
5491
|
setRemoteSessionDescription(sessionDescription ) {
|
|
5492
|
-
|
|
5492
|
+
try {
|
|
5493
|
+
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
5493
5494
|
|
|
5494
|
-
|
|
5495
|
+
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
5495
5496
|
|
|
5496
|
-
|
|
5497
|
+
return result;
|
|
5498
|
+
} catch (error) {
|
|
5499
|
+
this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
|
|
5500
|
+
throw error;
|
|
5501
|
+
}
|
|
5497
5502
|
}
|
|
5498
5503
|
|
|
5499
5504
|
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
@@ -450,7 +450,7 @@ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
450
450
|
|
|
451
451
|
// Use a function here to be able to mock it in tests
|
|
452
452
|
const realFetch = () => {
|
|
453
|
-
if (typeof document !== 'undefined') {
|
|
453
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
454
454
|
// Browser
|
|
455
455
|
return window.fetch;
|
|
456
456
|
}
|
|
@@ -1910,7 +1910,7 @@ class Contact {
|
|
|
1910
1910
|
this[key] = old[key] || this[key];
|
|
1911
1911
|
});
|
|
1912
1912
|
|
|
1913
|
-
if (old.lineState
|
|
1913
|
+
if (old.lineState) {
|
|
1914
1914
|
this.lineState = old.lineState;
|
|
1915
1915
|
}
|
|
1916
1916
|
|
|
@@ -450,7 +450,7 @@ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
|
450
450
|
|
|
451
451
|
// Use a function here to be able to mock it in tests
|
|
452
452
|
const realFetch = () => {
|
|
453
|
-
if (typeof document !== 'undefined') {
|
|
453
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
454
454
|
// Browser
|
|
455
455
|
return window.fetch;
|
|
456
456
|
}
|
|
@@ -1910,7 +1910,7 @@ class Contact {
|
|
|
1910
1910
|
this[key] = old[key] || this[key];
|
|
1911
1911
|
});
|
|
1912
1912
|
|
|
1913
|
-
if (old.lineState
|
|
1913
|
+
if (old.lineState) {
|
|
1914
1914
|
this.lineState = old.lineState;
|
|
1915
1915
|
}
|
|
1916
1916
|
|