@wazo/sdk 0.37.24 → 0.37.25
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 +12 -12
- package/esm/__tests__/web-rtc-client.test.js +120 -103
- package/esm/api/amid.js +1 -1
- package/esm/api/call-logd.js +2 -2
- 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 +12 -12
- package/esm/checker/Checker.js +145 -128
- package/esm/checker/checks/aor.js +12 -12
- package/esm/checker/checks/api.js +12 -12
- package/esm/checker/checks/index.js +135 -118
- package/esm/checker/checks/wazo-websocket.js +15 -15
- package/esm/checker/checks/webrtc-transport.js +120 -103
- package/esm/checker/checks/webrtc.js +120 -103
- package/esm/domain/AdHocAPIConference.js +12 -12
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/Contact.js +1 -1
- package/esm/domain/Features.js +12 -12
- package/esm/domain/Phone/CTIPhone.js +26 -26
- package/esm/domain/Phone/WebRTCPhone.js +87 -86
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/Contact.test.js +1 -1
- package/esm/index.js +356 -338
- package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
- package/esm/service/CallApi.js +12 -12
- package/esm/service/IssueReporter.js +1 -1
- package/esm/service/__tests__/IssueReporter.test.js +1 -1
- package/esm/service/getApiClient.js +12 -12
- package/esm/simple/Auth.js +346 -328
- package/esm/simple/Configuration.js +346 -328
- package/esm/simple/Directory.js +12 -12
- package/esm/simple/Phone.js +346 -328
- package/esm/simple/Websocket.js +17 -17
- package/esm/simple/index.js +350 -332
- package/esm/simple/room/LocalParticipant.js +350 -332
- package/esm/simple/room/Participant.js +350 -332
- package/esm/simple/room/RemoteParticipant.js +350 -332
- package/esm/simple/room/Room.js +351 -333
- package/esm/simple/room/SipRoom.js +350 -332
- package/esm/simple/room/Stream.js +350 -332
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +350 -332
- package/esm/simple/utils.js +350 -332
- package/esm/web-rtc-client.js +120 -103
- package/esm/websocket-client.js +15 -15
- package/lib/__tests__/api-client.test.js +12 -12
- package/lib/__tests__/web-rtc-client.test.js +120 -103
- package/lib/api/amid.js +1 -1
- package/lib/api/call-logd.js +2 -2
- 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 +12 -12
- package/lib/checker/Checker.js +145 -128
- package/lib/checker/checks/aor.js +12 -12
- package/lib/checker/checks/api.js +12 -12
- package/lib/checker/checks/index.js +135 -118
- package/lib/checker/checks/wazo-websocket.js +15 -15
- package/lib/checker/checks/webrtc-transport.js +120 -103
- package/lib/checker/checks/webrtc.js +120 -103
- package/lib/domain/AdHocAPIConference.js +12 -12
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +12 -12
- package/lib/domain/Phone/CTIPhone.js +26 -26
- package/lib/domain/Phone/WebRTCPhone.js +87 -86
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/Contact.test.js +1 -1
- package/lib/index.js +356 -338
- package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
- package/lib/service/CallApi.js +12 -12
- package/lib/service/IssueReporter.js +1 -1
- package/lib/service/__tests__/IssueReporter.test.js +1 -1
- package/lib/service/getApiClient.js +12 -12
- package/lib/simple/Auth.js +346 -328
- package/lib/simple/Configuration.js +346 -328
- package/lib/simple/Directory.js +12 -12
- package/lib/simple/Phone.js +346 -328
- package/lib/simple/Websocket.js +17 -17
- package/lib/simple/index.js +350 -332
- package/lib/simple/room/LocalParticipant.js +350 -332
- package/lib/simple/room/Participant.js +350 -332
- package/lib/simple/room/RemoteParticipant.js +350 -332
- package/lib/simple/room/Room.js +351 -333
- package/lib/simple/room/SipRoom.js +350 -332
- package/lib/simple/room/Stream.js +350 -332
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +350 -332
- package/lib/simple/utils.js +350 -332
- package/lib/web-rtc-client.js +120 -103
- package/lib/websocket-client.js +15 -15
- package/package.json +1 -1
- package/src/domain/Phone/WebRTCPhone.js +3 -2
- package/src/web-rtc-client.js +27 -10
|
@@ -138,7 +138,7 @@ const isMobile = () => typeof navigator !== 'undefined' && navigator.product ===
|
|
|
138
138
|
|
|
139
139
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
140
140
|
|
|
141
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
141
|
+
const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
142
142
|
|
|
143
143
|
// Use a function here to be able to mock it in tests
|
|
144
144
|
const realFetch = () => {
|
|
@@ -277,7 +277,7 @@ class ApiRequester {
|
|
|
277
277
|
};
|
|
278
278
|
|
|
279
279
|
if (this.refreshTokenPromise) {
|
|
280
|
-
logger.info('A token is already refreshing, waiting ...', { url });
|
|
280
|
+
logger$c.info('A token is already refreshing, waiting ...', { url });
|
|
281
281
|
await this.refreshTokenPromise;
|
|
282
282
|
}
|
|
283
283
|
|
|
@@ -297,7 +297,7 @@ class ApiRequester {
|
|
|
297
297
|
return promise.then(async (err ) => {
|
|
298
298
|
// Check if the token is still valid
|
|
299
299
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
300
|
-
logger.warn('token expired', { error: err.reason });
|
|
300
|
+
logger$c.warn('token expired', { error: err.reason });
|
|
301
301
|
// Replay the call after refreshing the token
|
|
302
302
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
303
303
|
}
|
|
@@ -307,7 +307,7 @@ class ApiRequester {
|
|
|
307
307
|
: exceptionClass.fromResponse(err, response.status);
|
|
308
308
|
|
|
309
309
|
if (this.shouldLogErrors) {
|
|
310
|
-
logger.error('API error', error);
|
|
310
|
+
logger$c.error('API error', error);
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
throw error;
|
|
@@ -317,7 +317,7 @@ class ApiRequester {
|
|
|
317
317
|
return newParse(response, isJson);
|
|
318
318
|
}).catch(error => {
|
|
319
319
|
if (this.shouldLogErrors) {
|
|
320
|
-
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
320
|
+
logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
throw error;
|
|
@@ -345,13 +345,13 @@ class ApiRequester {
|
|
|
345
345
|
) {
|
|
346
346
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
347
347
|
let newPath = path;
|
|
348
|
-
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
348
|
+
logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
349
349
|
|
|
350
350
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
351
351
|
|
|
352
352
|
return this.refreshTokenPromise.then(() => {
|
|
353
353
|
this.refreshTokenPromise = null;
|
|
354
|
-
logger.info('token refreshed', { isTokenNotFound });
|
|
354
|
+
logger$c.info('token refreshed', { isTokenNotFound });
|
|
355
355
|
if (isTokenNotFound) {
|
|
356
356
|
const pathParts = path.split('/');
|
|
357
357
|
pathParts.pop();
|
|
@@ -4063,7 +4063,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4063
4063
|
|
|
4064
4064
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4065
4065
|
|
|
4066
|
-
const logger$
|
|
4066
|
+
const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4067
4067
|
|
|
4068
4068
|
class CTIPhone extends Emitter {
|
|
4069
4069
|
|
|
@@ -4076,7 +4076,7 @@ class CTIPhone extends Emitter {
|
|
|
4076
4076
|
|
|
4077
4077
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4078
4078
|
super();
|
|
4079
|
-
logger$
|
|
4079
|
+
logger$b.info('CTI Phone created');
|
|
4080
4080
|
this.session = session;
|
|
4081
4081
|
this.isMobile = isMobile;
|
|
4082
4082
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4137,7 +4137,7 @@ class CTIPhone extends Emitter {
|
|
|
4137
4137
|
}
|
|
4138
4138
|
|
|
4139
4139
|
async makeCall(number , line ) {
|
|
4140
|
-
logger$
|
|
4140
|
+
logger$b.info('make CTI call', { number });
|
|
4141
4141
|
|
|
4142
4142
|
if (!number) {
|
|
4143
4143
|
return null;
|
|
@@ -4160,7 +4160,7 @@ class CTIPhone extends Emitter {
|
|
|
4160
4160
|
if (!callSession) {
|
|
4161
4161
|
return Promise.resolve(null);
|
|
4162
4162
|
}
|
|
4163
|
-
logger$
|
|
4163
|
+
logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4164
4164
|
|
|
4165
4165
|
if (!this.currentCall) {
|
|
4166
4166
|
this.currentCall = callSession.call;
|
|
@@ -4173,7 +4173,7 @@ class CTIPhone extends Emitter {
|
|
|
4173
4173
|
if (!callSession) {
|
|
4174
4174
|
return;
|
|
4175
4175
|
}
|
|
4176
|
-
logger$
|
|
4176
|
+
logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4177
4177
|
|
|
4178
4178
|
this.currentCall = undefined;
|
|
4179
4179
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4183,7 +4183,7 @@ class CTIPhone extends Emitter {
|
|
|
4183
4183
|
if (!callSession) {
|
|
4184
4184
|
return Promise.resolve(false);
|
|
4185
4185
|
}
|
|
4186
|
-
logger$
|
|
4186
|
+
logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4187
4187
|
|
|
4188
4188
|
try {
|
|
4189
4189
|
await CallApi.cancelCall(callSession);
|
|
@@ -4194,7 +4194,7 @@ class CTIPhone extends Emitter {
|
|
|
4194
4194
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4195
4195
|
return true;
|
|
4196
4196
|
} catch (e) {
|
|
4197
|
-
logger$
|
|
4197
|
+
logger$b.error('hangup CTI call, error', e);
|
|
4198
4198
|
|
|
4199
4199
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4200
4200
|
return false;
|
|
@@ -4207,7 +4207,7 @@ class CTIPhone extends Emitter {
|
|
|
4207
4207
|
if (!callSession) {
|
|
4208
4208
|
return;
|
|
4209
4209
|
}
|
|
4210
|
-
logger$
|
|
4210
|
+
logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4211
4211
|
|
|
4212
4212
|
await CallApi.cancelCall(callSession);
|
|
4213
4213
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4217,7 +4217,7 @@ class CTIPhone extends Emitter {
|
|
|
4217
4217
|
if (!callSession) {
|
|
4218
4218
|
return;
|
|
4219
4219
|
}
|
|
4220
|
-
logger$
|
|
4220
|
+
logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4221
4221
|
|
|
4222
4222
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4223
4223
|
}
|
|
@@ -4230,19 +4230,19 @@ class CTIPhone extends Emitter {
|
|
|
4230
4230
|
if (!callSession) {
|
|
4231
4231
|
return;
|
|
4232
4232
|
}
|
|
4233
|
-
logger$
|
|
4233
|
+
logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4234
4234
|
|
|
4235
4235
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4236
4236
|
}
|
|
4237
4237
|
|
|
4238
4238
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4239
|
-
logger$
|
|
4239
|
+
logger$b.info('cancel CTI transfer', { transferId });
|
|
4240
4240
|
|
|
4241
4241
|
return CallApi.cancelCallTransfer(transferId);
|
|
4242
4242
|
}
|
|
4243
4243
|
|
|
4244
4244
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4245
|
-
logger$
|
|
4245
|
+
logger$b.info('confirm CTI transfer', { transferId });
|
|
4246
4246
|
|
|
4247
4247
|
return CallApi.confirmCallTransfer(transferId);
|
|
4248
4248
|
}
|
|
@@ -4251,19 +4251,19 @@ class CTIPhone extends Emitter {
|
|
|
4251
4251
|
if (!callSession) {
|
|
4252
4252
|
return;
|
|
4253
4253
|
}
|
|
4254
|
-
logger$
|
|
4254
|
+
logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4255
4255
|
|
|
4256
4256
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4257
4257
|
}
|
|
4258
4258
|
|
|
4259
4259
|
onConnectionMade() {
|
|
4260
|
-
logger$
|
|
4260
|
+
logger$b.info('on CTI connection made');
|
|
4261
4261
|
|
|
4262
4262
|
this.eventEmitter.emit('onCallAccepted');
|
|
4263
4263
|
}
|
|
4264
4264
|
|
|
4265
4265
|
async close() {
|
|
4266
|
-
logger$
|
|
4266
|
+
logger$b.info('CTI close');
|
|
4267
4267
|
|
|
4268
4268
|
return Promise.resolve();
|
|
4269
4269
|
}
|
|
@@ -4272,7 +4272,7 @@ class CTIPhone extends Emitter {
|
|
|
4272
4272
|
if (!callSession) {
|
|
4273
4273
|
return;
|
|
4274
4274
|
}
|
|
4275
|
-
logger$
|
|
4275
|
+
logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4276
4276
|
|
|
4277
4277
|
return CallApi.hold(callSession.callId);
|
|
4278
4278
|
}
|
|
@@ -4281,7 +4281,7 @@ class CTIPhone extends Emitter {
|
|
|
4281
4281
|
if (!callSession) {
|
|
4282
4282
|
return;
|
|
4283
4283
|
}
|
|
4284
|
-
logger$
|
|
4284
|
+
logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4285
4285
|
|
|
4286
4286
|
return CallApi.resume(callSession.callId);
|
|
4287
4287
|
}
|
|
@@ -4290,7 +4290,7 @@ class CTIPhone extends Emitter {
|
|
|
4290
4290
|
if (!callSession) {
|
|
4291
4291
|
return;
|
|
4292
4292
|
}
|
|
4293
|
-
logger$
|
|
4293
|
+
logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4294
4294
|
|
|
4295
4295
|
return CallApi.mute(callSession.callId);
|
|
4296
4296
|
}
|
|
@@ -4299,7 +4299,7 @@ class CTIPhone extends Emitter {
|
|
|
4299
4299
|
if (!callSession) {
|
|
4300
4300
|
return;
|
|
4301
4301
|
}
|
|
4302
|
-
logger$
|
|
4302
|
+
logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4303
4303
|
|
|
4304
4304
|
return CallApi.unmute(callSession.callId);
|
|
4305
4305
|
}
|
|
@@ -5308,7 +5308,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5308
5308
|
const WEBHOOKD_VERSION = '1.0';
|
|
5309
5309
|
const AMID_VERSION = '1.0';
|
|
5310
5310
|
|
|
5311
|
-
const logger$
|
|
5311
|
+
const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5312
5312
|
|
|
5313
5313
|
class ApiClient {
|
|
5314
5314
|
|
|
@@ -5360,12 +5360,12 @@ class ApiClient {
|
|
|
5360
5360
|
}
|
|
5361
5361
|
|
|
5362
5362
|
async forceRefreshToken() {
|
|
5363
|
-
logger$
|
|
5363
|
+
logger$a.info('forcing refresh token, calling callback');
|
|
5364
5364
|
return this.refreshTokenCallback();
|
|
5365
5365
|
}
|
|
5366
5366
|
|
|
5367
5367
|
async refreshTokenCallback() {
|
|
5368
|
-
logger$
|
|
5368
|
+
logger$a.info('refresh token callback called', {
|
|
5369
5369
|
refreshToken: this.refreshToken,
|
|
5370
5370
|
refreshBackend: this.refreshBackend,
|
|
5371
5371
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5383,7 +5383,7 @@ class ApiClient {
|
|
|
5383
5383
|
this.isMobile,
|
|
5384
5384
|
);
|
|
5385
5385
|
|
|
5386
|
-
logger$
|
|
5386
|
+
logger$a.info('token refreshed', { token: session.token });
|
|
5387
5387
|
|
|
5388
5388
|
if (this.onRefreshToken) {
|
|
5389
5389
|
this.onRefreshToken(session.token, session);
|
|
@@ -5524,7 +5524,7 @@ var getApiClient = (forServer ) => {
|
|
|
5524
5524
|
class InvalidSubscription extends Error {}
|
|
5525
5525
|
class InvalidAuthorization extends Error {}
|
|
5526
5526
|
|
|
5527
|
-
const logger$
|
|
5527
|
+
const logger$9 = IssueReporter$1.loggerFor('simple-auth');
|
|
5528
5528
|
|
|
5529
5529
|
class Auth {
|
|
5530
5530
|
|
|
@@ -5559,7 +5559,7 @@ class Auth {
|
|
|
5559
5559
|
setApiClientId(this.clientId);
|
|
5560
5560
|
setRefreshExpiration(this.expiration);
|
|
5561
5561
|
setOnRefreshToken((token , session ) => {
|
|
5562
|
-
logger$
|
|
5562
|
+
logger$9.info('on refresh token done', { token });
|
|
5563
5563
|
setApiToken(token);
|
|
5564
5564
|
Wazo.Websocket.updateToken(token);
|
|
5565
5565
|
|
|
@@ -5604,7 +5604,7 @@ class Auth {
|
|
|
5604
5604
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
5605
5605
|
return this._onAuthenticated(rawSession);
|
|
5606
5606
|
} catch (e) {
|
|
5607
|
-
logger$
|
|
5607
|
+
logger$9.error('on validate token error', e);
|
|
5608
5608
|
console.warn(e);
|
|
5609
5609
|
return false;
|
|
5610
5610
|
}
|
|
@@ -5960,7 +5960,7 @@ class AdHocAPIConference {
|
|
|
5960
5960
|
|
|
5961
5961
|
/* */
|
|
5962
5962
|
|
|
5963
|
-
const parseCandidate = (candidate ) => {
|
|
5963
|
+
const parseCandidate$1 = (candidate ) => {
|
|
5964
5964
|
if (!candidate) {
|
|
5965
5965
|
return null;
|
|
5966
5966
|
}
|
|
@@ -6114,7 +6114,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6114
6114
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
6115
6115
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6116
6116
|
if (event.candidate) {
|
|
6117
|
-
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
6117
|
+
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6118
6118
|
}
|
|
6119
6119
|
};
|
|
6120
6120
|
|
|
@@ -6578,7 +6578,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6578
6578
|
const SEND_STATS_DELAY = 5000;
|
|
6579
6579
|
|
|
6580
6580
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6581
|
-
const logger$
|
|
6581
|
+
const logger$8 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6582
6582
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6583
6583
|
|
|
6584
6584
|
// events
|
|
@@ -6592,14 +6592,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6592
6592
|
const MESSAGE = 'message';
|
|
6593
6593
|
const ACCEPTED = 'accepted';
|
|
6594
6594
|
const REJECTED = 'rejected';
|
|
6595
|
-
const ON_TRACK = 'onTrack';
|
|
6596
|
-
const ON_REINVITE = 'reinvite';
|
|
6595
|
+
const ON_TRACK$1 = 'onTrack';
|
|
6596
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
6597
6597
|
const ON_ERROR = 'onError';
|
|
6598
6598
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6599
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6600
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
6599
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6600
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6601
6601
|
|
|
6602
|
-
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6602
|
+
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6603
6603
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6604
6604
|
class CanceledCallError extends Error {}
|
|
6605
6605
|
|
|
@@ -6735,12 +6735,12 @@ class WebRTCClient extends Emitter {
|
|
|
6735
6735
|
this.MESSAGE = MESSAGE;
|
|
6736
6736
|
this.ACCEPTED = ACCEPTED;
|
|
6737
6737
|
this.REJECTED = REJECTED;
|
|
6738
|
-
this.ON_TRACK = ON_TRACK;
|
|
6739
|
-
this.ON_REINVITE = ON_REINVITE;
|
|
6738
|
+
this.ON_TRACK = ON_TRACK$1;
|
|
6739
|
+
this.ON_REINVITE = ON_REINVITE$1;
|
|
6740
6740
|
this.ON_ERROR = ON_ERROR;
|
|
6741
6741
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6742
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6743
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6742
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6743
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6744
6744
|
}
|
|
6745
6745
|
|
|
6746
6746
|
configureMedia(media ) {
|
|
@@ -6757,13 +6757,13 @@ class WebRTCClient extends Emitter {
|
|
|
6757
6757
|
|
|
6758
6758
|
createUserAgent(configOverrides ) {
|
|
6759
6759
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6760
|
-
logger$
|
|
6760
|
+
logger$8.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6761
6761
|
|
|
6762
6762
|
webRTCConfiguration.delegate = {
|
|
6763
6763
|
onConnect: this.onConnect.bind(this),
|
|
6764
6764
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6765
6765
|
onInvite: (invitation ) => {
|
|
6766
|
-
logger$
|
|
6766
|
+
logger$8.info('sdk webrtc on invite', {
|
|
6767
6767
|
method: 'delegate.onInvite',
|
|
6768
6768
|
id: invitation.id,
|
|
6769
6769
|
remoteURI: invitation.remoteURI,
|
|
@@ -6806,7 +6806,7 @@ class WebRTCClient extends Emitter {
|
|
|
6806
6806
|
}
|
|
6807
6807
|
|
|
6808
6808
|
onConnect() {
|
|
6809
|
-
logger$
|
|
6809
|
+
logger$8.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6810
6810
|
this.eventEmitter.emit(CONNECTED);
|
|
6811
6811
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6812
6812
|
this.registerer.waitingToggle(false);
|
|
@@ -6815,7 +6815,7 @@ class WebRTCClient extends Emitter {
|
|
|
6815
6815
|
}
|
|
6816
6816
|
|
|
6817
6817
|
async onDisconnect(error ) {
|
|
6818
|
-
logger$
|
|
6818
|
+
logger$8.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6819
6819
|
this.connectionPromise = null;
|
|
6820
6820
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6821
6821
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6840,37 +6840,37 @@ class WebRTCClient extends Emitter {
|
|
|
6840
6840
|
};
|
|
6841
6841
|
|
|
6842
6842
|
if (this.skipRegister) {
|
|
6843
|
-
logger$
|
|
6843
|
+
logger$8.info('sdk webrtc skip register...', logInfo);
|
|
6844
6844
|
return Promise.resolve();
|
|
6845
6845
|
}
|
|
6846
6846
|
|
|
6847
|
-
logger$
|
|
6847
|
+
logger$8.info('sdk webrtc registering...', logInfo);
|
|
6848
6848
|
|
|
6849
6849
|
if (!this.userAgent) {
|
|
6850
|
-
logger$
|
|
6850
|
+
logger$8.info('sdk webrtc recreating User Agent');
|
|
6851
6851
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6852
6852
|
}
|
|
6853
6853
|
if (!this.userAgent || this.isRegistered()) {
|
|
6854
|
-
logger$
|
|
6854
|
+
logger$8.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6855
6855
|
return Promise.resolve();
|
|
6856
6856
|
}
|
|
6857
6857
|
|
|
6858
6858
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6859
|
-
logger$
|
|
6859
|
+
logger$8.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6860
6860
|
return Promise.resolve();
|
|
6861
6861
|
}
|
|
6862
6862
|
|
|
6863
6863
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6864
6864
|
|
|
6865
6865
|
const onRegisterFailed = () => {
|
|
6866
|
-
logger$
|
|
6866
|
+
logger$8.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6867
6867
|
this.connectionPromise = null;
|
|
6868
6868
|
if (this.registerer && this.registerer.waiting) {
|
|
6869
6869
|
this.registerer.waitingToggle(false);
|
|
6870
6870
|
}
|
|
6871
6871
|
|
|
6872
6872
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6873
|
-
logger$
|
|
6873
|
+
logger$8.info('sdk webrtc registering, retrying...', { tries });
|
|
6874
6874
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6875
6875
|
}
|
|
6876
6876
|
};
|
|
@@ -6879,18 +6879,18 @@ class WebRTCClient extends Emitter {
|
|
|
6879
6879
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6880
6880
|
// during the resolution of the primise.
|
|
6881
6881
|
if (!this.userAgent) {
|
|
6882
|
-
logger$
|
|
6882
|
+
logger$8.info('sdk webrtc recreating User Agent after connection');
|
|
6883
6883
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6884
6884
|
}
|
|
6885
6885
|
|
|
6886
|
-
logger$
|
|
6886
|
+
logger$8.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6887
6887
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
6888
6888
|
this.connectionPromise = null;
|
|
6889
6889
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6890
6890
|
|
|
6891
6891
|
// Bind registerer events
|
|
6892
6892
|
this.registerer.stateChange.addListener(newState => {
|
|
6893
|
-
logger$
|
|
6893
|
+
logger$8.info('sdk webrtc registering, state changed', { newState });
|
|
6894
6894
|
|
|
6895
6895
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
6896
6896
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -6903,7 +6903,7 @@ class WebRTCClient extends Emitter {
|
|
|
6903
6903
|
const options = {
|
|
6904
6904
|
requestDelegate: {
|
|
6905
6905
|
onReject: response => {
|
|
6906
|
-
logger$
|
|
6906
|
+
logger$8.error('sdk webrtc registering, rejected', { response });
|
|
6907
6907
|
|
|
6908
6908
|
onRegisterFailed();
|
|
6909
6909
|
},
|
|
@@ -6911,13 +6911,13 @@ class WebRTCClient extends Emitter {
|
|
|
6911
6911
|
};
|
|
6912
6912
|
|
|
6913
6913
|
return this.registerer.register(options).catch((e) => {
|
|
6914
|
-
logger$
|
|
6914
|
+
logger$8.error('sdk webrtc registering, error', e);
|
|
6915
6915
|
|
|
6916
6916
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6917
6917
|
return e;
|
|
6918
6918
|
});
|
|
6919
6919
|
}).catch(error => {
|
|
6920
|
-
logger$
|
|
6920
|
+
logger$8.error('sdk webrtc registering, transport error', error);
|
|
6921
6921
|
onRegisterFailed();
|
|
6922
6922
|
});
|
|
6923
6923
|
}
|
|
@@ -6946,21 +6946,21 @@ class WebRTCClient extends Emitter {
|
|
|
6946
6946
|
}
|
|
6947
6947
|
|
|
6948
6948
|
unregister() {
|
|
6949
|
-
logger$
|
|
6949
|
+
logger$8.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6950
6950
|
if (!this.registerer) {
|
|
6951
6951
|
return Promise.resolve();
|
|
6952
6952
|
}
|
|
6953
6953
|
|
|
6954
6954
|
try {
|
|
6955
6955
|
return this.registerer.unregister().then(() => {
|
|
6956
|
-
logger$
|
|
6956
|
+
logger$8.info('sdk webrtc unregistered');
|
|
6957
6957
|
this._cleanupRegister();
|
|
6958
6958
|
}).catch(e => {
|
|
6959
|
-
logger$
|
|
6959
|
+
logger$8.error('sdk webrtc unregistering, promise error', e);
|
|
6960
6960
|
this._cleanupRegister();
|
|
6961
6961
|
});
|
|
6962
6962
|
} catch (e) {
|
|
6963
|
-
logger$
|
|
6963
|
+
logger$8.error('sdk webrtc unregistering, error', e);
|
|
6964
6964
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6965
6965
|
// error when the registerer is in a bad state
|
|
6966
6966
|
this._cleanupRegister();
|
|
@@ -6968,7 +6968,7 @@ class WebRTCClient extends Emitter {
|
|
|
6968
6968
|
}
|
|
6969
6969
|
|
|
6970
6970
|
stop() {
|
|
6971
|
-
logger$
|
|
6971
|
+
logger$8.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6972
6972
|
if (!this.userAgent) {
|
|
6973
6973
|
return Promise.resolve();
|
|
6974
6974
|
}
|
|
@@ -6976,12 +6976,12 @@ class WebRTCClient extends Emitter {
|
|
|
6976
6976
|
return this.userAgent.stop().then(() => {
|
|
6977
6977
|
return this._cleanupRegister();
|
|
6978
6978
|
}).catch(e => {
|
|
6979
|
-
logger$
|
|
6979
|
+
logger$8.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6980
6980
|
});
|
|
6981
6981
|
}
|
|
6982
6982
|
|
|
6983
6983
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6984
|
-
logger$
|
|
6984
|
+
logger$8.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6985
6985
|
const inviterOptions = {
|
|
6986
6986
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6987
6987
|
conference,
|
|
@@ -7012,7 +7012,7 @@ class WebRTCClient extends Emitter {
|
|
|
7012
7012
|
this._onAccepted(session, response.session, true);
|
|
7013
7013
|
},
|
|
7014
7014
|
onReject: (response ) => {
|
|
7015
|
-
logger$
|
|
7015
|
+
logger$8.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
7016
7016
|
this._stopSendingStats(session);
|
|
7017
7017
|
this.stopNetworkMonitoring(session);
|
|
7018
7018
|
|
|
@@ -7035,11 +7035,11 @@ class WebRTCClient extends Emitter {
|
|
|
7035
7035
|
}
|
|
7036
7036
|
|
|
7037
7037
|
answer(session , enableVideo ) {
|
|
7038
|
-
logger$
|
|
7038
|
+
logger$8.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
7039
7039
|
|
|
7040
7040
|
if (!session || !session.accept) {
|
|
7041
7041
|
const error = 'No session to answer, or not an invitation';
|
|
7042
|
-
logger$
|
|
7042
|
+
logger$8.warn(error);
|
|
7043
7043
|
return Promise.reject(new Error(error));
|
|
7044
7044
|
}
|
|
7045
7045
|
const options = {
|
|
@@ -7049,15 +7049,15 @@ class WebRTCClient extends Emitter {
|
|
|
7049
7049
|
return session.accept(options).then(() => {
|
|
7050
7050
|
if (session.isCanceled) {
|
|
7051
7051
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
7052
|
-
logger$
|
|
7052
|
+
logger$8.error(message, { id: session.id });
|
|
7053
7053
|
this.onCallEnded(session);
|
|
7054
7054
|
|
|
7055
7055
|
throw new CanceledCallError(message);
|
|
7056
7056
|
}
|
|
7057
|
-
logger$
|
|
7057
|
+
logger$8.info('sdk webrtc answer, accepted.');
|
|
7058
7058
|
this._onAccepted(session);
|
|
7059
7059
|
}).catch(e => {
|
|
7060
|
-
logger$
|
|
7060
|
+
logger$8.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
7061
7061
|
|
|
7062
7062
|
throw e;
|
|
7063
7063
|
});
|
|
@@ -7065,7 +7065,7 @@ class WebRTCClient extends Emitter {
|
|
|
7065
7065
|
|
|
7066
7066
|
hangup(session ) {
|
|
7067
7067
|
const { state, id } = session;
|
|
7068
|
-
logger$
|
|
7068
|
+
logger$8.info('sdk webrtc hangup call', { id, state });
|
|
7069
7069
|
|
|
7070
7070
|
try {
|
|
7071
7071
|
this._stopSendingStats(session);
|
|
@@ -7094,7 +7094,7 @@ class WebRTCClient extends Emitter {
|
|
|
7094
7094
|
|
|
7095
7095
|
return bye();
|
|
7096
7096
|
} catch (error) {
|
|
7097
|
-
logger$
|
|
7097
|
+
logger$8.warn('sdk webrtc hangup, error', error);
|
|
7098
7098
|
}
|
|
7099
7099
|
|
|
7100
7100
|
return null;
|
|
@@ -7112,7 +7112,7 @@ class WebRTCClient extends Emitter {
|
|
|
7112
7112
|
// Fetch and emit an event at `interval` with session network stats
|
|
7113
7113
|
startNetworkMonitoring(session , interval = 1000) {
|
|
7114
7114
|
const sessionId = this.getSipSessionId(session);
|
|
7115
|
-
logger$
|
|
7115
|
+
logger$8.info('starting network inspection', { id: sessionId });
|
|
7116
7116
|
|
|
7117
7117
|
this.sessionNetworkStats[sessionId] = [];
|
|
7118
7118
|
|
|
@@ -7122,7 +7122,7 @@ class WebRTCClient extends Emitter {
|
|
|
7122
7122
|
stopNetworkMonitoring(session ) {
|
|
7123
7123
|
const sessionId = this.getSipSessionId(session);
|
|
7124
7124
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
7125
|
-
logger$
|
|
7125
|
+
logger$8.info('stopping network inspection', { id: sessionId, exists });
|
|
7126
7126
|
|
|
7127
7127
|
if (exists) {
|
|
7128
7128
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -7132,17 +7132,17 @@ class WebRTCClient extends Emitter {
|
|
|
7132
7132
|
}
|
|
7133
7133
|
|
|
7134
7134
|
reject(session ) {
|
|
7135
|
-
logger$
|
|
7135
|
+
logger$8.info('sdk webrtc reject call', { id: session.id });
|
|
7136
7136
|
|
|
7137
7137
|
try {
|
|
7138
7138
|
return session.reject ? session.reject() : session.cancel();
|
|
7139
7139
|
} catch (e) {
|
|
7140
|
-
logger$
|
|
7140
|
+
logger$8.warn('Error when rejecting call', e.message, e.stack);
|
|
7141
7141
|
}
|
|
7142
7142
|
}
|
|
7143
7143
|
|
|
7144
7144
|
async close() {
|
|
7145
|
-
logger$
|
|
7145
|
+
logger$8.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
7146
7146
|
this._cleanupMedia();
|
|
7147
7147
|
this.connectionPromise = null;
|
|
7148
7148
|
|
|
@@ -7173,7 +7173,7 @@ class WebRTCClient extends Emitter {
|
|
|
7173
7173
|
// eg: "INVITE not rejectable in state Completed"
|
|
7174
7174
|
}
|
|
7175
7175
|
this.userAgent = null;
|
|
7176
|
-
logger$
|
|
7176
|
+
logger$8.info('sdk webrtc client closed');
|
|
7177
7177
|
}
|
|
7178
7178
|
|
|
7179
7179
|
getNumber(session ) {
|
|
@@ -7186,13 +7186,13 @@ class WebRTCClient extends Emitter {
|
|
|
7186
7186
|
}
|
|
7187
7187
|
|
|
7188
7188
|
mute(session ) {
|
|
7189
|
-
logger$
|
|
7189
|
+
logger$8.info('sdk webrtc mute', { id: session.id });
|
|
7190
7190
|
|
|
7191
7191
|
this._toggleAudio(session, true);
|
|
7192
7192
|
}
|
|
7193
7193
|
|
|
7194
7194
|
unmute(session ) {
|
|
7195
|
-
logger$
|
|
7195
|
+
logger$8.info('sdk webrtc unmute', { id: session.id });
|
|
7196
7196
|
|
|
7197
7197
|
this._toggleAudio(session, false);
|
|
7198
7198
|
}
|
|
@@ -7232,13 +7232,13 @@ class WebRTCClient extends Emitter {
|
|
|
7232
7232
|
}
|
|
7233
7233
|
|
|
7234
7234
|
toggleCameraOn(session ) {
|
|
7235
|
-
logger$
|
|
7235
|
+
logger$8.info('sdk webrtc toggle camera on', { id: session.id });
|
|
7236
7236
|
|
|
7237
7237
|
this._toggleVideo(session, false);
|
|
7238
7238
|
}
|
|
7239
7239
|
|
|
7240
7240
|
toggleCameraOff(session ) {
|
|
7241
|
-
logger$
|
|
7241
|
+
logger$8.info('sdk webrtc toggle camera off', { id: session.id });
|
|
7242
7242
|
|
|
7243
7243
|
this._toggleVideo(session, true);
|
|
7244
7244
|
}
|
|
@@ -7247,7 +7247,7 @@ class WebRTCClient extends Emitter {
|
|
|
7247
7247
|
const sessionId = this.getSipSessionId(session);
|
|
7248
7248
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
7249
7249
|
|
|
7250
|
-
logger$
|
|
7250
|
+
logger$8.info('sdk webrtc hold', {
|
|
7251
7251
|
sessionId,
|
|
7252
7252
|
keys: Object.keys(this.heldSessions),
|
|
7253
7253
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7296,7 +7296,7 @@ class WebRTCClient extends Emitter {
|
|
|
7296
7296
|
const sessionId = this.getSipSessionId(session);
|
|
7297
7297
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7298
7298
|
|
|
7299
|
-
logger$
|
|
7299
|
+
logger$8.info('sdk webrtc unhold', {
|
|
7300
7300
|
sessionId,
|
|
7301
7301
|
keys: Object.keys(this.heldSessions),
|
|
7302
7302
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7444,7 +7444,7 @@ class WebRTCClient extends Emitter {
|
|
|
7444
7444
|
if (!session.sessionDescriptionHandler) {
|
|
7445
7445
|
return;
|
|
7446
7446
|
}
|
|
7447
|
-
logger$
|
|
7447
|
+
logger$8.info('Sending DTMF', {
|
|
7448
7448
|
id: this.getSipSessionId(session),
|
|
7449
7449
|
tone,
|
|
7450
7450
|
});
|
|
@@ -7460,7 +7460,7 @@ class WebRTCClient extends Emitter {
|
|
|
7460
7460
|
transfer(session , target ) {
|
|
7461
7461
|
this.hold(session);
|
|
7462
7462
|
|
|
7463
|
-
logger$
|
|
7463
|
+
logger$8.info('Transfering a session', {
|
|
7464
7464
|
id: this.getSipSessionId(session),
|
|
7465
7465
|
target,
|
|
7466
7466
|
});
|
|
@@ -7482,17 +7482,17 @@ class WebRTCClient extends Emitter {
|
|
|
7482
7482
|
atxfer(session ) {
|
|
7483
7483
|
this.hold(session);
|
|
7484
7484
|
|
|
7485
|
-
logger$
|
|
7485
|
+
logger$8.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7486
7486
|
|
|
7487
7487
|
const result = {
|
|
7488
7488
|
newSession: null,
|
|
7489
7489
|
init: async (target ) => {
|
|
7490
|
-
logger$
|
|
7490
|
+
logger$8.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7491
7491
|
|
|
7492
7492
|
result.newSession = await this.call(target);
|
|
7493
7493
|
},
|
|
7494
7494
|
complete: () => {
|
|
7495
|
-
logger$
|
|
7495
|
+
logger$8.info('webrtc transfer completed', {
|
|
7496
7496
|
id: this.getSipSessionId(session),
|
|
7497
7497
|
referId: this.getSipSessionId(result.newSession),
|
|
7498
7498
|
});
|
|
@@ -7513,7 +7513,7 @@ class WebRTCClient extends Emitter {
|
|
|
7513
7513
|
return;
|
|
7514
7514
|
}
|
|
7515
7515
|
|
|
7516
|
-
logger$
|
|
7516
|
+
logger$8.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7517
7517
|
|
|
7518
7518
|
try {
|
|
7519
7519
|
sipSession.message({
|
|
@@ -7555,7 +7555,7 @@ class WebRTCClient extends Emitter {
|
|
|
7555
7555
|
}
|
|
7556
7556
|
|
|
7557
7557
|
changeAudioOutputVolume(volume ) {
|
|
7558
|
-
logger$
|
|
7558
|
+
logger$8.info('Changing audio output volume', { volume });
|
|
7559
7559
|
|
|
7560
7560
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7561
7561
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7567,7 +7567,7 @@ class WebRTCClient extends Emitter {
|
|
|
7567
7567
|
}
|
|
7568
7568
|
|
|
7569
7569
|
changeAudioOutputDevice(id ) {
|
|
7570
|
-
logger$
|
|
7570
|
+
logger$8.info('Changing audio output device', { id });
|
|
7571
7571
|
|
|
7572
7572
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7573
7573
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7584,7 +7584,7 @@ class WebRTCClient extends Emitter {
|
|
|
7584
7584
|
|
|
7585
7585
|
changeAudioInputDevice(id , session ) {
|
|
7586
7586
|
const currentId = this.getAudioDeviceId();
|
|
7587
|
-
logger$
|
|
7587
|
+
logger$8.info('setting audio input device', { id, currentId, session: !!session });
|
|
7588
7588
|
|
|
7589
7589
|
if (id === currentId) {
|
|
7590
7590
|
return null;
|
|
@@ -7630,7 +7630,7 @@ class WebRTCClient extends Emitter {
|
|
|
7630
7630
|
|
|
7631
7631
|
setVideoInputDevice(id ) {
|
|
7632
7632
|
const currentId = this.getVideoDeviceId();
|
|
7633
|
-
logger$
|
|
7633
|
+
logger$8.info('setting video input device', { id, currentId });
|
|
7634
7634
|
|
|
7635
7635
|
if (id === currentId) {
|
|
7636
7636
|
return null;
|
|
@@ -7655,7 +7655,7 @@ class WebRTCClient extends Emitter {
|
|
|
7655
7655
|
const sessionId = this.getSipSessionId(session);
|
|
7656
7656
|
const localStream = this.getLocalStream(sessionId);
|
|
7657
7657
|
|
|
7658
|
-
logger$
|
|
7658
|
+
logger$8.info('changing video input device', { id, sessionId });
|
|
7659
7659
|
|
|
7660
7660
|
// Release old video stream
|
|
7661
7661
|
if (localStream) {
|
|
@@ -7723,7 +7723,7 @@ class WebRTCClient extends Emitter {
|
|
|
7723
7723
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7724
7724
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7725
7725
|
|
|
7726
|
-
logger$
|
|
7726
|
+
logger$8.info('Sending reinvite', {
|
|
7727
7727
|
id: this.getSipSessionId(sipSession),
|
|
7728
7728
|
newConstraints,
|
|
7729
7729
|
conference,
|
|
@@ -7761,7 +7761,7 @@ class WebRTCClient extends Emitter {
|
|
|
7761
7761
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7762
7762
|
}
|
|
7763
7763
|
|
|
7764
|
-
logger$
|
|
7764
|
+
logger$8.info('on re-INVITE accepted', {
|
|
7765
7765
|
id: this.getSipSessionId(sipSession),
|
|
7766
7766
|
wasMuted,
|
|
7767
7767
|
shouldDoScreenSharing,
|
|
@@ -7779,7 +7779,7 @@ class WebRTCClient extends Emitter {
|
|
|
7779
7779
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7780
7780
|
}
|
|
7781
7781
|
|
|
7782
|
-
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7782
|
+
return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
|
|
7783
7783
|
},
|
|
7784
7784
|
},
|
|
7785
7785
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7936,7 +7936,7 @@ class WebRTCClient extends Emitter {
|
|
|
7936
7936
|
}
|
|
7937
7937
|
|
|
7938
7938
|
startHeartbeat() {
|
|
7939
|
-
logger$
|
|
7939
|
+
logger$8.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7940
7940
|
if (!this.userAgent) {
|
|
7941
7941
|
this.heartbeat.stop();
|
|
7942
7942
|
return;
|
|
@@ -7949,7 +7949,7 @@ class WebRTCClient extends Emitter {
|
|
|
7949
7949
|
}
|
|
7950
7950
|
|
|
7951
7951
|
stopHeartbeat() {
|
|
7952
|
-
logger$
|
|
7952
|
+
logger$8.info('sdk webrtc stop heartbeat');
|
|
7953
7953
|
this.heartbeat.stop();
|
|
7954
7954
|
}
|
|
7955
7955
|
|
|
@@ -7970,7 +7970,7 @@ class WebRTCClient extends Emitter {
|
|
|
7970
7970
|
}
|
|
7971
7971
|
|
|
7972
7972
|
attemptReconnection() {
|
|
7973
|
-
logger$
|
|
7973
|
+
logger$8.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7974
7974
|
if (!this.userAgent) {
|
|
7975
7975
|
return;
|
|
7976
7976
|
}
|
|
@@ -7995,7 +7995,7 @@ class WebRTCClient extends Emitter {
|
|
|
7995
7995
|
return;
|
|
7996
7996
|
}
|
|
7997
7997
|
|
|
7998
|
-
logger$
|
|
7998
|
+
logger$8.info('setting local media stream', {
|
|
7999
7999
|
sipSessionId,
|
|
8000
8000
|
tracks: newStream ? newStream.getTracks() : null,
|
|
8001
8001
|
});
|
|
@@ -8012,7 +8012,7 @@ class WebRTCClient extends Emitter {
|
|
|
8012
8012
|
|
|
8013
8013
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
8014
8014
|
|
|
8015
|
-
logger$
|
|
8015
|
+
logger$8.info('updating local stream', {
|
|
8016
8016
|
sipSessionId,
|
|
8017
8017
|
oldStream: !!oldStream,
|
|
8018
8018
|
tracks: newStream.getTracks(),
|
|
@@ -8032,7 +8032,7 @@ class WebRTCClient extends Emitter {
|
|
|
8032
8032
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
8033
8033
|
const pc = this.getPeerConnection(sessionId);
|
|
8034
8034
|
|
|
8035
|
-
logger$
|
|
8035
|
+
logger$8.info('Updating remote stream', {
|
|
8036
8036
|
sessionId,
|
|
8037
8037
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
8038
8038
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -8057,14 +8057,16 @@ class WebRTCClient extends Emitter {
|
|
|
8057
8057
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
8058
8058
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
8059
8059
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
8060
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
8060
8061
|
|
|
8061
|
-
logger$
|
|
8062
|
+
logger$8.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
8062
8063
|
|
|
8063
8064
|
return {
|
|
8064
8065
|
constraints: {
|
|
8065
8066
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
8066
8067
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
8067
|
-
video: screenSharing ? (isDesktop
|
|
8068
|
+
video: screenSharing ? (isDesktop
|
|
8069
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
8068
8070
|
: this._getVideoConstraints(enableVideo),
|
|
8069
8071
|
screen: screenSharing,
|
|
8070
8072
|
desktop: isDesktop,
|
|
@@ -8107,7 +8109,7 @@ class WebRTCClient extends Emitter {
|
|
|
8107
8109
|
}
|
|
8108
8110
|
|
|
8109
8111
|
_onTransportError() {
|
|
8110
|
-
logger$
|
|
8112
|
+
logger$8.error('on transport error');
|
|
8111
8113
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
8112
8114
|
this.attemptReconnection();
|
|
8113
8115
|
}
|
|
@@ -8116,7 +8118,7 @@ class WebRTCClient extends Emitter {
|
|
|
8116
8118
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
8117
8119
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
8118
8120
|
if (this.hasHeartbeat()) {
|
|
8119
|
-
logger$
|
|
8121
|
+
logger$8.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
8120
8122
|
|
|
8121
8123
|
this.heartbeat.onHeartbeat();
|
|
8122
8124
|
if (this.heartbeatCb) {
|
|
@@ -8127,7 +8129,7 @@ class WebRTCClient extends Emitter {
|
|
|
8127
8129
|
}
|
|
8128
8130
|
|
|
8129
8131
|
async _onHeartbeatTimeout() {
|
|
8130
|
-
logger$
|
|
8132
|
+
logger$8.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
8131
8133
|
|
|
8132
8134
|
if (this.heartbeatTimeoutCb) {
|
|
8133
8135
|
this.heartbeatTimeoutCb();
|
|
@@ -8139,7 +8141,7 @@ class WebRTCClient extends Emitter {
|
|
|
8139
8141
|
try {
|
|
8140
8142
|
await this.userAgent.transport.disconnect();
|
|
8141
8143
|
} catch (e) {
|
|
8142
|
-
logger$
|
|
8144
|
+
logger$8.error('Transport disconnection after heartbeat timeout, error', e);
|
|
8143
8145
|
}
|
|
8144
8146
|
}
|
|
8145
8147
|
|
|
@@ -8172,31 +8174,31 @@ class WebRTCClient extends Emitter {
|
|
|
8172
8174
|
}
|
|
8173
8175
|
|
|
8174
8176
|
_connectIfNeeded() {
|
|
8175
|
-
logger$
|
|
8177
|
+
logger$8.info('connect if needed, checking', { connected: this.isConnected() });
|
|
8176
8178
|
if (!this.userAgent) {
|
|
8177
|
-
logger$
|
|
8179
|
+
logger$8.info('need to recreate User Agent');
|
|
8178
8180
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
8179
8181
|
}
|
|
8180
8182
|
|
|
8181
8183
|
if (this.isConnected()) {
|
|
8182
|
-
logger$
|
|
8184
|
+
logger$8.info('webrtc sdk, already connected');
|
|
8183
8185
|
return Promise.resolve();
|
|
8184
8186
|
}
|
|
8185
8187
|
|
|
8186
8188
|
if (this.isConnecting()) {
|
|
8187
|
-
logger$
|
|
8189
|
+
logger$8.info('webrtc sdk, already connecting...');
|
|
8188
8190
|
|
|
8189
8191
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
8190
8192
|
return this.connectionPromise;
|
|
8191
8193
|
}
|
|
8192
8194
|
|
|
8193
8195
|
if (this.connectionPromise) {
|
|
8194
|
-
logger$
|
|
8196
|
+
logger$8.info('webrtc sdk, connection promise connecting...');
|
|
8195
8197
|
// $FlowFixMe
|
|
8196
8198
|
return this.connectionPromise;
|
|
8197
8199
|
}
|
|
8198
8200
|
|
|
8199
|
-
logger$
|
|
8201
|
+
logger$8.info('WebRTC UA needs to connect');
|
|
8200
8202
|
|
|
8201
8203
|
// Force UA to reconnect
|
|
8202
8204
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -8321,7 +8323,7 @@ class WebRTCClient extends Emitter {
|
|
|
8321
8323
|
|
|
8322
8324
|
sdh.peerConnectionDelegate = {
|
|
8323
8325
|
onicecandidateerror: (error ) => {
|
|
8324
|
-
logger$
|
|
8326
|
+
logger$8.error('on icecandidate error', {
|
|
8325
8327
|
address: error.address,
|
|
8326
8328
|
port: error.port,
|
|
8327
8329
|
errorCode: error.errorCode,
|
|
@@ -8350,7 +8352,7 @@ class WebRTCClient extends Emitter {
|
|
|
8350
8352
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8351
8353
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8352
8354
|
}
|
|
8353
|
-
logger$
|
|
8355
|
+
logger$8.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8354
8356
|
|
|
8355
8357
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8356
8358
|
|
|
@@ -8366,12 +8368,12 @@ class WebRTCClient extends Emitter {
|
|
|
8366
8368
|
|
|
8367
8369
|
this._setupMedias(session);
|
|
8368
8370
|
|
|
8369
|
-
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8371
|
+
return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8370
8372
|
};
|
|
8371
8373
|
}
|
|
8372
8374
|
|
|
8373
8375
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8374
|
-
logger$
|
|
8376
|
+
logger$8.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8375
8377
|
|
|
8376
8378
|
this.storeSipSession(session);
|
|
8377
8379
|
|
|
@@ -8383,14 +8385,14 @@ class WebRTCClient extends Emitter {
|
|
|
8383
8385
|
const onTrack = (event ) => {
|
|
8384
8386
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8385
8387
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8386
|
-
logger$
|
|
8388
|
+
logger$8.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8387
8389
|
|
|
8388
8390
|
// Stop video track in audio only mode
|
|
8389
8391
|
if (isAudioOnly && kind === 'video') {
|
|
8390
8392
|
event.track.stop();
|
|
8391
8393
|
}
|
|
8392
8394
|
|
|
8393
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8395
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
8394
8396
|
};
|
|
8395
8397
|
|
|
8396
8398
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8399,12 +8401,14 @@ class WebRTCClient extends Emitter {
|
|
|
8399
8401
|
|
|
8400
8402
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8401
8403
|
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8404
|
+
if (pc) {
|
|
8405
|
+
pc.oniceconnectionstatechange = () => {
|
|
8406
|
+
logger$8.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8407
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8408
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8409
|
+
}
|
|
8410
|
+
};
|
|
8411
|
+
}
|
|
8408
8412
|
|
|
8409
8413
|
if (withEvent) {
|
|
8410
8414
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8573,10 +8577,10 @@ class WebRTCClient extends Emitter {
|
|
|
8573
8577
|
|
|
8574
8578
|
_stopSendingStats(session ) {
|
|
8575
8579
|
const sessionId = this.getSipSessionId(session);
|
|
8576
|
-
logger$
|
|
8580
|
+
logger$8.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8577
8581
|
|
|
8578
8582
|
if (sessionId in this.statsIntervals) {
|
|
8579
|
-
logger$
|
|
8583
|
+
logger$8.trace('Stop sending stats for call', { sessionId });
|
|
8580
8584
|
this.statsIntervals[sessionId]();
|
|
8581
8585
|
delete this.statsIntervals[sessionId];
|
|
8582
8586
|
}
|
|
@@ -8592,7 +8596,7 @@ class WebRTCClient extends Emitter {
|
|
|
8592
8596
|
try {
|
|
8593
8597
|
await this.userAgent.transport.disconnect();
|
|
8594
8598
|
} catch (e) {
|
|
8595
|
-
logger$
|
|
8599
|
+
logger$8.error('WebRTC transport disconnect, error', e);
|
|
8596
8600
|
}
|
|
8597
8601
|
}
|
|
8598
8602
|
}
|
|
@@ -8614,13 +8618,17 @@ class WebRTCClient extends Emitter {
|
|
|
8614
8618
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8615
8619
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8616
8620
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8621
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8617
8622
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8618
8623
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8624
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8619
8625
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8620
8626
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8621
8627
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8622
|
-
let audioBytesSent = 0;
|
|
8623
|
-
let audioBytesReceived = 0;
|
|
8628
|
+
let audioBytesSent = 0; // content + header
|
|
8629
|
+
let audioBytesReceived = 0; // content + header
|
|
8630
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8631
|
+
let audioContentReceived = 0;
|
|
8624
8632
|
let videoBytesSent = 0;
|
|
8625
8633
|
let videoBytesReceived = 0;
|
|
8626
8634
|
let transportSent = 0;
|
|
@@ -8630,6 +8638,7 @@ class WebRTCClient extends Emitter {
|
|
|
8630
8638
|
stats.forEach(report => {
|
|
8631
8639
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8632
8640
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8641
|
+
audioContentSent += Number(report.bytesSent);
|
|
8633
8642
|
}
|
|
8634
8643
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8635
8644
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -8641,6 +8650,7 @@ class WebRTCClient extends Emitter {
|
|
|
8641
8650
|
packetsLost += Number(report.packetsLost);
|
|
8642
8651
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8643
8652
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8653
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8644
8654
|
}
|
|
8645
8655
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8646
8656
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -8669,10 +8679,17 @@ class WebRTCClient extends Emitter {
|
|
|
8669
8679
|
});
|
|
8670
8680
|
|
|
8671
8681
|
networkStats.packetsLost = packetsLost;
|
|
8682
|
+
|
|
8672
8683
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8673
8684
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8674
8685
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8675
8686
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8687
|
+
|
|
8688
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8689
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8690
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8691
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8692
|
+
|
|
8676
8693
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8677
8694
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8678
8695
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8686,7 +8703,7 @@ class WebRTCClient extends Emitter {
|
|
|
8686
8703
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8687
8704
|
+ networkStats.transportSent;
|
|
8688
8705
|
|
|
8689
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8706
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8690
8707
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8691
8708
|
}
|
|
8692
8709
|
|
|
@@ -8714,8 +8731,8 @@ const ON_CALL_FAILED = 'onCallFailed';
|
|
|
8714
8731
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8715
8732
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8716
8733
|
const ON_MESSAGE = 'onMessage';
|
|
8717
|
-
const ON_REINVITE
|
|
8718
|
-
const ON_TRACK
|
|
8734
|
+
const ON_REINVITE = 'reinvite';
|
|
8735
|
+
const ON_TRACK = 'onTrack';
|
|
8719
8736
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8720
8737
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8721
8738
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8730,15 +8747,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8730
8747
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8731
8748
|
const ON_CALL_ERROR = 'onCallError';
|
|
8732
8749
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8733
|
-
const ON_NETWORK_STATS
|
|
8750
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8734
8751
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8735
8752
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8736
|
-
const ON_DISCONNECTED
|
|
8753
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
8737
8754
|
|
|
8738
8755
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8739
8756
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8740
8757
|
|
|
8741
|
-
const events
|
|
8758
|
+
const events = [
|
|
8742
8759
|
ON_USER_AGENT,
|
|
8743
8760
|
ON_REGISTERED,
|
|
8744
8761
|
ON_UNREGISTERED,
|
|
@@ -8756,8 +8773,8 @@ const events$1 = [
|
|
|
8756
8773
|
ON_CALL_FAILED,
|
|
8757
8774
|
ON_CALL_ENDED,
|
|
8758
8775
|
ON_MESSAGE,
|
|
8759
|
-
ON_REINVITE
|
|
8760
|
-
ON_TRACK
|
|
8776
|
+
ON_REINVITE,
|
|
8777
|
+
ON_TRACK,
|
|
8761
8778
|
ON_AUDIO_STREAM,
|
|
8762
8779
|
ON_VIDEO_STREAM,
|
|
8763
8780
|
ON_REMOVE_STREAM,
|
|
@@ -8772,11 +8789,11 @@ const events$1 = [
|
|
|
8772
8789
|
ON_CALL_ERROR,
|
|
8773
8790
|
ON_CHAT,
|
|
8774
8791
|
ON_SIGNAL,
|
|
8775
|
-
ON_NETWORK_STATS
|
|
8776
|
-
ON_DISCONNECTED
|
|
8792
|
+
ON_NETWORK_STATS,
|
|
8793
|
+
ON_DISCONNECTED,
|
|
8777
8794
|
];
|
|
8778
8795
|
|
|
8779
|
-
const logger$
|
|
8796
|
+
const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8780
8797
|
|
|
8781
8798
|
class WebRTCPhone extends Emitter {
|
|
8782
8799
|
|
|
@@ -8849,7 +8866,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8849
8866
|
}).catch(error => {
|
|
8850
8867
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8851
8868
|
console.error('register error', error, error.message, error.stack);
|
|
8852
|
-
logger$
|
|
8869
|
+
logger$7.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8853
8870
|
});
|
|
8854
8871
|
}
|
|
8855
8872
|
|
|
@@ -8864,7 +8881,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8864
8881
|
if (!this.client) {
|
|
8865
8882
|
return;
|
|
8866
8883
|
}
|
|
8867
|
-
logger$
|
|
8884
|
+
logger$7.info('WebRTC phone stop');
|
|
8868
8885
|
this.client.stop();
|
|
8869
8886
|
}
|
|
8870
8887
|
|
|
@@ -8879,11 +8896,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8879
8896
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8880
8897
|
audioOnly = false, iceRestart = false) {
|
|
8881
8898
|
const sipSession = this.findSipSession(callSession);
|
|
8882
|
-
logger$
|
|
8899
|
+
logger$7.info('WebRTC phone - send reinvite', {
|
|
8883
8900
|
sessionId: sipSession ? sipSession.id : null,
|
|
8884
8901
|
constraints,
|
|
8885
8902
|
audioOnly,
|
|
8886
8903
|
conference,
|
|
8904
|
+
iceRestart,
|
|
8887
8905
|
});
|
|
8888
8906
|
|
|
8889
8907
|
if (!sipSession) {
|
|
@@ -8916,7 +8934,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8916
8934
|
}
|
|
8917
8935
|
|
|
8918
8936
|
startHeartbeat() {
|
|
8919
|
-
logger$
|
|
8937
|
+
logger$7.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8920
8938
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8921
8939
|
return;
|
|
8922
8940
|
}
|
|
@@ -8925,7 +8943,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8925
8943
|
}
|
|
8926
8944
|
|
|
8927
8945
|
stopHeartbeat() {
|
|
8928
|
-
logger$
|
|
8946
|
+
logger$7.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8929
8947
|
if (!this.client) {
|
|
8930
8948
|
return;
|
|
8931
8949
|
}
|
|
@@ -8942,7 +8960,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8942
8960
|
}
|
|
8943
8961
|
|
|
8944
8962
|
reconnect() {
|
|
8945
|
-
logger$
|
|
8963
|
+
logger$7.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8946
8964
|
if (!this.client) {
|
|
8947
8965
|
return;
|
|
8948
8966
|
}
|
|
@@ -8983,7 +9001,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8983
9001
|
return false;
|
|
8984
9002
|
}
|
|
8985
9003
|
|
|
8986
|
-
logger$
|
|
9004
|
+
logger$7.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8987
9005
|
|
|
8988
9006
|
this.client.downgradeToAudio(sipSession);
|
|
8989
9007
|
|
|
@@ -9006,7 +9024,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9006
9024
|
return Promise.resolve(false);
|
|
9007
9025
|
}
|
|
9008
9026
|
|
|
9009
|
-
logger$
|
|
9027
|
+
logger$7.info('Upgrade to video', {
|
|
9010
9028
|
id: callSession ? callSession.getId() : null,
|
|
9011
9029
|
constraints,
|
|
9012
9030
|
isConference,
|
|
@@ -9046,7 +9064,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9046
9064
|
|
|
9047
9065
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
9048
9066
|
const sipSession = this.findSipSession(callSession);
|
|
9049
|
-
logger$
|
|
9067
|
+
logger$7.info('Sending reinvite message', {
|
|
9050
9068
|
id: callSession ? callSession.getId() : null,
|
|
9051
9069
|
isUpgrade,
|
|
9052
9070
|
});
|
|
@@ -9072,7 +9090,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9072
9090
|
// Monkey patch to know when canceled with the CANCEL message
|
|
9073
9091
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
9074
9092
|
sipSession._onCancel = (message ) => {
|
|
9075
|
-
logger$
|
|
9093
|
+
logger$7.trace('on sip session canceled', { callId: message.callId });
|
|
9076
9094
|
|
|
9077
9095
|
onCancel(message);
|
|
9078
9096
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -9100,13 +9118,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9100
9118
|
this.audioOutputVolume,
|
|
9101
9119
|
);
|
|
9102
9120
|
case sessionState.SessionState.Terminating:
|
|
9103
|
-
logger$
|
|
9121
|
+
logger$7.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
9104
9122
|
|
|
9105
9123
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
9106
9124
|
|
|
9107
9125
|
break;
|
|
9108
9126
|
case sessionState.SessionState.Terminated: {
|
|
9109
|
-
logger$
|
|
9127
|
+
logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9110
9128
|
|
|
9111
9129
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9112
9130
|
const callSession = this._createCallSession(sipSession);
|
|
@@ -9128,7 +9146,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9128
9146
|
const [stream] = event.streams;
|
|
9129
9147
|
const kind = event && event.track && event.track.kind;
|
|
9130
9148
|
|
|
9131
|
-
logger$
|
|
9149
|
+
logger$7.info('on track stream called on the peer connection', {
|
|
9132
9150
|
callId: this.getSipSessionId(sipSession),
|
|
9133
9151
|
streamId: stream ? stream.id : null,
|
|
9134
9152
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -9148,7 +9166,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9148
9166
|
};
|
|
9149
9167
|
|
|
9150
9168
|
peerConnection.onremovestream = event => {
|
|
9151
|
-
logger$
|
|
9169
|
+
logger$7.info('on remove stream called on the peer connection', {
|
|
9152
9170
|
id: event.stream.id,
|
|
9153
9171
|
tracks: event.stream.getTracks(),
|
|
9154
9172
|
});
|
|
@@ -9158,7 +9176,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9158
9176
|
}
|
|
9159
9177
|
|
|
9160
9178
|
async startScreenSharing(constraints , callSession ) {
|
|
9161
|
-
logger$
|
|
9179
|
+
logger$7.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
9162
9180
|
|
|
9163
9181
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
9164
9182
|
if (!screenShareStream) {
|
|
@@ -9198,7 +9216,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9198
9216
|
return;
|
|
9199
9217
|
}
|
|
9200
9218
|
|
|
9201
|
-
logger$
|
|
9219
|
+
logger$7.info('WebRTC phone - stop screen sharing', {
|
|
9202
9220
|
restoreLocalStream,
|
|
9203
9221
|
});
|
|
9204
9222
|
|
|
@@ -9254,7 +9272,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9254
9272
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
9255
9273
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9256
9274
|
|
|
9257
|
-
logger$
|
|
9275
|
+
logger$7.info('WebRTC phone - on screensharing', {
|
|
9258
9276
|
hadVideo,
|
|
9259
9277
|
id: this.getSipSessionId(sipSession),
|
|
9260
9278
|
screenTrack,
|
|
@@ -9262,7 +9280,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9262
9280
|
|
|
9263
9281
|
if (screenTrack) {
|
|
9264
9282
|
screenTrack.onended = () => {
|
|
9265
|
-
logger$
|
|
9283
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9266
9284
|
hadVideo,
|
|
9267
9285
|
id: this.getSipSessionId(sipSession),
|
|
9268
9286
|
screenTrack,
|
|
@@ -9293,7 +9311,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9293
9311
|
}
|
|
9294
9312
|
|
|
9295
9313
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9296
|
-
logger$
|
|
9314
|
+
logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9297
9315
|
|
|
9298
9316
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9299
9317
|
this.currentSipSession = sipSession;
|
|
@@ -9311,7 +9329,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9311
9329
|
}
|
|
9312
9330
|
|
|
9313
9331
|
changeAudioDevice(id ) {
|
|
9314
|
-
logger$
|
|
9332
|
+
logger$7.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9315
9333
|
this.audioOutputDeviceId = id;
|
|
9316
9334
|
this.client.changeAudioOutputDevice(id);
|
|
9317
9335
|
}
|
|
@@ -9321,14 +9339,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9321
9339
|
}
|
|
9322
9340
|
|
|
9323
9341
|
changeRingDevice(id ) {
|
|
9324
|
-
logger$
|
|
9342
|
+
logger$7.info('WebRTC phone - changing ring device', { id });
|
|
9325
9343
|
|
|
9326
9344
|
this.audioRingDeviceId = id;
|
|
9327
9345
|
}
|
|
9328
9346
|
|
|
9329
9347
|
// volume is a value between 0 and 1
|
|
9330
9348
|
changeAudioVolume(volume ) {
|
|
9331
|
-
logger$
|
|
9349
|
+
logger$7.info('WebRTC phone - changing audio volume', { volume });
|
|
9332
9350
|
|
|
9333
9351
|
this.audioOutputVolume = volume;
|
|
9334
9352
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9336,31 +9354,31 @@ class WebRTCPhone extends Emitter {
|
|
|
9336
9354
|
|
|
9337
9355
|
// volume is a value between 0 and 1
|
|
9338
9356
|
changeRingVolume(volume ) {
|
|
9339
|
-
logger$
|
|
9357
|
+
logger$7.info('WebRTC phone - changing ring volume', { volume });
|
|
9340
9358
|
|
|
9341
9359
|
this.audioRingVolume = volume;
|
|
9342
9360
|
}
|
|
9343
9361
|
|
|
9344
9362
|
changeAudioInputDevice(id ) {
|
|
9345
|
-
logger$
|
|
9363
|
+
logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9346
9364
|
|
|
9347
9365
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9348
9366
|
}
|
|
9349
9367
|
|
|
9350
9368
|
changeVideoInputDevice(id ) {
|
|
9351
|
-
logger$
|
|
9369
|
+
logger$7.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9352
9370
|
|
|
9353
9371
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9354
9372
|
}
|
|
9355
9373
|
|
|
9356
9374
|
changeSessionVideoInputDevice(id ) {
|
|
9357
|
-
logger$
|
|
9375
|
+
logger$7.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9358
9376
|
|
|
9359
9377
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9360
9378
|
}
|
|
9361
9379
|
|
|
9362
9380
|
_onCallTerminated(sipSession ) {
|
|
9363
|
-
logger$
|
|
9381
|
+
logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9364
9382
|
|
|
9365
9383
|
const callSession = this._createCallSession(sipSession);
|
|
9366
9384
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
@@ -9394,7 +9412,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9394
9412
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9395
9413
|
|
|
9396
9414
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9397
|
-
logger$
|
|
9415
|
+
logger$7.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9398
9416
|
sipId: sipSession.id,
|
|
9399
9417
|
shouldRetrigger,
|
|
9400
9418
|
hasIncomingCallSession,
|
|
@@ -9485,37 +9503,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9485
9503
|
|
|
9486
9504
|
// Deprecated
|
|
9487
9505
|
getLocalStreamForCall(callSession ) {
|
|
9488
|
-
logger$
|
|
9506
|
+
logger$7.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9489
9507
|
|
|
9490
9508
|
return this.getLocalStream(callSession);
|
|
9491
9509
|
}
|
|
9492
9510
|
|
|
9493
9511
|
// Deprecated
|
|
9494
9512
|
getRemoteStreamForCall(callSession ) {
|
|
9495
|
-
logger$
|
|
9513
|
+
logger$7.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9496
9514
|
|
|
9497
9515
|
return this.getRemoteVideoStream(callSession);
|
|
9498
9516
|
}
|
|
9499
9517
|
|
|
9500
9518
|
getRemoteStreamsForCall(callSession ) {
|
|
9501
|
-
logger$
|
|
9519
|
+
logger$7.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9502
9520
|
|
|
9503
9521
|
return this.getRemoteStream(callSession);
|
|
9504
9522
|
}
|
|
9505
9523
|
|
|
9506
9524
|
accept(callSession , cameraEnabled ) {
|
|
9507
|
-
logger$
|
|
9525
|
+
logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9508
9526
|
if (this.currentSipSession) {
|
|
9509
9527
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9510
9528
|
}
|
|
9511
9529
|
|
|
9512
9530
|
if (!callSession) {
|
|
9513
|
-
logger$
|
|
9531
|
+
logger$7.warn('no CallSession to accept.');
|
|
9514
9532
|
return Promise.resolve(null);
|
|
9515
9533
|
}
|
|
9516
9534
|
|
|
9517
9535
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9518
|
-
logger$
|
|
9536
|
+
logger$7.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9519
9537
|
return Promise.resolve(callSession.sipCallId);
|
|
9520
9538
|
}
|
|
9521
9539
|
|
|
@@ -9527,24 +9545,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9527
9545
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9528
9546
|
if (sipSession) {
|
|
9529
9547
|
if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
|
|
9530
|
-
logger$
|
|
9548
|
+
logger$7.warn('Trying to answer a terminated sipSession.');
|
|
9531
9549
|
|
|
9532
9550
|
return Promise.resolve(null);
|
|
9533
9551
|
}
|
|
9534
9552
|
|
|
9535
|
-
logger$
|
|
9553
|
+
logger$7.info('accept call, session found', { sipId: sipSession.id });
|
|
9536
9554
|
|
|
9537
9555
|
// $FlowFixMe
|
|
9538
9556
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9539
9557
|
return callSession.sipCallId;
|
|
9540
9558
|
}).catch(e => {
|
|
9541
|
-
logger$
|
|
9559
|
+
logger$7.error(e);
|
|
9542
9560
|
this.endCurrentCall(callSession);
|
|
9543
9561
|
throw e;
|
|
9544
9562
|
});
|
|
9545
9563
|
}
|
|
9546
9564
|
|
|
9547
|
-
logger$
|
|
9565
|
+
logger$7.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9548
9566
|
|
|
9549
9567
|
return Promise.resolve(null);
|
|
9550
9568
|
}
|
|
@@ -9554,7 +9572,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9554
9572
|
}
|
|
9555
9573
|
|
|
9556
9574
|
async reject(callSession ) {
|
|
9557
|
-
logger$
|
|
9575
|
+
logger$7.info('reject WebRTC called', { id: callSession.getId() });
|
|
9558
9576
|
|
|
9559
9577
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9560
9578
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9566,14 +9584,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9566
9584
|
|
|
9567
9585
|
const sipSession = this.findSipSession(callSession);
|
|
9568
9586
|
if (sipSession) {
|
|
9569
|
-
logger$
|
|
9587
|
+
logger$7.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9570
9588
|
|
|
9571
9589
|
this.client.hangup(sipSession);
|
|
9572
9590
|
}
|
|
9573
9591
|
}
|
|
9574
9592
|
|
|
9575
9593
|
async ignore(callSession ) {
|
|
9576
|
-
logger$
|
|
9594
|
+
logger$7.info('WebRTC ignore', { id: callSession.getId() });
|
|
9577
9595
|
|
|
9578
9596
|
// kill the ring
|
|
9579
9597
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9585,14 +9603,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9585
9603
|
const sipSession = this.findSipSession(callSession);
|
|
9586
9604
|
|
|
9587
9605
|
if (sipSession) {
|
|
9588
|
-
logger$
|
|
9606
|
+
logger$7.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9589
9607
|
|
|
9590
9608
|
return this.client.atxfer(sipSession);
|
|
9591
9609
|
}
|
|
9592
9610
|
}
|
|
9593
9611
|
|
|
9594
9612
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9595
|
-
logger$
|
|
9613
|
+
logger$7.info('WebRTC hold', { id: callSession.getId() });
|
|
9596
9614
|
|
|
9597
9615
|
const sipSession = this.findSipSession(callSession);
|
|
9598
9616
|
|
|
@@ -9607,18 +9625,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9607
9625
|
}
|
|
9608
9626
|
|
|
9609
9627
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9610
|
-
logger$
|
|
9628
|
+
logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9611
9629
|
|
|
9612
9630
|
const sipSession = this.findSipSession(callSession);
|
|
9613
9631
|
if (!sipSession) {
|
|
9614
9632
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9615
9633
|
}
|
|
9616
9634
|
|
|
9617
|
-
logger$
|
|
9635
|
+
logger$7.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9618
9636
|
|
|
9619
9637
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9620
9638
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9621
|
-
logger$
|
|
9639
|
+
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9622
9640
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9623
9641
|
}
|
|
9624
9642
|
|
|
@@ -9643,7 +9661,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9643
9661
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9644
9662
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9645
9663
|
|
|
9646
|
-
logger$
|
|
9664
|
+
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9647
9665
|
|
|
9648
9666
|
// Stop screenshre if needed
|
|
9649
9667
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9674,7 +9692,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9674
9692
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9675
9693
|
}
|
|
9676
9694
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9677
|
-
logger$
|
|
9695
|
+
logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9678
9696
|
|
|
9679
9697
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9680
9698
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9718,14 +9736,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9718
9736
|
}
|
|
9719
9737
|
|
|
9720
9738
|
mute(callSession , withEvent = true) {
|
|
9721
|
-
logger$
|
|
9739
|
+
logger$7.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9722
9740
|
|
|
9723
9741
|
const sipSession = this.findSipSession(callSession);
|
|
9724
9742
|
if (!sipSession) {
|
|
9725
9743
|
return;
|
|
9726
9744
|
}
|
|
9727
9745
|
|
|
9728
|
-
logger$
|
|
9746
|
+
logger$7.info('WebRTC muting', { sipId: sipSession.id });
|
|
9729
9747
|
this.client.mute(sipSession);
|
|
9730
9748
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9731
9749
|
|
|
@@ -9739,14 +9757,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9739
9757
|
}
|
|
9740
9758
|
|
|
9741
9759
|
unmute(callSession , withEvent = true) {
|
|
9742
|
-
logger$
|
|
9760
|
+
logger$7.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9743
9761
|
|
|
9744
9762
|
const sipSession = this.findSipSession(callSession);
|
|
9745
9763
|
if (!sipSession) {
|
|
9746
9764
|
return;
|
|
9747
9765
|
}
|
|
9748
9766
|
|
|
9749
|
-
logger$
|
|
9767
|
+
logger$7.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9750
9768
|
this.client.unmute(sipSession);
|
|
9751
9769
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9752
9770
|
|
|
@@ -9773,7 +9791,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9773
9791
|
if (!sipSession) {
|
|
9774
9792
|
return;
|
|
9775
9793
|
}
|
|
9776
|
-
logger$
|
|
9794
|
+
logger$7.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9777
9795
|
|
|
9778
9796
|
this.client.toggleCameraOn(sipSession);
|
|
9779
9797
|
|
|
@@ -9785,7 +9803,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9785
9803
|
if (!sipSession) {
|
|
9786
9804
|
return;
|
|
9787
9805
|
}
|
|
9788
|
-
logger$
|
|
9806
|
+
logger$7.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9789
9807
|
|
|
9790
9808
|
this.client.toggleCameraOff(sipSession);
|
|
9791
9809
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9797,7 +9815,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9797
9815
|
return;
|
|
9798
9816
|
}
|
|
9799
9817
|
|
|
9800
|
-
logger$
|
|
9818
|
+
logger$7.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9801
9819
|
this.client.sendDTMF(sipSession, tone);
|
|
9802
9820
|
}
|
|
9803
9821
|
|
|
@@ -9805,7 +9823,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9805
9823
|
// @TODO: line is not used here
|
|
9806
9824
|
async makeCall(number , line , cameraEnabled ,
|
|
9807
9825
|
audioOnly = false, conference = false) {
|
|
9808
|
-
logger$
|
|
9826
|
+
logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
9809
9827
|
if (!number) {
|
|
9810
9828
|
return Promise.resolve(null);
|
|
9811
9829
|
}
|
|
@@ -9815,7 +9833,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9815
9833
|
}
|
|
9816
9834
|
if (this.currentSipSession) {
|
|
9817
9835
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9818
|
-
logger$
|
|
9836
|
+
logger$7.warn('Unable to hold current session when making another call', e);
|
|
9819
9837
|
});
|
|
9820
9838
|
}
|
|
9821
9839
|
|
|
@@ -9825,7 +9843,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9825
9843
|
this._bindEvents(sipSession);
|
|
9826
9844
|
} catch (error) {
|
|
9827
9845
|
console.warn(error);
|
|
9828
|
-
logger$
|
|
9846
|
+
logger$7.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9829
9847
|
return Promise.resolve(null);
|
|
9830
9848
|
}
|
|
9831
9849
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
@@ -9853,7 +9871,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9853
9871
|
return;
|
|
9854
9872
|
}
|
|
9855
9873
|
|
|
9856
|
-
logger$
|
|
9874
|
+
logger$7.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9857
9875
|
|
|
9858
9876
|
this.client.transfer(sipSession, target);
|
|
9859
9877
|
}
|
|
@@ -9862,7 +9880,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9862
9880
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9863
9881
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9864
9882
|
|
|
9865
|
-
logger$
|
|
9883
|
+
logger$7.info('WebRTC indirect transfer', {
|
|
9866
9884
|
sipId: sipSession ? sipSession.id : null,
|
|
9867
9885
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9868
9886
|
});
|
|
@@ -9901,7 +9919,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9901
9919
|
return false;
|
|
9902
9920
|
}
|
|
9903
9921
|
|
|
9904
|
-
logger$
|
|
9922
|
+
logger$7.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9905
9923
|
|
|
9906
9924
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9907
9925
|
|
|
@@ -9947,7 +9965,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9947
9965
|
endCurrentCall(callSession ) {
|
|
9948
9966
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9949
9967
|
|
|
9950
|
-
logger$
|
|
9968
|
+
logger$7.info('Ending current call', {
|
|
9951
9969
|
id: callSession ? callSession.getId() : null,
|
|
9952
9970
|
isCurrent,
|
|
9953
9971
|
});
|
|
@@ -9971,7 +9989,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9971
9989
|
}
|
|
9972
9990
|
|
|
9973
9991
|
async close() {
|
|
9974
|
-
logger$
|
|
9992
|
+
logger$7.info('WebRTC close');
|
|
9975
9993
|
|
|
9976
9994
|
try {
|
|
9977
9995
|
await Promise.race([
|
|
@@ -9979,7 +9997,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9979
9997
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9980
9998
|
]);
|
|
9981
9999
|
} catch (e) {
|
|
9982
|
-
logger$
|
|
10000
|
+
logger$7.error('WebRTC close, unregister error', e);
|
|
9983
10001
|
}
|
|
9984
10002
|
|
|
9985
10003
|
this.client.close();
|
|
@@ -9997,12 +10015,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9997
10015
|
}
|
|
9998
10016
|
|
|
9999
10017
|
enableRinging() {
|
|
10000
|
-
logger$
|
|
10018
|
+
logger$7.info('WebRTC enable ringing');
|
|
10001
10019
|
this.ringingEnabled = true;
|
|
10002
10020
|
}
|
|
10003
10021
|
|
|
10004
10022
|
disableRinging() {
|
|
10005
|
-
logger$
|
|
10023
|
+
logger$7.info('WebRTC disable ringing');
|
|
10006
10024
|
this.ringingEnabled = false;
|
|
10007
10025
|
}
|
|
10008
10026
|
|
|
@@ -10042,7 +10060,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10042
10060
|
|
|
10043
10061
|
// Deprecated
|
|
10044
10062
|
getLocalMediaStream(callSession ) {
|
|
10045
|
-
logger$
|
|
10063
|
+
logger$7.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
10046
10064
|
return this.getLocalStream(callSession);
|
|
10047
10065
|
}
|
|
10048
10066
|
|
|
@@ -10084,7 +10102,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10084
10102
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
10085
10103
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
10086
10104
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
10087
|
-
logger$
|
|
10105
|
+
logger$7.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
10088
10106
|
|
|
10089
10107
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
10090
10108
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -10107,7 +10125,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10107
10125
|
});
|
|
10108
10126
|
|
|
10109
10127
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
10110
|
-
logger$
|
|
10128
|
+
logger$7.info('WebRTC on reinvite', {
|
|
10111
10129
|
sessionId: args[0].id,
|
|
10112
10130
|
inviteId: args[1].id,
|
|
10113
10131
|
updatedCalleeName: args[2],
|
|
@@ -10127,7 +10145,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10127
10145
|
});
|
|
10128
10146
|
|
|
10129
10147
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
10130
|
-
logger$
|
|
10148
|
+
logger$7.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
10131
10149
|
|
|
10132
10150
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
10133
10151
|
|
|
@@ -10138,22 +10156,22 @@ class WebRTCPhone extends Emitter {
|
|
|
10138
10156
|
this.client.on('ended', () => {});
|
|
10139
10157
|
|
|
10140
10158
|
this.client.on(this.client.ON_ERROR, e => {
|
|
10141
|
-
logger$
|
|
10159
|
+
logger$7.error('WebRTC error', e);
|
|
10142
10160
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10143
10161
|
});
|
|
10144
10162
|
|
|
10145
10163
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10146
|
-
logger$
|
|
10164
|
+
logger$7.info('WebRTC unregistered');
|
|
10147
10165
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10148
10166
|
});
|
|
10149
10167
|
|
|
10150
10168
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
10151
|
-
logger$
|
|
10152
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
10169
|
+
logger$7.info('WebRTC disconnected');
|
|
10170
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10153
10171
|
});
|
|
10154
10172
|
|
|
10155
10173
|
this.client.on(this.client.REGISTERED, () => {
|
|
10156
|
-
logger$
|
|
10174
|
+
logger$7.info('WebRTC registered', {
|
|
10157
10175
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
10158
10176
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
10159
10177
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -10174,19 +10192,19 @@ class WebRTCPhone extends Emitter {
|
|
|
10174
10192
|
// Send reinvite with iceRestart
|
|
10175
10193
|
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10176
10194
|
} catch (e) {
|
|
10177
|
-
logger$
|
|
10195
|
+
logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10178
10196
|
}
|
|
10179
10197
|
}
|
|
10180
10198
|
});
|
|
10181
10199
|
|
|
10182
10200
|
this.client.on(this.client.CONNECTED, () => {
|
|
10183
|
-
logger$
|
|
10201
|
+
logger$7.info('WebRTC client connected');
|
|
10184
10202
|
|
|
10185
10203
|
this.stopHeartbeat();
|
|
10186
10204
|
});
|
|
10187
10205
|
|
|
10188
10206
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
10189
|
-
logger$
|
|
10207
|
+
logger$7.info('WebRTC client disconnected');
|
|
10190
10208
|
|
|
10191
10209
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10192
10210
|
|
|
@@ -10200,7 +10218,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10200
10218
|
});
|
|
10201
10219
|
|
|
10202
10220
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
10203
|
-
this.eventEmitter.emit(ON_TRACK
|
|
10221
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
10204
10222
|
});
|
|
10205
10223
|
|
|
10206
10224
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -10215,7 +10233,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10215
10233
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
10216
10234
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
10217
10235
|
|
|
10218
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
10236
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
10219
10237
|
});
|
|
10220
10238
|
|
|
10221
10239
|
// Used when upgrading directly in screenshare mode
|
|
@@ -10224,7 +10242,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10224
10242
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
10225
10243
|
const callSession = this.callSessions[sipSessionId];
|
|
10226
10244
|
|
|
10227
|
-
logger$
|
|
10245
|
+
logger$7.info('Updrading directly in screensharing mode', {
|
|
10228
10246
|
sipSessionId,
|
|
10229
10247
|
tracks: localStream ? localStream.getTracks() : null,
|
|
10230
10248
|
});
|
|
@@ -10402,8 +10420,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10402
10420
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10403
10421
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10404
10422
|
ON_MESSAGE: ON_MESSAGE,
|
|
10405
|
-
ON_REINVITE: ON_REINVITE
|
|
10406
|
-
ON_TRACK: ON_TRACK
|
|
10423
|
+
ON_REINVITE: ON_REINVITE,
|
|
10424
|
+
ON_TRACK: ON_TRACK,
|
|
10407
10425
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10408
10426
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10409
10427
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10418,13 +10436,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10418
10436
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10419
10437
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10420
10438
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10421
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS
|
|
10439
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10422
10440
|
ON_CHAT: ON_CHAT,
|
|
10423
10441
|
ON_SIGNAL: ON_SIGNAL,
|
|
10424
|
-
ON_DISCONNECTED: ON_DISCONNECTED
|
|
10442
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10425
10443
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10426
10444
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10427
|
-
events: events
|
|
10445
|
+
events: events,
|
|
10428
10446
|
'default': WebRTCPhone
|
|
10429
10447
|
});
|
|
10430
10448
|
|
|
@@ -10818,7 +10836,7 @@ class Phone extends Emitter {
|
|
|
10818
10836
|
|
|
10819
10837
|
_transferEvents() {
|
|
10820
10838
|
this.unbind();
|
|
10821
|
-
[...events, ...transportEvents].forEach(event => {
|
|
10839
|
+
[...events$1, ...transportEvents].forEach(event => {
|
|
10822
10840
|
this.client.on(event, (...args) =>
|
|
10823
10841
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
10824
10842
|
});
|
|
@@ -10840,7 +10858,7 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
10840
10858
|
|
|
10841
10859
|
//
|
|
10842
10860
|
|
|
10843
|
-
const SOCKET_EVENTS = {
|
|
10861
|
+
const SOCKET_EVENTS$1 = {
|
|
10844
10862
|
ON_OPEN: 'onopen',
|
|
10845
10863
|
ON_MESSAGE: 'onmessage',
|
|
10846
10864
|
ON_ERROR: 'onerror',
|
|
@@ -10936,7 +10954,7 @@ const BLACKLIST_EVENTS = [
|
|
|
10936
10954
|
];
|
|
10937
10955
|
|
|
10938
10956
|
const HEARTBEAT_ENGINE_VERSION = '20.09';
|
|
10939
|
-
const logger$
|
|
10957
|
+
const logger$5 = IssueReporter$1.loggerFor('wazo-ws');
|
|
10940
10958
|
const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
|
|
10941
10959
|
|
|
10942
10960
|
class WebSocketClient extends Emitter {
|
|
@@ -10985,24 +11003,24 @@ class WebSocketClient extends Emitter {
|
|
|
10985
11003
|
}
|
|
10986
11004
|
|
|
10987
11005
|
connect() {
|
|
10988
|
-
logger$
|
|
11006
|
+
logger$5.info('connect method started', { host: this.host, token: this.token });
|
|
10989
11007
|
this.socket = new ReconnectingWebSocket__default['default'](this._getUrl.bind(this), [], this.options);
|
|
10990
11008
|
if (this.options.binaryType) {
|
|
10991
11009
|
this.socket.binaryType = this.options.binaryType;
|
|
10992
11010
|
}
|
|
10993
11011
|
|
|
10994
11012
|
this.socket.onopen = () => {
|
|
10995
|
-
logger$
|
|
10996
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
11013
|
+
logger$5.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
11014
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
|
|
10997
11015
|
};
|
|
10998
11016
|
|
|
10999
11017
|
this.socket.onerror = event => {
|
|
11000
|
-
logger$
|
|
11001
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
11018
|
+
logger$5.error('on Wazo WS error', event.target);
|
|
11019
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
|
|
11002
11020
|
};
|
|
11003
11021
|
|
|
11004
11022
|
this.socket.onmessage = (event ) => {
|
|
11005
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
11023
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
|
|
11006
11024
|
|
|
11007
11025
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
11008
11026
|
let { name } = message;
|
|
@@ -11027,7 +11045,7 @@ class WebSocketClient extends Emitter {
|
|
|
11027
11045
|
|
|
11028
11046
|
this.socket.onclose = event => {
|
|
11029
11047
|
// Can't be converted to JSON (circular structure)
|
|
11030
|
-
logger$
|
|
11048
|
+
logger$5.info('on Wazo WS close', {
|
|
11031
11049
|
reason: event.reason,
|
|
11032
11050
|
code: event.code,
|
|
11033
11051
|
readyState: event.target.readyState,
|
|
@@ -11035,22 +11053,22 @@ class WebSocketClient extends Emitter {
|
|
|
11035
11053
|
token: this.token,
|
|
11036
11054
|
});
|
|
11037
11055
|
this.initialized = false;
|
|
11038
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
11056
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
|
|
11039
11057
|
|
|
11040
11058
|
switch (event.code) {
|
|
11041
11059
|
case 4002:
|
|
11042
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
11060
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
|
|
11043
11061
|
break;
|
|
11044
11062
|
}
|
|
11045
11063
|
};
|
|
11046
11064
|
|
|
11047
11065
|
this.socket.onerror = event => {
|
|
11048
|
-
logger$
|
|
11066
|
+
logger$5.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
|
|
11049
11067
|
};
|
|
11050
11068
|
}
|
|
11051
11069
|
|
|
11052
11070
|
close(force = false) {
|
|
11053
|
-
logger$
|
|
11071
|
+
logger$5.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
|
|
11054
11072
|
|
|
11055
11073
|
if (!this.socket) {
|
|
11056
11074
|
return;
|
|
@@ -11068,7 +11086,7 @@ class WebSocketClient extends Emitter {
|
|
|
11068
11086
|
|
|
11069
11087
|
updateToken(token ) {
|
|
11070
11088
|
this.token = token;
|
|
11071
|
-
logger$
|
|
11089
|
+
logger$5.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
|
|
11072
11090
|
|
|
11073
11091
|
if (this.socket) {
|
|
11074
11092
|
// If still connected, send the token to the WS
|
|
@@ -11086,7 +11104,7 @@ class WebSocketClient extends Emitter {
|
|
|
11086
11104
|
}
|
|
11087
11105
|
|
|
11088
11106
|
startHeartbeat() {
|
|
11089
|
-
logger$
|
|
11107
|
+
logger$5.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
|
|
11090
11108
|
|
|
11091
11109
|
if (!this.socket) {
|
|
11092
11110
|
this.heartbeat.stop();
|
|
@@ -11100,7 +11118,7 @@ class WebSocketClient extends Emitter {
|
|
|
11100
11118
|
}
|
|
11101
11119
|
|
|
11102
11120
|
stopHeartbeat() {
|
|
11103
|
-
logger$
|
|
11121
|
+
logger$5.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
|
|
11104
11122
|
|
|
11105
11123
|
this.heartbeat.stop();
|
|
11106
11124
|
}
|
|
@@ -11130,7 +11148,7 @@ class WebSocketClient extends Emitter {
|
|
|
11130
11148
|
}
|
|
11131
11149
|
|
|
11132
11150
|
reconnect(reason ) {
|
|
11133
|
-
logger$
|
|
11151
|
+
logger$5.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
|
|
11134
11152
|
if (!this.socket) {
|
|
11135
11153
|
return;
|
|
11136
11154
|
}
|
|
@@ -11155,7 +11173,7 @@ class WebSocketClient extends Emitter {
|
|
|
11155
11173
|
break;
|
|
11156
11174
|
case 'start':
|
|
11157
11175
|
this.initialized = true;
|
|
11158
|
-
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
11176
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
|
|
11159
11177
|
break;
|
|
11160
11178
|
default:
|
|
11161
11179
|
this.eventEmitter.emit('message', message);
|
|
@@ -11186,7 +11204,7 @@ class WebSocketClient extends Emitter {
|
|
|
11186
11204
|
this.close();
|
|
11187
11205
|
}
|
|
11188
11206
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
11189
|
-
logger$
|
|
11207
|
+
logger$5.log('Wazo WS url computed to reconnect', { url });
|
|
11190
11208
|
|
|
11191
11209
|
return url;
|
|
11192
11210
|
}
|
|
@@ -11194,15 +11212,15 @@ class WebSocketClient extends Emitter {
|
|
|
11194
11212
|
_onHeartbeat(message ) {
|
|
11195
11213
|
if (message.payload === 'pong') {
|
|
11196
11214
|
this.heartbeat.onHeartbeat();
|
|
11197
|
-
logger$
|
|
11215
|
+
logger$5.log('on heartbeat received from Wazo WS');
|
|
11198
11216
|
}
|
|
11199
11217
|
}
|
|
11200
11218
|
|
|
11201
11219
|
async _onHeartbeatTimeout() {
|
|
11202
|
-
logger$
|
|
11220
|
+
logger$5.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
11203
11221
|
|
|
11204
11222
|
this.close();
|
|
11205
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11223
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11206
11224
|
|
|
11207
11225
|
if (this.onHeartBeatTimeout) {
|
|
11208
11226
|
this.onHeartBeatTimeout();
|
|
@@ -11282,7 +11300,7 @@ WebSocketClient.eventLists = [
|
|
|
11282
11300
|
|
|
11283
11301
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
11284
11302
|
__proto__: null,
|
|
11285
|
-
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
11303
|
+
SOCKET_EVENTS: SOCKET_EVENTS$1,
|
|
11286
11304
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
11287
11305
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
11288
11306
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -11355,10 +11373,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11355
11373
|
|
|
11356
11374
|
//
|
|
11357
11375
|
|
|
11358
|
-
const { SOCKET_EVENTS
|
|
11359
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS
|
|
11376
|
+
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11377
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
11360
11378
|
|
|
11361
|
-
const logger$
|
|
11379
|
+
const logger$4 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
11362
11380
|
|
|
11363
11381
|
class Websocket extends Emitter {
|
|
11364
11382
|
|
|
@@ -11372,9 +11390,9 @@ class Websocket extends Emitter {
|
|
|
11372
11390
|
// $FlowFixMe
|
|
11373
11391
|
this[key] = OTHER_EVENTS[key];
|
|
11374
11392
|
});
|
|
11375
|
-
Object.keys(SOCKET_EVENTS
|
|
11393
|
+
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
11376
11394
|
// $FlowFixMe
|
|
11377
|
-
this[key] = SOCKET_EVENTS
|
|
11395
|
+
this[key] = SOCKET_EVENTS[key];
|
|
11378
11396
|
});
|
|
11379
11397
|
this.eventLists = WebSocketClient.eventLists;
|
|
11380
11398
|
|
|
@@ -11382,7 +11400,7 @@ class Websocket extends Emitter {
|
|
|
11382
11400
|
}
|
|
11383
11401
|
|
|
11384
11402
|
open(host , session ) {
|
|
11385
|
-
logger$
|
|
11403
|
+
logger$4.info('open simple WebSocket', { host, token: session.token });
|
|
11386
11404
|
this.ws = new WebSocketClient(
|
|
11387
11405
|
{
|
|
11388
11406
|
host,
|
|
@@ -11410,7 +11428,7 @@ class Websocket extends Emitter {
|
|
|
11410
11428
|
}
|
|
11411
11429
|
|
|
11412
11430
|
updateToken(token ) {
|
|
11413
|
-
logger$
|
|
11431
|
+
logger$4.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
11414
11432
|
|
|
11415
11433
|
if (!this.ws) {
|
|
11416
11434
|
return;
|
|
@@ -11438,12 +11456,12 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11438
11456
|
|
|
11439
11457
|
//
|
|
11440
11458
|
|
|
11441
|
-
const logger$
|
|
11459
|
+
const logger$3 = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
11442
11460
|
|
|
11443
|
-
class SipRoom extends Room
|
|
11461
|
+
class SipRoom extends Room {
|
|
11444
11462
|
|
|
11445
11463
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
11446
|
-
logger$
|
|
11464
|
+
logger$3.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
11447
11465
|
|
|
11448
11466
|
if (!room) {
|
|
11449
11467
|
await Wazo.Phone.connect();
|
|
@@ -11459,7 +11477,7 @@ class SipRoom extends Room$1 {
|
|
|
11459
11477
|
room.setCallId(room.callSession.call.id);
|
|
11460
11478
|
}
|
|
11461
11479
|
|
|
11462
|
-
logger$
|
|
11480
|
+
logger$3.info('connected to room', {
|
|
11463
11481
|
extension: room.extension,
|
|
11464
11482
|
});
|
|
11465
11483
|
|
|
@@ -11467,7 +11485,7 @@ class SipRoom extends Room$1 {
|
|
|
11467
11485
|
}
|
|
11468
11486
|
|
|
11469
11487
|
mute() {
|
|
11470
|
-
logger$
|
|
11488
|
+
logger$3.info('mute sip room');
|
|
11471
11489
|
|
|
11472
11490
|
Wazo.Phone.mute(this.callSession, false);
|
|
11473
11491
|
|
|
@@ -11475,7 +11493,7 @@ class SipRoom extends Room$1 {
|
|
|
11475
11493
|
}
|
|
11476
11494
|
|
|
11477
11495
|
unmute() {
|
|
11478
|
-
logger$
|
|
11496
|
+
logger$3.info('unmute sip room');
|
|
11479
11497
|
|
|
11480
11498
|
Wazo.Phone.unmute(this.callSession, false);
|
|
11481
11499
|
|
|
@@ -11775,7 +11793,7 @@ class NotificationOptions {
|
|
|
11775
11793
|
|
|
11776
11794
|
|
|
11777
11795
|
// Represents a conference room, like `9000`.
|
|
11778
|
-
class Room {
|
|
11796
|
+
class Room$1 {
|
|
11779
11797
|
|
|
11780
11798
|
|
|
11781
11799
|
|
|
@@ -11796,7 +11814,7 @@ class Room {
|
|
|
11796
11814
|
}
|
|
11797
11815
|
|
|
11798
11816
|
connect(callSession ) {
|
|
11799
|
-
return new Room({ ...this, connectedCallSession: callSession });
|
|
11817
|
+
return new Room$1({ ...this, connectedCallSession: callSession });
|
|
11800
11818
|
}
|
|
11801
11819
|
|
|
11802
11820
|
has(callSession ) {
|
|
@@ -11805,7 +11823,7 @@ class Room {
|
|
|
11805
11823
|
|
|
11806
11824
|
addParticipant(uuid , extension , talking = null) {
|
|
11807
11825
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
11808
|
-
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
11826
|
+
return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
11809
11827
|
}
|
|
11810
11828
|
|
|
11811
11829
|
return this;
|
|
@@ -11824,7 +11842,7 @@ class Room {
|
|
|
11824
11842
|
updatedParticipants.push(participant);
|
|
11825
11843
|
}
|
|
11826
11844
|
|
|
11827
|
-
return new Room({ ...this, participants: updatedParticipants });
|
|
11845
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
11828
11846
|
}
|
|
11829
11847
|
|
|
11830
11848
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -11840,7 +11858,7 @@ class Room {
|
|
|
11840
11858
|
updatedParticipants.push(participant);
|
|
11841
11859
|
}
|
|
11842
11860
|
|
|
11843
|
-
return new Room({ ...this, participants: updatedParticipants });
|
|
11861
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
11844
11862
|
}
|
|
11845
11863
|
|
|
11846
11864
|
hasCallWithId(id ) {
|
|
@@ -11848,18 +11866,18 @@ class Room {
|
|
|
11848
11866
|
}
|
|
11849
11867
|
|
|
11850
11868
|
disconnect() {
|
|
11851
|
-
return new Room({ ...this, connectedCallSession: null });
|
|
11869
|
+
return new Room$1({ ...this, connectedCallSession: null });
|
|
11852
11870
|
}
|
|
11853
11871
|
|
|
11854
11872
|
removeParticipantWithUUID(uuid ) {
|
|
11855
|
-
return new Room({
|
|
11873
|
+
return new Room$1({
|
|
11856
11874
|
...this,
|
|
11857
11875
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
11858
11876
|
});
|
|
11859
11877
|
}
|
|
11860
11878
|
|
|
11861
11879
|
removeParticipantWithExtension(extension ) {
|
|
11862
|
-
return new Room({
|
|
11880
|
+
return new Room$1({
|
|
11863
11881
|
...this,
|
|
11864
11882
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
11865
11883
|
});
|
|
@@ -11870,7 +11888,7 @@ class Room {
|
|
|
11870
11888
|
}
|
|
11871
11889
|
|
|
11872
11890
|
static newFrom(room ) {
|
|
11873
|
-
return newFrom(room, Room);
|
|
11891
|
+
return newFrom(room, Room$1);
|
|
11874
11892
|
}
|
|
11875
11893
|
}
|
|
11876
11894
|
|
|
@@ -12177,11 +12195,11 @@ var wazoWebsocket = {
|
|
|
12177
12195
|
resolve();
|
|
12178
12196
|
};
|
|
12179
12197
|
|
|
12180
|
-
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
12198
|
+
client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
|
|
12181
12199
|
handleError(`Connection error : ${error}`);
|
|
12182
12200
|
});
|
|
12183
12201
|
|
|
12184
|
-
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
12202
|
+
client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
|
|
12185
12203
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
12186
12204
|
client.setOnHeartbeatTimeout(() => {
|
|
12187
12205
|
handleError('No response to heartbeat');
|
|
@@ -12282,7 +12300,7 @@ var webrtc = {
|
|
|
12282
12300
|
}),
|
|
12283
12301
|
};
|
|
12284
12302
|
|
|
12285
|
-
const parseCandidate
|
|
12303
|
+
const parseCandidate = line => {
|
|
12286
12304
|
let parts;
|
|
12287
12305
|
// Parse both variants.
|
|
12288
12306
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -12373,7 +12391,7 @@ var SymmetricNat = {
|
|
|
12373
12391
|
}
|
|
12374
12392
|
|
|
12375
12393
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
12376
|
-
const cand = parseCandidate
|
|
12394
|
+
const cand = parseCandidate(e.candidate.candidate);
|
|
12377
12395
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
12378
12396
|
candidates[cand.relatedPort].push(cand.port);
|
|
12379
12397
|
} else if (!e.candidate) {
|
|
@@ -12441,7 +12459,7 @@ var iceIpv4 = {
|
|
|
12441
12459
|
const rawCandidate = e.candidate.candidate;
|
|
12442
12460
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
12443
12461
|
hasSrflxOrRelay = true;
|
|
12444
|
-
const candidate = parseCandidate
|
|
12462
|
+
const candidate = parseCandidate(e.candidate.candidate);
|
|
12445
12463
|
ips.push(candidate.ip);
|
|
12446
12464
|
}
|
|
12447
12465
|
} else if (!e.candidate) {
|
|
@@ -12478,7 +12496,7 @@ var checks = [
|
|
|
12478
12496
|
|
|
12479
12497
|
//
|
|
12480
12498
|
|
|
12481
|
-
const logger$
|
|
12499
|
+
const logger$2 = IssueReporter$1.loggerFor('engine-check');
|
|
12482
12500
|
|
|
12483
12501
|
class Checker {
|
|
12484
12502
|
|
|
@@ -12496,28 +12514,28 @@ class Checker {
|
|
|
12496
12514
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
12497
12515
|
await this._addEngineVersion();
|
|
12498
12516
|
|
|
12499
|
-
logger$
|
|
12517
|
+
logger$2.info('Engine check starting');
|
|
12500
12518
|
|
|
12501
12519
|
for (let i = 0; i < this.checks.length; i++) {
|
|
12502
12520
|
const { name, check } = this.checks[i];
|
|
12503
12521
|
|
|
12504
|
-
logger$
|
|
12522
|
+
logger$2.info(`Checking ${name} ...`);
|
|
12505
12523
|
|
|
12506
12524
|
onCheckBegin(name);
|
|
12507
12525
|
try {
|
|
12508
12526
|
// eslint-disable-next-line no-await-in-loop
|
|
12509
12527
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
12510
|
-
logger$
|
|
12528
|
+
logger$2.info(`Checking ${name} success.`, { result });
|
|
12511
12529
|
|
|
12512
12530
|
onCheckResult(name, result);
|
|
12513
12531
|
} catch (e) {
|
|
12514
|
-
logger$
|
|
12532
|
+
logger$2.info(`Checking ${name} failure`, { message: e.message });
|
|
12515
12533
|
|
|
12516
12534
|
onCheckResult(name, e);
|
|
12517
12535
|
}
|
|
12518
12536
|
}
|
|
12519
12537
|
|
|
12520
|
-
logger$
|
|
12538
|
+
logger$2.info('Engine check done.');
|
|
12521
12539
|
}
|
|
12522
12540
|
|
|
12523
12541
|
addCheck(check ) {
|
|
@@ -12541,7 +12559,7 @@ const Wazo = {
|
|
|
12541
12559
|
Auth: Auth$1,
|
|
12542
12560
|
Phone: Phone$1,
|
|
12543
12561
|
Websocket: Websocket$1,
|
|
12544
|
-
Room
|
|
12562
|
+
Room,
|
|
12545
12563
|
SipRoom,
|
|
12546
12564
|
RemoteParticipant,
|
|
12547
12565
|
LocalParticipant,
|
|
@@ -12574,7 +12592,7 @@ const Wazo = {
|
|
|
12574
12592
|
Session,
|
|
12575
12593
|
Voicemail,
|
|
12576
12594
|
Relocation,
|
|
12577
|
-
ConferenceRoom: Room,
|
|
12595
|
+
ConferenceRoom: Room$1,
|
|
12578
12596
|
CallSession,
|
|
12579
12597
|
IndirectTransfer,
|
|
12580
12598
|
SwitchboardCall,
|
|
@@ -12613,9 +12631,9 @@ if (global) {
|
|
|
12613
12631
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
12614
12632
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
12615
12633
|
|
|
12616
|
-
const logger$
|
|
12634
|
+
const logger$1 = IssueReporter$1.loggerFor('sdk-room');
|
|
12617
12635
|
|
|
12618
|
-
class Room
|
|
12636
|
+
class Room extends Emitter {
|
|
12619
12637
|
|
|
12620
12638
|
|
|
12621
12639
|
|
|
@@ -12673,7 +12691,7 @@ class Room$1 extends Emitter {
|
|
|
12673
12691
|
extra = {},
|
|
12674
12692
|
) {
|
|
12675
12693
|
super();
|
|
12676
|
-
logger$
|
|
12694
|
+
logger$1.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
12677
12695
|
|
|
12678
12696
|
// Represents the room callSession
|
|
12679
12697
|
this.callSession = callSession;
|
|
@@ -12739,7 +12757,7 @@ class Room$1 extends Emitter {
|
|
|
12739
12757
|
* @returns {Promise<Room>}
|
|
12740
12758
|
*/
|
|
12741
12759
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
12742
|
-
logger$
|
|
12760
|
+
logger$1.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
12743
12761
|
|
|
12744
12762
|
if (!room) {
|
|
12745
12763
|
await Wazo.Phone.connect();
|
|
@@ -12752,7 +12770,7 @@ class Room$1 extends Emitter {
|
|
|
12752
12770
|
|
|
12753
12771
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
12754
12772
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
12755
|
-
logger$
|
|
12773
|
+
logger$1.info('room call received via WS', { callId: data.call_id });
|
|
12756
12774
|
if (room) {
|
|
12757
12775
|
room.setCallId(data.call_id);
|
|
12758
12776
|
}
|
|
@@ -12760,7 +12778,7 @@ class Room$1 extends Emitter {
|
|
|
12760
12778
|
|
|
12761
12779
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
12762
12780
|
// eslint-disable-next-line no-param-reassign
|
|
12763
|
-
room = new Room
|
|
12781
|
+
room = new Room(callSession, extension, null, null, extra);
|
|
12764
12782
|
|
|
12765
12783
|
// Wait for the call to be accepted
|
|
12766
12784
|
await new Promise((resolve, reject) => {
|
|
@@ -12781,7 +12799,7 @@ class Room$1 extends Emitter {
|
|
|
12781
12799
|
// Retrieve conference
|
|
12782
12800
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
12783
12801
|
|
|
12784
|
-
logger$
|
|
12802
|
+
logger$1.info('connected to room', {
|
|
12785
12803
|
sourceId: conference ? conference.sourceId : null,
|
|
12786
12804
|
name: conference ? conference.name : null,
|
|
12787
12805
|
});
|
|
@@ -12791,7 +12809,7 @@ class Room$1 extends Emitter {
|
|
|
12791
12809
|
room.setName(conference.name);
|
|
12792
12810
|
}
|
|
12793
12811
|
} else if (meeting) {
|
|
12794
|
-
logger$
|
|
12812
|
+
logger$1.info('Already connected to meeting', {
|
|
12795
12813
|
uuid: meeting.uuid,
|
|
12796
12814
|
name: meeting.name,
|
|
12797
12815
|
});
|
|
@@ -12804,13 +12822,13 @@ class Room$1 extends Emitter {
|
|
|
12804
12822
|
}
|
|
12805
12823
|
|
|
12806
12824
|
static disconnect() {
|
|
12807
|
-
logger$
|
|
12825
|
+
logger$1.info('static disconnection to room');
|
|
12808
12826
|
|
|
12809
12827
|
Wazo.Phone.disconnect();
|
|
12810
12828
|
}
|
|
12811
12829
|
|
|
12812
12830
|
async disconnect() {
|
|
12813
|
-
logger$
|
|
12831
|
+
logger$1.info('disconnection to room called');
|
|
12814
12832
|
|
|
12815
12833
|
await Wazo.Phone.hangup(this.callSession);
|
|
12816
12834
|
this.callSession = null;
|
|
@@ -12830,19 +12848,19 @@ class Room$1 extends Emitter {
|
|
|
12830
12848
|
}
|
|
12831
12849
|
|
|
12832
12850
|
setSourceId(sourceId ) {
|
|
12833
|
-
logger$
|
|
12851
|
+
logger$1.info('set room source id', { sourceId });
|
|
12834
12852
|
|
|
12835
12853
|
this.sourceId = sourceId;
|
|
12836
12854
|
}
|
|
12837
12855
|
|
|
12838
12856
|
setMeetingUuid(meetingUuid ) {
|
|
12839
|
-
logger$
|
|
12857
|
+
logger$1.info('set meeting uuid', { meetingUuid });
|
|
12840
12858
|
|
|
12841
12859
|
this.meetingUuid = meetingUuid;
|
|
12842
12860
|
}
|
|
12843
12861
|
|
|
12844
12862
|
setCallId(callId ) {
|
|
12845
|
-
logger$
|
|
12863
|
+
logger$1.info('set room call id', { callId });
|
|
12846
12864
|
|
|
12847
12865
|
if (callId) {
|
|
12848
12866
|
this.callId = callId;
|
|
@@ -12850,7 +12868,7 @@ class Room$1 extends Emitter {
|
|
|
12850
12868
|
}
|
|
12851
12869
|
|
|
12852
12870
|
setName(name ) {
|
|
12853
|
-
logger$
|
|
12871
|
+
logger$1.info('set room name', { name });
|
|
12854
12872
|
|
|
12855
12873
|
this.name = name;
|
|
12856
12874
|
}
|
|
@@ -12869,7 +12887,7 @@ class Room$1 extends Emitter {
|
|
|
12869
12887
|
}
|
|
12870
12888
|
|
|
12871
12889
|
async startScreenSharing(constraints ) {
|
|
12872
|
-
logger$
|
|
12890
|
+
logger$1.info('start room screen sharing', { constraints });
|
|
12873
12891
|
|
|
12874
12892
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
12875
12893
|
if (!screensharingStream) {
|
|
@@ -12883,7 +12901,7 @@ class Room$1 extends Emitter {
|
|
|
12883
12901
|
}
|
|
12884
12902
|
|
|
12885
12903
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
12886
|
-
logger$
|
|
12904
|
+
logger$1.info('stop room screen sharing');
|
|
12887
12905
|
|
|
12888
12906
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
12889
12907
|
|
|
@@ -12895,7 +12913,7 @@ class Room$1 extends Emitter {
|
|
|
12895
12913
|
}
|
|
12896
12914
|
|
|
12897
12915
|
turnCameraOff() {
|
|
12898
|
-
logger$
|
|
12916
|
+
logger$1.info('turn room camera off');
|
|
12899
12917
|
|
|
12900
12918
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
12901
12919
|
|
|
@@ -12905,7 +12923,7 @@ class Room$1 extends Emitter {
|
|
|
12905
12923
|
}
|
|
12906
12924
|
|
|
12907
12925
|
turnCameraOn() {
|
|
12908
|
-
logger$
|
|
12926
|
+
logger$1.info('turn room camera on');
|
|
12909
12927
|
|
|
12910
12928
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
12911
12929
|
|
|
@@ -12915,7 +12933,7 @@ class Room$1 extends Emitter {
|
|
|
12915
12933
|
}
|
|
12916
12934
|
|
|
12917
12935
|
mute() {
|
|
12918
|
-
logger$
|
|
12936
|
+
logger$1.info('mute room');
|
|
12919
12937
|
|
|
12920
12938
|
Wazo.Phone.mute(this.callSession);
|
|
12921
12939
|
|
|
@@ -12923,7 +12941,7 @@ class Room$1 extends Emitter {
|
|
|
12923
12941
|
}
|
|
12924
12942
|
|
|
12925
12943
|
unmute() {
|
|
12926
|
-
logger$
|
|
12944
|
+
logger$1.info('unmute room');
|
|
12927
12945
|
|
|
12928
12946
|
Wazo.Phone.unmute(this.callSession);
|
|
12929
12947
|
|
|
@@ -12943,7 +12961,7 @@ class Room$1 extends Emitter {
|
|
|
12943
12961
|
}
|
|
12944
12962
|
|
|
12945
12963
|
hold() {
|
|
12946
|
-
logger$
|
|
12964
|
+
logger$1.info('hold room');
|
|
12947
12965
|
|
|
12948
12966
|
Wazo.Phone.hold(this.callSession, true);
|
|
12949
12967
|
|
|
@@ -12953,7 +12971,7 @@ class Room$1 extends Emitter {
|
|
|
12953
12971
|
}
|
|
12954
12972
|
|
|
12955
12973
|
async resume() {
|
|
12956
|
-
logger$
|
|
12974
|
+
logger$1.info('resume room');
|
|
12957
12975
|
|
|
12958
12976
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
12959
12977
|
|
|
@@ -12981,13 +12999,13 @@ class Room$1 extends Emitter {
|
|
|
12981
12999
|
}
|
|
12982
13000
|
|
|
12983
13001
|
sendDTMF(tone ) {
|
|
12984
|
-
logger$
|
|
13002
|
+
logger$1.info('send room DTMF', { tone });
|
|
12985
13003
|
|
|
12986
13004
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
12987
13005
|
}
|
|
12988
13006
|
|
|
12989
13007
|
async sendReinvite(newConstraints = null) {
|
|
12990
|
-
logger$
|
|
13008
|
+
logger$1.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
12991
13009
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
12992
13010
|
|
|
12993
13011
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -13046,7 +13064,7 @@ class Room$1 extends Emitter {
|
|
|
13046
13064
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
13047
13065
|
|
|
13048
13066
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
13049
|
-
logger$
|
|
13067
|
+
logger$1.info('on room audio stream');
|
|
13050
13068
|
|
|
13051
13069
|
this.audioStream = stream;
|
|
13052
13070
|
if (!this.roomAudioElement) {
|
|
@@ -13059,7 +13077,7 @@ class Room$1 extends Emitter {
|
|
|
13059
13077
|
});
|
|
13060
13078
|
|
|
13061
13079
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
13062
|
-
logger$
|
|
13080
|
+
logger$1.info('on room video stream', { streamId });
|
|
13063
13081
|
|
|
13064
13082
|
this._mapMsid(sipSession.body.body);
|
|
13065
13083
|
|
|
@@ -13074,7 +13092,7 @@ class Room$1 extends Emitter {
|
|
|
13074
13092
|
});
|
|
13075
13093
|
|
|
13076
13094
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
13077
|
-
logger$
|
|
13095
|
+
logger$1.info('on room remove stream');
|
|
13078
13096
|
|
|
13079
13097
|
const participant = this.participants.find(someParticipant =>
|
|
13080
13098
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -13206,7 +13224,7 @@ class Room$1 extends Emitter {
|
|
|
13206
13224
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
13207
13225
|
if (requester) {
|
|
13208
13226
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
13209
|
-
logger$
|
|
13227
|
+
logger$1.info('trigger room requester status', { origin });
|
|
13210
13228
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
13211
13229
|
}
|
|
13212
13230
|
break;
|
|
@@ -13237,24 +13255,24 @@ class Room$1 extends Emitter {
|
|
|
13237
13255
|
|
|
13238
13256
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
13239
13257
|
if (participant.user_uuid === session.uuid) {
|
|
13240
|
-
logger$
|
|
13258
|
+
logger$1.info('room current user joined');
|
|
13241
13259
|
|
|
13242
13260
|
// Retrieve participants via an API calls
|
|
13243
13261
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
13244
13262
|
let response;
|
|
13245
13263
|
try {
|
|
13246
13264
|
if (this.meetingUuid) {
|
|
13247
|
-
logger$
|
|
13265
|
+
logger$1.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
13248
13266
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
13249
13267
|
} else {
|
|
13250
|
-
logger$
|
|
13268
|
+
logger$1.info('fetching conference participants', { conferenceId });
|
|
13251
13269
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
13252
13270
|
}
|
|
13253
13271
|
} catch (e) {
|
|
13254
|
-
logger$
|
|
13272
|
+
logger$1.error('room participants fetching, error', e);
|
|
13255
13273
|
}
|
|
13256
13274
|
if (response) {
|
|
13257
|
-
logger$
|
|
13275
|
+
logger$1.info('conference participants fetched', { nb: response.items.length });
|
|
13258
13276
|
participants = response.items.map(item => {
|
|
13259
13277
|
const isMe = item.call_id === this.callId;
|
|
13260
13278
|
|
|
@@ -13281,7 +13299,7 @@ class Room$1 extends Emitter {
|
|
|
13281
13299
|
? new Wazo.RemoteParticipant(this, participant)
|
|
13282
13300
|
: null;
|
|
13283
13301
|
|
|
13284
|
-
logger$
|
|
13302
|
+
logger$1.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
13285
13303
|
|
|
13286
13304
|
if (remoteParticipant) {
|
|
13287
13305
|
this.participants.push(remoteParticipant);
|
|
@@ -13446,7 +13464,7 @@ class Room$1 extends Emitter {
|
|
|
13446
13464
|
|
|
13447
13465
|
//
|
|
13448
13466
|
|
|
13449
|
-
const logger
|
|
13467
|
+
const logger = IssueReporter$1.loggerFor('room');
|
|
13450
13468
|
|
|
13451
13469
|
class Participant extends Emitter {
|
|
13452
13470
|
|
|
@@ -13568,7 +13586,7 @@ class Participant extends Emitter {
|
|
|
13568
13586
|
}
|
|
13569
13587
|
|
|
13570
13588
|
onTalking(isTalking ) {
|
|
13571
|
-
logger
|
|
13589
|
+
logger.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
13572
13590
|
this.isTalking = isTalking;
|
|
13573
13591
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
13574
13592
|
// directly from asterisk, there's no need to do so
|
|
@@ -13671,7 +13689,7 @@ class Participant extends Emitter {
|
|
|
13671
13689
|
}
|
|
13672
13690
|
|
|
13673
13691
|
updateStatus(status , broadcast = true) {
|
|
13674
|
-
logger
|
|
13692
|
+
logger.info('updating participant status', { name: this.name, status });
|
|
13675
13693
|
|
|
13676
13694
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
13677
13695
|
if (status.audioMuted) {
|
|
@@ -13719,7 +13737,7 @@ class Participant extends Emitter {
|
|
|
13719
13737
|
|
|
13720
13738
|
broadcastStatus(inboundStatus = null) {
|
|
13721
13739
|
const status = inboundStatus || this.getStatus();
|
|
13722
|
-
logger
|
|
13740
|
+
logger.info('broadcasting participant status', { callId: this.callId, status });
|
|
13723
13741
|
|
|
13724
13742
|
this.room.sendSignal({
|
|
13725
13743
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|