@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
|
@@ -128,7 +128,7 @@ const isMobile = () => typeof navigator !== 'undefined' && navigator.product ===
|
|
|
128
128
|
|
|
129
129
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
130
130
|
|
|
131
|
-
const logger
|
|
131
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
132
132
|
|
|
133
133
|
// Use a function here to be able to mock it in tests
|
|
134
134
|
const realFetch = () => {
|
|
@@ -267,7 +267,7 @@ class ApiRequester {
|
|
|
267
267
|
};
|
|
268
268
|
|
|
269
269
|
if (this.refreshTokenPromise) {
|
|
270
|
-
logger
|
|
270
|
+
logger.info('A token is already refreshing, waiting ...', { url });
|
|
271
271
|
await this.refreshTokenPromise;
|
|
272
272
|
}
|
|
273
273
|
|
|
@@ -287,7 +287,7 @@ class ApiRequester {
|
|
|
287
287
|
return promise.then(async (err ) => {
|
|
288
288
|
// Check if the token is still valid
|
|
289
289
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
290
|
-
logger
|
|
290
|
+
logger.warn('token expired', { error: err.reason });
|
|
291
291
|
// Replay the call after refreshing the token
|
|
292
292
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
293
293
|
}
|
|
@@ -297,7 +297,7 @@ class ApiRequester {
|
|
|
297
297
|
: exceptionClass.fromResponse(err, response.status);
|
|
298
298
|
|
|
299
299
|
if (this.shouldLogErrors) {
|
|
300
|
-
logger
|
|
300
|
+
logger.error('API error', error);
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
throw error;
|
|
@@ -307,7 +307,7 @@ class ApiRequester {
|
|
|
307
307
|
return newParse(response, isJson);
|
|
308
308
|
}).catch(error => {
|
|
309
309
|
if (this.shouldLogErrors) {
|
|
310
|
-
logger
|
|
310
|
+
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
throw error;
|
|
@@ -335,13 +335,13 @@ class ApiRequester {
|
|
|
335
335
|
) {
|
|
336
336
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
337
337
|
let newPath = path;
|
|
338
|
-
logger
|
|
338
|
+
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
339
339
|
|
|
340
340
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
341
341
|
|
|
342
342
|
return this.refreshTokenPromise.then(() => {
|
|
343
343
|
this.refreshTokenPromise = null;
|
|
344
|
-
logger
|
|
344
|
+
logger.info('token refreshed', { isTokenNotFound });
|
|
345
345
|
if (isTokenNotFound) {
|
|
346
346
|
const pathParts = path.split('/');
|
|
347
347
|
pathParts.pop();
|
|
@@ -2656,8 +2656,9 @@ class ExternalApp {
|
|
|
2656
2656
|
|
|
2657
2657
|
|
|
2658
2658
|
|
|
2659
|
-
|
|
2659
|
+
|
|
2660
2660
|
|
|
2661
|
+
|
|
2661
2662
|
|
|
2662
2663
|
|
|
2663
2664
|
class Meeting {
|
|
@@ -2668,9 +2669,10 @@ class Meeting {
|
|
|
2668
2669
|
|
|
2669
2670
|
|
|
2670
2671
|
|
|
2671
|
-
|
|
2672
|
+
|
|
2672
2673
|
|
|
2673
2674
|
|
|
2675
|
+
|
|
2674
2676
|
|
|
2675
2677
|
static parse(plain ) {
|
|
2676
2678
|
return new Meeting({
|
|
@@ -2680,8 +2682,9 @@ class Meeting {
|
|
|
2680
2682
|
ownerUuids: plain.owner_uuids,
|
|
2681
2683
|
port: plain.port,
|
|
2682
2684
|
uuid: plain.uuid,
|
|
2683
|
-
|
|
2685
|
+
extension: plain.exten,
|
|
2684
2686
|
persistent: plain.persistent,
|
|
2687
|
+
creationTime: moment(plain.creation_time).toDate(),
|
|
2685
2688
|
});
|
|
2686
2689
|
}
|
|
2687
2690
|
|
|
@@ -2703,8 +2706,9 @@ class Meeting {
|
|
|
2703
2706
|
ownerUuids,
|
|
2704
2707
|
port,
|
|
2705
2708
|
uri,
|
|
2706
|
-
|
|
2709
|
+
extension,
|
|
2707
2710
|
persistent,
|
|
2711
|
+
creationTime,
|
|
2708
2712
|
} = {}) {
|
|
2709
2713
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2710
2714
|
this.uri = uri;
|
|
@@ -2712,8 +2716,9 @@ class Meeting {
|
|
|
2712
2716
|
this.ownerUuids = ownerUuids;
|
|
2713
2717
|
this.port = port;
|
|
2714
2718
|
this.uuid = uuid;
|
|
2715
|
-
this.
|
|
2719
|
+
this.extension = extension;
|
|
2716
2720
|
this.persistent = persistent;
|
|
2721
|
+
this.creationTime = creationTime;
|
|
2717
2722
|
|
|
2718
2723
|
// Useful to compare instead of instanceof with minified code
|
|
2719
2724
|
this.type = 'Meeting';
|
|
@@ -4048,7 +4053,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4048
4053
|
|
|
4049
4054
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4050
4055
|
|
|
4051
|
-
const logger$
|
|
4056
|
+
const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4052
4057
|
|
|
4053
4058
|
class CTIPhone extends Emitter {
|
|
4054
4059
|
|
|
@@ -4061,7 +4066,7 @@ class CTIPhone extends Emitter {
|
|
|
4061
4066
|
|
|
4062
4067
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4063
4068
|
super();
|
|
4064
|
-
logger$
|
|
4069
|
+
logger$1.info('CTI Phone created');
|
|
4065
4070
|
this.session = session;
|
|
4066
4071
|
this.isMobile = isMobile;
|
|
4067
4072
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4122,7 +4127,7 @@ class CTIPhone extends Emitter {
|
|
|
4122
4127
|
}
|
|
4123
4128
|
|
|
4124
4129
|
async makeCall(number , line ) {
|
|
4125
|
-
logger$
|
|
4130
|
+
logger$1.info('make CTI call', { number });
|
|
4126
4131
|
|
|
4127
4132
|
if (!number) {
|
|
4128
4133
|
return null;
|
|
@@ -4145,7 +4150,7 @@ class CTIPhone extends Emitter {
|
|
|
4145
4150
|
if (!callSession) {
|
|
4146
4151
|
return Promise.resolve(null);
|
|
4147
4152
|
}
|
|
4148
|
-
logger$
|
|
4153
|
+
logger$1.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4149
4154
|
|
|
4150
4155
|
if (!this.currentCall) {
|
|
4151
4156
|
this.currentCall = callSession.call;
|
|
@@ -4158,7 +4163,7 @@ class CTIPhone extends Emitter {
|
|
|
4158
4163
|
if (!callSession) {
|
|
4159
4164
|
return;
|
|
4160
4165
|
}
|
|
4161
|
-
logger$
|
|
4166
|
+
logger$1.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4162
4167
|
|
|
4163
4168
|
this.currentCall = undefined;
|
|
4164
4169
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4168,7 +4173,7 @@ class CTIPhone extends Emitter {
|
|
|
4168
4173
|
if (!callSession) {
|
|
4169
4174
|
return Promise.resolve(false);
|
|
4170
4175
|
}
|
|
4171
|
-
logger$
|
|
4176
|
+
logger$1.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4172
4177
|
|
|
4173
4178
|
try {
|
|
4174
4179
|
await CallApi.cancelCall(callSession);
|
|
@@ -4179,7 +4184,7 @@ class CTIPhone extends Emitter {
|
|
|
4179
4184
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4180
4185
|
return true;
|
|
4181
4186
|
} catch (e) {
|
|
4182
|
-
logger$
|
|
4187
|
+
logger$1.error('hangup CTI call, error', e);
|
|
4183
4188
|
|
|
4184
4189
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4185
4190
|
return false;
|
|
@@ -4192,7 +4197,7 @@ class CTIPhone extends Emitter {
|
|
|
4192
4197
|
if (!callSession) {
|
|
4193
4198
|
return;
|
|
4194
4199
|
}
|
|
4195
|
-
logger$
|
|
4200
|
+
logger$1.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4196
4201
|
|
|
4197
4202
|
await CallApi.cancelCall(callSession);
|
|
4198
4203
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4202,7 +4207,7 @@ class CTIPhone extends Emitter {
|
|
|
4202
4207
|
if (!callSession) {
|
|
4203
4208
|
return;
|
|
4204
4209
|
}
|
|
4205
|
-
logger$
|
|
4210
|
+
logger$1.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4206
4211
|
|
|
4207
4212
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4208
4213
|
}
|
|
@@ -4215,19 +4220,19 @@ class CTIPhone extends Emitter {
|
|
|
4215
4220
|
if (!callSession) {
|
|
4216
4221
|
return;
|
|
4217
4222
|
}
|
|
4218
|
-
logger$
|
|
4223
|
+
logger$1.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4219
4224
|
|
|
4220
4225
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4221
4226
|
}
|
|
4222
4227
|
|
|
4223
4228
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4224
|
-
logger$
|
|
4229
|
+
logger$1.info('cancel CTI transfer', { transferId });
|
|
4225
4230
|
|
|
4226
4231
|
return CallApi.cancelCallTransfer(transferId);
|
|
4227
4232
|
}
|
|
4228
4233
|
|
|
4229
4234
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4230
|
-
logger$
|
|
4235
|
+
logger$1.info('confirm CTI transfer', { transferId });
|
|
4231
4236
|
|
|
4232
4237
|
return CallApi.confirmCallTransfer(transferId);
|
|
4233
4238
|
}
|
|
@@ -4236,19 +4241,19 @@ class CTIPhone extends Emitter {
|
|
|
4236
4241
|
if (!callSession) {
|
|
4237
4242
|
return;
|
|
4238
4243
|
}
|
|
4239
|
-
logger$
|
|
4244
|
+
logger$1.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4240
4245
|
|
|
4241
4246
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4242
4247
|
}
|
|
4243
4248
|
|
|
4244
4249
|
onConnectionMade() {
|
|
4245
|
-
logger$
|
|
4250
|
+
logger$1.info('on CTI connection made');
|
|
4246
4251
|
|
|
4247
4252
|
this.eventEmitter.emit('onCallAccepted');
|
|
4248
4253
|
}
|
|
4249
4254
|
|
|
4250
4255
|
async close() {
|
|
4251
|
-
logger$
|
|
4256
|
+
logger$1.info('CTI close');
|
|
4252
4257
|
|
|
4253
4258
|
return Promise.resolve();
|
|
4254
4259
|
}
|
|
@@ -4257,7 +4262,7 @@ class CTIPhone extends Emitter {
|
|
|
4257
4262
|
if (!callSession) {
|
|
4258
4263
|
return;
|
|
4259
4264
|
}
|
|
4260
|
-
logger$
|
|
4265
|
+
logger$1.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4261
4266
|
|
|
4262
4267
|
return CallApi.hold(callSession.callId);
|
|
4263
4268
|
}
|
|
@@ -4266,7 +4271,7 @@ class CTIPhone extends Emitter {
|
|
|
4266
4271
|
if (!callSession) {
|
|
4267
4272
|
return;
|
|
4268
4273
|
}
|
|
4269
|
-
logger$
|
|
4274
|
+
logger$1.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4270
4275
|
|
|
4271
4276
|
return CallApi.resume(callSession.callId);
|
|
4272
4277
|
}
|
|
@@ -4275,7 +4280,7 @@ class CTIPhone extends Emitter {
|
|
|
4275
4280
|
if (!callSession) {
|
|
4276
4281
|
return;
|
|
4277
4282
|
}
|
|
4278
|
-
logger$
|
|
4283
|
+
logger$1.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4279
4284
|
|
|
4280
4285
|
return CallApi.mute(callSession.callId);
|
|
4281
4286
|
}
|
|
@@ -4284,7 +4289,7 @@ class CTIPhone extends Emitter {
|
|
|
4284
4289
|
if (!callSession) {
|
|
4285
4290
|
return;
|
|
4286
4291
|
}
|
|
4287
|
-
logger$
|
|
4292
|
+
logger$1.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4288
4293
|
|
|
4289
4294
|
return CallApi.unmute(callSession.callId);
|
|
4290
4295
|
}
|
|
@@ -5293,7 +5298,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5293
5298
|
const WEBHOOKD_VERSION = '1.0';
|
|
5294
5299
|
const AMID_VERSION = '1.0';
|
|
5295
5300
|
|
|
5296
|
-
const logger$
|
|
5301
|
+
const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5297
5302
|
|
|
5298
5303
|
class ApiClient {
|
|
5299
5304
|
|
|
@@ -5345,12 +5350,12 @@ class ApiClient {
|
|
|
5345
5350
|
}
|
|
5346
5351
|
|
|
5347
5352
|
async forceRefreshToken() {
|
|
5348
|
-
logger$
|
|
5353
|
+
logger$2.info('forcing refresh token, calling callback');
|
|
5349
5354
|
return this.refreshTokenCallback();
|
|
5350
5355
|
}
|
|
5351
5356
|
|
|
5352
5357
|
async refreshTokenCallback() {
|
|
5353
|
-
logger$
|
|
5358
|
+
logger$2.info('refresh token callback called', {
|
|
5354
5359
|
refreshToken: this.refreshToken,
|
|
5355
5360
|
refreshBackend: this.refreshBackend,
|
|
5356
5361
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5368,7 +5373,7 @@ class ApiClient {
|
|
|
5368
5373
|
this.isMobile,
|
|
5369
5374
|
);
|
|
5370
5375
|
|
|
5371
|
-
logger$
|
|
5376
|
+
logger$2.info('token refreshed', { token: session.token });
|
|
5372
5377
|
|
|
5373
5378
|
if (this.onRefreshToken) {
|
|
5374
5379
|
this.onRefreshToken(session.token, session);
|
|
@@ -5509,7 +5514,7 @@ var getApiClient = (forServer ) => {
|
|
|
5509
5514
|
class InvalidSubscription extends Error {}
|
|
5510
5515
|
class InvalidAuthorization extends Error {}
|
|
5511
5516
|
|
|
5512
|
-
const logger$
|
|
5517
|
+
const logger$3 = IssueReporter$1.loggerFor('simple-auth');
|
|
5513
5518
|
|
|
5514
5519
|
class Auth {
|
|
5515
5520
|
|
|
@@ -5544,7 +5549,7 @@ class Auth {
|
|
|
5544
5549
|
setApiClientId(this.clientId);
|
|
5545
5550
|
setRefreshExpiration(this.expiration);
|
|
5546
5551
|
setOnRefreshToken((token , session ) => {
|
|
5547
|
-
logger$
|
|
5552
|
+
logger$3.info('on refresh token done', { token });
|
|
5548
5553
|
setApiToken(token);
|
|
5549
5554
|
Wazo.Websocket.updateToken(token);
|
|
5550
5555
|
|
|
@@ -5589,7 +5594,7 @@ class Auth {
|
|
|
5589
5594
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
5590
5595
|
return this._onAuthenticated(rawSession);
|
|
5591
5596
|
} catch (e) {
|
|
5592
|
-
logger$
|
|
5597
|
+
logger$3.error('on validate token error', e);
|
|
5593
5598
|
console.warn(e);
|
|
5594
5599
|
return false;
|
|
5595
5600
|
}
|
|
@@ -5945,7 +5950,7 @@ class AdHocAPIConference {
|
|
|
5945
5950
|
|
|
5946
5951
|
/* */
|
|
5947
5952
|
|
|
5948
|
-
const parseCandidate
|
|
5953
|
+
const parseCandidate = (candidate ) => {
|
|
5949
5954
|
if (!candidate) {
|
|
5950
5955
|
return null;
|
|
5951
5956
|
}
|
|
@@ -6099,7 +6104,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6099
6104
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
6100
6105
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6101
6106
|
if (event.candidate) {
|
|
6102
|
-
this.gatheredCandidates.push(parseCandidate
|
|
6107
|
+
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
6103
6108
|
}
|
|
6104
6109
|
};
|
|
6105
6110
|
|
|
@@ -6563,7 +6568,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6563
6568
|
const SEND_STATS_DELAY = 5000;
|
|
6564
6569
|
|
|
6565
6570
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6566
|
-
const logger$
|
|
6571
|
+
const logger$4 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6567
6572
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6568
6573
|
|
|
6569
6574
|
// events
|
|
@@ -6577,14 +6582,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6577
6582
|
const MESSAGE = 'message';
|
|
6578
6583
|
const ACCEPTED = 'accepted';
|
|
6579
6584
|
const REJECTED = 'rejected';
|
|
6580
|
-
const ON_TRACK
|
|
6581
|
-
const ON_REINVITE
|
|
6585
|
+
const ON_TRACK = 'onTrack';
|
|
6586
|
+
const ON_REINVITE = 'reinvite';
|
|
6582
6587
|
const ON_ERROR = 'onError';
|
|
6583
6588
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6584
|
-
const ON_NETWORK_STATS
|
|
6585
|
-
const ON_DISCONNECTED
|
|
6589
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6590
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
6586
6591
|
|
|
6587
|
-
const events
|
|
6592
|
+
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6588
6593
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6589
6594
|
class CanceledCallError extends Error {}
|
|
6590
6595
|
|
|
@@ -6720,12 +6725,12 @@ class WebRTCClient extends Emitter {
|
|
|
6720
6725
|
this.MESSAGE = MESSAGE;
|
|
6721
6726
|
this.ACCEPTED = ACCEPTED;
|
|
6722
6727
|
this.REJECTED = REJECTED;
|
|
6723
|
-
this.ON_TRACK = ON_TRACK
|
|
6724
|
-
this.ON_REINVITE = ON_REINVITE
|
|
6728
|
+
this.ON_TRACK = ON_TRACK;
|
|
6729
|
+
this.ON_REINVITE = ON_REINVITE;
|
|
6725
6730
|
this.ON_ERROR = ON_ERROR;
|
|
6726
6731
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6727
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS
|
|
6728
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED
|
|
6732
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6733
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6729
6734
|
}
|
|
6730
6735
|
|
|
6731
6736
|
configureMedia(media ) {
|
|
@@ -6742,13 +6747,13 @@ class WebRTCClient extends Emitter {
|
|
|
6742
6747
|
|
|
6743
6748
|
createUserAgent(configOverrides ) {
|
|
6744
6749
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6745
|
-
logger$
|
|
6750
|
+
logger$4.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6746
6751
|
|
|
6747
6752
|
webRTCConfiguration.delegate = {
|
|
6748
6753
|
onConnect: this.onConnect.bind(this),
|
|
6749
6754
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6750
6755
|
onInvite: (invitation ) => {
|
|
6751
|
-
logger$
|
|
6756
|
+
logger$4.info('sdk webrtc on invite', {
|
|
6752
6757
|
method: 'delegate.onInvite',
|
|
6753
6758
|
id: invitation.id,
|
|
6754
6759
|
remoteURI: invitation.remoteURI,
|
|
@@ -6791,7 +6796,7 @@ class WebRTCClient extends Emitter {
|
|
|
6791
6796
|
}
|
|
6792
6797
|
|
|
6793
6798
|
onConnect() {
|
|
6794
|
-
logger$
|
|
6799
|
+
logger$4.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6795
6800
|
this.eventEmitter.emit(CONNECTED);
|
|
6796
6801
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6797
6802
|
this.registerer.waitingToggle(false);
|
|
@@ -6800,7 +6805,7 @@ class WebRTCClient extends Emitter {
|
|
|
6800
6805
|
}
|
|
6801
6806
|
|
|
6802
6807
|
async onDisconnect(error ) {
|
|
6803
|
-
logger$
|
|
6808
|
+
logger$4.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6804
6809
|
this.connectionPromise = null;
|
|
6805
6810
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6806
6811
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6825,37 +6830,37 @@ class WebRTCClient extends Emitter {
|
|
|
6825
6830
|
};
|
|
6826
6831
|
|
|
6827
6832
|
if (this.skipRegister) {
|
|
6828
|
-
logger$
|
|
6833
|
+
logger$4.info('sdk webrtc skip register...', logInfo);
|
|
6829
6834
|
return Promise.resolve();
|
|
6830
6835
|
}
|
|
6831
6836
|
|
|
6832
|
-
logger$
|
|
6837
|
+
logger$4.info('sdk webrtc registering...', logInfo);
|
|
6833
6838
|
|
|
6834
6839
|
if (!this.userAgent) {
|
|
6835
|
-
logger$
|
|
6840
|
+
logger$4.info('sdk webrtc recreating User Agent');
|
|
6836
6841
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6837
6842
|
}
|
|
6838
6843
|
if (!this.userAgent || this.isRegistered()) {
|
|
6839
|
-
logger$
|
|
6844
|
+
logger$4.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6840
6845
|
return Promise.resolve();
|
|
6841
6846
|
}
|
|
6842
6847
|
|
|
6843
6848
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6844
|
-
logger$
|
|
6849
|
+
logger$4.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6845
6850
|
return Promise.resolve();
|
|
6846
6851
|
}
|
|
6847
6852
|
|
|
6848
6853
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6849
6854
|
|
|
6850
6855
|
const onRegisterFailed = () => {
|
|
6851
|
-
logger$
|
|
6856
|
+
logger$4.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6852
6857
|
this.connectionPromise = null;
|
|
6853
6858
|
if (this.registerer && this.registerer.waiting) {
|
|
6854
6859
|
this.registerer.waitingToggle(false);
|
|
6855
6860
|
}
|
|
6856
6861
|
|
|
6857
6862
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6858
|
-
logger$
|
|
6863
|
+
logger$4.info('sdk webrtc registering, retrying...', { tries });
|
|
6859
6864
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6860
6865
|
}
|
|
6861
6866
|
};
|
|
@@ -6864,18 +6869,18 @@ class WebRTCClient extends Emitter {
|
|
|
6864
6869
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6865
6870
|
// during the resolution of the primise.
|
|
6866
6871
|
if (!this.userAgent) {
|
|
6867
|
-
logger$
|
|
6872
|
+
logger$4.info('sdk webrtc recreating User Agent after connection');
|
|
6868
6873
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6869
6874
|
}
|
|
6870
6875
|
|
|
6871
|
-
logger$
|
|
6876
|
+
logger$4.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6872
6877
|
this.registerer = new Registerer(this.userAgent, registerOptions);
|
|
6873
6878
|
this.connectionPromise = null;
|
|
6874
6879
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6875
6880
|
|
|
6876
6881
|
// Bind registerer events
|
|
6877
6882
|
this.registerer.stateChange.addListener(newState => {
|
|
6878
|
-
logger$
|
|
6883
|
+
logger$4.info('sdk webrtc registering, state changed', { newState });
|
|
6879
6884
|
|
|
6880
6885
|
if (newState === RegistererState.Registered && this.registerer
|
|
6881
6886
|
&& this.registerer.state === RegistererState.Registered) {
|
|
@@ -6888,7 +6893,7 @@ class WebRTCClient extends Emitter {
|
|
|
6888
6893
|
const options = {
|
|
6889
6894
|
requestDelegate: {
|
|
6890
6895
|
onReject: response => {
|
|
6891
|
-
logger$
|
|
6896
|
+
logger$4.error('sdk webrtc registering, rejected', { response });
|
|
6892
6897
|
|
|
6893
6898
|
onRegisterFailed();
|
|
6894
6899
|
},
|
|
@@ -6896,13 +6901,13 @@ class WebRTCClient extends Emitter {
|
|
|
6896
6901
|
};
|
|
6897
6902
|
|
|
6898
6903
|
return this.registerer.register(options).catch((e) => {
|
|
6899
|
-
logger$
|
|
6904
|
+
logger$4.error('sdk webrtc registering, error', e);
|
|
6900
6905
|
|
|
6901
6906
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6902
6907
|
return e;
|
|
6903
6908
|
});
|
|
6904
6909
|
}).catch(error => {
|
|
6905
|
-
logger$
|
|
6910
|
+
logger$4.error('sdk webrtc registering, transport error', error);
|
|
6906
6911
|
onRegisterFailed();
|
|
6907
6912
|
});
|
|
6908
6913
|
}
|
|
@@ -6931,21 +6936,21 @@ class WebRTCClient extends Emitter {
|
|
|
6931
6936
|
}
|
|
6932
6937
|
|
|
6933
6938
|
unregister() {
|
|
6934
|
-
logger$
|
|
6939
|
+
logger$4.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6935
6940
|
if (!this.registerer) {
|
|
6936
6941
|
return Promise.resolve();
|
|
6937
6942
|
}
|
|
6938
6943
|
|
|
6939
6944
|
try {
|
|
6940
6945
|
return this.registerer.unregister().then(() => {
|
|
6941
|
-
logger$
|
|
6946
|
+
logger$4.info('sdk webrtc unregistered');
|
|
6942
6947
|
this._cleanupRegister();
|
|
6943
6948
|
}).catch(e => {
|
|
6944
|
-
logger$
|
|
6949
|
+
logger$4.error('sdk webrtc unregistering, promise error', e);
|
|
6945
6950
|
this._cleanupRegister();
|
|
6946
6951
|
});
|
|
6947
6952
|
} catch (e) {
|
|
6948
|
-
logger$
|
|
6953
|
+
logger$4.error('sdk webrtc unregistering, error', e);
|
|
6949
6954
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6950
6955
|
// error when the registerer is in a bad state
|
|
6951
6956
|
this._cleanupRegister();
|
|
@@ -6953,7 +6958,7 @@ class WebRTCClient extends Emitter {
|
|
|
6953
6958
|
}
|
|
6954
6959
|
|
|
6955
6960
|
stop() {
|
|
6956
|
-
logger$
|
|
6961
|
+
logger$4.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6957
6962
|
if (!this.userAgent) {
|
|
6958
6963
|
return Promise.resolve();
|
|
6959
6964
|
}
|
|
@@ -6961,12 +6966,12 @@ class WebRTCClient extends Emitter {
|
|
|
6961
6966
|
return this.userAgent.stop().then(() => {
|
|
6962
6967
|
return this._cleanupRegister();
|
|
6963
6968
|
}).catch(e => {
|
|
6964
|
-
logger$
|
|
6969
|
+
logger$4.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6965
6970
|
});
|
|
6966
6971
|
}
|
|
6967
6972
|
|
|
6968
6973
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6969
|
-
logger$
|
|
6974
|
+
logger$4.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
6970
6975
|
const inviterOptions = {
|
|
6971
6976
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6972
6977
|
conference,
|
|
@@ -6997,7 +7002,7 @@ class WebRTCClient extends Emitter {
|
|
|
6997
7002
|
this._onAccepted(session, response.session, true);
|
|
6998
7003
|
},
|
|
6999
7004
|
onReject: (response ) => {
|
|
7000
|
-
logger$
|
|
7005
|
+
logger$4.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
7001
7006
|
this._stopSendingStats(session);
|
|
7002
7007
|
this.stopNetworkMonitoring(session);
|
|
7003
7008
|
|
|
@@ -7020,11 +7025,11 @@ class WebRTCClient extends Emitter {
|
|
|
7020
7025
|
}
|
|
7021
7026
|
|
|
7022
7027
|
answer(session , enableVideo ) {
|
|
7023
|
-
logger$
|
|
7028
|
+
logger$4.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
7024
7029
|
|
|
7025
7030
|
if (!session || !session.accept) {
|
|
7026
7031
|
const error = 'No session to answer, or not an invitation';
|
|
7027
|
-
logger$
|
|
7032
|
+
logger$4.warn(error);
|
|
7028
7033
|
return Promise.reject(new Error(error));
|
|
7029
7034
|
}
|
|
7030
7035
|
const options = {
|
|
@@ -7034,15 +7039,15 @@ class WebRTCClient extends Emitter {
|
|
|
7034
7039
|
return session.accept(options).then(() => {
|
|
7035
7040
|
if (session.isCanceled) {
|
|
7036
7041
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
7037
|
-
logger$
|
|
7042
|
+
logger$4.error(message, { id: session.id });
|
|
7038
7043
|
this.onCallEnded(session);
|
|
7039
7044
|
|
|
7040
7045
|
throw new CanceledCallError(message);
|
|
7041
7046
|
}
|
|
7042
|
-
logger$
|
|
7047
|
+
logger$4.info('sdk webrtc answer, accepted.');
|
|
7043
7048
|
this._onAccepted(session);
|
|
7044
7049
|
}).catch(e => {
|
|
7045
|
-
logger$
|
|
7050
|
+
logger$4.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
7046
7051
|
|
|
7047
7052
|
throw e;
|
|
7048
7053
|
});
|
|
@@ -7050,7 +7055,7 @@ class WebRTCClient extends Emitter {
|
|
|
7050
7055
|
|
|
7051
7056
|
hangup(session ) {
|
|
7052
7057
|
const { state, id } = session;
|
|
7053
|
-
logger$
|
|
7058
|
+
logger$4.info('sdk webrtc hangup call', { id, state });
|
|
7054
7059
|
|
|
7055
7060
|
try {
|
|
7056
7061
|
this._stopSendingStats(session);
|
|
@@ -7079,7 +7084,7 @@ class WebRTCClient extends Emitter {
|
|
|
7079
7084
|
|
|
7080
7085
|
return bye();
|
|
7081
7086
|
} catch (error) {
|
|
7082
|
-
logger$
|
|
7087
|
+
logger$4.warn('sdk webrtc hangup, error', error);
|
|
7083
7088
|
}
|
|
7084
7089
|
|
|
7085
7090
|
return null;
|
|
@@ -7097,7 +7102,7 @@ class WebRTCClient extends Emitter {
|
|
|
7097
7102
|
// Fetch and emit an event at `interval` with session network stats
|
|
7098
7103
|
startNetworkMonitoring(session , interval = 1000) {
|
|
7099
7104
|
const sessionId = this.getSipSessionId(session);
|
|
7100
|
-
logger$
|
|
7105
|
+
logger$4.info('starting network inspection', { id: sessionId });
|
|
7101
7106
|
|
|
7102
7107
|
this.sessionNetworkStats[sessionId] = [];
|
|
7103
7108
|
|
|
@@ -7107,7 +7112,7 @@ class WebRTCClient extends Emitter {
|
|
|
7107
7112
|
stopNetworkMonitoring(session ) {
|
|
7108
7113
|
const sessionId = this.getSipSessionId(session);
|
|
7109
7114
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
7110
|
-
logger$
|
|
7115
|
+
logger$4.info('stopping network inspection', { id: sessionId, exists });
|
|
7111
7116
|
|
|
7112
7117
|
if (exists) {
|
|
7113
7118
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -7117,17 +7122,17 @@ class WebRTCClient extends Emitter {
|
|
|
7117
7122
|
}
|
|
7118
7123
|
|
|
7119
7124
|
reject(session ) {
|
|
7120
|
-
logger$
|
|
7125
|
+
logger$4.info('sdk webrtc reject call', { id: session.id });
|
|
7121
7126
|
|
|
7122
7127
|
try {
|
|
7123
7128
|
return session.reject ? session.reject() : session.cancel();
|
|
7124
7129
|
} catch (e) {
|
|
7125
|
-
logger$
|
|
7130
|
+
logger$4.warn('Error when rejecting call', e.message, e.stack);
|
|
7126
7131
|
}
|
|
7127
7132
|
}
|
|
7128
7133
|
|
|
7129
7134
|
async close() {
|
|
7130
|
-
logger$
|
|
7135
|
+
logger$4.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
7131
7136
|
this._cleanupMedia();
|
|
7132
7137
|
this.connectionPromise = null;
|
|
7133
7138
|
|
|
@@ -7158,7 +7163,7 @@ class WebRTCClient extends Emitter {
|
|
|
7158
7163
|
// eg: "INVITE not rejectable in state Completed"
|
|
7159
7164
|
}
|
|
7160
7165
|
this.userAgent = null;
|
|
7161
|
-
logger$
|
|
7166
|
+
logger$4.info('sdk webrtc client closed');
|
|
7162
7167
|
}
|
|
7163
7168
|
|
|
7164
7169
|
getNumber(session ) {
|
|
@@ -7171,13 +7176,13 @@ class WebRTCClient extends Emitter {
|
|
|
7171
7176
|
}
|
|
7172
7177
|
|
|
7173
7178
|
mute(session ) {
|
|
7174
|
-
logger$
|
|
7179
|
+
logger$4.info('sdk webrtc mute', { id: session.id });
|
|
7175
7180
|
|
|
7176
7181
|
this._toggleAudio(session, true);
|
|
7177
7182
|
}
|
|
7178
7183
|
|
|
7179
7184
|
unmute(session ) {
|
|
7180
|
-
logger$
|
|
7185
|
+
logger$4.info('sdk webrtc unmute', { id: session.id });
|
|
7181
7186
|
|
|
7182
7187
|
this._toggleAudio(session, false);
|
|
7183
7188
|
}
|
|
@@ -7217,13 +7222,13 @@ class WebRTCClient extends Emitter {
|
|
|
7217
7222
|
}
|
|
7218
7223
|
|
|
7219
7224
|
toggleCameraOn(session ) {
|
|
7220
|
-
logger$
|
|
7225
|
+
logger$4.info('sdk webrtc toggle camera on', { id: session.id });
|
|
7221
7226
|
|
|
7222
7227
|
this._toggleVideo(session, false);
|
|
7223
7228
|
}
|
|
7224
7229
|
|
|
7225
7230
|
toggleCameraOff(session ) {
|
|
7226
|
-
logger$
|
|
7231
|
+
logger$4.info('sdk webrtc toggle camera off', { id: session.id });
|
|
7227
7232
|
|
|
7228
7233
|
this._toggleVideo(session, true);
|
|
7229
7234
|
}
|
|
@@ -7232,7 +7237,7 @@ class WebRTCClient extends Emitter {
|
|
|
7232
7237
|
const sessionId = this.getSipSessionId(session);
|
|
7233
7238
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
7234
7239
|
|
|
7235
|
-
logger$
|
|
7240
|
+
logger$4.info('sdk webrtc hold', {
|
|
7236
7241
|
sessionId,
|
|
7237
7242
|
keys: Object.keys(this.heldSessions),
|
|
7238
7243
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7281,7 +7286,7 @@ class WebRTCClient extends Emitter {
|
|
|
7281
7286
|
const sessionId = this.getSipSessionId(session);
|
|
7282
7287
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7283
7288
|
|
|
7284
|
-
logger$
|
|
7289
|
+
logger$4.info('sdk webrtc unhold', {
|
|
7285
7290
|
sessionId,
|
|
7286
7291
|
keys: Object.keys(this.heldSessions),
|
|
7287
7292
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7429,7 +7434,7 @@ class WebRTCClient extends Emitter {
|
|
|
7429
7434
|
if (!session.sessionDescriptionHandler) {
|
|
7430
7435
|
return;
|
|
7431
7436
|
}
|
|
7432
|
-
logger$
|
|
7437
|
+
logger$4.info('Sending DTMF', {
|
|
7433
7438
|
id: this.getSipSessionId(session),
|
|
7434
7439
|
tone,
|
|
7435
7440
|
});
|
|
@@ -7445,7 +7450,7 @@ class WebRTCClient extends Emitter {
|
|
|
7445
7450
|
transfer(session , target ) {
|
|
7446
7451
|
this.hold(session);
|
|
7447
7452
|
|
|
7448
|
-
logger$
|
|
7453
|
+
logger$4.info('Transfering a session', {
|
|
7449
7454
|
id: this.getSipSessionId(session),
|
|
7450
7455
|
target,
|
|
7451
7456
|
});
|
|
@@ -7467,17 +7472,17 @@ class WebRTCClient extends Emitter {
|
|
|
7467
7472
|
atxfer(session ) {
|
|
7468
7473
|
this.hold(session);
|
|
7469
7474
|
|
|
7470
|
-
logger$
|
|
7475
|
+
logger$4.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7471
7476
|
|
|
7472
7477
|
const result = {
|
|
7473
7478
|
newSession: null,
|
|
7474
7479
|
init: async (target ) => {
|
|
7475
|
-
logger$
|
|
7480
|
+
logger$4.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7476
7481
|
|
|
7477
7482
|
result.newSession = await this.call(target);
|
|
7478
7483
|
},
|
|
7479
7484
|
complete: () => {
|
|
7480
|
-
logger$
|
|
7485
|
+
logger$4.info('webrtc transfer completed', {
|
|
7481
7486
|
id: this.getSipSessionId(session),
|
|
7482
7487
|
referId: this.getSipSessionId(result.newSession),
|
|
7483
7488
|
});
|
|
@@ -7498,7 +7503,7 @@ class WebRTCClient extends Emitter {
|
|
|
7498
7503
|
return;
|
|
7499
7504
|
}
|
|
7500
7505
|
|
|
7501
|
-
logger$
|
|
7506
|
+
logger$4.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7502
7507
|
|
|
7503
7508
|
try {
|
|
7504
7509
|
sipSession.message({
|
|
@@ -7540,7 +7545,7 @@ class WebRTCClient extends Emitter {
|
|
|
7540
7545
|
}
|
|
7541
7546
|
|
|
7542
7547
|
changeAudioOutputVolume(volume ) {
|
|
7543
|
-
logger$
|
|
7548
|
+
logger$4.info('Changing audio output volume', { volume });
|
|
7544
7549
|
|
|
7545
7550
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7546
7551
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7552,7 +7557,7 @@ class WebRTCClient extends Emitter {
|
|
|
7552
7557
|
}
|
|
7553
7558
|
|
|
7554
7559
|
changeAudioOutputDevice(id ) {
|
|
7555
|
-
logger$
|
|
7560
|
+
logger$4.info('Changing audio output device', { id });
|
|
7556
7561
|
|
|
7557
7562
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7558
7563
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7569,7 +7574,7 @@ class WebRTCClient extends Emitter {
|
|
|
7569
7574
|
|
|
7570
7575
|
changeAudioInputDevice(id , session ) {
|
|
7571
7576
|
const currentId = this.getAudioDeviceId();
|
|
7572
|
-
logger$
|
|
7577
|
+
logger$4.info('setting audio input device', { id, currentId, session: !!session });
|
|
7573
7578
|
|
|
7574
7579
|
if (id === currentId) {
|
|
7575
7580
|
return null;
|
|
@@ -7615,7 +7620,7 @@ class WebRTCClient extends Emitter {
|
|
|
7615
7620
|
|
|
7616
7621
|
setVideoInputDevice(id ) {
|
|
7617
7622
|
const currentId = this.getVideoDeviceId();
|
|
7618
|
-
logger$
|
|
7623
|
+
logger$4.info('setting video input device', { id, currentId });
|
|
7619
7624
|
|
|
7620
7625
|
if (id === currentId) {
|
|
7621
7626
|
return null;
|
|
@@ -7640,7 +7645,7 @@ class WebRTCClient extends Emitter {
|
|
|
7640
7645
|
const sessionId = this.getSipSessionId(session);
|
|
7641
7646
|
const localStream = this.getLocalStream(sessionId);
|
|
7642
7647
|
|
|
7643
|
-
logger$
|
|
7648
|
+
logger$4.info('changing video input device', { id, sessionId });
|
|
7644
7649
|
|
|
7645
7650
|
// Release old video stream
|
|
7646
7651
|
if (localStream) {
|
|
@@ -7708,7 +7713,7 @@ class WebRTCClient extends Emitter {
|
|
|
7708
7713
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7709
7714
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7710
7715
|
|
|
7711
|
-
logger$
|
|
7716
|
+
logger$4.info('Sending reinvite', {
|
|
7712
7717
|
id: this.getSipSessionId(sipSession),
|
|
7713
7718
|
newConstraints,
|
|
7714
7719
|
conference,
|
|
@@ -7746,7 +7751,7 @@ class WebRTCClient extends Emitter {
|
|
|
7746
7751
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7747
7752
|
}
|
|
7748
7753
|
|
|
7749
|
-
logger$
|
|
7754
|
+
logger$4.info('on re-INVITE accepted', {
|
|
7750
7755
|
id: this.getSipSessionId(sipSession),
|
|
7751
7756
|
wasMuted,
|
|
7752
7757
|
shouldDoScreenSharing,
|
|
@@ -7764,7 +7769,7 @@ class WebRTCClient extends Emitter {
|
|
|
7764
7769
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7765
7770
|
}
|
|
7766
7771
|
|
|
7767
|
-
return this.eventEmitter.emit(ON_REINVITE
|
|
7772
|
+
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7768
7773
|
},
|
|
7769
7774
|
},
|
|
7770
7775
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7921,7 +7926,7 @@ class WebRTCClient extends Emitter {
|
|
|
7921
7926
|
}
|
|
7922
7927
|
|
|
7923
7928
|
startHeartbeat() {
|
|
7924
|
-
logger$
|
|
7929
|
+
logger$4.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7925
7930
|
if (!this.userAgent) {
|
|
7926
7931
|
this.heartbeat.stop();
|
|
7927
7932
|
return;
|
|
@@ -7934,7 +7939,7 @@ class WebRTCClient extends Emitter {
|
|
|
7934
7939
|
}
|
|
7935
7940
|
|
|
7936
7941
|
stopHeartbeat() {
|
|
7937
|
-
logger$
|
|
7942
|
+
logger$4.info('sdk webrtc stop heartbeat');
|
|
7938
7943
|
this.heartbeat.stop();
|
|
7939
7944
|
}
|
|
7940
7945
|
|
|
@@ -7955,7 +7960,7 @@ class WebRTCClient extends Emitter {
|
|
|
7955
7960
|
}
|
|
7956
7961
|
|
|
7957
7962
|
attemptReconnection() {
|
|
7958
|
-
logger$
|
|
7963
|
+
logger$4.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7959
7964
|
if (!this.userAgent) {
|
|
7960
7965
|
return;
|
|
7961
7966
|
}
|
|
@@ -7980,7 +7985,7 @@ class WebRTCClient extends Emitter {
|
|
|
7980
7985
|
return;
|
|
7981
7986
|
}
|
|
7982
7987
|
|
|
7983
|
-
logger$
|
|
7988
|
+
logger$4.info('setting local media stream', {
|
|
7984
7989
|
sipSessionId,
|
|
7985
7990
|
tracks: newStream ? newStream.getTracks() : null,
|
|
7986
7991
|
});
|
|
@@ -7997,7 +8002,7 @@ class WebRTCClient extends Emitter {
|
|
|
7997
8002
|
|
|
7998
8003
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
7999
8004
|
|
|
8000
|
-
logger$
|
|
8005
|
+
logger$4.info('updating local stream', {
|
|
8001
8006
|
sipSessionId,
|
|
8002
8007
|
oldStream: !!oldStream,
|
|
8003
8008
|
tracks: newStream.getTracks(),
|
|
@@ -8017,7 +8022,7 @@ class WebRTCClient extends Emitter {
|
|
|
8017
8022
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
8018
8023
|
const pc = this.getPeerConnection(sessionId);
|
|
8019
8024
|
|
|
8020
|
-
logger$
|
|
8025
|
+
logger$4.info('Updating remote stream', {
|
|
8021
8026
|
sessionId,
|
|
8022
8027
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
8023
8028
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -8043,7 +8048,7 @@ class WebRTCClient extends Emitter {
|
|
|
8043
8048
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
8044
8049
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
8045
8050
|
|
|
8046
|
-
logger$
|
|
8051
|
+
logger$4.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
8047
8052
|
|
|
8048
8053
|
return {
|
|
8049
8054
|
constraints: {
|
|
@@ -8092,7 +8097,7 @@ class WebRTCClient extends Emitter {
|
|
|
8092
8097
|
}
|
|
8093
8098
|
|
|
8094
8099
|
_onTransportError() {
|
|
8095
|
-
logger$
|
|
8100
|
+
logger$4.error('on transport error');
|
|
8096
8101
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
8097
8102
|
this.attemptReconnection();
|
|
8098
8103
|
}
|
|
@@ -8101,7 +8106,7 @@ class WebRTCClient extends Emitter {
|
|
|
8101
8106
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
8102
8107
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
8103
8108
|
if (this.hasHeartbeat()) {
|
|
8104
|
-
logger$
|
|
8109
|
+
logger$4.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
8105
8110
|
|
|
8106
8111
|
this.heartbeat.onHeartbeat();
|
|
8107
8112
|
if (this.heartbeatCb) {
|
|
@@ -8112,7 +8117,7 @@ class WebRTCClient extends Emitter {
|
|
|
8112
8117
|
}
|
|
8113
8118
|
|
|
8114
8119
|
async _onHeartbeatTimeout() {
|
|
8115
|
-
logger$
|
|
8120
|
+
logger$4.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
8116
8121
|
|
|
8117
8122
|
if (this.heartbeatTimeoutCb) {
|
|
8118
8123
|
this.heartbeatTimeoutCb();
|
|
@@ -8124,7 +8129,7 @@ class WebRTCClient extends Emitter {
|
|
|
8124
8129
|
try {
|
|
8125
8130
|
await this.userAgent.transport.disconnect();
|
|
8126
8131
|
} catch (e) {
|
|
8127
|
-
logger$
|
|
8132
|
+
logger$4.error('Transport disconnection after heartbeat timeout, error', e);
|
|
8128
8133
|
}
|
|
8129
8134
|
}
|
|
8130
8135
|
|
|
@@ -8157,31 +8162,31 @@ class WebRTCClient extends Emitter {
|
|
|
8157
8162
|
}
|
|
8158
8163
|
|
|
8159
8164
|
_connectIfNeeded() {
|
|
8160
|
-
logger$
|
|
8165
|
+
logger$4.info('connect if needed, checking', { connected: this.isConnected() });
|
|
8161
8166
|
if (!this.userAgent) {
|
|
8162
|
-
logger$
|
|
8167
|
+
logger$4.info('need to recreate User Agent');
|
|
8163
8168
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
8164
8169
|
}
|
|
8165
8170
|
|
|
8166
8171
|
if (this.isConnected()) {
|
|
8167
|
-
logger$
|
|
8172
|
+
logger$4.info('webrtc sdk, already connected');
|
|
8168
8173
|
return Promise.resolve();
|
|
8169
8174
|
}
|
|
8170
8175
|
|
|
8171
8176
|
if (this.isConnecting()) {
|
|
8172
|
-
logger$
|
|
8177
|
+
logger$4.info('webrtc sdk, already connecting...');
|
|
8173
8178
|
|
|
8174
8179
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
8175
8180
|
return this.connectionPromise;
|
|
8176
8181
|
}
|
|
8177
8182
|
|
|
8178
8183
|
if (this.connectionPromise) {
|
|
8179
|
-
logger$
|
|
8184
|
+
logger$4.info('webrtc sdk, connection promise connecting...');
|
|
8180
8185
|
// $FlowFixMe
|
|
8181
8186
|
return this.connectionPromise;
|
|
8182
8187
|
}
|
|
8183
8188
|
|
|
8184
|
-
logger$
|
|
8189
|
+
logger$4.info('WebRTC UA needs to connect');
|
|
8185
8190
|
|
|
8186
8191
|
// Force UA to reconnect
|
|
8187
8192
|
if (this.userAgent && this.userAgent.state !== UserAgentState.Stopped) {
|
|
@@ -8306,7 +8311,7 @@ class WebRTCClient extends Emitter {
|
|
|
8306
8311
|
|
|
8307
8312
|
sdh.peerConnectionDelegate = {
|
|
8308
8313
|
onicecandidateerror: (error ) => {
|
|
8309
|
-
logger$
|
|
8314
|
+
logger$4.error('on icecandidate error', {
|
|
8310
8315
|
address: error.address,
|
|
8311
8316
|
port: error.port,
|
|
8312
8317
|
errorCode: error.errorCode,
|
|
@@ -8335,7 +8340,7 @@ class WebRTCClient extends Emitter {
|
|
|
8335
8340
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8336
8341
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8337
8342
|
}
|
|
8338
|
-
logger$
|
|
8343
|
+
logger$4.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8339
8344
|
|
|
8340
8345
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8341
8346
|
|
|
@@ -8351,12 +8356,12 @@ class WebRTCClient extends Emitter {
|
|
|
8351
8356
|
|
|
8352
8357
|
this._setupMedias(session);
|
|
8353
8358
|
|
|
8354
|
-
return this.eventEmitter.emit(ON_REINVITE
|
|
8359
|
+
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8355
8360
|
};
|
|
8356
8361
|
}
|
|
8357
8362
|
|
|
8358
8363
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8359
|
-
logger$
|
|
8364
|
+
logger$4.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8360
8365
|
|
|
8361
8366
|
this.storeSipSession(session);
|
|
8362
8367
|
|
|
@@ -8368,14 +8373,14 @@ class WebRTCClient extends Emitter {
|
|
|
8368
8373
|
const onTrack = (event ) => {
|
|
8369
8374
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8370
8375
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8371
|
-
logger$
|
|
8376
|
+
logger$4.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8372
8377
|
|
|
8373
8378
|
// Stop video track in audio only mode
|
|
8374
8379
|
if (isAudioOnly && kind === 'video') {
|
|
8375
8380
|
event.track.stop();
|
|
8376
8381
|
}
|
|
8377
8382
|
|
|
8378
|
-
this.eventEmitter.emit(ON_TRACK
|
|
8383
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8379
8384
|
};
|
|
8380
8385
|
|
|
8381
8386
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8385,9 +8390,9 @@ class WebRTCClient extends Emitter {
|
|
|
8385
8390
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8386
8391
|
|
|
8387
8392
|
pc.oniceconnectionstatechange = () => {
|
|
8388
|
-
logger$
|
|
8393
|
+
logger$4.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8389
8394
|
if (pc.iceConnectionState === 'disconnected') {
|
|
8390
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
8395
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
8391
8396
|
}
|
|
8392
8397
|
};
|
|
8393
8398
|
|
|
@@ -8558,10 +8563,10 @@ class WebRTCClient extends Emitter {
|
|
|
8558
8563
|
|
|
8559
8564
|
_stopSendingStats(session ) {
|
|
8560
8565
|
const sessionId = this.getSipSessionId(session);
|
|
8561
|
-
logger$
|
|
8566
|
+
logger$4.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8562
8567
|
|
|
8563
8568
|
if (sessionId in this.statsIntervals) {
|
|
8564
|
-
logger$
|
|
8569
|
+
logger$4.trace('Stop sending stats for call', { sessionId });
|
|
8565
8570
|
this.statsIntervals[sessionId]();
|
|
8566
8571
|
delete this.statsIntervals[sessionId];
|
|
8567
8572
|
}
|
|
@@ -8577,7 +8582,7 @@ class WebRTCClient extends Emitter {
|
|
|
8577
8582
|
try {
|
|
8578
8583
|
await this.userAgent.transport.disconnect();
|
|
8579
8584
|
} catch (e) {
|
|
8580
|
-
logger$
|
|
8585
|
+
logger$4.error('WebRTC transport disconnect, error', e);
|
|
8581
8586
|
}
|
|
8582
8587
|
}
|
|
8583
8588
|
}
|
|
@@ -8671,7 +8676,7 @@ class WebRTCClient extends Emitter {
|
|
|
8671
8676
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8672
8677
|
+ networkStats.transportSent;
|
|
8673
8678
|
|
|
8674
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
8679
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8675
8680
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8676
8681
|
}
|
|
8677
8682
|
|
|
@@ -8699,8 +8704,8 @@ const ON_CALL_FAILED = 'onCallFailed';
|
|
|
8699
8704
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8700
8705
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8701
8706
|
const ON_MESSAGE = 'onMessage';
|
|
8702
|
-
const ON_REINVITE = 'reinvite';
|
|
8703
|
-
const ON_TRACK = 'onTrack';
|
|
8707
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
8708
|
+
const ON_TRACK$1 = 'onTrack';
|
|
8704
8709
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8705
8710
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8706
8711
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8715,15 +8720,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8715
8720
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8716
8721
|
const ON_CALL_ERROR = 'onCallError';
|
|
8717
8722
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8718
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8723
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
8719
8724
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8720
8725
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8721
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
8726
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
8722
8727
|
|
|
8723
8728
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8724
8729
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8725
8730
|
|
|
8726
|
-
const events = [
|
|
8731
|
+
const events$1 = [
|
|
8727
8732
|
ON_USER_AGENT,
|
|
8728
8733
|
ON_REGISTERED,
|
|
8729
8734
|
ON_UNREGISTERED,
|
|
@@ -8741,8 +8746,8 @@ const events = [
|
|
|
8741
8746
|
ON_CALL_FAILED,
|
|
8742
8747
|
ON_CALL_ENDED,
|
|
8743
8748
|
ON_MESSAGE,
|
|
8744
|
-
ON_REINVITE,
|
|
8745
|
-
ON_TRACK,
|
|
8749
|
+
ON_REINVITE$1,
|
|
8750
|
+
ON_TRACK$1,
|
|
8746
8751
|
ON_AUDIO_STREAM,
|
|
8747
8752
|
ON_VIDEO_STREAM,
|
|
8748
8753
|
ON_REMOVE_STREAM,
|
|
@@ -8757,11 +8762,11 @@ const events = [
|
|
|
8757
8762
|
ON_CALL_ERROR,
|
|
8758
8763
|
ON_CHAT,
|
|
8759
8764
|
ON_SIGNAL,
|
|
8760
|
-
ON_NETWORK_STATS,
|
|
8761
|
-
ON_DISCONNECTED,
|
|
8765
|
+
ON_NETWORK_STATS$1,
|
|
8766
|
+
ON_DISCONNECTED$1,
|
|
8762
8767
|
];
|
|
8763
8768
|
|
|
8764
|
-
const logger$
|
|
8769
|
+
const logger$5 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8765
8770
|
|
|
8766
8771
|
class WebRTCPhone extends Emitter {
|
|
8767
8772
|
|
|
@@ -8834,7 +8839,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8834
8839
|
}).catch(error => {
|
|
8835
8840
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8836
8841
|
console.error('register error', error, error.message, error.stack);
|
|
8837
|
-
logger$
|
|
8842
|
+
logger$5.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8838
8843
|
});
|
|
8839
8844
|
}
|
|
8840
8845
|
|
|
@@ -8849,7 +8854,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8849
8854
|
if (!this.client) {
|
|
8850
8855
|
return;
|
|
8851
8856
|
}
|
|
8852
|
-
logger$
|
|
8857
|
+
logger$5.info('WebRTC phone stop');
|
|
8853
8858
|
this.client.stop();
|
|
8854
8859
|
}
|
|
8855
8860
|
|
|
@@ -8864,7 +8869,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8864
8869
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8865
8870
|
audioOnly = false, iceRestart = false) {
|
|
8866
8871
|
const sipSession = this.findSipSession(callSession);
|
|
8867
|
-
logger$
|
|
8872
|
+
logger$5.info('WebRTC phone - send reinvite', {
|
|
8868
8873
|
sessionId: sipSession ? sipSession.id : null,
|
|
8869
8874
|
constraints,
|
|
8870
8875
|
audioOnly,
|
|
@@ -8901,7 +8906,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8901
8906
|
}
|
|
8902
8907
|
|
|
8903
8908
|
startHeartbeat() {
|
|
8904
|
-
logger$
|
|
8909
|
+
logger$5.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8905
8910
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8906
8911
|
return;
|
|
8907
8912
|
}
|
|
@@ -8910,7 +8915,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8910
8915
|
}
|
|
8911
8916
|
|
|
8912
8917
|
stopHeartbeat() {
|
|
8913
|
-
logger$
|
|
8918
|
+
logger$5.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8914
8919
|
if (!this.client) {
|
|
8915
8920
|
return;
|
|
8916
8921
|
}
|
|
@@ -8927,7 +8932,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8927
8932
|
}
|
|
8928
8933
|
|
|
8929
8934
|
reconnect() {
|
|
8930
|
-
logger$
|
|
8935
|
+
logger$5.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8931
8936
|
if (!this.client) {
|
|
8932
8937
|
return;
|
|
8933
8938
|
}
|
|
@@ -8968,10 +8973,15 @@ class WebRTCPhone extends Emitter {
|
|
|
8968
8973
|
return false;
|
|
8969
8974
|
}
|
|
8970
8975
|
|
|
8971
|
-
logger$
|
|
8976
|
+
logger$5.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8972
8977
|
|
|
8973
8978
|
this.client.downgradeToAudio(sipSession);
|
|
8974
8979
|
|
|
8980
|
+
if (callSession) {
|
|
8981
|
+
callSession.cameraEnabled = false;
|
|
8982
|
+
this._updateCallSession(callSession);
|
|
8983
|
+
}
|
|
8984
|
+
|
|
8975
8985
|
if (withMessage) {
|
|
8976
8986
|
this._sendReinviteMessage(callSession, false);
|
|
8977
8987
|
}
|
|
@@ -8986,7 +8996,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8986
8996
|
return Promise.resolve(false);
|
|
8987
8997
|
}
|
|
8988
8998
|
|
|
8989
|
-
logger$
|
|
8999
|
+
logger$5.info('Upgrade to video', {
|
|
8990
9000
|
id: callSession ? callSession.getId() : null,
|
|
8991
9001
|
constraints,
|
|
8992
9002
|
isConference,
|
|
@@ -8999,6 +9009,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8999
9009
|
|
|
9000
9010
|
const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
|
|
9001
9011
|
|
|
9012
|
+
if (callSession) {
|
|
9013
|
+
callSession.cameraEnabled = true;
|
|
9014
|
+
this._updateCallSession(callSession);
|
|
9015
|
+
}
|
|
9016
|
+
|
|
9002
9017
|
// If no stream is returned, it means we have to reinvite
|
|
9003
9018
|
if (!newStream) {
|
|
9004
9019
|
return true;
|
|
@@ -9021,7 +9036,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9021
9036
|
|
|
9022
9037
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
9023
9038
|
const sipSession = this.findSipSession(callSession);
|
|
9024
|
-
logger$
|
|
9039
|
+
logger$5.info('Sending reinvite message', {
|
|
9025
9040
|
id: callSession ? callSession.getId() : null,
|
|
9026
9041
|
isUpgrade,
|
|
9027
9042
|
});
|
|
@@ -9047,7 +9062,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9047
9062
|
// Monkey patch to know when canceled with the CANCEL message
|
|
9048
9063
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
9049
9064
|
sipSession._onCancel = (message ) => {
|
|
9050
|
-
logger$
|
|
9065
|
+
logger$5.trace('on sip session canceled', { callId: message.callId });
|
|
9051
9066
|
|
|
9052
9067
|
onCancel(message);
|
|
9053
9068
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -9075,13 +9090,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9075
9090
|
this.audioOutputVolume,
|
|
9076
9091
|
);
|
|
9077
9092
|
case SessionState.Terminating:
|
|
9078
|
-
logger$
|
|
9093
|
+
logger$5.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
9079
9094
|
|
|
9080
9095
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
9081
9096
|
|
|
9082
9097
|
break;
|
|
9083
9098
|
case SessionState.Terminated: {
|
|
9084
|
-
logger$
|
|
9099
|
+
logger$5.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9085
9100
|
|
|
9086
9101
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9087
9102
|
const callSession = this._createCallSession(sipSession);
|
|
@@ -9103,7 +9118,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9103
9118
|
const [stream] = event.streams;
|
|
9104
9119
|
const kind = event && event.track && event.track.kind;
|
|
9105
9120
|
|
|
9106
|
-
logger$
|
|
9121
|
+
logger$5.info('on track stream called on the peer connection', {
|
|
9107
9122
|
callId: this.getSipSessionId(sipSession),
|
|
9108
9123
|
streamId: stream ? stream.id : null,
|
|
9109
9124
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -9123,7 +9138,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9123
9138
|
};
|
|
9124
9139
|
|
|
9125
9140
|
peerConnection.onremovestream = event => {
|
|
9126
|
-
logger$
|
|
9141
|
+
logger$5.info('on remove stream called on the peer connection', {
|
|
9127
9142
|
id: event.stream.id,
|
|
9128
9143
|
tracks: event.stream.getTracks(),
|
|
9129
9144
|
});
|
|
@@ -9133,7 +9148,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9133
9148
|
}
|
|
9134
9149
|
|
|
9135
9150
|
async startScreenSharing(constraints , callSession ) {
|
|
9136
|
-
logger$
|
|
9151
|
+
logger$5.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
9137
9152
|
|
|
9138
9153
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
9139
9154
|
if (!screenShareStream) {
|
|
@@ -9173,7 +9188,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9173
9188
|
return;
|
|
9174
9189
|
}
|
|
9175
9190
|
|
|
9176
|
-
logger$
|
|
9191
|
+
logger$5.info('WebRTC phone - stop screen sharing', {
|
|
9177
9192
|
restoreLocalStream,
|
|
9178
9193
|
});
|
|
9179
9194
|
|
|
@@ -9229,7 +9244,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9229
9244
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
9230
9245
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9231
9246
|
|
|
9232
|
-
logger$
|
|
9247
|
+
logger$5.info('WebRTC phone - on screensharing', {
|
|
9233
9248
|
hadVideo,
|
|
9234
9249
|
id: this.getSipSessionId(sipSession),
|
|
9235
9250
|
screenTrack,
|
|
@@ -9237,7 +9252,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9237
9252
|
|
|
9238
9253
|
if (screenTrack) {
|
|
9239
9254
|
screenTrack.onended = () => {
|
|
9240
|
-
logger$
|
|
9255
|
+
logger$5.info('WebRTC phone - on screenshare ended', {
|
|
9241
9256
|
hadVideo,
|
|
9242
9257
|
id: this.getSipSessionId(sipSession),
|
|
9243
9258
|
screenTrack,
|
|
@@ -9268,7 +9283,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9268
9283
|
}
|
|
9269
9284
|
|
|
9270
9285
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9271
|
-
logger$
|
|
9286
|
+
logger$5.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9272
9287
|
|
|
9273
9288
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9274
9289
|
this.currentSipSession = sipSession;
|
|
@@ -9286,7 +9301,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9286
9301
|
}
|
|
9287
9302
|
|
|
9288
9303
|
changeAudioDevice(id ) {
|
|
9289
|
-
logger$
|
|
9304
|
+
logger$5.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9290
9305
|
this.audioOutputDeviceId = id;
|
|
9291
9306
|
this.client.changeAudioOutputDevice(id);
|
|
9292
9307
|
}
|
|
@@ -9296,14 +9311,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9296
9311
|
}
|
|
9297
9312
|
|
|
9298
9313
|
changeRingDevice(id ) {
|
|
9299
|
-
logger$
|
|
9314
|
+
logger$5.info('WebRTC phone - changing ring device', { id });
|
|
9300
9315
|
|
|
9301
9316
|
this.audioRingDeviceId = id;
|
|
9302
9317
|
}
|
|
9303
9318
|
|
|
9304
9319
|
// volume is a value between 0 and 1
|
|
9305
9320
|
changeAudioVolume(volume ) {
|
|
9306
|
-
logger$
|
|
9321
|
+
logger$5.info('WebRTC phone - changing audio volume', { volume });
|
|
9307
9322
|
|
|
9308
9323
|
this.audioOutputVolume = volume;
|
|
9309
9324
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9311,31 +9326,31 @@ class WebRTCPhone extends Emitter {
|
|
|
9311
9326
|
|
|
9312
9327
|
// volume is a value between 0 and 1
|
|
9313
9328
|
changeRingVolume(volume ) {
|
|
9314
|
-
logger$
|
|
9329
|
+
logger$5.info('WebRTC phone - changing ring volume', { volume });
|
|
9315
9330
|
|
|
9316
9331
|
this.audioRingVolume = volume;
|
|
9317
9332
|
}
|
|
9318
9333
|
|
|
9319
9334
|
changeAudioInputDevice(id ) {
|
|
9320
|
-
logger$
|
|
9335
|
+
logger$5.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9321
9336
|
|
|
9322
9337
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9323
9338
|
}
|
|
9324
9339
|
|
|
9325
9340
|
changeVideoInputDevice(id ) {
|
|
9326
|
-
logger$
|
|
9341
|
+
logger$5.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9327
9342
|
|
|
9328
9343
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9329
9344
|
}
|
|
9330
9345
|
|
|
9331
9346
|
changeSessionVideoInputDevice(id ) {
|
|
9332
|
-
logger$
|
|
9347
|
+
logger$5.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9333
9348
|
|
|
9334
9349
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9335
9350
|
}
|
|
9336
9351
|
|
|
9337
9352
|
_onCallTerminated(sipSession ) {
|
|
9338
|
-
logger$
|
|
9353
|
+
logger$5.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9339
9354
|
|
|
9340
9355
|
const callSession = this._createCallSession(sipSession);
|
|
9341
9356
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
@@ -9369,7 +9384,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9369
9384
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9370
9385
|
|
|
9371
9386
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9372
|
-
logger$
|
|
9387
|
+
logger$5.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9373
9388
|
sipId: sipSession.id,
|
|
9374
9389
|
shouldRetrigger,
|
|
9375
9390
|
hasIncomingCallSession,
|
|
@@ -9460,37 +9475,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9460
9475
|
|
|
9461
9476
|
// Deprecated
|
|
9462
9477
|
getLocalStreamForCall(callSession ) {
|
|
9463
|
-
logger$
|
|
9478
|
+
logger$5.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9464
9479
|
|
|
9465
9480
|
return this.getLocalStream(callSession);
|
|
9466
9481
|
}
|
|
9467
9482
|
|
|
9468
9483
|
// Deprecated
|
|
9469
9484
|
getRemoteStreamForCall(callSession ) {
|
|
9470
|
-
logger$
|
|
9485
|
+
logger$5.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9471
9486
|
|
|
9472
9487
|
return this.getRemoteVideoStream(callSession);
|
|
9473
9488
|
}
|
|
9474
9489
|
|
|
9475
9490
|
getRemoteStreamsForCall(callSession ) {
|
|
9476
|
-
logger$
|
|
9491
|
+
logger$5.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9477
9492
|
|
|
9478
9493
|
return this.getRemoteStream(callSession);
|
|
9479
9494
|
}
|
|
9480
9495
|
|
|
9481
9496
|
accept(callSession , cameraEnabled ) {
|
|
9482
|
-
logger$
|
|
9497
|
+
logger$5.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9483
9498
|
if (this.currentSipSession) {
|
|
9484
9499
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9485
9500
|
}
|
|
9486
9501
|
|
|
9487
9502
|
if (!callSession) {
|
|
9488
|
-
logger$
|
|
9503
|
+
logger$5.warn('no CallSession to accept.');
|
|
9489
9504
|
return Promise.resolve(null);
|
|
9490
9505
|
}
|
|
9491
9506
|
|
|
9492
9507
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9493
|
-
logger$
|
|
9508
|
+
logger$5.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9494
9509
|
return Promise.resolve(callSession.sipCallId);
|
|
9495
9510
|
}
|
|
9496
9511
|
|
|
@@ -9502,24 +9517,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9502
9517
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9503
9518
|
if (sipSession) {
|
|
9504
9519
|
if (sipSession.state === SessionState.Terminated || sipSession.state === SessionState.Terminating) {
|
|
9505
|
-
logger$
|
|
9520
|
+
logger$5.warn('Trying to answer a terminated sipSession.');
|
|
9506
9521
|
|
|
9507
9522
|
return Promise.resolve(null);
|
|
9508
9523
|
}
|
|
9509
9524
|
|
|
9510
|
-
logger$
|
|
9525
|
+
logger$5.info('accept call, session found', { sipId: sipSession.id });
|
|
9511
9526
|
|
|
9512
9527
|
// $FlowFixMe
|
|
9513
9528
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9514
9529
|
return callSession.sipCallId;
|
|
9515
9530
|
}).catch(e => {
|
|
9516
|
-
logger$
|
|
9531
|
+
logger$5.error(e);
|
|
9517
9532
|
this.endCurrentCall(callSession);
|
|
9518
9533
|
throw e;
|
|
9519
9534
|
});
|
|
9520
9535
|
}
|
|
9521
9536
|
|
|
9522
|
-
logger$
|
|
9537
|
+
logger$5.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9523
9538
|
|
|
9524
9539
|
return Promise.resolve(null);
|
|
9525
9540
|
}
|
|
@@ -9529,7 +9544,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9529
9544
|
}
|
|
9530
9545
|
|
|
9531
9546
|
async reject(callSession ) {
|
|
9532
|
-
logger$
|
|
9547
|
+
logger$5.info('reject WebRTC called', { id: callSession.getId() });
|
|
9533
9548
|
|
|
9534
9549
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9535
9550
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9541,14 +9556,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9541
9556
|
|
|
9542
9557
|
const sipSession = this.findSipSession(callSession);
|
|
9543
9558
|
if (sipSession) {
|
|
9544
|
-
logger$
|
|
9559
|
+
logger$5.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9545
9560
|
|
|
9546
9561
|
this.client.hangup(sipSession);
|
|
9547
9562
|
}
|
|
9548
9563
|
}
|
|
9549
9564
|
|
|
9550
9565
|
async ignore(callSession ) {
|
|
9551
|
-
logger$
|
|
9566
|
+
logger$5.info('WebRTC ignore', { id: callSession.getId() });
|
|
9552
9567
|
|
|
9553
9568
|
// kill the ring
|
|
9554
9569
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9560,14 +9575,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9560
9575
|
const sipSession = this.findSipSession(callSession);
|
|
9561
9576
|
|
|
9562
9577
|
if (sipSession) {
|
|
9563
|
-
logger$
|
|
9578
|
+
logger$5.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9564
9579
|
|
|
9565
9580
|
return this.client.atxfer(sipSession);
|
|
9566
9581
|
}
|
|
9567
9582
|
}
|
|
9568
9583
|
|
|
9569
9584
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9570
|
-
logger$
|
|
9585
|
+
logger$5.info('WebRTC hold', { id: callSession.getId() });
|
|
9571
9586
|
|
|
9572
9587
|
const sipSession = this.findSipSession(callSession);
|
|
9573
9588
|
|
|
@@ -9582,18 +9597,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9582
9597
|
}
|
|
9583
9598
|
|
|
9584
9599
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9585
|
-
logger$
|
|
9600
|
+
logger$5.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9586
9601
|
|
|
9587
9602
|
const sipSession = this.findSipSession(callSession);
|
|
9588
9603
|
if (!sipSession) {
|
|
9589
9604
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9590
9605
|
}
|
|
9591
9606
|
|
|
9592
|
-
logger$
|
|
9607
|
+
logger$5.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9593
9608
|
|
|
9594
9609
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9595
9610
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9596
|
-
logger$
|
|
9611
|
+
logger$5.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9597
9612
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9598
9613
|
}
|
|
9599
9614
|
|
|
@@ -9618,7 +9633,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9618
9633
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9619
9634
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9620
9635
|
|
|
9621
|
-
logger$
|
|
9636
|
+
logger$5.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9622
9637
|
|
|
9623
9638
|
// Stop screenshre if needed
|
|
9624
9639
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9649,7 +9664,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9649
9664
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9650
9665
|
}
|
|
9651
9666
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9652
|
-
logger$
|
|
9667
|
+
logger$5.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9653
9668
|
|
|
9654
9669
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9655
9670
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9693,14 +9708,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9693
9708
|
}
|
|
9694
9709
|
|
|
9695
9710
|
mute(callSession , withEvent = true) {
|
|
9696
|
-
logger$
|
|
9711
|
+
logger$5.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9697
9712
|
|
|
9698
9713
|
const sipSession = this.findSipSession(callSession);
|
|
9699
9714
|
if (!sipSession) {
|
|
9700
9715
|
return;
|
|
9701
9716
|
}
|
|
9702
9717
|
|
|
9703
|
-
logger$
|
|
9718
|
+
logger$5.info('WebRTC muting', { sipId: sipSession.id });
|
|
9704
9719
|
this.client.mute(sipSession);
|
|
9705
9720
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9706
9721
|
|
|
@@ -9714,14 +9729,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9714
9729
|
}
|
|
9715
9730
|
|
|
9716
9731
|
unmute(callSession , withEvent = true) {
|
|
9717
|
-
logger$
|
|
9732
|
+
logger$5.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9718
9733
|
|
|
9719
9734
|
const sipSession = this.findSipSession(callSession);
|
|
9720
9735
|
if (!sipSession) {
|
|
9721
9736
|
return;
|
|
9722
9737
|
}
|
|
9723
9738
|
|
|
9724
|
-
logger$
|
|
9739
|
+
logger$5.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9725
9740
|
this.client.unmute(sipSession);
|
|
9726
9741
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9727
9742
|
|
|
@@ -9748,7 +9763,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9748
9763
|
if (!sipSession) {
|
|
9749
9764
|
return;
|
|
9750
9765
|
}
|
|
9751
|
-
logger$
|
|
9766
|
+
logger$5.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9752
9767
|
|
|
9753
9768
|
this.client.toggleCameraOn(sipSession);
|
|
9754
9769
|
|
|
@@ -9760,7 +9775,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9760
9775
|
if (!sipSession) {
|
|
9761
9776
|
return;
|
|
9762
9777
|
}
|
|
9763
|
-
logger$
|
|
9778
|
+
logger$5.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9764
9779
|
|
|
9765
9780
|
this.client.toggleCameraOff(sipSession);
|
|
9766
9781
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9772,7 +9787,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9772
9787
|
return;
|
|
9773
9788
|
}
|
|
9774
9789
|
|
|
9775
|
-
logger$
|
|
9790
|
+
logger$5.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9776
9791
|
this.client.sendDTMF(sipSession, tone);
|
|
9777
9792
|
}
|
|
9778
9793
|
|
|
@@ -9780,7 +9795,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9780
9795
|
// @TODO: line is not used here
|
|
9781
9796
|
async makeCall(number , line , cameraEnabled ,
|
|
9782
9797
|
audioOnly = false, conference = false) {
|
|
9783
|
-
logger$
|
|
9798
|
+
logger$5.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
|
|
9784
9799
|
if (!number) {
|
|
9785
9800
|
return Promise.resolve(null);
|
|
9786
9801
|
}
|
|
@@ -9790,7 +9805,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9790
9805
|
}
|
|
9791
9806
|
if (this.currentSipSession) {
|
|
9792
9807
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9793
|
-
logger$
|
|
9808
|
+
logger$5.warn('Unable to hold current session when making another call', e);
|
|
9794
9809
|
});
|
|
9795
9810
|
}
|
|
9796
9811
|
|
|
@@ -9800,7 +9815,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9800
9815
|
this._bindEvents(sipSession);
|
|
9801
9816
|
} catch (error) {
|
|
9802
9817
|
console.warn(error);
|
|
9803
|
-
logger$
|
|
9818
|
+
logger$5.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9804
9819
|
return Promise.resolve(null);
|
|
9805
9820
|
}
|
|
9806
9821
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
@@ -9828,7 +9843,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9828
9843
|
return;
|
|
9829
9844
|
}
|
|
9830
9845
|
|
|
9831
|
-
logger$
|
|
9846
|
+
logger$5.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9832
9847
|
|
|
9833
9848
|
this.client.transfer(sipSession, target);
|
|
9834
9849
|
}
|
|
@@ -9837,7 +9852,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9837
9852
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9838
9853
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9839
9854
|
|
|
9840
|
-
logger$
|
|
9855
|
+
logger$5.info('WebRTC indirect transfer', {
|
|
9841
9856
|
sipId: sipSession ? sipSession.id : null,
|
|
9842
9857
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9843
9858
|
});
|
|
@@ -9876,7 +9891,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9876
9891
|
return false;
|
|
9877
9892
|
}
|
|
9878
9893
|
|
|
9879
|
-
logger$
|
|
9894
|
+
logger$5.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9880
9895
|
|
|
9881
9896
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9882
9897
|
|
|
@@ -9922,7 +9937,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9922
9937
|
endCurrentCall(callSession ) {
|
|
9923
9938
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9924
9939
|
|
|
9925
|
-
logger$
|
|
9940
|
+
logger$5.info('Ending current call', {
|
|
9926
9941
|
id: callSession ? callSession.getId() : null,
|
|
9927
9942
|
isCurrent,
|
|
9928
9943
|
});
|
|
@@ -9946,7 +9961,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9946
9961
|
}
|
|
9947
9962
|
|
|
9948
9963
|
async close() {
|
|
9949
|
-
logger$
|
|
9964
|
+
logger$5.info('WebRTC close');
|
|
9950
9965
|
|
|
9951
9966
|
try {
|
|
9952
9967
|
await Promise.race([
|
|
@@ -9954,7 +9969,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9954
9969
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9955
9970
|
]);
|
|
9956
9971
|
} catch (e) {
|
|
9957
|
-
logger$
|
|
9972
|
+
logger$5.error('WebRTC close, unregister error', e);
|
|
9958
9973
|
}
|
|
9959
9974
|
|
|
9960
9975
|
this.client.close();
|
|
@@ -9972,12 +9987,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9972
9987
|
}
|
|
9973
9988
|
|
|
9974
9989
|
enableRinging() {
|
|
9975
|
-
logger$
|
|
9990
|
+
logger$5.info('WebRTC enable ringing');
|
|
9976
9991
|
this.ringingEnabled = true;
|
|
9977
9992
|
}
|
|
9978
9993
|
|
|
9979
9994
|
disableRinging() {
|
|
9980
|
-
logger$
|
|
9995
|
+
logger$5.info('WebRTC disable ringing');
|
|
9981
9996
|
this.ringingEnabled = false;
|
|
9982
9997
|
}
|
|
9983
9998
|
|
|
@@ -10017,7 +10032,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10017
10032
|
|
|
10018
10033
|
// Deprecated
|
|
10019
10034
|
getLocalMediaStream(callSession ) {
|
|
10020
|
-
logger$
|
|
10035
|
+
logger$5.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
10021
10036
|
return this.getLocalStream(callSession);
|
|
10022
10037
|
}
|
|
10023
10038
|
|
|
@@ -10059,7 +10074,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10059
10074
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
10060
10075
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
10061
10076
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
10062
|
-
logger$
|
|
10077
|
+
logger$5.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
10063
10078
|
|
|
10064
10079
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
10065
10080
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -10082,7 +10097,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10082
10097
|
});
|
|
10083
10098
|
|
|
10084
10099
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
10085
|
-
logger$
|
|
10100
|
+
logger$5.info('WebRTC on reinvite', {
|
|
10086
10101
|
sessionId: args[0].id,
|
|
10087
10102
|
inviteId: args[1].id,
|
|
10088
10103
|
updatedCalleeName: args[2],
|
|
@@ -10102,7 +10117,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10102
10117
|
});
|
|
10103
10118
|
|
|
10104
10119
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
10105
|
-
logger$
|
|
10120
|
+
logger$5.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
10106
10121
|
|
|
10107
10122
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
10108
10123
|
|
|
@@ -10113,22 +10128,22 @@ class WebRTCPhone extends Emitter {
|
|
|
10113
10128
|
this.client.on('ended', () => {});
|
|
10114
10129
|
|
|
10115
10130
|
this.client.on(this.client.ON_ERROR, e => {
|
|
10116
|
-
logger$
|
|
10131
|
+
logger$5.error('WebRTC error', e);
|
|
10117
10132
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10118
10133
|
});
|
|
10119
10134
|
|
|
10120
10135
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10121
|
-
logger$
|
|
10136
|
+
logger$5.info('WebRTC unregistered');
|
|
10122
10137
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10123
10138
|
});
|
|
10124
10139
|
|
|
10125
10140
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
10126
|
-
logger$
|
|
10127
|
-
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10141
|
+
logger$5.info('WebRTC disconnected');
|
|
10142
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
10128
10143
|
});
|
|
10129
10144
|
|
|
10130
10145
|
this.client.on(this.client.REGISTERED, () => {
|
|
10131
|
-
logger$
|
|
10146
|
+
logger$5.info('WebRTC registered', {
|
|
10132
10147
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
10133
10148
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
10134
10149
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -10141,23 +10156,27 @@ class WebRTCPhone extends Emitter {
|
|
|
10141
10156
|
if (this.shouldSendReinvite && this.currentSipSession
|
|
10142
10157
|
&& this.currentSipSession.state === SessionState.Established) {
|
|
10143
10158
|
this.shouldSendReinvite = false;
|
|
10159
|
+
const pc = this.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
10160
|
+
const isConference = pc ? pc.sfu : false;
|
|
10161
|
+
const hasVideo = this.currentCallSession && this.currentCallSession.cameraEnabled;
|
|
10162
|
+
|
|
10144
10163
|
try {
|
|
10145
10164
|
// Send reinvite with iceRestart
|
|
10146
|
-
this.sendReinvite(this.currentCallSession, null,
|
|
10165
|
+
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10147
10166
|
} catch (e) {
|
|
10148
|
-
logger$
|
|
10167
|
+
logger$5.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10149
10168
|
}
|
|
10150
10169
|
}
|
|
10151
10170
|
});
|
|
10152
10171
|
|
|
10153
10172
|
this.client.on(this.client.CONNECTED, () => {
|
|
10154
|
-
logger$
|
|
10173
|
+
logger$5.info('WebRTC client connected');
|
|
10155
10174
|
|
|
10156
10175
|
this.stopHeartbeat();
|
|
10157
10176
|
});
|
|
10158
10177
|
|
|
10159
10178
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
10160
|
-
logger$
|
|
10179
|
+
logger$5.info('WebRTC client disconnected');
|
|
10161
10180
|
|
|
10162
10181
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10163
10182
|
|
|
@@ -10171,7 +10190,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10171
10190
|
});
|
|
10172
10191
|
|
|
10173
10192
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
10174
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
10193
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
10175
10194
|
});
|
|
10176
10195
|
|
|
10177
10196
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -10186,7 +10205,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10186
10205
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
10187
10206
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
10188
10207
|
|
|
10189
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
10208
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, callSession, stats, previousStats);
|
|
10190
10209
|
});
|
|
10191
10210
|
|
|
10192
10211
|
// Used when upgrading directly in screenshare mode
|
|
@@ -10195,7 +10214,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10195
10214
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
10196
10215
|
const callSession = this.callSessions[sipSessionId];
|
|
10197
10216
|
|
|
10198
|
-
logger$
|
|
10217
|
+
logger$5.info('Updrading directly in screensharing mode', {
|
|
10199
10218
|
sipSessionId,
|
|
10200
10219
|
tracks: localStream ? localStream.getTracks() : null,
|
|
10201
10220
|
});
|
|
@@ -10227,6 +10246,15 @@ class WebRTCPhone extends Emitter {
|
|
|
10227
10246
|
return this.client.getSipSessionId(sipSession);
|
|
10228
10247
|
}
|
|
10229
10248
|
|
|
10249
|
+
_updateCallSession(callSession ) {
|
|
10250
|
+
const sipSession = this.findSipSession(callSession);
|
|
10251
|
+
const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
|
|
10252
|
+
|
|
10253
|
+
if (sipSessionId) {
|
|
10254
|
+
this.callSessions[sipSessionId] = callSession;
|
|
10255
|
+
}
|
|
10256
|
+
}
|
|
10257
|
+
|
|
10230
10258
|
_onMessage(message ) {
|
|
10231
10259
|
if (!message || message.method !== 'MESSAGE') {
|
|
10232
10260
|
return;
|
|
@@ -10364,8 +10392,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10364
10392
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10365
10393
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10366
10394
|
ON_MESSAGE: ON_MESSAGE,
|
|
10367
|
-
ON_REINVITE: ON_REINVITE,
|
|
10368
|
-
ON_TRACK: ON_TRACK,
|
|
10395
|
+
ON_REINVITE: ON_REINVITE$1,
|
|
10396
|
+
ON_TRACK: ON_TRACK$1,
|
|
10369
10397
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10370
10398
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10371
10399
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10380,13 +10408,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10380
10408
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10381
10409
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10382
10410
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10383
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10411
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS$1,
|
|
10384
10412
|
ON_CHAT: ON_CHAT,
|
|
10385
10413
|
ON_SIGNAL: ON_SIGNAL,
|
|
10386
|
-
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10414
|
+
ON_DISCONNECTED: ON_DISCONNECTED$1,
|
|
10387
10415
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10388
10416
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10389
|
-
events: events,
|
|
10417
|
+
events: events$1,
|
|
10390
10418
|
'default': WebRTCPhone
|
|
10391
10419
|
});
|
|
10392
10420
|
|
|
@@ -10780,7 +10808,7 @@ class Phone extends Emitter {
|
|
|
10780
10808
|
|
|
10781
10809
|
_transferEvents() {
|
|
10782
10810
|
this.unbind();
|
|
10783
|
-
[...events
|
|
10811
|
+
[...events, ...transportEvents].forEach(event => {
|
|
10784
10812
|
this.client.on(event, (...args) =>
|
|
10785
10813
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
10786
10814
|
});
|
|
@@ -10802,7 +10830,7 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
10802
10830
|
|
|
10803
10831
|
//
|
|
10804
10832
|
|
|
10805
|
-
const SOCKET_EVENTS
|
|
10833
|
+
const SOCKET_EVENTS = {
|
|
10806
10834
|
ON_OPEN: 'onopen',
|
|
10807
10835
|
ON_MESSAGE: 'onmessage',
|
|
10808
10836
|
ON_ERROR: 'onerror',
|
|
@@ -10898,7 +10926,7 @@ const BLACKLIST_EVENTS = [
|
|
|
10898
10926
|
];
|
|
10899
10927
|
|
|
10900
10928
|
const HEARTBEAT_ENGINE_VERSION = '20.09';
|
|
10901
|
-
const logger$
|
|
10929
|
+
const logger$7 = IssueReporter$1.loggerFor('wazo-ws');
|
|
10902
10930
|
const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
|
|
10903
10931
|
|
|
10904
10932
|
class WebSocketClient extends Emitter {
|
|
@@ -10947,24 +10975,24 @@ class WebSocketClient extends Emitter {
|
|
|
10947
10975
|
}
|
|
10948
10976
|
|
|
10949
10977
|
connect() {
|
|
10950
|
-
logger$
|
|
10978
|
+
logger$7.info('connect method started', { host: this.host, token: this.token });
|
|
10951
10979
|
this.socket = new ReconnectingWebSocket(this._getUrl.bind(this), [], this.options);
|
|
10952
10980
|
if (this.options.binaryType) {
|
|
10953
10981
|
this.socket.binaryType = this.options.binaryType;
|
|
10954
10982
|
}
|
|
10955
10983
|
|
|
10956
10984
|
this.socket.onopen = () => {
|
|
10957
|
-
logger$
|
|
10958
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
10985
|
+
logger$7.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
10986
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
10959
10987
|
};
|
|
10960
10988
|
|
|
10961
10989
|
this.socket.onerror = event => {
|
|
10962
|
-
logger$
|
|
10963
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
10990
|
+
logger$7.error('on Wazo WS error', event.target);
|
|
10991
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
10964
10992
|
};
|
|
10965
10993
|
|
|
10966
10994
|
this.socket.onmessage = (event ) => {
|
|
10967
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
10995
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
10968
10996
|
|
|
10969
10997
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
10970
10998
|
let { name } = message;
|
|
@@ -10989,7 +11017,7 @@ class WebSocketClient extends Emitter {
|
|
|
10989
11017
|
|
|
10990
11018
|
this.socket.onclose = event => {
|
|
10991
11019
|
// Can't be converted to JSON (circular structure)
|
|
10992
|
-
logger$
|
|
11020
|
+
logger$7.info('on Wazo WS close', {
|
|
10993
11021
|
reason: event.reason,
|
|
10994
11022
|
code: event.code,
|
|
10995
11023
|
readyState: event.target.readyState,
|
|
@@ -10997,22 +11025,22 @@ class WebSocketClient extends Emitter {
|
|
|
10997
11025
|
token: this.token,
|
|
10998
11026
|
});
|
|
10999
11027
|
this.initialized = false;
|
|
11000
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11028
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
11001
11029
|
|
|
11002
11030
|
switch (event.code) {
|
|
11003
11031
|
case 4002:
|
|
11004
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11032
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
11005
11033
|
break;
|
|
11006
11034
|
}
|
|
11007
11035
|
};
|
|
11008
11036
|
|
|
11009
11037
|
this.socket.onerror = event => {
|
|
11010
|
-
logger$
|
|
11038
|
+
logger$7.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
|
|
11011
11039
|
};
|
|
11012
11040
|
}
|
|
11013
11041
|
|
|
11014
11042
|
close(force = false) {
|
|
11015
|
-
logger$
|
|
11043
|
+
logger$7.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
|
|
11016
11044
|
|
|
11017
11045
|
if (!this.socket) {
|
|
11018
11046
|
return;
|
|
@@ -11030,7 +11058,7 @@ class WebSocketClient extends Emitter {
|
|
|
11030
11058
|
|
|
11031
11059
|
updateToken(token ) {
|
|
11032
11060
|
this.token = token;
|
|
11033
|
-
logger$
|
|
11061
|
+
logger$7.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
|
|
11034
11062
|
|
|
11035
11063
|
if (this.socket) {
|
|
11036
11064
|
// If still connected, send the token to the WS
|
|
@@ -11048,7 +11076,7 @@ class WebSocketClient extends Emitter {
|
|
|
11048
11076
|
}
|
|
11049
11077
|
|
|
11050
11078
|
startHeartbeat() {
|
|
11051
|
-
logger$
|
|
11079
|
+
logger$7.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
|
|
11052
11080
|
|
|
11053
11081
|
if (!this.socket) {
|
|
11054
11082
|
this.heartbeat.stop();
|
|
@@ -11062,7 +11090,7 @@ class WebSocketClient extends Emitter {
|
|
|
11062
11090
|
}
|
|
11063
11091
|
|
|
11064
11092
|
stopHeartbeat() {
|
|
11065
|
-
logger$
|
|
11093
|
+
logger$7.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
|
|
11066
11094
|
|
|
11067
11095
|
this.heartbeat.stop();
|
|
11068
11096
|
}
|
|
@@ -11092,7 +11120,7 @@ class WebSocketClient extends Emitter {
|
|
|
11092
11120
|
}
|
|
11093
11121
|
|
|
11094
11122
|
reconnect(reason ) {
|
|
11095
|
-
logger$
|
|
11123
|
+
logger$7.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
|
|
11096
11124
|
if (!this.socket) {
|
|
11097
11125
|
return;
|
|
11098
11126
|
}
|
|
@@ -11117,7 +11145,7 @@ class WebSocketClient extends Emitter {
|
|
|
11117
11145
|
break;
|
|
11118
11146
|
case 'start':
|
|
11119
11147
|
this.initialized = true;
|
|
11120
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11148
|
+
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
11121
11149
|
break;
|
|
11122
11150
|
default:
|
|
11123
11151
|
this.eventEmitter.emit('message', message);
|
|
@@ -11148,7 +11176,7 @@ class WebSocketClient extends Emitter {
|
|
|
11148
11176
|
this.close();
|
|
11149
11177
|
}
|
|
11150
11178
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
11151
|
-
logger$
|
|
11179
|
+
logger$7.log('Wazo WS url computed to reconnect', { url });
|
|
11152
11180
|
|
|
11153
11181
|
return url;
|
|
11154
11182
|
}
|
|
@@ -11156,15 +11184,15 @@ class WebSocketClient extends Emitter {
|
|
|
11156
11184
|
_onHeartbeat(message ) {
|
|
11157
11185
|
if (message.payload === 'pong') {
|
|
11158
11186
|
this.heartbeat.onHeartbeat();
|
|
11159
|
-
logger$
|
|
11187
|
+
logger$7.log('on heartbeat received from Wazo WS');
|
|
11160
11188
|
}
|
|
11161
11189
|
}
|
|
11162
11190
|
|
|
11163
11191
|
async _onHeartbeatTimeout() {
|
|
11164
|
-
logger$
|
|
11192
|
+
logger$7.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
11165
11193
|
|
|
11166
11194
|
this.close();
|
|
11167
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11195
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11168
11196
|
|
|
11169
11197
|
if (this.onHeartBeatTimeout) {
|
|
11170
11198
|
this.onHeartBeatTimeout();
|
|
@@ -11244,7 +11272,7 @@ WebSocketClient.eventLists = [
|
|
|
11244
11272
|
|
|
11245
11273
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
11246
11274
|
__proto__: null,
|
|
11247
|
-
SOCKET_EVENTS: SOCKET_EVENTS
|
|
11275
|
+
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
11248
11276
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
11249
11277
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
11250
11278
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -11317,10 +11345,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11317
11345
|
|
|
11318
11346
|
//
|
|
11319
11347
|
|
|
11320
|
-
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11321
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
11348
|
+
const { SOCKET_EVENTS: SOCKET_EVENTS$1, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11349
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS$1), ...Object.values(OTHER_EVENTS)];
|
|
11322
11350
|
|
|
11323
|
-
const logger$
|
|
11351
|
+
const logger$8 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
11324
11352
|
|
|
11325
11353
|
class Websocket extends Emitter {
|
|
11326
11354
|
|
|
@@ -11334,9 +11362,9 @@ class Websocket extends Emitter {
|
|
|
11334
11362
|
// $FlowFixMe
|
|
11335
11363
|
this[key] = OTHER_EVENTS[key];
|
|
11336
11364
|
});
|
|
11337
|
-
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
11365
|
+
Object.keys(SOCKET_EVENTS$1).forEach(key => {
|
|
11338
11366
|
// $FlowFixMe
|
|
11339
|
-
this[key] = SOCKET_EVENTS[key];
|
|
11367
|
+
this[key] = SOCKET_EVENTS$1[key];
|
|
11340
11368
|
});
|
|
11341
11369
|
this.eventLists = WebSocketClient.eventLists;
|
|
11342
11370
|
|
|
@@ -11344,7 +11372,7 @@ class Websocket extends Emitter {
|
|
|
11344
11372
|
}
|
|
11345
11373
|
|
|
11346
11374
|
open(host , session ) {
|
|
11347
|
-
logger$
|
|
11375
|
+
logger$8.info('open simple WebSocket', { host, token: session.token });
|
|
11348
11376
|
this.ws = new WebSocketClient(
|
|
11349
11377
|
{
|
|
11350
11378
|
host,
|
|
@@ -11372,7 +11400,7 @@ class Websocket extends Emitter {
|
|
|
11372
11400
|
}
|
|
11373
11401
|
|
|
11374
11402
|
updateToken(token ) {
|
|
11375
|
-
logger$
|
|
11403
|
+
logger$8.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
11376
11404
|
|
|
11377
11405
|
if (!this.ws) {
|
|
11378
11406
|
return;
|
|
@@ -11400,12 +11428,12 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11400
11428
|
|
|
11401
11429
|
//
|
|
11402
11430
|
|
|
11403
|
-
const logger$
|
|
11431
|
+
const logger$9 = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
11404
11432
|
|
|
11405
|
-
class SipRoom extends Room {
|
|
11433
|
+
class SipRoom extends Room$1 {
|
|
11406
11434
|
|
|
11407
11435
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
11408
|
-
logger$
|
|
11436
|
+
logger$9.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
11409
11437
|
|
|
11410
11438
|
if (!room) {
|
|
11411
11439
|
await Wazo.Phone.connect();
|
|
@@ -11421,7 +11449,7 @@ class SipRoom extends Room {
|
|
|
11421
11449
|
room.setCallId(room.callSession.call.id);
|
|
11422
11450
|
}
|
|
11423
11451
|
|
|
11424
|
-
logger$
|
|
11452
|
+
logger$9.info('connected to room', {
|
|
11425
11453
|
extension: room.extension,
|
|
11426
11454
|
});
|
|
11427
11455
|
|
|
@@ -11429,7 +11457,7 @@ class SipRoom extends Room {
|
|
|
11429
11457
|
}
|
|
11430
11458
|
|
|
11431
11459
|
mute() {
|
|
11432
|
-
logger$
|
|
11460
|
+
logger$9.info('mute sip room');
|
|
11433
11461
|
|
|
11434
11462
|
Wazo.Phone.mute(this.callSession, false);
|
|
11435
11463
|
|
|
@@ -11437,7 +11465,7 @@ class SipRoom extends Room {
|
|
|
11437
11465
|
}
|
|
11438
11466
|
|
|
11439
11467
|
unmute() {
|
|
11440
|
-
logger$
|
|
11468
|
+
logger$9.info('unmute sip room');
|
|
11441
11469
|
|
|
11442
11470
|
Wazo.Phone.unmute(this.callSession, false);
|
|
11443
11471
|
|
|
@@ -11737,7 +11765,7 @@ class NotificationOptions {
|
|
|
11737
11765
|
|
|
11738
11766
|
|
|
11739
11767
|
// Represents a conference room, like `9000`.
|
|
11740
|
-
class Room
|
|
11768
|
+
class Room {
|
|
11741
11769
|
|
|
11742
11770
|
|
|
11743
11771
|
|
|
@@ -11758,7 +11786,7 @@ class Room$1 {
|
|
|
11758
11786
|
}
|
|
11759
11787
|
|
|
11760
11788
|
connect(callSession ) {
|
|
11761
|
-
return new Room
|
|
11789
|
+
return new Room({ ...this, connectedCallSession: callSession });
|
|
11762
11790
|
}
|
|
11763
11791
|
|
|
11764
11792
|
has(callSession ) {
|
|
@@ -11767,7 +11795,7 @@ class Room$1 {
|
|
|
11767
11795
|
|
|
11768
11796
|
addParticipant(uuid , extension , talking = null) {
|
|
11769
11797
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
11770
|
-
return new Room
|
|
11798
|
+
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
11771
11799
|
}
|
|
11772
11800
|
|
|
11773
11801
|
return this;
|
|
@@ -11786,7 +11814,7 @@ class Room$1 {
|
|
|
11786
11814
|
updatedParticipants.push(participant);
|
|
11787
11815
|
}
|
|
11788
11816
|
|
|
11789
|
-
return new Room
|
|
11817
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
11790
11818
|
}
|
|
11791
11819
|
|
|
11792
11820
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -11802,7 +11830,7 @@ class Room$1 {
|
|
|
11802
11830
|
updatedParticipants.push(participant);
|
|
11803
11831
|
}
|
|
11804
11832
|
|
|
11805
|
-
return new Room
|
|
11833
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
11806
11834
|
}
|
|
11807
11835
|
|
|
11808
11836
|
hasCallWithId(id ) {
|
|
@@ -11810,18 +11838,18 @@ class Room$1 {
|
|
|
11810
11838
|
}
|
|
11811
11839
|
|
|
11812
11840
|
disconnect() {
|
|
11813
|
-
return new Room
|
|
11841
|
+
return new Room({ ...this, connectedCallSession: null });
|
|
11814
11842
|
}
|
|
11815
11843
|
|
|
11816
11844
|
removeParticipantWithUUID(uuid ) {
|
|
11817
|
-
return new Room
|
|
11845
|
+
return new Room({
|
|
11818
11846
|
...this,
|
|
11819
11847
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
11820
11848
|
});
|
|
11821
11849
|
}
|
|
11822
11850
|
|
|
11823
11851
|
removeParticipantWithExtension(extension ) {
|
|
11824
|
-
return new Room
|
|
11852
|
+
return new Room({
|
|
11825
11853
|
...this,
|
|
11826
11854
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
11827
11855
|
});
|
|
@@ -11832,7 +11860,7 @@ class Room$1 {
|
|
|
11832
11860
|
}
|
|
11833
11861
|
|
|
11834
11862
|
static newFrom(room ) {
|
|
11835
|
-
return newFrom(room, Room
|
|
11863
|
+
return newFrom(room, Room);
|
|
11836
11864
|
}
|
|
11837
11865
|
}
|
|
11838
11866
|
|
|
@@ -12139,11 +12167,11 @@ var wazoWebsocket = {
|
|
|
12139
12167
|
resolve();
|
|
12140
12168
|
};
|
|
12141
12169
|
|
|
12142
|
-
client.on(SOCKET_EVENTS
|
|
12170
|
+
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
12143
12171
|
handleError(`Connection error : ${error}`);
|
|
12144
12172
|
});
|
|
12145
12173
|
|
|
12146
|
-
client.on(SOCKET_EVENTS
|
|
12174
|
+
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
12147
12175
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
12148
12176
|
client.setOnHeartbeatTimeout(() => {
|
|
12149
12177
|
handleError('No response to heartbeat');
|
|
@@ -12244,7 +12272,7 @@ var webrtc = {
|
|
|
12244
12272
|
}),
|
|
12245
12273
|
};
|
|
12246
12274
|
|
|
12247
|
-
const parseCandidate = line => {
|
|
12275
|
+
const parseCandidate$1 = line => {
|
|
12248
12276
|
let parts;
|
|
12249
12277
|
// Parse both variants.
|
|
12250
12278
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -12335,7 +12363,7 @@ var SymmetricNat = {
|
|
|
12335
12363
|
}
|
|
12336
12364
|
|
|
12337
12365
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
12338
|
-
const cand = parseCandidate(e.candidate.candidate);
|
|
12366
|
+
const cand = parseCandidate$1(e.candidate.candidate);
|
|
12339
12367
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
12340
12368
|
candidates[cand.relatedPort].push(cand.port);
|
|
12341
12369
|
} else if (!e.candidate) {
|
|
@@ -12403,7 +12431,7 @@ var iceIpv4 = {
|
|
|
12403
12431
|
const rawCandidate = e.candidate.candidate;
|
|
12404
12432
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
12405
12433
|
hasSrflxOrRelay = true;
|
|
12406
|
-
const candidate = parseCandidate(e.candidate.candidate);
|
|
12434
|
+
const candidate = parseCandidate$1(e.candidate.candidate);
|
|
12407
12435
|
ips.push(candidate.ip);
|
|
12408
12436
|
}
|
|
12409
12437
|
} else if (!e.candidate) {
|
|
@@ -12440,7 +12468,7 @@ var checks = [
|
|
|
12440
12468
|
|
|
12441
12469
|
//
|
|
12442
12470
|
|
|
12443
|
-
const logger$
|
|
12471
|
+
const logger$a = IssueReporter$1.loggerFor('engine-check');
|
|
12444
12472
|
|
|
12445
12473
|
class Checker {
|
|
12446
12474
|
|
|
@@ -12458,28 +12486,28 @@ class Checker {
|
|
|
12458
12486
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
12459
12487
|
await this._addEngineVersion();
|
|
12460
12488
|
|
|
12461
|
-
logger$
|
|
12489
|
+
logger$a.info('Engine check starting');
|
|
12462
12490
|
|
|
12463
12491
|
for (let i = 0; i < this.checks.length; i++) {
|
|
12464
12492
|
const { name, check } = this.checks[i];
|
|
12465
12493
|
|
|
12466
|
-
logger$
|
|
12494
|
+
logger$a.info(`Checking ${name} ...`);
|
|
12467
12495
|
|
|
12468
12496
|
onCheckBegin(name);
|
|
12469
12497
|
try {
|
|
12470
12498
|
// eslint-disable-next-line no-await-in-loop
|
|
12471
12499
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
12472
|
-
logger$
|
|
12500
|
+
logger$a.info(`Checking ${name} success.`, { result });
|
|
12473
12501
|
|
|
12474
12502
|
onCheckResult(name, result);
|
|
12475
12503
|
} catch (e) {
|
|
12476
|
-
logger$
|
|
12504
|
+
logger$a.info(`Checking ${name} failure`, { message: e.message });
|
|
12477
12505
|
|
|
12478
12506
|
onCheckResult(name, e);
|
|
12479
12507
|
}
|
|
12480
12508
|
}
|
|
12481
12509
|
|
|
12482
|
-
logger$
|
|
12510
|
+
logger$a.info('Engine check done.');
|
|
12483
12511
|
}
|
|
12484
12512
|
|
|
12485
12513
|
addCheck(check ) {
|
|
@@ -12503,7 +12531,7 @@ const Wazo = {
|
|
|
12503
12531
|
Auth: Auth$1,
|
|
12504
12532
|
Phone: Phone$1,
|
|
12505
12533
|
Websocket: Websocket$1,
|
|
12506
|
-
Room,
|
|
12534
|
+
Room: Room$1,
|
|
12507
12535
|
SipRoom,
|
|
12508
12536
|
RemoteParticipant,
|
|
12509
12537
|
LocalParticipant,
|
|
@@ -12536,7 +12564,7 @@ const Wazo = {
|
|
|
12536
12564
|
Session,
|
|
12537
12565
|
Voicemail,
|
|
12538
12566
|
Relocation,
|
|
12539
|
-
ConferenceRoom: Room
|
|
12567
|
+
ConferenceRoom: Room,
|
|
12540
12568
|
CallSession,
|
|
12541
12569
|
IndirectTransfer,
|
|
12542
12570
|
SwitchboardCall,
|
|
@@ -12575,9 +12603,9 @@ if (global) {
|
|
|
12575
12603
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
12576
12604
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
12577
12605
|
|
|
12578
|
-
const logger$
|
|
12606
|
+
const logger$b = IssueReporter$1.loggerFor('sdk-room');
|
|
12579
12607
|
|
|
12580
|
-
class Room extends Emitter {
|
|
12608
|
+
class Room$1 extends Emitter {
|
|
12581
12609
|
|
|
12582
12610
|
|
|
12583
12611
|
|
|
@@ -12635,7 +12663,7 @@ class Room extends Emitter {
|
|
|
12635
12663
|
extra = {},
|
|
12636
12664
|
) {
|
|
12637
12665
|
super();
|
|
12638
|
-
logger$
|
|
12666
|
+
logger$b.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
12639
12667
|
|
|
12640
12668
|
// Represents the room callSession
|
|
12641
12669
|
this.callSession = callSession;
|
|
@@ -12701,7 +12729,7 @@ class Room extends Emitter {
|
|
|
12701
12729
|
* @returns {Promise<Room>}
|
|
12702
12730
|
*/
|
|
12703
12731
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
12704
|
-
logger$
|
|
12732
|
+
logger$b.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
12705
12733
|
|
|
12706
12734
|
if (!room) {
|
|
12707
12735
|
await Wazo.Phone.connect();
|
|
@@ -12714,7 +12742,7 @@ class Room extends Emitter {
|
|
|
12714
12742
|
|
|
12715
12743
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
12716
12744
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
12717
|
-
logger$
|
|
12745
|
+
logger$b.info('room call received via WS', { callId: data.call_id });
|
|
12718
12746
|
if (room) {
|
|
12719
12747
|
room.setCallId(data.call_id);
|
|
12720
12748
|
}
|
|
@@ -12722,7 +12750,7 @@ class Room extends Emitter {
|
|
|
12722
12750
|
|
|
12723
12751
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
12724
12752
|
// eslint-disable-next-line no-param-reassign
|
|
12725
|
-
room = new Room(callSession, extension, null, null, extra);
|
|
12753
|
+
room = new Room$1(callSession, extension, null, null, extra);
|
|
12726
12754
|
|
|
12727
12755
|
// Wait for the call to be accepted
|
|
12728
12756
|
await new Promise((resolve, reject) => {
|
|
@@ -12743,7 +12771,7 @@ class Room extends Emitter {
|
|
|
12743
12771
|
// Retrieve conference
|
|
12744
12772
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
12745
12773
|
|
|
12746
|
-
logger$
|
|
12774
|
+
logger$b.info('connected to room', {
|
|
12747
12775
|
sourceId: conference ? conference.sourceId : null,
|
|
12748
12776
|
name: conference ? conference.name : null,
|
|
12749
12777
|
});
|
|
@@ -12753,7 +12781,7 @@ class Room extends Emitter {
|
|
|
12753
12781
|
room.setName(conference.name);
|
|
12754
12782
|
}
|
|
12755
12783
|
} else if (meeting) {
|
|
12756
|
-
logger$
|
|
12784
|
+
logger$b.info('Already connected to meeting', {
|
|
12757
12785
|
uuid: meeting.uuid,
|
|
12758
12786
|
name: meeting.name,
|
|
12759
12787
|
});
|
|
@@ -12766,13 +12794,13 @@ class Room extends Emitter {
|
|
|
12766
12794
|
}
|
|
12767
12795
|
|
|
12768
12796
|
static disconnect() {
|
|
12769
|
-
logger$
|
|
12797
|
+
logger$b.info('static disconnection to room');
|
|
12770
12798
|
|
|
12771
12799
|
Wazo.Phone.disconnect();
|
|
12772
12800
|
}
|
|
12773
12801
|
|
|
12774
12802
|
async disconnect() {
|
|
12775
|
-
logger$
|
|
12803
|
+
logger$b.info('disconnection to room called');
|
|
12776
12804
|
|
|
12777
12805
|
await Wazo.Phone.hangup(this.callSession);
|
|
12778
12806
|
this.callSession = null;
|
|
@@ -12792,19 +12820,19 @@ class Room extends Emitter {
|
|
|
12792
12820
|
}
|
|
12793
12821
|
|
|
12794
12822
|
setSourceId(sourceId ) {
|
|
12795
|
-
logger$
|
|
12823
|
+
logger$b.info('set room source id', { sourceId });
|
|
12796
12824
|
|
|
12797
12825
|
this.sourceId = sourceId;
|
|
12798
12826
|
}
|
|
12799
12827
|
|
|
12800
12828
|
setMeetingUuid(meetingUuid ) {
|
|
12801
|
-
logger$
|
|
12829
|
+
logger$b.info('set meeting uuid', { meetingUuid });
|
|
12802
12830
|
|
|
12803
12831
|
this.meetingUuid = meetingUuid;
|
|
12804
12832
|
}
|
|
12805
12833
|
|
|
12806
12834
|
setCallId(callId ) {
|
|
12807
|
-
logger$
|
|
12835
|
+
logger$b.info('set room call id', { callId });
|
|
12808
12836
|
|
|
12809
12837
|
if (callId) {
|
|
12810
12838
|
this.callId = callId;
|
|
@@ -12812,7 +12840,7 @@ class Room extends Emitter {
|
|
|
12812
12840
|
}
|
|
12813
12841
|
|
|
12814
12842
|
setName(name ) {
|
|
12815
|
-
logger$
|
|
12843
|
+
logger$b.info('set room name', { name });
|
|
12816
12844
|
|
|
12817
12845
|
this.name = name;
|
|
12818
12846
|
}
|
|
@@ -12831,7 +12859,7 @@ class Room extends Emitter {
|
|
|
12831
12859
|
}
|
|
12832
12860
|
|
|
12833
12861
|
async startScreenSharing(constraints ) {
|
|
12834
|
-
logger$
|
|
12862
|
+
logger$b.info('start room screen sharing', { constraints });
|
|
12835
12863
|
|
|
12836
12864
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
12837
12865
|
if (!screensharingStream) {
|
|
@@ -12845,7 +12873,7 @@ class Room extends Emitter {
|
|
|
12845
12873
|
}
|
|
12846
12874
|
|
|
12847
12875
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
12848
|
-
logger$
|
|
12876
|
+
logger$b.info('stop room screen sharing');
|
|
12849
12877
|
|
|
12850
12878
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
12851
12879
|
|
|
@@ -12857,7 +12885,7 @@ class Room extends Emitter {
|
|
|
12857
12885
|
}
|
|
12858
12886
|
|
|
12859
12887
|
turnCameraOff() {
|
|
12860
|
-
logger$
|
|
12888
|
+
logger$b.info('turn room camera off');
|
|
12861
12889
|
|
|
12862
12890
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
12863
12891
|
|
|
@@ -12867,7 +12895,7 @@ class Room extends Emitter {
|
|
|
12867
12895
|
}
|
|
12868
12896
|
|
|
12869
12897
|
turnCameraOn() {
|
|
12870
|
-
logger$
|
|
12898
|
+
logger$b.info('turn room camera on');
|
|
12871
12899
|
|
|
12872
12900
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
12873
12901
|
|
|
@@ -12877,7 +12905,7 @@ class Room extends Emitter {
|
|
|
12877
12905
|
}
|
|
12878
12906
|
|
|
12879
12907
|
mute() {
|
|
12880
|
-
logger$
|
|
12908
|
+
logger$b.info('mute room');
|
|
12881
12909
|
|
|
12882
12910
|
Wazo.Phone.mute(this.callSession);
|
|
12883
12911
|
|
|
@@ -12885,7 +12913,7 @@ class Room extends Emitter {
|
|
|
12885
12913
|
}
|
|
12886
12914
|
|
|
12887
12915
|
unmute() {
|
|
12888
|
-
logger$
|
|
12916
|
+
logger$b.info('unmute room');
|
|
12889
12917
|
|
|
12890
12918
|
Wazo.Phone.unmute(this.callSession);
|
|
12891
12919
|
|
|
@@ -12905,7 +12933,7 @@ class Room extends Emitter {
|
|
|
12905
12933
|
}
|
|
12906
12934
|
|
|
12907
12935
|
hold() {
|
|
12908
|
-
logger$
|
|
12936
|
+
logger$b.info('hold room');
|
|
12909
12937
|
|
|
12910
12938
|
Wazo.Phone.hold(this.callSession, true);
|
|
12911
12939
|
|
|
@@ -12915,7 +12943,7 @@ class Room extends Emitter {
|
|
|
12915
12943
|
}
|
|
12916
12944
|
|
|
12917
12945
|
async resume() {
|
|
12918
|
-
logger$
|
|
12946
|
+
logger$b.info('resume room');
|
|
12919
12947
|
|
|
12920
12948
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
12921
12949
|
|
|
@@ -12943,13 +12971,13 @@ class Room extends Emitter {
|
|
|
12943
12971
|
}
|
|
12944
12972
|
|
|
12945
12973
|
sendDTMF(tone ) {
|
|
12946
|
-
logger$
|
|
12974
|
+
logger$b.info('send room DTMF', { tone });
|
|
12947
12975
|
|
|
12948
12976
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
12949
12977
|
}
|
|
12950
12978
|
|
|
12951
12979
|
async sendReinvite(newConstraints = null) {
|
|
12952
|
-
logger$
|
|
12980
|
+
logger$b.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
12953
12981
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
12954
12982
|
|
|
12955
12983
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -13008,7 +13036,7 @@ class Room extends Emitter {
|
|
|
13008
13036
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
13009
13037
|
|
|
13010
13038
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
13011
|
-
logger$
|
|
13039
|
+
logger$b.info('on room audio stream');
|
|
13012
13040
|
|
|
13013
13041
|
this.audioStream = stream;
|
|
13014
13042
|
if (!this.roomAudioElement) {
|
|
@@ -13021,7 +13049,7 @@ class Room extends Emitter {
|
|
|
13021
13049
|
});
|
|
13022
13050
|
|
|
13023
13051
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
13024
|
-
logger$
|
|
13052
|
+
logger$b.info('on room video stream', { streamId });
|
|
13025
13053
|
|
|
13026
13054
|
this._mapMsid(sipSession.body.body);
|
|
13027
13055
|
|
|
@@ -13036,7 +13064,7 @@ class Room extends Emitter {
|
|
|
13036
13064
|
});
|
|
13037
13065
|
|
|
13038
13066
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
13039
|
-
logger$
|
|
13067
|
+
logger$b.info('on room remove stream');
|
|
13040
13068
|
|
|
13041
13069
|
const participant = this.participants.find(someParticipant =>
|
|
13042
13070
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -13168,7 +13196,7 @@ class Room extends Emitter {
|
|
|
13168
13196
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
13169
13197
|
if (requester) {
|
|
13170
13198
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
13171
|
-
logger$
|
|
13199
|
+
logger$b.info('trigger room requester status', { origin });
|
|
13172
13200
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
13173
13201
|
}
|
|
13174
13202
|
break;
|
|
@@ -13199,24 +13227,24 @@ class Room extends Emitter {
|
|
|
13199
13227
|
|
|
13200
13228
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
13201
13229
|
if (participant.user_uuid === session.uuid) {
|
|
13202
|
-
logger$
|
|
13230
|
+
logger$b.info('room current user joined');
|
|
13203
13231
|
|
|
13204
13232
|
// Retrieve participants via an API calls
|
|
13205
13233
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
13206
13234
|
let response;
|
|
13207
13235
|
try {
|
|
13208
13236
|
if (this.meetingUuid) {
|
|
13209
|
-
logger$
|
|
13237
|
+
logger$b.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
13210
13238
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
13211
13239
|
} else {
|
|
13212
|
-
logger$
|
|
13240
|
+
logger$b.info('fetching conference participants', { conferenceId });
|
|
13213
13241
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
13214
13242
|
}
|
|
13215
13243
|
} catch (e) {
|
|
13216
|
-
logger$
|
|
13244
|
+
logger$b.error('room participants fetching, error', e);
|
|
13217
13245
|
}
|
|
13218
13246
|
if (response) {
|
|
13219
|
-
logger$
|
|
13247
|
+
logger$b.info('conference participants fetched', { nb: response.items.length });
|
|
13220
13248
|
participants = response.items.map(item => {
|
|
13221
13249
|
const isMe = item.call_id === this.callId;
|
|
13222
13250
|
|
|
@@ -13243,7 +13271,7 @@ class Room extends Emitter {
|
|
|
13243
13271
|
? new Wazo.RemoteParticipant(this, participant)
|
|
13244
13272
|
: null;
|
|
13245
13273
|
|
|
13246
|
-
logger$
|
|
13274
|
+
logger$b.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
13247
13275
|
|
|
13248
13276
|
if (remoteParticipant) {
|
|
13249
13277
|
this.participants.push(remoteParticipant);
|
|
@@ -13408,7 +13436,7 @@ class Room extends Emitter {
|
|
|
13408
13436
|
|
|
13409
13437
|
//
|
|
13410
13438
|
|
|
13411
|
-
const logger = IssueReporter$1.loggerFor('room');
|
|
13439
|
+
const logger$c = IssueReporter$1.loggerFor('room');
|
|
13412
13440
|
|
|
13413
13441
|
class Participant extends Emitter {
|
|
13414
13442
|
|
|
@@ -13530,7 +13558,7 @@ class Participant extends Emitter {
|
|
|
13530
13558
|
}
|
|
13531
13559
|
|
|
13532
13560
|
onTalking(isTalking ) {
|
|
13533
|
-
logger.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
13561
|
+
logger$c.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
13534
13562
|
this.isTalking = isTalking;
|
|
13535
13563
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
13536
13564
|
// directly from asterisk, there's no need to do so
|
|
@@ -13633,7 +13661,7 @@ class Participant extends Emitter {
|
|
|
13633
13661
|
}
|
|
13634
13662
|
|
|
13635
13663
|
updateStatus(status , broadcast = true) {
|
|
13636
|
-
logger.info('updating participant status', { name: this.name, status });
|
|
13664
|
+
logger$c.info('updating participant status', { name: this.name, status });
|
|
13637
13665
|
|
|
13638
13666
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
13639
13667
|
if (status.audioMuted) {
|
|
@@ -13681,7 +13709,7 @@ class Participant extends Emitter {
|
|
|
13681
13709
|
|
|
13682
13710
|
broadcastStatus(inboundStatus = null) {
|
|
13683
13711
|
const status = inboundStatus || this.getStatus();
|
|
13684
|
-
logger.info('broadcasting participant status', { callId: this.callId, status });
|
|
13712
|
+
logger$c.info('broadcasting participant status', { callId: this.callId, status });
|
|
13685
13713
|
|
|
13686
13714
|
this.room.sendSignal({
|
|
13687
13715
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|