@wazo/sdk 0.37.23 → 0.37.24
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/dist/wazo-sdk.js +6 -6
- package/esm/__tests__/api-client.test.js +22 -17
- package/esm/__tests__/web-rtc-client.test.js +105 -100
- package/esm/api/amid.js +1 -1
- package/esm/api/call-logd.js +2 -2
- package/esm/api/confd.js +10 -5
- package/esm/api/ctid-ng.js +3 -3
- package/esm/api/dird.js +1 -1
- package/esm/api/webhookd.js +1 -1
- package/esm/api-client.js +22 -17
- package/esm/checker/Checker.js +130 -125
- package/esm/checker/checks/aor.js +22 -17
- package/esm/checker/checks/api.js +22 -17
- package/esm/checker/checks/index.js +120 -115
- package/esm/checker/checks/wazo-websocket.js +15 -15
- package/esm/checker/checks/webrtc-transport.js +105 -100
- package/esm/checker/checks/webrtc.js +105 -100
- package/esm/domain/AdHocAPIConference.js +22 -17
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/Contact.js +1 -1
- package/esm/domain/Features.js +22 -17
- package/esm/domain/Meeting.js +12 -5
- package/esm/domain/Phone/CTIPhone.js +36 -31
- package/esm/domain/Phone/WebRTCPhone.js +110 -87
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/Contact.test.js +1 -1
- package/esm/domain/__tests__/Meeting.test.js +144 -0
- package/esm/index.js +365 -337
- package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
- package/esm/service/CallApi.js +22 -17
- package/esm/service/IssueReporter.js +1 -1
- package/esm/service/__tests__/IssueReporter.test.js +1 -1
- package/esm/service/getApiClient.js +22 -17
- package/esm/simple/Auth.js +355 -327
- package/esm/simple/Configuration.js +355 -327
- package/esm/simple/Directory.js +22 -17
- package/esm/simple/Phone.js +355 -327
- package/esm/simple/Websocket.js +17 -17
- package/esm/simple/index.js +359 -331
- package/esm/simple/room/LocalParticipant.js +359 -331
- package/esm/simple/room/Participant.js +359 -331
- package/esm/simple/room/RemoteParticipant.js +359 -331
- package/esm/simple/room/Room.js +360 -332
- package/esm/simple/room/SipRoom.js +359 -331
- package/esm/simple/room/Stream.js +359 -331
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/esm/simple/utils.js +359 -331
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/web-rtc-client.js +105 -100
- package/esm/websocket-client.js +15 -15
- package/lib/__tests__/api-client.test.js +22 -17
- package/lib/__tests__/web-rtc-client.test.js +105 -100
- package/lib/api/amid.js +1 -1
- package/lib/api/call-logd.js +2 -2
- package/lib/api/confd.js +10 -5
- package/lib/api/ctid-ng.js +3 -3
- package/lib/api/dird.js +1 -1
- package/lib/api/webhookd.js +1 -1
- package/lib/api-client.js +22 -17
- package/lib/checker/Checker.js +130 -125
- package/lib/checker/checks/aor.js +22 -17
- package/lib/checker/checks/api.js +22 -17
- package/lib/checker/checks/index.js +120 -115
- package/lib/checker/checks/wazo-websocket.js +15 -15
- package/lib/checker/checks/webrtc-transport.js +105 -100
- package/lib/checker/checks/webrtc.js +105 -100
- package/lib/domain/AdHocAPIConference.js +22 -17
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +22 -17
- package/lib/domain/Meeting.js +16 -5
- package/lib/domain/Phone/CTIPhone.js +36 -31
- package/lib/domain/Phone/WebRTCPhone.js +110 -87
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/Contact.test.js +1 -1
- package/lib/domain/__tests__/Meeting.test.js +150 -0
- package/lib/index.js +365 -337
- package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
- package/lib/service/CallApi.js +22 -17
- package/lib/service/IssueReporter.js +1 -1
- package/lib/service/__tests__/IssueReporter.test.js +1 -1
- package/lib/service/getApiClient.js +22 -17
- package/lib/simple/Auth.js +355 -327
- package/lib/simple/Configuration.js +355 -327
- package/lib/simple/Directory.js +22 -17
- package/lib/simple/Phone.js +355 -327
- package/lib/simple/Websocket.js +17 -17
- package/lib/simple/index.js +359 -331
- package/lib/simple/room/LocalParticipant.js +359 -331
- package/lib/simple/room/Participant.js +359 -331
- package/lib/simple/room/RemoteParticipant.js +359 -331
- package/lib/simple/room/Room.js +360 -332
- package/lib/simple/room/SipRoom.js +359 -331
- package/lib/simple/room/Stream.js +359 -331
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/lib/simple/utils.js +359 -331
- package/lib/types/WebSocketMessage.js +2 -0
- package/lib/web-rtc-client.js +105 -100
- package/lib/websocket-client.js +15 -15
- package/package.json +1 -1
- package/src/domain/Meeting.js +12 -5
- package/src/domain/Phone/WebRTCPhone.js +24 -1
- package/src/domain/__tests__/Meeting.test.js +50 -0
|
@@ -138,7 +138,7 @@ const isMobile = () => typeof navigator !== 'undefined' && navigator.product ===
|
|
|
138
138
|
|
|
139
139
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
140
140
|
|
|
141
|
-
const logger
|
|
141
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
142
142
|
|
|
143
143
|
// Use a function here to be able to mock it in tests
|
|
144
144
|
const realFetch = () => {
|
|
@@ -277,7 +277,7 @@ class ApiRequester {
|
|
|
277
277
|
};
|
|
278
278
|
|
|
279
279
|
if (this.refreshTokenPromise) {
|
|
280
|
-
logger
|
|
280
|
+
logger.info('A token is already refreshing, waiting ...', { url });
|
|
281
281
|
await this.refreshTokenPromise;
|
|
282
282
|
}
|
|
283
283
|
|
|
@@ -297,7 +297,7 @@ class ApiRequester {
|
|
|
297
297
|
return promise.then(async (err ) => {
|
|
298
298
|
// Check if the token is still valid
|
|
299
299
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
300
|
-
logger
|
|
300
|
+
logger.warn('token expired', { error: err.reason });
|
|
301
301
|
// Replay the call after refreshing the token
|
|
302
302
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
303
303
|
}
|
|
@@ -307,7 +307,7 @@ class ApiRequester {
|
|
|
307
307
|
: exceptionClass.fromResponse(err, response.status);
|
|
308
308
|
|
|
309
309
|
if (this.shouldLogErrors) {
|
|
310
|
-
logger
|
|
310
|
+
logger.error('API error', error);
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
throw error;
|
|
@@ -317,7 +317,7 @@ class ApiRequester {
|
|
|
317
317
|
return newParse(response, isJson);
|
|
318
318
|
}).catch(error => {
|
|
319
319
|
if (this.shouldLogErrors) {
|
|
320
|
-
logger
|
|
320
|
+
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
throw error;
|
|
@@ -345,13 +345,13 @@ class ApiRequester {
|
|
|
345
345
|
) {
|
|
346
346
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
347
347
|
let newPath = path;
|
|
348
|
-
logger
|
|
348
|
+
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
349
349
|
|
|
350
350
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
351
351
|
|
|
352
352
|
return this.refreshTokenPromise.then(() => {
|
|
353
353
|
this.refreshTokenPromise = null;
|
|
354
|
-
logger
|
|
354
|
+
logger.info('token refreshed', { isTokenNotFound });
|
|
355
355
|
if (isTokenNotFound) {
|
|
356
356
|
const pathParts = path.split('/');
|
|
357
357
|
pathParts.pop();
|
|
@@ -2666,8 +2666,9 @@ class ExternalApp {
|
|
|
2666
2666
|
|
|
2667
2667
|
|
|
2668
2668
|
|
|
2669
|
-
|
|
2669
|
+
|
|
2670
2670
|
|
|
2671
|
+
|
|
2671
2672
|
|
|
2672
2673
|
|
|
2673
2674
|
class Meeting {
|
|
@@ -2678,9 +2679,10 @@ class Meeting {
|
|
|
2678
2679
|
|
|
2679
2680
|
|
|
2680
2681
|
|
|
2681
|
-
|
|
2682
|
+
|
|
2682
2683
|
|
|
2683
2684
|
|
|
2685
|
+
|
|
2684
2686
|
|
|
2685
2687
|
static parse(plain ) {
|
|
2686
2688
|
return new Meeting({
|
|
@@ -2690,8 +2692,9 @@ class Meeting {
|
|
|
2690
2692
|
ownerUuids: plain.owner_uuids,
|
|
2691
2693
|
port: plain.port,
|
|
2692
2694
|
uuid: plain.uuid,
|
|
2693
|
-
|
|
2695
|
+
extension: plain.exten,
|
|
2694
2696
|
persistent: plain.persistent,
|
|
2697
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2695
2698
|
});
|
|
2696
2699
|
}
|
|
2697
2700
|
|
|
@@ -2713,8 +2716,9 @@ class Meeting {
|
|
|
2713
2716
|
ownerUuids,
|
|
2714
2717
|
port,
|
|
2715
2718
|
uri,
|
|
2716
|
-
|
|
2719
|
+
extension,
|
|
2717
2720
|
persistent,
|
|
2721
|
+
creationTime,
|
|
2718
2722
|
} = {}) {
|
|
2719
2723
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2720
2724
|
this.uri = uri;
|
|
@@ -2722,8 +2726,9 @@ class Meeting {
|
|
|
2722
2726
|
this.ownerUuids = ownerUuids;
|
|
2723
2727
|
this.port = port;
|
|
2724
2728
|
this.uuid = uuid;
|
|
2725
|
-
this.
|
|
2729
|
+
this.extension = extension;
|
|
2726
2730
|
this.persistent = persistent;
|
|
2731
|
+
this.creationTime = creationTime;
|
|
2727
2732
|
|
|
2728
2733
|
// Useful to compare instead of instanceof with minified code
|
|
2729
2734
|
this.type = 'Meeting';
|
|
@@ -4058,7 +4063,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4058
4063
|
|
|
4059
4064
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4060
4065
|
|
|
4061
|
-
const logger$
|
|
4066
|
+
const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4062
4067
|
|
|
4063
4068
|
class CTIPhone extends Emitter {
|
|
4064
4069
|
|
|
@@ -4071,7 +4076,7 @@ class CTIPhone extends Emitter {
|
|
|
4071
4076
|
|
|
4072
4077
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4073
4078
|
super();
|
|
4074
|
-
logger$
|
|
4079
|
+
logger$1.info('CTI Phone created');
|
|
4075
4080
|
this.session = session;
|
|
4076
4081
|
this.isMobile = isMobile;
|
|
4077
4082
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4132,7 +4137,7 @@ class CTIPhone extends Emitter {
|
|
|
4132
4137
|
}
|
|
4133
4138
|
|
|
4134
4139
|
async makeCall(number , line ) {
|
|
4135
|
-
logger$
|
|
4140
|
+
logger$1.info('make CTI call', { number });
|
|
4136
4141
|
|
|
4137
4142
|
if (!number) {
|
|
4138
4143
|
return null;
|
|
@@ -4155,7 +4160,7 @@ class CTIPhone extends Emitter {
|
|
|
4155
4160
|
if (!callSession) {
|
|
4156
4161
|
return Promise.resolve(null);
|
|
4157
4162
|
}
|
|
4158
|
-
logger$
|
|
4163
|
+
logger$1.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4159
4164
|
|
|
4160
4165
|
if (!this.currentCall) {
|
|
4161
4166
|
this.currentCall = callSession.call;
|
|
@@ -4168,7 +4173,7 @@ class CTIPhone extends Emitter {
|
|
|
4168
4173
|
if (!callSession) {
|
|
4169
4174
|
return;
|
|
4170
4175
|
}
|
|
4171
|
-
logger$
|
|
4176
|
+
logger$1.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4172
4177
|
|
|
4173
4178
|
this.currentCall = undefined;
|
|
4174
4179
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4178,7 +4183,7 @@ class CTIPhone extends Emitter {
|
|
|
4178
4183
|
if (!callSession) {
|
|
4179
4184
|
return Promise.resolve(false);
|
|
4180
4185
|
}
|
|
4181
|
-
logger$
|
|
4186
|
+
logger$1.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4182
4187
|
|
|
4183
4188
|
try {
|
|
4184
4189
|
await CallApi.cancelCall(callSession);
|
|
@@ -4189,7 +4194,7 @@ class CTIPhone extends Emitter {
|
|
|
4189
4194
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4190
4195
|
return true;
|
|
4191
4196
|
} catch (e) {
|
|
4192
|
-
logger$
|
|
4197
|
+
logger$1.error('hangup CTI call, error', e);
|
|
4193
4198
|
|
|
4194
4199
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4195
4200
|
return false;
|
|
@@ -4202,7 +4207,7 @@ class CTIPhone extends Emitter {
|
|
|
4202
4207
|
if (!callSession) {
|
|
4203
4208
|
return;
|
|
4204
4209
|
}
|
|
4205
|
-
logger$
|
|
4210
|
+
logger$1.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4206
4211
|
|
|
4207
4212
|
await CallApi.cancelCall(callSession);
|
|
4208
4213
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4212,7 +4217,7 @@ class CTIPhone extends Emitter {
|
|
|
4212
4217
|
if (!callSession) {
|
|
4213
4218
|
return;
|
|
4214
4219
|
}
|
|
4215
|
-
logger$
|
|
4220
|
+
logger$1.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4216
4221
|
|
|
4217
4222
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4218
4223
|
}
|
|
@@ -4225,19 +4230,19 @@ class CTIPhone extends Emitter {
|
|
|
4225
4230
|
if (!callSession) {
|
|
4226
4231
|
return;
|
|
4227
4232
|
}
|
|
4228
|
-
logger$
|
|
4233
|
+
logger$1.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4229
4234
|
|
|
4230
4235
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4231
4236
|
}
|
|
4232
4237
|
|
|
4233
4238
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4234
|
-
logger$
|
|
4239
|
+
logger$1.info('cancel CTI transfer', { transferId });
|
|
4235
4240
|
|
|
4236
4241
|
return CallApi.cancelCallTransfer(transferId);
|
|
4237
4242
|
}
|
|
4238
4243
|
|
|
4239
4244
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4240
|
-
logger$
|
|
4245
|
+
logger$1.info('confirm CTI transfer', { transferId });
|
|
4241
4246
|
|
|
4242
4247
|
return CallApi.confirmCallTransfer(transferId);
|
|
4243
4248
|
}
|
|
@@ -4246,19 +4251,19 @@ class CTIPhone extends Emitter {
|
|
|
4246
4251
|
if (!callSession) {
|
|
4247
4252
|
return;
|
|
4248
4253
|
}
|
|
4249
|
-
logger$
|
|
4254
|
+
logger$1.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4250
4255
|
|
|
4251
4256
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4252
4257
|
}
|
|
4253
4258
|
|
|
4254
4259
|
onConnectionMade() {
|
|
4255
|
-
logger$
|
|
4260
|
+
logger$1.info('on CTI connection made');
|
|
4256
4261
|
|
|
4257
4262
|
this.eventEmitter.emit('onCallAccepted');
|
|
4258
4263
|
}
|
|
4259
4264
|
|
|
4260
4265
|
async close() {
|
|
4261
|
-
logger$
|
|
4266
|
+
logger$1.info('CTI close');
|
|
4262
4267
|
|
|
4263
4268
|
return Promise.resolve();
|
|
4264
4269
|
}
|
|
@@ -4267,7 +4272,7 @@ class CTIPhone extends Emitter {
|
|
|
4267
4272
|
if (!callSession) {
|
|
4268
4273
|
return;
|
|
4269
4274
|
}
|
|
4270
|
-
logger$
|
|
4275
|
+
logger$1.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4271
4276
|
|
|
4272
4277
|
return CallApi.hold(callSession.callId);
|
|
4273
4278
|
}
|
|
@@ -4276,7 +4281,7 @@ class CTIPhone extends Emitter {
|
|
|
4276
4281
|
if (!callSession) {
|
|
4277
4282
|
return;
|
|
4278
4283
|
}
|
|
4279
|
-
logger$
|
|
4284
|
+
logger$1.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4280
4285
|
|
|
4281
4286
|
return CallApi.resume(callSession.callId);
|
|
4282
4287
|
}
|
|
@@ -4285,7 +4290,7 @@ class CTIPhone extends Emitter {
|
|
|
4285
4290
|
if (!callSession) {
|
|
4286
4291
|
return;
|
|
4287
4292
|
}
|
|
4288
|
-
logger$
|
|
4293
|
+
logger$1.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4289
4294
|
|
|
4290
4295
|
return CallApi.mute(callSession.callId);
|
|
4291
4296
|
}
|
|
@@ -4294,7 +4299,7 @@ class CTIPhone extends Emitter {
|
|
|
4294
4299
|
if (!callSession) {
|
|
4295
4300
|
return;
|
|
4296
4301
|
}
|
|
4297
|
-
logger$
|
|
4302
|
+
logger$1.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4298
4303
|
|
|
4299
4304
|
return CallApi.unmute(callSession.callId);
|
|
4300
4305
|
}
|
|
@@ -5303,7 +5308,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5303
5308
|
const WEBHOOKD_VERSION = '1.0';
|
|
5304
5309
|
const AMID_VERSION = '1.0';
|
|
5305
5310
|
|
|
5306
|
-
const logger$
|
|
5311
|
+
const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5307
5312
|
|
|
5308
5313
|
class ApiClient {
|
|
5309
5314
|
|
|
@@ -5355,12 +5360,12 @@ class ApiClient {
|
|
|
5355
5360
|
}
|
|
5356
5361
|
|
|
5357
5362
|
async forceRefreshToken() {
|
|
5358
|
-
logger$
|
|
5363
|
+
logger$2.info('forcing refresh token, calling callback');
|
|
5359
5364
|
return this.refreshTokenCallback();
|
|
5360
5365
|
}
|
|
5361
5366
|
|
|
5362
5367
|
async refreshTokenCallback() {
|
|
5363
|
-
logger$
|
|
5368
|
+
logger$2.info('refresh token callback called', {
|
|
5364
5369
|
refreshToken: this.refreshToken,
|
|
5365
5370
|
refreshBackend: this.refreshBackend,
|
|
5366
5371
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5378,7 +5383,7 @@ class ApiClient {
|
|
|
5378
5383
|
this.isMobile,
|
|
5379
5384
|
);
|
|
5380
5385
|
|
|
5381
|
-
logger$
|
|
5386
|
+
logger$2.info('token refreshed', { token: session.token });
|
|
5382
5387
|
|
|
5383
5388
|
if (this.onRefreshToken) {
|
|
5384
5389
|
this.onRefreshToken(session.token, session);
|
|
@@ -5519,7 +5524,7 @@ var getApiClient = (forServer ) => {
|
|
|
5519
5524
|
class InvalidSubscription extends Error {}
|
|
5520
5525
|
class InvalidAuthorization extends Error {}
|
|
5521
5526
|
|
|
5522
|
-
const logger$
|
|
5527
|
+
const logger$3 = IssueReporter$1.loggerFor('simple-auth');
|
|
5523
5528
|
|
|
5524
5529
|
class Auth {
|
|
5525
5530
|
|
|
@@ -5554,7 +5559,7 @@ class Auth {
|
|
|
5554
5559
|
setApiClientId(this.clientId);
|
|
5555
5560
|
setRefreshExpiration(this.expiration);
|
|
5556
5561
|
setOnRefreshToken((token , session ) => {
|
|
5557
|
-
logger$
|
|
5562
|
+
logger$3.info('on refresh token done', { token });
|
|
5558
5563
|
setApiToken(token);
|
|
5559
5564
|
Wazo.Websocket.updateToken(token);
|
|
5560
5565
|
|
|
@@ -5599,7 +5604,7 @@ class Auth {
|
|
|
5599
5604
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
5600
5605
|
return this._onAuthenticated(rawSession);
|
|
5601
5606
|
} catch (e) {
|
|
5602
|
-
logger$
|
|
5607
|
+
logger$3.error('on validate token error', e);
|
|
5603
5608
|
console.warn(e);
|
|
5604
5609
|
return false;
|
|
5605
5610
|
}
|
|
@@ -5955,7 +5960,7 @@ class AdHocAPIConference {
|
|
|
5955
5960
|
|
|
5956
5961
|
/* */
|
|
5957
5962
|
|
|
5958
|
-
const parseCandidate
|
|
5963
|
+
const parseCandidate = (candidate ) => {
|
|
5959
5964
|
if (!candidate) {
|
|
5960
5965
|
return null;
|
|
5961
5966
|
}
|
|
@@ -6109,7 +6114,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6109
6114
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
6110
6115
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6111
6116
|
if (event.candidate) {
|
|
6112
|
-
this.gatheredCandidates.push(parseCandidate
|
|
6117
|
+
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
6113
6118
|
}
|
|
6114
6119
|
};
|
|
6115
6120
|
|
|
@@ -6573,7 +6578,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6573
6578
|
const SEND_STATS_DELAY = 5000;
|
|
6574
6579
|
|
|
6575
6580
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6576
|
-
const logger$
|
|
6581
|
+
const logger$4 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6577
6582
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6578
6583
|
|
|
6579
6584
|
// events
|
|
@@ -6587,14 +6592,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6587
6592
|
const MESSAGE = 'message';
|
|
6588
6593
|
const ACCEPTED = 'accepted';
|
|
6589
6594
|
const REJECTED = 'rejected';
|
|
6590
|
-
const ON_TRACK
|
|
6591
|
-
const ON_REINVITE
|
|
6595
|
+
const ON_TRACK = 'onTrack';
|
|
6596
|
+
const ON_REINVITE = 'reinvite';
|
|
6592
6597
|
const ON_ERROR = 'onError';
|
|
6593
6598
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6594
|
-
const ON_NETWORK_STATS
|
|
6595
|
-
const ON_DISCONNECTED
|
|
6599
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6600
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
6596
6601
|
|
|
6597
|
-
const events
|
|
6602
|
+
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6598
6603
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6599
6604
|
class CanceledCallError extends Error {}
|
|
6600
6605
|
|
|
@@ -6730,12 +6735,12 @@ class WebRTCClient extends Emitter {
|
|
|
6730
6735
|
this.MESSAGE = MESSAGE;
|
|
6731
6736
|
this.ACCEPTED = ACCEPTED;
|
|
6732
6737
|
this.REJECTED = REJECTED;
|
|
6733
|
-
this.ON_TRACK = ON_TRACK
|
|
6734
|
-
this.ON_REINVITE = ON_REINVITE
|
|
6738
|
+
this.ON_TRACK = ON_TRACK;
|
|
6739
|
+
this.ON_REINVITE = ON_REINVITE;
|
|
6735
6740
|
this.ON_ERROR = ON_ERROR;
|
|
6736
6741
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6737
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS
|
|
6738
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED
|
|
6742
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6743
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6739
6744
|
}
|
|
6740
6745
|
|
|
6741
6746
|
configureMedia(media ) {
|
|
@@ -6752,13 +6757,13 @@ class WebRTCClient extends Emitter {
|
|
|
6752
6757
|
|
|
6753
6758
|
createUserAgent(configOverrides ) {
|
|
6754
6759
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6755
|
-
logger$
|
|
6760
|
+
logger$4.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6756
6761
|
|
|
6757
6762
|
webRTCConfiguration.delegate = {
|
|
6758
6763
|
onConnect: this.onConnect.bind(this),
|
|
6759
6764
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6760
6765
|
onInvite: (invitation ) => {
|
|
6761
|
-
logger$
|
|
6766
|
+
logger$4.info('sdk webrtc on invite', {
|
|
6762
6767
|
method: 'delegate.onInvite',
|
|
6763
6768
|
id: invitation.id,
|
|
6764
6769
|
remoteURI: invitation.remoteURI,
|
|
@@ -6801,7 +6806,7 @@ class WebRTCClient extends Emitter {
|
|
|
6801
6806
|
}
|
|
6802
6807
|
|
|
6803
6808
|
onConnect() {
|
|
6804
|
-
logger$
|
|
6809
|
+
logger$4.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6805
6810
|
this.eventEmitter.emit(CONNECTED);
|
|
6806
6811
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6807
6812
|
this.registerer.waitingToggle(false);
|
|
@@ -6810,7 +6815,7 @@ class WebRTCClient extends Emitter {
|
|
|
6810
6815
|
}
|
|
6811
6816
|
|
|
6812
6817
|
async onDisconnect(error ) {
|
|
6813
|
-
logger$
|
|
6818
|
+
logger$4.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6814
6819
|
this.connectionPromise = null;
|
|
6815
6820
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6816
6821
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6835,37 +6840,37 @@ class WebRTCClient extends Emitter {
|
|
|
6835
6840
|
};
|
|
6836
6841
|
|
|
6837
6842
|
if (this.skipRegister) {
|
|
6838
|
-
logger$
|
|
6843
|
+
logger$4.info('sdk webrtc skip register...', logInfo);
|
|
6839
6844
|
return Promise.resolve();
|
|
6840
6845
|
}
|
|
6841
6846
|
|
|
6842
|
-
logger$
|
|
6847
|
+
logger$4.info('sdk webrtc registering...', logInfo);
|
|
6843
6848
|
|
|
6844
6849
|
if (!this.userAgent) {
|
|
6845
|
-
logger$
|
|
6850
|
+
logger$4.info('sdk webrtc recreating User Agent');
|
|
6846
6851
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6847
6852
|
}
|
|
6848
6853
|
if (!this.userAgent || this.isRegistered()) {
|
|
6849
|
-
logger$
|
|
6854
|
+
logger$4.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6850
6855
|
return Promise.resolve();
|
|
6851
6856
|
}
|
|
6852
6857
|
|
|
6853
6858
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6854
|
-
logger$
|
|
6859
|
+
logger$4.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6855
6860
|
return Promise.resolve();
|
|
6856
6861
|
}
|
|
6857
6862
|
|
|
6858
6863
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6859
6864
|
|
|
6860
6865
|
const onRegisterFailed = () => {
|
|
6861
|
-
logger$
|
|
6866
|
+
logger$4.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6862
6867
|
this.connectionPromise = null;
|
|
6863
6868
|
if (this.registerer && this.registerer.waiting) {
|
|
6864
6869
|
this.registerer.waitingToggle(false);
|
|
6865
6870
|
}
|
|
6866
6871
|
|
|
6867
6872
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6868
|
-
logger$
|
|
6873
|
+
logger$4.info('sdk webrtc registering, retrying...', { tries });
|
|
6869
6874
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6870
6875
|
}
|
|
6871
6876
|
};
|
|
@@ -6874,18 +6879,18 @@ class WebRTCClient extends Emitter {
|
|
|
6874
6879
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6875
6880
|
// during the resolution of the primise.
|
|
6876
6881
|
if (!this.userAgent) {
|
|
6877
|
-
logger$
|
|
6882
|
+
logger$4.info('sdk webrtc recreating User Agent after connection');
|
|
6878
6883
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6879
6884
|
}
|
|
6880
6885
|
|
|
6881
|
-
logger$
|
|
6886
|
+
logger$4.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6882
6887
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
6883
6888
|
this.connectionPromise = null;
|
|
6884
6889
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6885
6890
|
|
|
6886
6891
|
// Bind registerer events
|
|
6887
6892
|
this.registerer.stateChange.addListener(newState => {
|
|
6888
|
-
logger$
|
|
6893
|
+
logger$4.info('sdk webrtc registering, state changed', { newState });
|
|
6889
6894
|
|
|
6890
6895
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
6891
6896
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -6898,7 +6903,7 @@ class WebRTCClient extends Emitter {
|
|
|
6898
6903
|
const options = {
|
|
6899
6904
|
requestDelegate: {
|
|
6900
6905
|
onReject: response => {
|
|
6901
|
-
logger$
|
|
6906
|
+
logger$4.error('sdk webrtc registering, rejected', { response });
|
|
6902
6907
|
|
|
6903
6908
|
onRegisterFailed();
|
|
6904
6909
|
},
|
|
@@ -6906,13 +6911,13 @@ class WebRTCClient extends Emitter {
|
|
|
6906
6911
|
};
|
|
6907
6912
|
|
|
6908
6913
|
return this.registerer.register(options).catch((e) => {
|
|
6909
|
-
logger$
|
|
6914
|
+
logger$4.error('sdk webrtc registering, error', e);
|
|
6910
6915
|
|
|
6911
6916
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6912
6917
|
return e;
|
|
6913
6918
|
});
|
|
6914
6919
|
}).catch(error => {
|
|
6915
|
-
logger$
|
|
6920
|
+
logger$4.error('sdk webrtc registering, transport error', error);
|
|
6916
6921
|
onRegisterFailed();
|
|
6917
6922
|
});
|
|
6918
6923
|
}
|
|
@@ -6941,21 +6946,21 @@ class WebRTCClient extends Emitter {
|
|
|
6941
6946
|
}
|
|
6942
6947
|
|
|
6943
6948
|
unregister() {
|
|
6944
|
-
logger$
|
|
6949
|
+
logger$4.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6945
6950
|
if (!this.registerer) {
|
|
6946
6951
|
return Promise.resolve();
|
|
6947
6952
|
}
|
|
6948
6953
|
|
|
6949
6954
|
try {
|
|
6950
6955
|
return this.registerer.unregister().then(() => {
|
|
6951
|
-
logger$
|
|
6956
|
+
logger$4.info('sdk webrtc unregistered');
|
|
6952
6957
|
this._cleanupRegister();
|
|
6953
6958
|
}).catch(e => {
|
|
6954
|
-
logger$
|
|
6959
|
+
logger$4.error('sdk webrtc unregistering, promise error', e);
|
|
6955
6960
|
this._cleanupRegister();
|
|
6956
6961
|
});
|
|
6957
6962
|
} catch (e) {
|
|
6958
|
-
logger$
|
|
6963
|
+
logger$4.error('sdk webrtc unregistering, error', e);
|
|
6959
6964
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6960
6965
|
// error when the registerer is in a bad state
|
|
6961
6966
|
this._cleanupRegister();
|
|
@@ -6963,7 +6968,7 @@ class WebRTCClient extends Emitter {
|
|
|
6963
6968
|
}
|
|
6964
6969
|
|
|
6965
6970
|
stop() {
|
|
6966
|
-
logger$
|
|
6971
|
+
logger$4.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6967
6972
|
if (!this.userAgent) {
|
|
6968
6973
|
return Promise.resolve();
|
|
6969
6974
|
}
|
|
@@ -6971,12 +6976,12 @@ class WebRTCClient extends Emitter {
|
|
|
6971
6976
|
return this.userAgent.stop().then(() => {
|
|
6972
6977
|
return this._cleanupRegister();
|
|
6973
6978
|
}).catch(e => {
|
|
6974
|
-
logger$
|
|
6979
|
+
logger$4.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6975
6980
|
});
|
|
6976
6981
|
}
|
|
6977
6982
|
|
|
6978
6983
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6979
|
-
logger$
|
|
6984
|
+
logger$4.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
6980
6985
|
const inviterOptions = {
|
|
6981
6986
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6982
6987
|
conference,
|
|
@@ -7007,7 +7012,7 @@ class WebRTCClient extends Emitter {
|
|
|
7007
7012
|
this._onAccepted(session, response.session, true);
|
|
7008
7013
|
},
|
|
7009
7014
|
onReject: (response ) => {
|
|
7010
|
-
logger$
|
|
7015
|
+
logger$4.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
7011
7016
|
this._stopSendingStats(session);
|
|
7012
7017
|
this.stopNetworkMonitoring(session);
|
|
7013
7018
|
|
|
@@ -7030,11 +7035,11 @@ class WebRTCClient extends Emitter {
|
|
|
7030
7035
|
}
|
|
7031
7036
|
|
|
7032
7037
|
answer(session , enableVideo ) {
|
|
7033
|
-
logger$
|
|
7038
|
+
logger$4.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
7034
7039
|
|
|
7035
7040
|
if (!session || !session.accept) {
|
|
7036
7041
|
const error = 'No session to answer, or not an invitation';
|
|
7037
|
-
logger$
|
|
7042
|
+
logger$4.warn(error);
|
|
7038
7043
|
return Promise.reject(new Error(error));
|
|
7039
7044
|
}
|
|
7040
7045
|
const options = {
|
|
@@ -7044,15 +7049,15 @@ class WebRTCClient extends Emitter {
|
|
|
7044
7049
|
return session.accept(options).then(() => {
|
|
7045
7050
|
if (session.isCanceled) {
|
|
7046
7051
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
7047
|
-
logger$
|
|
7052
|
+
logger$4.error(message, { id: session.id });
|
|
7048
7053
|
this.onCallEnded(session);
|
|
7049
7054
|
|
|
7050
7055
|
throw new CanceledCallError(message);
|
|
7051
7056
|
}
|
|
7052
|
-
logger$
|
|
7057
|
+
logger$4.info('sdk webrtc answer, accepted.');
|
|
7053
7058
|
this._onAccepted(session);
|
|
7054
7059
|
}).catch(e => {
|
|
7055
|
-
logger$
|
|
7060
|
+
logger$4.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
7056
7061
|
|
|
7057
7062
|
throw e;
|
|
7058
7063
|
});
|
|
@@ -7060,7 +7065,7 @@ class WebRTCClient extends Emitter {
|
|
|
7060
7065
|
|
|
7061
7066
|
hangup(session ) {
|
|
7062
7067
|
const { state, id } = session;
|
|
7063
|
-
logger$
|
|
7068
|
+
logger$4.info('sdk webrtc hangup call', { id, state });
|
|
7064
7069
|
|
|
7065
7070
|
try {
|
|
7066
7071
|
this._stopSendingStats(session);
|
|
@@ -7089,7 +7094,7 @@ class WebRTCClient extends Emitter {
|
|
|
7089
7094
|
|
|
7090
7095
|
return bye();
|
|
7091
7096
|
} catch (error) {
|
|
7092
|
-
logger$
|
|
7097
|
+
logger$4.warn('sdk webrtc hangup, error', error);
|
|
7093
7098
|
}
|
|
7094
7099
|
|
|
7095
7100
|
return null;
|
|
@@ -7107,7 +7112,7 @@ class WebRTCClient extends Emitter {
|
|
|
7107
7112
|
// Fetch and emit an event at `interval` with session network stats
|
|
7108
7113
|
startNetworkMonitoring(session , interval = 1000) {
|
|
7109
7114
|
const sessionId = this.getSipSessionId(session);
|
|
7110
|
-
logger$
|
|
7115
|
+
logger$4.info('starting network inspection', { id: sessionId });
|
|
7111
7116
|
|
|
7112
7117
|
this.sessionNetworkStats[sessionId] = [];
|
|
7113
7118
|
|
|
@@ -7117,7 +7122,7 @@ class WebRTCClient extends Emitter {
|
|
|
7117
7122
|
stopNetworkMonitoring(session ) {
|
|
7118
7123
|
const sessionId = this.getSipSessionId(session);
|
|
7119
7124
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
7120
|
-
logger$
|
|
7125
|
+
logger$4.info('stopping network inspection', { id: sessionId, exists });
|
|
7121
7126
|
|
|
7122
7127
|
if (exists) {
|
|
7123
7128
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -7127,17 +7132,17 @@ class WebRTCClient extends Emitter {
|
|
|
7127
7132
|
}
|
|
7128
7133
|
|
|
7129
7134
|
reject(session ) {
|
|
7130
|
-
logger$
|
|
7135
|
+
logger$4.info('sdk webrtc reject call', { id: session.id });
|
|
7131
7136
|
|
|
7132
7137
|
try {
|
|
7133
7138
|
return session.reject ? session.reject() : session.cancel();
|
|
7134
7139
|
} catch (e) {
|
|
7135
|
-
logger$
|
|
7140
|
+
logger$4.warn('Error when rejecting call', e.message, e.stack);
|
|
7136
7141
|
}
|
|
7137
7142
|
}
|
|
7138
7143
|
|
|
7139
7144
|
async close() {
|
|
7140
|
-
logger$
|
|
7145
|
+
logger$4.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
7141
7146
|
this._cleanupMedia();
|
|
7142
7147
|
this.connectionPromise = null;
|
|
7143
7148
|
|
|
@@ -7168,7 +7173,7 @@ class WebRTCClient extends Emitter {
|
|
|
7168
7173
|
// eg: "INVITE not rejectable in state Completed"
|
|
7169
7174
|
}
|
|
7170
7175
|
this.userAgent = null;
|
|
7171
|
-
logger$
|
|
7176
|
+
logger$4.info('sdk webrtc client closed');
|
|
7172
7177
|
}
|
|
7173
7178
|
|
|
7174
7179
|
getNumber(session ) {
|
|
@@ -7181,13 +7186,13 @@ class WebRTCClient extends Emitter {
|
|
|
7181
7186
|
}
|
|
7182
7187
|
|
|
7183
7188
|
mute(session ) {
|
|
7184
|
-
logger$
|
|
7189
|
+
logger$4.info('sdk webrtc mute', { id: session.id });
|
|
7185
7190
|
|
|
7186
7191
|
this._toggleAudio(session, true);
|
|
7187
7192
|
}
|
|
7188
7193
|
|
|
7189
7194
|
unmute(session ) {
|
|
7190
|
-
logger$
|
|
7195
|
+
logger$4.info('sdk webrtc unmute', { id: session.id });
|
|
7191
7196
|
|
|
7192
7197
|
this._toggleAudio(session, false);
|
|
7193
7198
|
}
|
|
@@ -7227,13 +7232,13 @@ class WebRTCClient extends Emitter {
|
|
|
7227
7232
|
}
|
|
7228
7233
|
|
|
7229
7234
|
toggleCameraOn(session ) {
|
|
7230
|
-
logger$
|
|
7235
|
+
logger$4.info('sdk webrtc toggle camera on', { id: session.id });
|
|
7231
7236
|
|
|
7232
7237
|
this._toggleVideo(session, false);
|
|
7233
7238
|
}
|
|
7234
7239
|
|
|
7235
7240
|
toggleCameraOff(session ) {
|
|
7236
|
-
logger$
|
|
7241
|
+
logger$4.info('sdk webrtc toggle camera off', { id: session.id });
|
|
7237
7242
|
|
|
7238
7243
|
this._toggleVideo(session, true);
|
|
7239
7244
|
}
|
|
@@ -7242,7 +7247,7 @@ class WebRTCClient extends Emitter {
|
|
|
7242
7247
|
const sessionId = this.getSipSessionId(session);
|
|
7243
7248
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
7244
7249
|
|
|
7245
|
-
logger$
|
|
7250
|
+
logger$4.info('sdk webrtc hold', {
|
|
7246
7251
|
sessionId,
|
|
7247
7252
|
keys: Object.keys(this.heldSessions),
|
|
7248
7253
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7291,7 +7296,7 @@ class WebRTCClient extends Emitter {
|
|
|
7291
7296
|
const sessionId = this.getSipSessionId(session);
|
|
7292
7297
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7293
7298
|
|
|
7294
|
-
logger$
|
|
7299
|
+
logger$4.info('sdk webrtc unhold', {
|
|
7295
7300
|
sessionId,
|
|
7296
7301
|
keys: Object.keys(this.heldSessions),
|
|
7297
7302
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7439,7 +7444,7 @@ class WebRTCClient extends Emitter {
|
|
|
7439
7444
|
if (!session.sessionDescriptionHandler) {
|
|
7440
7445
|
return;
|
|
7441
7446
|
}
|
|
7442
|
-
logger$
|
|
7447
|
+
logger$4.info('Sending DTMF', {
|
|
7443
7448
|
id: this.getSipSessionId(session),
|
|
7444
7449
|
tone,
|
|
7445
7450
|
});
|
|
@@ -7455,7 +7460,7 @@ class WebRTCClient extends Emitter {
|
|
|
7455
7460
|
transfer(session , target ) {
|
|
7456
7461
|
this.hold(session);
|
|
7457
7462
|
|
|
7458
|
-
logger$
|
|
7463
|
+
logger$4.info('Transfering a session', {
|
|
7459
7464
|
id: this.getSipSessionId(session),
|
|
7460
7465
|
target,
|
|
7461
7466
|
});
|
|
@@ -7477,17 +7482,17 @@ class WebRTCClient extends Emitter {
|
|
|
7477
7482
|
atxfer(session ) {
|
|
7478
7483
|
this.hold(session);
|
|
7479
7484
|
|
|
7480
|
-
logger$
|
|
7485
|
+
logger$4.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7481
7486
|
|
|
7482
7487
|
const result = {
|
|
7483
7488
|
newSession: null,
|
|
7484
7489
|
init: async (target ) => {
|
|
7485
|
-
logger$
|
|
7490
|
+
logger$4.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7486
7491
|
|
|
7487
7492
|
result.newSession = await this.call(target);
|
|
7488
7493
|
},
|
|
7489
7494
|
complete: () => {
|
|
7490
|
-
logger$
|
|
7495
|
+
logger$4.info('webrtc transfer completed', {
|
|
7491
7496
|
id: this.getSipSessionId(session),
|
|
7492
7497
|
referId: this.getSipSessionId(result.newSession),
|
|
7493
7498
|
});
|
|
@@ -7508,7 +7513,7 @@ class WebRTCClient extends Emitter {
|
|
|
7508
7513
|
return;
|
|
7509
7514
|
}
|
|
7510
7515
|
|
|
7511
|
-
logger$
|
|
7516
|
+
logger$4.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7512
7517
|
|
|
7513
7518
|
try {
|
|
7514
7519
|
sipSession.message({
|
|
@@ -7550,7 +7555,7 @@ class WebRTCClient extends Emitter {
|
|
|
7550
7555
|
}
|
|
7551
7556
|
|
|
7552
7557
|
changeAudioOutputVolume(volume ) {
|
|
7553
|
-
logger$
|
|
7558
|
+
logger$4.info('Changing audio output volume', { volume });
|
|
7554
7559
|
|
|
7555
7560
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7556
7561
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7562,7 +7567,7 @@ class WebRTCClient extends Emitter {
|
|
|
7562
7567
|
}
|
|
7563
7568
|
|
|
7564
7569
|
changeAudioOutputDevice(id ) {
|
|
7565
|
-
logger$
|
|
7570
|
+
logger$4.info('Changing audio output device', { id });
|
|
7566
7571
|
|
|
7567
7572
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7568
7573
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7579,7 +7584,7 @@ class WebRTCClient extends Emitter {
|
|
|
7579
7584
|
|
|
7580
7585
|
changeAudioInputDevice(id , session ) {
|
|
7581
7586
|
const currentId = this.getAudioDeviceId();
|
|
7582
|
-
logger$
|
|
7587
|
+
logger$4.info('setting audio input device', { id, currentId, session: !!session });
|
|
7583
7588
|
|
|
7584
7589
|
if (id === currentId) {
|
|
7585
7590
|
return null;
|
|
@@ -7625,7 +7630,7 @@ class WebRTCClient extends Emitter {
|
|
|
7625
7630
|
|
|
7626
7631
|
setVideoInputDevice(id ) {
|
|
7627
7632
|
const currentId = this.getVideoDeviceId();
|
|
7628
|
-
logger$
|
|
7633
|
+
logger$4.info('setting video input device', { id, currentId });
|
|
7629
7634
|
|
|
7630
7635
|
if (id === currentId) {
|
|
7631
7636
|
return null;
|
|
@@ -7650,7 +7655,7 @@ class WebRTCClient extends Emitter {
|
|
|
7650
7655
|
const sessionId = this.getSipSessionId(session);
|
|
7651
7656
|
const localStream = this.getLocalStream(sessionId);
|
|
7652
7657
|
|
|
7653
|
-
logger$
|
|
7658
|
+
logger$4.info('changing video input device', { id, sessionId });
|
|
7654
7659
|
|
|
7655
7660
|
// Release old video stream
|
|
7656
7661
|
if (localStream) {
|
|
@@ -7718,7 +7723,7 @@ class WebRTCClient extends Emitter {
|
|
|
7718
7723
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7719
7724
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7720
7725
|
|
|
7721
|
-
logger$
|
|
7726
|
+
logger$4.info('Sending reinvite', {
|
|
7722
7727
|
id: this.getSipSessionId(sipSession),
|
|
7723
7728
|
newConstraints,
|
|
7724
7729
|
conference,
|
|
@@ -7756,7 +7761,7 @@ class WebRTCClient extends Emitter {
|
|
|
7756
7761
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7757
7762
|
}
|
|
7758
7763
|
|
|
7759
|
-
logger$
|
|
7764
|
+
logger$4.info('on re-INVITE accepted', {
|
|
7760
7765
|
id: this.getSipSessionId(sipSession),
|
|
7761
7766
|
wasMuted,
|
|
7762
7767
|
shouldDoScreenSharing,
|
|
@@ -7774,7 +7779,7 @@ class WebRTCClient extends Emitter {
|
|
|
7774
7779
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7775
7780
|
}
|
|
7776
7781
|
|
|
7777
|
-
return this.eventEmitter.emit(ON_REINVITE
|
|
7782
|
+
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7778
7783
|
},
|
|
7779
7784
|
},
|
|
7780
7785
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7931,7 +7936,7 @@ class WebRTCClient extends Emitter {
|
|
|
7931
7936
|
}
|
|
7932
7937
|
|
|
7933
7938
|
startHeartbeat() {
|
|
7934
|
-
logger$
|
|
7939
|
+
logger$4.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7935
7940
|
if (!this.userAgent) {
|
|
7936
7941
|
this.heartbeat.stop();
|
|
7937
7942
|
return;
|
|
@@ -7944,7 +7949,7 @@ class WebRTCClient extends Emitter {
|
|
|
7944
7949
|
}
|
|
7945
7950
|
|
|
7946
7951
|
stopHeartbeat() {
|
|
7947
|
-
logger$
|
|
7952
|
+
logger$4.info('sdk webrtc stop heartbeat');
|
|
7948
7953
|
this.heartbeat.stop();
|
|
7949
7954
|
}
|
|
7950
7955
|
|
|
@@ -7965,7 +7970,7 @@ class WebRTCClient extends Emitter {
|
|
|
7965
7970
|
}
|
|
7966
7971
|
|
|
7967
7972
|
attemptReconnection() {
|
|
7968
|
-
logger$
|
|
7973
|
+
logger$4.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7969
7974
|
if (!this.userAgent) {
|
|
7970
7975
|
return;
|
|
7971
7976
|
}
|
|
@@ -7990,7 +7995,7 @@ class WebRTCClient extends Emitter {
|
|
|
7990
7995
|
return;
|
|
7991
7996
|
}
|
|
7992
7997
|
|
|
7993
|
-
logger$
|
|
7998
|
+
logger$4.info('setting local media stream', {
|
|
7994
7999
|
sipSessionId,
|
|
7995
8000
|
tracks: newStream ? newStream.getTracks() : null,
|
|
7996
8001
|
});
|
|
@@ -8007,7 +8012,7 @@ class WebRTCClient extends Emitter {
|
|
|
8007
8012
|
|
|
8008
8013
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
8009
8014
|
|
|
8010
|
-
logger$
|
|
8015
|
+
logger$4.info('updating local stream', {
|
|
8011
8016
|
sipSessionId,
|
|
8012
8017
|
oldStream: !!oldStream,
|
|
8013
8018
|
tracks: newStream.getTracks(),
|
|
@@ -8027,7 +8032,7 @@ class WebRTCClient extends Emitter {
|
|
|
8027
8032
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
8028
8033
|
const pc = this.getPeerConnection(sessionId);
|
|
8029
8034
|
|
|
8030
|
-
logger$
|
|
8035
|
+
logger$4.info('Updating remote stream', {
|
|
8031
8036
|
sessionId,
|
|
8032
8037
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
8033
8038
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -8053,7 +8058,7 @@ class WebRTCClient extends Emitter {
|
|
|
8053
8058
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
8054
8059
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
8055
8060
|
|
|
8056
|
-
logger$
|
|
8061
|
+
logger$4.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
8057
8062
|
|
|
8058
8063
|
return {
|
|
8059
8064
|
constraints: {
|
|
@@ -8102,7 +8107,7 @@ class WebRTCClient extends Emitter {
|
|
|
8102
8107
|
}
|
|
8103
8108
|
|
|
8104
8109
|
_onTransportError() {
|
|
8105
|
-
logger$
|
|
8110
|
+
logger$4.error('on transport error');
|
|
8106
8111
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
8107
8112
|
this.attemptReconnection();
|
|
8108
8113
|
}
|
|
@@ -8111,7 +8116,7 @@ class WebRTCClient extends Emitter {
|
|
|
8111
8116
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
8112
8117
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
8113
8118
|
if (this.hasHeartbeat()) {
|
|
8114
|
-
logger$
|
|
8119
|
+
logger$4.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
8115
8120
|
|
|
8116
8121
|
this.heartbeat.onHeartbeat();
|
|
8117
8122
|
if (this.heartbeatCb) {
|
|
@@ -8122,7 +8127,7 @@ class WebRTCClient extends Emitter {
|
|
|
8122
8127
|
}
|
|
8123
8128
|
|
|
8124
8129
|
async _onHeartbeatTimeout() {
|
|
8125
|
-
logger$
|
|
8130
|
+
logger$4.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
8126
8131
|
|
|
8127
8132
|
if (this.heartbeatTimeoutCb) {
|
|
8128
8133
|
this.heartbeatTimeoutCb();
|
|
@@ -8134,7 +8139,7 @@ class WebRTCClient extends Emitter {
|
|
|
8134
8139
|
try {
|
|
8135
8140
|
await this.userAgent.transport.disconnect();
|
|
8136
8141
|
} catch (e) {
|
|
8137
|
-
logger$
|
|
8142
|
+
logger$4.error('Transport disconnection after heartbeat timeout, error', e);
|
|
8138
8143
|
}
|
|
8139
8144
|
}
|
|
8140
8145
|
|
|
@@ -8167,31 +8172,31 @@ class WebRTCClient extends Emitter {
|
|
|
8167
8172
|
}
|
|
8168
8173
|
|
|
8169
8174
|
_connectIfNeeded() {
|
|
8170
|
-
logger$
|
|
8175
|
+
logger$4.info('connect if needed, checking', { connected: this.isConnected() });
|
|
8171
8176
|
if (!this.userAgent) {
|
|
8172
|
-
logger$
|
|
8177
|
+
logger$4.info('need to recreate User Agent');
|
|
8173
8178
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
8174
8179
|
}
|
|
8175
8180
|
|
|
8176
8181
|
if (this.isConnected()) {
|
|
8177
|
-
logger$
|
|
8182
|
+
logger$4.info('webrtc sdk, already connected');
|
|
8178
8183
|
return Promise.resolve();
|
|
8179
8184
|
}
|
|
8180
8185
|
|
|
8181
8186
|
if (this.isConnecting()) {
|
|
8182
|
-
logger$
|
|
8187
|
+
logger$4.info('webrtc sdk, already connecting...');
|
|
8183
8188
|
|
|
8184
8189
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
8185
8190
|
return this.connectionPromise;
|
|
8186
8191
|
}
|
|
8187
8192
|
|
|
8188
8193
|
if (this.connectionPromise) {
|
|
8189
|
-
logger$
|
|
8194
|
+
logger$4.info('webrtc sdk, connection promise connecting...');
|
|
8190
8195
|
// $FlowFixMe
|
|
8191
8196
|
return this.connectionPromise;
|
|
8192
8197
|
}
|
|
8193
8198
|
|
|
8194
|
-
logger$
|
|
8199
|
+
logger$4.info('WebRTC UA needs to connect');
|
|
8195
8200
|
|
|
8196
8201
|
// Force UA to reconnect
|
|
8197
8202
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -8316,7 +8321,7 @@ class WebRTCClient extends Emitter {
|
|
|
8316
8321
|
|
|
8317
8322
|
sdh.peerConnectionDelegate = {
|
|
8318
8323
|
onicecandidateerror: (error ) => {
|
|
8319
|
-
logger$
|
|
8324
|
+
logger$4.error('on icecandidate error', {
|
|
8320
8325
|
address: error.address,
|
|
8321
8326
|
port: error.port,
|
|
8322
8327
|
errorCode: error.errorCode,
|
|
@@ -8345,7 +8350,7 @@ class WebRTCClient extends Emitter {
|
|
|
8345
8350
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8346
8351
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8347
8352
|
}
|
|
8348
|
-
logger$
|
|
8353
|
+
logger$4.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8349
8354
|
|
|
8350
8355
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8351
8356
|
|
|
@@ -8361,12 +8366,12 @@ class WebRTCClient extends Emitter {
|
|
|
8361
8366
|
|
|
8362
8367
|
this._setupMedias(session);
|
|
8363
8368
|
|
|
8364
|
-
return this.eventEmitter.emit(ON_REINVITE
|
|
8369
|
+
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8365
8370
|
};
|
|
8366
8371
|
}
|
|
8367
8372
|
|
|
8368
8373
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8369
|
-
logger$
|
|
8374
|
+
logger$4.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8370
8375
|
|
|
8371
8376
|
this.storeSipSession(session);
|
|
8372
8377
|
|
|
@@ -8378,14 +8383,14 @@ class WebRTCClient extends Emitter {
|
|
|
8378
8383
|
const onTrack = (event ) => {
|
|
8379
8384
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8380
8385
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8381
|
-
logger$
|
|
8386
|
+
logger$4.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8382
8387
|
|
|
8383
8388
|
// Stop video track in audio only mode
|
|
8384
8389
|
if (isAudioOnly && kind === 'video') {
|
|
8385
8390
|
event.track.stop();
|
|
8386
8391
|
}
|
|
8387
8392
|
|
|
8388
|
-
this.eventEmitter.emit(ON_TRACK
|
|
8393
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8389
8394
|
};
|
|
8390
8395
|
|
|
8391
8396
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8395,9 +8400,9 @@ class WebRTCClient extends Emitter {
|
|
|
8395
8400
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8396
8401
|
|
|
8397
8402
|
pc.oniceconnectionstatechange = () => {
|
|
8398
|
-
logger$
|
|
8403
|
+
logger$4.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8399
8404
|
if (pc.iceConnectionState === 'disconnected') {
|
|
8400
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
8405
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
8401
8406
|
}
|
|
8402
8407
|
};
|
|
8403
8408
|
|
|
@@ -8568,10 +8573,10 @@ class WebRTCClient extends Emitter {
|
|
|
8568
8573
|
|
|
8569
8574
|
_stopSendingStats(session ) {
|
|
8570
8575
|
const sessionId = this.getSipSessionId(session);
|
|
8571
|
-
logger$
|
|
8576
|
+
logger$4.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8572
8577
|
|
|
8573
8578
|
if (sessionId in this.statsIntervals) {
|
|
8574
|
-
logger$
|
|
8579
|
+
logger$4.trace('Stop sending stats for call', { sessionId });
|
|
8575
8580
|
this.statsIntervals[sessionId]();
|
|
8576
8581
|
delete this.statsIntervals[sessionId];
|
|
8577
8582
|
}
|
|
@@ -8587,7 +8592,7 @@ class WebRTCClient extends Emitter {
|
|
|
8587
8592
|
try {
|
|
8588
8593
|
await this.userAgent.transport.disconnect();
|
|
8589
8594
|
} catch (e) {
|
|
8590
|
-
logger$
|
|
8595
|
+
logger$4.error('WebRTC transport disconnect, error', e);
|
|
8591
8596
|
}
|
|
8592
8597
|
}
|
|
8593
8598
|
}
|
|
@@ -8681,7 +8686,7 @@ class WebRTCClient extends Emitter {
|
|
|
8681
8686
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8682
8687
|
+ networkStats.transportSent;
|
|
8683
8688
|
|
|
8684
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
8689
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8685
8690
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8686
8691
|
}
|
|
8687
8692
|
|
|
@@ -8709,8 +8714,8 @@ const ON_CALL_FAILED = 'onCallFailed';
|
|
|
8709
8714
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8710
8715
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8711
8716
|
const ON_MESSAGE = 'onMessage';
|
|
8712
|
-
const ON_REINVITE = 'reinvite';
|
|
8713
|
-
const ON_TRACK = 'onTrack';
|
|
8717
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
8718
|
+
const ON_TRACK$1 = 'onTrack';
|
|
8714
8719
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8715
8720
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8716
8721
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8725,15 +8730,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8725
8730
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8726
8731
|
const ON_CALL_ERROR = 'onCallError';
|
|
8727
8732
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8728
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8733
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
8729
8734
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8730
8735
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8731
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
8736
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
8732
8737
|
|
|
8733
8738
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8734
8739
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8735
8740
|
|
|
8736
|
-
const events = [
|
|
8741
|
+
const events$1 = [
|
|
8737
8742
|
ON_USER_AGENT,
|
|
8738
8743
|
ON_REGISTERED,
|
|
8739
8744
|
ON_UNREGISTERED,
|
|
@@ -8751,8 +8756,8 @@ const events = [
|
|
|
8751
8756
|
ON_CALL_FAILED,
|
|
8752
8757
|
ON_CALL_ENDED,
|
|
8753
8758
|
ON_MESSAGE,
|
|
8754
|
-
ON_REINVITE,
|
|
8755
|
-
ON_TRACK,
|
|
8759
|
+
ON_REINVITE$1,
|
|
8760
|
+
ON_TRACK$1,
|
|
8756
8761
|
ON_AUDIO_STREAM,
|
|
8757
8762
|
ON_VIDEO_STREAM,
|
|
8758
8763
|
ON_REMOVE_STREAM,
|
|
@@ -8767,11 +8772,11 @@ const events = [
|
|
|
8767
8772
|
ON_CALL_ERROR,
|
|
8768
8773
|
ON_CHAT,
|
|
8769
8774
|
ON_SIGNAL,
|
|
8770
|
-
ON_NETWORK_STATS,
|
|
8771
|
-
ON_DISCONNECTED,
|
|
8775
|
+
ON_NETWORK_STATS$1,
|
|
8776
|
+
ON_DISCONNECTED$1,
|
|
8772
8777
|
];
|
|
8773
8778
|
|
|
8774
|
-
const logger$
|
|
8779
|
+
const logger$5 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8775
8780
|
|
|
8776
8781
|
class WebRTCPhone extends Emitter {
|
|
8777
8782
|
|
|
@@ -8844,7 +8849,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8844
8849
|
}).catch(error => {
|
|
8845
8850
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8846
8851
|
console.error('register error', error, error.message, error.stack);
|
|
8847
|
-
logger$
|
|
8852
|
+
logger$5.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8848
8853
|
});
|
|
8849
8854
|
}
|
|
8850
8855
|
|
|
@@ -8859,7 +8864,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8859
8864
|
if (!this.client) {
|
|
8860
8865
|
return;
|
|
8861
8866
|
}
|
|
8862
|
-
logger$
|
|
8867
|
+
logger$5.info('WebRTC phone stop');
|
|
8863
8868
|
this.client.stop();
|
|
8864
8869
|
}
|
|
8865
8870
|
|
|
@@ -8874,7 +8879,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8874
8879
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8875
8880
|
audioOnly = false, iceRestart = false) {
|
|
8876
8881
|
const sipSession = this.findSipSession(callSession);
|
|
8877
|
-
logger$
|
|
8882
|
+
logger$5.info('WebRTC phone - send reinvite', {
|
|
8878
8883
|
sessionId: sipSession ? sipSession.id : null,
|
|
8879
8884
|
constraints,
|
|
8880
8885
|
audioOnly,
|
|
@@ -8911,7 +8916,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8911
8916
|
}
|
|
8912
8917
|
|
|
8913
8918
|
startHeartbeat() {
|
|
8914
|
-
logger$
|
|
8919
|
+
logger$5.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8915
8920
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8916
8921
|
return;
|
|
8917
8922
|
}
|
|
@@ -8920,7 +8925,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8920
8925
|
}
|
|
8921
8926
|
|
|
8922
8927
|
stopHeartbeat() {
|
|
8923
|
-
logger$
|
|
8928
|
+
logger$5.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8924
8929
|
if (!this.client) {
|
|
8925
8930
|
return;
|
|
8926
8931
|
}
|
|
@@ -8937,7 +8942,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8937
8942
|
}
|
|
8938
8943
|
|
|
8939
8944
|
reconnect() {
|
|
8940
|
-
logger$
|
|
8945
|
+
logger$5.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8941
8946
|
if (!this.client) {
|
|
8942
8947
|
return;
|
|
8943
8948
|
}
|
|
@@ -8978,10 +8983,15 @@ class WebRTCPhone extends Emitter {
|
|
|
8978
8983
|
return false;
|
|
8979
8984
|
}
|
|
8980
8985
|
|
|
8981
|
-
logger$
|
|
8986
|
+
logger$5.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8982
8987
|
|
|
8983
8988
|
this.client.downgradeToAudio(sipSession);
|
|
8984
8989
|
|
|
8990
|
+
if (callSession) {
|
|
8991
|
+
callSession.cameraEnabled = false;
|
|
8992
|
+
this._updateCallSession(callSession);
|
|
8993
|
+
}
|
|
8994
|
+
|
|
8985
8995
|
if (withMessage) {
|
|
8986
8996
|
this._sendReinviteMessage(callSession, false);
|
|
8987
8997
|
}
|
|
@@ -8996,7 +9006,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8996
9006
|
return Promise.resolve(false);
|
|
8997
9007
|
}
|
|
8998
9008
|
|
|
8999
|
-
logger$
|
|
9009
|
+
logger$5.info('Upgrade to video', {
|
|
9000
9010
|
id: callSession ? callSession.getId() : null,
|
|
9001
9011
|
constraints,
|
|
9002
9012
|
isConference,
|
|
@@ -9009,6 +9019,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9009
9019
|
|
|
9010
9020
|
const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
|
|
9011
9021
|
|
|
9022
|
+
if (callSession) {
|
|
9023
|
+
callSession.cameraEnabled = true;
|
|
9024
|
+
this._updateCallSession(callSession);
|
|
9025
|
+
}
|
|
9026
|
+
|
|
9012
9027
|
// If no stream is returned, it means we have to reinvite
|
|
9013
9028
|
if (!newStream) {
|
|
9014
9029
|
return true;
|
|
@@ -9031,7 +9046,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9031
9046
|
|
|
9032
9047
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
9033
9048
|
const sipSession = this.findSipSession(callSession);
|
|
9034
|
-
logger$
|
|
9049
|
+
logger$5.info('Sending reinvite message', {
|
|
9035
9050
|
id: callSession ? callSession.getId() : null,
|
|
9036
9051
|
isUpgrade,
|
|
9037
9052
|
});
|
|
@@ -9057,7 +9072,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9057
9072
|
// Monkey patch to know when canceled with the CANCEL message
|
|
9058
9073
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
9059
9074
|
sipSession._onCancel = (message ) => {
|
|
9060
|
-
logger$
|
|
9075
|
+
logger$5.trace('on sip session canceled', { callId: message.callId });
|
|
9061
9076
|
|
|
9062
9077
|
onCancel(message);
|
|
9063
9078
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -9085,13 +9100,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9085
9100
|
this.audioOutputVolume,
|
|
9086
9101
|
);
|
|
9087
9102
|
case sessionState.SessionState.Terminating:
|
|
9088
|
-
logger$
|
|
9103
|
+
logger$5.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
9089
9104
|
|
|
9090
9105
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
9091
9106
|
|
|
9092
9107
|
break;
|
|
9093
9108
|
case sessionState.SessionState.Terminated: {
|
|
9094
|
-
logger$
|
|
9109
|
+
logger$5.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9095
9110
|
|
|
9096
9111
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9097
9112
|
const callSession = this._createCallSession(sipSession);
|
|
@@ -9113,7 +9128,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9113
9128
|
const [stream] = event.streams;
|
|
9114
9129
|
const kind = event && event.track && event.track.kind;
|
|
9115
9130
|
|
|
9116
|
-
logger$
|
|
9131
|
+
logger$5.info('on track stream called on the peer connection', {
|
|
9117
9132
|
callId: this.getSipSessionId(sipSession),
|
|
9118
9133
|
streamId: stream ? stream.id : null,
|
|
9119
9134
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -9133,7 +9148,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9133
9148
|
};
|
|
9134
9149
|
|
|
9135
9150
|
peerConnection.onremovestream = event => {
|
|
9136
|
-
logger$
|
|
9151
|
+
logger$5.info('on remove stream called on the peer connection', {
|
|
9137
9152
|
id: event.stream.id,
|
|
9138
9153
|
tracks: event.stream.getTracks(),
|
|
9139
9154
|
});
|
|
@@ -9143,7 +9158,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9143
9158
|
}
|
|
9144
9159
|
|
|
9145
9160
|
async startScreenSharing(constraints , callSession ) {
|
|
9146
|
-
logger$
|
|
9161
|
+
logger$5.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
9147
9162
|
|
|
9148
9163
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
9149
9164
|
if (!screenShareStream) {
|
|
@@ -9183,7 +9198,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9183
9198
|
return;
|
|
9184
9199
|
}
|
|
9185
9200
|
|
|
9186
|
-
logger$
|
|
9201
|
+
logger$5.info('WebRTC phone - stop screen sharing', {
|
|
9187
9202
|
restoreLocalStream,
|
|
9188
9203
|
});
|
|
9189
9204
|
|
|
@@ -9239,7 +9254,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9239
9254
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
9240
9255
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9241
9256
|
|
|
9242
|
-
logger$
|
|
9257
|
+
logger$5.info('WebRTC phone - on screensharing', {
|
|
9243
9258
|
hadVideo,
|
|
9244
9259
|
id: this.getSipSessionId(sipSession),
|
|
9245
9260
|
screenTrack,
|
|
@@ -9247,7 +9262,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9247
9262
|
|
|
9248
9263
|
if (screenTrack) {
|
|
9249
9264
|
screenTrack.onended = () => {
|
|
9250
|
-
logger$
|
|
9265
|
+
logger$5.info('WebRTC phone - on screenshare ended', {
|
|
9251
9266
|
hadVideo,
|
|
9252
9267
|
id: this.getSipSessionId(sipSession),
|
|
9253
9268
|
screenTrack,
|
|
@@ -9278,7 +9293,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9278
9293
|
}
|
|
9279
9294
|
|
|
9280
9295
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9281
|
-
logger$
|
|
9296
|
+
logger$5.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9282
9297
|
|
|
9283
9298
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9284
9299
|
this.currentSipSession = sipSession;
|
|
@@ -9296,7 +9311,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9296
9311
|
}
|
|
9297
9312
|
|
|
9298
9313
|
changeAudioDevice(id ) {
|
|
9299
|
-
logger$
|
|
9314
|
+
logger$5.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9300
9315
|
this.audioOutputDeviceId = id;
|
|
9301
9316
|
this.client.changeAudioOutputDevice(id);
|
|
9302
9317
|
}
|
|
@@ -9306,14 +9321,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9306
9321
|
}
|
|
9307
9322
|
|
|
9308
9323
|
changeRingDevice(id ) {
|
|
9309
|
-
logger$
|
|
9324
|
+
logger$5.info('WebRTC phone - changing ring device', { id });
|
|
9310
9325
|
|
|
9311
9326
|
this.audioRingDeviceId = id;
|
|
9312
9327
|
}
|
|
9313
9328
|
|
|
9314
9329
|
// volume is a value between 0 and 1
|
|
9315
9330
|
changeAudioVolume(volume ) {
|
|
9316
|
-
logger$
|
|
9331
|
+
logger$5.info('WebRTC phone - changing audio volume', { volume });
|
|
9317
9332
|
|
|
9318
9333
|
this.audioOutputVolume = volume;
|
|
9319
9334
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9321,31 +9336,31 @@ class WebRTCPhone extends Emitter {
|
|
|
9321
9336
|
|
|
9322
9337
|
// volume is a value between 0 and 1
|
|
9323
9338
|
changeRingVolume(volume ) {
|
|
9324
|
-
logger$
|
|
9339
|
+
logger$5.info('WebRTC phone - changing ring volume', { volume });
|
|
9325
9340
|
|
|
9326
9341
|
this.audioRingVolume = volume;
|
|
9327
9342
|
}
|
|
9328
9343
|
|
|
9329
9344
|
changeAudioInputDevice(id ) {
|
|
9330
|
-
logger$
|
|
9345
|
+
logger$5.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9331
9346
|
|
|
9332
9347
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9333
9348
|
}
|
|
9334
9349
|
|
|
9335
9350
|
changeVideoInputDevice(id ) {
|
|
9336
|
-
logger$
|
|
9351
|
+
logger$5.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9337
9352
|
|
|
9338
9353
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9339
9354
|
}
|
|
9340
9355
|
|
|
9341
9356
|
changeSessionVideoInputDevice(id ) {
|
|
9342
|
-
logger$
|
|
9357
|
+
logger$5.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9343
9358
|
|
|
9344
9359
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9345
9360
|
}
|
|
9346
9361
|
|
|
9347
9362
|
_onCallTerminated(sipSession ) {
|
|
9348
|
-
logger$
|
|
9363
|
+
logger$5.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9349
9364
|
|
|
9350
9365
|
const callSession = this._createCallSession(sipSession);
|
|
9351
9366
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
@@ -9379,7 +9394,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9379
9394
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9380
9395
|
|
|
9381
9396
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9382
|
-
logger$
|
|
9397
|
+
logger$5.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9383
9398
|
sipId: sipSession.id,
|
|
9384
9399
|
shouldRetrigger,
|
|
9385
9400
|
hasIncomingCallSession,
|
|
@@ -9470,37 +9485,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9470
9485
|
|
|
9471
9486
|
// Deprecated
|
|
9472
9487
|
getLocalStreamForCall(callSession ) {
|
|
9473
|
-
logger$
|
|
9488
|
+
logger$5.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9474
9489
|
|
|
9475
9490
|
return this.getLocalStream(callSession);
|
|
9476
9491
|
}
|
|
9477
9492
|
|
|
9478
9493
|
// Deprecated
|
|
9479
9494
|
getRemoteStreamForCall(callSession ) {
|
|
9480
|
-
logger$
|
|
9495
|
+
logger$5.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9481
9496
|
|
|
9482
9497
|
return this.getRemoteVideoStream(callSession);
|
|
9483
9498
|
}
|
|
9484
9499
|
|
|
9485
9500
|
getRemoteStreamsForCall(callSession ) {
|
|
9486
|
-
logger$
|
|
9501
|
+
logger$5.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9487
9502
|
|
|
9488
9503
|
return this.getRemoteStream(callSession);
|
|
9489
9504
|
}
|
|
9490
9505
|
|
|
9491
9506
|
accept(callSession , cameraEnabled ) {
|
|
9492
|
-
logger$
|
|
9507
|
+
logger$5.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9493
9508
|
if (this.currentSipSession) {
|
|
9494
9509
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9495
9510
|
}
|
|
9496
9511
|
|
|
9497
9512
|
if (!callSession) {
|
|
9498
|
-
logger$
|
|
9513
|
+
logger$5.warn('no CallSession to accept.');
|
|
9499
9514
|
return Promise.resolve(null);
|
|
9500
9515
|
}
|
|
9501
9516
|
|
|
9502
9517
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9503
|
-
logger$
|
|
9518
|
+
logger$5.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9504
9519
|
return Promise.resolve(callSession.sipCallId);
|
|
9505
9520
|
}
|
|
9506
9521
|
|
|
@@ -9512,24 +9527,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9512
9527
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9513
9528
|
if (sipSession) {
|
|
9514
9529
|
if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
|
|
9515
|
-
logger$
|
|
9530
|
+
logger$5.warn('Trying to answer a terminated sipSession.');
|
|
9516
9531
|
|
|
9517
9532
|
return Promise.resolve(null);
|
|
9518
9533
|
}
|
|
9519
9534
|
|
|
9520
|
-
logger$
|
|
9535
|
+
logger$5.info('accept call, session found', { sipId: sipSession.id });
|
|
9521
9536
|
|
|
9522
9537
|
// $FlowFixMe
|
|
9523
9538
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9524
9539
|
return callSession.sipCallId;
|
|
9525
9540
|
}).catch(e => {
|
|
9526
|
-
logger$
|
|
9541
|
+
logger$5.error(e);
|
|
9527
9542
|
this.endCurrentCall(callSession);
|
|
9528
9543
|
throw e;
|
|
9529
9544
|
});
|
|
9530
9545
|
}
|
|
9531
9546
|
|
|
9532
|
-
logger$
|
|
9547
|
+
logger$5.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9533
9548
|
|
|
9534
9549
|
return Promise.resolve(null);
|
|
9535
9550
|
}
|
|
@@ -9539,7 +9554,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9539
9554
|
}
|
|
9540
9555
|
|
|
9541
9556
|
async reject(callSession ) {
|
|
9542
|
-
logger$
|
|
9557
|
+
logger$5.info('reject WebRTC called', { id: callSession.getId() });
|
|
9543
9558
|
|
|
9544
9559
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9545
9560
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9551,14 +9566,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9551
9566
|
|
|
9552
9567
|
const sipSession = this.findSipSession(callSession);
|
|
9553
9568
|
if (sipSession) {
|
|
9554
|
-
logger$
|
|
9569
|
+
logger$5.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9555
9570
|
|
|
9556
9571
|
this.client.hangup(sipSession);
|
|
9557
9572
|
}
|
|
9558
9573
|
}
|
|
9559
9574
|
|
|
9560
9575
|
async ignore(callSession ) {
|
|
9561
|
-
logger$
|
|
9576
|
+
logger$5.info('WebRTC ignore', { id: callSession.getId() });
|
|
9562
9577
|
|
|
9563
9578
|
// kill the ring
|
|
9564
9579
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9570,14 +9585,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9570
9585
|
const sipSession = this.findSipSession(callSession);
|
|
9571
9586
|
|
|
9572
9587
|
if (sipSession) {
|
|
9573
|
-
logger$
|
|
9588
|
+
logger$5.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9574
9589
|
|
|
9575
9590
|
return this.client.atxfer(sipSession);
|
|
9576
9591
|
}
|
|
9577
9592
|
}
|
|
9578
9593
|
|
|
9579
9594
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9580
|
-
logger$
|
|
9595
|
+
logger$5.info('WebRTC hold', { id: callSession.getId() });
|
|
9581
9596
|
|
|
9582
9597
|
const sipSession = this.findSipSession(callSession);
|
|
9583
9598
|
|
|
@@ -9592,18 +9607,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9592
9607
|
}
|
|
9593
9608
|
|
|
9594
9609
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9595
|
-
logger$
|
|
9610
|
+
logger$5.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9596
9611
|
|
|
9597
9612
|
const sipSession = this.findSipSession(callSession);
|
|
9598
9613
|
if (!sipSession) {
|
|
9599
9614
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9600
9615
|
}
|
|
9601
9616
|
|
|
9602
|
-
logger$
|
|
9617
|
+
logger$5.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9603
9618
|
|
|
9604
9619
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9605
9620
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9606
|
-
logger$
|
|
9621
|
+
logger$5.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9607
9622
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9608
9623
|
}
|
|
9609
9624
|
|
|
@@ -9628,7 +9643,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9628
9643
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9629
9644
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9630
9645
|
|
|
9631
|
-
logger$
|
|
9646
|
+
logger$5.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9632
9647
|
|
|
9633
9648
|
// Stop screenshre if needed
|
|
9634
9649
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9659,7 +9674,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9659
9674
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9660
9675
|
}
|
|
9661
9676
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9662
|
-
logger$
|
|
9677
|
+
logger$5.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9663
9678
|
|
|
9664
9679
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9665
9680
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9703,14 +9718,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9703
9718
|
}
|
|
9704
9719
|
|
|
9705
9720
|
mute(callSession , withEvent = true) {
|
|
9706
|
-
logger$
|
|
9721
|
+
logger$5.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9707
9722
|
|
|
9708
9723
|
const sipSession = this.findSipSession(callSession);
|
|
9709
9724
|
if (!sipSession) {
|
|
9710
9725
|
return;
|
|
9711
9726
|
}
|
|
9712
9727
|
|
|
9713
|
-
logger$
|
|
9728
|
+
logger$5.info('WebRTC muting', { sipId: sipSession.id });
|
|
9714
9729
|
this.client.mute(sipSession);
|
|
9715
9730
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9716
9731
|
|
|
@@ -9724,14 +9739,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9724
9739
|
}
|
|
9725
9740
|
|
|
9726
9741
|
unmute(callSession , withEvent = true) {
|
|
9727
|
-
logger$
|
|
9742
|
+
logger$5.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9728
9743
|
|
|
9729
9744
|
const sipSession = this.findSipSession(callSession);
|
|
9730
9745
|
if (!sipSession) {
|
|
9731
9746
|
return;
|
|
9732
9747
|
}
|
|
9733
9748
|
|
|
9734
|
-
logger$
|
|
9749
|
+
logger$5.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9735
9750
|
this.client.unmute(sipSession);
|
|
9736
9751
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9737
9752
|
|
|
@@ -9758,7 +9773,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9758
9773
|
if (!sipSession) {
|
|
9759
9774
|
return;
|
|
9760
9775
|
}
|
|
9761
|
-
logger$
|
|
9776
|
+
logger$5.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9762
9777
|
|
|
9763
9778
|
this.client.toggleCameraOn(sipSession);
|
|
9764
9779
|
|
|
@@ -9770,7 +9785,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9770
9785
|
if (!sipSession) {
|
|
9771
9786
|
return;
|
|
9772
9787
|
}
|
|
9773
|
-
logger$
|
|
9788
|
+
logger$5.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9774
9789
|
|
|
9775
9790
|
this.client.toggleCameraOff(sipSession);
|
|
9776
9791
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9782,7 +9797,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9782
9797
|
return;
|
|
9783
9798
|
}
|
|
9784
9799
|
|
|
9785
|
-
logger$
|
|
9800
|
+
logger$5.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9786
9801
|
this.client.sendDTMF(sipSession, tone);
|
|
9787
9802
|
}
|
|
9788
9803
|
|
|
@@ -9790,7 +9805,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9790
9805
|
// @TODO: line is not used here
|
|
9791
9806
|
async makeCall(number , line , cameraEnabled ,
|
|
9792
9807
|
audioOnly = false, conference = false) {
|
|
9793
|
-
logger$
|
|
9808
|
+
logger$5.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
|
|
9794
9809
|
if (!number) {
|
|
9795
9810
|
return Promise.resolve(null);
|
|
9796
9811
|
}
|
|
@@ -9800,7 +9815,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9800
9815
|
}
|
|
9801
9816
|
if (this.currentSipSession) {
|
|
9802
9817
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9803
|
-
logger$
|
|
9818
|
+
logger$5.warn('Unable to hold current session when making another call', e);
|
|
9804
9819
|
});
|
|
9805
9820
|
}
|
|
9806
9821
|
|
|
@@ -9810,7 +9825,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9810
9825
|
this._bindEvents(sipSession);
|
|
9811
9826
|
} catch (error) {
|
|
9812
9827
|
console.warn(error);
|
|
9813
|
-
logger$
|
|
9828
|
+
logger$5.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9814
9829
|
return Promise.resolve(null);
|
|
9815
9830
|
}
|
|
9816
9831
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
@@ -9838,7 +9853,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9838
9853
|
return;
|
|
9839
9854
|
}
|
|
9840
9855
|
|
|
9841
|
-
logger$
|
|
9856
|
+
logger$5.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9842
9857
|
|
|
9843
9858
|
this.client.transfer(sipSession, target);
|
|
9844
9859
|
}
|
|
@@ -9847,7 +9862,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9847
9862
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9848
9863
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9849
9864
|
|
|
9850
|
-
logger$
|
|
9865
|
+
logger$5.info('WebRTC indirect transfer', {
|
|
9851
9866
|
sipId: sipSession ? sipSession.id : null,
|
|
9852
9867
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9853
9868
|
});
|
|
@@ -9886,7 +9901,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9886
9901
|
return false;
|
|
9887
9902
|
}
|
|
9888
9903
|
|
|
9889
|
-
logger$
|
|
9904
|
+
logger$5.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9890
9905
|
|
|
9891
9906
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9892
9907
|
|
|
@@ -9932,7 +9947,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9932
9947
|
endCurrentCall(callSession ) {
|
|
9933
9948
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9934
9949
|
|
|
9935
|
-
logger$
|
|
9950
|
+
logger$5.info('Ending current call', {
|
|
9936
9951
|
id: callSession ? callSession.getId() : null,
|
|
9937
9952
|
isCurrent,
|
|
9938
9953
|
});
|
|
@@ -9956,7 +9971,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9956
9971
|
}
|
|
9957
9972
|
|
|
9958
9973
|
async close() {
|
|
9959
|
-
logger$
|
|
9974
|
+
logger$5.info('WebRTC close');
|
|
9960
9975
|
|
|
9961
9976
|
try {
|
|
9962
9977
|
await Promise.race([
|
|
@@ -9964,7 +9979,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9964
9979
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9965
9980
|
]);
|
|
9966
9981
|
} catch (e) {
|
|
9967
|
-
logger$
|
|
9982
|
+
logger$5.error('WebRTC close, unregister error', e);
|
|
9968
9983
|
}
|
|
9969
9984
|
|
|
9970
9985
|
this.client.close();
|
|
@@ -9982,12 +9997,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9982
9997
|
}
|
|
9983
9998
|
|
|
9984
9999
|
enableRinging() {
|
|
9985
|
-
logger$
|
|
10000
|
+
logger$5.info('WebRTC enable ringing');
|
|
9986
10001
|
this.ringingEnabled = true;
|
|
9987
10002
|
}
|
|
9988
10003
|
|
|
9989
10004
|
disableRinging() {
|
|
9990
|
-
logger$
|
|
10005
|
+
logger$5.info('WebRTC disable ringing');
|
|
9991
10006
|
this.ringingEnabled = false;
|
|
9992
10007
|
}
|
|
9993
10008
|
|
|
@@ -10027,7 +10042,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10027
10042
|
|
|
10028
10043
|
// Deprecated
|
|
10029
10044
|
getLocalMediaStream(callSession ) {
|
|
10030
|
-
logger$
|
|
10045
|
+
logger$5.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
10031
10046
|
return this.getLocalStream(callSession);
|
|
10032
10047
|
}
|
|
10033
10048
|
|
|
@@ -10069,7 +10084,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10069
10084
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
10070
10085
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
10071
10086
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
10072
|
-
logger$
|
|
10087
|
+
logger$5.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
10073
10088
|
|
|
10074
10089
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
10075
10090
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -10092,7 +10107,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10092
10107
|
});
|
|
10093
10108
|
|
|
10094
10109
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
10095
|
-
logger$
|
|
10110
|
+
logger$5.info('WebRTC on reinvite', {
|
|
10096
10111
|
sessionId: args[0].id,
|
|
10097
10112
|
inviteId: args[1].id,
|
|
10098
10113
|
updatedCalleeName: args[2],
|
|
@@ -10112,7 +10127,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10112
10127
|
});
|
|
10113
10128
|
|
|
10114
10129
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
10115
|
-
logger$
|
|
10130
|
+
logger$5.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
10116
10131
|
|
|
10117
10132
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
10118
10133
|
|
|
@@ -10123,22 +10138,22 @@ class WebRTCPhone extends Emitter {
|
|
|
10123
10138
|
this.client.on('ended', () => {});
|
|
10124
10139
|
|
|
10125
10140
|
this.client.on(this.client.ON_ERROR, e => {
|
|
10126
|
-
logger$
|
|
10141
|
+
logger$5.error('WebRTC error', e);
|
|
10127
10142
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10128
10143
|
});
|
|
10129
10144
|
|
|
10130
10145
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10131
|
-
logger$
|
|
10146
|
+
logger$5.info('WebRTC unregistered');
|
|
10132
10147
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10133
10148
|
});
|
|
10134
10149
|
|
|
10135
10150
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
10136
|
-
logger$
|
|
10137
|
-
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10151
|
+
logger$5.info('WebRTC disconnected');
|
|
10152
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
10138
10153
|
});
|
|
10139
10154
|
|
|
10140
10155
|
this.client.on(this.client.REGISTERED, () => {
|
|
10141
|
-
logger$
|
|
10156
|
+
logger$5.info('WebRTC registered', {
|
|
10142
10157
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
10143
10158
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
10144
10159
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -10151,23 +10166,27 @@ class WebRTCPhone extends Emitter {
|
|
|
10151
10166
|
if (this.shouldSendReinvite && this.currentSipSession
|
|
10152
10167
|
&& this.currentSipSession.state === sessionState.SessionState.Established) {
|
|
10153
10168
|
this.shouldSendReinvite = false;
|
|
10169
|
+
const pc = this.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
10170
|
+
const isConference = pc ? pc.sfu : false;
|
|
10171
|
+
const hasVideo = this.currentCallSession && this.currentCallSession.cameraEnabled;
|
|
10172
|
+
|
|
10154
10173
|
try {
|
|
10155
10174
|
// Send reinvite with iceRestart
|
|
10156
|
-
this.sendReinvite(this.currentCallSession, null,
|
|
10175
|
+
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10157
10176
|
} catch (e) {
|
|
10158
|
-
logger$
|
|
10177
|
+
logger$5.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10159
10178
|
}
|
|
10160
10179
|
}
|
|
10161
10180
|
});
|
|
10162
10181
|
|
|
10163
10182
|
this.client.on(this.client.CONNECTED, () => {
|
|
10164
|
-
logger$
|
|
10183
|
+
logger$5.info('WebRTC client connected');
|
|
10165
10184
|
|
|
10166
10185
|
this.stopHeartbeat();
|
|
10167
10186
|
});
|
|
10168
10187
|
|
|
10169
10188
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
10170
|
-
logger$
|
|
10189
|
+
logger$5.info('WebRTC client disconnected');
|
|
10171
10190
|
|
|
10172
10191
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10173
10192
|
|
|
@@ -10181,7 +10200,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10181
10200
|
});
|
|
10182
10201
|
|
|
10183
10202
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
10184
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
10203
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
10185
10204
|
});
|
|
10186
10205
|
|
|
10187
10206
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -10196,7 +10215,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10196
10215
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
10197
10216
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
10198
10217
|
|
|
10199
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
10218
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, callSession, stats, previousStats);
|
|
10200
10219
|
});
|
|
10201
10220
|
|
|
10202
10221
|
// Used when upgrading directly in screenshare mode
|
|
@@ -10205,7 +10224,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10205
10224
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
10206
10225
|
const callSession = this.callSessions[sipSessionId];
|
|
10207
10226
|
|
|
10208
|
-
logger$
|
|
10227
|
+
logger$5.info('Updrading directly in screensharing mode', {
|
|
10209
10228
|
sipSessionId,
|
|
10210
10229
|
tracks: localStream ? localStream.getTracks() : null,
|
|
10211
10230
|
});
|
|
@@ -10237,6 +10256,15 @@ class WebRTCPhone extends Emitter {
|
|
|
10237
10256
|
return this.client.getSipSessionId(sipSession);
|
|
10238
10257
|
}
|
|
10239
10258
|
|
|
10259
|
+
_updateCallSession(callSession ) {
|
|
10260
|
+
const sipSession = this.findSipSession(callSession);
|
|
10261
|
+
const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
|
|
10262
|
+
|
|
10263
|
+
if (sipSessionId) {
|
|
10264
|
+
this.callSessions[sipSessionId] = callSession;
|
|
10265
|
+
}
|
|
10266
|
+
}
|
|
10267
|
+
|
|
10240
10268
|
_onMessage(message ) {
|
|
10241
10269
|
if (!message || message.method !== 'MESSAGE') {
|
|
10242
10270
|
return;
|
|
@@ -10374,8 +10402,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10374
10402
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10375
10403
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10376
10404
|
ON_MESSAGE: ON_MESSAGE,
|
|
10377
|
-
ON_REINVITE: ON_REINVITE,
|
|
10378
|
-
ON_TRACK: ON_TRACK,
|
|
10405
|
+
ON_REINVITE: ON_REINVITE$1,
|
|
10406
|
+
ON_TRACK: ON_TRACK$1,
|
|
10379
10407
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10380
10408
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10381
10409
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10390,13 +10418,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10390
10418
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10391
10419
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10392
10420
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10393
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10421
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS$1,
|
|
10394
10422
|
ON_CHAT: ON_CHAT,
|
|
10395
10423
|
ON_SIGNAL: ON_SIGNAL,
|
|
10396
|
-
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10424
|
+
ON_DISCONNECTED: ON_DISCONNECTED$1,
|
|
10397
10425
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10398
10426
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10399
|
-
events: events,
|
|
10427
|
+
events: events$1,
|
|
10400
10428
|
'default': WebRTCPhone
|
|
10401
10429
|
});
|
|
10402
10430
|
|
|
@@ -10790,7 +10818,7 @@ class Phone extends Emitter {
|
|
|
10790
10818
|
|
|
10791
10819
|
_transferEvents() {
|
|
10792
10820
|
this.unbind();
|
|
10793
|
-
[...events
|
|
10821
|
+
[...events, ...transportEvents].forEach(event => {
|
|
10794
10822
|
this.client.on(event, (...args) =>
|
|
10795
10823
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
10796
10824
|
});
|
|
@@ -10812,7 +10840,7 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
10812
10840
|
|
|
10813
10841
|
//
|
|
10814
10842
|
|
|
10815
|
-
const SOCKET_EVENTS
|
|
10843
|
+
const SOCKET_EVENTS = {
|
|
10816
10844
|
ON_OPEN: 'onopen',
|
|
10817
10845
|
ON_MESSAGE: 'onmessage',
|
|
10818
10846
|
ON_ERROR: 'onerror',
|
|
@@ -10908,7 +10936,7 @@ const BLACKLIST_EVENTS = [
|
|
|
10908
10936
|
];
|
|
10909
10937
|
|
|
10910
10938
|
const HEARTBEAT_ENGINE_VERSION = '20.09';
|
|
10911
|
-
const logger$
|
|
10939
|
+
const logger$7 = IssueReporter$1.loggerFor('wazo-ws');
|
|
10912
10940
|
const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
|
|
10913
10941
|
|
|
10914
10942
|
class WebSocketClient extends Emitter {
|
|
@@ -10957,24 +10985,24 @@ class WebSocketClient extends Emitter {
|
|
|
10957
10985
|
}
|
|
10958
10986
|
|
|
10959
10987
|
connect() {
|
|
10960
|
-
logger$
|
|
10988
|
+
logger$7.info('connect method started', { host: this.host, token: this.token });
|
|
10961
10989
|
this.socket = new ReconnectingWebSocket__default['default'](this._getUrl.bind(this), [], this.options);
|
|
10962
10990
|
if (this.options.binaryType) {
|
|
10963
10991
|
this.socket.binaryType = this.options.binaryType;
|
|
10964
10992
|
}
|
|
10965
10993
|
|
|
10966
10994
|
this.socket.onopen = () => {
|
|
10967
|
-
logger$
|
|
10968
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
10995
|
+
logger$7.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
10996
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
10969
10997
|
};
|
|
10970
10998
|
|
|
10971
10999
|
this.socket.onerror = event => {
|
|
10972
|
-
logger$
|
|
10973
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11000
|
+
logger$7.error('on Wazo WS error', event.target);
|
|
11001
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
10974
11002
|
};
|
|
10975
11003
|
|
|
10976
11004
|
this.socket.onmessage = (event ) => {
|
|
10977
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11005
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
10978
11006
|
|
|
10979
11007
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
10980
11008
|
let { name } = message;
|
|
@@ -10999,7 +11027,7 @@ class WebSocketClient extends Emitter {
|
|
|
10999
11027
|
|
|
11000
11028
|
this.socket.onclose = event => {
|
|
11001
11029
|
// Can't be converted to JSON (circular structure)
|
|
11002
|
-
logger$
|
|
11030
|
+
logger$7.info('on Wazo WS close', {
|
|
11003
11031
|
reason: event.reason,
|
|
11004
11032
|
code: event.code,
|
|
11005
11033
|
readyState: event.target.readyState,
|
|
@@ -11007,22 +11035,22 @@ class WebSocketClient extends Emitter {
|
|
|
11007
11035
|
token: this.token,
|
|
11008
11036
|
});
|
|
11009
11037
|
this.initialized = false;
|
|
11010
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11038
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
11011
11039
|
|
|
11012
11040
|
switch (event.code) {
|
|
11013
11041
|
case 4002:
|
|
11014
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11042
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
11015
11043
|
break;
|
|
11016
11044
|
}
|
|
11017
11045
|
};
|
|
11018
11046
|
|
|
11019
11047
|
this.socket.onerror = event => {
|
|
11020
|
-
logger$
|
|
11048
|
+
logger$7.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
|
|
11021
11049
|
};
|
|
11022
11050
|
}
|
|
11023
11051
|
|
|
11024
11052
|
close(force = false) {
|
|
11025
|
-
logger$
|
|
11053
|
+
logger$7.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
|
|
11026
11054
|
|
|
11027
11055
|
if (!this.socket) {
|
|
11028
11056
|
return;
|
|
@@ -11040,7 +11068,7 @@ class WebSocketClient extends Emitter {
|
|
|
11040
11068
|
|
|
11041
11069
|
updateToken(token ) {
|
|
11042
11070
|
this.token = token;
|
|
11043
|
-
logger$
|
|
11071
|
+
logger$7.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
|
|
11044
11072
|
|
|
11045
11073
|
if (this.socket) {
|
|
11046
11074
|
// If still connected, send the token to the WS
|
|
@@ -11058,7 +11086,7 @@ class WebSocketClient extends Emitter {
|
|
|
11058
11086
|
}
|
|
11059
11087
|
|
|
11060
11088
|
startHeartbeat() {
|
|
11061
|
-
logger$
|
|
11089
|
+
logger$7.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
|
|
11062
11090
|
|
|
11063
11091
|
if (!this.socket) {
|
|
11064
11092
|
this.heartbeat.stop();
|
|
@@ -11072,7 +11100,7 @@ class WebSocketClient extends Emitter {
|
|
|
11072
11100
|
}
|
|
11073
11101
|
|
|
11074
11102
|
stopHeartbeat() {
|
|
11075
|
-
logger$
|
|
11103
|
+
logger$7.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
|
|
11076
11104
|
|
|
11077
11105
|
this.heartbeat.stop();
|
|
11078
11106
|
}
|
|
@@ -11102,7 +11130,7 @@ class WebSocketClient extends Emitter {
|
|
|
11102
11130
|
}
|
|
11103
11131
|
|
|
11104
11132
|
reconnect(reason ) {
|
|
11105
|
-
logger$
|
|
11133
|
+
logger$7.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
|
|
11106
11134
|
if (!this.socket) {
|
|
11107
11135
|
return;
|
|
11108
11136
|
}
|
|
@@ -11127,7 +11155,7 @@ class WebSocketClient extends Emitter {
|
|
|
11127
11155
|
break;
|
|
11128
11156
|
case 'start':
|
|
11129
11157
|
this.initialized = true;
|
|
11130
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11158
|
+
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
11131
11159
|
break;
|
|
11132
11160
|
default:
|
|
11133
11161
|
this.eventEmitter.emit('message', message);
|
|
@@ -11158,7 +11186,7 @@ class WebSocketClient extends Emitter {
|
|
|
11158
11186
|
this.close();
|
|
11159
11187
|
}
|
|
11160
11188
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
11161
|
-
logger$
|
|
11189
|
+
logger$7.log('Wazo WS url computed to reconnect', { url });
|
|
11162
11190
|
|
|
11163
11191
|
return url;
|
|
11164
11192
|
}
|
|
@@ -11166,15 +11194,15 @@ class WebSocketClient extends Emitter {
|
|
|
11166
11194
|
_onHeartbeat(message ) {
|
|
11167
11195
|
if (message.payload === 'pong') {
|
|
11168
11196
|
this.heartbeat.onHeartbeat();
|
|
11169
|
-
logger$
|
|
11197
|
+
logger$7.log('on heartbeat received from Wazo WS');
|
|
11170
11198
|
}
|
|
11171
11199
|
}
|
|
11172
11200
|
|
|
11173
11201
|
async _onHeartbeatTimeout() {
|
|
11174
|
-
logger$
|
|
11202
|
+
logger$7.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
11175
11203
|
|
|
11176
11204
|
this.close();
|
|
11177
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11205
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11178
11206
|
|
|
11179
11207
|
if (this.onHeartBeatTimeout) {
|
|
11180
11208
|
this.onHeartBeatTimeout();
|
|
@@ -11254,7 +11282,7 @@ WebSocketClient.eventLists = [
|
|
|
11254
11282
|
|
|
11255
11283
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
11256
11284
|
__proto__: null,
|
|
11257
|
-
SOCKET_EVENTS: SOCKET_EVENTS
|
|
11285
|
+
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
11258
11286
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
11259
11287
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
11260
11288
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -11327,10 +11355,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11327
11355
|
|
|
11328
11356
|
//
|
|
11329
11357
|
|
|
11330
|
-
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11331
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
11358
|
+
const { SOCKET_EVENTS: SOCKET_EVENTS$1, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11359
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS$1), ...Object.values(OTHER_EVENTS)];
|
|
11332
11360
|
|
|
11333
|
-
const logger$
|
|
11361
|
+
const logger$8 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
11334
11362
|
|
|
11335
11363
|
class Websocket extends Emitter {
|
|
11336
11364
|
|
|
@@ -11344,9 +11372,9 @@ class Websocket extends Emitter {
|
|
|
11344
11372
|
// $FlowFixMe
|
|
11345
11373
|
this[key] = OTHER_EVENTS[key];
|
|
11346
11374
|
});
|
|
11347
|
-
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
11375
|
+
Object.keys(SOCKET_EVENTS$1).forEach(key => {
|
|
11348
11376
|
// $FlowFixMe
|
|
11349
|
-
this[key] = SOCKET_EVENTS[key];
|
|
11377
|
+
this[key] = SOCKET_EVENTS$1[key];
|
|
11350
11378
|
});
|
|
11351
11379
|
this.eventLists = WebSocketClient.eventLists;
|
|
11352
11380
|
|
|
@@ -11354,7 +11382,7 @@ class Websocket extends Emitter {
|
|
|
11354
11382
|
}
|
|
11355
11383
|
|
|
11356
11384
|
open(host , session ) {
|
|
11357
|
-
logger$
|
|
11385
|
+
logger$8.info('open simple WebSocket', { host, token: session.token });
|
|
11358
11386
|
this.ws = new WebSocketClient(
|
|
11359
11387
|
{
|
|
11360
11388
|
host,
|
|
@@ -11382,7 +11410,7 @@ class Websocket extends Emitter {
|
|
|
11382
11410
|
}
|
|
11383
11411
|
|
|
11384
11412
|
updateToken(token ) {
|
|
11385
|
-
logger$
|
|
11413
|
+
logger$8.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
11386
11414
|
|
|
11387
11415
|
if (!this.ws) {
|
|
11388
11416
|
return;
|
|
@@ -11410,12 +11438,12 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11410
11438
|
|
|
11411
11439
|
//
|
|
11412
11440
|
|
|
11413
|
-
const logger$
|
|
11441
|
+
const logger$9 = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
11414
11442
|
|
|
11415
|
-
class SipRoom extends Room {
|
|
11443
|
+
class SipRoom extends Room$1 {
|
|
11416
11444
|
|
|
11417
11445
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
11418
|
-
logger$
|
|
11446
|
+
logger$9.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
11419
11447
|
|
|
11420
11448
|
if (!room) {
|
|
11421
11449
|
await Wazo.Phone.connect();
|
|
@@ -11431,7 +11459,7 @@ class SipRoom extends Room {
|
|
|
11431
11459
|
room.setCallId(room.callSession.call.id);
|
|
11432
11460
|
}
|
|
11433
11461
|
|
|
11434
|
-
logger$
|
|
11462
|
+
logger$9.info('connected to room', {
|
|
11435
11463
|
extension: room.extension,
|
|
11436
11464
|
});
|
|
11437
11465
|
|
|
@@ -11439,7 +11467,7 @@ class SipRoom extends Room {
|
|
|
11439
11467
|
}
|
|
11440
11468
|
|
|
11441
11469
|
mute() {
|
|
11442
|
-
logger$
|
|
11470
|
+
logger$9.info('mute sip room');
|
|
11443
11471
|
|
|
11444
11472
|
Wazo.Phone.mute(this.callSession, false);
|
|
11445
11473
|
|
|
@@ -11447,7 +11475,7 @@ class SipRoom extends Room {
|
|
|
11447
11475
|
}
|
|
11448
11476
|
|
|
11449
11477
|
unmute() {
|
|
11450
|
-
logger$
|
|
11478
|
+
logger$9.info('unmute sip room');
|
|
11451
11479
|
|
|
11452
11480
|
Wazo.Phone.unmute(this.callSession, false);
|
|
11453
11481
|
|
|
@@ -11747,7 +11775,7 @@ class NotificationOptions {
|
|
|
11747
11775
|
|
|
11748
11776
|
|
|
11749
11777
|
// Represents a conference room, like `9000`.
|
|
11750
|
-
class Room
|
|
11778
|
+
class Room {
|
|
11751
11779
|
|
|
11752
11780
|
|
|
11753
11781
|
|
|
@@ -11768,7 +11796,7 @@ class Room$1 {
|
|
|
11768
11796
|
}
|
|
11769
11797
|
|
|
11770
11798
|
connect(callSession ) {
|
|
11771
|
-
return new Room
|
|
11799
|
+
return new Room({ ...this, connectedCallSession: callSession });
|
|
11772
11800
|
}
|
|
11773
11801
|
|
|
11774
11802
|
has(callSession ) {
|
|
@@ -11777,7 +11805,7 @@ class Room$1 {
|
|
|
11777
11805
|
|
|
11778
11806
|
addParticipant(uuid , extension , talking = null) {
|
|
11779
11807
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
11780
|
-
return new Room
|
|
11808
|
+
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
11781
11809
|
}
|
|
11782
11810
|
|
|
11783
11811
|
return this;
|
|
@@ -11796,7 +11824,7 @@ class Room$1 {
|
|
|
11796
11824
|
updatedParticipants.push(participant);
|
|
11797
11825
|
}
|
|
11798
11826
|
|
|
11799
|
-
return new Room
|
|
11827
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
11800
11828
|
}
|
|
11801
11829
|
|
|
11802
11830
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -11812,7 +11840,7 @@ class Room$1 {
|
|
|
11812
11840
|
updatedParticipants.push(participant);
|
|
11813
11841
|
}
|
|
11814
11842
|
|
|
11815
|
-
return new Room
|
|
11843
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
11816
11844
|
}
|
|
11817
11845
|
|
|
11818
11846
|
hasCallWithId(id ) {
|
|
@@ -11820,18 +11848,18 @@ class Room$1 {
|
|
|
11820
11848
|
}
|
|
11821
11849
|
|
|
11822
11850
|
disconnect() {
|
|
11823
|
-
return new Room
|
|
11851
|
+
return new Room({ ...this, connectedCallSession: null });
|
|
11824
11852
|
}
|
|
11825
11853
|
|
|
11826
11854
|
removeParticipantWithUUID(uuid ) {
|
|
11827
|
-
return new Room
|
|
11855
|
+
return new Room({
|
|
11828
11856
|
...this,
|
|
11829
11857
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
11830
11858
|
});
|
|
11831
11859
|
}
|
|
11832
11860
|
|
|
11833
11861
|
removeParticipantWithExtension(extension ) {
|
|
11834
|
-
return new Room
|
|
11862
|
+
return new Room({
|
|
11835
11863
|
...this,
|
|
11836
11864
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
11837
11865
|
});
|
|
@@ -11842,7 +11870,7 @@ class Room$1 {
|
|
|
11842
11870
|
}
|
|
11843
11871
|
|
|
11844
11872
|
static newFrom(room ) {
|
|
11845
|
-
return newFrom(room, Room
|
|
11873
|
+
return newFrom(room, Room);
|
|
11846
11874
|
}
|
|
11847
11875
|
}
|
|
11848
11876
|
|
|
@@ -12149,11 +12177,11 @@ var wazoWebsocket = {
|
|
|
12149
12177
|
resolve();
|
|
12150
12178
|
};
|
|
12151
12179
|
|
|
12152
|
-
client.on(SOCKET_EVENTS
|
|
12180
|
+
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
12153
12181
|
handleError(`Connection error : ${error}`);
|
|
12154
12182
|
});
|
|
12155
12183
|
|
|
12156
|
-
client.on(SOCKET_EVENTS
|
|
12184
|
+
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
12157
12185
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
12158
12186
|
client.setOnHeartbeatTimeout(() => {
|
|
12159
12187
|
handleError('No response to heartbeat');
|
|
@@ -12254,7 +12282,7 @@ var webrtc = {
|
|
|
12254
12282
|
}),
|
|
12255
12283
|
};
|
|
12256
12284
|
|
|
12257
|
-
const parseCandidate = line => {
|
|
12285
|
+
const parseCandidate$1 = line => {
|
|
12258
12286
|
let parts;
|
|
12259
12287
|
// Parse both variants.
|
|
12260
12288
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -12345,7 +12373,7 @@ var SymmetricNat = {
|
|
|
12345
12373
|
}
|
|
12346
12374
|
|
|
12347
12375
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
12348
|
-
const cand = parseCandidate(e.candidate.candidate);
|
|
12376
|
+
const cand = parseCandidate$1(e.candidate.candidate);
|
|
12349
12377
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
12350
12378
|
candidates[cand.relatedPort].push(cand.port);
|
|
12351
12379
|
} else if (!e.candidate) {
|
|
@@ -12413,7 +12441,7 @@ var iceIpv4 = {
|
|
|
12413
12441
|
const rawCandidate = e.candidate.candidate;
|
|
12414
12442
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
12415
12443
|
hasSrflxOrRelay = true;
|
|
12416
|
-
const candidate = parseCandidate(e.candidate.candidate);
|
|
12444
|
+
const candidate = parseCandidate$1(e.candidate.candidate);
|
|
12417
12445
|
ips.push(candidate.ip);
|
|
12418
12446
|
}
|
|
12419
12447
|
} else if (!e.candidate) {
|
|
@@ -12450,7 +12478,7 @@ var checks = [
|
|
|
12450
12478
|
|
|
12451
12479
|
//
|
|
12452
12480
|
|
|
12453
|
-
const logger$
|
|
12481
|
+
const logger$a = IssueReporter$1.loggerFor('engine-check');
|
|
12454
12482
|
|
|
12455
12483
|
class Checker {
|
|
12456
12484
|
|
|
@@ -12468,28 +12496,28 @@ class Checker {
|
|
|
12468
12496
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
12469
12497
|
await this._addEngineVersion();
|
|
12470
12498
|
|
|
12471
|
-
logger$
|
|
12499
|
+
logger$a.info('Engine check starting');
|
|
12472
12500
|
|
|
12473
12501
|
for (let i = 0; i < this.checks.length; i++) {
|
|
12474
12502
|
const { name, check } = this.checks[i];
|
|
12475
12503
|
|
|
12476
|
-
logger$
|
|
12504
|
+
logger$a.info(`Checking ${name} ...`);
|
|
12477
12505
|
|
|
12478
12506
|
onCheckBegin(name);
|
|
12479
12507
|
try {
|
|
12480
12508
|
// eslint-disable-next-line no-await-in-loop
|
|
12481
12509
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
12482
|
-
logger$
|
|
12510
|
+
logger$a.info(`Checking ${name} success.`, { result });
|
|
12483
12511
|
|
|
12484
12512
|
onCheckResult(name, result);
|
|
12485
12513
|
} catch (e) {
|
|
12486
|
-
logger$
|
|
12514
|
+
logger$a.info(`Checking ${name} failure`, { message: e.message });
|
|
12487
12515
|
|
|
12488
12516
|
onCheckResult(name, e);
|
|
12489
12517
|
}
|
|
12490
12518
|
}
|
|
12491
12519
|
|
|
12492
|
-
logger$
|
|
12520
|
+
logger$a.info('Engine check done.');
|
|
12493
12521
|
}
|
|
12494
12522
|
|
|
12495
12523
|
addCheck(check ) {
|
|
@@ -12513,7 +12541,7 @@ const Wazo = {
|
|
|
12513
12541
|
Auth: Auth$1,
|
|
12514
12542
|
Phone: Phone$1,
|
|
12515
12543
|
Websocket: Websocket$1,
|
|
12516
|
-
Room,
|
|
12544
|
+
Room: Room$1,
|
|
12517
12545
|
SipRoom,
|
|
12518
12546
|
RemoteParticipant,
|
|
12519
12547
|
LocalParticipant,
|
|
@@ -12546,7 +12574,7 @@ const Wazo = {
|
|
|
12546
12574
|
Session,
|
|
12547
12575
|
Voicemail,
|
|
12548
12576
|
Relocation,
|
|
12549
|
-
ConferenceRoom: Room
|
|
12577
|
+
ConferenceRoom: Room,
|
|
12550
12578
|
CallSession,
|
|
12551
12579
|
IndirectTransfer,
|
|
12552
12580
|
SwitchboardCall,
|
|
@@ -12585,9 +12613,9 @@ if (global) {
|
|
|
12585
12613
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
12586
12614
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
12587
12615
|
|
|
12588
|
-
const logger$
|
|
12616
|
+
const logger$b = IssueReporter$1.loggerFor('sdk-room');
|
|
12589
12617
|
|
|
12590
|
-
class Room extends Emitter {
|
|
12618
|
+
class Room$1 extends Emitter {
|
|
12591
12619
|
|
|
12592
12620
|
|
|
12593
12621
|
|
|
@@ -12645,7 +12673,7 @@ class Room extends Emitter {
|
|
|
12645
12673
|
extra = {},
|
|
12646
12674
|
) {
|
|
12647
12675
|
super();
|
|
12648
|
-
logger$
|
|
12676
|
+
logger$b.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
12649
12677
|
|
|
12650
12678
|
// Represents the room callSession
|
|
12651
12679
|
this.callSession = callSession;
|
|
@@ -12711,7 +12739,7 @@ class Room extends Emitter {
|
|
|
12711
12739
|
* @returns {Promise<Room>}
|
|
12712
12740
|
*/
|
|
12713
12741
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
12714
|
-
logger$
|
|
12742
|
+
logger$b.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
12715
12743
|
|
|
12716
12744
|
if (!room) {
|
|
12717
12745
|
await Wazo.Phone.connect();
|
|
@@ -12724,7 +12752,7 @@ class Room extends Emitter {
|
|
|
12724
12752
|
|
|
12725
12753
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
12726
12754
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
12727
|
-
logger$
|
|
12755
|
+
logger$b.info('room call received via WS', { callId: data.call_id });
|
|
12728
12756
|
if (room) {
|
|
12729
12757
|
room.setCallId(data.call_id);
|
|
12730
12758
|
}
|
|
@@ -12732,7 +12760,7 @@ class Room extends Emitter {
|
|
|
12732
12760
|
|
|
12733
12761
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
12734
12762
|
// eslint-disable-next-line no-param-reassign
|
|
12735
|
-
room = new Room(callSession, extension, null, null, extra);
|
|
12763
|
+
room = new Room$1(callSession, extension, null, null, extra);
|
|
12736
12764
|
|
|
12737
12765
|
// Wait for the call to be accepted
|
|
12738
12766
|
await new Promise((resolve, reject) => {
|
|
@@ -12753,7 +12781,7 @@ class Room extends Emitter {
|
|
|
12753
12781
|
// Retrieve conference
|
|
12754
12782
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
12755
12783
|
|
|
12756
|
-
logger$
|
|
12784
|
+
logger$b.info('connected to room', {
|
|
12757
12785
|
sourceId: conference ? conference.sourceId : null,
|
|
12758
12786
|
name: conference ? conference.name : null,
|
|
12759
12787
|
});
|
|
@@ -12763,7 +12791,7 @@ class Room extends Emitter {
|
|
|
12763
12791
|
room.setName(conference.name);
|
|
12764
12792
|
}
|
|
12765
12793
|
} else if (meeting) {
|
|
12766
|
-
logger$
|
|
12794
|
+
logger$b.info('Already connected to meeting', {
|
|
12767
12795
|
uuid: meeting.uuid,
|
|
12768
12796
|
name: meeting.name,
|
|
12769
12797
|
});
|
|
@@ -12776,13 +12804,13 @@ class Room extends Emitter {
|
|
|
12776
12804
|
}
|
|
12777
12805
|
|
|
12778
12806
|
static disconnect() {
|
|
12779
|
-
logger$
|
|
12807
|
+
logger$b.info('static disconnection to room');
|
|
12780
12808
|
|
|
12781
12809
|
Wazo.Phone.disconnect();
|
|
12782
12810
|
}
|
|
12783
12811
|
|
|
12784
12812
|
async disconnect() {
|
|
12785
|
-
logger$
|
|
12813
|
+
logger$b.info('disconnection to room called');
|
|
12786
12814
|
|
|
12787
12815
|
await Wazo.Phone.hangup(this.callSession);
|
|
12788
12816
|
this.callSession = null;
|
|
@@ -12802,19 +12830,19 @@ class Room extends Emitter {
|
|
|
12802
12830
|
}
|
|
12803
12831
|
|
|
12804
12832
|
setSourceId(sourceId ) {
|
|
12805
|
-
logger$
|
|
12833
|
+
logger$b.info('set room source id', { sourceId });
|
|
12806
12834
|
|
|
12807
12835
|
this.sourceId = sourceId;
|
|
12808
12836
|
}
|
|
12809
12837
|
|
|
12810
12838
|
setMeetingUuid(meetingUuid ) {
|
|
12811
|
-
logger$
|
|
12839
|
+
logger$b.info('set meeting uuid', { meetingUuid });
|
|
12812
12840
|
|
|
12813
12841
|
this.meetingUuid = meetingUuid;
|
|
12814
12842
|
}
|
|
12815
12843
|
|
|
12816
12844
|
setCallId(callId ) {
|
|
12817
|
-
logger$
|
|
12845
|
+
logger$b.info('set room call id', { callId });
|
|
12818
12846
|
|
|
12819
12847
|
if (callId) {
|
|
12820
12848
|
this.callId = callId;
|
|
@@ -12822,7 +12850,7 @@ class Room extends Emitter {
|
|
|
12822
12850
|
}
|
|
12823
12851
|
|
|
12824
12852
|
setName(name ) {
|
|
12825
|
-
logger$
|
|
12853
|
+
logger$b.info('set room name', { name });
|
|
12826
12854
|
|
|
12827
12855
|
this.name = name;
|
|
12828
12856
|
}
|
|
@@ -12841,7 +12869,7 @@ class Room extends Emitter {
|
|
|
12841
12869
|
}
|
|
12842
12870
|
|
|
12843
12871
|
async startScreenSharing(constraints ) {
|
|
12844
|
-
logger$
|
|
12872
|
+
logger$b.info('start room screen sharing', { constraints });
|
|
12845
12873
|
|
|
12846
12874
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
12847
12875
|
if (!screensharingStream) {
|
|
@@ -12855,7 +12883,7 @@ class Room extends Emitter {
|
|
|
12855
12883
|
}
|
|
12856
12884
|
|
|
12857
12885
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
12858
|
-
logger$
|
|
12886
|
+
logger$b.info('stop room screen sharing');
|
|
12859
12887
|
|
|
12860
12888
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
12861
12889
|
|
|
@@ -12867,7 +12895,7 @@ class Room extends Emitter {
|
|
|
12867
12895
|
}
|
|
12868
12896
|
|
|
12869
12897
|
turnCameraOff() {
|
|
12870
|
-
logger$
|
|
12898
|
+
logger$b.info('turn room camera off');
|
|
12871
12899
|
|
|
12872
12900
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
12873
12901
|
|
|
@@ -12877,7 +12905,7 @@ class Room extends Emitter {
|
|
|
12877
12905
|
}
|
|
12878
12906
|
|
|
12879
12907
|
turnCameraOn() {
|
|
12880
|
-
logger$
|
|
12908
|
+
logger$b.info('turn room camera on');
|
|
12881
12909
|
|
|
12882
12910
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
12883
12911
|
|
|
@@ -12887,7 +12915,7 @@ class Room extends Emitter {
|
|
|
12887
12915
|
}
|
|
12888
12916
|
|
|
12889
12917
|
mute() {
|
|
12890
|
-
logger$
|
|
12918
|
+
logger$b.info('mute room');
|
|
12891
12919
|
|
|
12892
12920
|
Wazo.Phone.mute(this.callSession);
|
|
12893
12921
|
|
|
@@ -12895,7 +12923,7 @@ class Room extends Emitter {
|
|
|
12895
12923
|
}
|
|
12896
12924
|
|
|
12897
12925
|
unmute() {
|
|
12898
|
-
logger$
|
|
12926
|
+
logger$b.info('unmute room');
|
|
12899
12927
|
|
|
12900
12928
|
Wazo.Phone.unmute(this.callSession);
|
|
12901
12929
|
|
|
@@ -12915,7 +12943,7 @@ class Room extends Emitter {
|
|
|
12915
12943
|
}
|
|
12916
12944
|
|
|
12917
12945
|
hold() {
|
|
12918
|
-
logger$
|
|
12946
|
+
logger$b.info('hold room');
|
|
12919
12947
|
|
|
12920
12948
|
Wazo.Phone.hold(this.callSession, true);
|
|
12921
12949
|
|
|
@@ -12925,7 +12953,7 @@ class Room extends Emitter {
|
|
|
12925
12953
|
}
|
|
12926
12954
|
|
|
12927
12955
|
async resume() {
|
|
12928
|
-
logger$
|
|
12956
|
+
logger$b.info('resume room');
|
|
12929
12957
|
|
|
12930
12958
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
12931
12959
|
|
|
@@ -12953,13 +12981,13 @@ class Room extends Emitter {
|
|
|
12953
12981
|
}
|
|
12954
12982
|
|
|
12955
12983
|
sendDTMF(tone ) {
|
|
12956
|
-
logger$
|
|
12984
|
+
logger$b.info('send room DTMF', { tone });
|
|
12957
12985
|
|
|
12958
12986
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
12959
12987
|
}
|
|
12960
12988
|
|
|
12961
12989
|
async sendReinvite(newConstraints = null) {
|
|
12962
|
-
logger$
|
|
12990
|
+
logger$b.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
12963
12991
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
12964
12992
|
|
|
12965
12993
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -13018,7 +13046,7 @@ class Room extends Emitter {
|
|
|
13018
13046
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
13019
13047
|
|
|
13020
13048
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
13021
|
-
logger$
|
|
13049
|
+
logger$b.info('on room audio stream');
|
|
13022
13050
|
|
|
13023
13051
|
this.audioStream = stream;
|
|
13024
13052
|
if (!this.roomAudioElement) {
|
|
@@ -13031,7 +13059,7 @@ class Room extends Emitter {
|
|
|
13031
13059
|
});
|
|
13032
13060
|
|
|
13033
13061
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
13034
|
-
logger$
|
|
13062
|
+
logger$b.info('on room video stream', { streamId });
|
|
13035
13063
|
|
|
13036
13064
|
this._mapMsid(sipSession.body.body);
|
|
13037
13065
|
|
|
@@ -13046,7 +13074,7 @@ class Room extends Emitter {
|
|
|
13046
13074
|
});
|
|
13047
13075
|
|
|
13048
13076
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
13049
|
-
logger$
|
|
13077
|
+
logger$b.info('on room remove stream');
|
|
13050
13078
|
|
|
13051
13079
|
const participant = this.participants.find(someParticipant =>
|
|
13052
13080
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -13178,7 +13206,7 @@ class Room extends Emitter {
|
|
|
13178
13206
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
13179
13207
|
if (requester) {
|
|
13180
13208
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
13181
|
-
logger$
|
|
13209
|
+
logger$b.info('trigger room requester status', { origin });
|
|
13182
13210
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
13183
13211
|
}
|
|
13184
13212
|
break;
|
|
@@ -13209,24 +13237,24 @@ class Room extends Emitter {
|
|
|
13209
13237
|
|
|
13210
13238
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
13211
13239
|
if (participant.user_uuid === session.uuid) {
|
|
13212
|
-
logger$
|
|
13240
|
+
logger$b.info('room current user joined');
|
|
13213
13241
|
|
|
13214
13242
|
// Retrieve participants via an API calls
|
|
13215
13243
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
13216
13244
|
let response;
|
|
13217
13245
|
try {
|
|
13218
13246
|
if (this.meetingUuid) {
|
|
13219
|
-
logger$
|
|
13247
|
+
logger$b.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
13220
13248
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
13221
13249
|
} else {
|
|
13222
|
-
logger$
|
|
13250
|
+
logger$b.info('fetching conference participants', { conferenceId });
|
|
13223
13251
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
13224
13252
|
}
|
|
13225
13253
|
} catch (e) {
|
|
13226
|
-
logger$
|
|
13254
|
+
logger$b.error('room participants fetching, error', e);
|
|
13227
13255
|
}
|
|
13228
13256
|
if (response) {
|
|
13229
|
-
logger$
|
|
13257
|
+
logger$b.info('conference participants fetched', { nb: response.items.length });
|
|
13230
13258
|
participants = response.items.map(item => {
|
|
13231
13259
|
const isMe = item.call_id === this.callId;
|
|
13232
13260
|
|
|
@@ -13253,7 +13281,7 @@ class Room extends Emitter {
|
|
|
13253
13281
|
? new Wazo.RemoteParticipant(this, participant)
|
|
13254
13282
|
: null;
|
|
13255
13283
|
|
|
13256
|
-
logger$
|
|
13284
|
+
logger$b.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
13257
13285
|
|
|
13258
13286
|
if (remoteParticipant) {
|
|
13259
13287
|
this.participants.push(remoteParticipant);
|
|
@@ -13418,7 +13446,7 @@ class Room extends Emitter {
|
|
|
13418
13446
|
|
|
13419
13447
|
//
|
|
13420
13448
|
|
|
13421
|
-
const logger = IssueReporter$1.loggerFor('room');
|
|
13449
|
+
const logger$c = IssueReporter$1.loggerFor('room');
|
|
13422
13450
|
|
|
13423
13451
|
class Participant extends Emitter {
|
|
13424
13452
|
|
|
@@ -13540,7 +13568,7 @@ class Participant extends Emitter {
|
|
|
13540
13568
|
}
|
|
13541
13569
|
|
|
13542
13570
|
onTalking(isTalking ) {
|
|
13543
|
-
logger.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
13571
|
+
logger$c.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
13544
13572
|
this.isTalking = isTalking;
|
|
13545
13573
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
13546
13574
|
// directly from asterisk, there's no need to do so
|
|
@@ -13643,7 +13671,7 @@ class Participant extends Emitter {
|
|
|
13643
13671
|
}
|
|
13644
13672
|
|
|
13645
13673
|
updateStatus(status , broadcast = true) {
|
|
13646
|
-
logger.info('updating participant status', { name: this.name, status });
|
|
13674
|
+
logger$c.info('updating participant status', { name: this.name, status });
|
|
13647
13675
|
|
|
13648
13676
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
13649
13677
|
if (status.audioMuted) {
|
|
@@ -13691,7 +13719,7 @@ class Participant extends Emitter {
|
|
|
13691
13719
|
|
|
13692
13720
|
broadcastStatus(inboundStatus = null) {
|
|
13693
13721
|
const status = inboundStatus || this.getStatus();
|
|
13694
|
-
logger.info('broadcasting participant status', { callId: this.callId, status });
|
|
13722
|
+
logger$c.info('broadcasting participant status', { callId: this.callId, status });
|
|
13695
13723
|
|
|
13696
13724
|
this.room.sendSignal({
|
|
13697
13725
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|