@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
package/lib/simple/Phone.js
CHANGED
|
@@ -263,8 +263,10 @@ var updateFrom = (instance , from ) => {
|
|
|
263
263
|
|
|
264
264
|
|
|
265
265
|
|
|
266
|
+
|
|
266
267
|
|
|
267
268
|
|
|
269
|
+
|
|
268
270
|
|
|
269
271
|
|
|
270
272
|
|
|
@@ -281,6 +283,7 @@ var updateFrom = (instance , from ) => {
|
|
|
281
283
|
|
|
282
284
|
|
|
283
285
|
|
|
286
|
+
|
|
284
287
|
|
|
285
288
|
|
|
286
289
|
class CallSession {
|
|
@@ -300,8 +303,12 @@ class CallSession {
|
|
|
300
303
|
|
|
301
304
|
|
|
302
305
|
|
|
306
|
+
|
|
307
|
+
|
|
303
308
|
|
|
304
309
|
|
|
310
|
+
|
|
311
|
+
|
|
305
312
|
|
|
306
313
|
|
|
307
314
|
|
|
@@ -339,6 +346,8 @@ class CallSession {
|
|
|
339
346
|
|
|
340
347
|
|
|
341
348
|
|
|
349
|
+
|
|
350
|
+
|
|
342
351
|
|
|
343
352
|
constructor({
|
|
344
353
|
answered,
|
|
@@ -352,6 +361,8 @@ class CallSession {
|
|
|
352
361
|
paused,
|
|
353
362
|
ringing,
|
|
354
363
|
startTime,
|
|
364
|
+
creationTime,
|
|
365
|
+
endTime,
|
|
355
366
|
cameraEnabled,
|
|
356
367
|
dialedExtension,
|
|
357
368
|
sipCallId,
|
|
@@ -364,12 +375,15 @@ class CallSession {
|
|
|
364
375
|
recording,
|
|
365
376
|
recordingPaused,
|
|
366
377
|
videoRemotelyDowngraded,
|
|
378
|
+
sipSession,
|
|
367
379
|
} ) {
|
|
368
380
|
this.callId = callId;
|
|
369
381
|
this.sipCallId = sipCallId;
|
|
370
382
|
this.displayName = displayName;
|
|
371
383
|
this.number = number;
|
|
384
|
+
this.creationTime = creationTime;
|
|
372
385
|
this.startTime = startTime;
|
|
386
|
+
this.endTime = endTime;
|
|
373
387
|
this.isCaller = isCaller;
|
|
374
388
|
this.answered = answered;
|
|
375
389
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -388,6 +402,7 @@ class CallSession {
|
|
|
388
402
|
this.recording = recording || false;
|
|
389
403
|
this.recordingPaused = recordingPaused || false;
|
|
390
404
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
405
|
+
this.sipSession = sipSession;
|
|
391
406
|
|
|
392
407
|
// Useful to compare instead of instanceof with minified code
|
|
393
408
|
this.type = 'CallSession';
|
|
@@ -1034,11 +1049,11 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
1034
1049
|
|
|
1035
1050
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
1036
1051
|
|
|
1037
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1052
|
+
const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1038
1053
|
|
|
1039
1054
|
// Use a function here to be able to mock it in tests
|
|
1040
1055
|
const realFetch = () => {
|
|
1041
|
-
if (typeof document !== 'undefined') {
|
|
1056
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
1042
1057
|
// Browser
|
|
1043
1058
|
return window.fetch;
|
|
1044
1059
|
}
|
|
@@ -1173,7 +1188,7 @@ class ApiRequester {
|
|
|
1173
1188
|
};
|
|
1174
1189
|
|
|
1175
1190
|
if (this.refreshTokenPromise) {
|
|
1176
|
-
logger.info('A token is already refreshing, waiting ...', { url });
|
|
1191
|
+
logger$c.info('A token is already refreshing, waiting ...', { url });
|
|
1177
1192
|
await this.refreshTokenPromise;
|
|
1178
1193
|
}
|
|
1179
1194
|
|
|
@@ -1193,7 +1208,7 @@ class ApiRequester {
|
|
|
1193
1208
|
return promise.then(async (err ) => {
|
|
1194
1209
|
// Check if the token is still valid
|
|
1195
1210
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
1196
|
-
logger.warn('token expired', { error: err.reason });
|
|
1211
|
+
logger$c.warn('token expired', { error: err.reason });
|
|
1197
1212
|
// Replay the call after refreshing the token
|
|
1198
1213
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
1199
1214
|
}
|
|
@@ -1203,7 +1218,7 @@ class ApiRequester {
|
|
|
1203
1218
|
: exceptionClass.fromResponse(err, response.status);
|
|
1204
1219
|
|
|
1205
1220
|
if (this.shouldLogErrors) {
|
|
1206
|
-
logger.error('API error', error);
|
|
1221
|
+
logger$c.error('API error', error);
|
|
1207
1222
|
}
|
|
1208
1223
|
|
|
1209
1224
|
throw error;
|
|
@@ -1213,7 +1228,7 @@ class ApiRequester {
|
|
|
1213
1228
|
return newParse(response, isJson);
|
|
1214
1229
|
}).catch(error => {
|
|
1215
1230
|
if (this.shouldLogErrors) {
|
|
1216
|
-
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
1231
|
+
logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
1217
1232
|
}
|
|
1218
1233
|
|
|
1219
1234
|
throw error;
|
|
@@ -1241,13 +1256,13 @@ class ApiRequester {
|
|
|
1241
1256
|
) {
|
|
1242
1257
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
1243
1258
|
let newPath = path;
|
|
1244
|
-
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
1259
|
+
logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
1245
1260
|
|
|
1246
1261
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
1247
1262
|
|
|
1248
1263
|
return this.refreshTokenPromise.then(() => {
|
|
1249
1264
|
this.refreshTokenPromise = null;
|
|
1250
|
-
logger.info('token refreshed', { isTokenNotFound });
|
|
1265
|
+
logger$c.info('token refreshed', { isTokenNotFound });
|
|
1251
1266
|
if (isTokenNotFound) {
|
|
1252
1267
|
const pathParts = path.split('/');
|
|
1253
1268
|
pathParts.pop();
|
|
@@ -2487,7 +2502,7 @@ class Contact {
|
|
|
2487
2502
|
this[key] = old[key] || this[key];
|
|
2488
2503
|
});
|
|
2489
2504
|
|
|
2490
|
-
if (old.lineState
|
|
2505
|
+
if (old.lineState) {
|
|
2491
2506
|
this.lineState = old.lineState;
|
|
2492
2507
|
}
|
|
2493
2508
|
|
|
@@ -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);
|
|
@@ -5696,7 +5711,7 @@ class AdHocAPIConference {
|
|
|
5696
5711
|
|
|
5697
5712
|
/* */
|
|
5698
5713
|
|
|
5699
|
-
const parseCandidate = (candidate ) => {
|
|
5714
|
+
const parseCandidate$1 = (candidate ) => {
|
|
5700
5715
|
if (!candidate) {
|
|
5701
5716
|
return null;
|
|
5702
5717
|
}
|
|
@@ -5808,11 +5823,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5808
5823
|
|
|
5809
5824
|
// $FlowFixMe
|
|
5810
5825
|
setRemoteSessionDescription(sessionDescription ) {
|
|
5811
|
-
|
|
5826
|
+
try {
|
|
5827
|
+
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
5812
5828
|
|
|
5813
|
-
|
|
5829
|
+
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
5814
5830
|
|
|
5815
|
-
|
|
5831
|
+
return result;
|
|
5832
|
+
} catch (error) {
|
|
5833
|
+
this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
|
|
5834
|
+
throw error;
|
|
5835
|
+
}
|
|
5816
5836
|
}
|
|
5817
5837
|
|
|
5818
5838
|
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
@@ -5850,7 +5870,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5850
5870
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
5851
5871
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
5852
5872
|
if (event.candidate) {
|
|
5853
|
-
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
5873
|
+
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
5854
5874
|
}
|
|
5855
5875
|
};
|
|
5856
5876
|
|
|
@@ -6314,7 +6334,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6314
6334
|
const SEND_STATS_DELAY = 5000;
|
|
6315
6335
|
|
|
6316
6336
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6317
|
-
const logger$
|
|
6337
|
+
const logger$9 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6318
6338
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6319
6339
|
|
|
6320
6340
|
// events
|
|
@@ -6328,14 +6348,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6328
6348
|
const MESSAGE = 'message';
|
|
6329
6349
|
const ACCEPTED = 'accepted';
|
|
6330
6350
|
const REJECTED = 'rejected';
|
|
6331
|
-
const ON_TRACK = 'onTrack';
|
|
6332
|
-
const ON_REINVITE = 'reinvite';
|
|
6351
|
+
const ON_TRACK$1 = 'onTrack';
|
|
6352
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
6333
6353
|
const ON_ERROR = 'onError';
|
|
6334
6354
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6335
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6336
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
6355
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6356
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6337
6357
|
|
|
6338
|
-
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6358
|
+
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6339
6359
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6340
6360
|
class CanceledCallError extends Error {}
|
|
6341
6361
|
|
|
@@ -6471,12 +6491,12 @@ class WebRTCClient extends Emitter {
|
|
|
6471
6491
|
this.MESSAGE = MESSAGE;
|
|
6472
6492
|
this.ACCEPTED = ACCEPTED;
|
|
6473
6493
|
this.REJECTED = REJECTED;
|
|
6474
|
-
this.ON_TRACK = ON_TRACK;
|
|
6475
|
-
this.ON_REINVITE = ON_REINVITE;
|
|
6494
|
+
this.ON_TRACK = ON_TRACK$1;
|
|
6495
|
+
this.ON_REINVITE = ON_REINVITE$1;
|
|
6476
6496
|
this.ON_ERROR = ON_ERROR;
|
|
6477
6497
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6478
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6479
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6498
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6499
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6480
6500
|
}
|
|
6481
6501
|
|
|
6482
6502
|
configureMedia(media ) {
|
|
@@ -6493,13 +6513,13 @@ class WebRTCClient extends Emitter {
|
|
|
6493
6513
|
|
|
6494
6514
|
createUserAgent(configOverrides ) {
|
|
6495
6515
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6496
|
-
logger$
|
|
6516
|
+
logger$9.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6497
6517
|
|
|
6498
6518
|
webRTCConfiguration.delegate = {
|
|
6499
6519
|
onConnect: this.onConnect.bind(this),
|
|
6500
6520
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6501
6521
|
onInvite: (invitation ) => {
|
|
6502
|
-
logger$
|
|
6522
|
+
logger$9.info('sdk webrtc on invite', {
|
|
6503
6523
|
method: 'delegate.onInvite',
|
|
6504
6524
|
id: invitation.id,
|
|
6505
6525
|
remoteURI: invitation.remoteURI,
|
|
@@ -6542,7 +6562,7 @@ class WebRTCClient extends Emitter {
|
|
|
6542
6562
|
}
|
|
6543
6563
|
|
|
6544
6564
|
onConnect() {
|
|
6545
|
-
logger$
|
|
6565
|
+
logger$9.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6546
6566
|
this.eventEmitter.emit(CONNECTED);
|
|
6547
6567
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6548
6568
|
this.registerer.waitingToggle(false);
|
|
@@ -6551,7 +6571,7 @@ class WebRTCClient extends Emitter {
|
|
|
6551
6571
|
}
|
|
6552
6572
|
|
|
6553
6573
|
async onDisconnect(error ) {
|
|
6554
|
-
logger$
|
|
6574
|
+
logger$9.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6555
6575
|
this.connectionPromise = null;
|
|
6556
6576
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6557
6577
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6576,37 +6596,37 @@ class WebRTCClient extends Emitter {
|
|
|
6576
6596
|
};
|
|
6577
6597
|
|
|
6578
6598
|
if (this.skipRegister) {
|
|
6579
|
-
logger$
|
|
6599
|
+
logger$9.info('sdk webrtc skip register...', logInfo);
|
|
6580
6600
|
return Promise.resolve();
|
|
6581
6601
|
}
|
|
6582
6602
|
|
|
6583
|
-
logger$
|
|
6603
|
+
logger$9.info('sdk webrtc registering...', logInfo);
|
|
6584
6604
|
|
|
6585
6605
|
if (!this.userAgent) {
|
|
6586
|
-
logger$
|
|
6606
|
+
logger$9.info('sdk webrtc recreating User Agent');
|
|
6587
6607
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6588
6608
|
}
|
|
6589
6609
|
if (!this.userAgent || this.isRegistered()) {
|
|
6590
|
-
logger$
|
|
6610
|
+
logger$9.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6591
6611
|
return Promise.resolve();
|
|
6592
6612
|
}
|
|
6593
6613
|
|
|
6594
6614
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6595
|
-
logger$
|
|
6615
|
+
logger$9.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6596
6616
|
return Promise.resolve();
|
|
6597
6617
|
}
|
|
6598
6618
|
|
|
6599
6619
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6600
6620
|
|
|
6601
6621
|
const onRegisterFailed = () => {
|
|
6602
|
-
logger$
|
|
6622
|
+
logger$9.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6603
6623
|
this.connectionPromise = null;
|
|
6604
6624
|
if (this.registerer && this.registerer.waiting) {
|
|
6605
6625
|
this.registerer.waitingToggle(false);
|
|
6606
6626
|
}
|
|
6607
6627
|
|
|
6608
6628
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6609
|
-
logger$
|
|
6629
|
+
logger$9.info('sdk webrtc registering, retrying...', { tries });
|
|
6610
6630
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6611
6631
|
}
|
|
6612
6632
|
};
|
|
@@ -6615,18 +6635,18 @@ class WebRTCClient extends Emitter {
|
|
|
6615
6635
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6616
6636
|
// during the resolution of the primise.
|
|
6617
6637
|
if (!this.userAgent) {
|
|
6618
|
-
logger$
|
|
6638
|
+
logger$9.info('sdk webrtc recreating User Agent after connection');
|
|
6619
6639
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6620
6640
|
}
|
|
6621
6641
|
|
|
6622
|
-
logger$
|
|
6642
|
+
logger$9.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6623
6643
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
6624
6644
|
this.connectionPromise = null;
|
|
6625
6645
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6626
6646
|
|
|
6627
6647
|
// Bind registerer events
|
|
6628
6648
|
this.registerer.stateChange.addListener(newState => {
|
|
6629
|
-
logger$
|
|
6649
|
+
logger$9.info('sdk webrtc registering, state changed', { newState });
|
|
6630
6650
|
|
|
6631
6651
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
6632
6652
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -6639,7 +6659,7 @@ class WebRTCClient extends Emitter {
|
|
|
6639
6659
|
const options = {
|
|
6640
6660
|
requestDelegate: {
|
|
6641
6661
|
onReject: response => {
|
|
6642
|
-
logger$
|
|
6662
|
+
logger$9.error('sdk webrtc registering, rejected', { response });
|
|
6643
6663
|
|
|
6644
6664
|
onRegisterFailed();
|
|
6645
6665
|
},
|
|
@@ -6647,13 +6667,13 @@ class WebRTCClient extends Emitter {
|
|
|
6647
6667
|
};
|
|
6648
6668
|
|
|
6649
6669
|
return this.registerer.register(options).catch((e) => {
|
|
6650
|
-
logger$
|
|
6670
|
+
logger$9.error('sdk webrtc registering, error', e);
|
|
6651
6671
|
|
|
6652
6672
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6653
6673
|
return e;
|
|
6654
6674
|
});
|
|
6655
6675
|
}).catch(error => {
|
|
6656
|
-
logger$
|
|
6676
|
+
logger$9.error('sdk webrtc registering, transport error', error);
|
|
6657
6677
|
onRegisterFailed();
|
|
6658
6678
|
});
|
|
6659
6679
|
}
|
|
@@ -6682,21 +6702,21 @@ class WebRTCClient extends Emitter {
|
|
|
6682
6702
|
}
|
|
6683
6703
|
|
|
6684
6704
|
unregister() {
|
|
6685
|
-
logger$
|
|
6705
|
+
logger$9.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6686
6706
|
if (!this.registerer) {
|
|
6687
6707
|
return Promise.resolve();
|
|
6688
6708
|
}
|
|
6689
6709
|
|
|
6690
6710
|
try {
|
|
6691
6711
|
return this.registerer.unregister().then(() => {
|
|
6692
|
-
logger$
|
|
6712
|
+
logger$9.info('sdk webrtc unregistered');
|
|
6693
6713
|
this._cleanupRegister();
|
|
6694
6714
|
}).catch(e => {
|
|
6695
|
-
logger$
|
|
6715
|
+
logger$9.error('sdk webrtc unregistering, promise error', e);
|
|
6696
6716
|
this._cleanupRegister();
|
|
6697
6717
|
});
|
|
6698
6718
|
} catch (e) {
|
|
6699
|
-
logger$
|
|
6719
|
+
logger$9.error('sdk webrtc unregistering, error', e);
|
|
6700
6720
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6701
6721
|
// error when the registerer is in a bad state
|
|
6702
6722
|
this._cleanupRegister();
|
|
@@ -6704,7 +6724,7 @@ class WebRTCClient extends Emitter {
|
|
|
6704
6724
|
}
|
|
6705
6725
|
|
|
6706
6726
|
stop() {
|
|
6707
|
-
logger$
|
|
6727
|
+
logger$9.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6708
6728
|
if (!this.userAgent) {
|
|
6709
6729
|
return Promise.resolve();
|
|
6710
6730
|
}
|
|
@@ -6712,12 +6732,12 @@ class WebRTCClient extends Emitter {
|
|
|
6712
6732
|
return this.userAgent.stop().then(() => {
|
|
6713
6733
|
return this._cleanupRegister();
|
|
6714
6734
|
}).catch(e => {
|
|
6715
|
-
logger$
|
|
6735
|
+
logger$9.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6716
6736
|
});
|
|
6717
6737
|
}
|
|
6718
6738
|
|
|
6719
6739
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6720
|
-
logger$
|
|
6740
|
+
logger$9.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6721
6741
|
const inviterOptions = {
|
|
6722
6742
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6723
6743
|
conference,
|
|
@@ -6748,7 +6768,7 @@ class WebRTCClient extends Emitter {
|
|
|
6748
6768
|
this._onAccepted(session, response.session, true);
|
|
6749
6769
|
},
|
|
6750
6770
|
onReject: (response ) => {
|
|
6751
|
-
logger$
|
|
6771
|
+
logger$9.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
6752
6772
|
this._stopSendingStats(session);
|
|
6753
6773
|
this.stopNetworkMonitoring(session);
|
|
6754
6774
|
|
|
@@ -6771,11 +6791,11 @@ class WebRTCClient extends Emitter {
|
|
|
6771
6791
|
}
|
|
6772
6792
|
|
|
6773
6793
|
answer(session , enableVideo ) {
|
|
6774
|
-
logger$
|
|
6794
|
+
logger$9.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
6775
6795
|
|
|
6776
6796
|
if (!session || !session.accept) {
|
|
6777
6797
|
const error = 'No session to answer, or not an invitation';
|
|
6778
|
-
logger$
|
|
6798
|
+
logger$9.warn(error);
|
|
6779
6799
|
return Promise.reject(new Error(error));
|
|
6780
6800
|
}
|
|
6781
6801
|
const options = {
|
|
@@ -6785,15 +6805,15 @@ class WebRTCClient extends Emitter {
|
|
|
6785
6805
|
return session.accept(options).then(() => {
|
|
6786
6806
|
if (session.isCanceled) {
|
|
6787
6807
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
6788
|
-
logger$
|
|
6808
|
+
logger$9.error(message, { id: session.id });
|
|
6789
6809
|
this.onCallEnded(session);
|
|
6790
6810
|
|
|
6791
6811
|
throw new CanceledCallError(message);
|
|
6792
6812
|
}
|
|
6793
|
-
logger$
|
|
6813
|
+
logger$9.info('sdk webrtc answer, accepted.');
|
|
6794
6814
|
this._onAccepted(session);
|
|
6795
6815
|
}).catch(e => {
|
|
6796
|
-
logger$
|
|
6816
|
+
logger$9.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
6797
6817
|
|
|
6798
6818
|
throw e;
|
|
6799
6819
|
});
|
|
@@ -6801,7 +6821,7 @@ class WebRTCClient extends Emitter {
|
|
|
6801
6821
|
|
|
6802
6822
|
hangup(session ) {
|
|
6803
6823
|
const { state, id } = session;
|
|
6804
|
-
logger$
|
|
6824
|
+
logger$9.info('sdk webrtc hangup call', { id, state });
|
|
6805
6825
|
|
|
6806
6826
|
try {
|
|
6807
6827
|
this._stopSendingStats(session);
|
|
@@ -6830,7 +6850,7 @@ class WebRTCClient extends Emitter {
|
|
|
6830
6850
|
|
|
6831
6851
|
return bye();
|
|
6832
6852
|
} catch (error) {
|
|
6833
|
-
logger$
|
|
6853
|
+
logger$9.warn('sdk webrtc hangup, error', error);
|
|
6834
6854
|
}
|
|
6835
6855
|
|
|
6836
6856
|
return null;
|
|
@@ -6848,7 +6868,7 @@ class WebRTCClient extends Emitter {
|
|
|
6848
6868
|
// Fetch and emit an event at `interval` with session network stats
|
|
6849
6869
|
startNetworkMonitoring(session , interval = 1000) {
|
|
6850
6870
|
const sessionId = this.getSipSessionId(session);
|
|
6851
|
-
logger$
|
|
6871
|
+
logger$9.info('starting network inspection', { id: sessionId });
|
|
6852
6872
|
|
|
6853
6873
|
this.sessionNetworkStats[sessionId] = [];
|
|
6854
6874
|
|
|
@@ -6858,7 +6878,7 @@ class WebRTCClient extends Emitter {
|
|
|
6858
6878
|
stopNetworkMonitoring(session ) {
|
|
6859
6879
|
const sessionId = this.getSipSessionId(session);
|
|
6860
6880
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
6861
|
-
logger$
|
|
6881
|
+
logger$9.info('stopping network inspection', { id: sessionId, exists });
|
|
6862
6882
|
|
|
6863
6883
|
if (exists) {
|
|
6864
6884
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -6868,17 +6888,17 @@ class WebRTCClient extends Emitter {
|
|
|
6868
6888
|
}
|
|
6869
6889
|
|
|
6870
6890
|
reject(session ) {
|
|
6871
|
-
logger$
|
|
6891
|
+
logger$9.info('sdk webrtc reject call', { id: session.id });
|
|
6872
6892
|
|
|
6873
6893
|
try {
|
|
6874
6894
|
return session.reject ? session.reject() : session.cancel();
|
|
6875
6895
|
} catch (e) {
|
|
6876
|
-
logger$
|
|
6896
|
+
logger$9.warn('Error when rejecting call', e.message, e.stack);
|
|
6877
6897
|
}
|
|
6878
6898
|
}
|
|
6879
6899
|
|
|
6880
6900
|
async close() {
|
|
6881
|
-
logger$
|
|
6901
|
+
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6882
6902
|
this._cleanupMedia();
|
|
6883
6903
|
this.connectionPromise = null;
|
|
6884
6904
|
|
|
@@ -6909,7 +6929,7 @@ class WebRTCClient extends Emitter {
|
|
|
6909
6929
|
// eg: "INVITE not rejectable in state Completed"
|
|
6910
6930
|
}
|
|
6911
6931
|
this.userAgent = null;
|
|
6912
|
-
logger$
|
|
6932
|
+
logger$9.info('sdk webrtc client closed');
|
|
6913
6933
|
}
|
|
6914
6934
|
|
|
6915
6935
|
getNumber(session ) {
|
|
@@ -6922,13 +6942,13 @@ class WebRTCClient extends Emitter {
|
|
|
6922
6942
|
}
|
|
6923
6943
|
|
|
6924
6944
|
mute(session ) {
|
|
6925
|
-
logger$
|
|
6945
|
+
logger$9.info('sdk webrtc mute', { id: session.id });
|
|
6926
6946
|
|
|
6927
6947
|
this._toggleAudio(session, true);
|
|
6928
6948
|
}
|
|
6929
6949
|
|
|
6930
6950
|
unmute(session ) {
|
|
6931
|
-
logger$
|
|
6951
|
+
logger$9.info('sdk webrtc unmute', { id: session.id });
|
|
6932
6952
|
|
|
6933
6953
|
this._toggleAudio(session, false);
|
|
6934
6954
|
}
|
|
@@ -6968,13 +6988,13 @@ class WebRTCClient extends Emitter {
|
|
|
6968
6988
|
}
|
|
6969
6989
|
|
|
6970
6990
|
toggleCameraOn(session ) {
|
|
6971
|
-
logger$
|
|
6991
|
+
logger$9.info('sdk webrtc toggle camera on', { id: session.id });
|
|
6972
6992
|
|
|
6973
6993
|
this._toggleVideo(session, false);
|
|
6974
6994
|
}
|
|
6975
6995
|
|
|
6976
6996
|
toggleCameraOff(session ) {
|
|
6977
|
-
logger$
|
|
6997
|
+
logger$9.info('sdk webrtc toggle camera off', { id: session.id });
|
|
6978
6998
|
|
|
6979
6999
|
this._toggleVideo(session, true);
|
|
6980
7000
|
}
|
|
@@ -6983,7 +7003,7 @@ class WebRTCClient extends Emitter {
|
|
|
6983
7003
|
const sessionId = this.getSipSessionId(session);
|
|
6984
7004
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
6985
7005
|
|
|
6986
|
-
logger$
|
|
7006
|
+
logger$9.info('sdk webrtc hold', {
|
|
6987
7007
|
sessionId,
|
|
6988
7008
|
keys: Object.keys(this.heldSessions),
|
|
6989
7009
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7032,7 +7052,7 @@ class WebRTCClient extends Emitter {
|
|
|
7032
7052
|
const sessionId = this.getSipSessionId(session);
|
|
7033
7053
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7034
7054
|
|
|
7035
|
-
logger$
|
|
7055
|
+
logger$9.info('sdk webrtc unhold', {
|
|
7036
7056
|
sessionId,
|
|
7037
7057
|
keys: Object.keys(this.heldSessions),
|
|
7038
7058
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7180,7 +7200,7 @@ class WebRTCClient extends Emitter {
|
|
|
7180
7200
|
if (!session.sessionDescriptionHandler) {
|
|
7181
7201
|
return;
|
|
7182
7202
|
}
|
|
7183
|
-
logger$
|
|
7203
|
+
logger$9.info('Sending DTMF', {
|
|
7184
7204
|
id: this.getSipSessionId(session),
|
|
7185
7205
|
tone,
|
|
7186
7206
|
});
|
|
@@ -7196,7 +7216,7 @@ class WebRTCClient extends Emitter {
|
|
|
7196
7216
|
transfer(session , target ) {
|
|
7197
7217
|
this.hold(session);
|
|
7198
7218
|
|
|
7199
|
-
logger$
|
|
7219
|
+
logger$9.info('Transfering a session', {
|
|
7200
7220
|
id: this.getSipSessionId(session),
|
|
7201
7221
|
target,
|
|
7202
7222
|
});
|
|
@@ -7218,17 +7238,17 @@ class WebRTCClient extends Emitter {
|
|
|
7218
7238
|
atxfer(session ) {
|
|
7219
7239
|
this.hold(session);
|
|
7220
7240
|
|
|
7221
|
-
logger$
|
|
7241
|
+
logger$9.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7222
7242
|
|
|
7223
7243
|
const result = {
|
|
7224
7244
|
newSession: null,
|
|
7225
7245
|
init: async (target ) => {
|
|
7226
|
-
logger$
|
|
7246
|
+
logger$9.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7227
7247
|
|
|
7228
7248
|
result.newSession = await this.call(target);
|
|
7229
7249
|
},
|
|
7230
7250
|
complete: () => {
|
|
7231
|
-
logger$
|
|
7251
|
+
logger$9.info('webrtc transfer completed', {
|
|
7232
7252
|
id: this.getSipSessionId(session),
|
|
7233
7253
|
referId: this.getSipSessionId(result.newSession),
|
|
7234
7254
|
});
|
|
@@ -7249,7 +7269,7 @@ class WebRTCClient extends Emitter {
|
|
|
7249
7269
|
return;
|
|
7250
7270
|
}
|
|
7251
7271
|
|
|
7252
|
-
logger$
|
|
7272
|
+
logger$9.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7253
7273
|
|
|
7254
7274
|
try {
|
|
7255
7275
|
sipSession.message({
|
|
@@ -7291,7 +7311,7 @@ class WebRTCClient extends Emitter {
|
|
|
7291
7311
|
}
|
|
7292
7312
|
|
|
7293
7313
|
changeAudioOutputVolume(volume ) {
|
|
7294
|
-
logger$
|
|
7314
|
+
logger$9.info('Changing audio output volume', { volume });
|
|
7295
7315
|
|
|
7296
7316
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7297
7317
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7303,7 +7323,7 @@ class WebRTCClient extends Emitter {
|
|
|
7303
7323
|
}
|
|
7304
7324
|
|
|
7305
7325
|
changeAudioOutputDevice(id ) {
|
|
7306
|
-
logger$
|
|
7326
|
+
logger$9.info('Changing audio output device', { id });
|
|
7307
7327
|
|
|
7308
7328
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7309
7329
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7320,7 +7340,7 @@ class WebRTCClient extends Emitter {
|
|
|
7320
7340
|
|
|
7321
7341
|
changeAudioInputDevice(id , session ) {
|
|
7322
7342
|
const currentId = this.getAudioDeviceId();
|
|
7323
|
-
logger$
|
|
7343
|
+
logger$9.info('setting audio input device', { id, currentId, session: !!session });
|
|
7324
7344
|
|
|
7325
7345
|
if (id === currentId) {
|
|
7326
7346
|
return null;
|
|
@@ -7366,7 +7386,7 @@ class WebRTCClient extends Emitter {
|
|
|
7366
7386
|
|
|
7367
7387
|
setVideoInputDevice(id ) {
|
|
7368
7388
|
const currentId = this.getVideoDeviceId();
|
|
7369
|
-
logger$
|
|
7389
|
+
logger$9.info('setting video input device', { id, currentId });
|
|
7370
7390
|
|
|
7371
7391
|
if (id === currentId) {
|
|
7372
7392
|
return null;
|
|
@@ -7391,7 +7411,7 @@ class WebRTCClient extends Emitter {
|
|
|
7391
7411
|
const sessionId = this.getSipSessionId(session);
|
|
7392
7412
|
const localStream = this.getLocalStream(sessionId);
|
|
7393
7413
|
|
|
7394
|
-
logger$
|
|
7414
|
+
logger$9.info('changing video input device', { id, sessionId });
|
|
7395
7415
|
|
|
7396
7416
|
// Release old video stream
|
|
7397
7417
|
if (localStream) {
|
|
@@ -7459,7 +7479,7 @@ class WebRTCClient extends Emitter {
|
|
|
7459
7479
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7460
7480
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7461
7481
|
|
|
7462
|
-
logger$
|
|
7482
|
+
logger$9.info('Sending reinvite', {
|
|
7463
7483
|
id: this.getSipSessionId(sipSession),
|
|
7464
7484
|
newConstraints,
|
|
7465
7485
|
conference,
|
|
@@ -7497,7 +7517,7 @@ class WebRTCClient extends Emitter {
|
|
|
7497
7517
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7498
7518
|
}
|
|
7499
7519
|
|
|
7500
|
-
logger$
|
|
7520
|
+
logger$9.info('on re-INVITE accepted', {
|
|
7501
7521
|
id: this.getSipSessionId(sipSession),
|
|
7502
7522
|
wasMuted,
|
|
7503
7523
|
shouldDoScreenSharing,
|
|
@@ -7515,7 +7535,7 @@ class WebRTCClient extends Emitter {
|
|
|
7515
7535
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7516
7536
|
}
|
|
7517
7537
|
|
|
7518
|
-
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7538
|
+
return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
|
|
7519
7539
|
},
|
|
7520
7540
|
},
|
|
7521
7541
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7672,7 +7692,7 @@ class WebRTCClient extends Emitter {
|
|
|
7672
7692
|
}
|
|
7673
7693
|
|
|
7674
7694
|
startHeartbeat() {
|
|
7675
|
-
logger$
|
|
7695
|
+
logger$9.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7676
7696
|
if (!this.userAgent) {
|
|
7677
7697
|
this.heartbeat.stop();
|
|
7678
7698
|
return;
|
|
@@ -7685,7 +7705,7 @@ class WebRTCClient extends Emitter {
|
|
|
7685
7705
|
}
|
|
7686
7706
|
|
|
7687
7707
|
stopHeartbeat() {
|
|
7688
|
-
logger$
|
|
7708
|
+
logger$9.info('sdk webrtc stop heartbeat');
|
|
7689
7709
|
this.heartbeat.stop();
|
|
7690
7710
|
}
|
|
7691
7711
|
|
|
@@ -7706,7 +7726,7 @@ class WebRTCClient extends Emitter {
|
|
|
7706
7726
|
}
|
|
7707
7727
|
|
|
7708
7728
|
attemptReconnection() {
|
|
7709
|
-
logger$
|
|
7729
|
+
logger$9.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7710
7730
|
if (!this.userAgent) {
|
|
7711
7731
|
return;
|
|
7712
7732
|
}
|
|
@@ -7731,7 +7751,7 @@ class WebRTCClient extends Emitter {
|
|
|
7731
7751
|
return;
|
|
7732
7752
|
}
|
|
7733
7753
|
|
|
7734
|
-
logger$
|
|
7754
|
+
logger$9.info('setting local media stream', {
|
|
7735
7755
|
sipSessionId,
|
|
7736
7756
|
tracks: newStream ? newStream.getTracks() : null,
|
|
7737
7757
|
});
|
|
@@ -7748,7 +7768,7 @@ class WebRTCClient extends Emitter {
|
|
|
7748
7768
|
|
|
7749
7769
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
7750
7770
|
|
|
7751
|
-
logger$
|
|
7771
|
+
logger$9.info('updating local stream', {
|
|
7752
7772
|
sipSessionId,
|
|
7753
7773
|
oldStream: !!oldStream,
|
|
7754
7774
|
tracks: newStream.getTracks(),
|
|
@@ -7768,7 +7788,7 @@ class WebRTCClient extends Emitter {
|
|
|
7768
7788
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
7769
7789
|
const pc = this.getPeerConnection(sessionId);
|
|
7770
7790
|
|
|
7771
|
-
logger$
|
|
7791
|
+
logger$9.info('Updating remote stream', {
|
|
7772
7792
|
sessionId,
|
|
7773
7793
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
7774
7794
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -7793,14 +7813,16 @@ class WebRTCClient extends Emitter {
|
|
|
7793
7813
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
7794
7814
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
7795
7815
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
7816
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
7796
7817
|
|
|
7797
|
-
logger$
|
|
7818
|
+
logger$9.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
7798
7819
|
|
|
7799
7820
|
return {
|
|
7800
7821
|
constraints: {
|
|
7801
7822
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
7802
7823
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
7803
|
-
video: screenSharing ? (isDesktop
|
|
7824
|
+
video: screenSharing ? (isDesktop
|
|
7825
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
7804
7826
|
: this._getVideoConstraints(enableVideo),
|
|
7805
7827
|
screen: screenSharing,
|
|
7806
7828
|
desktop: isDesktop,
|
|
@@ -7843,7 +7865,7 @@ class WebRTCClient extends Emitter {
|
|
|
7843
7865
|
}
|
|
7844
7866
|
|
|
7845
7867
|
_onTransportError() {
|
|
7846
|
-
logger$
|
|
7868
|
+
logger$9.error('on transport error');
|
|
7847
7869
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
7848
7870
|
this.attemptReconnection();
|
|
7849
7871
|
}
|
|
@@ -7852,7 +7874,7 @@ class WebRTCClient extends Emitter {
|
|
|
7852
7874
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
7853
7875
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
7854
7876
|
if (this.hasHeartbeat()) {
|
|
7855
|
-
logger$
|
|
7877
|
+
logger$9.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
7856
7878
|
|
|
7857
7879
|
this.heartbeat.onHeartbeat();
|
|
7858
7880
|
if (this.heartbeatCb) {
|
|
@@ -7863,7 +7885,7 @@ class WebRTCClient extends Emitter {
|
|
|
7863
7885
|
}
|
|
7864
7886
|
|
|
7865
7887
|
async _onHeartbeatTimeout() {
|
|
7866
|
-
logger$
|
|
7888
|
+
logger$9.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7867
7889
|
|
|
7868
7890
|
if (this.heartbeatTimeoutCb) {
|
|
7869
7891
|
this.heartbeatTimeoutCb();
|
|
@@ -7875,7 +7897,7 @@ class WebRTCClient extends Emitter {
|
|
|
7875
7897
|
try {
|
|
7876
7898
|
await this.userAgent.transport.disconnect();
|
|
7877
7899
|
} catch (e) {
|
|
7878
|
-
logger$
|
|
7900
|
+
logger$9.error('Transport disconnection after heartbeat timeout, error', e);
|
|
7879
7901
|
}
|
|
7880
7902
|
}
|
|
7881
7903
|
|
|
@@ -7908,31 +7930,31 @@ class WebRTCClient extends Emitter {
|
|
|
7908
7930
|
}
|
|
7909
7931
|
|
|
7910
7932
|
_connectIfNeeded() {
|
|
7911
|
-
logger$
|
|
7933
|
+
logger$9.info('connect if needed, checking', { connected: this.isConnected() });
|
|
7912
7934
|
if (!this.userAgent) {
|
|
7913
|
-
logger$
|
|
7935
|
+
logger$9.info('need to recreate User Agent');
|
|
7914
7936
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
7915
7937
|
}
|
|
7916
7938
|
|
|
7917
7939
|
if (this.isConnected()) {
|
|
7918
|
-
logger$
|
|
7940
|
+
logger$9.info('webrtc sdk, already connected');
|
|
7919
7941
|
return Promise.resolve();
|
|
7920
7942
|
}
|
|
7921
7943
|
|
|
7922
7944
|
if (this.isConnecting()) {
|
|
7923
|
-
logger$
|
|
7945
|
+
logger$9.info('webrtc sdk, already connecting...');
|
|
7924
7946
|
|
|
7925
7947
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
7926
7948
|
return this.connectionPromise;
|
|
7927
7949
|
}
|
|
7928
7950
|
|
|
7929
7951
|
if (this.connectionPromise) {
|
|
7930
|
-
logger$
|
|
7952
|
+
logger$9.info('webrtc sdk, connection promise connecting...');
|
|
7931
7953
|
// $FlowFixMe
|
|
7932
7954
|
return this.connectionPromise;
|
|
7933
7955
|
}
|
|
7934
7956
|
|
|
7935
|
-
logger$
|
|
7957
|
+
logger$9.info('WebRTC UA needs to connect');
|
|
7936
7958
|
|
|
7937
7959
|
// Force UA to reconnect
|
|
7938
7960
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -8057,7 +8079,7 @@ class WebRTCClient extends Emitter {
|
|
|
8057
8079
|
|
|
8058
8080
|
sdh.peerConnectionDelegate = {
|
|
8059
8081
|
onicecandidateerror: (error ) => {
|
|
8060
|
-
logger$
|
|
8082
|
+
logger$9.error('on icecandidate error', {
|
|
8061
8083
|
address: error.address,
|
|
8062
8084
|
port: error.port,
|
|
8063
8085
|
errorCode: error.errorCode,
|
|
@@ -8086,7 +8108,7 @@ class WebRTCClient extends Emitter {
|
|
|
8086
8108
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8087
8109
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8088
8110
|
}
|
|
8089
|
-
logger$
|
|
8111
|
+
logger$9.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8090
8112
|
|
|
8091
8113
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8092
8114
|
|
|
@@ -8102,12 +8124,12 @@ class WebRTCClient extends Emitter {
|
|
|
8102
8124
|
|
|
8103
8125
|
this._setupMedias(session);
|
|
8104
8126
|
|
|
8105
|
-
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8127
|
+
return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8106
8128
|
};
|
|
8107
8129
|
}
|
|
8108
8130
|
|
|
8109
8131
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8110
|
-
logger$
|
|
8132
|
+
logger$9.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8111
8133
|
|
|
8112
8134
|
this.storeSipSession(session);
|
|
8113
8135
|
|
|
@@ -8119,14 +8141,14 @@ class WebRTCClient extends Emitter {
|
|
|
8119
8141
|
const onTrack = (event ) => {
|
|
8120
8142
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8121
8143
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8122
|
-
logger$
|
|
8144
|
+
logger$9.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8123
8145
|
|
|
8124
8146
|
// Stop video track in audio only mode
|
|
8125
8147
|
if (isAudioOnly && kind === 'video') {
|
|
8126
8148
|
event.track.stop();
|
|
8127
8149
|
}
|
|
8128
8150
|
|
|
8129
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8151
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
8130
8152
|
};
|
|
8131
8153
|
|
|
8132
8154
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8135,12 +8157,14 @@ class WebRTCClient extends Emitter {
|
|
|
8135
8157
|
|
|
8136
8158
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8137
8159
|
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8160
|
+
if (pc) {
|
|
8161
|
+
pc.oniceconnectionstatechange = () => {
|
|
8162
|
+
logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8163
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8164
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8165
|
+
}
|
|
8166
|
+
};
|
|
8167
|
+
}
|
|
8144
8168
|
|
|
8145
8169
|
if (withEvent) {
|
|
8146
8170
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8309,10 +8333,10 @@ class WebRTCClient extends Emitter {
|
|
|
8309
8333
|
|
|
8310
8334
|
_stopSendingStats(session ) {
|
|
8311
8335
|
const sessionId = this.getSipSessionId(session);
|
|
8312
|
-
logger$
|
|
8336
|
+
logger$9.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8313
8337
|
|
|
8314
8338
|
if (sessionId in this.statsIntervals) {
|
|
8315
|
-
logger$
|
|
8339
|
+
logger$9.trace('Stop sending stats for call', { sessionId });
|
|
8316
8340
|
this.statsIntervals[sessionId]();
|
|
8317
8341
|
delete this.statsIntervals[sessionId];
|
|
8318
8342
|
}
|
|
@@ -8328,7 +8352,7 @@ class WebRTCClient extends Emitter {
|
|
|
8328
8352
|
try {
|
|
8329
8353
|
await this.userAgent.transport.disconnect();
|
|
8330
8354
|
} catch (e) {
|
|
8331
|
-
logger$
|
|
8355
|
+
logger$9.error('WebRTC transport disconnect, error', e);
|
|
8332
8356
|
}
|
|
8333
8357
|
}
|
|
8334
8358
|
}
|
|
@@ -8350,13 +8374,17 @@ class WebRTCClient extends Emitter {
|
|
|
8350
8374
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8351
8375
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8352
8376
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8377
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8353
8378
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8354
8379
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8380
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8355
8381
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8356
8382
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8357
8383
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8358
|
-
let audioBytesSent = 0;
|
|
8359
|
-
let audioBytesReceived = 0;
|
|
8384
|
+
let audioBytesSent = 0; // content + header
|
|
8385
|
+
let audioBytesReceived = 0; // content + header
|
|
8386
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8387
|
+
let audioContentReceived = 0;
|
|
8360
8388
|
let videoBytesSent = 0;
|
|
8361
8389
|
let videoBytesReceived = 0;
|
|
8362
8390
|
let transportSent = 0;
|
|
@@ -8366,6 +8394,7 @@ class WebRTCClient extends Emitter {
|
|
|
8366
8394
|
stats.forEach(report => {
|
|
8367
8395
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8368
8396
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8397
|
+
audioContentSent += Number(report.bytesSent);
|
|
8369
8398
|
}
|
|
8370
8399
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8371
8400
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -8377,6 +8406,7 @@ class WebRTCClient extends Emitter {
|
|
|
8377
8406
|
packetsLost += Number(report.packetsLost);
|
|
8378
8407
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8379
8408
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8409
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8380
8410
|
}
|
|
8381
8411
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8382
8412
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -8405,10 +8435,17 @@ class WebRTCClient extends Emitter {
|
|
|
8405
8435
|
});
|
|
8406
8436
|
|
|
8407
8437
|
networkStats.packetsLost = packetsLost;
|
|
8438
|
+
|
|
8408
8439
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8409
8440
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8410
8441
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8411
8442
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8443
|
+
|
|
8444
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8445
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8446
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8447
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8448
|
+
|
|
8412
8449
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8413
8450
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8414
8451
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8422,7 +8459,7 @@ class WebRTCClient extends Emitter {
|
|
|
8422
8459
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8423
8460
|
+ networkStats.transportSent;
|
|
8424
8461
|
|
|
8425
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8462
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8426
8463
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8427
8464
|
}
|
|
8428
8465
|
|
|
@@ -8447,11 +8484,12 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8447
8484
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8448
8485
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8449
8486
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8487
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8450
8488
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8451
8489
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8452
8490
|
const ON_MESSAGE = 'onMessage';
|
|
8453
|
-
const ON_REINVITE
|
|
8454
|
-
const ON_TRACK
|
|
8491
|
+
const ON_REINVITE = 'reinvite';
|
|
8492
|
+
const ON_TRACK = 'onTrack';
|
|
8455
8493
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8456
8494
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8457
8495
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8466,15 +8504,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8466
8504
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8467
8505
|
const ON_CALL_ERROR = 'onCallError';
|
|
8468
8506
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8469
|
-
const ON_NETWORK_STATS
|
|
8507
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8470
8508
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8471
8509
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8472
|
-
const ON_DISCONNECTED
|
|
8510
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
8473
8511
|
|
|
8474
8512
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8475
8513
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8476
8514
|
|
|
8477
|
-
const events
|
|
8515
|
+
const events = [
|
|
8478
8516
|
ON_USER_AGENT,
|
|
8479
8517
|
ON_REGISTERED,
|
|
8480
8518
|
ON_UNREGISTERED,
|
|
@@ -8491,9 +8529,10 @@ const events$1 = [
|
|
|
8491
8529
|
ON_CAMERA_DISABLED,
|
|
8492
8530
|
ON_CALL_FAILED,
|
|
8493
8531
|
ON_CALL_ENDED,
|
|
8532
|
+
ON_CALL_REJECTED,
|
|
8494
8533
|
ON_MESSAGE,
|
|
8495
|
-
ON_REINVITE
|
|
8496
|
-
ON_TRACK
|
|
8534
|
+
ON_REINVITE,
|
|
8535
|
+
ON_TRACK,
|
|
8497
8536
|
ON_AUDIO_STREAM,
|
|
8498
8537
|
ON_VIDEO_STREAM,
|
|
8499
8538
|
ON_REMOVE_STREAM,
|
|
@@ -8508,11 +8547,11 @@ const events$1 = [
|
|
|
8508
8547
|
ON_CALL_ERROR,
|
|
8509
8548
|
ON_CHAT,
|
|
8510
8549
|
ON_SIGNAL,
|
|
8511
|
-
ON_NETWORK_STATS
|
|
8512
|
-
ON_DISCONNECTED
|
|
8550
|
+
ON_NETWORK_STATS,
|
|
8551
|
+
ON_DISCONNECTED,
|
|
8513
8552
|
];
|
|
8514
8553
|
|
|
8515
|
-
const logger$
|
|
8554
|
+
const logger$8 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8516
8555
|
|
|
8517
8556
|
class WebRTCPhone extends Emitter {
|
|
8518
8557
|
|
|
@@ -8585,7 +8624,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8585
8624
|
}).catch(error => {
|
|
8586
8625
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8587
8626
|
console.error('register error', error, error.message, error.stack);
|
|
8588
|
-
logger$
|
|
8627
|
+
logger$8.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8589
8628
|
});
|
|
8590
8629
|
}
|
|
8591
8630
|
|
|
@@ -8600,7 +8639,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8600
8639
|
if (!this.client) {
|
|
8601
8640
|
return;
|
|
8602
8641
|
}
|
|
8603
|
-
logger$
|
|
8642
|
+
logger$8.info('WebRTC phone stop');
|
|
8604
8643
|
this.client.stop();
|
|
8605
8644
|
}
|
|
8606
8645
|
|
|
@@ -8615,11 +8654,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8615
8654
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8616
8655
|
audioOnly = false, iceRestart = false) {
|
|
8617
8656
|
const sipSession = this.findSipSession(callSession);
|
|
8618
|
-
logger$
|
|
8657
|
+
logger$8.info('WebRTC phone - send reinvite', {
|
|
8619
8658
|
sessionId: sipSession ? sipSession.id : null,
|
|
8620
8659
|
constraints,
|
|
8621
8660
|
audioOnly,
|
|
8622
8661
|
conference,
|
|
8662
|
+
iceRestart,
|
|
8623
8663
|
});
|
|
8624
8664
|
|
|
8625
8665
|
if (!sipSession) {
|
|
@@ -8652,7 +8692,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8652
8692
|
}
|
|
8653
8693
|
|
|
8654
8694
|
startHeartbeat() {
|
|
8655
|
-
logger$
|
|
8695
|
+
logger$8.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8656
8696
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8657
8697
|
return;
|
|
8658
8698
|
}
|
|
@@ -8661,7 +8701,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8661
8701
|
}
|
|
8662
8702
|
|
|
8663
8703
|
stopHeartbeat() {
|
|
8664
|
-
logger$
|
|
8704
|
+
logger$8.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8665
8705
|
if (!this.client) {
|
|
8666
8706
|
return;
|
|
8667
8707
|
}
|
|
@@ -8678,7 +8718,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8678
8718
|
}
|
|
8679
8719
|
|
|
8680
8720
|
reconnect() {
|
|
8681
|
-
logger$
|
|
8721
|
+
logger$8.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8682
8722
|
if (!this.client) {
|
|
8683
8723
|
return;
|
|
8684
8724
|
}
|
|
@@ -8719,7 +8759,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8719
8759
|
return false;
|
|
8720
8760
|
}
|
|
8721
8761
|
|
|
8722
|
-
logger$
|
|
8762
|
+
logger$8.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8723
8763
|
|
|
8724
8764
|
this.client.downgradeToAudio(sipSession);
|
|
8725
8765
|
|
|
@@ -8742,7 +8782,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8742
8782
|
return Promise.resolve(false);
|
|
8743
8783
|
}
|
|
8744
8784
|
|
|
8745
|
-
logger$
|
|
8785
|
+
logger$8.info('Upgrade to video', {
|
|
8746
8786
|
id: callSession ? callSession.getId() : null,
|
|
8747
8787
|
constraints,
|
|
8748
8788
|
isConference,
|
|
@@ -8782,7 +8822,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8782
8822
|
|
|
8783
8823
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
8784
8824
|
const sipSession = this.findSipSession(callSession);
|
|
8785
|
-
logger$
|
|
8825
|
+
logger$8.info('Sending reinvite message', {
|
|
8786
8826
|
id: callSession ? callSession.getId() : null,
|
|
8787
8827
|
isUpgrade,
|
|
8788
8828
|
});
|
|
@@ -8808,7 +8848,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8808
8848
|
// Monkey patch to know when canceled with the CANCEL message
|
|
8809
8849
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
8810
8850
|
sipSession._onCancel = (message ) => {
|
|
8811
|
-
logger$
|
|
8851
|
+
logger$8.trace('on sip session canceled', { callId: message.callId });
|
|
8812
8852
|
|
|
8813
8853
|
onCancel(message);
|
|
8814
8854
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -8836,16 +8876,17 @@ class WebRTCPhone extends Emitter {
|
|
|
8836
8876
|
this.audioOutputVolume,
|
|
8837
8877
|
);
|
|
8838
8878
|
case sessionState.SessionState.Terminating:
|
|
8839
|
-
logger$
|
|
8879
|
+
logger$8.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
8840
8880
|
|
|
8841
8881
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
8842
8882
|
|
|
8843
8883
|
break;
|
|
8844
8884
|
case sessionState.SessionState.Terminated: {
|
|
8845
|
-
logger$
|
|
8885
|
+
logger$8.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
8846
8886
|
|
|
8847
8887
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8848
8888
|
const callSession = this._createCallSession(sipSession);
|
|
8889
|
+
callSession.endTime = new Date();
|
|
8849
8890
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
8850
8891
|
|
|
8851
8892
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -8864,7 +8905,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8864
8905
|
const [stream] = event.streams;
|
|
8865
8906
|
const kind = event && event.track && event.track.kind;
|
|
8866
8907
|
|
|
8867
|
-
logger$
|
|
8908
|
+
logger$8.info('on track stream called on the peer connection', {
|
|
8868
8909
|
callId: this.getSipSessionId(sipSession),
|
|
8869
8910
|
streamId: stream ? stream.id : null,
|
|
8870
8911
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -8884,7 +8925,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8884
8925
|
};
|
|
8885
8926
|
|
|
8886
8927
|
peerConnection.onremovestream = event => {
|
|
8887
|
-
logger$
|
|
8928
|
+
logger$8.info('on remove stream called on the peer connection', {
|
|
8888
8929
|
id: event.stream.id,
|
|
8889
8930
|
tracks: event.stream.getTracks(),
|
|
8890
8931
|
});
|
|
@@ -8894,7 +8935,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8894
8935
|
}
|
|
8895
8936
|
|
|
8896
8937
|
async startScreenSharing(constraints , callSession ) {
|
|
8897
|
-
logger$
|
|
8938
|
+
logger$8.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
8898
8939
|
|
|
8899
8940
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
8900
8941
|
if (!screenShareStream) {
|
|
@@ -8934,7 +8975,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8934
8975
|
return;
|
|
8935
8976
|
}
|
|
8936
8977
|
|
|
8937
|
-
logger$
|
|
8978
|
+
logger$8.info('WebRTC phone - stop screen sharing', {
|
|
8938
8979
|
restoreLocalStream,
|
|
8939
8980
|
});
|
|
8940
8981
|
|
|
@@ -8990,7 +9031,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8990
9031
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
8991
9032
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
8992
9033
|
|
|
8993
|
-
logger$
|
|
9034
|
+
logger$8.info('WebRTC phone - on screensharing', {
|
|
8994
9035
|
hadVideo,
|
|
8995
9036
|
id: this.getSipSessionId(sipSession),
|
|
8996
9037
|
screenTrack,
|
|
@@ -8998,7 +9039,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8998
9039
|
|
|
8999
9040
|
if (screenTrack) {
|
|
9000
9041
|
screenTrack.onended = () => {
|
|
9001
|
-
logger$
|
|
9042
|
+
logger$8.info('WebRTC phone - on screenshare ended', {
|
|
9002
9043
|
hadVideo,
|
|
9003
9044
|
id: this.getSipSessionId(sipSession),
|
|
9004
9045
|
screenTrack,
|
|
@@ -9029,7 +9070,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9029
9070
|
}
|
|
9030
9071
|
|
|
9031
9072
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9032
|
-
logger$
|
|
9073
|
+
logger$8.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9033
9074
|
|
|
9034
9075
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9035
9076
|
this.currentSipSession = sipSession;
|
|
@@ -9047,7 +9088,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9047
9088
|
}
|
|
9048
9089
|
|
|
9049
9090
|
changeAudioDevice(id ) {
|
|
9050
|
-
logger$
|
|
9091
|
+
logger$8.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9051
9092
|
this.audioOutputDeviceId = id;
|
|
9052
9093
|
this.client.changeAudioOutputDevice(id);
|
|
9053
9094
|
}
|
|
@@ -9057,14 +9098,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9057
9098
|
}
|
|
9058
9099
|
|
|
9059
9100
|
changeRingDevice(id ) {
|
|
9060
|
-
logger$
|
|
9101
|
+
logger$8.info('WebRTC phone - changing ring device', { id });
|
|
9061
9102
|
|
|
9062
9103
|
this.audioRingDeviceId = id;
|
|
9063
9104
|
}
|
|
9064
9105
|
|
|
9065
9106
|
// volume is a value between 0 and 1
|
|
9066
9107
|
changeAudioVolume(volume ) {
|
|
9067
|
-
logger$
|
|
9108
|
+
logger$8.info('WebRTC phone - changing audio volume', { volume });
|
|
9068
9109
|
|
|
9069
9110
|
this.audioOutputVolume = volume;
|
|
9070
9111
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9072,32 +9113,33 @@ class WebRTCPhone extends Emitter {
|
|
|
9072
9113
|
|
|
9073
9114
|
// volume is a value between 0 and 1
|
|
9074
9115
|
changeRingVolume(volume ) {
|
|
9075
|
-
logger$
|
|
9116
|
+
logger$8.info('WebRTC phone - changing ring volume', { volume });
|
|
9076
9117
|
|
|
9077
9118
|
this.audioRingVolume = volume;
|
|
9078
9119
|
}
|
|
9079
9120
|
|
|
9080
9121
|
changeAudioInputDevice(id ) {
|
|
9081
|
-
logger$
|
|
9122
|
+
logger$8.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9082
9123
|
|
|
9083
9124
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9084
9125
|
}
|
|
9085
9126
|
|
|
9086
9127
|
changeVideoInputDevice(id ) {
|
|
9087
|
-
logger$
|
|
9128
|
+
logger$8.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9088
9129
|
|
|
9089
9130
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9090
9131
|
}
|
|
9091
9132
|
|
|
9092
9133
|
changeSessionVideoInputDevice(id ) {
|
|
9093
|
-
logger$
|
|
9134
|
+
logger$8.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9094
9135
|
|
|
9095
9136
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9096
9137
|
}
|
|
9097
9138
|
|
|
9098
9139
|
_onCallTerminated(sipSession ) {
|
|
9099
|
-
logger$
|
|
9140
|
+
logger$8.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9100
9141
|
|
|
9142
|
+
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9101
9143
|
const callSession = this._createCallSession(sipSession);
|
|
9102
9144
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
9103
9145
|
const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
|
|
@@ -9115,7 +9157,6 @@ class WebRTCPhone extends Emitter {
|
|
|
9115
9157
|
}, 5);
|
|
9116
9158
|
}
|
|
9117
9159
|
|
|
9118
|
-
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9119
9160
|
if (sipSessionId) {
|
|
9120
9161
|
this.removeIncomingSessions(sipSessionId);
|
|
9121
9162
|
}
|
|
@@ -9130,7 +9171,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9130
9171
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9131
9172
|
|
|
9132
9173
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9133
|
-
logger$
|
|
9174
|
+
logger$8.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9134
9175
|
sipId: sipSession.id,
|
|
9135
9176
|
shouldRetrigger,
|
|
9136
9177
|
hasIncomingCallSession,
|
|
@@ -9221,37 +9262,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9221
9262
|
|
|
9222
9263
|
// Deprecated
|
|
9223
9264
|
getLocalStreamForCall(callSession ) {
|
|
9224
|
-
logger$
|
|
9265
|
+
logger$8.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9225
9266
|
|
|
9226
9267
|
return this.getLocalStream(callSession);
|
|
9227
9268
|
}
|
|
9228
9269
|
|
|
9229
9270
|
// Deprecated
|
|
9230
9271
|
getRemoteStreamForCall(callSession ) {
|
|
9231
|
-
logger$
|
|
9272
|
+
logger$8.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9232
9273
|
|
|
9233
9274
|
return this.getRemoteVideoStream(callSession);
|
|
9234
9275
|
}
|
|
9235
9276
|
|
|
9236
9277
|
getRemoteStreamsForCall(callSession ) {
|
|
9237
|
-
logger$
|
|
9278
|
+
logger$8.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9238
9279
|
|
|
9239
9280
|
return this.getRemoteStream(callSession);
|
|
9240
9281
|
}
|
|
9241
9282
|
|
|
9242
9283
|
accept(callSession , cameraEnabled ) {
|
|
9243
|
-
logger$
|
|
9284
|
+
logger$8.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9244
9285
|
if (this.currentSipSession) {
|
|
9245
9286
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9246
9287
|
}
|
|
9247
9288
|
|
|
9248
9289
|
if (!callSession) {
|
|
9249
|
-
logger$
|
|
9290
|
+
logger$8.warn('no CallSession to accept.');
|
|
9250
9291
|
return Promise.resolve(null);
|
|
9251
9292
|
}
|
|
9252
9293
|
|
|
9253
9294
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9254
|
-
logger$
|
|
9295
|
+
logger$8.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9255
9296
|
return Promise.resolve(callSession.sipCallId);
|
|
9256
9297
|
}
|
|
9257
9298
|
|
|
@@ -9263,24 +9304,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9263
9304
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9264
9305
|
if (sipSession) {
|
|
9265
9306
|
if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
|
|
9266
|
-
logger$
|
|
9307
|
+
logger$8.warn('Trying to answer a terminated sipSession.');
|
|
9267
9308
|
|
|
9268
9309
|
return Promise.resolve(null);
|
|
9269
9310
|
}
|
|
9270
9311
|
|
|
9271
|
-
logger$
|
|
9312
|
+
logger$8.info('accept call, session found', { sipId: sipSession.id });
|
|
9272
9313
|
|
|
9273
9314
|
// $FlowFixMe
|
|
9274
9315
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9275
9316
|
return callSession.sipCallId;
|
|
9276
9317
|
}).catch(e => {
|
|
9277
|
-
logger$
|
|
9318
|
+
logger$8.error(e);
|
|
9278
9319
|
this.endCurrentCall(callSession);
|
|
9279
9320
|
throw e;
|
|
9280
9321
|
});
|
|
9281
9322
|
}
|
|
9282
9323
|
|
|
9283
|
-
logger$
|
|
9324
|
+
logger$8.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9284
9325
|
|
|
9285
9326
|
return Promise.resolve(null);
|
|
9286
9327
|
}
|
|
@@ -9290,7 +9331,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9290
9331
|
}
|
|
9291
9332
|
|
|
9292
9333
|
async reject(callSession ) {
|
|
9293
|
-
logger$
|
|
9334
|
+
logger$8.info('reject WebRTC called', { id: callSession.getId() });
|
|
9294
9335
|
|
|
9295
9336
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9296
9337
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9302,14 +9343,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9302
9343
|
|
|
9303
9344
|
const sipSession = this.findSipSession(callSession);
|
|
9304
9345
|
if (sipSession) {
|
|
9305
|
-
logger$
|
|
9346
|
+
logger$8.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9306
9347
|
|
|
9307
9348
|
this.client.hangup(sipSession);
|
|
9308
9349
|
}
|
|
9309
9350
|
}
|
|
9310
9351
|
|
|
9311
9352
|
async ignore(callSession ) {
|
|
9312
|
-
logger$
|
|
9353
|
+
logger$8.info('WebRTC ignore', { id: callSession.getId() });
|
|
9313
9354
|
|
|
9314
9355
|
// kill the ring
|
|
9315
9356
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9321,14 +9362,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9321
9362
|
const sipSession = this.findSipSession(callSession);
|
|
9322
9363
|
|
|
9323
9364
|
if (sipSession) {
|
|
9324
|
-
logger$
|
|
9365
|
+
logger$8.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9325
9366
|
|
|
9326
9367
|
return this.client.atxfer(sipSession);
|
|
9327
9368
|
}
|
|
9328
9369
|
}
|
|
9329
9370
|
|
|
9330
9371
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9331
|
-
logger$
|
|
9372
|
+
logger$8.info('WebRTC hold', { id: callSession.getId() });
|
|
9332
9373
|
|
|
9333
9374
|
const sipSession = this.findSipSession(callSession);
|
|
9334
9375
|
|
|
@@ -9343,18 +9384,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9343
9384
|
}
|
|
9344
9385
|
|
|
9345
9386
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9346
|
-
logger$
|
|
9387
|
+
logger$8.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9347
9388
|
|
|
9348
9389
|
const sipSession = this.findSipSession(callSession);
|
|
9349
9390
|
if (!sipSession) {
|
|
9350
9391
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9351
9392
|
}
|
|
9352
9393
|
|
|
9353
|
-
logger$
|
|
9394
|
+
logger$8.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9354
9395
|
|
|
9355
9396
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9356
9397
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9357
|
-
logger$
|
|
9398
|
+
logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9358
9399
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9359
9400
|
}
|
|
9360
9401
|
|
|
@@ -9379,7 +9420,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9379
9420
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9380
9421
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9381
9422
|
|
|
9382
|
-
logger$
|
|
9423
|
+
logger$8.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9383
9424
|
|
|
9384
9425
|
// Stop screenshre if needed
|
|
9385
9426
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9410,7 +9451,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9410
9451
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9411
9452
|
}
|
|
9412
9453
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9413
|
-
logger$
|
|
9454
|
+
logger$8.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9414
9455
|
|
|
9415
9456
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9416
9457
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9454,14 +9495,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9454
9495
|
}
|
|
9455
9496
|
|
|
9456
9497
|
mute(callSession , withEvent = true) {
|
|
9457
|
-
logger$
|
|
9498
|
+
logger$8.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9458
9499
|
|
|
9459
9500
|
const sipSession = this.findSipSession(callSession);
|
|
9460
9501
|
if (!sipSession) {
|
|
9461
9502
|
return;
|
|
9462
9503
|
}
|
|
9463
9504
|
|
|
9464
|
-
logger$
|
|
9505
|
+
logger$8.info('WebRTC muting', { sipId: sipSession.id });
|
|
9465
9506
|
this.client.mute(sipSession);
|
|
9466
9507
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9467
9508
|
|
|
@@ -9475,14 +9516,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9475
9516
|
}
|
|
9476
9517
|
|
|
9477
9518
|
unmute(callSession , withEvent = true) {
|
|
9478
|
-
logger$
|
|
9519
|
+
logger$8.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9479
9520
|
|
|
9480
9521
|
const sipSession = this.findSipSession(callSession);
|
|
9481
9522
|
if (!sipSession) {
|
|
9482
9523
|
return;
|
|
9483
9524
|
}
|
|
9484
9525
|
|
|
9485
|
-
logger$
|
|
9526
|
+
logger$8.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9486
9527
|
this.client.unmute(sipSession);
|
|
9487
9528
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9488
9529
|
|
|
@@ -9509,7 +9550,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9509
9550
|
if (!sipSession) {
|
|
9510
9551
|
return;
|
|
9511
9552
|
}
|
|
9512
|
-
logger$
|
|
9553
|
+
logger$8.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9513
9554
|
|
|
9514
9555
|
this.client.toggleCameraOn(sipSession);
|
|
9515
9556
|
|
|
@@ -9521,7 +9562,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9521
9562
|
if (!sipSession) {
|
|
9522
9563
|
return;
|
|
9523
9564
|
}
|
|
9524
|
-
logger$
|
|
9565
|
+
logger$8.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9525
9566
|
|
|
9526
9567
|
this.client.toggleCameraOff(sipSession);
|
|
9527
9568
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9533,7 +9574,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9533
9574
|
return;
|
|
9534
9575
|
}
|
|
9535
9576
|
|
|
9536
|
-
logger$
|
|
9577
|
+
logger$8.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9537
9578
|
this.client.sendDTMF(sipSession, tone);
|
|
9538
9579
|
}
|
|
9539
9580
|
|
|
@@ -9541,7 +9582,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9541
9582
|
// @TODO: line is not used here
|
|
9542
9583
|
async makeCall(number , line , cameraEnabled ,
|
|
9543
9584
|
audioOnly = false, conference = false) {
|
|
9544
|
-
logger$
|
|
9585
|
+
logger$8.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
9545
9586
|
if (!number) {
|
|
9546
9587
|
return Promise.resolve(null);
|
|
9547
9588
|
}
|
|
@@ -9551,7 +9592,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9551
9592
|
}
|
|
9552
9593
|
if (this.currentSipSession) {
|
|
9553
9594
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9554
|
-
logger$
|
|
9595
|
+
logger$8.warn('Unable to hold current session when making another call', e);
|
|
9555
9596
|
});
|
|
9556
9597
|
}
|
|
9557
9598
|
|
|
@@ -9561,10 +9602,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9561
9602
|
this._bindEvents(sipSession);
|
|
9562
9603
|
} catch (error) {
|
|
9563
9604
|
console.warn(error);
|
|
9564
|
-
logger$
|
|
9605
|
+
logger$8.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9565
9606
|
return Promise.resolve(null);
|
|
9566
9607
|
}
|
|
9567
9608
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9609
|
+
callSession.creationTime = new Date();
|
|
9568
9610
|
|
|
9569
9611
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9570
9612
|
|
|
@@ -9589,7 +9631,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9589
9631
|
return;
|
|
9590
9632
|
}
|
|
9591
9633
|
|
|
9592
|
-
logger$
|
|
9634
|
+
logger$8.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9593
9635
|
|
|
9594
9636
|
this.client.transfer(sipSession, target);
|
|
9595
9637
|
}
|
|
@@ -9598,7 +9640,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9598
9640
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9599
9641
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9600
9642
|
|
|
9601
|
-
logger$
|
|
9643
|
+
logger$8.info('WebRTC indirect transfer', {
|
|
9602
9644
|
sipId: sipSession ? sipSession.id : null,
|
|
9603
9645
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9604
9646
|
});
|
|
@@ -9637,7 +9679,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9637
9679
|
return false;
|
|
9638
9680
|
}
|
|
9639
9681
|
|
|
9640
|
-
logger$
|
|
9682
|
+
logger$8.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9641
9683
|
|
|
9642
9684
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9643
9685
|
|
|
@@ -9683,7 +9725,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9683
9725
|
endCurrentCall(callSession ) {
|
|
9684
9726
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9685
9727
|
|
|
9686
|
-
logger$
|
|
9728
|
+
logger$8.info('Ending current call', {
|
|
9687
9729
|
id: callSession ? callSession.getId() : null,
|
|
9688
9730
|
isCurrent,
|
|
9689
9731
|
});
|
|
@@ -9707,7 +9749,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9707
9749
|
}
|
|
9708
9750
|
|
|
9709
9751
|
async close() {
|
|
9710
|
-
logger$
|
|
9752
|
+
logger$8.info('WebRTC close');
|
|
9711
9753
|
|
|
9712
9754
|
try {
|
|
9713
9755
|
await Promise.race([
|
|
@@ -9715,7 +9757,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9715
9757
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9716
9758
|
]);
|
|
9717
9759
|
} catch (e) {
|
|
9718
|
-
logger$
|
|
9760
|
+
logger$8.error('WebRTC close, unregister error', e);
|
|
9719
9761
|
}
|
|
9720
9762
|
|
|
9721
9763
|
this.client.close();
|
|
@@ -9733,12 +9775,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9733
9775
|
}
|
|
9734
9776
|
|
|
9735
9777
|
enableRinging() {
|
|
9736
|
-
logger$
|
|
9778
|
+
logger$8.info('WebRTC enable ringing');
|
|
9737
9779
|
this.ringingEnabled = true;
|
|
9738
9780
|
}
|
|
9739
9781
|
|
|
9740
9782
|
disableRinging() {
|
|
9741
|
-
logger$
|
|
9783
|
+
logger$8.info('WebRTC disable ringing');
|
|
9742
9784
|
this.ringingEnabled = false;
|
|
9743
9785
|
}
|
|
9744
9786
|
|
|
@@ -9760,8 +9802,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9760
9802
|
}
|
|
9761
9803
|
|
|
9762
9804
|
const sessionId = this.incomingSessions[0];
|
|
9805
|
+
const sipSession = this.client.getSipSession(sessionId);
|
|
9806
|
+
if (!sipSession) {
|
|
9807
|
+
return null;
|
|
9808
|
+
}
|
|
9763
9809
|
|
|
9764
|
-
return this._createCallSession(
|
|
9810
|
+
return this._createCallSession(sipSession);
|
|
9765
9811
|
}
|
|
9766
9812
|
|
|
9767
9813
|
sendMessage(sipSession = null, body , contentType = 'text/plain') {
|
|
@@ -9778,7 +9824,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9778
9824
|
|
|
9779
9825
|
// Deprecated
|
|
9780
9826
|
getLocalMediaStream(callSession ) {
|
|
9781
|
-
logger$
|
|
9827
|
+
logger$8.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9782
9828
|
return this.getLocalStream(callSession);
|
|
9783
9829
|
}
|
|
9784
9830
|
|
|
@@ -9820,7 +9866,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9820
9866
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
9821
9867
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
9822
9868
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
9823
|
-
logger$
|
|
9869
|
+
logger$8.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
9824
9870
|
|
|
9825
9871
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
9826
9872
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -9839,11 +9885,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9839
9885
|
callSession);
|
|
9840
9886
|
}
|
|
9841
9887
|
|
|
9888
|
+
callSession.creationTime = new Date();
|
|
9842
9889
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
9843
9890
|
});
|
|
9844
9891
|
|
|
9845
9892
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
9846
|
-
logger$
|
|
9893
|
+
logger$8.info('WebRTC on reinvite', {
|
|
9847
9894
|
sessionId: args[0].id,
|
|
9848
9895
|
inviteId: args[1].id,
|
|
9849
9896
|
updatedCalleeName: args[2],
|
|
@@ -9863,7 +9910,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9863
9910
|
});
|
|
9864
9911
|
|
|
9865
9912
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
9866
|
-
logger$
|
|
9913
|
+
logger$8.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
9867
9914
|
|
|
9868
9915
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
9869
9916
|
|
|
@@ -9874,22 +9921,29 @@ class WebRTCPhone extends Emitter {
|
|
|
9874
9921
|
this.client.on('ended', () => {});
|
|
9875
9922
|
|
|
9876
9923
|
this.client.on(this.client.ON_ERROR, e => {
|
|
9877
|
-
logger$
|
|
9924
|
+
logger$8.error('WebRTC error', e);
|
|
9878
9925
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
9879
9926
|
});
|
|
9880
9927
|
|
|
9928
|
+
this.client.on(this.client.REJECTED, session => {
|
|
9929
|
+
logger$8.info('WebRTC call rejected', session.id);
|
|
9930
|
+
const callSession = this._createCallSession(session);
|
|
9931
|
+
callSession.endTime = new Date();
|
|
9932
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
9933
|
+
});
|
|
9934
|
+
|
|
9881
9935
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
9882
|
-
logger$
|
|
9936
|
+
logger$8.info('WebRTC unregistered');
|
|
9883
9937
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
9884
9938
|
});
|
|
9885
9939
|
|
|
9886
9940
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
9887
|
-
logger$
|
|
9888
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
9941
|
+
logger$8.info('WebRTC disconnected');
|
|
9942
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
9889
9943
|
});
|
|
9890
9944
|
|
|
9891
9945
|
this.client.on(this.client.REGISTERED, () => {
|
|
9892
|
-
logger$
|
|
9946
|
+
logger$8.info('WebRTC registered', {
|
|
9893
9947
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
9894
9948
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
9895
9949
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -9910,19 +9964,19 @@ class WebRTCPhone extends Emitter {
|
|
|
9910
9964
|
// Send reinvite with iceRestart
|
|
9911
9965
|
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
9912
9966
|
} catch (e) {
|
|
9913
|
-
logger$
|
|
9967
|
+
logger$8.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
9914
9968
|
}
|
|
9915
9969
|
}
|
|
9916
9970
|
});
|
|
9917
9971
|
|
|
9918
9972
|
this.client.on(this.client.CONNECTED, () => {
|
|
9919
|
-
logger$
|
|
9973
|
+
logger$8.info('WebRTC client connected');
|
|
9920
9974
|
|
|
9921
9975
|
this.stopHeartbeat();
|
|
9922
9976
|
});
|
|
9923
9977
|
|
|
9924
9978
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
9925
|
-
logger$
|
|
9979
|
+
logger$8.info('WebRTC client disconnected');
|
|
9926
9980
|
|
|
9927
9981
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
9928
9982
|
|
|
@@ -9936,7 +9990,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9936
9990
|
});
|
|
9937
9991
|
|
|
9938
9992
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
9939
|
-
this.eventEmitter.emit(ON_TRACK
|
|
9993
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
9940
9994
|
});
|
|
9941
9995
|
|
|
9942
9996
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -9951,7 +10005,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9951
10005
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
9952
10006
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
9953
10007
|
|
|
9954
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
10008
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
9955
10009
|
});
|
|
9956
10010
|
|
|
9957
10011
|
// Used when upgrading directly in screenshare mode
|
|
@@ -9960,7 +10014,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9960
10014
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
9961
10015
|
const callSession = this.callSessions[sipSessionId];
|
|
9962
10016
|
|
|
9963
|
-
logger$
|
|
10017
|
+
logger$8.info('Updrading directly in screensharing mode', {
|
|
9964
10018
|
sipSessionId,
|
|
9965
10019
|
tracks: localStream ? localStream.getTracks() : null,
|
|
9966
10020
|
});
|
|
@@ -10090,6 +10144,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10090
10144
|
const number = identity ? identity.uri._normal.user : null;
|
|
10091
10145
|
const { state } = sipSession || {};
|
|
10092
10146
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10147
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10093
10148
|
|
|
10094
10149
|
const callSession = new CallSession({
|
|
10095
10150
|
callId: fromSession && fromSession.callId,
|
|
@@ -10097,6 +10152,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10097
10152
|
sipStatus: state,
|
|
10098
10153
|
displayName: identity ? identity.displayName || number : number,
|
|
10099
10154
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10155
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10156
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10100
10157
|
answered: state === sessionState.SessionState.Established,
|
|
10101
10158
|
paused: this.client.isCallHeld(sipSession),
|
|
10102
10159
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10107,6 +10164,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10107
10164
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10108
10165
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10109
10166
|
recordingPaused: false, // @TODO
|
|
10167
|
+
sipSession,
|
|
10110
10168
|
...extra,
|
|
10111
10169
|
});
|
|
10112
10170
|
|
|
@@ -10135,11 +10193,12 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10135
10193
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10136
10194
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10137
10195
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10196
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10138
10197
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10139
10198
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10140
10199
|
ON_MESSAGE: ON_MESSAGE,
|
|
10141
|
-
ON_REINVITE: ON_REINVITE
|
|
10142
|
-
ON_TRACK: ON_TRACK
|
|
10200
|
+
ON_REINVITE: ON_REINVITE,
|
|
10201
|
+
ON_TRACK: ON_TRACK,
|
|
10143
10202
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10144
10203
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10145
10204
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10154,13 +10213,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10154
10213
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10155
10214
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10156
10215
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10157
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS
|
|
10216
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10158
10217
|
ON_CHAT: ON_CHAT,
|
|
10159
10218
|
ON_SIGNAL: ON_SIGNAL,
|
|
10160
|
-
ON_DISCONNECTED: ON_DISCONNECTED
|
|
10219
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10161
10220
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10162
10221
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10163
|
-
events: events
|
|
10222
|
+
events: events,
|
|
10164
10223
|
'default': WebRTCPhone
|
|
10165
10224
|
});
|
|
10166
10225
|
|
|
@@ -10169,7 +10228,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10169
10228
|
class InvalidSubscription extends Error {}
|
|
10170
10229
|
class InvalidAuthorization extends Error {}
|
|
10171
10230
|
|
|
10172
|
-
const logger$
|
|
10231
|
+
const logger$7 = IssueReporter$1.loggerFor('simple-auth');
|
|
10173
10232
|
|
|
10174
10233
|
class Auth {
|
|
10175
10234
|
|
|
@@ -10204,7 +10263,7 @@ class Auth {
|
|
|
10204
10263
|
setApiClientId(this.clientId);
|
|
10205
10264
|
setRefreshExpiration(this.expiration);
|
|
10206
10265
|
setOnRefreshToken((token , session ) => {
|
|
10207
|
-
logger$
|
|
10266
|
+
logger$7.info('on refresh token done', { token });
|
|
10208
10267
|
setApiToken(token);
|
|
10209
10268
|
Wazo.Websocket.updateToken(token);
|
|
10210
10269
|
|
|
@@ -10249,7 +10308,7 @@ class Auth {
|
|
|
10249
10308
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
10250
10309
|
return this._onAuthenticated(rawSession);
|
|
10251
10310
|
} catch (e) {
|
|
10252
|
-
logger$
|
|
10311
|
+
logger$7.error('on validate token error', e);
|
|
10253
10312
|
console.warn(e);
|
|
10254
10313
|
return false;
|
|
10255
10314
|
}
|
|
@@ -10430,7 +10489,7 @@ var Auth$1 = global.wazoAuthInstance;
|
|
|
10430
10489
|
|
|
10431
10490
|
//
|
|
10432
10491
|
|
|
10433
|
-
const SOCKET_EVENTS = {
|
|
10492
|
+
const SOCKET_EVENTS$1 = {
|
|
10434
10493
|
ON_OPEN: 'onopen',
|
|
10435
10494
|
ON_MESSAGE: 'onmessage',
|
|
10436
10495
|
ON_ERROR: 'onerror',
|
|
@@ -10583,16 +10642,16 @@ class WebSocketClient extends Emitter {
|
|
|
10583
10642
|
|
|
10584
10643
|
this.socket.onopen = () => {
|
|
10585
10644
|
logger$6.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
10586
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
10645
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
|
|
10587
10646
|
};
|
|
10588
10647
|
|
|
10589
10648
|
this.socket.onerror = event => {
|
|
10590
10649
|
logger$6.error('on Wazo WS error', event.target);
|
|
10591
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
10650
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
|
|
10592
10651
|
};
|
|
10593
10652
|
|
|
10594
10653
|
this.socket.onmessage = (event ) => {
|
|
10595
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
10654
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
|
|
10596
10655
|
|
|
10597
10656
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
10598
10657
|
let { name } = message;
|
|
@@ -10625,11 +10684,11 @@ class WebSocketClient extends Emitter {
|
|
|
10625
10684
|
token: this.token,
|
|
10626
10685
|
});
|
|
10627
10686
|
this.initialized = false;
|
|
10628
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
10687
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
|
|
10629
10688
|
|
|
10630
10689
|
switch (event.code) {
|
|
10631
10690
|
case 4002:
|
|
10632
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
10691
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
|
|
10633
10692
|
break;
|
|
10634
10693
|
}
|
|
10635
10694
|
};
|
|
@@ -10745,7 +10804,7 @@ class WebSocketClient extends Emitter {
|
|
|
10745
10804
|
break;
|
|
10746
10805
|
case 'start':
|
|
10747
10806
|
this.initialized = true;
|
|
10748
|
-
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
10807
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
|
|
10749
10808
|
break;
|
|
10750
10809
|
default:
|
|
10751
10810
|
this.eventEmitter.emit('message', message);
|
|
@@ -10792,7 +10851,7 @@ class WebSocketClient extends Emitter {
|
|
|
10792
10851
|
logger$6.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
10793
10852
|
|
|
10794
10853
|
this.close();
|
|
10795
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
10854
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
10796
10855
|
|
|
10797
10856
|
if (this.onHeartBeatTimeout) {
|
|
10798
10857
|
this.onHeartBeatTimeout();
|
|
@@ -10872,7 +10931,7 @@ WebSocketClient.eventLists = [
|
|
|
10872
10931
|
|
|
10873
10932
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
10874
10933
|
__proto__: null,
|
|
10875
|
-
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
10934
|
+
SOCKET_EVENTS: SOCKET_EVENTS$1,
|
|
10876
10935
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
10877
10936
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
10878
10937
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -10945,10 +11004,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
10945
11004
|
|
|
10946
11005
|
//
|
|
10947
11006
|
|
|
10948
|
-
const { SOCKET_EVENTS
|
|
10949
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS
|
|
11007
|
+
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11008
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
10950
11009
|
|
|
10951
|
-
const logger$
|
|
11010
|
+
const logger$5 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
10952
11011
|
|
|
10953
11012
|
class Websocket extends Emitter {
|
|
10954
11013
|
|
|
@@ -10962,9 +11021,9 @@ class Websocket extends Emitter {
|
|
|
10962
11021
|
// $FlowFixMe
|
|
10963
11022
|
this[key] = OTHER_EVENTS[key];
|
|
10964
11023
|
});
|
|
10965
|
-
Object.keys(SOCKET_EVENTS
|
|
11024
|
+
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
10966
11025
|
// $FlowFixMe
|
|
10967
|
-
this[key] = SOCKET_EVENTS
|
|
11026
|
+
this[key] = SOCKET_EVENTS[key];
|
|
10968
11027
|
});
|
|
10969
11028
|
this.eventLists = WebSocketClient.eventLists;
|
|
10970
11029
|
|
|
@@ -10972,7 +11031,7 @@ class Websocket extends Emitter {
|
|
|
10972
11031
|
}
|
|
10973
11032
|
|
|
10974
11033
|
open(host , session ) {
|
|
10975
|
-
logger$
|
|
11034
|
+
logger$5.info('open simple WebSocket', { host, token: session.token });
|
|
10976
11035
|
this.ws = new WebSocketClient(
|
|
10977
11036
|
{
|
|
10978
11037
|
host,
|
|
@@ -11000,7 +11059,7 @@ class Websocket extends Emitter {
|
|
|
11000
11059
|
}
|
|
11001
11060
|
|
|
11002
11061
|
updateToken(token ) {
|
|
11003
|
-
logger$
|
|
11062
|
+
logger$5.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
11004
11063
|
|
|
11005
11064
|
if (!this.ws) {
|
|
11006
11065
|
return;
|
|
@@ -11028,7 +11087,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11028
11087
|
|
|
11029
11088
|
//
|
|
11030
11089
|
|
|
11031
|
-
const logger$
|
|
11090
|
+
const logger$4 = IssueReporter$1.loggerFor('room');
|
|
11032
11091
|
|
|
11033
11092
|
class Participant extends Emitter {
|
|
11034
11093
|
|
|
@@ -11150,7 +11209,7 @@ class Participant extends Emitter {
|
|
|
11150
11209
|
}
|
|
11151
11210
|
|
|
11152
11211
|
onTalking(isTalking ) {
|
|
11153
|
-
logger$
|
|
11212
|
+
logger$4.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
11154
11213
|
this.isTalking = isTalking;
|
|
11155
11214
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
11156
11215
|
// directly from asterisk, there's no need to do so
|
|
@@ -11253,7 +11312,7 @@ class Participant extends Emitter {
|
|
|
11253
11312
|
}
|
|
11254
11313
|
|
|
11255
11314
|
updateStatus(status , broadcast = true) {
|
|
11256
|
-
logger$
|
|
11315
|
+
logger$4.info('updating participant status', { name: this.name, status });
|
|
11257
11316
|
|
|
11258
11317
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
11259
11318
|
if (status.audioMuted) {
|
|
@@ -11301,7 +11360,7 @@ class Participant extends Emitter {
|
|
|
11301
11360
|
|
|
11302
11361
|
broadcastStatus(inboundStatus = null) {
|
|
11303
11362
|
const status = inboundStatus || this.getStatus();
|
|
11304
|
-
logger$
|
|
11363
|
+
logger$4.info('broadcasting participant status', { callId: this.callId, status });
|
|
11305
11364
|
|
|
11306
11365
|
this.room.sendSignal({
|
|
11307
11366
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|
|
@@ -11337,9 +11396,9 @@ class LocalParticipant extends Participant {
|
|
|
11337
11396
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
11338
11397
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
11339
11398
|
|
|
11340
|
-
const logger$
|
|
11399
|
+
const logger$3 = IssueReporter$1.loggerFor('sdk-room');
|
|
11341
11400
|
|
|
11342
|
-
class Room extends Emitter {
|
|
11401
|
+
class Room$1 extends Emitter {
|
|
11343
11402
|
|
|
11344
11403
|
|
|
11345
11404
|
|
|
@@ -11397,7 +11456,7 @@ class Room extends Emitter {
|
|
|
11397
11456
|
extra = {},
|
|
11398
11457
|
) {
|
|
11399
11458
|
super();
|
|
11400
|
-
logger$
|
|
11459
|
+
logger$3.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
11401
11460
|
|
|
11402
11461
|
// Represents the room callSession
|
|
11403
11462
|
this.callSession = callSession;
|
|
@@ -11463,7 +11522,7 @@ class Room extends Emitter {
|
|
|
11463
11522
|
* @returns {Promise<Room>}
|
|
11464
11523
|
*/
|
|
11465
11524
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
11466
|
-
logger$
|
|
11525
|
+
logger$3.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
11467
11526
|
|
|
11468
11527
|
if (!room) {
|
|
11469
11528
|
await Wazo.Phone.connect();
|
|
@@ -11476,7 +11535,7 @@ class Room extends Emitter {
|
|
|
11476
11535
|
|
|
11477
11536
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
11478
11537
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
11479
|
-
logger$
|
|
11538
|
+
logger$3.info('room call received via WS', { callId: data.call_id });
|
|
11480
11539
|
if (room) {
|
|
11481
11540
|
room.setCallId(data.call_id);
|
|
11482
11541
|
}
|
|
@@ -11484,7 +11543,7 @@ class Room extends Emitter {
|
|
|
11484
11543
|
|
|
11485
11544
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
11486
11545
|
// eslint-disable-next-line no-param-reassign
|
|
11487
|
-
room = new Room(callSession, extension, null, null, extra);
|
|
11546
|
+
room = new Room$1(callSession, extension, null, null, extra);
|
|
11488
11547
|
|
|
11489
11548
|
// Wait for the call to be accepted
|
|
11490
11549
|
await new Promise((resolve, reject) => {
|
|
@@ -11505,7 +11564,7 @@ class Room extends Emitter {
|
|
|
11505
11564
|
// Retrieve conference
|
|
11506
11565
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
11507
11566
|
|
|
11508
|
-
logger$
|
|
11567
|
+
logger$3.info('connected to room', {
|
|
11509
11568
|
sourceId: conference ? conference.sourceId : null,
|
|
11510
11569
|
name: conference ? conference.name : null,
|
|
11511
11570
|
});
|
|
@@ -11515,7 +11574,7 @@ class Room extends Emitter {
|
|
|
11515
11574
|
room.setName(conference.name);
|
|
11516
11575
|
}
|
|
11517
11576
|
} else if (meeting) {
|
|
11518
|
-
logger$
|
|
11577
|
+
logger$3.info('Already connected to meeting', {
|
|
11519
11578
|
uuid: meeting.uuid,
|
|
11520
11579
|
name: meeting.name,
|
|
11521
11580
|
});
|
|
@@ -11528,13 +11587,13 @@ class Room extends Emitter {
|
|
|
11528
11587
|
}
|
|
11529
11588
|
|
|
11530
11589
|
static disconnect() {
|
|
11531
|
-
logger$
|
|
11590
|
+
logger$3.info('static disconnection to room');
|
|
11532
11591
|
|
|
11533
11592
|
Wazo.Phone.disconnect();
|
|
11534
11593
|
}
|
|
11535
11594
|
|
|
11536
11595
|
async disconnect() {
|
|
11537
|
-
logger$
|
|
11596
|
+
logger$3.info('disconnection to room called');
|
|
11538
11597
|
|
|
11539
11598
|
await Wazo.Phone.hangup(this.callSession);
|
|
11540
11599
|
this.callSession = null;
|
|
@@ -11554,19 +11613,19 @@ class Room extends Emitter {
|
|
|
11554
11613
|
}
|
|
11555
11614
|
|
|
11556
11615
|
setSourceId(sourceId ) {
|
|
11557
|
-
logger$
|
|
11616
|
+
logger$3.info('set room source id', { sourceId });
|
|
11558
11617
|
|
|
11559
11618
|
this.sourceId = sourceId;
|
|
11560
11619
|
}
|
|
11561
11620
|
|
|
11562
11621
|
setMeetingUuid(meetingUuid ) {
|
|
11563
|
-
logger$
|
|
11622
|
+
logger$3.info('set meeting uuid', { meetingUuid });
|
|
11564
11623
|
|
|
11565
11624
|
this.meetingUuid = meetingUuid;
|
|
11566
11625
|
}
|
|
11567
11626
|
|
|
11568
11627
|
setCallId(callId ) {
|
|
11569
|
-
logger$
|
|
11628
|
+
logger$3.info('set room call id', { callId });
|
|
11570
11629
|
|
|
11571
11630
|
if (callId) {
|
|
11572
11631
|
this.callId = callId;
|
|
@@ -11574,7 +11633,7 @@ class Room extends Emitter {
|
|
|
11574
11633
|
}
|
|
11575
11634
|
|
|
11576
11635
|
setName(name ) {
|
|
11577
|
-
logger$
|
|
11636
|
+
logger$3.info('set room name', { name });
|
|
11578
11637
|
|
|
11579
11638
|
this.name = name;
|
|
11580
11639
|
}
|
|
@@ -11593,7 +11652,7 @@ class Room extends Emitter {
|
|
|
11593
11652
|
}
|
|
11594
11653
|
|
|
11595
11654
|
async startScreenSharing(constraints ) {
|
|
11596
|
-
logger$
|
|
11655
|
+
logger$3.info('start room screen sharing', { constraints });
|
|
11597
11656
|
|
|
11598
11657
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
11599
11658
|
if (!screensharingStream) {
|
|
@@ -11607,7 +11666,7 @@ class Room extends Emitter {
|
|
|
11607
11666
|
}
|
|
11608
11667
|
|
|
11609
11668
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
11610
|
-
logger$
|
|
11669
|
+
logger$3.info('stop room screen sharing');
|
|
11611
11670
|
|
|
11612
11671
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
11613
11672
|
|
|
@@ -11619,7 +11678,7 @@ class Room extends Emitter {
|
|
|
11619
11678
|
}
|
|
11620
11679
|
|
|
11621
11680
|
turnCameraOff() {
|
|
11622
|
-
logger$
|
|
11681
|
+
logger$3.info('turn room camera off');
|
|
11623
11682
|
|
|
11624
11683
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
11625
11684
|
|
|
@@ -11629,7 +11688,7 @@ class Room extends Emitter {
|
|
|
11629
11688
|
}
|
|
11630
11689
|
|
|
11631
11690
|
turnCameraOn() {
|
|
11632
|
-
logger$
|
|
11691
|
+
logger$3.info('turn room camera on');
|
|
11633
11692
|
|
|
11634
11693
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
11635
11694
|
|
|
@@ -11639,7 +11698,7 @@ class Room extends Emitter {
|
|
|
11639
11698
|
}
|
|
11640
11699
|
|
|
11641
11700
|
mute() {
|
|
11642
|
-
logger$
|
|
11701
|
+
logger$3.info('mute room');
|
|
11643
11702
|
|
|
11644
11703
|
Wazo.Phone.mute(this.callSession);
|
|
11645
11704
|
|
|
@@ -11647,7 +11706,7 @@ class Room extends Emitter {
|
|
|
11647
11706
|
}
|
|
11648
11707
|
|
|
11649
11708
|
unmute() {
|
|
11650
|
-
logger$
|
|
11709
|
+
logger$3.info('unmute room');
|
|
11651
11710
|
|
|
11652
11711
|
Wazo.Phone.unmute(this.callSession);
|
|
11653
11712
|
|
|
@@ -11667,7 +11726,7 @@ class Room extends Emitter {
|
|
|
11667
11726
|
}
|
|
11668
11727
|
|
|
11669
11728
|
hold() {
|
|
11670
|
-
logger$
|
|
11729
|
+
logger$3.info('hold room');
|
|
11671
11730
|
|
|
11672
11731
|
Wazo.Phone.hold(this.callSession, true);
|
|
11673
11732
|
|
|
@@ -11677,7 +11736,7 @@ class Room extends Emitter {
|
|
|
11677
11736
|
}
|
|
11678
11737
|
|
|
11679
11738
|
async resume() {
|
|
11680
|
-
logger$
|
|
11739
|
+
logger$3.info('resume room');
|
|
11681
11740
|
|
|
11682
11741
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
11683
11742
|
|
|
@@ -11705,13 +11764,13 @@ class Room extends Emitter {
|
|
|
11705
11764
|
}
|
|
11706
11765
|
|
|
11707
11766
|
sendDTMF(tone ) {
|
|
11708
|
-
logger$
|
|
11767
|
+
logger$3.info('send room DTMF', { tone });
|
|
11709
11768
|
|
|
11710
11769
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
11711
11770
|
}
|
|
11712
11771
|
|
|
11713
11772
|
async sendReinvite(newConstraints = null) {
|
|
11714
|
-
logger$
|
|
11773
|
+
logger$3.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
11715
11774
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
11716
11775
|
|
|
11717
11776
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -11770,7 +11829,7 @@ class Room extends Emitter {
|
|
|
11770
11829
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
11771
11830
|
|
|
11772
11831
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
11773
|
-
logger$
|
|
11832
|
+
logger$3.info('on room audio stream');
|
|
11774
11833
|
|
|
11775
11834
|
this.audioStream = stream;
|
|
11776
11835
|
if (!this.roomAudioElement) {
|
|
@@ -11783,7 +11842,7 @@ class Room extends Emitter {
|
|
|
11783
11842
|
});
|
|
11784
11843
|
|
|
11785
11844
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
11786
|
-
logger$
|
|
11845
|
+
logger$3.info('on room video stream', { streamId });
|
|
11787
11846
|
|
|
11788
11847
|
this._mapMsid(sipSession.body.body);
|
|
11789
11848
|
|
|
@@ -11798,7 +11857,7 @@ class Room extends Emitter {
|
|
|
11798
11857
|
});
|
|
11799
11858
|
|
|
11800
11859
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
11801
|
-
logger$
|
|
11860
|
+
logger$3.info('on room remove stream');
|
|
11802
11861
|
|
|
11803
11862
|
const participant = this.participants.find(someParticipant =>
|
|
11804
11863
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -11930,7 +11989,7 @@ class Room extends Emitter {
|
|
|
11930
11989
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
11931
11990
|
if (requester) {
|
|
11932
11991
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
11933
|
-
logger$
|
|
11992
|
+
logger$3.info('trigger room requester status', { origin });
|
|
11934
11993
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
11935
11994
|
}
|
|
11936
11995
|
break;
|
|
@@ -11961,24 +12020,24 @@ class Room extends Emitter {
|
|
|
11961
12020
|
|
|
11962
12021
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
11963
12022
|
if (participant.user_uuid === session.uuid) {
|
|
11964
|
-
logger$
|
|
12023
|
+
logger$3.info('room current user joined');
|
|
11965
12024
|
|
|
11966
12025
|
// Retrieve participants via an API calls
|
|
11967
12026
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
11968
12027
|
let response;
|
|
11969
12028
|
try {
|
|
11970
12029
|
if (this.meetingUuid) {
|
|
11971
|
-
logger$
|
|
12030
|
+
logger$3.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
11972
12031
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
11973
12032
|
} else {
|
|
11974
|
-
logger$
|
|
12033
|
+
logger$3.info('fetching conference participants', { conferenceId });
|
|
11975
12034
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
11976
12035
|
}
|
|
11977
12036
|
} catch (e) {
|
|
11978
|
-
logger$
|
|
12037
|
+
logger$3.error('room participants fetching, error', e);
|
|
11979
12038
|
}
|
|
11980
12039
|
if (response) {
|
|
11981
|
-
logger$
|
|
12040
|
+
logger$3.info('conference participants fetched', { nb: response.items.length });
|
|
11982
12041
|
participants = response.items.map(item => {
|
|
11983
12042
|
const isMe = item.call_id === this.callId;
|
|
11984
12043
|
|
|
@@ -12005,7 +12064,7 @@ class Room extends Emitter {
|
|
|
12005
12064
|
? new Wazo.RemoteParticipant(this, participant)
|
|
12006
12065
|
: null;
|
|
12007
12066
|
|
|
12008
|
-
logger$
|
|
12067
|
+
logger$3.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
12009
12068
|
|
|
12010
12069
|
if (remoteParticipant) {
|
|
12011
12070
|
this.participants.push(remoteParticipant);
|
|
@@ -12170,12 +12229,12 @@ class Room extends Emitter {
|
|
|
12170
12229
|
|
|
12171
12230
|
//
|
|
12172
12231
|
|
|
12173
|
-
const logger$
|
|
12232
|
+
const logger$2 = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
12174
12233
|
|
|
12175
|
-
class SipRoom extends Room {
|
|
12234
|
+
class SipRoom extends Room$1 {
|
|
12176
12235
|
|
|
12177
12236
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
12178
|
-
logger$
|
|
12237
|
+
logger$2.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
12179
12238
|
|
|
12180
12239
|
if (!room) {
|
|
12181
12240
|
await Wazo.Phone.connect();
|
|
@@ -12191,7 +12250,7 @@ class SipRoom extends Room {
|
|
|
12191
12250
|
room.setCallId(room.callSession.call.id);
|
|
12192
12251
|
}
|
|
12193
12252
|
|
|
12194
|
-
logger$
|
|
12253
|
+
logger$2.info('connected to room', {
|
|
12195
12254
|
extension: room.extension,
|
|
12196
12255
|
});
|
|
12197
12256
|
|
|
@@ -12199,7 +12258,7 @@ class SipRoom extends Room {
|
|
|
12199
12258
|
}
|
|
12200
12259
|
|
|
12201
12260
|
mute() {
|
|
12202
|
-
logger$
|
|
12261
|
+
logger$2.info('mute sip room');
|
|
12203
12262
|
|
|
12204
12263
|
Wazo.Phone.mute(this.callSession, false);
|
|
12205
12264
|
|
|
@@ -12207,7 +12266,7 @@ class SipRoom extends Room {
|
|
|
12207
12266
|
}
|
|
12208
12267
|
|
|
12209
12268
|
unmute() {
|
|
12210
|
-
logger$
|
|
12269
|
+
logger$2.info('unmute sip room');
|
|
12211
12270
|
|
|
12212
12271
|
Wazo.Phone.unmute(this.callSession, false);
|
|
12213
12272
|
|
|
@@ -12414,6 +12473,14 @@ const createLocalVideoStream = async (options ) => createLocalStream('vid
|
|
|
12414
12473
|
|
|
12415
12474
|
const createLocalAudioStream = async (options ) => createLocalStream('audio', options);
|
|
12416
12475
|
|
|
12476
|
+
/* */
|
|
12477
|
+
class SFUNotAvailableError extends Error {
|
|
12478
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
12479
|
+
super(message);
|
|
12480
|
+
this.name = 'SFUNotAvailableError';
|
|
12481
|
+
}
|
|
12482
|
+
}
|
|
12483
|
+
|
|
12417
12484
|
//
|
|
12418
12485
|
|
|
12419
12486
|
|
|
@@ -12491,7 +12558,7 @@ class NotificationOptions {
|
|
|
12491
12558
|
|
|
12492
12559
|
|
|
12493
12560
|
// Represents a conference room, like `9000`.
|
|
12494
|
-
class Room
|
|
12561
|
+
class Room {
|
|
12495
12562
|
|
|
12496
12563
|
|
|
12497
12564
|
|
|
@@ -12512,7 +12579,7 @@ class Room$1 {
|
|
|
12512
12579
|
}
|
|
12513
12580
|
|
|
12514
12581
|
connect(callSession ) {
|
|
12515
|
-
return new Room
|
|
12582
|
+
return new Room({ ...this, connectedCallSession: callSession });
|
|
12516
12583
|
}
|
|
12517
12584
|
|
|
12518
12585
|
has(callSession ) {
|
|
@@ -12521,7 +12588,7 @@ class Room$1 {
|
|
|
12521
12588
|
|
|
12522
12589
|
addParticipant(uuid , extension , talking = null) {
|
|
12523
12590
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
12524
|
-
return new Room
|
|
12591
|
+
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12525
12592
|
}
|
|
12526
12593
|
|
|
12527
12594
|
return this;
|
|
@@ -12540,7 +12607,7 @@ class Room$1 {
|
|
|
12540
12607
|
updatedParticipants.push(participant);
|
|
12541
12608
|
}
|
|
12542
12609
|
|
|
12543
|
-
return new Room
|
|
12610
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12544
12611
|
}
|
|
12545
12612
|
|
|
12546
12613
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -12556,7 +12623,7 @@ class Room$1 {
|
|
|
12556
12623
|
updatedParticipants.push(participant);
|
|
12557
12624
|
}
|
|
12558
12625
|
|
|
12559
|
-
return new Room
|
|
12626
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12560
12627
|
}
|
|
12561
12628
|
|
|
12562
12629
|
hasCallWithId(id ) {
|
|
@@ -12564,18 +12631,18 @@ class Room$1 {
|
|
|
12564
12631
|
}
|
|
12565
12632
|
|
|
12566
12633
|
disconnect() {
|
|
12567
|
-
return new Room
|
|
12634
|
+
return new Room({ ...this, connectedCallSession: null });
|
|
12568
12635
|
}
|
|
12569
12636
|
|
|
12570
12637
|
removeParticipantWithUUID(uuid ) {
|
|
12571
|
-
return new Room
|
|
12638
|
+
return new Room({
|
|
12572
12639
|
...this,
|
|
12573
12640
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
12574
12641
|
});
|
|
12575
12642
|
}
|
|
12576
12643
|
|
|
12577
12644
|
removeParticipantWithExtension(extension ) {
|
|
12578
|
-
return new Room
|
|
12645
|
+
return new Room({
|
|
12579
12646
|
...this,
|
|
12580
12647
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
12581
12648
|
});
|
|
@@ -12586,7 +12653,7 @@ class Room$1 {
|
|
|
12586
12653
|
}
|
|
12587
12654
|
|
|
12588
12655
|
static newFrom(room ) {
|
|
12589
|
-
return newFrom(room, Room
|
|
12656
|
+
return newFrom(room, Room);
|
|
12590
12657
|
}
|
|
12591
12658
|
}
|
|
12592
12659
|
|
|
@@ -12893,11 +12960,11 @@ var wazoWebsocket = {
|
|
|
12893
12960
|
resolve();
|
|
12894
12961
|
};
|
|
12895
12962
|
|
|
12896
|
-
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
12963
|
+
client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
|
|
12897
12964
|
handleError(`Connection error : ${error}`);
|
|
12898
12965
|
});
|
|
12899
12966
|
|
|
12900
|
-
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
12967
|
+
client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
|
|
12901
12968
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
12902
12969
|
client.setOnHeartbeatTimeout(() => {
|
|
12903
12970
|
handleError('No response to heartbeat');
|
|
@@ -12998,7 +13065,7 @@ var webrtc = {
|
|
|
12998
13065
|
}),
|
|
12999
13066
|
};
|
|
13000
13067
|
|
|
13001
|
-
const parseCandidate
|
|
13068
|
+
const parseCandidate = line => {
|
|
13002
13069
|
let parts;
|
|
13003
13070
|
// Parse both variants.
|
|
13004
13071
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -13089,7 +13156,7 @@ var SymmetricNat = {
|
|
|
13089
13156
|
}
|
|
13090
13157
|
|
|
13091
13158
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
13092
|
-
const cand = parseCandidate
|
|
13159
|
+
const cand = parseCandidate(e.candidate.candidate);
|
|
13093
13160
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
13094
13161
|
candidates[cand.relatedPort].push(cand.port);
|
|
13095
13162
|
} else if (!e.candidate) {
|
|
@@ -13157,7 +13224,7 @@ var iceIpv4 = {
|
|
|
13157
13224
|
const rawCandidate = e.candidate.candidate;
|
|
13158
13225
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
13159
13226
|
hasSrflxOrRelay = true;
|
|
13160
|
-
const candidate = parseCandidate
|
|
13227
|
+
const candidate = parseCandidate(e.candidate.candidate);
|
|
13161
13228
|
ips.push(candidate.ip);
|
|
13162
13229
|
}
|
|
13163
13230
|
} else if (!e.candidate) {
|
|
@@ -13194,7 +13261,7 @@ var checks = [
|
|
|
13194
13261
|
|
|
13195
13262
|
//
|
|
13196
13263
|
|
|
13197
|
-
const logger$
|
|
13264
|
+
const logger$1 = IssueReporter$1.loggerFor('engine-check');
|
|
13198
13265
|
|
|
13199
13266
|
class Checker {
|
|
13200
13267
|
|
|
@@ -13212,28 +13279,28 @@ class Checker {
|
|
|
13212
13279
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
13213
13280
|
await this._addEngineVersion();
|
|
13214
13281
|
|
|
13215
|
-
logger$
|
|
13282
|
+
logger$1.info('Engine check starting');
|
|
13216
13283
|
|
|
13217
13284
|
for (let i = 0; i < this.checks.length; i++) {
|
|
13218
13285
|
const { name, check } = this.checks[i];
|
|
13219
13286
|
|
|
13220
|
-
logger$
|
|
13287
|
+
logger$1.info(`Checking ${name} ...`);
|
|
13221
13288
|
|
|
13222
13289
|
onCheckBegin(name);
|
|
13223
13290
|
try {
|
|
13224
13291
|
// eslint-disable-next-line no-await-in-loop
|
|
13225
13292
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
13226
|
-
logger$
|
|
13293
|
+
logger$1.info(`Checking ${name} success.`, { result });
|
|
13227
13294
|
|
|
13228
13295
|
onCheckResult(name, result);
|
|
13229
13296
|
} catch (e) {
|
|
13230
|
-
logger$
|
|
13297
|
+
logger$1.info(`Checking ${name} failure`, { message: e.message });
|
|
13231
13298
|
|
|
13232
13299
|
onCheckResult(name, e);
|
|
13233
13300
|
}
|
|
13234
13301
|
}
|
|
13235
13302
|
|
|
13236
|
-
logger$
|
|
13303
|
+
logger$1.info('Engine check done.');
|
|
13237
13304
|
}
|
|
13238
13305
|
|
|
13239
13306
|
addCheck(check ) {
|
|
@@ -13257,7 +13324,7 @@ const Wazo = {
|
|
|
13257
13324
|
Auth: Auth$1,
|
|
13258
13325
|
Phone: Phone$1,
|
|
13259
13326
|
Websocket: Websocket$1,
|
|
13260
|
-
Room,
|
|
13327
|
+
Room: Room$1,
|
|
13261
13328
|
SipRoom,
|
|
13262
13329
|
RemoteParticipant,
|
|
13263
13330
|
LocalParticipant,
|
|
@@ -13290,7 +13357,7 @@ const Wazo = {
|
|
|
13290
13357
|
Session,
|
|
13291
13358
|
Voicemail,
|
|
13292
13359
|
Relocation,
|
|
13293
|
-
ConferenceRoom: Room
|
|
13360
|
+
ConferenceRoom: Room,
|
|
13294
13361
|
CallSession,
|
|
13295
13362
|
IndirectTransfer,
|
|
13296
13363
|
SwitchboardCall,
|
|
@@ -13315,6 +13382,7 @@ const Wazo = {
|
|
|
13315
13382
|
InvalidSubscription,
|
|
13316
13383
|
InvalidAuthorization,
|
|
13317
13384
|
CanceledCallError,
|
|
13385
|
+
SFUNotAvailableError,
|
|
13318
13386
|
};
|
|
13319
13387
|
|
|
13320
13388
|
if (window) {
|
|
@@ -13326,7 +13394,7 @@ if (global) {
|
|
|
13326
13394
|
|
|
13327
13395
|
//
|
|
13328
13396
|
|
|
13329
|
-
const logger
|
|
13397
|
+
const logger = IssueReporter$1.loggerFor('simple-phone');
|
|
13330
13398
|
const sipLogger = IssueReporter$1.loggerFor('sip.js');
|
|
13331
13399
|
const protocolLogger = IssueReporter$1.loggerFor('sip');
|
|
13332
13400
|
|
|
@@ -13433,7 +13501,7 @@ class Phone extends Emitter {
|
|
|
13433
13501
|
async disconnect() {
|
|
13434
13502
|
if (this.phone) {
|
|
13435
13503
|
if (this.phone.hasAnActiveCall()) {
|
|
13436
|
-
logger
|
|
13504
|
+
logger.info('hangup call on disconnect');
|
|
13437
13505
|
// $FlowFixMe
|
|
13438
13506
|
await this.phone.hangup();
|
|
13439
13507
|
}
|
|
@@ -13456,13 +13524,13 @@ class Phone extends Emitter {
|
|
|
13456
13524
|
}
|
|
13457
13525
|
|
|
13458
13526
|
async hangup(callSession ) {
|
|
13459
|
-
logger
|
|
13527
|
+
logger.info('hangup via simple phone', { callId: callSession.getId() });
|
|
13460
13528
|
|
|
13461
13529
|
return this.phone && this.phone.hangup(callSession);
|
|
13462
13530
|
}
|
|
13463
13531
|
|
|
13464
13532
|
async accept(callSession , cameraEnabled ) {
|
|
13465
|
-
logger
|
|
13533
|
+
logger.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
|
|
13466
13534
|
|
|
13467
13535
|
return this.phone && this.phone.accept(callSession, cameraEnabled);
|
|
13468
13536
|
}
|
|
@@ -13501,7 +13569,7 @@ class Phone extends Emitter {
|
|
|
13501
13569
|
muteViaAPI(callSession ) {
|
|
13502
13570
|
if (callSession && callSession.callId) {
|
|
13503
13571
|
Wazo.getApiClient().calld.mute(callSession.callId).catch(e => {
|
|
13504
|
-
logger
|
|
13572
|
+
logger.error('Mute via API, error', e);
|
|
13505
13573
|
});
|
|
13506
13574
|
}
|
|
13507
13575
|
}
|
|
@@ -13509,7 +13577,7 @@ class Phone extends Emitter {
|
|
|
13509
13577
|
unmuteViaAPI(callSession ) {
|
|
13510
13578
|
if (callSession && callSession.callId) {
|
|
13511
13579
|
Wazo.getApiClient().calld.unmute(callSession.callId).catch(e => {
|
|
13512
|
-
logger
|
|
13580
|
+
logger.error('Unmute via API, error', e);
|
|
13513
13581
|
});
|
|
13514
13582
|
}
|
|
13515
13583
|
}
|
|
@@ -13617,7 +13685,7 @@ class Phone extends Emitter {
|
|
|
13617
13685
|
|
|
13618
13686
|
// @Deprecated
|
|
13619
13687
|
getLocalMediaStream(callSession ) {
|
|
13620
|
-
logger
|
|
13688
|
+
logger.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
|
|
13621
13689
|
|
|
13622
13690
|
return this.phone && this.phone.getLocalStream(callSession);
|
|
13623
13691
|
}
|
|
@@ -13640,20 +13708,20 @@ class Phone extends Emitter {
|
|
|
13640
13708
|
|
|
13641
13709
|
// @Deprecated
|
|
13642
13710
|
getRemoteStreamForCall(callSession ) {
|
|
13643
|
-
logger
|
|
13711
|
+
logger.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
|
|
13644
13712
|
return this.getRemoteStream(callSession);
|
|
13645
13713
|
}
|
|
13646
13714
|
|
|
13647
13715
|
// Returns remote streams directly from the peerConnection
|
|
13648
13716
|
// @Deprecated
|
|
13649
13717
|
getRemoteStreamsForCall(callSession ) {
|
|
13650
|
-
logger
|
|
13718
|
+
logger.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
|
|
13651
13719
|
return this.getLocalStream(callSession);
|
|
13652
13720
|
}
|
|
13653
13721
|
|
|
13654
13722
|
// @Deprecated
|
|
13655
13723
|
getRemoteVideoStreamForCall(callSession ) {
|
|
13656
|
-
logger
|
|
13724
|
+
logger.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
|
|
13657
13725
|
|
|
13658
13726
|
return this.getRemoteVideoStream(callSession);
|
|
13659
13727
|
}
|
|
@@ -13708,13 +13776,13 @@ class Phone extends Emitter {
|
|
|
13708
13776
|
|
|
13709
13777
|
checkSfu() {
|
|
13710
13778
|
if (!this.hasSfu()) {
|
|
13711
|
-
throw new
|
|
13779
|
+
throw new SFUNotAvailableError();
|
|
13712
13780
|
}
|
|
13713
13781
|
}
|
|
13714
13782
|
|
|
13715
13783
|
_transferEvents() {
|
|
13716
13784
|
this.unbind();
|
|
13717
|
-
[...events, ...transportEvents].forEach(event => {
|
|
13785
|
+
[...events$1, ...transportEvents].forEach(event => {
|
|
13718
13786
|
this.client.on(event, (...args) =>
|
|
13719
13787
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
13720
13788
|
});
|