@wazo/sdk 0.37.24 → 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.
- package/README.md +96 -58
- package/dist/wazo-sdk.js +6 -6
- package/esm/__tests__/api-client.test.js +14 -14
- package/esm/__tests__/web-rtc-client.test.js +130 -108
- package/esm/api/agentd.js +1 -1
- package/esm/api/amid.js +2 -2
- package/esm/api/application.js +1 -1
- package/esm/api/auth.js +1 -1
- package/esm/api/call-logd.js +3 -3
- 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 +4 -4
- package/esm/api/dird.js +3 -3
- package/esm/api/webhookd.js +2 -2
- package/esm/api-client.js +14 -14
- package/esm/checker/Checker.js +155 -133
- package/esm/checker/checks/aor.js +14 -14
- package/esm/checker/checks/api.js +14 -14
- package/esm/checker/checks/index.js +145 -123
- package/esm/checker/checks/wazo-websocket.js +16 -16
- package/esm/checker/checks/webrtc-transport.js +130 -108
- package/esm/checker/checks/webrtc.js +130 -108
- package/esm/domain/AdHocAPIConference.js +14 -14
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/CallSession.js +15 -0
- package/esm/domain/Contact.js +2 -2
- package/esm/domain/Features.js +14 -14
- package/esm/domain/Phone/CTIPhone.js +43 -28
- package/esm/domain/Phone/WebRTCPhone.js +126 -90
- package/esm/domain/SFUNotAvailableError.js +9 -0
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/CallSession.test.js +15 -0
- package/esm/domain/__tests__/Contact.test.js +2 -2
- package/esm/domain/__tests__/IndirectTransfer.test.js +15 -0
- package/esm/domain/__tests__/Room.test.js +15 -0
- package/esm/index.js +415 -346
- package/esm/lib/WazoSessionDescriptionHandler.js +10 -5
- package/esm/service/CallApi.js +14 -14
- package/esm/service/IssueReporter.js +2 -2
- package/esm/service/__tests__/IssueReporter.test.js +2 -2
- package/esm/service/getApiClient.js +14 -14
- package/esm/simple/Auth.js +404 -336
- package/esm/simple/Configuration.js +404 -336
- package/esm/simple/Directory.js +14 -14
- package/esm/simple/Phone.js +404 -336
- package/esm/simple/Websocket.js +18 -18
- package/esm/simple/index.js +408 -340
- package/esm/simple/room/LocalParticipant.js +408 -340
- package/esm/simple/room/Participant.js +408 -340
- package/esm/simple/room/RemoteParticipant.js +408 -340
- package/esm/simple/room/Room.js +409 -341
- package/esm/simple/room/SipRoom.js +408 -340
- package/esm/simple/room/Stream.js +408 -340
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +408 -340
- package/esm/simple/utils.js +408 -340
- package/esm/utils/__tests__/api-requester.test.js +1 -1
- package/esm/utils/api-requester.js +1 -1
- package/esm/web-rtc-client.js +130 -108
- package/esm/websocket-client.js +16 -16
- package/lib/__tests__/api-client.test.js +14 -14
- package/lib/__tests__/web-rtc-client.test.js +130 -108
- package/lib/api/agentd.js +1 -1
- package/lib/api/amid.js +2 -2
- package/lib/api/application.js +1 -1
- package/lib/api/auth.js +1 -1
- package/lib/api/call-logd.js +3 -3
- 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 +4 -4
- package/lib/api/dird.js +3 -3
- package/lib/api/webhookd.js +2 -2
- package/lib/api-client.js +14 -14
- package/lib/checker/Checker.js +155 -133
- package/lib/checker/checks/aor.js +14 -14
- package/lib/checker/checks/api.js +14 -14
- package/lib/checker/checks/index.js +145 -123
- package/lib/checker/checks/wazo-websocket.js +16 -16
- package/lib/checker/checks/webrtc-transport.js +130 -108
- package/lib/checker/checks/webrtc.js +130 -108
- package/lib/domain/AdHocAPIConference.js +14 -14
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/CallSession.js +15 -0
- package/lib/domain/Contact.js +2 -2
- package/lib/domain/Features.js +14 -14
- package/lib/domain/Phone/CTIPhone.js +43 -28
- package/lib/domain/Phone/WebRTCPhone.js +126 -89
- package/lib/domain/SFUNotAvailableError.js +11 -0
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/CallSession.test.js +15 -0
- package/lib/domain/__tests__/Contact.test.js +2 -2
- package/lib/domain/__tests__/IndirectTransfer.test.js +15 -0
- package/lib/domain/__tests__/Room.test.js +15 -0
- package/lib/index.js +415 -346
- package/lib/lib/WazoSessionDescriptionHandler.js +10 -5
- package/lib/service/CallApi.js +14 -14
- package/lib/service/IssueReporter.js +2 -2
- package/lib/service/__tests__/IssueReporter.test.js +2 -2
- package/lib/service/getApiClient.js +14 -14
- package/lib/simple/Auth.js +404 -336
- package/lib/simple/Configuration.js +404 -336
- package/lib/simple/Directory.js +14 -14
- package/lib/simple/Phone.js +404 -336
- package/lib/simple/Websocket.js +18 -18
- package/lib/simple/index.js +408 -340
- package/lib/simple/room/LocalParticipant.js +408 -340
- package/lib/simple/room/Participant.js +408 -340
- package/lib/simple/room/RemoteParticipant.js +408 -340
- package/lib/simple/room/Room.js +409 -341
- package/lib/simple/room/SipRoom.js +408 -340
- package/lib/simple/room/Stream.js +408 -340
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +408 -340
- package/lib/simple/utils.js +408 -340
- package/lib/utils/__tests__/api-requester.test.js +1 -1
- package/lib/utils/api-requester.js +1 -1
- package/lib/web-rtc-client.js +130 -108
- package/lib/websocket-client.js +16 -16
- package/package.json +1 -1
- package/src/domain/CallSession.js +16 -0
- package/src/domain/Contact.js +1 -1
- package/src/domain/Phone/WebRTCPhone.js +25 -4
- package/src/domain/SFUNotAvailableError.js +7 -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/src/web-rtc-client.js +27 -10
|
@@ -138,11 +138,11 @@ const isMobile = () => typeof navigator !== 'undefined' && navigator.product ===
|
|
|
138
138
|
|
|
139
139
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
140
140
|
|
|
141
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
141
|
+
const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
142
142
|
|
|
143
143
|
// Use a function here to be able to mock it in tests
|
|
144
144
|
const realFetch = () => {
|
|
145
|
-
if (typeof document !== 'undefined') {
|
|
145
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
146
146
|
// Browser
|
|
147
147
|
return window.fetch;
|
|
148
148
|
}
|
|
@@ -277,7 +277,7 @@ class ApiRequester {
|
|
|
277
277
|
};
|
|
278
278
|
|
|
279
279
|
if (this.refreshTokenPromise) {
|
|
280
|
-
logger.info('A token is already refreshing, waiting ...', { url });
|
|
280
|
+
logger$c.info('A token is already refreshing, waiting ...', { url });
|
|
281
281
|
await this.refreshTokenPromise;
|
|
282
282
|
}
|
|
283
283
|
|
|
@@ -297,7 +297,7 @@ class ApiRequester {
|
|
|
297
297
|
return promise.then(async (err ) => {
|
|
298
298
|
// Check if the token is still valid
|
|
299
299
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
300
|
-
logger.warn('token expired', { error: err.reason });
|
|
300
|
+
logger$c.warn('token expired', { error: err.reason });
|
|
301
301
|
// Replay the call after refreshing the token
|
|
302
302
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
303
303
|
}
|
|
@@ -307,7 +307,7 @@ class ApiRequester {
|
|
|
307
307
|
: exceptionClass.fromResponse(err, response.status);
|
|
308
308
|
|
|
309
309
|
if (this.shouldLogErrors) {
|
|
310
|
-
logger.error('API error', error);
|
|
310
|
+
logger$c.error('API error', error);
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
throw error;
|
|
@@ -317,7 +317,7 @@ class ApiRequester {
|
|
|
317
317
|
return newParse(response, isJson);
|
|
318
318
|
}).catch(error => {
|
|
319
319
|
if (this.shouldLogErrors) {
|
|
320
|
-
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
320
|
+
logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
throw error;
|
|
@@ -345,13 +345,13 @@ class ApiRequester {
|
|
|
345
345
|
) {
|
|
346
346
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
347
347
|
let newPath = path;
|
|
348
|
-
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
348
|
+
logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
349
349
|
|
|
350
350
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
351
351
|
|
|
352
352
|
return this.refreshTokenPromise.then(() => {
|
|
353
353
|
this.refreshTokenPromise = null;
|
|
354
|
-
logger.info('token refreshed', { isTokenNotFound });
|
|
354
|
+
logger$c.info('token refreshed', { isTokenNotFound });
|
|
355
355
|
if (isTokenNotFound) {
|
|
356
356
|
const pathParts = path.split('/');
|
|
357
357
|
pathParts.pop();
|
|
@@ -1959,7 +1959,7 @@ class Contact {
|
|
|
1959
1959
|
this[key] = old[key] || this[key];
|
|
1960
1960
|
});
|
|
1961
1961
|
|
|
1962
|
-
if (old.lineState
|
|
1962
|
+
if (old.lineState) {
|
|
1963
1963
|
this.lineState = old.lineState;
|
|
1964
1964
|
}
|
|
1965
1965
|
|
|
@@ -3289,8 +3289,10 @@ var updateFrom = (instance , from ) => {
|
|
|
3289
3289
|
|
|
3290
3290
|
|
|
3291
3291
|
|
|
3292
|
+
|
|
3292
3293
|
|
|
3293
3294
|
|
|
3295
|
+
|
|
3294
3296
|
|
|
3295
3297
|
|
|
3296
3298
|
|
|
@@ -3307,6 +3309,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3307
3309
|
|
|
3308
3310
|
|
|
3309
3311
|
|
|
3312
|
+
|
|
3310
3313
|
|
|
3311
3314
|
|
|
3312
3315
|
class CallSession {
|
|
@@ -3326,8 +3329,12 @@ class CallSession {
|
|
|
3326
3329
|
|
|
3327
3330
|
|
|
3328
3331
|
|
|
3332
|
+
|
|
3333
|
+
|
|
3329
3334
|
|
|
3330
3335
|
|
|
3336
|
+
|
|
3337
|
+
|
|
3331
3338
|
|
|
3332
3339
|
|
|
3333
3340
|
|
|
@@ -3365,6 +3372,8 @@ class CallSession {
|
|
|
3365
3372
|
|
|
3366
3373
|
|
|
3367
3374
|
|
|
3375
|
+
|
|
3376
|
+
|
|
3368
3377
|
|
|
3369
3378
|
constructor({
|
|
3370
3379
|
answered,
|
|
@@ -3378,6 +3387,8 @@ class CallSession {
|
|
|
3378
3387
|
paused,
|
|
3379
3388
|
ringing,
|
|
3380
3389
|
startTime,
|
|
3390
|
+
creationTime,
|
|
3391
|
+
endTime,
|
|
3381
3392
|
cameraEnabled,
|
|
3382
3393
|
dialedExtension,
|
|
3383
3394
|
sipCallId,
|
|
@@ -3390,12 +3401,15 @@ class CallSession {
|
|
|
3390
3401
|
recording,
|
|
3391
3402
|
recordingPaused,
|
|
3392
3403
|
videoRemotelyDowngraded,
|
|
3404
|
+
sipSession,
|
|
3393
3405
|
} ) {
|
|
3394
3406
|
this.callId = callId;
|
|
3395
3407
|
this.sipCallId = sipCallId;
|
|
3396
3408
|
this.displayName = displayName;
|
|
3397
3409
|
this.number = number;
|
|
3410
|
+
this.creationTime = creationTime;
|
|
3398
3411
|
this.startTime = startTime;
|
|
3412
|
+
this.endTime = endTime;
|
|
3399
3413
|
this.isCaller = isCaller;
|
|
3400
3414
|
this.answered = answered;
|
|
3401
3415
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -3414,6 +3428,7 @@ class CallSession {
|
|
|
3414
3428
|
this.recording = recording || false;
|
|
3415
3429
|
this.recordingPaused = recordingPaused || false;
|
|
3416
3430
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3431
|
+
this.sipSession = sipSession;
|
|
3417
3432
|
|
|
3418
3433
|
// Useful to compare instead of instanceof with minified code
|
|
3419
3434
|
this.type = 'CallSession';
|
|
@@ -4063,7 +4078,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4063
4078
|
|
|
4064
4079
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4065
4080
|
|
|
4066
|
-
const logger$
|
|
4081
|
+
const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4067
4082
|
|
|
4068
4083
|
class CTIPhone extends Emitter {
|
|
4069
4084
|
|
|
@@ -4076,7 +4091,7 @@ class CTIPhone extends Emitter {
|
|
|
4076
4091
|
|
|
4077
4092
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4078
4093
|
super();
|
|
4079
|
-
logger$
|
|
4094
|
+
logger$b.info('CTI Phone created');
|
|
4080
4095
|
this.session = session;
|
|
4081
4096
|
this.isMobile = isMobile;
|
|
4082
4097
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4137,7 +4152,7 @@ class CTIPhone extends Emitter {
|
|
|
4137
4152
|
}
|
|
4138
4153
|
|
|
4139
4154
|
async makeCall(number , line ) {
|
|
4140
|
-
logger$
|
|
4155
|
+
logger$b.info('make CTI call', { number });
|
|
4141
4156
|
|
|
4142
4157
|
if (!number) {
|
|
4143
4158
|
return null;
|
|
@@ -4160,7 +4175,7 @@ class CTIPhone extends Emitter {
|
|
|
4160
4175
|
if (!callSession) {
|
|
4161
4176
|
return Promise.resolve(null);
|
|
4162
4177
|
}
|
|
4163
|
-
logger$
|
|
4178
|
+
logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4164
4179
|
|
|
4165
4180
|
if (!this.currentCall) {
|
|
4166
4181
|
this.currentCall = callSession.call;
|
|
@@ -4173,7 +4188,7 @@ class CTIPhone extends Emitter {
|
|
|
4173
4188
|
if (!callSession) {
|
|
4174
4189
|
return;
|
|
4175
4190
|
}
|
|
4176
|
-
logger$
|
|
4191
|
+
logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4177
4192
|
|
|
4178
4193
|
this.currentCall = undefined;
|
|
4179
4194
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4183,7 +4198,7 @@ class CTIPhone extends Emitter {
|
|
|
4183
4198
|
if (!callSession) {
|
|
4184
4199
|
return Promise.resolve(false);
|
|
4185
4200
|
}
|
|
4186
|
-
logger$
|
|
4201
|
+
logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4187
4202
|
|
|
4188
4203
|
try {
|
|
4189
4204
|
await CallApi.cancelCall(callSession);
|
|
@@ -4194,7 +4209,7 @@ class CTIPhone extends Emitter {
|
|
|
4194
4209
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4195
4210
|
return true;
|
|
4196
4211
|
} catch (e) {
|
|
4197
|
-
logger$
|
|
4212
|
+
logger$b.error('hangup CTI call, error', e);
|
|
4198
4213
|
|
|
4199
4214
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4200
4215
|
return false;
|
|
@@ -4207,7 +4222,7 @@ class CTIPhone extends Emitter {
|
|
|
4207
4222
|
if (!callSession) {
|
|
4208
4223
|
return;
|
|
4209
4224
|
}
|
|
4210
|
-
logger$
|
|
4225
|
+
logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4211
4226
|
|
|
4212
4227
|
await CallApi.cancelCall(callSession);
|
|
4213
4228
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4217,7 +4232,7 @@ class CTIPhone extends Emitter {
|
|
|
4217
4232
|
if (!callSession) {
|
|
4218
4233
|
return;
|
|
4219
4234
|
}
|
|
4220
|
-
logger$
|
|
4235
|
+
logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4221
4236
|
|
|
4222
4237
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4223
4238
|
}
|
|
@@ -4230,19 +4245,19 @@ class CTIPhone extends Emitter {
|
|
|
4230
4245
|
if (!callSession) {
|
|
4231
4246
|
return;
|
|
4232
4247
|
}
|
|
4233
|
-
logger$
|
|
4248
|
+
logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4234
4249
|
|
|
4235
4250
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4236
4251
|
}
|
|
4237
4252
|
|
|
4238
4253
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4239
|
-
logger$
|
|
4254
|
+
logger$b.info('cancel CTI transfer', { transferId });
|
|
4240
4255
|
|
|
4241
4256
|
return CallApi.cancelCallTransfer(transferId);
|
|
4242
4257
|
}
|
|
4243
4258
|
|
|
4244
4259
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4245
|
-
logger$
|
|
4260
|
+
logger$b.info('confirm CTI transfer', { transferId });
|
|
4246
4261
|
|
|
4247
4262
|
return CallApi.confirmCallTransfer(transferId);
|
|
4248
4263
|
}
|
|
@@ -4251,19 +4266,19 @@ class CTIPhone extends Emitter {
|
|
|
4251
4266
|
if (!callSession) {
|
|
4252
4267
|
return;
|
|
4253
4268
|
}
|
|
4254
|
-
logger$
|
|
4269
|
+
logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4255
4270
|
|
|
4256
4271
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4257
4272
|
}
|
|
4258
4273
|
|
|
4259
4274
|
onConnectionMade() {
|
|
4260
|
-
logger$
|
|
4275
|
+
logger$b.info('on CTI connection made');
|
|
4261
4276
|
|
|
4262
4277
|
this.eventEmitter.emit('onCallAccepted');
|
|
4263
4278
|
}
|
|
4264
4279
|
|
|
4265
4280
|
async close() {
|
|
4266
|
-
logger$
|
|
4281
|
+
logger$b.info('CTI close');
|
|
4267
4282
|
|
|
4268
4283
|
return Promise.resolve();
|
|
4269
4284
|
}
|
|
@@ -4272,7 +4287,7 @@ class CTIPhone extends Emitter {
|
|
|
4272
4287
|
if (!callSession) {
|
|
4273
4288
|
return;
|
|
4274
4289
|
}
|
|
4275
|
-
logger$
|
|
4290
|
+
logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4276
4291
|
|
|
4277
4292
|
return CallApi.hold(callSession.callId);
|
|
4278
4293
|
}
|
|
@@ -4281,7 +4296,7 @@ class CTIPhone extends Emitter {
|
|
|
4281
4296
|
if (!callSession) {
|
|
4282
4297
|
return;
|
|
4283
4298
|
}
|
|
4284
|
-
logger$
|
|
4299
|
+
logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4285
4300
|
|
|
4286
4301
|
return CallApi.resume(callSession.callId);
|
|
4287
4302
|
}
|
|
@@ -4290,7 +4305,7 @@ class CTIPhone extends Emitter {
|
|
|
4290
4305
|
if (!callSession) {
|
|
4291
4306
|
return;
|
|
4292
4307
|
}
|
|
4293
|
-
logger$
|
|
4308
|
+
logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4294
4309
|
|
|
4295
4310
|
return CallApi.mute(callSession.callId);
|
|
4296
4311
|
}
|
|
@@ -4299,7 +4314,7 @@ class CTIPhone extends Emitter {
|
|
|
4299
4314
|
if (!callSession) {
|
|
4300
4315
|
return;
|
|
4301
4316
|
}
|
|
4302
|
-
logger$
|
|
4317
|
+
logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4303
4318
|
|
|
4304
4319
|
return CallApi.unmute(callSession.callId);
|
|
4305
4320
|
}
|
|
@@ -5308,7 +5323,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5308
5323
|
const WEBHOOKD_VERSION = '1.0';
|
|
5309
5324
|
const AMID_VERSION = '1.0';
|
|
5310
5325
|
|
|
5311
|
-
const logger$
|
|
5326
|
+
const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5312
5327
|
|
|
5313
5328
|
class ApiClient {
|
|
5314
5329
|
|
|
@@ -5360,12 +5375,12 @@ class ApiClient {
|
|
|
5360
5375
|
}
|
|
5361
5376
|
|
|
5362
5377
|
async forceRefreshToken() {
|
|
5363
|
-
logger$
|
|
5378
|
+
logger$a.info('forcing refresh token, calling callback');
|
|
5364
5379
|
return this.refreshTokenCallback();
|
|
5365
5380
|
}
|
|
5366
5381
|
|
|
5367
5382
|
async refreshTokenCallback() {
|
|
5368
|
-
logger$
|
|
5383
|
+
logger$a.info('refresh token callback called', {
|
|
5369
5384
|
refreshToken: this.refreshToken,
|
|
5370
5385
|
refreshBackend: this.refreshBackend,
|
|
5371
5386
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5383,7 +5398,7 @@ class ApiClient {
|
|
|
5383
5398
|
this.isMobile,
|
|
5384
5399
|
);
|
|
5385
5400
|
|
|
5386
|
-
logger$
|
|
5401
|
+
logger$a.info('token refreshed', { token: session.token });
|
|
5387
5402
|
|
|
5388
5403
|
if (this.onRefreshToken) {
|
|
5389
5404
|
this.onRefreshToken(session.token, session);
|
|
@@ -5524,7 +5539,7 @@ var getApiClient = (forServer ) => {
|
|
|
5524
5539
|
class InvalidSubscription extends Error {}
|
|
5525
5540
|
class InvalidAuthorization extends Error {}
|
|
5526
5541
|
|
|
5527
|
-
const logger$
|
|
5542
|
+
const logger$9 = IssueReporter$1.loggerFor('simple-auth');
|
|
5528
5543
|
|
|
5529
5544
|
class Auth {
|
|
5530
5545
|
|
|
@@ -5559,7 +5574,7 @@ class Auth {
|
|
|
5559
5574
|
setApiClientId(this.clientId);
|
|
5560
5575
|
setRefreshExpiration(this.expiration);
|
|
5561
5576
|
setOnRefreshToken((token , session ) => {
|
|
5562
|
-
logger$
|
|
5577
|
+
logger$9.info('on refresh token done', { token });
|
|
5563
5578
|
setApiToken(token);
|
|
5564
5579
|
Wazo.Websocket.updateToken(token);
|
|
5565
5580
|
|
|
@@ -5604,7 +5619,7 @@ class Auth {
|
|
|
5604
5619
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
5605
5620
|
return this._onAuthenticated(rawSession);
|
|
5606
5621
|
} catch (e) {
|
|
5607
|
-
logger$
|
|
5622
|
+
logger$9.error('on validate token error', e);
|
|
5608
5623
|
console.warn(e);
|
|
5609
5624
|
return false;
|
|
5610
5625
|
}
|
|
@@ -5960,7 +5975,7 @@ class AdHocAPIConference {
|
|
|
5960
5975
|
|
|
5961
5976
|
/* */
|
|
5962
5977
|
|
|
5963
|
-
const parseCandidate = (candidate ) => {
|
|
5978
|
+
const parseCandidate$1 = (candidate ) => {
|
|
5964
5979
|
if (!candidate) {
|
|
5965
5980
|
return null;
|
|
5966
5981
|
}
|
|
@@ -6072,11 +6087,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6072
6087
|
|
|
6073
6088
|
// $FlowFixMe
|
|
6074
6089
|
setRemoteSessionDescription(sessionDescription ) {
|
|
6075
|
-
|
|
6090
|
+
try {
|
|
6091
|
+
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
6076
6092
|
|
|
6077
|
-
|
|
6093
|
+
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
6078
6094
|
|
|
6079
|
-
|
|
6095
|
+
return result;
|
|
6096
|
+
} catch (error) {
|
|
6097
|
+
this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
|
|
6098
|
+
throw error;
|
|
6099
|
+
}
|
|
6080
6100
|
}
|
|
6081
6101
|
|
|
6082
6102
|
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
@@ -6114,7 +6134,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6114
6134
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
6115
6135
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6116
6136
|
if (event.candidate) {
|
|
6117
|
-
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
6137
|
+
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6118
6138
|
}
|
|
6119
6139
|
};
|
|
6120
6140
|
|
|
@@ -6578,7 +6598,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6578
6598
|
const SEND_STATS_DELAY = 5000;
|
|
6579
6599
|
|
|
6580
6600
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6581
|
-
const logger$
|
|
6601
|
+
const logger$8 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6582
6602
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6583
6603
|
|
|
6584
6604
|
// events
|
|
@@ -6592,14 +6612,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6592
6612
|
const MESSAGE = 'message';
|
|
6593
6613
|
const ACCEPTED = 'accepted';
|
|
6594
6614
|
const REJECTED = 'rejected';
|
|
6595
|
-
const ON_TRACK = 'onTrack';
|
|
6596
|
-
const ON_REINVITE = 'reinvite';
|
|
6615
|
+
const ON_TRACK$1 = 'onTrack';
|
|
6616
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
6597
6617
|
const ON_ERROR = 'onError';
|
|
6598
6618
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6599
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6600
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
6619
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6620
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6601
6621
|
|
|
6602
|
-
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6622
|
+
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6603
6623
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6604
6624
|
class CanceledCallError extends Error {}
|
|
6605
6625
|
|
|
@@ -6735,12 +6755,12 @@ class WebRTCClient extends Emitter {
|
|
|
6735
6755
|
this.MESSAGE = MESSAGE;
|
|
6736
6756
|
this.ACCEPTED = ACCEPTED;
|
|
6737
6757
|
this.REJECTED = REJECTED;
|
|
6738
|
-
this.ON_TRACK = ON_TRACK;
|
|
6739
|
-
this.ON_REINVITE = ON_REINVITE;
|
|
6758
|
+
this.ON_TRACK = ON_TRACK$1;
|
|
6759
|
+
this.ON_REINVITE = ON_REINVITE$1;
|
|
6740
6760
|
this.ON_ERROR = ON_ERROR;
|
|
6741
6761
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6742
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6743
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6762
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6763
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6744
6764
|
}
|
|
6745
6765
|
|
|
6746
6766
|
configureMedia(media ) {
|
|
@@ -6757,13 +6777,13 @@ class WebRTCClient extends Emitter {
|
|
|
6757
6777
|
|
|
6758
6778
|
createUserAgent(configOverrides ) {
|
|
6759
6779
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6760
|
-
logger$
|
|
6780
|
+
logger$8.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6761
6781
|
|
|
6762
6782
|
webRTCConfiguration.delegate = {
|
|
6763
6783
|
onConnect: this.onConnect.bind(this),
|
|
6764
6784
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6765
6785
|
onInvite: (invitation ) => {
|
|
6766
|
-
logger$
|
|
6786
|
+
logger$8.info('sdk webrtc on invite', {
|
|
6767
6787
|
method: 'delegate.onInvite',
|
|
6768
6788
|
id: invitation.id,
|
|
6769
6789
|
remoteURI: invitation.remoteURI,
|
|
@@ -6806,7 +6826,7 @@ class WebRTCClient extends Emitter {
|
|
|
6806
6826
|
}
|
|
6807
6827
|
|
|
6808
6828
|
onConnect() {
|
|
6809
|
-
logger$
|
|
6829
|
+
logger$8.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6810
6830
|
this.eventEmitter.emit(CONNECTED);
|
|
6811
6831
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6812
6832
|
this.registerer.waitingToggle(false);
|
|
@@ -6815,7 +6835,7 @@ class WebRTCClient extends Emitter {
|
|
|
6815
6835
|
}
|
|
6816
6836
|
|
|
6817
6837
|
async onDisconnect(error ) {
|
|
6818
|
-
logger$
|
|
6838
|
+
logger$8.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6819
6839
|
this.connectionPromise = null;
|
|
6820
6840
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6821
6841
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6840,37 +6860,37 @@ class WebRTCClient extends Emitter {
|
|
|
6840
6860
|
};
|
|
6841
6861
|
|
|
6842
6862
|
if (this.skipRegister) {
|
|
6843
|
-
logger$
|
|
6863
|
+
logger$8.info('sdk webrtc skip register...', logInfo);
|
|
6844
6864
|
return Promise.resolve();
|
|
6845
6865
|
}
|
|
6846
6866
|
|
|
6847
|
-
logger$
|
|
6867
|
+
logger$8.info('sdk webrtc registering...', logInfo);
|
|
6848
6868
|
|
|
6849
6869
|
if (!this.userAgent) {
|
|
6850
|
-
logger$
|
|
6870
|
+
logger$8.info('sdk webrtc recreating User Agent');
|
|
6851
6871
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6852
6872
|
}
|
|
6853
6873
|
if (!this.userAgent || this.isRegistered()) {
|
|
6854
|
-
logger$
|
|
6874
|
+
logger$8.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6855
6875
|
return Promise.resolve();
|
|
6856
6876
|
}
|
|
6857
6877
|
|
|
6858
6878
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6859
|
-
logger$
|
|
6879
|
+
logger$8.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6860
6880
|
return Promise.resolve();
|
|
6861
6881
|
}
|
|
6862
6882
|
|
|
6863
6883
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6864
6884
|
|
|
6865
6885
|
const onRegisterFailed = () => {
|
|
6866
|
-
logger$
|
|
6886
|
+
logger$8.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6867
6887
|
this.connectionPromise = null;
|
|
6868
6888
|
if (this.registerer && this.registerer.waiting) {
|
|
6869
6889
|
this.registerer.waitingToggle(false);
|
|
6870
6890
|
}
|
|
6871
6891
|
|
|
6872
6892
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6873
|
-
logger$
|
|
6893
|
+
logger$8.info('sdk webrtc registering, retrying...', { tries });
|
|
6874
6894
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6875
6895
|
}
|
|
6876
6896
|
};
|
|
@@ -6879,18 +6899,18 @@ class WebRTCClient extends Emitter {
|
|
|
6879
6899
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6880
6900
|
// during the resolution of the primise.
|
|
6881
6901
|
if (!this.userAgent) {
|
|
6882
|
-
logger$
|
|
6902
|
+
logger$8.info('sdk webrtc recreating User Agent after connection');
|
|
6883
6903
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6884
6904
|
}
|
|
6885
6905
|
|
|
6886
|
-
logger$
|
|
6906
|
+
logger$8.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6887
6907
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
6888
6908
|
this.connectionPromise = null;
|
|
6889
6909
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6890
6910
|
|
|
6891
6911
|
// Bind registerer events
|
|
6892
6912
|
this.registerer.stateChange.addListener(newState => {
|
|
6893
|
-
logger$
|
|
6913
|
+
logger$8.info('sdk webrtc registering, state changed', { newState });
|
|
6894
6914
|
|
|
6895
6915
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
6896
6916
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -6903,7 +6923,7 @@ class WebRTCClient extends Emitter {
|
|
|
6903
6923
|
const options = {
|
|
6904
6924
|
requestDelegate: {
|
|
6905
6925
|
onReject: response => {
|
|
6906
|
-
logger$
|
|
6926
|
+
logger$8.error('sdk webrtc registering, rejected', { response });
|
|
6907
6927
|
|
|
6908
6928
|
onRegisterFailed();
|
|
6909
6929
|
},
|
|
@@ -6911,13 +6931,13 @@ class WebRTCClient extends Emitter {
|
|
|
6911
6931
|
};
|
|
6912
6932
|
|
|
6913
6933
|
return this.registerer.register(options).catch((e) => {
|
|
6914
|
-
logger$
|
|
6934
|
+
logger$8.error('sdk webrtc registering, error', e);
|
|
6915
6935
|
|
|
6916
6936
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6917
6937
|
return e;
|
|
6918
6938
|
});
|
|
6919
6939
|
}).catch(error => {
|
|
6920
|
-
logger$
|
|
6940
|
+
logger$8.error('sdk webrtc registering, transport error', error);
|
|
6921
6941
|
onRegisterFailed();
|
|
6922
6942
|
});
|
|
6923
6943
|
}
|
|
@@ -6946,21 +6966,21 @@ class WebRTCClient extends Emitter {
|
|
|
6946
6966
|
}
|
|
6947
6967
|
|
|
6948
6968
|
unregister() {
|
|
6949
|
-
logger$
|
|
6969
|
+
logger$8.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6950
6970
|
if (!this.registerer) {
|
|
6951
6971
|
return Promise.resolve();
|
|
6952
6972
|
}
|
|
6953
6973
|
|
|
6954
6974
|
try {
|
|
6955
6975
|
return this.registerer.unregister().then(() => {
|
|
6956
|
-
logger$
|
|
6976
|
+
logger$8.info('sdk webrtc unregistered');
|
|
6957
6977
|
this._cleanupRegister();
|
|
6958
6978
|
}).catch(e => {
|
|
6959
|
-
logger$
|
|
6979
|
+
logger$8.error('sdk webrtc unregistering, promise error', e);
|
|
6960
6980
|
this._cleanupRegister();
|
|
6961
6981
|
});
|
|
6962
6982
|
} catch (e) {
|
|
6963
|
-
logger$
|
|
6983
|
+
logger$8.error('sdk webrtc unregistering, error', e);
|
|
6964
6984
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6965
6985
|
// error when the registerer is in a bad state
|
|
6966
6986
|
this._cleanupRegister();
|
|
@@ -6968,7 +6988,7 @@ class WebRTCClient extends Emitter {
|
|
|
6968
6988
|
}
|
|
6969
6989
|
|
|
6970
6990
|
stop() {
|
|
6971
|
-
logger$
|
|
6991
|
+
logger$8.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6972
6992
|
if (!this.userAgent) {
|
|
6973
6993
|
return Promise.resolve();
|
|
6974
6994
|
}
|
|
@@ -6976,12 +6996,12 @@ class WebRTCClient extends Emitter {
|
|
|
6976
6996
|
return this.userAgent.stop().then(() => {
|
|
6977
6997
|
return this._cleanupRegister();
|
|
6978
6998
|
}).catch(e => {
|
|
6979
|
-
logger$
|
|
6999
|
+
logger$8.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6980
7000
|
});
|
|
6981
7001
|
}
|
|
6982
7002
|
|
|
6983
7003
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6984
|
-
logger$
|
|
7004
|
+
logger$8.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6985
7005
|
const inviterOptions = {
|
|
6986
7006
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6987
7007
|
conference,
|
|
@@ -7012,7 +7032,7 @@ class WebRTCClient extends Emitter {
|
|
|
7012
7032
|
this._onAccepted(session, response.session, true);
|
|
7013
7033
|
},
|
|
7014
7034
|
onReject: (response ) => {
|
|
7015
|
-
logger$
|
|
7035
|
+
logger$8.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
7016
7036
|
this._stopSendingStats(session);
|
|
7017
7037
|
this.stopNetworkMonitoring(session);
|
|
7018
7038
|
|
|
@@ -7035,11 +7055,11 @@ class WebRTCClient extends Emitter {
|
|
|
7035
7055
|
}
|
|
7036
7056
|
|
|
7037
7057
|
answer(session , enableVideo ) {
|
|
7038
|
-
logger$
|
|
7058
|
+
logger$8.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
7039
7059
|
|
|
7040
7060
|
if (!session || !session.accept) {
|
|
7041
7061
|
const error = 'No session to answer, or not an invitation';
|
|
7042
|
-
logger$
|
|
7062
|
+
logger$8.warn(error);
|
|
7043
7063
|
return Promise.reject(new Error(error));
|
|
7044
7064
|
}
|
|
7045
7065
|
const options = {
|
|
@@ -7049,15 +7069,15 @@ class WebRTCClient extends Emitter {
|
|
|
7049
7069
|
return session.accept(options).then(() => {
|
|
7050
7070
|
if (session.isCanceled) {
|
|
7051
7071
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
7052
|
-
logger$
|
|
7072
|
+
logger$8.error(message, { id: session.id });
|
|
7053
7073
|
this.onCallEnded(session);
|
|
7054
7074
|
|
|
7055
7075
|
throw new CanceledCallError(message);
|
|
7056
7076
|
}
|
|
7057
|
-
logger$
|
|
7077
|
+
logger$8.info('sdk webrtc answer, accepted.');
|
|
7058
7078
|
this._onAccepted(session);
|
|
7059
7079
|
}).catch(e => {
|
|
7060
|
-
logger$
|
|
7080
|
+
logger$8.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
7061
7081
|
|
|
7062
7082
|
throw e;
|
|
7063
7083
|
});
|
|
@@ -7065,7 +7085,7 @@ class WebRTCClient extends Emitter {
|
|
|
7065
7085
|
|
|
7066
7086
|
hangup(session ) {
|
|
7067
7087
|
const { state, id } = session;
|
|
7068
|
-
logger$
|
|
7088
|
+
logger$8.info('sdk webrtc hangup call', { id, state });
|
|
7069
7089
|
|
|
7070
7090
|
try {
|
|
7071
7091
|
this._stopSendingStats(session);
|
|
@@ -7094,7 +7114,7 @@ class WebRTCClient extends Emitter {
|
|
|
7094
7114
|
|
|
7095
7115
|
return bye();
|
|
7096
7116
|
} catch (error) {
|
|
7097
|
-
logger$
|
|
7117
|
+
logger$8.warn('sdk webrtc hangup, error', error);
|
|
7098
7118
|
}
|
|
7099
7119
|
|
|
7100
7120
|
return null;
|
|
@@ -7112,7 +7132,7 @@ class WebRTCClient extends Emitter {
|
|
|
7112
7132
|
// Fetch and emit an event at `interval` with session network stats
|
|
7113
7133
|
startNetworkMonitoring(session , interval = 1000) {
|
|
7114
7134
|
const sessionId = this.getSipSessionId(session);
|
|
7115
|
-
logger$
|
|
7135
|
+
logger$8.info('starting network inspection', { id: sessionId });
|
|
7116
7136
|
|
|
7117
7137
|
this.sessionNetworkStats[sessionId] = [];
|
|
7118
7138
|
|
|
@@ -7122,7 +7142,7 @@ class WebRTCClient extends Emitter {
|
|
|
7122
7142
|
stopNetworkMonitoring(session ) {
|
|
7123
7143
|
const sessionId = this.getSipSessionId(session);
|
|
7124
7144
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
7125
|
-
logger$
|
|
7145
|
+
logger$8.info('stopping network inspection', { id: sessionId, exists });
|
|
7126
7146
|
|
|
7127
7147
|
if (exists) {
|
|
7128
7148
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -7132,17 +7152,17 @@ class WebRTCClient extends Emitter {
|
|
|
7132
7152
|
}
|
|
7133
7153
|
|
|
7134
7154
|
reject(session ) {
|
|
7135
|
-
logger$
|
|
7155
|
+
logger$8.info('sdk webrtc reject call', { id: session.id });
|
|
7136
7156
|
|
|
7137
7157
|
try {
|
|
7138
7158
|
return session.reject ? session.reject() : session.cancel();
|
|
7139
7159
|
} catch (e) {
|
|
7140
|
-
logger$
|
|
7160
|
+
logger$8.warn('Error when rejecting call', e.message, e.stack);
|
|
7141
7161
|
}
|
|
7142
7162
|
}
|
|
7143
7163
|
|
|
7144
7164
|
async close() {
|
|
7145
|
-
logger$
|
|
7165
|
+
logger$8.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
7146
7166
|
this._cleanupMedia();
|
|
7147
7167
|
this.connectionPromise = null;
|
|
7148
7168
|
|
|
@@ -7173,7 +7193,7 @@ class WebRTCClient extends Emitter {
|
|
|
7173
7193
|
// eg: "INVITE not rejectable in state Completed"
|
|
7174
7194
|
}
|
|
7175
7195
|
this.userAgent = null;
|
|
7176
|
-
logger$
|
|
7196
|
+
logger$8.info('sdk webrtc client closed');
|
|
7177
7197
|
}
|
|
7178
7198
|
|
|
7179
7199
|
getNumber(session ) {
|
|
@@ -7186,13 +7206,13 @@ class WebRTCClient extends Emitter {
|
|
|
7186
7206
|
}
|
|
7187
7207
|
|
|
7188
7208
|
mute(session ) {
|
|
7189
|
-
logger$
|
|
7209
|
+
logger$8.info('sdk webrtc mute', { id: session.id });
|
|
7190
7210
|
|
|
7191
7211
|
this._toggleAudio(session, true);
|
|
7192
7212
|
}
|
|
7193
7213
|
|
|
7194
7214
|
unmute(session ) {
|
|
7195
|
-
logger$
|
|
7215
|
+
logger$8.info('sdk webrtc unmute', { id: session.id });
|
|
7196
7216
|
|
|
7197
7217
|
this._toggleAudio(session, false);
|
|
7198
7218
|
}
|
|
@@ -7232,13 +7252,13 @@ class WebRTCClient extends Emitter {
|
|
|
7232
7252
|
}
|
|
7233
7253
|
|
|
7234
7254
|
toggleCameraOn(session ) {
|
|
7235
|
-
logger$
|
|
7255
|
+
logger$8.info('sdk webrtc toggle camera on', { id: session.id });
|
|
7236
7256
|
|
|
7237
7257
|
this._toggleVideo(session, false);
|
|
7238
7258
|
}
|
|
7239
7259
|
|
|
7240
7260
|
toggleCameraOff(session ) {
|
|
7241
|
-
logger$
|
|
7261
|
+
logger$8.info('sdk webrtc toggle camera off', { id: session.id });
|
|
7242
7262
|
|
|
7243
7263
|
this._toggleVideo(session, true);
|
|
7244
7264
|
}
|
|
@@ -7247,7 +7267,7 @@ class WebRTCClient extends Emitter {
|
|
|
7247
7267
|
const sessionId = this.getSipSessionId(session);
|
|
7248
7268
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
7249
7269
|
|
|
7250
|
-
logger$
|
|
7270
|
+
logger$8.info('sdk webrtc hold', {
|
|
7251
7271
|
sessionId,
|
|
7252
7272
|
keys: Object.keys(this.heldSessions),
|
|
7253
7273
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7296,7 +7316,7 @@ class WebRTCClient extends Emitter {
|
|
|
7296
7316
|
const sessionId = this.getSipSessionId(session);
|
|
7297
7317
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7298
7318
|
|
|
7299
|
-
logger$
|
|
7319
|
+
logger$8.info('sdk webrtc unhold', {
|
|
7300
7320
|
sessionId,
|
|
7301
7321
|
keys: Object.keys(this.heldSessions),
|
|
7302
7322
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7444,7 +7464,7 @@ class WebRTCClient extends Emitter {
|
|
|
7444
7464
|
if (!session.sessionDescriptionHandler) {
|
|
7445
7465
|
return;
|
|
7446
7466
|
}
|
|
7447
|
-
logger$
|
|
7467
|
+
logger$8.info('Sending DTMF', {
|
|
7448
7468
|
id: this.getSipSessionId(session),
|
|
7449
7469
|
tone,
|
|
7450
7470
|
});
|
|
@@ -7460,7 +7480,7 @@ class WebRTCClient extends Emitter {
|
|
|
7460
7480
|
transfer(session , target ) {
|
|
7461
7481
|
this.hold(session);
|
|
7462
7482
|
|
|
7463
|
-
logger$
|
|
7483
|
+
logger$8.info('Transfering a session', {
|
|
7464
7484
|
id: this.getSipSessionId(session),
|
|
7465
7485
|
target,
|
|
7466
7486
|
});
|
|
@@ -7482,17 +7502,17 @@ class WebRTCClient extends Emitter {
|
|
|
7482
7502
|
atxfer(session ) {
|
|
7483
7503
|
this.hold(session);
|
|
7484
7504
|
|
|
7485
|
-
logger$
|
|
7505
|
+
logger$8.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7486
7506
|
|
|
7487
7507
|
const result = {
|
|
7488
7508
|
newSession: null,
|
|
7489
7509
|
init: async (target ) => {
|
|
7490
|
-
logger$
|
|
7510
|
+
logger$8.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7491
7511
|
|
|
7492
7512
|
result.newSession = await this.call(target);
|
|
7493
7513
|
},
|
|
7494
7514
|
complete: () => {
|
|
7495
|
-
logger$
|
|
7515
|
+
logger$8.info('webrtc transfer completed', {
|
|
7496
7516
|
id: this.getSipSessionId(session),
|
|
7497
7517
|
referId: this.getSipSessionId(result.newSession),
|
|
7498
7518
|
});
|
|
@@ -7513,7 +7533,7 @@ class WebRTCClient extends Emitter {
|
|
|
7513
7533
|
return;
|
|
7514
7534
|
}
|
|
7515
7535
|
|
|
7516
|
-
logger$
|
|
7536
|
+
logger$8.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7517
7537
|
|
|
7518
7538
|
try {
|
|
7519
7539
|
sipSession.message({
|
|
@@ -7555,7 +7575,7 @@ class WebRTCClient extends Emitter {
|
|
|
7555
7575
|
}
|
|
7556
7576
|
|
|
7557
7577
|
changeAudioOutputVolume(volume ) {
|
|
7558
|
-
logger$
|
|
7578
|
+
logger$8.info('Changing audio output volume', { volume });
|
|
7559
7579
|
|
|
7560
7580
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7561
7581
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7567,7 +7587,7 @@ class WebRTCClient extends Emitter {
|
|
|
7567
7587
|
}
|
|
7568
7588
|
|
|
7569
7589
|
changeAudioOutputDevice(id ) {
|
|
7570
|
-
logger$
|
|
7590
|
+
logger$8.info('Changing audio output device', { id });
|
|
7571
7591
|
|
|
7572
7592
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7573
7593
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7584,7 +7604,7 @@ class WebRTCClient extends Emitter {
|
|
|
7584
7604
|
|
|
7585
7605
|
changeAudioInputDevice(id , session ) {
|
|
7586
7606
|
const currentId = this.getAudioDeviceId();
|
|
7587
|
-
logger$
|
|
7607
|
+
logger$8.info('setting audio input device', { id, currentId, session: !!session });
|
|
7588
7608
|
|
|
7589
7609
|
if (id === currentId) {
|
|
7590
7610
|
return null;
|
|
@@ -7630,7 +7650,7 @@ class WebRTCClient extends Emitter {
|
|
|
7630
7650
|
|
|
7631
7651
|
setVideoInputDevice(id ) {
|
|
7632
7652
|
const currentId = this.getVideoDeviceId();
|
|
7633
|
-
logger$
|
|
7653
|
+
logger$8.info('setting video input device', { id, currentId });
|
|
7634
7654
|
|
|
7635
7655
|
if (id === currentId) {
|
|
7636
7656
|
return null;
|
|
@@ -7655,7 +7675,7 @@ class WebRTCClient extends Emitter {
|
|
|
7655
7675
|
const sessionId = this.getSipSessionId(session);
|
|
7656
7676
|
const localStream = this.getLocalStream(sessionId);
|
|
7657
7677
|
|
|
7658
|
-
logger$
|
|
7678
|
+
logger$8.info('changing video input device', { id, sessionId });
|
|
7659
7679
|
|
|
7660
7680
|
// Release old video stream
|
|
7661
7681
|
if (localStream) {
|
|
@@ -7723,7 +7743,7 @@ class WebRTCClient extends Emitter {
|
|
|
7723
7743
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7724
7744
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7725
7745
|
|
|
7726
|
-
logger$
|
|
7746
|
+
logger$8.info('Sending reinvite', {
|
|
7727
7747
|
id: this.getSipSessionId(sipSession),
|
|
7728
7748
|
newConstraints,
|
|
7729
7749
|
conference,
|
|
@@ -7761,7 +7781,7 @@ class WebRTCClient extends Emitter {
|
|
|
7761
7781
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7762
7782
|
}
|
|
7763
7783
|
|
|
7764
|
-
logger$
|
|
7784
|
+
logger$8.info('on re-INVITE accepted', {
|
|
7765
7785
|
id: this.getSipSessionId(sipSession),
|
|
7766
7786
|
wasMuted,
|
|
7767
7787
|
shouldDoScreenSharing,
|
|
@@ -7779,7 +7799,7 @@ class WebRTCClient extends Emitter {
|
|
|
7779
7799
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7780
7800
|
}
|
|
7781
7801
|
|
|
7782
|
-
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7802
|
+
return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
|
|
7783
7803
|
},
|
|
7784
7804
|
},
|
|
7785
7805
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7936,7 +7956,7 @@ class WebRTCClient extends Emitter {
|
|
|
7936
7956
|
}
|
|
7937
7957
|
|
|
7938
7958
|
startHeartbeat() {
|
|
7939
|
-
logger$
|
|
7959
|
+
logger$8.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7940
7960
|
if (!this.userAgent) {
|
|
7941
7961
|
this.heartbeat.stop();
|
|
7942
7962
|
return;
|
|
@@ -7949,7 +7969,7 @@ class WebRTCClient extends Emitter {
|
|
|
7949
7969
|
}
|
|
7950
7970
|
|
|
7951
7971
|
stopHeartbeat() {
|
|
7952
|
-
logger$
|
|
7972
|
+
logger$8.info('sdk webrtc stop heartbeat');
|
|
7953
7973
|
this.heartbeat.stop();
|
|
7954
7974
|
}
|
|
7955
7975
|
|
|
@@ -7970,7 +7990,7 @@ class WebRTCClient extends Emitter {
|
|
|
7970
7990
|
}
|
|
7971
7991
|
|
|
7972
7992
|
attemptReconnection() {
|
|
7973
|
-
logger$
|
|
7993
|
+
logger$8.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7974
7994
|
if (!this.userAgent) {
|
|
7975
7995
|
return;
|
|
7976
7996
|
}
|
|
@@ -7995,7 +8015,7 @@ class WebRTCClient extends Emitter {
|
|
|
7995
8015
|
return;
|
|
7996
8016
|
}
|
|
7997
8017
|
|
|
7998
|
-
logger$
|
|
8018
|
+
logger$8.info('setting local media stream', {
|
|
7999
8019
|
sipSessionId,
|
|
8000
8020
|
tracks: newStream ? newStream.getTracks() : null,
|
|
8001
8021
|
});
|
|
@@ -8012,7 +8032,7 @@ class WebRTCClient extends Emitter {
|
|
|
8012
8032
|
|
|
8013
8033
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
8014
8034
|
|
|
8015
|
-
logger$
|
|
8035
|
+
logger$8.info('updating local stream', {
|
|
8016
8036
|
sipSessionId,
|
|
8017
8037
|
oldStream: !!oldStream,
|
|
8018
8038
|
tracks: newStream.getTracks(),
|
|
@@ -8032,7 +8052,7 @@ class WebRTCClient extends Emitter {
|
|
|
8032
8052
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
8033
8053
|
const pc = this.getPeerConnection(sessionId);
|
|
8034
8054
|
|
|
8035
|
-
logger$
|
|
8055
|
+
logger$8.info('Updating remote stream', {
|
|
8036
8056
|
sessionId,
|
|
8037
8057
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
8038
8058
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -8057,14 +8077,16 @@ class WebRTCClient extends Emitter {
|
|
|
8057
8077
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
8058
8078
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
8059
8079
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
8080
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
8060
8081
|
|
|
8061
|
-
logger$
|
|
8082
|
+
logger$8.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
8062
8083
|
|
|
8063
8084
|
return {
|
|
8064
8085
|
constraints: {
|
|
8065
8086
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
8066
8087
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
8067
|
-
video: screenSharing ? (isDesktop
|
|
8088
|
+
video: screenSharing ? (isDesktop
|
|
8089
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
8068
8090
|
: this._getVideoConstraints(enableVideo),
|
|
8069
8091
|
screen: screenSharing,
|
|
8070
8092
|
desktop: isDesktop,
|
|
@@ -8107,7 +8129,7 @@ class WebRTCClient extends Emitter {
|
|
|
8107
8129
|
}
|
|
8108
8130
|
|
|
8109
8131
|
_onTransportError() {
|
|
8110
|
-
logger$
|
|
8132
|
+
logger$8.error('on transport error');
|
|
8111
8133
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
8112
8134
|
this.attemptReconnection();
|
|
8113
8135
|
}
|
|
@@ -8116,7 +8138,7 @@ class WebRTCClient extends Emitter {
|
|
|
8116
8138
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
8117
8139
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
8118
8140
|
if (this.hasHeartbeat()) {
|
|
8119
|
-
logger$
|
|
8141
|
+
logger$8.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
8120
8142
|
|
|
8121
8143
|
this.heartbeat.onHeartbeat();
|
|
8122
8144
|
if (this.heartbeatCb) {
|
|
@@ -8127,7 +8149,7 @@ class WebRTCClient extends Emitter {
|
|
|
8127
8149
|
}
|
|
8128
8150
|
|
|
8129
8151
|
async _onHeartbeatTimeout() {
|
|
8130
|
-
logger$
|
|
8152
|
+
logger$8.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
8131
8153
|
|
|
8132
8154
|
if (this.heartbeatTimeoutCb) {
|
|
8133
8155
|
this.heartbeatTimeoutCb();
|
|
@@ -8139,7 +8161,7 @@ class WebRTCClient extends Emitter {
|
|
|
8139
8161
|
try {
|
|
8140
8162
|
await this.userAgent.transport.disconnect();
|
|
8141
8163
|
} catch (e) {
|
|
8142
|
-
logger$
|
|
8164
|
+
logger$8.error('Transport disconnection after heartbeat timeout, error', e);
|
|
8143
8165
|
}
|
|
8144
8166
|
}
|
|
8145
8167
|
|
|
@@ -8172,31 +8194,31 @@ class WebRTCClient extends Emitter {
|
|
|
8172
8194
|
}
|
|
8173
8195
|
|
|
8174
8196
|
_connectIfNeeded() {
|
|
8175
|
-
logger$
|
|
8197
|
+
logger$8.info('connect if needed, checking', { connected: this.isConnected() });
|
|
8176
8198
|
if (!this.userAgent) {
|
|
8177
|
-
logger$
|
|
8199
|
+
logger$8.info('need to recreate User Agent');
|
|
8178
8200
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
8179
8201
|
}
|
|
8180
8202
|
|
|
8181
8203
|
if (this.isConnected()) {
|
|
8182
|
-
logger$
|
|
8204
|
+
logger$8.info('webrtc sdk, already connected');
|
|
8183
8205
|
return Promise.resolve();
|
|
8184
8206
|
}
|
|
8185
8207
|
|
|
8186
8208
|
if (this.isConnecting()) {
|
|
8187
|
-
logger$
|
|
8209
|
+
logger$8.info('webrtc sdk, already connecting...');
|
|
8188
8210
|
|
|
8189
8211
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
8190
8212
|
return this.connectionPromise;
|
|
8191
8213
|
}
|
|
8192
8214
|
|
|
8193
8215
|
if (this.connectionPromise) {
|
|
8194
|
-
logger$
|
|
8216
|
+
logger$8.info('webrtc sdk, connection promise connecting...');
|
|
8195
8217
|
// $FlowFixMe
|
|
8196
8218
|
return this.connectionPromise;
|
|
8197
8219
|
}
|
|
8198
8220
|
|
|
8199
|
-
logger$
|
|
8221
|
+
logger$8.info('WebRTC UA needs to connect');
|
|
8200
8222
|
|
|
8201
8223
|
// Force UA to reconnect
|
|
8202
8224
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -8321,7 +8343,7 @@ class WebRTCClient extends Emitter {
|
|
|
8321
8343
|
|
|
8322
8344
|
sdh.peerConnectionDelegate = {
|
|
8323
8345
|
onicecandidateerror: (error ) => {
|
|
8324
|
-
logger$
|
|
8346
|
+
logger$8.error('on icecandidate error', {
|
|
8325
8347
|
address: error.address,
|
|
8326
8348
|
port: error.port,
|
|
8327
8349
|
errorCode: error.errorCode,
|
|
@@ -8350,7 +8372,7 @@ class WebRTCClient extends Emitter {
|
|
|
8350
8372
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8351
8373
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8352
8374
|
}
|
|
8353
|
-
logger$
|
|
8375
|
+
logger$8.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8354
8376
|
|
|
8355
8377
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8356
8378
|
|
|
@@ -8366,12 +8388,12 @@ class WebRTCClient extends Emitter {
|
|
|
8366
8388
|
|
|
8367
8389
|
this._setupMedias(session);
|
|
8368
8390
|
|
|
8369
|
-
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8391
|
+
return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8370
8392
|
};
|
|
8371
8393
|
}
|
|
8372
8394
|
|
|
8373
8395
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8374
|
-
logger$
|
|
8396
|
+
logger$8.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8375
8397
|
|
|
8376
8398
|
this.storeSipSession(session);
|
|
8377
8399
|
|
|
@@ -8383,14 +8405,14 @@ class WebRTCClient extends Emitter {
|
|
|
8383
8405
|
const onTrack = (event ) => {
|
|
8384
8406
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8385
8407
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8386
|
-
logger$
|
|
8408
|
+
logger$8.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8387
8409
|
|
|
8388
8410
|
// Stop video track in audio only mode
|
|
8389
8411
|
if (isAudioOnly && kind === 'video') {
|
|
8390
8412
|
event.track.stop();
|
|
8391
8413
|
}
|
|
8392
8414
|
|
|
8393
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8415
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
8394
8416
|
};
|
|
8395
8417
|
|
|
8396
8418
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8399,12 +8421,14 @@ class WebRTCClient extends Emitter {
|
|
|
8399
8421
|
|
|
8400
8422
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8401
8423
|
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8424
|
+
if (pc) {
|
|
8425
|
+
pc.oniceconnectionstatechange = () => {
|
|
8426
|
+
logger$8.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8427
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8428
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8429
|
+
}
|
|
8430
|
+
};
|
|
8431
|
+
}
|
|
8408
8432
|
|
|
8409
8433
|
if (withEvent) {
|
|
8410
8434
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8573,10 +8597,10 @@ class WebRTCClient extends Emitter {
|
|
|
8573
8597
|
|
|
8574
8598
|
_stopSendingStats(session ) {
|
|
8575
8599
|
const sessionId = this.getSipSessionId(session);
|
|
8576
|
-
logger$
|
|
8600
|
+
logger$8.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8577
8601
|
|
|
8578
8602
|
if (sessionId in this.statsIntervals) {
|
|
8579
|
-
logger$
|
|
8603
|
+
logger$8.trace('Stop sending stats for call', { sessionId });
|
|
8580
8604
|
this.statsIntervals[sessionId]();
|
|
8581
8605
|
delete this.statsIntervals[sessionId];
|
|
8582
8606
|
}
|
|
@@ -8592,7 +8616,7 @@ class WebRTCClient extends Emitter {
|
|
|
8592
8616
|
try {
|
|
8593
8617
|
await this.userAgent.transport.disconnect();
|
|
8594
8618
|
} catch (e) {
|
|
8595
|
-
logger$
|
|
8619
|
+
logger$8.error('WebRTC transport disconnect, error', e);
|
|
8596
8620
|
}
|
|
8597
8621
|
}
|
|
8598
8622
|
}
|
|
@@ -8614,13 +8638,17 @@ class WebRTCClient extends Emitter {
|
|
|
8614
8638
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8615
8639
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8616
8640
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8641
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8617
8642
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8618
8643
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8644
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8619
8645
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8620
8646
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8621
8647
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8622
|
-
let audioBytesSent = 0;
|
|
8623
|
-
let audioBytesReceived = 0;
|
|
8648
|
+
let audioBytesSent = 0; // content + header
|
|
8649
|
+
let audioBytesReceived = 0; // content + header
|
|
8650
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8651
|
+
let audioContentReceived = 0;
|
|
8624
8652
|
let videoBytesSent = 0;
|
|
8625
8653
|
let videoBytesReceived = 0;
|
|
8626
8654
|
let transportSent = 0;
|
|
@@ -8630,6 +8658,7 @@ class WebRTCClient extends Emitter {
|
|
|
8630
8658
|
stats.forEach(report => {
|
|
8631
8659
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8632
8660
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8661
|
+
audioContentSent += Number(report.bytesSent);
|
|
8633
8662
|
}
|
|
8634
8663
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8635
8664
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -8641,6 +8670,7 @@ class WebRTCClient extends Emitter {
|
|
|
8641
8670
|
packetsLost += Number(report.packetsLost);
|
|
8642
8671
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8643
8672
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8673
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8644
8674
|
}
|
|
8645
8675
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8646
8676
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -8669,10 +8699,17 @@ class WebRTCClient extends Emitter {
|
|
|
8669
8699
|
});
|
|
8670
8700
|
|
|
8671
8701
|
networkStats.packetsLost = packetsLost;
|
|
8702
|
+
|
|
8672
8703
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8673
8704
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8674
8705
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8675
8706
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8707
|
+
|
|
8708
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8709
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8710
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8711
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8712
|
+
|
|
8676
8713
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8677
8714
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8678
8715
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8686,7 +8723,7 @@ class WebRTCClient extends Emitter {
|
|
|
8686
8723
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8687
8724
|
+ networkStats.transportSent;
|
|
8688
8725
|
|
|
8689
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8726
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8690
8727
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8691
8728
|
}
|
|
8692
8729
|
|
|
@@ -8711,11 +8748,12 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8711
8748
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8712
8749
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8713
8750
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8751
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8714
8752
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8715
8753
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8716
8754
|
const ON_MESSAGE = 'onMessage';
|
|
8717
|
-
const ON_REINVITE
|
|
8718
|
-
const ON_TRACK
|
|
8755
|
+
const ON_REINVITE = 'reinvite';
|
|
8756
|
+
const ON_TRACK = 'onTrack';
|
|
8719
8757
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8720
8758
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8721
8759
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8730,15 +8768,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8730
8768
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8731
8769
|
const ON_CALL_ERROR = 'onCallError';
|
|
8732
8770
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8733
|
-
const ON_NETWORK_STATS
|
|
8771
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8734
8772
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8735
8773
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8736
|
-
const ON_DISCONNECTED
|
|
8774
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
8737
8775
|
|
|
8738
8776
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8739
8777
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8740
8778
|
|
|
8741
|
-
const events
|
|
8779
|
+
const events = [
|
|
8742
8780
|
ON_USER_AGENT,
|
|
8743
8781
|
ON_REGISTERED,
|
|
8744
8782
|
ON_UNREGISTERED,
|
|
@@ -8755,9 +8793,10 @@ const events$1 = [
|
|
|
8755
8793
|
ON_CAMERA_DISABLED,
|
|
8756
8794
|
ON_CALL_FAILED,
|
|
8757
8795
|
ON_CALL_ENDED,
|
|
8796
|
+
ON_CALL_REJECTED,
|
|
8758
8797
|
ON_MESSAGE,
|
|
8759
|
-
ON_REINVITE
|
|
8760
|
-
ON_TRACK
|
|
8798
|
+
ON_REINVITE,
|
|
8799
|
+
ON_TRACK,
|
|
8761
8800
|
ON_AUDIO_STREAM,
|
|
8762
8801
|
ON_VIDEO_STREAM,
|
|
8763
8802
|
ON_REMOVE_STREAM,
|
|
@@ -8772,11 +8811,11 @@ const events$1 = [
|
|
|
8772
8811
|
ON_CALL_ERROR,
|
|
8773
8812
|
ON_CHAT,
|
|
8774
8813
|
ON_SIGNAL,
|
|
8775
|
-
ON_NETWORK_STATS
|
|
8776
|
-
ON_DISCONNECTED
|
|
8814
|
+
ON_NETWORK_STATS,
|
|
8815
|
+
ON_DISCONNECTED,
|
|
8777
8816
|
];
|
|
8778
8817
|
|
|
8779
|
-
const logger$
|
|
8818
|
+
const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8780
8819
|
|
|
8781
8820
|
class WebRTCPhone extends Emitter {
|
|
8782
8821
|
|
|
@@ -8849,7 +8888,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8849
8888
|
}).catch(error => {
|
|
8850
8889
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8851
8890
|
console.error('register error', error, error.message, error.stack);
|
|
8852
|
-
logger$
|
|
8891
|
+
logger$7.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8853
8892
|
});
|
|
8854
8893
|
}
|
|
8855
8894
|
|
|
@@ -8864,7 +8903,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8864
8903
|
if (!this.client) {
|
|
8865
8904
|
return;
|
|
8866
8905
|
}
|
|
8867
|
-
logger$
|
|
8906
|
+
logger$7.info('WebRTC phone stop');
|
|
8868
8907
|
this.client.stop();
|
|
8869
8908
|
}
|
|
8870
8909
|
|
|
@@ -8879,11 +8918,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8879
8918
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8880
8919
|
audioOnly = false, iceRestart = false) {
|
|
8881
8920
|
const sipSession = this.findSipSession(callSession);
|
|
8882
|
-
logger$
|
|
8921
|
+
logger$7.info('WebRTC phone - send reinvite', {
|
|
8883
8922
|
sessionId: sipSession ? sipSession.id : null,
|
|
8884
8923
|
constraints,
|
|
8885
8924
|
audioOnly,
|
|
8886
8925
|
conference,
|
|
8926
|
+
iceRestart,
|
|
8887
8927
|
});
|
|
8888
8928
|
|
|
8889
8929
|
if (!sipSession) {
|
|
@@ -8916,7 +8956,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8916
8956
|
}
|
|
8917
8957
|
|
|
8918
8958
|
startHeartbeat() {
|
|
8919
|
-
logger$
|
|
8959
|
+
logger$7.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8920
8960
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8921
8961
|
return;
|
|
8922
8962
|
}
|
|
@@ -8925,7 +8965,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8925
8965
|
}
|
|
8926
8966
|
|
|
8927
8967
|
stopHeartbeat() {
|
|
8928
|
-
logger$
|
|
8968
|
+
logger$7.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8929
8969
|
if (!this.client) {
|
|
8930
8970
|
return;
|
|
8931
8971
|
}
|
|
@@ -8942,7 +8982,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8942
8982
|
}
|
|
8943
8983
|
|
|
8944
8984
|
reconnect() {
|
|
8945
|
-
logger$
|
|
8985
|
+
logger$7.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8946
8986
|
if (!this.client) {
|
|
8947
8987
|
return;
|
|
8948
8988
|
}
|
|
@@ -8983,7 +9023,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8983
9023
|
return false;
|
|
8984
9024
|
}
|
|
8985
9025
|
|
|
8986
|
-
logger$
|
|
9026
|
+
logger$7.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8987
9027
|
|
|
8988
9028
|
this.client.downgradeToAudio(sipSession);
|
|
8989
9029
|
|
|
@@ -9006,7 +9046,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9006
9046
|
return Promise.resolve(false);
|
|
9007
9047
|
}
|
|
9008
9048
|
|
|
9009
|
-
logger$
|
|
9049
|
+
logger$7.info('Upgrade to video', {
|
|
9010
9050
|
id: callSession ? callSession.getId() : null,
|
|
9011
9051
|
constraints,
|
|
9012
9052
|
isConference,
|
|
@@ -9046,7 +9086,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9046
9086
|
|
|
9047
9087
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
9048
9088
|
const sipSession = this.findSipSession(callSession);
|
|
9049
|
-
logger$
|
|
9089
|
+
logger$7.info('Sending reinvite message', {
|
|
9050
9090
|
id: callSession ? callSession.getId() : null,
|
|
9051
9091
|
isUpgrade,
|
|
9052
9092
|
});
|
|
@@ -9072,7 +9112,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9072
9112
|
// Monkey patch to know when canceled with the CANCEL message
|
|
9073
9113
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
9074
9114
|
sipSession._onCancel = (message ) => {
|
|
9075
|
-
logger$
|
|
9115
|
+
logger$7.trace('on sip session canceled', { callId: message.callId });
|
|
9076
9116
|
|
|
9077
9117
|
onCancel(message);
|
|
9078
9118
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -9100,16 +9140,17 @@ class WebRTCPhone extends Emitter {
|
|
|
9100
9140
|
this.audioOutputVolume,
|
|
9101
9141
|
);
|
|
9102
9142
|
case sessionState.SessionState.Terminating:
|
|
9103
|
-
logger$
|
|
9143
|
+
logger$7.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
9104
9144
|
|
|
9105
9145
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
9106
9146
|
|
|
9107
9147
|
break;
|
|
9108
9148
|
case sessionState.SessionState.Terminated: {
|
|
9109
|
-
logger$
|
|
9149
|
+
logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9110
9150
|
|
|
9111
9151
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9112
9152
|
const callSession = this._createCallSession(sipSession);
|
|
9153
|
+
callSession.endTime = new Date();
|
|
9113
9154
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9114
9155
|
|
|
9115
9156
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -9128,7 +9169,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9128
9169
|
const [stream] = event.streams;
|
|
9129
9170
|
const kind = event && event.track && event.track.kind;
|
|
9130
9171
|
|
|
9131
|
-
logger$
|
|
9172
|
+
logger$7.info('on track stream called on the peer connection', {
|
|
9132
9173
|
callId: this.getSipSessionId(sipSession),
|
|
9133
9174
|
streamId: stream ? stream.id : null,
|
|
9134
9175
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -9148,7 +9189,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9148
9189
|
};
|
|
9149
9190
|
|
|
9150
9191
|
peerConnection.onremovestream = event => {
|
|
9151
|
-
logger$
|
|
9192
|
+
logger$7.info('on remove stream called on the peer connection', {
|
|
9152
9193
|
id: event.stream.id,
|
|
9153
9194
|
tracks: event.stream.getTracks(),
|
|
9154
9195
|
});
|
|
@@ -9158,7 +9199,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9158
9199
|
}
|
|
9159
9200
|
|
|
9160
9201
|
async startScreenSharing(constraints , callSession ) {
|
|
9161
|
-
logger$
|
|
9202
|
+
logger$7.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
9162
9203
|
|
|
9163
9204
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
9164
9205
|
if (!screenShareStream) {
|
|
@@ -9198,7 +9239,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9198
9239
|
return;
|
|
9199
9240
|
}
|
|
9200
9241
|
|
|
9201
|
-
logger$
|
|
9242
|
+
logger$7.info('WebRTC phone - stop screen sharing', {
|
|
9202
9243
|
restoreLocalStream,
|
|
9203
9244
|
});
|
|
9204
9245
|
|
|
@@ -9254,7 +9295,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9254
9295
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
9255
9296
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9256
9297
|
|
|
9257
|
-
logger$
|
|
9298
|
+
logger$7.info('WebRTC phone - on screensharing', {
|
|
9258
9299
|
hadVideo,
|
|
9259
9300
|
id: this.getSipSessionId(sipSession),
|
|
9260
9301
|
screenTrack,
|
|
@@ -9262,7 +9303,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9262
9303
|
|
|
9263
9304
|
if (screenTrack) {
|
|
9264
9305
|
screenTrack.onended = () => {
|
|
9265
|
-
logger$
|
|
9306
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9266
9307
|
hadVideo,
|
|
9267
9308
|
id: this.getSipSessionId(sipSession),
|
|
9268
9309
|
screenTrack,
|
|
@@ -9293,7 +9334,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9293
9334
|
}
|
|
9294
9335
|
|
|
9295
9336
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9296
|
-
logger$
|
|
9337
|
+
logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9297
9338
|
|
|
9298
9339
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9299
9340
|
this.currentSipSession = sipSession;
|
|
@@ -9311,7 +9352,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9311
9352
|
}
|
|
9312
9353
|
|
|
9313
9354
|
changeAudioDevice(id ) {
|
|
9314
|
-
logger$
|
|
9355
|
+
logger$7.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9315
9356
|
this.audioOutputDeviceId = id;
|
|
9316
9357
|
this.client.changeAudioOutputDevice(id);
|
|
9317
9358
|
}
|
|
@@ -9321,14 +9362,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9321
9362
|
}
|
|
9322
9363
|
|
|
9323
9364
|
changeRingDevice(id ) {
|
|
9324
|
-
logger$
|
|
9365
|
+
logger$7.info('WebRTC phone - changing ring device', { id });
|
|
9325
9366
|
|
|
9326
9367
|
this.audioRingDeviceId = id;
|
|
9327
9368
|
}
|
|
9328
9369
|
|
|
9329
9370
|
// volume is a value between 0 and 1
|
|
9330
9371
|
changeAudioVolume(volume ) {
|
|
9331
|
-
logger$
|
|
9372
|
+
logger$7.info('WebRTC phone - changing audio volume', { volume });
|
|
9332
9373
|
|
|
9333
9374
|
this.audioOutputVolume = volume;
|
|
9334
9375
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9336,32 +9377,33 @@ class WebRTCPhone extends Emitter {
|
|
|
9336
9377
|
|
|
9337
9378
|
// volume is a value between 0 and 1
|
|
9338
9379
|
changeRingVolume(volume ) {
|
|
9339
|
-
logger$
|
|
9380
|
+
logger$7.info('WebRTC phone - changing ring volume', { volume });
|
|
9340
9381
|
|
|
9341
9382
|
this.audioRingVolume = volume;
|
|
9342
9383
|
}
|
|
9343
9384
|
|
|
9344
9385
|
changeAudioInputDevice(id ) {
|
|
9345
|
-
logger$
|
|
9386
|
+
logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9346
9387
|
|
|
9347
9388
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9348
9389
|
}
|
|
9349
9390
|
|
|
9350
9391
|
changeVideoInputDevice(id ) {
|
|
9351
|
-
logger$
|
|
9392
|
+
logger$7.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9352
9393
|
|
|
9353
9394
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9354
9395
|
}
|
|
9355
9396
|
|
|
9356
9397
|
changeSessionVideoInputDevice(id ) {
|
|
9357
|
-
logger$
|
|
9398
|
+
logger$7.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9358
9399
|
|
|
9359
9400
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9360
9401
|
}
|
|
9361
9402
|
|
|
9362
9403
|
_onCallTerminated(sipSession ) {
|
|
9363
|
-
logger$
|
|
9404
|
+
logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9364
9405
|
|
|
9406
|
+
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9365
9407
|
const callSession = this._createCallSession(sipSession);
|
|
9366
9408
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
9367
9409
|
const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
|
|
@@ -9379,7 +9421,6 @@ class WebRTCPhone extends Emitter {
|
|
|
9379
9421
|
}, 5);
|
|
9380
9422
|
}
|
|
9381
9423
|
|
|
9382
|
-
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9383
9424
|
if (sipSessionId) {
|
|
9384
9425
|
this.removeIncomingSessions(sipSessionId);
|
|
9385
9426
|
}
|
|
@@ -9394,7 +9435,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9394
9435
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9395
9436
|
|
|
9396
9437
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9397
|
-
logger$
|
|
9438
|
+
logger$7.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9398
9439
|
sipId: sipSession.id,
|
|
9399
9440
|
shouldRetrigger,
|
|
9400
9441
|
hasIncomingCallSession,
|
|
@@ -9485,37 +9526,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9485
9526
|
|
|
9486
9527
|
// Deprecated
|
|
9487
9528
|
getLocalStreamForCall(callSession ) {
|
|
9488
|
-
logger$
|
|
9529
|
+
logger$7.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9489
9530
|
|
|
9490
9531
|
return this.getLocalStream(callSession);
|
|
9491
9532
|
}
|
|
9492
9533
|
|
|
9493
9534
|
// Deprecated
|
|
9494
9535
|
getRemoteStreamForCall(callSession ) {
|
|
9495
|
-
logger$
|
|
9536
|
+
logger$7.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9496
9537
|
|
|
9497
9538
|
return this.getRemoteVideoStream(callSession);
|
|
9498
9539
|
}
|
|
9499
9540
|
|
|
9500
9541
|
getRemoteStreamsForCall(callSession ) {
|
|
9501
|
-
logger$
|
|
9542
|
+
logger$7.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9502
9543
|
|
|
9503
9544
|
return this.getRemoteStream(callSession);
|
|
9504
9545
|
}
|
|
9505
9546
|
|
|
9506
9547
|
accept(callSession , cameraEnabled ) {
|
|
9507
|
-
logger$
|
|
9548
|
+
logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9508
9549
|
if (this.currentSipSession) {
|
|
9509
9550
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9510
9551
|
}
|
|
9511
9552
|
|
|
9512
9553
|
if (!callSession) {
|
|
9513
|
-
logger$
|
|
9554
|
+
logger$7.warn('no CallSession to accept.');
|
|
9514
9555
|
return Promise.resolve(null);
|
|
9515
9556
|
}
|
|
9516
9557
|
|
|
9517
9558
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9518
|
-
logger$
|
|
9559
|
+
logger$7.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9519
9560
|
return Promise.resolve(callSession.sipCallId);
|
|
9520
9561
|
}
|
|
9521
9562
|
|
|
@@ -9527,24 +9568,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9527
9568
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9528
9569
|
if (sipSession) {
|
|
9529
9570
|
if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
|
|
9530
|
-
logger$
|
|
9571
|
+
logger$7.warn('Trying to answer a terminated sipSession.');
|
|
9531
9572
|
|
|
9532
9573
|
return Promise.resolve(null);
|
|
9533
9574
|
}
|
|
9534
9575
|
|
|
9535
|
-
logger$
|
|
9576
|
+
logger$7.info('accept call, session found', { sipId: sipSession.id });
|
|
9536
9577
|
|
|
9537
9578
|
// $FlowFixMe
|
|
9538
9579
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9539
9580
|
return callSession.sipCallId;
|
|
9540
9581
|
}).catch(e => {
|
|
9541
|
-
logger$
|
|
9582
|
+
logger$7.error(e);
|
|
9542
9583
|
this.endCurrentCall(callSession);
|
|
9543
9584
|
throw e;
|
|
9544
9585
|
});
|
|
9545
9586
|
}
|
|
9546
9587
|
|
|
9547
|
-
logger$
|
|
9588
|
+
logger$7.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9548
9589
|
|
|
9549
9590
|
return Promise.resolve(null);
|
|
9550
9591
|
}
|
|
@@ -9554,7 +9595,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9554
9595
|
}
|
|
9555
9596
|
|
|
9556
9597
|
async reject(callSession ) {
|
|
9557
|
-
logger$
|
|
9598
|
+
logger$7.info('reject WebRTC called', { id: callSession.getId() });
|
|
9558
9599
|
|
|
9559
9600
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9560
9601
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9566,14 +9607,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9566
9607
|
|
|
9567
9608
|
const sipSession = this.findSipSession(callSession);
|
|
9568
9609
|
if (sipSession) {
|
|
9569
|
-
logger$
|
|
9610
|
+
logger$7.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9570
9611
|
|
|
9571
9612
|
this.client.hangup(sipSession);
|
|
9572
9613
|
}
|
|
9573
9614
|
}
|
|
9574
9615
|
|
|
9575
9616
|
async ignore(callSession ) {
|
|
9576
|
-
logger$
|
|
9617
|
+
logger$7.info('WebRTC ignore', { id: callSession.getId() });
|
|
9577
9618
|
|
|
9578
9619
|
// kill the ring
|
|
9579
9620
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9585,14 +9626,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9585
9626
|
const sipSession = this.findSipSession(callSession);
|
|
9586
9627
|
|
|
9587
9628
|
if (sipSession) {
|
|
9588
|
-
logger$
|
|
9629
|
+
logger$7.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9589
9630
|
|
|
9590
9631
|
return this.client.atxfer(sipSession);
|
|
9591
9632
|
}
|
|
9592
9633
|
}
|
|
9593
9634
|
|
|
9594
9635
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9595
|
-
logger$
|
|
9636
|
+
logger$7.info('WebRTC hold', { id: callSession.getId() });
|
|
9596
9637
|
|
|
9597
9638
|
const sipSession = this.findSipSession(callSession);
|
|
9598
9639
|
|
|
@@ -9607,18 +9648,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9607
9648
|
}
|
|
9608
9649
|
|
|
9609
9650
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9610
|
-
logger$
|
|
9651
|
+
logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9611
9652
|
|
|
9612
9653
|
const sipSession = this.findSipSession(callSession);
|
|
9613
9654
|
if (!sipSession) {
|
|
9614
9655
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9615
9656
|
}
|
|
9616
9657
|
|
|
9617
|
-
logger$
|
|
9658
|
+
logger$7.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9618
9659
|
|
|
9619
9660
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9620
9661
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9621
|
-
logger$
|
|
9662
|
+
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9622
9663
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9623
9664
|
}
|
|
9624
9665
|
|
|
@@ -9643,7 +9684,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9643
9684
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9644
9685
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9645
9686
|
|
|
9646
|
-
logger$
|
|
9687
|
+
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9647
9688
|
|
|
9648
9689
|
// Stop screenshre if needed
|
|
9649
9690
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9674,7 +9715,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9674
9715
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9675
9716
|
}
|
|
9676
9717
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9677
|
-
logger$
|
|
9718
|
+
logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9678
9719
|
|
|
9679
9720
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9680
9721
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9718,14 +9759,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9718
9759
|
}
|
|
9719
9760
|
|
|
9720
9761
|
mute(callSession , withEvent = true) {
|
|
9721
|
-
logger$
|
|
9762
|
+
logger$7.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9722
9763
|
|
|
9723
9764
|
const sipSession = this.findSipSession(callSession);
|
|
9724
9765
|
if (!sipSession) {
|
|
9725
9766
|
return;
|
|
9726
9767
|
}
|
|
9727
9768
|
|
|
9728
|
-
logger$
|
|
9769
|
+
logger$7.info('WebRTC muting', { sipId: sipSession.id });
|
|
9729
9770
|
this.client.mute(sipSession);
|
|
9730
9771
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9731
9772
|
|
|
@@ -9739,14 +9780,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9739
9780
|
}
|
|
9740
9781
|
|
|
9741
9782
|
unmute(callSession , withEvent = true) {
|
|
9742
|
-
logger$
|
|
9783
|
+
logger$7.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9743
9784
|
|
|
9744
9785
|
const sipSession = this.findSipSession(callSession);
|
|
9745
9786
|
if (!sipSession) {
|
|
9746
9787
|
return;
|
|
9747
9788
|
}
|
|
9748
9789
|
|
|
9749
|
-
logger$
|
|
9790
|
+
logger$7.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9750
9791
|
this.client.unmute(sipSession);
|
|
9751
9792
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9752
9793
|
|
|
@@ -9773,7 +9814,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9773
9814
|
if (!sipSession) {
|
|
9774
9815
|
return;
|
|
9775
9816
|
}
|
|
9776
|
-
logger$
|
|
9817
|
+
logger$7.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9777
9818
|
|
|
9778
9819
|
this.client.toggleCameraOn(sipSession);
|
|
9779
9820
|
|
|
@@ -9785,7 +9826,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9785
9826
|
if (!sipSession) {
|
|
9786
9827
|
return;
|
|
9787
9828
|
}
|
|
9788
|
-
logger$
|
|
9829
|
+
logger$7.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9789
9830
|
|
|
9790
9831
|
this.client.toggleCameraOff(sipSession);
|
|
9791
9832
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9797,7 +9838,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9797
9838
|
return;
|
|
9798
9839
|
}
|
|
9799
9840
|
|
|
9800
|
-
logger$
|
|
9841
|
+
logger$7.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9801
9842
|
this.client.sendDTMF(sipSession, tone);
|
|
9802
9843
|
}
|
|
9803
9844
|
|
|
@@ -9805,7 +9846,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9805
9846
|
// @TODO: line is not used here
|
|
9806
9847
|
async makeCall(number , line , cameraEnabled ,
|
|
9807
9848
|
audioOnly = false, conference = false) {
|
|
9808
|
-
logger$
|
|
9849
|
+
logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
9809
9850
|
if (!number) {
|
|
9810
9851
|
return Promise.resolve(null);
|
|
9811
9852
|
}
|
|
@@ -9815,7 +9856,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9815
9856
|
}
|
|
9816
9857
|
if (this.currentSipSession) {
|
|
9817
9858
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9818
|
-
logger$
|
|
9859
|
+
logger$7.warn('Unable to hold current session when making another call', e);
|
|
9819
9860
|
});
|
|
9820
9861
|
}
|
|
9821
9862
|
|
|
@@ -9825,10 +9866,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9825
9866
|
this._bindEvents(sipSession);
|
|
9826
9867
|
} catch (error) {
|
|
9827
9868
|
console.warn(error);
|
|
9828
|
-
logger$
|
|
9869
|
+
logger$7.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9829
9870
|
return Promise.resolve(null);
|
|
9830
9871
|
}
|
|
9831
9872
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9873
|
+
callSession.creationTime = new Date();
|
|
9832
9874
|
|
|
9833
9875
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9834
9876
|
|
|
@@ -9853,7 +9895,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9853
9895
|
return;
|
|
9854
9896
|
}
|
|
9855
9897
|
|
|
9856
|
-
logger$
|
|
9898
|
+
logger$7.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9857
9899
|
|
|
9858
9900
|
this.client.transfer(sipSession, target);
|
|
9859
9901
|
}
|
|
@@ -9862,7 +9904,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9862
9904
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9863
9905
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9864
9906
|
|
|
9865
|
-
logger$
|
|
9907
|
+
logger$7.info('WebRTC indirect transfer', {
|
|
9866
9908
|
sipId: sipSession ? sipSession.id : null,
|
|
9867
9909
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9868
9910
|
});
|
|
@@ -9901,7 +9943,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9901
9943
|
return false;
|
|
9902
9944
|
}
|
|
9903
9945
|
|
|
9904
|
-
logger$
|
|
9946
|
+
logger$7.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9905
9947
|
|
|
9906
9948
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9907
9949
|
|
|
@@ -9947,7 +9989,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9947
9989
|
endCurrentCall(callSession ) {
|
|
9948
9990
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9949
9991
|
|
|
9950
|
-
logger$
|
|
9992
|
+
logger$7.info('Ending current call', {
|
|
9951
9993
|
id: callSession ? callSession.getId() : null,
|
|
9952
9994
|
isCurrent,
|
|
9953
9995
|
});
|
|
@@ -9971,7 +10013,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9971
10013
|
}
|
|
9972
10014
|
|
|
9973
10015
|
async close() {
|
|
9974
|
-
logger$
|
|
10016
|
+
logger$7.info('WebRTC close');
|
|
9975
10017
|
|
|
9976
10018
|
try {
|
|
9977
10019
|
await Promise.race([
|
|
@@ -9979,7 +10021,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9979
10021
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9980
10022
|
]);
|
|
9981
10023
|
} catch (e) {
|
|
9982
|
-
logger$
|
|
10024
|
+
logger$7.error('WebRTC close, unregister error', e);
|
|
9983
10025
|
}
|
|
9984
10026
|
|
|
9985
10027
|
this.client.close();
|
|
@@ -9997,12 +10039,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9997
10039
|
}
|
|
9998
10040
|
|
|
9999
10041
|
enableRinging() {
|
|
10000
|
-
logger$
|
|
10042
|
+
logger$7.info('WebRTC enable ringing');
|
|
10001
10043
|
this.ringingEnabled = true;
|
|
10002
10044
|
}
|
|
10003
10045
|
|
|
10004
10046
|
disableRinging() {
|
|
10005
|
-
logger$
|
|
10047
|
+
logger$7.info('WebRTC disable ringing');
|
|
10006
10048
|
this.ringingEnabled = false;
|
|
10007
10049
|
}
|
|
10008
10050
|
|
|
@@ -10024,8 +10066,12 @@ class WebRTCPhone extends Emitter {
|
|
|
10024
10066
|
}
|
|
10025
10067
|
|
|
10026
10068
|
const sessionId = this.incomingSessions[0];
|
|
10069
|
+
const sipSession = this.client.getSipSession(sessionId);
|
|
10070
|
+
if (!sipSession) {
|
|
10071
|
+
return null;
|
|
10072
|
+
}
|
|
10027
10073
|
|
|
10028
|
-
return this._createCallSession(
|
|
10074
|
+
return this._createCallSession(sipSession);
|
|
10029
10075
|
}
|
|
10030
10076
|
|
|
10031
10077
|
sendMessage(sipSession = null, body , contentType = 'text/plain') {
|
|
@@ -10042,7 +10088,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10042
10088
|
|
|
10043
10089
|
// Deprecated
|
|
10044
10090
|
getLocalMediaStream(callSession ) {
|
|
10045
|
-
logger$
|
|
10091
|
+
logger$7.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
10046
10092
|
return this.getLocalStream(callSession);
|
|
10047
10093
|
}
|
|
10048
10094
|
|
|
@@ -10084,7 +10130,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10084
10130
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
10085
10131
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
10086
10132
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
10087
|
-
logger$
|
|
10133
|
+
logger$7.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
10088
10134
|
|
|
10089
10135
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
10090
10136
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -10103,11 +10149,12 @@ class WebRTCPhone extends Emitter {
|
|
|
10103
10149
|
callSession);
|
|
10104
10150
|
}
|
|
10105
10151
|
|
|
10152
|
+
callSession.creationTime = new Date();
|
|
10106
10153
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
10107
10154
|
});
|
|
10108
10155
|
|
|
10109
10156
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
10110
|
-
logger$
|
|
10157
|
+
logger$7.info('WebRTC on reinvite', {
|
|
10111
10158
|
sessionId: args[0].id,
|
|
10112
10159
|
inviteId: args[1].id,
|
|
10113
10160
|
updatedCalleeName: args[2],
|
|
@@ -10127,7 +10174,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10127
10174
|
});
|
|
10128
10175
|
|
|
10129
10176
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
10130
|
-
logger$
|
|
10177
|
+
logger$7.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
10131
10178
|
|
|
10132
10179
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
10133
10180
|
|
|
@@ -10138,22 +10185,29 @@ class WebRTCPhone extends Emitter {
|
|
|
10138
10185
|
this.client.on('ended', () => {});
|
|
10139
10186
|
|
|
10140
10187
|
this.client.on(this.client.ON_ERROR, e => {
|
|
10141
|
-
logger$
|
|
10188
|
+
logger$7.error('WebRTC error', e);
|
|
10142
10189
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10143
10190
|
});
|
|
10144
10191
|
|
|
10192
|
+
this.client.on(this.client.REJECTED, session => {
|
|
10193
|
+
logger$7.info('WebRTC call rejected', session.id);
|
|
10194
|
+
const callSession = this._createCallSession(session);
|
|
10195
|
+
callSession.endTime = new Date();
|
|
10196
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
10197
|
+
});
|
|
10198
|
+
|
|
10145
10199
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10146
|
-
logger$
|
|
10200
|
+
logger$7.info('WebRTC unregistered');
|
|
10147
10201
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10148
10202
|
});
|
|
10149
10203
|
|
|
10150
10204
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
10151
|
-
logger$
|
|
10152
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
10205
|
+
logger$7.info('WebRTC disconnected');
|
|
10206
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10153
10207
|
});
|
|
10154
10208
|
|
|
10155
10209
|
this.client.on(this.client.REGISTERED, () => {
|
|
10156
|
-
logger$
|
|
10210
|
+
logger$7.info('WebRTC registered', {
|
|
10157
10211
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
10158
10212
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
10159
10213
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -10174,19 +10228,19 @@ class WebRTCPhone extends Emitter {
|
|
|
10174
10228
|
// Send reinvite with iceRestart
|
|
10175
10229
|
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10176
10230
|
} catch (e) {
|
|
10177
|
-
logger$
|
|
10231
|
+
logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10178
10232
|
}
|
|
10179
10233
|
}
|
|
10180
10234
|
});
|
|
10181
10235
|
|
|
10182
10236
|
this.client.on(this.client.CONNECTED, () => {
|
|
10183
|
-
logger$
|
|
10237
|
+
logger$7.info('WebRTC client connected');
|
|
10184
10238
|
|
|
10185
10239
|
this.stopHeartbeat();
|
|
10186
10240
|
});
|
|
10187
10241
|
|
|
10188
10242
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
10189
|
-
logger$
|
|
10243
|
+
logger$7.info('WebRTC client disconnected');
|
|
10190
10244
|
|
|
10191
10245
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10192
10246
|
|
|
@@ -10200,7 +10254,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10200
10254
|
});
|
|
10201
10255
|
|
|
10202
10256
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
10203
|
-
this.eventEmitter.emit(ON_TRACK
|
|
10257
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
10204
10258
|
});
|
|
10205
10259
|
|
|
10206
10260
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -10215,7 +10269,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10215
10269
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
10216
10270
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
10217
10271
|
|
|
10218
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
10272
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
10219
10273
|
});
|
|
10220
10274
|
|
|
10221
10275
|
// Used when upgrading directly in screenshare mode
|
|
@@ -10224,7 +10278,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10224
10278
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
10225
10279
|
const callSession = this.callSessions[sipSessionId];
|
|
10226
10280
|
|
|
10227
|
-
logger$
|
|
10281
|
+
logger$7.info('Updrading directly in screensharing mode', {
|
|
10228
10282
|
sipSessionId,
|
|
10229
10283
|
tracks: localStream ? localStream.getTracks() : null,
|
|
10230
10284
|
});
|
|
@@ -10354,6 +10408,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10354
10408
|
const number = identity ? identity.uri._normal.user : null;
|
|
10355
10409
|
const { state } = sipSession || {};
|
|
10356
10410
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10411
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10357
10412
|
|
|
10358
10413
|
const callSession = new CallSession({
|
|
10359
10414
|
callId: fromSession && fromSession.callId,
|
|
@@ -10361,6 +10416,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10361
10416
|
sipStatus: state,
|
|
10362
10417
|
displayName: identity ? identity.displayName || number : number,
|
|
10363
10418
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10419
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10420
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10364
10421
|
answered: state === sessionState.SessionState.Established,
|
|
10365
10422
|
paused: this.client.isCallHeld(sipSession),
|
|
10366
10423
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10371,6 +10428,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10371
10428
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10372
10429
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10373
10430
|
recordingPaused: false, // @TODO
|
|
10431
|
+
sipSession,
|
|
10374
10432
|
...extra,
|
|
10375
10433
|
});
|
|
10376
10434
|
|
|
@@ -10399,11 +10457,12 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10399
10457
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10400
10458
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10401
10459
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10460
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10402
10461
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10403
10462
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10404
10463
|
ON_MESSAGE: ON_MESSAGE,
|
|
10405
|
-
ON_REINVITE: ON_REINVITE
|
|
10406
|
-
ON_TRACK: ON_TRACK
|
|
10464
|
+
ON_REINVITE: ON_REINVITE,
|
|
10465
|
+
ON_TRACK: ON_TRACK,
|
|
10407
10466
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10408
10467
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10409
10468
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10418,16 +10477,24 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10418
10477
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10419
10478
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10420
10479
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10421
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS
|
|
10480
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10422
10481
|
ON_CHAT: ON_CHAT,
|
|
10423
10482
|
ON_SIGNAL: ON_SIGNAL,
|
|
10424
|
-
ON_DISCONNECTED: ON_DISCONNECTED
|
|
10483
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10425
10484
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10426
10485
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10427
|
-
events: events
|
|
10486
|
+
events: events,
|
|
10428
10487
|
'default': WebRTCPhone
|
|
10429
10488
|
});
|
|
10430
10489
|
|
|
10490
|
+
/* */
|
|
10491
|
+
class SFUNotAvailableError extends Error {
|
|
10492
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10493
|
+
super(message);
|
|
10494
|
+
this.name = 'SFUNotAvailableError';
|
|
10495
|
+
}
|
|
10496
|
+
}
|
|
10497
|
+
|
|
10431
10498
|
//
|
|
10432
10499
|
|
|
10433
10500
|
const logger$6 = IssueReporter$1.loggerFor('simple-phone');
|
|
@@ -10812,13 +10879,13 @@ class Phone extends Emitter {
|
|
|
10812
10879
|
|
|
10813
10880
|
checkSfu() {
|
|
10814
10881
|
if (!this.hasSfu()) {
|
|
10815
|
-
throw new
|
|
10882
|
+
throw new SFUNotAvailableError();
|
|
10816
10883
|
}
|
|
10817
10884
|
}
|
|
10818
10885
|
|
|
10819
10886
|
_transferEvents() {
|
|
10820
10887
|
this.unbind();
|
|
10821
|
-
[...events, ...transportEvents].forEach(event => {
|
|
10888
|
+
[...events$1, ...transportEvents].forEach(event => {
|
|
10822
10889
|
this.client.on(event, (...args) =>
|
|
10823
10890
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
10824
10891
|
});
|
|
@@ -10840,7 +10907,7 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
10840
10907
|
|
|
10841
10908
|
//
|
|
10842
10909
|
|
|
10843
|
-
const SOCKET_EVENTS = {
|
|
10910
|
+
const SOCKET_EVENTS$1 = {
|
|
10844
10911
|
ON_OPEN: 'onopen',
|
|
10845
10912
|
ON_MESSAGE: 'onmessage',
|
|
10846
10913
|
ON_ERROR: 'onerror',
|
|
@@ -10936,7 +11003,7 @@ const BLACKLIST_EVENTS = [
|
|
|
10936
11003
|
];
|
|
10937
11004
|
|
|
10938
11005
|
const HEARTBEAT_ENGINE_VERSION = '20.09';
|
|
10939
|
-
const logger$
|
|
11006
|
+
const logger$5 = IssueReporter$1.loggerFor('wazo-ws');
|
|
10940
11007
|
const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
|
|
10941
11008
|
|
|
10942
11009
|
class WebSocketClient extends Emitter {
|
|
@@ -10985,24 +11052,24 @@ class WebSocketClient extends Emitter {
|
|
|
10985
11052
|
}
|
|
10986
11053
|
|
|
10987
11054
|
connect() {
|
|
10988
|
-
logger$
|
|
11055
|
+
logger$5.info('connect method started', { host: this.host, token: this.token });
|
|
10989
11056
|
this.socket = new ReconnectingWebSocket__default['default'](this._getUrl.bind(this), [], this.options);
|
|
10990
11057
|
if (this.options.binaryType) {
|
|
10991
11058
|
this.socket.binaryType = this.options.binaryType;
|
|
10992
11059
|
}
|
|
10993
11060
|
|
|
10994
11061
|
this.socket.onopen = () => {
|
|
10995
|
-
logger$
|
|
10996
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
11062
|
+
logger$5.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
11063
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
|
|
10997
11064
|
};
|
|
10998
11065
|
|
|
10999
11066
|
this.socket.onerror = event => {
|
|
11000
|
-
logger$
|
|
11001
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
11067
|
+
logger$5.error('on Wazo WS error', event.target);
|
|
11068
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
|
|
11002
11069
|
};
|
|
11003
11070
|
|
|
11004
11071
|
this.socket.onmessage = (event ) => {
|
|
11005
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
11072
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
|
|
11006
11073
|
|
|
11007
11074
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
11008
11075
|
let { name } = message;
|
|
@@ -11027,7 +11094,7 @@ class WebSocketClient extends Emitter {
|
|
|
11027
11094
|
|
|
11028
11095
|
this.socket.onclose = event => {
|
|
11029
11096
|
// Can't be converted to JSON (circular structure)
|
|
11030
|
-
logger$
|
|
11097
|
+
logger$5.info('on Wazo WS close', {
|
|
11031
11098
|
reason: event.reason,
|
|
11032
11099
|
code: event.code,
|
|
11033
11100
|
readyState: event.target.readyState,
|
|
@@ -11035,22 +11102,22 @@ class WebSocketClient extends Emitter {
|
|
|
11035
11102
|
token: this.token,
|
|
11036
11103
|
});
|
|
11037
11104
|
this.initialized = false;
|
|
11038
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
11105
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
|
|
11039
11106
|
|
|
11040
11107
|
switch (event.code) {
|
|
11041
11108
|
case 4002:
|
|
11042
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
11109
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
|
|
11043
11110
|
break;
|
|
11044
11111
|
}
|
|
11045
11112
|
};
|
|
11046
11113
|
|
|
11047
11114
|
this.socket.onerror = event => {
|
|
11048
|
-
logger$
|
|
11115
|
+
logger$5.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
|
|
11049
11116
|
};
|
|
11050
11117
|
}
|
|
11051
11118
|
|
|
11052
11119
|
close(force = false) {
|
|
11053
|
-
logger$
|
|
11120
|
+
logger$5.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
|
|
11054
11121
|
|
|
11055
11122
|
if (!this.socket) {
|
|
11056
11123
|
return;
|
|
@@ -11068,7 +11135,7 @@ class WebSocketClient extends Emitter {
|
|
|
11068
11135
|
|
|
11069
11136
|
updateToken(token ) {
|
|
11070
11137
|
this.token = token;
|
|
11071
|
-
logger$
|
|
11138
|
+
logger$5.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
|
|
11072
11139
|
|
|
11073
11140
|
if (this.socket) {
|
|
11074
11141
|
// If still connected, send the token to the WS
|
|
@@ -11086,7 +11153,7 @@ class WebSocketClient extends Emitter {
|
|
|
11086
11153
|
}
|
|
11087
11154
|
|
|
11088
11155
|
startHeartbeat() {
|
|
11089
|
-
logger$
|
|
11156
|
+
logger$5.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
|
|
11090
11157
|
|
|
11091
11158
|
if (!this.socket) {
|
|
11092
11159
|
this.heartbeat.stop();
|
|
@@ -11100,7 +11167,7 @@ class WebSocketClient extends Emitter {
|
|
|
11100
11167
|
}
|
|
11101
11168
|
|
|
11102
11169
|
stopHeartbeat() {
|
|
11103
|
-
logger$
|
|
11170
|
+
logger$5.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
|
|
11104
11171
|
|
|
11105
11172
|
this.heartbeat.stop();
|
|
11106
11173
|
}
|
|
@@ -11130,7 +11197,7 @@ class WebSocketClient extends Emitter {
|
|
|
11130
11197
|
}
|
|
11131
11198
|
|
|
11132
11199
|
reconnect(reason ) {
|
|
11133
|
-
logger$
|
|
11200
|
+
logger$5.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
|
|
11134
11201
|
if (!this.socket) {
|
|
11135
11202
|
return;
|
|
11136
11203
|
}
|
|
@@ -11155,7 +11222,7 @@ class WebSocketClient extends Emitter {
|
|
|
11155
11222
|
break;
|
|
11156
11223
|
case 'start':
|
|
11157
11224
|
this.initialized = true;
|
|
11158
|
-
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
11225
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
|
|
11159
11226
|
break;
|
|
11160
11227
|
default:
|
|
11161
11228
|
this.eventEmitter.emit('message', message);
|
|
@@ -11186,7 +11253,7 @@ class WebSocketClient extends Emitter {
|
|
|
11186
11253
|
this.close();
|
|
11187
11254
|
}
|
|
11188
11255
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
11189
|
-
logger$
|
|
11256
|
+
logger$5.log('Wazo WS url computed to reconnect', { url });
|
|
11190
11257
|
|
|
11191
11258
|
return url;
|
|
11192
11259
|
}
|
|
@@ -11194,15 +11261,15 @@ class WebSocketClient extends Emitter {
|
|
|
11194
11261
|
_onHeartbeat(message ) {
|
|
11195
11262
|
if (message.payload === 'pong') {
|
|
11196
11263
|
this.heartbeat.onHeartbeat();
|
|
11197
|
-
logger$
|
|
11264
|
+
logger$5.log('on heartbeat received from Wazo WS');
|
|
11198
11265
|
}
|
|
11199
11266
|
}
|
|
11200
11267
|
|
|
11201
11268
|
async _onHeartbeatTimeout() {
|
|
11202
|
-
logger$
|
|
11269
|
+
logger$5.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
11203
11270
|
|
|
11204
11271
|
this.close();
|
|
11205
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11272
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11206
11273
|
|
|
11207
11274
|
if (this.onHeartBeatTimeout) {
|
|
11208
11275
|
this.onHeartBeatTimeout();
|
|
@@ -11282,7 +11349,7 @@ WebSocketClient.eventLists = [
|
|
|
11282
11349
|
|
|
11283
11350
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
11284
11351
|
__proto__: null,
|
|
11285
|
-
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
11352
|
+
SOCKET_EVENTS: SOCKET_EVENTS$1,
|
|
11286
11353
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
11287
11354
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
11288
11355
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -11355,10 +11422,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11355
11422
|
|
|
11356
11423
|
//
|
|
11357
11424
|
|
|
11358
|
-
const { SOCKET_EVENTS
|
|
11359
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS
|
|
11425
|
+
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11426
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
11360
11427
|
|
|
11361
|
-
const logger$
|
|
11428
|
+
const logger$4 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
11362
11429
|
|
|
11363
11430
|
class Websocket extends Emitter {
|
|
11364
11431
|
|
|
@@ -11372,9 +11439,9 @@ class Websocket extends Emitter {
|
|
|
11372
11439
|
// $FlowFixMe
|
|
11373
11440
|
this[key] = OTHER_EVENTS[key];
|
|
11374
11441
|
});
|
|
11375
|
-
Object.keys(SOCKET_EVENTS
|
|
11442
|
+
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
11376
11443
|
// $FlowFixMe
|
|
11377
|
-
this[key] = SOCKET_EVENTS
|
|
11444
|
+
this[key] = SOCKET_EVENTS[key];
|
|
11378
11445
|
});
|
|
11379
11446
|
this.eventLists = WebSocketClient.eventLists;
|
|
11380
11447
|
|
|
@@ -11382,7 +11449,7 @@ class Websocket extends Emitter {
|
|
|
11382
11449
|
}
|
|
11383
11450
|
|
|
11384
11451
|
open(host , session ) {
|
|
11385
|
-
logger$
|
|
11452
|
+
logger$4.info('open simple WebSocket', { host, token: session.token });
|
|
11386
11453
|
this.ws = new WebSocketClient(
|
|
11387
11454
|
{
|
|
11388
11455
|
host,
|
|
@@ -11410,7 +11477,7 @@ class Websocket extends Emitter {
|
|
|
11410
11477
|
}
|
|
11411
11478
|
|
|
11412
11479
|
updateToken(token ) {
|
|
11413
|
-
logger$
|
|
11480
|
+
logger$4.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
11414
11481
|
|
|
11415
11482
|
if (!this.ws) {
|
|
11416
11483
|
return;
|
|
@@ -11438,12 +11505,12 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11438
11505
|
|
|
11439
11506
|
//
|
|
11440
11507
|
|
|
11441
|
-
const logger$
|
|
11508
|
+
const logger$3 = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
11442
11509
|
|
|
11443
|
-
class SipRoom extends Room
|
|
11510
|
+
class SipRoom extends Room {
|
|
11444
11511
|
|
|
11445
11512
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
11446
|
-
logger$
|
|
11513
|
+
logger$3.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
11447
11514
|
|
|
11448
11515
|
if (!room) {
|
|
11449
11516
|
await Wazo.Phone.connect();
|
|
@@ -11459,7 +11526,7 @@ class SipRoom extends Room$1 {
|
|
|
11459
11526
|
room.setCallId(room.callSession.call.id);
|
|
11460
11527
|
}
|
|
11461
11528
|
|
|
11462
|
-
logger$
|
|
11529
|
+
logger$3.info('connected to room', {
|
|
11463
11530
|
extension: room.extension,
|
|
11464
11531
|
});
|
|
11465
11532
|
|
|
@@ -11467,7 +11534,7 @@ class SipRoom extends Room$1 {
|
|
|
11467
11534
|
}
|
|
11468
11535
|
|
|
11469
11536
|
mute() {
|
|
11470
|
-
logger$
|
|
11537
|
+
logger$3.info('mute sip room');
|
|
11471
11538
|
|
|
11472
11539
|
Wazo.Phone.mute(this.callSession, false);
|
|
11473
11540
|
|
|
@@ -11475,7 +11542,7 @@ class SipRoom extends Room$1 {
|
|
|
11475
11542
|
}
|
|
11476
11543
|
|
|
11477
11544
|
unmute() {
|
|
11478
|
-
logger$
|
|
11545
|
+
logger$3.info('unmute sip room');
|
|
11479
11546
|
|
|
11480
11547
|
Wazo.Phone.unmute(this.callSession, false);
|
|
11481
11548
|
|
|
@@ -11770,7 +11837,7 @@ class NotificationOptions {
|
|
|
11770
11837
|
|
|
11771
11838
|
|
|
11772
11839
|
// Represents a conference room, like `9000`.
|
|
11773
|
-
class Room {
|
|
11840
|
+
class Room$1 {
|
|
11774
11841
|
|
|
11775
11842
|
|
|
11776
11843
|
|
|
@@ -11791,7 +11858,7 @@ class Room {
|
|
|
11791
11858
|
}
|
|
11792
11859
|
|
|
11793
11860
|
connect(callSession ) {
|
|
11794
|
-
return new Room({ ...this, connectedCallSession: callSession });
|
|
11861
|
+
return new Room$1({ ...this, connectedCallSession: callSession });
|
|
11795
11862
|
}
|
|
11796
11863
|
|
|
11797
11864
|
has(callSession ) {
|
|
@@ -11800,7 +11867,7 @@ class Room {
|
|
|
11800
11867
|
|
|
11801
11868
|
addParticipant(uuid , extension , talking = null) {
|
|
11802
11869
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
11803
|
-
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
11870
|
+
return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
11804
11871
|
}
|
|
11805
11872
|
|
|
11806
11873
|
return this;
|
|
@@ -11819,7 +11886,7 @@ class Room {
|
|
|
11819
11886
|
updatedParticipants.push(participant);
|
|
11820
11887
|
}
|
|
11821
11888
|
|
|
11822
|
-
return new Room({ ...this, participants: updatedParticipants });
|
|
11889
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
11823
11890
|
}
|
|
11824
11891
|
|
|
11825
11892
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -11835,7 +11902,7 @@ class Room {
|
|
|
11835
11902
|
updatedParticipants.push(participant);
|
|
11836
11903
|
}
|
|
11837
11904
|
|
|
11838
|
-
return new Room({ ...this, participants: updatedParticipants });
|
|
11905
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
11839
11906
|
}
|
|
11840
11907
|
|
|
11841
11908
|
hasCallWithId(id ) {
|
|
@@ -11843,18 +11910,18 @@ class Room {
|
|
|
11843
11910
|
}
|
|
11844
11911
|
|
|
11845
11912
|
disconnect() {
|
|
11846
|
-
return new Room({ ...this, connectedCallSession: null });
|
|
11913
|
+
return new Room$1({ ...this, connectedCallSession: null });
|
|
11847
11914
|
}
|
|
11848
11915
|
|
|
11849
11916
|
removeParticipantWithUUID(uuid ) {
|
|
11850
|
-
return new Room({
|
|
11917
|
+
return new Room$1({
|
|
11851
11918
|
...this,
|
|
11852
11919
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
11853
11920
|
});
|
|
11854
11921
|
}
|
|
11855
11922
|
|
|
11856
11923
|
removeParticipantWithExtension(extension ) {
|
|
11857
|
-
return new Room({
|
|
11924
|
+
return new Room$1({
|
|
11858
11925
|
...this,
|
|
11859
11926
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
11860
11927
|
});
|
|
@@ -11865,7 +11932,7 @@ class Room {
|
|
|
11865
11932
|
}
|
|
11866
11933
|
|
|
11867
11934
|
static newFrom(room ) {
|
|
11868
|
-
return newFrom(room, Room);
|
|
11935
|
+
return newFrom(room, Room$1);
|
|
11869
11936
|
}
|
|
11870
11937
|
}
|
|
11871
11938
|
|
|
@@ -12172,11 +12239,11 @@ var wazoWebsocket = {
|
|
|
12172
12239
|
resolve();
|
|
12173
12240
|
};
|
|
12174
12241
|
|
|
12175
|
-
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
12242
|
+
client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
|
|
12176
12243
|
handleError(`Connection error : ${error}`);
|
|
12177
12244
|
});
|
|
12178
12245
|
|
|
12179
|
-
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
12246
|
+
client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
|
|
12180
12247
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
12181
12248
|
client.setOnHeartbeatTimeout(() => {
|
|
12182
12249
|
handleError('No response to heartbeat');
|
|
@@ -12277,7 +12344,7 @@ var webrtc = {
|
|
|
12277
12344
|
}),
|
|
12278
12345
|
};
|
|
12279
12346
|
|
|
12280
|
-
const parseCandidate
|
|
12347
|
+
const parseCandidate = line => {
|
|
12281
12348
|
let parts;
|
|
12282
12349
|
// Parse both variants.
|
|
12283
12350
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -12368,7 +12435,7 @@ var SymmetricNat = {
|
|
|
12368
12435
|
}
|
|
12369
12436
|
|
|
12370
12437
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
12371
|
-
const cand = parseCandidate
|
|
12438
|
+
const cand = parseCandidate(e.candidate.candidate);
|
|
12372
12439
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
12373
12440
|
candidates[cand.relatedPort].push(cand.port);
|
|
12374
12441
|
} else if (!e.candidate) {
|
|
@@ -12436,7 +12503,7 @@ var iceIpv4 = {
|
|
|
12436
12503
|
const rawCandidate = e.candidate.candidate;
|
|
12437
12504
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
12438
12505
|
hasSrflxOrRelay = true;
|
|
12439
|
-
const candidate = parseCandidate
|
|
12506
|
+
const candidate = parseCandidate(e.candidate.candidate);
|
|
12440
12507
|
ips.push(candidate.ip);
|
|
12441
12508
|
}
|
|
12442
12509
|
} else if (!e.candidate) {
|
|
@@ -12473,7 +12540,7 @@ var checks = [
|
|
|
12473
12540
|
|
|
12474
12541
|
//
|
|
12475
12542
|
|
|
12476
|
-
const logger$
|
|
12543
|
+
const logger$2 = IssueReporter$1.loggerFor('engine-check');
|
|
12477
12544
|
|
|
12478
12545
|
class Checker {
|
|
12479
12546
|
|
|
@@ -12491,28 +12558,28 @@ class Checker {
|
|
|
12491
12558
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
12492
12559
|
await this._addEngineVersion();
|
|
12493
12560
|
|
|
12494
|
-
logger$
|
|
12561
|
+
logger$2.info('Engine check starting');
|
|
12495
12562
|
|
|
12496
12563
|
for (let i = 0; i < this.checks.length; i++) {
|
|
12497
12564
|
const { name, check } = this.checks[i];
|
|
12498
12565
|
|
|
12499
|
-
logger$
|
|
12566
|
+
logger$2.info(`Checking ${name} ...`);
|
|
12500
12567
|
|
|
12501
12568
|
onCheckBegin(name);
|
|
12502
12569
|
try {
|
|
12503
12570
|
// eslint-disable-next-line no-await-in-loop
|
|
12504
12571
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
12505
|
-
logger$
|
|
12572
|
+
logger$2.info(`Checking ${name} success.`, { result });
|
|
12506
12573
|
|
|
12507
12574
|
onCheckResult(name, result);
|
|
12508
12575
|
} catch (e) {
|
|
12509
|
-
logger$
|
|
12576
|
+
logger$2.info(`Checking ${name} failure`, { message: e.message });
|
|
12510
12577
|
|
|
12511
12578
|
onCheckResult(name, e);
|
|
12512
12579
|
}
|
|
12513
12580
|
}
|
|
12514
12581
|
|
|
12515
|
-
logger$
|
|
12582
|
+
logger$2.info('Engine check done.');
|
|
12516
12583
|
}
|
|
12517
12584
|
|
|
12518
12585
|
addCheck(check ) {
|
|
@@ -12536,7 +12603,7 @@ const Wazo = {
|
|
|
12536
12603
|
Auth: Auth$1,
|
|
12537
12604
|
Phone: Phone$1,
|
|
12538
12605
|
Websocket: Websocket$1,
|
|
12539
|
-
Room
|
|
12606
|
+
Room,
|
|
12540
12607
|
SipRoom,
|
|
12541
12608
|
RemoteParticipant,
|
|
12542
12609
|
LocalParticipant,
|
|
@@ -12569,7 +12636,7 @@ const Wazo = {
|
|
|
12569
12636
|
Session,
|
|
12570
12637
|
Voicemail,
|
|
12571
12638
|
Relocation,
|
|
12572
|
-
ConferenceRoom: Room,
|
|
12639
|
+
ConferenceRoom: Room$1,
|
|
12573
12640
|
CallSession,
|
|
12574
12641
|
IndirectTransfer,
|
|
12575
12642
|
SwitchboardCall,
|
|
@@ -12594,6 +12661,7 @@ const Wazo = {
|
|
|
12594
12661
|
InvalidSubscription,
|
|
12595
12662
|
InvalidAuthorization,
|
|
12596
12663
|
CanceledCallError,
|
|
12664
|
+
SFUNotAvailableError,
|
|
12597
12665
|
};
|
|
12598
12666
|
|
|
12599
12667
|
if (window) {
|
|
@@ -12608,9 +12676,9 @@ if (global) {
|
|
|
12608
12676
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
12609
12677
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
12610
12678
|
|
|
12611
|
-
const logger$
|
|
12679
|
+
const logger$1 = IssueReporter$1.loggerFor('sdk-room');
|
|
12612
12680
|
|
|
12613
|
-
class Room
|
|
12681
|
+
class Room extends Emitter {
|
|
12614
12682
|
|
|
12615
12683
|
|
|
12616
12684
|
|
|
@@ -12668,7 +12736,7 @@ class Room$1 extends Emitter {
|
|
|
12668
12736
|
extra = {},
|
|
12669
12737
|
) {
|
|
12670
12738
|
super();
|
|
12671
|
-
logger$
|
|
12739
|
+
logger$1.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
12672
12740
|
|
|
12673
12741
|
// Represents the room callSession
|
|
12674
12742
|
this.callSession = callSession;
|
|
@@ -12734,7 +12802,7 @@ class Room$1 extends Emitter {
|
|
|
12734
12802
|
* @returns {Promise<Room>}
|
|
12735
12803
|
*/
|
|
12736
12804
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
12737
|
-
logger$
|
|
12805
|
+
logger$1.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
12738
12806
|
|
|
12739
12807
|
if (!room) {
|
|
12740
12808
|
await Wazo.Phone.connect();
|
|
@@ -12747,7 +12815,7 @@ class Room$1 extends Emitter {
|
|
|
12747
12815
|
|
|
12748
12816
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
12749
12817
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
12750
|
-
logger$
|
|
12818
|
+
logger$1.info('room call received via WS', { callId: data.call_id });
|
|
12751
12819
|
if (room) {
|
|
12752
12820
|
room.setCallId(data.call_id);
|
|
12753
12821
|
}
|
|
@@ -12755,7 +12823,7 @@ class Room$1 extends Emitter {
|
|
|
12755
12823
|
|
|
12756
12824
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
12757
12825
|
// eslint-disable-next-line no-param-reassign
|
|
12758
|
-
room = new Room
|
|
12826
|
+
room = new Room(callSession, extension, null, null, extra);
|
|
12759
12827
|
|
|
12760
12828
|
// Wait for the call to be accepted
|
|
12761
12829
|
await new Promise((resolve, reject) => {
|
|
@@ -12776,7 +12844,7 @@ class Room$1 extends Emitter {
|
|
|
12776
12844
|
// Retrieve conference
|
|
12777
12845
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
12778
12846
|
|
|
12779
|
-
logger$
|
|
12847
|
+
logger$1.info('connected to room', {
|
|
12780
12848
|
sourceId: conference ? conference.sourceId : null,
|
|
12781
12849
|
name: conference ? conference.name : null,
|
|
12782
12850
|
});
|
|
@@ -12786,7 +12854,7 @@ class Room$1 extends Emitter {
|
|
|
12786
12854
|
room.setName(conference.name);
|
|
12787
12855
|
}
|
|
12788
12856
|
} else if (meeting) {
|
|
12789
|
-
logger$
|
|
12857
|
+
logger$1.info('Already connected to meeting', {
|
|
12790
12858
|
uuid: meeting.uuid,
|
|
12791
12859
|
name: meeting.name,
|
|
12792
12860
|
});
|
|
@@ -12799,13 +12867,13 @@ class Room$1 extends Emitter {
|
|
|
12799
12867
|
}
|
|
12800
12868
|
|
|
12801
12869
|
static disconnect() {
|
|
12802
|
-
logger$
|
|
12870
|
+
logger$1.info('static disconnection to room');
|
|
12803
12871
|
|
|
12804
12872
|
Wazo.Phone.disconnect();
|
|
12805
12873
|
}
|
|
12806
12874
|
|
|
12807
12875
|
async disconnect() {
|
|
12808
|
-
logger$
|
|
12876
|
+
logger$1.info('disconnection to room called');
|
|
12809
12877
|
|
|
12810
12878
|
await Wazo.Phone.hangup(this.callSession);
|
|
12811
12879
|
this.callSession = null;
|
|
@@ -12825,19 +12893,19 @@ class Room$1 extends Emitter {
|
|
|
12825
12893
|
}
|
|
12826
12894
|
|
|
12827
12895
|
setSourceId(sourceId ) {
|
|
12828
|
-
logger$
|
|
12896
|
+
logger$1.info('set room source id', { sourceId });
|
|
12829
12897
|
|
|
12830
12898
|
this.sourceId = sourceId;
|
|
12831
12899
|
}
|
|
12832
12900
|
|
|
12833
12901
|
setMeetingUuid(meetingUuid ) {
|
|
12834
|
-
logger$
|
|
12902
|
+
logger$1.info('set meeting uuid', { meetingUuid });
|
|
12835
12903
|
|
|
12836
12904
|
this.meetingUuid = meetingUuid;
|
|
12837
12905
|
}
|
|
12838
12906
|
|
|
12839
12907
|
setCallId(callId ) {
|
|
12840
|
-
logger$
|
|
12908
|
+
logger$1.info('set room call id', { callId });
|
|
12841
12909
|
|
|
12842
12910
|
if (callId) {
|
|
12843
12911
|
this.callId = callId;
|
|
@@ -12845,7 +12913,7 @@ class Room$1 extends Emitter {
|
|
|
12845
12913
|
}
|
|
12846
12914
|
|
|
12847
12915
|
setName(name ) {
|
|
12848
|
-
logger$
|
|
12916
|
+
logger$1.info('set room name', { name });
|
|
12849
12917
|
|
|
12850
12918
|
this.name = name;
|
|
12851
12919
|
}
|
|
@@ -12864,7 +12932,7 @@ class Room$1 extends Emitter {
|
|
|
12864
12932
|
}
|
|
12865
12933
|
|
|
12866
12934
|
async startScreenSharing(constraints ) {
|
|
12867
|
-
logger$
|
|
12935
|
+
logger$1.info('start room screen sharing', { constraints });
|
|
12868
12936
|
|
|
12869
12937
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
12870
12938
|
if (!screensharingStream) {
|
|
@@ -12878,7 +12946,7 @@ class Room$1 extends Emitter {
|
|
|
12878
12946
|
}
|
|
12879
12947
|
|
|
12880
12948
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
12881
|
-
logger$
|
|
12949
|
+
logger$1.info('stop room screen sharing');
|
|
12882
12950
|
|
|
12883
12951
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
12884
12952
|
|
|
@@ -12890,7 +12958,7 @@ class Room$1 extends Emitter {
|
|
|
12890
12958
|
}
|
|
12891
12959
|
|
|
12892
12960
|
turnCameraOff() {
|
|
12893
|
-
logger$
|
|
12961
|
+
logger$1.info('turn room camera off');
|
|
12894
12962
|
|
|
12895
12963
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
12896
12964
|
|
|
@@ -12900,7 +12968,7 @@ class Room$1 extends Emitter {
|
|
|
12900
12968
|
}
|
|
12901
12969
|
|
|
12902
12970
|
turnCameraOn() {
|
|
12903
|
-
logger$
|
|
12971
|
+
logger$1.info('turn room camera on');
|
|
12904
12972
|
|
|
12905
12973
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
12906
12974
|
|
|
@@ -12910,7 +12978,7 @@ class Room$1 extends Emitter {
|
|
|
12910
12978
|
}
|
|
12911
12979
|
|
|
12912
12980
|
mute() {
|
|
12913
|
-
logger$
|
|
12981
|
+
logger$1.info('mute room');
|
|
12914
12982
|
|
|
12915
12983
|
Wazo.Phone.mute(this.callSession);
|
|
12916
12984
|
|
|
@@ -12918,7 +12986,7 @@ class Room$1 extends Emitter {
|
|
|
12918
12986
|
}
|
|
12919
12987
|
|
|
12920
12988
|
unmute() {
|
|
12921
|
-
logger$
|
|
12989
|
+
logger$1.info('unmute room');
|
|
12922
12990
|
|
|
12923
12991
|
Wazo.Phone.unmute(this.callSession);
|
|
12924
12992
|
|
|
@@ -12938,7 +13006,7 @@ class Room$1 extends Emitter {
|
|
|
12938
13006
|
}
|
|
12939
13007
|
|
|
12940
13008
|
hold() {
|
|
12941
|
-
logger$
|
|
13009
|
+
logger$1.info('hold room');
|
|
12942
13010
|
|
|
12943
13011
|
Wazo.Phone.hold(this.callSession, true);
|
|
12944
13012
|
|
|
@@ -12948,7 +13016,7 @@ class Room$1 extends Emitter {
|
|
|
12948
13016
|
}
|
|
12949
13017
|
|
|
12950
13018
|
async resume() {
|
|
12951
|
-
logger$
|
|
13019
|
+
logger$1.info('resume room');
|
|
12952
13020
|
|
|
12953
13021
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
12954
13022
|
|
|
@@ -12976,13 +13044,13 @@ class Room$1 extends Emitter {
|
|
|
12976
13044
|
}
|
|
12977
13045
|
|
|
12978
13046
|
sendDTMF(tone ) {
|
|
12979
|
-
logger$
|
|
13047
|
+
logger$1.info('send room DTMF', { tone });
|
|
12980
13048
|
|
|
12981
13049
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
12982
13050
|
}
|
|
12983
13051
|
|
|
12984
13052
|
async sendReinvite(newConstraints = null) {
|
|
12985
|
-
logger$
|
|
13053
|
+
logger$1.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
12986
13054
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
12987
13055
|
|
|
12988
13056
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -13041,7 +13109,7 @@ class Room$1 extends Emitter {
|
|
|
13041
13109
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
13042
13110
|
|
|
13043
13111
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
13044
|
-
logger$
|
|
13112
|
+
logger$1.info('on room audio stream');
|
|
13045
13113
|
|
|
13046
13114
|
this.audioStream = stream;
|
|
13047
13115
|
if (!this.roomAudioElement) {
|
|
@@ -13054,7 +13122,7 @@ class Room$1 extends Emitter {
|
|
|
13054
13122
|
});
|
|
13055
13123
|
|
|
13056
13124
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
13057
|
-
logger$
|
|
13125
|
+
logger$1.info('on room video stream', { streamId });
|
|
13058
13126
|
|
|
13059
13127
|
this._mapMsid(sipSession.body.body);
|
|
13060
13128
|
|
|
@@ -13069,7 +13137,7 @@ class Room$1 extends Emitter {
|
|
|
13069
13137
|
});
|
|
13070
13138
|
|
|
13071
13139
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
13072
|
-
logger$
|
|
13140
|
+
logger$1.info('on room remove stream');
|
|
13073
13141
|
|
|
13074
13142
|
const participant = this.participants.find(someParticipant =>
|
|
13075
13143
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -13201,7 +13269,7 @@ class Room$1 extends Emitter {
|
|
|
13201
13269
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
13202
13270
|
if (requester) {
|
|
13203
13271
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
13204
|
-
logger$
|
|
13272
|
+
logger$1.info('trigger room requester status', { origin });
|
|
13205
13273
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
13206
13274
|
}
|
|
13207
13275
|
break;
|
|
@@ -13232,24 +13300,24 @@ class Room$1 extends Emitter {
|
|
|
13232
13300
|
|
|
13233
13301
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
13234
13302
|
if (participant.user_uuid === session.uuid) {
|
|
13235
|
-
logger$
|
|
13303
|
+
logger$1.info('room current user joined');
|
|
13236
13304
|
|
|
13237
13305
|
// Retrieve participants via an API calls
|
|
13238
13306
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
13239
13307
|
let response;
|
|
13240
13308
|
try {
|
|
13241
13309
|
if (this.meetingUuid) {
|
|
13242
|
-
logger$
|
|
13310
|
+
logger$1.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
13243
13311
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
13244
13312
|
} else {
|
|
13245
|
-
logger$
|
|
13313
|
+
logger$1.info('fetching conference participants', { conferenceId });
|
|
13246
13314
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
13247
13315
|
}
|
|
13248
13316
|
} catch (e) {
|
|
13249
|
-
logger$
|
|
13317
|
+
logger$1.error('room participants fetching, error', e);
|
|
13250
13318
|
}
|
|
13251
13319
|
if (response) {
|
|
13252
|
-
logger$
|
|
13320
|
+
logger$1.info('conference participants fetched', { nb: response.items.length });
|
|
13253
13321
|
participants = response.items.map(item => {
|
|
13254
13322
|
const isMe = item.call_id === this.callId;
|
|
13255
13323
|
|
|
@@ -13276,7 +13344,7 @@ class Room$1 extends Emitter {
|
|
|
13276
13344
|
? new Wazo.RemoteParticipant(this, participant)
|
|
13277
13345
|
: null;
|
|
13278
13346
|
|
|
13279
|
-
logger$
|
|
13347
|
+
logger$1.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
13280
13348
|
|
|
13281
13349
|
if (remoteParticipant) {
|
|
13282
13350
|
this.participants.push(remoteParticipant);
|
|
@@ -13441,7 +13509,7 @@ class Room$1 extends Emitter {
|
|
|
13441
13509
|
|
|
13442
13510
|
//
|
|
13443
13511
|
|
|
13444
|
-
const logger
|
|
13512
|
+
const logger = IssueReporter$1.loggerFor('room');
|
|
13445
13513
|
|
|
13446
13514
|
class Participant extends Emitter {
|
|
13447
13515
|
|
|
@@ -13563,7 +13631,7 @@ class Participant extends Emitter {
|
|
|
13563
13631
|
}
|
|
13564
13632
|
|
|
13565
13633
|
onTalking(isTalking ) {
|
|
13566
|
-
logger
|
|
13634
|
+
logger.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
13567
13635
|
this.isTalking = isTalking;
|
|
13568
13636
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
13569
13637
|
// directly from asterisk, there's no need to do so
|
|
@@ -13666,7 +13734,7 @@ class Participant extends Emitter {
|
|
|
13666
13734
|
}
|
|
13667
13735
|
|
|
13668
13736
|
updateStatus(status , broadcast = true) {
|
|
13669
|
-
logger
|
|
13737
|
+
logger.info('updating participant status', { name: this.name, status });
|
|
13670
13738
|
|
|
13671
13739
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
13672
13740
|
if (status.audioMuted) {
|
|
@@ -13714,7 +13782,7 @@ class Participant extends Emitter {
|
|
|
13714
13782
|
|
|
13715
13783
|
broadcastStatus(inboundStatus = null) {
|
|
13716
13784
|
const status = inboundStatus || this.getStatus();
|
|
13717
|
-
logger
|
|
13785
|
+
logger.info('broadcasting participant status', { callId: this.callId, status });
|
|
13718
13786
|
|
|
13719
13787
|
this.room.sendSignal({
|
|
13720
13788
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|