@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
package/lib/index.js
CHANGED
|
@@ -471,7 +471,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
471
471
|
|
|
472
472
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
473
473
|
|
|
474
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
474
|
+
const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
475
475
|
|
|
476
476
|
// Use a function here to be able to mock it in tests
|
|
477
477
|
const realFetch = () => {
|
|
@@ -610,7 +610,7 @@ class ApiRequester {
|
|
|
610
610
|
};
|
|
611
611
|
|
|
612
612
|
if (this.refreshTokenPromise) {
|
|
613
|
-
logger.info('A token is already refreshing, waiting ...', { url });
|
|
613
|
+
logger$c.info('A token is already refreshing, waiting ...', { url });
|
|
614
614
|
await this.refreshTokenPromise;
|
|
615
615
|
}
|
|
616
616
|
|
|
@@ -630,7 +630,7 @@ class ApiRequester {
|
|
|
630
630
|
return promise.then(async (err ) => {
|
|
631
631
|
// Check if the token is still valid
|
|
632
632
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
633
|
-
logger.warn('token expired', { error: err.reason });
|
|
633
|
+
logger$c.warn('token expired', { error: err.reason });
|
|
634
634
|
// Replay the call after refreshing the token
|
|
635
635
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
636
636
|
}
|
|
@@ -640,7 +640,7 @@ class ApiRequester {
|
|
|
640
640
|
: exceptionClass.fromResponse(err, response.status);
|
|
641
641
|
|
|
642
642
|
if (this.shouldLogErrors) {
|
|
643
|
-
logger.error('API error', error);
|
|
643
|
+
logger$c.error('API error', error);
|
|
644
644
|
}
|
|
645
645
|
|
|
646
646
|
throw error;
|
|
@@ -650,7 +650,7 @@ class ApiRequester {
|
|
|
650
650
|
return newParse(response, isJson);
|
|
651
651
|
}).catch(error => {
|
|
652
652
|
if (this.shouldLogErrors) {
|
|
653
|
-
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
653
|
+
logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
654
654
|
}
|
|
655
655
|
|
|
656
656
|
throw error;
|
|
@@ -678,13 +678,13 @@ class ApiRequester {
|
|
|
678
678
|
) {
|
|
679
679
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
680
680
|
let newPath = path;
|
|
681
|
-
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
681
|
+
logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
682
682
|
|
|
683
683
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
684
684
|
|
|
685
685
|
return this.refreshTokenPromise.then(() => {
|
|
686
686
|
this.refreshTokenPromise = null;
|
|
687
|
-
logger.info('token refreshed', { isTokenNotFound });
|
|
687
|
+
logger$c.info('token refreshed', { isTokenNotFound });
|
|
688
688
|
if (isTokenNotFound) {
|
|
689
689
|
const pathParts = path.split('/');
|
|
690
690
|
pathParts.pop();
|
|
@@ -4148,7 +4148,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4148
4148
|
|
|
4149
4149
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4150
4150
|
|
|
4151
|
-
const logger$
|
|
4151
|
+
const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4152
4152
|
|
|
4153
4153
|
class CTIPhone extends Emitter {
|
|
4154
4154
|
|
|
@@ -4161,7 +4161,7 @@ class CTIPhone extends Emitter {
|
|
|
4161
4161
|
|
|
4162
4162
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4163
4163
|
super();
|
|
4164
|
-
logger$
|
|
4164
|
+
logger$b.info('CTI Phone created');
|
|
4165
4165
|
this.session = session;
|
|
4166
4166
|
this.isMobile = isMobile;
|
|
4167
4167
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4222,7 +4222,7 @@ class CTIPhone extends Emitter {
|
|
|
4222
4222
|
}
|
|
4223
4223
|
|
|
4224
4224
|
async makeCall(number , line ) {
|
|
4225
|
-
logger$
|
|
4225
|
+
logger$b.info('make CTI call', { number });
|
|
4226
4226
|
|
|
4227
4227
|
if (!number) {
|
|
4228
4228
|
return null;
|
|
@@ -4245,7 +4245,7 @@ class CTIPhone extends Emitter {
|
|
|
4245
4245
|
if (!callSession) {
|
|
4246
4246
|
return Promise.resolve(null);
|
|
4247
4247
|
}
|
|
4248
|
-
logger$
|
|
4248
|
+
logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4249
4249
|
|
|
4250
4250
|
if (!this.currentCall) {
|
|
4251
4251
|
this.currentCall = callSession.call;
|
|
@@ -4258,7 +4258,7 @@ class CTIPhone extends Emitter {
|
|
|
4258
4258
|
if (!callSession) {
|
|
4259
4259
|
return;
|
|
4260
4260
|
}
|
|
4261
|
-
logger$
|
|
4261
|
+
logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4262
4262
|
|
|
4263
4263
|
this.currentCall = undefined;
|
|
4264
4264
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4268,7 +4268,7 @@ class CTIPhone extends Emitter {
|
|
|
4268
4268
|
if (!callSession) {
|
|
4269
4269
|
return Promise.resolve(false);
|
|
4270
4270
|
}
|
|
4271
|
-
logger$
|
|
4271
|
+
logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4272
4272
|
|
|
4273
4273
|
try {
|
|
4274
4274
|
await CallApi.cancelCall(callSession);
|
|
@@ -4279,7 +4279,7 @@ class CTIPhone extends Emitter {
|
|
|
4279
4279
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4280
4280
|
return true;
|
|
4281
4281
|
} catch (e) {
|
|
4282
|
-
logger$
|
|
4282
|
+
logger$b.error('hangup CTI call, error', e);
|
|
4283
4283
|
|
|
4284
4284
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4285
4285
|
return false;
|
|
@@ -4292,7 +4292,7 @@ class CTIPhone extends Emitter {
|
|
|
4292
4292
|
if (!callSession) {
|
|
4293
4293
|
return;
|
|
4294
4294
|
}
|
|
4295
|
-
logger$
|
|
4295
|
+
logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4296
4296
|
|
|
4297
4297
|
await CallApi.cancelCall(callSession);
|
|
4298
4298
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4302,7 +4302,7 @@ class CTIPhone extends Emitter {
|
|
|
4302
4302
|
if (!callSession) {
|
|
4303
4303
|
return;
|
|
4304
4304
|
}
|
|
4305
|
-
logger$
|
|
4305
|
+
logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4306
4306
|
|
|
4307
4307
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4308
4308
|
}
|
|
@@ -4315,19 +4315,19 @@ class CTIPhone extends Emitter {
|
|
|
4315
4315
|
if (!callSession) {
|
|
4316
4316
|
return;
|
|
4317
4317
|
}
|
|
4318
|
-
logger$
|
|
4318
|
+
logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4319
4319
|
|
|
4320
4320
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4321
4321
|
}
|
|
4322
4322
|
|
|
4323
4323
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4324
|
-
logger$
|
|
4324
|
+
logger$b.info('cancel CTI transfer', { transferId });
|
|
4325
4325
|
|
|
4326
4326
|
return CallApi.cancelCallTransfer(transferId);
|
|
4327
4327
|
}
|
|
4328
4328
|
|
|
4329
4329
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4330
|
-
logger$
|
|
4330
|
+
logger$b.info('confirm CTI transfer', { transferId });
|
|
4331
4331
|
|
|
4332
4332
|
return CallApi.confirmCallTransfer(transferId);
|
|
4333
4333
|
}
|
|
@@ -4336,19 +4336,19 @@ class CTIPhone extends Emitter {
|
|
|
4336
4336
|
if (!callSession) {
|
|
4337
4337
|
return;
|
|
4338
4338
|
}
|
|
4339
|
-
logger$
|
|
4339
|
+
logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4340
4340
|
|
|
4341
4341
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4342
4342
|
}
|
|
4343
4343
|
|
|
4344
4344
|
onConnectionMade() {
|
|
4345
|
-
logger$
|
|
4345
|
+
logger$b.info('on CTI connection made');
|
|
4346
4346
|
|
|
4347
4347
|
this.eventEmitter.emit('onCallAccepted');
|
|
4348
4348
|
}
|
|
4349
4349
|
|
|
4350
4350
|
async close() {
|
|
4351
|
-
logger$
|
|
4351
|
+
logger$b.info('CTI close');
|
|
4352
4352
|
|
|
4353
4353
|
return Promise.resolve();
|
|
4354
4354
|
}
|
|
@@ -4357,7 +4357,7 @@ class CTIPhone extends Emitter {
|
|
|
4357
4357
|
if (!callSession) {
|
|
4358
4358
|
return;
|
|
4359
4359
|
}
|
|
4360
|
-
logger$
|
|
4360
|
+
logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4361
4361
|
|
|
4362
4362
|
return CallApi.hold(callSession.callId);
|
|
4363
4363
|
}
|
|
@@ -4366,7 +4366,7 @@ class CTIPhone extends Emitter {
|
|
|
4366
4366
|
if (!callSession) {
|
|
4367
4367
|
return;
|
|
4368
4368
|
}
|
|
4369
|
-
logger$
|
|
4369
|
+
logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4370
4370
|
|
|
4371
4371
|
return CallApi.resume(callSession.callId);
|
|
4372
4372
|
}
|
|
@@ -4375,7 +4375,7 @@ class CTIPhone extends Emitter {
|
|
|
4375
4375
|
if (!callSession) {
|
|
4376
4376
|
return;
|
|
4377
4377
|
}
|
|
4378
|
-
logger$
|
|
4378
|
+
logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4379
4379
|
|
|
4380
4380
|
return CallApi.mute(callSession.callId);
|
|
4381
4381
|
}
|
|
@@ -4384,7 +4384,7 @@ class CTIPhone extends Emitter {
|
|
|
4384
4384
|
if (!callSession) {
|
|
4385
4385
|
return;
|
|
4386
4386
|
}
|
|
4387
|
-
logger$
|
|
4387
|
+
logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4388
4388
|
|
|
4389
4389
|
return CallApi.unmute(callSession.callId);
|
|
4390
4390
|
}
|
|
@@ -5393,7 +5393,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5393
5393
|
const WEBHOOKD_VERSION = '1.0';
|
|
5394
5394
|
const AMID_VERSION = '1.0';
|
|
5395
5395
|
|
|
5396
|
-
const logger$
|
|
5396
|
+
const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5397
5397
|
|
|
5398
5398
|
class ApiClient {
|
|
5399
5399
|
|
|
@@ -5445,12 +5445,12 @@ class ApiClient {
|
|
|
5445
5445
|
}
|
|
5446
5446
|
|
|
5447
5447
|
async forceRefreshToken() {
|
|
5448
|
-
logger$
|
|
5448
|
+
logger$a.info('forcing refresh token, calling callback');
|
|
5449
5449
|
return this.refreshTokenCallback();
|
|
5450
5450
|
}
|
|
5451
5451
|
|
|
5452
5452
|
async refreshTokenCallback() {
|
|
5453
|
-
logger$
|
|
5453
|
+
logger$a.info('refresh token callback called', {
|
|
5454
5454
|
refreshToken: this.refreshToken,
|
|
5455
5455
|
refreshBackend: this.refreshBackend,
|
|
5456
5456
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5468,7 +5468,7 @@ class ApiClient {
|
|
|
5468
5468
|
this.isMobile,
|
|
5469
5469
|
);
|
|
5470
5470
|
|
|
5471
|
-
logger$
|
|
5471
|
+
logger$a.info('token refreshed', { token: session.token });
|
|
5472
5472
|
|
|
5473
5473
|
if (this.onRefreshToken) {
|
|
5474
5474
|
this.onRefreshToken(session.token, session);
|
|
@@ -5523,7 +5523,7 @@ class ApiClient {
|
|
|
5523
5523
|
|
|
5524
5524
|
/* */
|
|
5525
5525
|
|
|
5526
|
-
const parseCandidate = (candidate ) => {
|
|
5526
|
+
const parseCandidate$1 = (candidate ) => {
|
|
5527
5527
|
if (!candidate) {
|
|
5528
5528
|
return null;
|
|
5529
5529
|
}
|
|
@@ -5677,7 +5677,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5677
5677
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
5678
5678
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
5679
5679
|
if (event.candidate) {
|
|
5680
|
-
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
5680
|
+
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
5681
5681
|
}
|
|
5682
5682
|
};
|
|
5683
5683
|
|
|
@@ -6141,7 +6141,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6141
6141
|
const SEND_STATS_DELAY = 5000;
|
|
6142
6142
|
|
|
6143
6143
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6144
|
-
const logger$
|
|
6144
|
+
const logger$9 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6145
6145
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6146
6146
|
|
|
6147
6147
|
// events
|
|
@@ -6155,14 +6155,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6155
6155
|
const MESSAGE = 'message';
|
|
6156
6156
|
const ACCEPTED = 'accepted';
|
|
6157
6157
|
const REJECTED = 'rejected';
|
|
6158
|
-
const ON_TRACK = 'onTrack';
|
|
6159
|
-
const ON_REINVITE = 'reinvite';
|
|
6158
|
+
const ON_TRACK$1 = 'onTrack';
|
|
6159
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
6160
6160
|
const ON_ERROR = 'onError';
|
|
6161
6161
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6162
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6163
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
6162
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6163
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6164
6164
|
|
|
6165
|
-
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6165
|
+
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6166
6166
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6167
6167
|
class CanceledCallError extends Error {}
|
|
6168
6168
|
|
|
@@ -6298,12 +6298,12 @@ class WebRTCClient extends Emitter {
|
|
|
6298
6298
|
this.MESSAGE = MESSAGE;
|
|
6299
6299
|
this.ACCEPTED = ACCEPTED;
|
|
6300
6300
|
this.REJECTED = REJECTED;
|
|
6301
|
-
this.ON_TRACK = ON_TRACK;
|
|
6302
|
-
this.ON_REINVITE = ON_REINVITE;
|
|
6301
|
+
this.ON_TRACK = ON_TRACK$1;
|
|
6302
|
+
this.ON_REINVITE = ON_REINVITE$1;
|
|
6303
6303
|
this.ON_ERROR = ON_ERROR;
|
|
6304
6304
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6305
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6306
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6305
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6306
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6307
6307
|
}
|
|
6308
6308
|
|
|
6309
6309
|
configureMedia(media ) {
|
|
@@ -6320,13 +6320,13 @@ class WebRTCClient extends Emitter {
|
|
|
6320
6320
|
|
|
6321
6321
|
createUserAgent(configOverrides ) {
|
|
6322
6322
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6323
|
-
logger$
|
|
6323
|
+
logger$9.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6324
6324
|
|
|
6325
6325
|
webRTCConfiguration.delegate = {
|
|
6326
6326
|
onConnect: this.onConnect.bind(this),
|
|
6327
6327
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6328
6328
|
onInvite: (invitation ) => {
|
|
6329
|
-
logger$
|
|
6329
|
+
logger$9.info('sdk webrtc on invite', {
|
|
6330
6330
|
method: 'delegate.onInvite',
|
|
6331
6331
|
id: invitation.id,
|
|
6332
6332
|
remoteURI: invitation.remoteURI,
|
|
@@ -6369,7 +6369,7 @@ class WebRTCClient extends Emitter {
|
|
|
6369
6369
|
}
|
|
6370
6370
|
|
|
6371
6371
|
onConnect() {
|
|
6372
|
-
logger$
|
|
6372
|
+
logger$9.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6373
6373
|
this.eventEmitter.emit(CONNECTED);
|
|
6374
6374
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6375
6375
|
this.registerer.waitingToggle(false);
|
|
@@ -6378,7 +6378,7 @@ class WebRTCClient extends Emitter {
|
|
|
6378
6378
|
}
|
|
6379
6379
|
|
|
6380
6380
|
async onDisconnect(error ) {
|
|
6381
|
-
logger$
|
|
6381
|
+
logger$9.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6382
6382
|
this.connectionPromise = null;
|
|
6383
6383
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6384
6384
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6403,37 +6403,37 @@ class WebRTCClient extends Emitter {
|
|
|
6403
6403
|
};
|
|
6404
6404
|
|
|
6405
6405
|
if (this.skipRegister) {
|
|
6406
|
-
logger$
|
|
6406
|
+
logger$9.info('sdk webrtc skip register...', logInfo);
|
|
6407
6407
|
return Promise.resolve();
|
|
6408
6408
|
}
|
|
6409
6409
|
|
|
6410
|
-
logger$
|
|
6410
|
+
logger$9.info('sdk webrtc registering...', logInfo);
|
|
6411
6411
|
|
|
6412
6412
|
if (!this.userAgent) {
|
|
6413
|
-
logger$
|
|
6413
|
+
logger$9.info('sdk webrtc recreating User Agent');
|
|
6414
6414
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6415
6415
|
}
|
|
6416
6416
|
if (!this.userAgent || this.isRegistered()) {
|
|
6417
|
-
logger$
|
|
6417
|
+
logger$9.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6418
6418
|
return Promise.resolve();
|
|
6419
6419
|
}
|
|
6420
6420
|
|
|
6421
6421
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6422
|
-
logger$
|
|
6422
|
+
logger$9.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6423
6423
|
return Promise.resolve();
|
|
6424
6424
|
}
|
|
6425
6425
|
|
|
6426
6426
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6427
6427
|
|
|
6428
6428
|
const onRegisterFailed = () => {
|
|
6429
|
-
logger$
|
|
6429
|
+
logger$9.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6430
6430
|
this.connectionPromise = null;
|
|
6431
6431
|
if (this.registerer && this.registerer.waiting) {
|
|
6432
6432
|
this.registerer.waitingToggle(false);
|
|
6433
6433
|
}
|
|
6434
6434
|
|
|
6435
6435
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6436
|
-
logger$
|
|
6436
|
+
logger$9.info('sdk webrtc registering, retrying...', { tries });
|
|
6437
6437
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6438
6438
|
}
|
|
6439
6439
|
};
|
|
@@ -6442,18 +6442,18 @@ class WebRTCClient extends Emitter {
|
|
|
6442
6442
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6443
6443
|
// during the resolution of the primise.
|
|
6444
6444
|
if (!this.userAgent) {
|
|
6445
|
-
logger$
|
|
6445
|
+
logger$9.info('sdk webrtc recreating User Agent after connection');
|
|
6446
6446
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6447
6447
|
}
|
|
6448
6448
|
|
|
6449
|
-
logger$
|
|
6449
|
+
logger$9.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6450
6450
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
6451
6451
|
this.connectionPromise = null;
|
|
6452
6452
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6453
6453
|
|
|
6454
6454
|
// Bind registerer events
|
|
6455
6455
|
this.registerer.stateChange.addListener(newState => {
|
|
6456
|
-
logger$
|
|
6456
|
+
logger$9.info('sdk webrtc registering, state changed', { newState });
|
|
6457
6457
|
|
|
6458
6458
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
6459
6459
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -6466,7 +6466,7 @@ class WebRTCClient extends Emitter {
|
|
|
6466
6466
|
const options = {
|
|
6467
6467
|
requestDelegate: {
|
|
6468
6468
|
onReject: response => {
|
|
6469
|
-
logger$
|
|
6469
|
+
logger$9.error('sdk webrtc registering, rejected', { response });
|
|
6470
6470
|
|
|
6471
6471
|
onRegisterFailed();
|
|
6472
6472
|
},
|
|
@@ -6474,13 +6474,13 @@ class WebRTCClient extends Emitter {
|
|
|
6474
6474
|
};
|
|
6475
6475
|
|
|
6476
6476
|
return this.registerer.register(options).catch((e) => {
|
|
6477
|
-
logger$
|
|
6477
|
+
logger$9.error('sdk webrtc registering, error', e);
|
|
6478
6478
|
|
|
6479
6479
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6480
6480
|
return e;
|
|
6481
6481
|
});
|
|
6482
6482
|
}).catch(error => {
|
|
6483
|
-
logger$
|
|
6483
|
+
logger$9.error('sdk webrtc registering, transport error', error);
|
|
6484
6484
|
onRegisterFailed();
|
|
6485
6485
|
});
|
|
6486
6486
|
}
|
|
@@ -6509,21 +6509,21 @@ class WebRTCClient extends Emitter {
|
|
|
6509
6509
|
}
|
|
6510
6510
|
|
|
6511
6511
|
unregister() {
|
|
6512
|
-
logger$
|
|
6512
|
+
logger$9.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6513
6513
|
if (!this.registerer) {
|
|
6514
6514
|
return Promise.resolve();
|
|
6515
6515
|
}
|
|
6516
6516
|
|
|
6517
6517
|
try {
|
|
6518
6518
|
return this.registerer.unregister().then(() => {
|
|
6519
|
-
logger$
|
|
6519
|
+
logger$9.info('sdk webrtc unregistered');
|
|
6520
6520
|
this._cleanupRegister();
|
|
6521
6521
|
}).catch(e => {
|
|
6522
|
-
logger$
|
|
6522
|
+
logger$9.error('sdk webrtc unregistering, promise error', e);
|
|
6523
6523
|
this._cleanupRegister();
|
|
6524
6524
|
});
|
|
6525
6525
|
} catch (e) {
|
|
6526
|
-
logger$
|
|
6526
|
+
logger$9.error('sdk webrtc unregistering, error', e);
|
|
6527
6527
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6528
6528
|
// error when the registerer is in a bad state
|
|
6529
6529
|
this._cleanupRegister();
|
|
@@ -6531,7 +6531,7 @@ class WebRTCClient extends Emitter {
|
|
|
6531
6531
|
}
|
|
6532
6532
|
|
|
6533
6533
|
stop() {
|
|
6534
|
-
logger$
|
|
6534
|
+
logger$9.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6535
6535
|
if (!this.userAgent) {
|
|
6536
6536
|
return Promise.resolve();
|
|
6537
6537
|
}
|
|
@@ -6539,12 +6539,12 @@ class WebRTCClient extends Emitter {
|
|
|
6539
6539
|
return this.userAgent.stop().then(() => {
|
|
6540
6540
|
return this._cleanupRegister();
|
|
6541
6541
|
}).catch(e => {
|
|
6542
|
-
logger$
|
|
6542
|
+
logger$9.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6543
6543
|
});
|
|
6544
6544
|
}
|
|
6545
6545
|
|
|
6546
6546
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6547
|
-
logger$
|
|
6547
|
+
logger$9.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6548
6548
|
const inviterOptions = {
|
|
6549
6549
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6550
6550
|
conference,
|
|
@@ -6575,7 +6575,7 @@ class WebRTCClient extends Emitter {
|
|
|
6575
6575
|
this._onAccepted(session, response.session, true);
|
|
6576
6576
|
},
|
|
6577
6577
|
onReject: (response ) => {
|
|
6578
|
-
logger$
|
|
6578
|
+
logger$9.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
6579
6579
|
this._stopSendingStats(session);
|
|
6580
6580
|
this.stopNetworkMonitoring(session);
|
|
6581
6581
|
|
|
@@ -6598,11 +6598,11 @@ class WebRTCClient extends Emitter {
|
|
|
6598
6598
|
}
|
|
6599
6599
|
|
|
6600
6600
|
answer(session , enableVideo ) {
|
|
6601
|
-
logger$
|
|
6601
|
+
logger$9.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
6602
6602
|
|
|
6603
6603
|
if (!session || !session.accept) {
|
|
6604
6604
|
const error = 'No session to answer, or not an invitation';
|
|
6605
|
-
logger$
|
|
6605
|
+
logger$9.warn(error);
|
|
6606
6606
|
return Promise.reject(new Error(error));
|
|
6607
6607
|
}
|
|
6608
6608
|
const options = {
|
|
@@ -6612,15 +6612,15 @@ class WebRTCClient extends Emitter {
|
|
|
6612
6612
|
return session.accept(options).then(() => {
|
|
6613
6613
|
if (session.isCanceled) {
|
|
6614
6614
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
6615
|
-
logger$
|
|
6615
|
+
logger$9.error(message, { id: session.id });
|
|
6616
6616
|
this.onCallEnded(session);
|
|
6617
6617
|
|
|
6618
6618
|
throw new CanceledCallError(message);
|
|
6619
6619
|
}
|
|
6620
|
-
logger$
|
|
6620
|
+
logger$9.info('sdk webrtc answer, accepted.');
|
|
6621
6621
|
this._onAccepted(session);
|
|
6622
6622
|
}).catch(e => {
|
|
6623
|
-
logger$
|
|
6623
|
+
logger$9.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
6624
6624
|
|
|
6625
6625
|
throw e;
|
|
6626
6626
|
});
|
|
@@ -6628,7 +6628,7 @@ class WebRTCClient extends Emitter {
|
|
|
6628
6628
|
|
|
6629
6629
|
hangup(session ) {
|
|
6630
6630
|
const { state, id } = session;
|
|
6631
|
-
logger$
|
|
6631
|
+
logger$9.info('sdk webrtc hangup call', { id, state });
|
|
6632
6632
|
|
|
6633
6633
|
try {
|
|
6634
6634
|
this._stopSendingStats(session);
|
|
@@ -6657,7 +6657,7 @@ class WebRTCClient extends Emitter {
|
|
|
6657
6657
|
|
|
6658
6658
|
return bye();
|
|
6659
6659
|
} catch (error) {
|
|
6660
|
-
logger$
|
|
6660
|
+
logger$9.warn('sdk webrtc hangup, error', error);
|
|
6661
6661
|
}
|
|
6662
6662
|
|
|
6663
6663
|
return null;
|
|
@@ -6675,7 +6675,7 @@ class WebRTCClient extends Emitter {
|
|
|
6675
6675
|
// Fetch and emit an event at `interval` with session network stats
|
|
6676
6676
|
startNetworkMonitoring(session , interval = 1000) {
|
|
6677
6677
|
const sessionId = this.getSipSessionId(session);
|
|
6678
|
-
logger$
|
|
6678
|
+
logger$9.info('starting network inspection', { id: sessionId });
|
|
6679
6679
|
|
|
6680
6680
|
this.sessionNetworkStats[sessionId] = [];
|
|
6681
6681
|
|
|
@@ -6685,7 +6685,7 @@ class WebRTCClient extends Emitter {
|
|
|
6685
6685
|
stopNetworkMonitoring(session ) {
|
|
6686
6686
|
const sessionId = this.getSipSessionId(session);
|
|
6687
6687
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
6688
|
-
logger$
|
|
6688
|
+
logger$9.info('stopping network inspection', { id: sessionId, exists });
|
|
6689
6689
|
|
|
6690
6690
|
if (exists) {
|
|
6691
6691
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -6695,17 +6695,17 @@ class WebRTCClient extends Emitter {
|
|
|
6695
6695
|
}
|
|
6696
6696
|
|
|
6697
6697
|
reject(session ) {
|
|
6698
|
-
logger$
|
|
6698
|
+
logger$9.info('sdk webrtc reject call', { id: session.id });
|
|
6699
6699
|
|
|
6700
6700
|
try {
|
|
6701
6701
|
return session.reject ? session.reject() : session.cancel();
|
|
6702
6702
|
} catch (e) {
|
|
6703
|
-
logger$
|
|
6703
|
+
logger$9.warn('Error when rejecting call', e.message, e.stack);
|
|
6704
6704
|
}
|
|
6705
6705
|
}
|
|
6706
6706
|
|
|
6707
6707
|
async close() {
|
|
6708
|
-
logger$
|
|
6708
|
+
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6709
6709
|
this._cleanupMedia();
|
|
6710
6710
|
this.connectionPromise = null;
|
|
6711
6711
|
|
|
@@ -6736,7 +6736,7 @@ class WebRTCClient extends Emitter {
|
|
|
6736
6736
|
// eg: "INVITE not rejectable in state Completed"
|
|
6737
6737
|
}
|
|
6738
6738
|
this.userAgent = null;
|
|
6739
|
-
logger$
|
|
6739
|
+
logger$9.info('sdk webrtc client closed');
|
|
6740
6740
|
}
|
|
6741
6741
|
|
|
6742
6742
|
getNumber(session ) {
|
|
@@ -6749,13 +6749,13 @@ class WebRTCClient extends Emitter {
|
|
|
6749
6749
|
}
|
|
6750
6750
|
|
|
6751
6751
|
mute(session ) {
|
|
6752
|
-
logger$
|
|
6752
|
+
logger$9.info('sdk webrtc mute', { id: session.id });
|
|
6753
6753
|
|
|
6754
6754
|
this._toggleAudio(session, true);
|
|
6755
6755
|
}
|
|
6756
6756
|
|
|
6757
6757
|
unmute(session ) {
|
|
6758
|
-
logger$
|
|
6758
|
+
logger$9.info('sdk webrtc unmute', { id: session.id });
|
|
6759
6759
|
|
|
6760
6760
|
this._toggleAudio(session, false);
|
|
6761
6761
|
}
|
|
@@ -6795,13 +6795,13 @@ class WebRTCClient extends Emitter {
|
|
|
6795
6795
|
}
|
|
6796
6796
|
|
|
6797
6797
|
toggleCameraOn(session ) {
|
|
6798
|
-
logger$
|
|
6798
|
+
logger$9.info('sdk webrtc toggle camera on', { id: session.id });
|
|
6799
6799
|
|
|
6800
6800
|
this._toggleVideo(session, false);
|
|
6801
6801
|
}
|
|
6802
6802
|
|
|
6803
6803
|
toggleCameraOff(session ) {
|
|
6804
|
-
logger$
|
|
6804
|
+
logger$9.info('sdk webrtc toggle camera off', { id: session.id });
|
|
6805
6805
|
|
|
6806
6806
|
this._toggleVideo(session, true);
|
|
6807
6807
|
}
|
|
@@ -6810,7 +6810,7 @@ class WebRTCClient extends Emitter {
|
|
|
6810
6810
|
const sessionId = this.getSipSessionId(session);
|
|
6811
6811
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
6812
6812
|
|
|
6813
|
-
logger$
|
|
6813
|
+
logger$9.info('sdk webrtc hold', {
|
|
6814
6814
|
sessionId,
|
|
6815
6815
|
keys: Object.keys(this.heldSessions),
|
|
6816
6816
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -6859,7 +6859,7 @@ class WebRTCClient extends Emitter {
|
|
|
6859
6859
|
const sessionId = this.getSipSessionId(session);
|
|
6860
6860
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
6861
6861
|
|
|
6862
|
-
logger$
|
|
6862
|
+
logger$9.info('sdk webrtc unhold', {
|
|
6863
6863
|
sessionId,
|
|
6864
6864
|
keys: Object.keys(this.heldSessions),
|
|
6865
6865
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7007,7 +7007,7 @@ class WebRTCClient extends Emitter {
|
|
|
7007
7007
|
if (!session.sessionDescriptionHandler) {
|
|
7008
7008
|
return;
|
|
7009
7009
|
}
|
|
7010
|
-
logger$
|
|
7010
|
+
logger$9.info('Sending DTMF', {
|
|
7011
7011
|
id: this.getSipSessionId(session),
|
|
7012
7012
|
tone,
|
|
7013
7013
|
});
|
|
@@ -7023,7 +7023,7 @@ class WebRTCClient extends Emitter {
|
|
|
7023
7023
|
transfer(session , target ) {
|
|
7024
7024
|
this.hold(session);
|
|
7025
7025
|
|
|
7026
|
-
logger$
|
|
7026
|
+
logger$9.info('Transfering a session', {
|
|
7027
7027
|
id: this.getSipSessionId(session),
|
|
7028
7028
|
target,
|
|
7029
7029
|
});
|
|
@@ -7045,17 +7045,17 @@ class WebRTCClient extends Emitter {
|
|
|
7045
7045
|
atxfer(session ) {
|
|
7046
7046
|
this.hold(session);
|
|
7047
7047
|
|
|
7048
|
-
logger$
|
|
7048
|
+
logger$9.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7049
7049
|
|
|
7050
7050
|
const result = {
|
|
7051
7051
|
newSession: null,
|
|
7052
7052
|
init: async (target ) => {
|
|
7053
|
-
logger$
|
|
7053
|
+
logger$9.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7054
7054
|
|
|
7055
7055
|
result.newSession = await this.call(target);
|
|
7056
7056
|
},
|
|
7057
7057
|
complete: () => {
|
|
7058
|
-
logger$
|
|
7058
|
+
logger$9.info('webrtc transfer completed', {
|
|
7059
7059
|
id: this.getSipSessionId(session),
|
|
7060
7060
|
referId: this.getSipSessionId(result.newSession),
|
|
7061
7061
|
});
|
|
@@ -7076,7 +7076,7 @@ class WebRTCClient extends Emitter {
|
|
|
7076
7076
|
return;
|
|
7077
7077
|
}
|
|
7078
7078
|
|
|
7079
|
-
logger$
|
|
7079
|
+
logger$9.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7080
7080
|
|
|
7081
7081
|
try {
|
|
7082
7082
|
sipSession.message({
|
|
@@ -7118,7 +7118,7 @@ class WebRTCClient extends Emitter {
|
|
|
7118
7118
|
}
|
|
7119
7119
|
|
|
7120
7120
|
changeAudioOutputVolume(volume ) {
|
|
7121
|
-
logger$
|
|
7121
|
+
logger$9.info('Changing audio output volume', { volume });
|
|
7122
7122
|
|
|
7123
7123
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7124
7124
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7130,7 +7130,7 @@ class WebRTCClient extends Emitter {
|
|
|
7130
7130
|
}
|
|
7131
7131
|
|
|
7132
7132
|
changeAudioOutputDevice(id ) {
|
|
7133
|
-
logger$
|
|
7133
|
+
logger$9.info('Changing audio output device', { id });
|
|
7134
7134
|
|
|
7135
7135
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7136
7136
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7147,7 +7147,7 @@ class WebRTCClient extends Emitter {
|
|
|
7147
7147
|
|
|
7148
7148
|
changeAudioInputDevice(id , session ) {
|
|
7149
7149
|
const currentId = this.getAudioDeviceId();
|
|
7150
|
-
logger$
|
|
7150
|
+
logger$9.info('setting audio input device', { id, currentId, session: !!session });
|
|
7151
7151
|
|
|
7152
7152
|
if (id === currentId) {
|
|
7153
7153
|
return null;
|
|
@@ -7193,7 +7193,7 @@ class WebRTCClient extends Emitter {
|
|
|
7193
7193
|
|
|
7194
7194
|
setVideoInputDevice(id ) {
|
|
7195
7195
|
const currentId = this.getVideoDeviceId();
|
|
7196
|
-
logger$
|
|
7196
|
+
logger$9.info('setting video input device', { id, currentId });
|
|
7197
7197
|
|
|
7198
7198
|
if (id === currentId) {
|
|
7199
7199
|
return null;
|
|
@@ -7218,7 +7218,7 @@ class WebRTCClient extends Emitter {
|
|
|
7218
7218
|
const sessionId = this.getSipSessionId(session);
|
|
7219
7219
|
const localStream = this.getLocalStream(sessionId);
|
|
7220
7220
|
|
|
7221
|
-
logger$
|
|
7221
|
+
logger$9.info('changing video input device', { id, sessionId });
|
|
7222
7222
|
|
|
7223
7223
|
// Release old video stream
|
|
7224
7224
|
if (localStream) {
|
|
@@ -7286,7 +7286,7 @@ class WebRTCClient extends Emitter {
|
|
|
7286
7286
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7287
7287
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7288
7288
|
|
|
7289
|
-
logger$
|
|
7289
|
+
logger$9.info('Sending reinvite', {
|
|
7290
7290
|
id: this.getSipSessionId(sipSession),
|
|
7291
7291
|
newConstraints,
|
|
7292
7292
|
conference,
|
|
@@ -7324,7 +7324,7 @@ class WebRTCClient extends Emitter {
|
|
|
7324
7324
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7325
7325
|
}
|
|
7326
7326
|
|
|
7327
|
-
logger$
|
|
7327
|
+
logger$9.info('on re-INVITE accepted', {
|
|
7328
7328
|
id: this.getSipSessionId(sipSession),
|
|
7329
7329
|
wasMuted,
|
|
7330
7330
|
shouldDoScreenSharing,
|
|
@@ -7342,7 +7342,7 @@ class WebRTCClient extends Emitter {
|
|
|
7342
7342
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7343
7343
|
}
|
|
7344
7344
|
|
|
7345
|
-
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7345
|
+
return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
|
|
7346
7346
|
},
|
|
7347
7347
|
},
|
|
7348
7348
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7499,7 +7499,7 @@ class WebRTCClient extends Emitter {
|
|
|
7499
7499
|
}
|
|
7500
7500
|
|
|
7501
7501
|
startHeartbeat() {
|
|
7502
|
-
logger$
|
|
7502
|
+
logger$9.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7503
7503
|
if (!this.userAgent) {
|
|
7504
7504
|
this.heartbeat.stop();
|
|
7505
7505
|
return;
|
|
@@ -7512,7 +7512,7 @@ class WebRTCClient extends Emitter {
|
|
|
7512
7512
|
}
|
|
7513
7513
|
|
|
7514
7514
|
stopHeartbeat() {
|
|
7515
|
-
logger$
|
|
7515
|
+
logger$9.info('sdk webrtc stop heartbeat');
|
|
7516
7516
|
this.heartbeat.stop();
|
|
7517
7517
|
}
|
|
7518
7518
|
|
|
@@ -7533,7 +7533,7 @@ class WebRTCClient extends Emitter {
|
|
|
7533
7533
|
}
|
|
7534
7534
|
|
|
7535
7535
|
attemptReconnection() {
|
|
7536
|
-
logger$
|
|
7536
|
+
logger$9.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7537
7537
|
if (!this.userAgent) {
|
|
7538
7538
|
return;
|
|
7539
7539
|
}
|
|
@@ -7558,7 +7558,7 @@ class WebRTCClient extends Emitter {
|
|
|
7558
7558
|
return;
|
|
7559
7559
|
}
|
|
7560
7560
|
|
|
7561
|
-
logger$
|
|
7561
|
+
logger$9.info('setting local media stream', {
|
|
7562
7562
|
sipSessionId,
|
|
7563
7563
|
tracks: newStream ? newStream.getTracks() : null,
|
|
7564
7564
|
});
|
|
@@ -7575,7 +7575,7 @@ class WebRTCClient extends Emitter {
|
|
|
7575
7575
|
|
|
7576
7576
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
7577
7577
|
|
|
7578
|
-
logger$
|
|
7578
|
+
logger$9.info('updating local stream', {
|
|
7579
7579
|
sipSessionId,
|
|
7580
7580
|
oldStream: !!oldStream,
|
|
7581
7581
|
tracks: newStream.getTracks(),
|
|
@@ -7595,7 +7595,7 @@ class WebRTCClient extends Emitter {
|
|
|
7595
7595
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
7596
7596
|
const pc = this.getPeerConnection(sessionId);
|
|
7597
7597
|
|
|
7598
|
-
logger$
|
|
7598
|
+
logger$9.info('Updating remote stream', {
|
|
7599
7599
|
sessionId,
|
|
7600
7600
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
7601
7601
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -7620,14 +7620,16 @@ class WebRTCClient extends Emitter {
|
|
|
7620
7620
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
7621
7621
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
7622
7622
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
7623
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
7623
7624
|
|
|
7624
|
-
logger$
|
|
7625
|
+
logger$9.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
7625
7626
|
|
|
7626
7627
|
return {
|
|
7627
7628
|
constraints: {
|
|
7628
7629
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
7629
7630
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
7630
|
-
video: screenSharing ? (isDesktop
|
|
7631
|
+
video: screenSharing ? (isDesktop
|
|
7632
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
7631
7633
|
: this._getVideoConstraints(enableVideo),
|
|
7632
7634
|
screen: screenSharing,
|
|
7633
7635
|
desktop: isDesktop,
|
|
@@ -7670,7 +7672,7 @@ class WebRTCClient extends Emitter {
|
|
|
7670
7672
|
}
|
|
7671
7673
|
|
|
7672
7674
|
_onTransportError() {
|
|
7673
|
-
logger$
|
|
7675
|
+
logger$9.error('on transport error');
|
|
7674
7676
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
7675
7677
|
this.attemptReconnection();
|
|
7676
7678
|
}
|
|
@@ -7679,7 +7681,7 @@ class WebRTCClient extends Emitter {
|
|
|
7679
7681
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
7680
7682
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
7681
7683
|
if (this.hasHeartbeat()) {
|
|
7682
|
-
logger$
|
|
7684
|
+
logger$9.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
7683
7685
|
|
|
7684
7686
|
this.heartbeat.onHeartbeat();
|
|
7685
7687
|
if (this.heartbeatCb) {
|
|
@@ -7690,7 +7692,7 @@ class WebRTCClient extends Emitter {
|
|
|
7690
7692
|
}
|
|
7691
7693
|
|
|
7692
7694
|
async _onHeartbeatTimeout() {
|
|
7693
|
-
logger$
|
|
7695
|
+
logger$9.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7694
7696
|
|
|
7695
7697
|
if (this.heartbeatTimeoutCb) {
|
|
7696
7698
|
this.heartbeatTimeoutCb();
|
|
@@ -7702,7 +7704,7 @@ class WebRTCClient extends Emitter {
|
|
|
7702
7704
|
try {
|
|
7703
7705
|
await this.userAgent.transport.disconnect();
|
|
7704
7706
|
} catch (e) {
|
|
7705
|
-
logger$
|
|
7707
|
+
logger$9.error('Transport disconnection after heartbeat timeout, error', e);
|
|
7706
7708
|
}
|
|
7707
7709
|
}
|
|
7708
7710
|
|
|
@@ -7735,31 +7737,31 @@ class WebRTCClient extends Emitter {
|
|
|
7735
7737
|
}
|
|
7736
7738
|
|
|
7737
7739
|
_connectIfNeeded() {
|
|
7738
|
-
logger$
|
|
7740
|
+
logger$9.info('connect if needed, checking', { connected: this.isConnected() });
|
|
7739
7741
|
if (!this.userAgent) {
|
|
7740
|
-
logger$
|
|
7742
|
+
logger$9.info('need to recreate User Agent');
|
|
7741
7743
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
7742
7744
|
}
|
|
7743
7745
|
|
|
7744
7746
|
if (this.isConnected()) {
|
|
7745
|
-
logger$
|
|
7747
|
+
logger$9.info('webrtc sdk, already connected');
|
|
7746
7748
|
return Promise.resolve();
|
|
7747
7749
|
}
|
|
7748
7750
|
|
|
7749
7751
|
if (this.isConnecting()) {
|
|
7750
|
-
logger$
|
|
7752
|
+
logger$9.info('webrtc sdk, already connecting...');
|
|
7751
7753
|
|
|
7752
7754
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
7753
7755
|
return this.connectionPromise;
|
|
7754
7756
|
}
|
|
7755
7757
|
|
|
7756
7758
|
if (this.connectionPromise) {
|
|
7757
|
-
logger$
|
|
7759
|
+
logger$9.info('webrtc sdk, connection promise connecting...');
|
|
7758
7760
|
// $FlowFixMe
|
|
7759
7761
|
return this.connectionPromise;
|
|
7760
7762
|
}
|
|
7761
7763
|
|
|
7762
|
-
logger$
|
|
7764
|
+
logger$9.info('WebRTC UA needs to connect');
|
|
7763
7765
|
|
|
7764
7766
|
// Force UA to reconnect
|
|
7765
7767
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -7884,7 +7886,7 @@ class WebRTCClient extends Emitter {
|
|
|
7884
7886
|
|
|
7885
7887
|
sdh.peerConnectionDelegate = {
|
|
7886
7888
|
onicecandidateerror: (error ) => {
|
|
7887
|
-
logger$
|
|
7889
|
+
logger$9.error('on icecandidate error', {
|
|
7888
7890
|
address: error.address,
|
|
7889
7891
|
port: error.port,
|
|
7890
7892
|
errorCode: error.errorCode,
|
|
@@ -7913,7 +7915,7 @@ class WebRTCClient extends Emitter {
|
|
|
7913
7915
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
7914
7916
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
7915
7917
|
}
|
|
7916
|
-
logger$
|
|
7918
|
+
logger$9.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
7917
7919
|
|
|
7918
7920
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
7919
7921
|
|
|
@@ -7929,12 +7931,12 @@ class WebRTCClient extends Emitter {
|
|
|
7929
7931
|
|
|
7930
7932
|
this._setupMedias(session);
|
|
7931
7933
|
|
|
7932
|
-
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
7934
|
+
return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
7933
7935
|
};
|
|
7934
7936
|
}
|
|
7935
7937
|
|
|
7936
7938
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
7937
|
-
logger$
|
|
7939
|
+
logger$9.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
7938
7940
|
|
|
7939
7941
|
this.storeSipSession(session);
|
|
7940
7942
|
|
|
@@ -7946,14 +7948,14 @@ class WebRTCClient extends Emitter {
|
|
|
7946
7948
|
const onTrack = (event ) => {
|
|
7947
7949
|
const isAudioOnly = this._isAudioOnly(session);
|
|
7948
7950
|
const { kind, label, readyState, id, muted } = event.track;
|
|
7949
|
-
logger$
|
|
7951
|
+
logger$9.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
7950
7952
|
|
|
7951
7953
|
// Stop video track in audio only mode
|
|
7952
7954
|
if (isAudioOnly && kind === 'video') {
|
|
7953
7955
|
event.track.stop();
|
|
7954
7956
|
}
|
|
7955
7957
|
|
|
7956
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
7958
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
7957
7959
|
};
|
|
7958
7960
|
|
|
7959
7961
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -7962,12 +7964,14 @@ class WebRTCClient extends Emitter {
|
|
|
7962
7964
|
|
|
7963
7965
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7964
7966
|
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7967
|
+
if (pc) {
|
|
7968
|
+
pc.oniceconnectionstatechange = () => {
|
|
7969
|
+
logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7970
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
7971
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
7972
|
+
}
|
|
7973
|
+
};
|
|
7974
|
+
}
|
|
7971
7975
|
|
|
7972
7976
|
if (withEvent) {
|
|
7973
7977
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8136,10 +8140,10 @@ class WebRTCClient extends Emitter {
|
|
|
8136
8140
|
|
|
8137
8141
|
_stopSendingStats(session ) {
|
|
8138
8142
|
const sessionId = this.getSipSessionId(session);
|
|
8139
|
-
logger$
|
|
8143
|
+
logger$9.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8140
8144
|
|
|
8141
8145
|
if (sessionId in this.statsIntervals) {
|
|
8142
|
-
logger$
|
|
8146
|
+
logger$9.trace('Stop sending stats for call', { sessionId });
|
|
8143
8147
|
this.statsIntervals[sessionId]();
|
|
8144
8148
|
delete this.statsIntervals[sessionId];
|
|
8145
8149
|
}
|
|
@@ -8155,7 +8159,7 @@ class WebRTCClient extends Emitter {
|
|
|
8155
8159
|
try {
|
|
8156
8160
|
await this.userAgent.transport.disconnect();
|
|
8157
8161
|
} catch (e) {
|
|
8158
|
-
logger$
|
|
8162
|
+
logger$9.error('WebRTC transport disconnect, error', e);
|
|
8159
8163
|
}
|
|
8160
8164
|
}
|
|
8161
8165
|
}
|
|
@@ -8177,13 +8181,17 @@ class WebRTCClient extends Emitter {
|
|
|
8177
8181
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8178
8182
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8179
8183
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8184
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8180
8185
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8181
8186
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8187
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8182
8188
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8183
8189
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8184
8190
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8185
|
-
let audioBytesSent = 0;
|
|
8186
|
-
let audioBytesReceived = 0;
|
|
8191
|
+
let audioBytesSent = 0; // content + header
|
|
8192
|
+
let audioBytesReceived = 0; // content + header
|
|
8193
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8194
|
+
let audioContentReceived = 0;
|
|
8187
8195
|
let videoBytesSent = 0;
|
|
8188
8196
|
let videoBytesReceived = 0;
|
|
8189
8197
|
let transportSent = 0;
|
|
@@ -8193,6 +8201,7 @@ class WebRTCClient extends Emitter {
|
|
|
8193
8201
|
stats.forEach(report => {
|
|
8194
8202
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8195
8203
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8204
|
+
audioContentSent += Number(report.bytesSent);
|
|
8196
8205
|
}
|
|
8197
8206
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8198
8207
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -8204,6 +8213,7 @@ class WebRTCClient extends Emitter {
|
|
|
8204
8213
|
packetsLost += Number(report.packetsLost);
|
|
8205
8214
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8206
8215
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8216
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8207
8217
|
}
|
|
8208
8218
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8209
8219
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -8232,10 +8242,17 @@ class WebRTCClient extends Emitter {
|
|
|
8232
8242
|
});
|
|
8233
8243
|
|
|
8234
8244
|
networkStats.packetsLost = packetsLost;
|
|
8245
|
+
|
|
8235
8246
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8236
8247
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8237
8248
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8238
8249
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8250
|
+
|
|
8251
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8252
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8253
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8254
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8255
|
+
|
|
8239
8256
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8240
8257
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8241
8258
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8249,7 +8266,7 @@ class WebRTCClient extends Emitter {
|
|
|
8249
8266
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8250
8267
|
+ networkStats.transportSent;
|
|
8251
8268
|
|
|
8252
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8269
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8253
8270
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8254
8271
|
}
|
|
8255
8272
|
|
|
@@ -8257,7 +8274,7 @@ class WebRTCClient extends Emitter {
|
|
|
8257
8274
|
|
|
8258
8275
|
//
|
|
8259
8276
|
|
|
8260
|
-
const SOCKET_EVENTS = {
|
|
8277
|
+
const SOCKET_EVENTS$1 = {
|
|
8261
8278
|
ON_OPEN: 'onopen',
|
|
8262
8279
|
ON_MESSAGE: 'onmessage',
|
|
8263
8280
|
ON_ERROR: 'onerror',
|
|
@@ -8353,7 +8370,7 @@ const BLACKLIST_EVENTS = [
|
|
|
8353
8370
|
];
|
|
8354
8371
|
|
|
8355
8372
|
const HEARTBEAT_ENGINE_VERSION = '20.09';
|
|
8356
|
-
const logger$
|
|
8373
|
+
const logger$8 = IssueReporter$1.loggerFor('wazo-ws');
|
|
8357
8374
|
const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
|
|
8358
8375
|
|
|
8359
8376
|
class WebSocketClient extends Emitter {
|
|
@@ -8402,24 +8419,24 @@ class WebSocketClient extends Emitter {
|
|
|
8402
8419
|
}
|
|
8403
8420
|
|
|
8404
8421
|
connect() {
|
|
8405
|
-
logger$
|
|
8422
|
+
logger$8.info('connect method started', { host: this.host, token: this.token });
|
|
8406
8423
|
this.socket = new ReconnectingWebSocket__default['default'](this._getUrl.bind(this), [], this.options);
|
|
8407
8424
|
if (this.options.binaryType) {
|
|
8408
8425
|
this.socket.binaryType = this.options.binaryType;
|
|
8409
8426
|
}
|
|
8410
8427
|
|
|
8411
8428
|
this.socket.onopen = () => {
|
|
8412
|
-
logger$
|
|
8413
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
8429
|
+
logger$8.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
8430
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
|
|
8414
8431
|
};
|
|
8415
8432
|
|
|
8416
8433
|
this.socket.onerror = event => {
|
|
8417
|
-
logger$
|
|
8418
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
8434
|
+
logger$8.error('on Wazo WS error', event.target);
|
|
8435
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
|
|
8419
8436
|
};
|
|
8420
8437
|
|
|
8421
8438
|
this.socket.onmessage = (event ) => {
|
|
8422
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
8439
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
|
|
8423
8440
|
|
|
8424
8441
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
8425
8442
|
let { name } = message;
|
|
@@ -8444,7 +8461,7 @@ class WebSocketClient extends Emitter {
|
|
|
8444
8461
|
|
|
8445
8462
|
this.socket.onclose = event => {
|
|
8446
8463
|
// Can't be converted to JSON (circular structure)
|
|
8447
|
-
logger$
|
|
8464
|
+
logger$8.info('on Wazo WS close', {
|
|
8448
8465
|
reason: event.reason,
|
|
8449
8466
|
code: event.code,
|
|
8450
8467
|
readyState: event.target.readyState,
|
|
@@ -8452,22 +8469,22 @@ class WebSocketClient extends Emitter {
|
|
|
8452
8469
|
token: this.token,
|
|
8453
8470
|
});
|
|
8454
8471
|
this.initialized = false;
|
|
8455
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
8472
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
|
|
8456
8473
|
|
|
8457
8474
|
switch (event.code) {
|
|
8458
8475
|
case 4002:
|
|
8459
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
8476
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
|
|
8460
8477
|
break;
|
|
8461
8478
|
}
|
|
8462
8479
|
};
|
|
8463
8480
|
|
|
8464
8481
|
this.socket.onerror = event => {
|
|
8465
|
-
logger$
|
|
8482
|
+
logger$8.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
|
|
8466
8483
|
};
|
|
8467
8484
|
}
|
|
8468
8485
|
|
|
8469
8486
|
close(force = false) {
|
|
8470
|
-
logger$
|
|
8487
|
+
logger$8.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
|
|
8471
8488
|
|
|
8472
8489
|
if (!this.socket) {
|
|
8473
8490
|
return;
|
|
@@ -8485,7 +8502,7 @@ class WebSocketClient extends Emitter {
|
|
|
8485
8502
|
|
|
8486
8503
|
updateToken(token ) {
|
|
8487
8504
|
this.token = token;
|
|
8488
|
-
logger$
|
|
8505
|
+
logger$8.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
|
|
8489
8506
|
|
|
8490
8507
|
if (this.socket) {
|
|
8491
8508
|
// If still connected, send the token to the WS
|
|
@@ -8503,7 +8520,7 @@ class WebSocketClient extends Emitter {
|
|
|
8503
8520
|
}
|
|
8504
8521
|
|
|
8505
8522
|
startHeartbeat() {
|
|
8506
|
-
logger$
|
|
8523
|
+
logger$8.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
|
|
8507
8524
|
|
|
8508
8525
|
if (!this.socket) {
|
|
8509
8526
|
this.heartbeat.stop();
|
|
@@ -8517,7 +8534,7 @@ class WebSocketClient extends Emitter {
|
|
|
8517
8534
|
}
|
|
8518
8535
|
|
|
8519
8536
|
stopHeartbeat() {
|
|
8520
|
-
logger$
|
|
8537
|
+
logger$8.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
|
|
8521
8538
|
|
|
8522
8539
|
this.heartbeat.stop();
|
|
8523
8540
|
}
|
|
@@ -8547,7 +8564,7 @@ class WebSocketClient extends Emitter {
|
|
|
8547
8564
|
}
|
|
8548
8565
|
|
|
8549
8566
|
reconnect(reason ) {
|
|
8550
|
-
logger$
|
|
8567
|
+
logger$8.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
|
|
8551
8568
|
if (!this.socket) {
|
|
8552
8569
|
return;
|
|
8553
8570
|
}
|
|
@@ -8572,7 +8589,7 @@ class WebSocketClient extends Emitter {
|
|
|
8572
8589
|
break;
|
|
8573
8590
|
case 'start':
|
|
8574
8591
|
this.initialized = true;
|
|
8575
|
-
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
8592
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
|
|
8576
8593
|
break;
|
|
8577
8594
|
default:
|
|
8578
8595
|
this.eventEmitter.emit('message', message);
|
|
@@ -8603,7 +8620,7 @@ class WebSocketClient extends Emitter {
|
|
|
8603
8620
|
this.close();
|
|
8604
8621
|
}
|
|
8605
8622
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
8606
|
-
logger$
|
|
8623
|
+
logger$8.log('Wazo WS url computed to reconnect', { url });
|
|
8607
8624
|
|
|
8608
8625
|
return url;
|
|
8609
8626
|
}
|
|
@@ -8611,15 +8628,15 @@ class WebSocketClient extends Emitter {
|
|
|
8611
8628
|
_onHeartbeat(message ) {
|
|
8612
8629
|
if (message.payload === 'pong') {
|
|
8613
8630
|
this.heartbeat.onHeartbeat();
|
|
8614
|
-
logger$
|
|
8631
|
+
logger$8.log('on heartbeat received from Wazo WS');
|
|
8615
8632
|
}
|
|
8616
8633
|
}
|
|
8617
8634
|
|
|
8618
8635
|
async _onHeartbeatTimeout() {
|
|
8619
|
-
logger$
|
|
8636
|
+
logger$8.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
8620
8637
|
|
|
8621
8638
|
this.close();
|
|
8622
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
8639
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
8623
8640
|
|
|
8624
8641
|
if (this.onHeartBeatTimeout) {
|
|
8625
8642
|
this.onHeartBeatTimeout();
|
|
@@ -8699,7 +8716,7 @@ WebSocketClient.eventLists = [
|
|
|
8699
8716
|
|
|
8700
8717
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
8701
8718
|
__proto__: null,
|
|
8702
|
-
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
8719
|
+
SOCKET_EVENTS: SOCKET_EVENTS$1,
|
|
8703
8720
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
8704
8721
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
8705
8722
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -8932,7 +8949,7 @@ class NotificationOptions {
|
|
|
8932
8949
|
|
|
8933
8950
|
|
|
8934
8951
|
// Represents a conference room, like `9000`.
|
|
8935
|
-
class Room {
|
|
8952
|
+
class Room$1 {
|
|
8936
8953
|
|
|
8937
8954
|
|
|
8938
8955
|
|
|
@@ -8953,7 +8970,7 @@ class Room {
|
|
|
8953
8970
|
}
|
|
8954
8971
|
|
|
8955
8972
|
connect(callSession ) {
|
|
8956
|
-
return new Room({ ...this, connectedCallSession: callSession });
|
|
8973
|
+
return new Room$1({ ...this, connectedCallSession: callSession });
|
|
8957
8974
|
}
|
|
8958
8975
|
|
|
8959
8976
|
has(callSession ) {
|
|
@@ -8962,7 +8979,7 @@ class Room {
|
|
|
8962
8979
|
|
|
8963
8980
|
addParticipant(uuid , extension , talking = null) {
|
|
8964
8981
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
8965
|
-
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
8982
|
+
return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
8966
8983
|
}
|
|
8967
8984
|
|
|
8968
8985
|
return this;
|
|
@@ -8981,7 +8998,7 @@ class Room {
|
|
|
8981
8998
|
updatedParticipants.push(participant);
|
|
8982
8999
|
}
|
|
8983
9000
|
|
|
8984
|
-
return new Room({ ...this, participants: updatedParticipants });
|
|
9001
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
8985
9002
|
}
|
|
8986
9003
|
|
|
8987
9004
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -8997,7 +9014,7 @@ class Room {
|
|
|
8997
9014
|
updatedParticipants.push(participant);
|
|
8998
9015
|
}
|
|
8999
9016
|
|
|
9000
|
-
return new Room({ ...this, participants: updatedParticipants });
|
|
9017
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
9001
9018
|
}
|
|
9002
9019
|
|
|
9003
9020
|
hasCallWithId(id ) {
|
|
@@ -9005,18 +9022,18 @@ class Room {
|
|
|
9005
9022
|
}
|
|
9006
9023
|
|
|
9007
9024
|
disconnect() {
|
|
9008
|
-
return new Room({ ...this, connectedCallSession: null });
|
|
9025
|
+
return new Room$1({ ...this, connectedCallSession: null });
|
|
9009
9026
|
}
|
|
9010
9027
|
|
|
9011
9028
|
removeParticipantWithUUID(uuid ) {
|
|
9012
|
-
return new Room({
|
|
9029
|
+
return new Room$1({
|
|
9013
9030
|
...this,
|
|
9014
9031
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
9015
9032
|
});
|
|
9016
9033
|
}
|
|
9017
9034
|
|
|
9018
9035
|
removeParticipantWithExtension(extension ) {
|
|
9019
|
-
return new Room({
|
|
9036
|
+
return new Room$1({
|
|
9020
9037
|
...this,
|
|
9021
9038
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
9022
9039
|
});
|
|
@@ -9027,7 +9044,7 @@ class Room {
|
|
|
9027
9044
|
}
|
|
9028
9045
|
|
|
9029
9046
|
static newFrom(room ) {
|
|
9030
|
-
return newFrom(room, Room);
|
|
9047
|
+
return newFrom(room, Room$1);
|
|
9031
9048
|
}
|
|
9032
9049
|
}
|
|
9033
9050
|
|
|
@@ -9170,8 +9187,8 @@ const ON_CALL_FAILED = 'onCallFailed';
|
|
|
9170
9187
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
9171
9188
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
9172
9189
|
const ON_MESSAGE = 'onMessage';
|
|
9173
|
-
const ON_REINVITE
|
|
9174
|
-
const ON_TRACK
|
|
9190
|
+
const ON_REINVITE = 'reinvite';
|
|
9191
|
+
const ON_TRACK = 'onTrack';
|
|
9175
9192
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
9176
9193
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
9177
9194
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -9186,15 +9203,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
9186
9203
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
9187
9204
|
const ON_CALL_ERROR = 'onCallError';
|
|
9188
9205
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
9189
|
-
const ON_NETWORK_STATS
|
|
9206
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
9190
9207
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
9191
9208
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
9192
|
-
const ON_DISCONNECTED
|
|
9209
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
9193
9210
|
|
|
9194
9211
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
9195
9212
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
9196
9213
|
|
|
9197
|
-
const events
|
|
9214
|
+
const events = [
|
|
9198
9215
|
ON_USER_AGENT,
|
|
9199
9216
|
ON_REGISTERED,
|
|
9200
9217
|
ON_UNREGISTERED,
|
|
@@ -9212,8 +9229,8 @@ const events$1 = [
|
|
|
9212
9229
|
ON_CALL_FAILED,
|
|
9213
9230
|
ON_CALL_ENDED,
|
|
9214
9231
|
ON_MESSAGE,
|
|
9215
|
-
ON_REINVITE
|
|
9216
|
-
ON_TRACK
|
|
9232
|
+
ON_REINVITE,
|
|
9233
|
+
ON_TRACK,
|
|
9217
9234
|
ON_AUDIO_STREAM,
|
|
9218
9235
|
ON_VIDEO_STREAM,
|
|
9219
9236
|
ON_REMOVE_STREAM,
|
|
@@ -9228,11 +9245,11 @@ const events$1 = [
|
|
|
9228
9245
|
ON_CALL_ERROR,
|
|
9229
9246
|
ON_CHAT,
|
|
9230
9247
|
ON_SIGNAL,
|
|
9231
|
-
ON_NETWORK_STATS
|
|
9232
|
-
ON_DISCONNECTED
|
|
9248
|
+
ON_NETWORK_STATS,
|
|
9249
|
+
ON_DISCONNECTED,
|
|
9233
9250
|
];
|
|
9234
9251
|
|
|
9235
|
-
const logger$
|
|
9252
|
+
const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
9236
9253
|
|
|
9237
9254
|
class WebRTCPhone extends Emitter {
|
|
9238
9255
|
|
|
@@ -9305,7 +9322,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9305
9322
|
}).catch(error => {
|
|
9306
9323
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
9307
9324
|
console.error('register error', error, error.message, error.stack);
|
|
9308
|
-
logger$
|
|
9325
|
+
logger$7.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
9309
9326
|
});
|
|
9310
9327
|
}
|
|
9311
9328
|
|
|
@@ -9320,7 +9337,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9320
9337
|
if (!this.client) {
|
|
9321
9338
|
return;
|
|
9322
9339
|
}
|
|
9323
|
-
logger$
|
|
9340
|
+
logger$7.info('WebRTC phone stop');
|
|
9324
9341
|
this.client.stop();
|
|
9325
9342
|
}
|
|
9326
9343
|
|
|
@@ -9335,11 +9352,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9335
9352
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
9336
9353
|
audioOnly = false, iceRestart = false) {
|
|
9337
9354
|
const sipSession = this.findSipSession(callSession);
|
|
9338
|
-
logger$
|
|
9355
|
+
logger$7.info('WebRTC phone - send reinvite', {
|
|
9339
9356
|
sessionId: sipSession ? sipSession.id : null,
|
|
9340
9357
|
constraints,
|
|
9341
9358
|
audioOnly,
|
|
9342
9359
|
conference,
|
|
9360
|
+
iceRestart,
|
|
9343
9361
|
});
|
|
9344
9362
|
|
|
9345
9363
|
if (!sipSession) {
|
|
@@ -9372,7 +9390,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9372
9390
|
}
|
|
9373
9391
|
|
|
9374
9392
|
startHeartbeat() {
|
|
9375
|
-
logger$
|
|
9393
|
+
logger$7.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
9376
9394
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
9377
9395
|
return;
|
|
9378
9396
|
}
|
|
@@ -9381,7 +9399,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9381
9399
|
}
|
|
9382
9400
|
|
|
9383
9401
|
stopHeartbeat() {
|
|
9384
|
-
logger$
|
|
9402
|
+
logger$7.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
9385
9403
|
if (!this.client) {
|
|
9386
9404
|
return;
|
|
9387
9405
|
}
|
|
@@ -9398,7 +9416,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9398
9416
|
}
|
|
9399
9417
|
|
|
9400
9418
|
reconnect() {
|
|
9401
|
-
logger$
|
|
9419
|
+
logger$7.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
9402
9420
|
if (!this.client) {
|
|
9403
9421
|
return;
|
|
9404
9422
|
}
|
|
@@ -9439,7 +9457,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9439
9457
|
return false;
|
|
9440
9458
|
}
|
|
9441
9459
|
|
|
9442
|
-
logger$
|
|
9460
|
+
logger$7.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
9443
9461
|
|
|
9444
9462
|
this.client.downgradeToAudio(sipSession);
|
|
9445
9463
|
|
|
@@ -9462,7 +9480,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9462
9480
|
return Promise.resolve(false);
|
|
9463
9481
|
}
|
|
9464
9482
|
|
|
9465
|
-
logger$
|
|
9483
|
+
logger$7.info('Upgrade to video', {
|
|
9466
9484
|
id: callSession ? callSession.getId() : null,
|
|
9467
9485
|
constraints,
|
|
9468
9486
|
isConference,
|
|
@@ -9502,7 +9520,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9502
9520
|
|
|
9503
9521
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
9504
9522
|
const sipSession = this.findSipSession(callSession);
|
|
9505
|
-
logger$
|
|
9523
|
+
logger$7.info('Sending reinvite message', {
|
|
9506
9524
|
id: callSession ? callSession.getId() : null,
|
|
9507
9525
|
isUpgrade,
|
|
9508
9526
|
});
|
|
@@ -9528,7 +9546,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9528
9546
|
// Monkey patch to know when canceled with the CANCEL message
|
|
9529
9547
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
9530
9548
|
sipSession._onCancel = (message ) => {
|
|
9531
|
-
logger$
|
|
9549
|
+
logger$7.trace('on sip session canceled', { callId: message.callId });
|
|
9532
9550
|
|
|
9533
9551
|
onCancel(message);
|
|
9534
9552
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -9556,13 +9574,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9556
9574
|
this.audioOutputVolume,
|
|
9557
9575
|
);
|
|
9558
9576
|
case sessionState.SessionState.Terminating:
|
|
9559
|
-
logger$
|
|
9577
|
+
logger$7.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
9560
9578
|
|
|
9561
9579
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
9562
9580
|
|
|
9563
9581
|
break;
|
|
9564
9582
|
case sessionState.SessionState.Terminated: {
|
|
9565
|
-
logger$
|
|
9583
|
+
logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9566
9584
|
|
|
9567
9585
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9568
9586
|
const callSession = this._createCallSession(sipSession);
|
|
@@ -9584,7 +9602,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9584
9602
|
const [stream] = event.streams;
|
|
9585
9603
|
const kind = event && event.track && event.track.kind;
|
|
9586
9604
|
|
|
9587
|
-
logger$
|
|
9605
|
+
logger$7.info('on track stream called on the peer connection', {
|
|
9588
9606
|
callId: this.getSipSessionId(sipSession),
|
|
9589
9607
|
streamId: stream ? stream.id : null,
|
|
9590
9608
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -9604,7 +9622,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9604
9622
|
};
|
|
9605
9623
|
|
|
9606
9624
|
peerConnection.onremovestream = event => {
|
|
9607
|
-
logger$
|
|
9625
|
+
logger$7.info('on remove stream called on the peer connection', {
|
|
9608
9626
|
id: event.stream.id,
|
|
9609
9627
|
tracks: event.stream.getTracks(),
|
|
9610
9628
|
});
|
|
@@ -9614,7 +9632,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9614
9632
|
}
|
|
9615
9633
|
|
|
9616
9634
|
async startScreenSharing(constraints , callSession ) {
|
|
9617
|
-
logger$
|
|
9635
|
+
logger$7.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
9618
9636
|
|
|
9619
9637
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
9620
9638
|
if (!screenShareStream) {
|
|
@@ -9654,7 +9672,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9654
9672
|
return;
|
|
9655
9673
|
}
|
|
9656
9674
|
|
|
9657
|
-
logger$
|
|
9675
|
+
logger$7.info('WebRTC phone - stop screen sharing', {
|
|
9658
9676
|
restoreLocalStream,
|
|
9659
9677
|
});
|
|
9660
9678
|
|
|
@@ -9710,7 +9728,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9710
9728
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
9711
9729
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9712
9730
|
|
|
9713
|
-
logger$
|
|
9731
|
+
logger$7.info('WebRTC phone - on screensharing', {
|
|
9714
9732
|
hadVideo,
|
|
9715
9733
|
id: this.getSipSessionId(sipSession),
|
|
9716
9734
|
screenTrack,
|
|
@@ -9718,7 +9736,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9718
9736
|
|
|
9719
9737
|
if (screenTrack) {
|
|
9720
9738
|
screenTrack.onended = () => {
|
|
9721
|
-
logger$
|
|
9739
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9722
9740
|
hadVideo,
|
|
9723
9741
|
id: this.getSipSessionId(sipSession),
|
|
9724
9742
|
screenTrack,
|
|
@@ -9749,7 +9767,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9749
9767
|
}
|
|
9750
9768
|
|
|
9751
9769
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9752
|
-
logger$
|
|
9770
|
+
logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9753
9771
|
|
|
9754
9772
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9755
9773
|
this.currentSipSession = sipSession;
|
|
@@ -9767,7 +9785,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9767
9785
|
}
|
|
9768
9786
|
|
|
9769
9787
|
changeAudioDevice(id ) {
|
|
9770
|
-
logger$
|
|
9788
|
+
logger$7.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9771
9789
|
this.audioOutputDeviceId = id;
|
|
9772
9790
|
this.client.changeAudioOutputDevice(id);
|
|
9773
9791
|
}
|
|
@@ -9777,14 +9795,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9777
9795
|
}
|
|
9778
9796
|
|
|
9779
9797
|
changeRingDevice(id ) {
|
|
9780
|
-
logger$
|
|
9798
|
+
logger$7.info('WebRTC phone - changing ring device', { id });
|
|
9781
9799
|
|
|
9782
9800
|
this.audioRingDeviceId = id;
|
|
9783
9801
|
}
|
|
9784
9802
|
|
|
9785
9803
|
// volume is a value between 0 and 1
|
|
9786
9804
|
changeAudioVolume(volume ) {
|
|
9787
|
-
logger$
|
|
9805
|
+
logger$7.info('WebRTC phone - changing audio volume', { volume });
|
|
9788
9806
|
|
|
9789
9807
|
this.audioOutputVolume = volume;
|
|
9790
9808
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9792,31 +9810,31 @@ class WebRTCPhone extends Emitter {
|
|
|
9792
9810
|
|
|
9793
9811
|
// volume is a value between 0 and 1
|
|
9794
9812
|
changeRingVolume(volume ) {
|
|
9795
|
-
logger$
|
|
9813
|
+
logger$7.info('WebRTC phone - changing ring volume', { volume });
|
|
9796
9814
|
|
|
9797
9815
|
this.audioRingVolume = volume;
|
|
9798
9816
|
}
|
|
9799
9817
|
|
|
9800
9818
|
changeAudioInputDevice(id ) {
|
|
9801
|
-
logger$
|
|
9819
|
+
logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9802
9820
|
|
|
9803
9821
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9804
9822
|
}
|
|
9805
9823
|
|
|
9806
9824
|
changeVideoInputDevice(id ) {
|
|
9807
|
-
logger$
|
|
9825
|
+
logger$7.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9808
9826
|
|
|
9809
9827
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9810
9828
|
}
|
|
9811
9829
|
|
|
9812
9830
|
changeSessionVideoInputDevice(id ) {
|
|
9813
|
-
logger$
|
|
9831
|
+
logger$7.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9814
9832
|
|
|
9815
9833
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9816
9834
|
}
|
|
9817
9835
|
|
|
9818
9836
|
_onCallTerminated(sipSession ) {
|
|
9819
|
-
logger$
|
|
9837
|
+
logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9820
9838
|
|
|
9821
9839
|
const callSession = this._createCallSession(sipSession);
|
|
9822
9840
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
@@ -9850,7 +9868,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9850
9868
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9851
9869
|
|
|
9852
9870
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9853
|
-
logger$
|
|
9871
|
+
logger$7.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9854
9872
|
sipId: sipSession.id,
|
|
9855
9873
|
shouldRetrigger,
|
|
9856
9874
|
hasIncomingCallSession,
|
|
@@ -9941,37 +9959,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9941
9959
|
|
|
9942
9960
|
// Deprecated
|
|
9943
9961
|
getLocalStreamForCall(callSession ) {
|
|
9944
|
-
logger$
|
|
9962
|
+
logger$7.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9945
9963
|
|
|
9946
9964
|
return this.getLocalStream(callSession);
|
|
9947
9965
|
}
|
|
9948
9966
|
|
|
9949
9967
|
// Deprecated
|
|
9950
9968
|
getRemoteStreamForCall(callSession ) {
|
|
9951
|
-
logger$
|
|
9969
|
+
logger$7.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9952
9970
|
|
|
9953
9971
|
return this.getRemoteVideoStream(callSession);
|
|
9954
9972
|
}
|
|
9955
9973
|
|
|
9956
9974
|
getRemoteStreamsForCall(callSession ) {
|
|
9957
|
-
logger$
|
|
9975
|
+
logger$7.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9958
9976
|
|
|
9959
9977
|
return this.getRemoteStream(callSession);
|
|
9960
9978
|
}
|
|
9961
9979
|
|
|
9962
9980
|
accept(callSession , cameraEnabled ) {
|
|
9963
|
-
logger$
|
|
9981
|
+
logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9964
9982
|
if (this.currentSipSession) {
|
|
9965
9983
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9966
9984
|
}
|
|
9967
9985
|
|
|
9968
9986
|
if (!callSession) {
|
|
9969
|
-
logger$
|
|
9987
|
+
logger$7.warn('no CallSession to accept.');
|
|
9970
9988
|
return Promise.resolve(null);
|
|
9971
9989
|
}
|
|
9972
9990
|
|
|
9973
9991
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9974
|
-
logger$
|
|
9992
|
+
logger$7.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9975
9993
|
return Promise.resolve(callSession.sipCallId);
|
|
9976
9994
|
}
|
|
9977
9995
|
|
|
@@ -9983,24 +10001,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9983
10001
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9984
10002
|
if (sipSession) {
|
|
9985
10003
|
if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
|
|
9986
|
-
logger$
|
|
10004
|
+
logger$7.warn('Trying to answer a terminated sipSession.');
|
|
9987
10005
|
|
|
9988
10006
|
return Promise.resolve(null);
|
|
9989
10007
|
}
|
|
9990
10008
|
|
|
9991
|
-
logger$
|
|
10009
|
+
logger$7.info('accept call, session found', { sipId: sipSession.id });
|
|
9992
10010
|
|
|
9993
10011
|
// $FlowFixMe
|
|
9994
10012
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9995
10013
|
return callSession.sipCallId;
|
|
9996
10014
|
}).catch(e => {
|
|
9997
|
-
logger$
|
|
10015
|
+
logger$7.error(e);
|
|
9998
10016
|
this.endCurrentCall(callSession);
|
|
9999
10017
|
throw e;
|
|
10000
10018
|
});
|
|
10001
10019
|
}
|
|
10002
10020
|
|
|
10003
|
-
logger$
|
|
10021
|
+
logger$7.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
10004
10022
|
|
|
10005
10023
|
return Promise.resolve(null);
|
|
10006
10024
|
}
|
|
@@ -10010,7 +10028,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10010
10028
|
}
|
|
10011
10029
|
|
|
10012
10030
|
async reject(callSession ) {
|
|
10013
|
-
logger$
|
|
10031
|
+
logger$7.info('reject WebRTC called', { id: callSession.getId() });
|
|
10014
10032
|
|
|
10015
10033
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
10016
10034
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -10022,14 +10040,14 @@ class WebRTCPhone extends Emitter {
|
|
|
10022
10040
|
|
|
10023
10041
|
const sipSession = this.findSipSession(callSession);
|
|
10024
10042
|
if (sipSession) {
|
|
10025
|
-
logger$
|
|
10043
|
+
logger$7.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
10026
10044
|
|
|
10027
10045
|
this.client.hangup(sipSession);
|
|
10028
10046
|
}
|
|
10029
10047
|
}
|
|
10030
10048
|
|
|
10031
10049
|
async ignore(callSession ) {
|
|
10032
|
-
logger$
|
|
10050
|
+
logger$7.info('WebRTC ignore', { id: callSession.getId() });
|
|
10033
10051
|
|
|
10034
10052
|
// kill the ring
|
|
10035
10053
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -10041,14 +10059,14 @@ class WebRTCPhone extends Emitter {
|
|
|
10041
10059
|
const sipSession = this.findSipSession(callSession);
|
|
10042
10060
|
|
|
10043
10061
|
if (sipSession) {
|
|
10044
|
-
logger$
|
|
10062
|
+
logger$7.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
10045
10063
|
|
|
10046
10064
|
return this.client.atxfer(sipSession);
|
|
10047
10065
|
}
|
|
10048
10066
|
}
|
|
10049
10067
|
|
|
10050
10068
|
hold(callSession , withEvent = true, isConference = false) {
|
|
10051
|
-
logger$
|
|
10069
|
+
logger$7.info('WebRTC hold', { id: callSession.getId() });
|
|
10052
10070
|
|
|
10053
10071
|
const sipSession = this.findSipSession(callSession);
|
|
10054
10072
|
|
|
@@ -10063,18 +10081,18 @@ class WebRTCPhone extends Emitter {
|
|
|
10063
10081
|
}
|
|
10064
10082
|
|
|
10065
10083
|
resume(callSession , isConference = false, withEvent = true) {
|
|
10066
|
-
logger$
|
|
10084
|
+
logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
10067
10085
|
|
|
10068
10086
|
const sipSession = this.findSipSession(callSession);
|
|
10069
10087
|
if (!sipSession) {
|
|
10070
10088
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
10071
10089
|
}
|
|
10072
10090
|
|
|
10073
|
-
logger$
|
|
10091
|
+
logger$7.info('WebRTC resuming', { sipId: sipSession.id });
|
|
10074
10092
|
|
|
10075
10093
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
10076
10094
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
10077
|
-
logger$
|
|
10095
|
+
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
10078
10096
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
10079
10097
|
}
|
|
10080
10098
|
|
|
@@ -10099,7 +10117,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10099
10117
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10100
10118
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
10101
10119
|
|
|
10102
|
-
logger$
|
|
10120
|
+
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
10103
10121
|
|
|
10104
10122
|
// Stop screenshre if needed
|
|
10105
10123
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -10130,7 +10148,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10130
10148
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
10131
10149
|
}
|
|
10132
10150
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10133
|
-
logger$
|
|
10151
|
+
logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
10134
10152
|
|
|
10135
10153
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
10136
10154
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -10174,14 +10192,14 @@ class WebRTCPhone extends Emitter {
|
|
|
10174
10192
|
}
|
|
10175
10193
|
|
|
10176
10194
|
mute(callSession , withEvent = true) {
|
|
10177
|
-
logger$
|
|
10195
|
+
logger$7.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
10178
10196
|
|
|
10179
10197
|
const sipSession = this.findSipSession(callSession);
|
|
10180
10198
|
if (!sipSession) {
|
|
10181
10199
|
return;
|
|
10182
10200
|
}
|
|
10183
10201
|
|
|
10184
|
-
logger$
|
|
10202
|
+
logger$7.info('WebRTC muting', { sipId: sipSession.id });
|
|
10185
10203
|
this.client.mute(sipSession);
|
|
10186
10204
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
10187
10205
|
|
|
@@ -10195,14 +10213,14 @@ class WebRTCPhone extends Emitter {
|
|
|
10195
10213
|
}
|
|
10196
10214
|
|
|
10197
10215
|
unmute(callSession , withEvent = true) {
|
|
10198
|
-
logger$
|
|
10216
|
+
logger$7.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
10199
10217
|
|
|
10200
10218
|
const sipSession = this.findSipSession(callSession);
|
|
10201
10219
|
if (!sipSession) {
|
|
10202
10220
|
return;
|
|
10203
10221
|
}
|
|
10204
10222
|
|
|
10205
|
-
logger$
|
|
10223
|
+
logger$7.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
10206
10224
|
this.client.unmute(sipSession);
|
|
10207
10225
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
10208
10226
|
|
|
@@ -10229,7 +10247,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10229
10247
|
if (!sipSession) {
|
|
10230
10248
|
return;
|
|
10231
10249
|
}
|
|
10232
|
-
logger$
|
|
10250
|
+
logger$7.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
10233
10251
|
|
|
10234
10252
|
this.client.toggleCameraOn(sipSession);
|
|
10235
10253
|
|
|
@@ -10241,7 +10259,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10241
10259
|
if (!sipSession) {
|
|
10242
10260
|
return;
|
|
10243
10261
|
}
|
|
10244
|
-
logger$
|
|
10262
|
+
logger$7.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
10245
10263
|
|
|
10246
10264
|
this.client.toggleCameraOff(sipSession);
|
|
10247
10265
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -10253,7 +10271,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10253
10271
|
return;
|
|
10254
10272
|
}
|
|
10255
10273
|
|
|
10256
|
-
logger$
|
|
10274
|
+
logger$7.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
10257
10275
|
this.client.sendDTMF(sipSession, tone);
|
|
10258
10276
|
}
|
|
10259
10277
|
|
|
@@ -10261,7 +10279,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10261
10279
|
// @TODO: line is not used here
|
|
10262
10280
|
async makeCall(number , line , cameraEnabled ,
|
|
10263
10281
|
audioOnly = false, conference = false) {
|
|
10264
|
-
logger$
|
|
10282
|
+
logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
10265
10283
|
if (!number) {
|
|
10266
10284
|
return Promise.resolve(null);
|
|
10267
10285
|
}
|
|
@@ -10271,7 +10289,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10271
10289
|
}
|
|
10272
10290
|
if (this.currentSipSession) {
|
|
10273
10291
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
10274
|
-
logger$
|
|
10292
|
+
logger$7.warn('Unable to hold current session when making another call', e);
|
|
10275
10293
|
});
|
|
10276
10294
|
}
|
|
10277
10295
|
|
|
@@ -10281,7 +10299,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10281
10299
|
this._bindEvents(sipSession);
|
|
10282
10300
|
} catch (error) {
|
|
10283
10301
|
console.warn(error);
|
|
10284
|
-
logger$
|
|
10302
|
+
logger$7.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
10285
10303
|
return Promise.resolve(null);
|
|
10286
10304
|
}
|
|
10287
10305
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
@@ -10309,7 +10327,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10309
10327
|
return;
|
|
10310
10328
|
}
|
|
10311
10329
|
|
|
10312
|
-
logger$
|
|
10330
|
+
logger$7.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
10313
10331
|
|
|
10314
10332
|
this.client.transfer(sipSession, target);
|
|
10315
10333
|
}
|
|
@@ -10318,7 +10336,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10318
10336
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
10319
10337
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
10320
10338
|
|
|
10321
|
-
logger$
|
|
10339
|
+
logger$7.info('WebRTC indirect transfer', {
|
|
10322
10340
|
sipId: sipSession ? sipSession.id : null,
|
|
10323
10341
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
10324
10342
|
});
|
|
@@ -10357,7 +10375,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10357
10375
|
return false;
|
|
10358
10376
|
}
|
|
10359
10377
|
|
|
10360
|
-
logger$
|
|
10378
|
+
logger$7.info('WebRTC hangup', { sipId: sipSession.id });
|
|
10361
10379
|
|
|
10362
10380
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
10363
10381
|
|
|
@@ -10403,7 +10421,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10403
10421
|
endCurrentCall(callSession ) {
|
|
10404
10422
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
10405
10423
|
|
|
10406
|
-
logger$
|
|
10424
|
+
logger$7.info('Ending current call', {
|
|
10407
10425
|
id: callSession ? callSession.getId() : null,
|
|
10408
10426
|
isCurrent,
|
|
10409
10427
|
});
|
|
@@ -10427,7 +10445,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10427
10445
|
}
|
|
10428
10446
|
|
|
10429
10447
|
async close() {
|
|
10430
|
-
logger$
|
|
10448
|
+
logger$7.info('WebRTC close');
|
|
10431
10449
|
|
|
10432
10450
|
try {
|
|
10433
10451
|
await Promise.race([
|
|
@@ -10435,7 +10453,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10435
10453
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
10436
10454
|
]);
|
|
10437
10455
|
} catch (e) {
|
|
10438
|
-
logger$
|
|
10456
|
+
logger$7.error('WebRTC close, unregister error', e);
|
|
10439
10457
|
}
|
|
10440
10458
|
|
|
10441
10459
|
this.client.close();
|
|
@@ -10453,12 +10471,12 @@ class WebRTCPhone extends Emitter {
|
|
|
10453
10471
|
}
|
|
10454
10472
|
|
|
10455
10473
|
enableRinging() {
|
|
10456
|
-
logger$
|
|
10474
|
+
logger$7.info('WebRTC enable ringing');
|
|
10457
10475
|
this.ringingEnabled = true;
|
|
10458
10476
|
}
|
|
10459
10477
|
|
|
10460
10478
|
disableRinging() {
|
|
10461
|
-
logger$
|
|
10479
|
+
logger$7.info('WebRTC disable ringing');
|
|
10462
10480
|
this.ringingEnabled = false;
|
|
10463
10481
|
}
|
|
10464
10482
|
|
|
@@ -10498,7 +10516,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10498
10516
|
|
|
10499
10517
|
// Deprecated
|
|
10500
10518
|
getLocalMediaStream(callSession ) {
|
|
10501
|
-
logger$
|
|
10519
|
+
logger$7.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
10502
10520
|
return this.getLocalStream(callSession);
|
|
10503
10521
|
}
|
|
10504
10522
|
|
|
@@ -10540,7 +10558,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10540
10558
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
10541
10559
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
10542
10560
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
10543
|
-
logger$
|
|
10561
|
+
logger$7.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
10544
10562
|
|
|
10545
10563
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
10546
10564
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -10563,7 +10581,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10563
10581
|
});
|
|
10564
10582
|
|
|
10565
10583
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
10566
|
-
logger$
|
|
10584
|
+
logger$7.info('WebRTC on reinvite', {
|
|
10567
10585
|
sessionId: args[0].id,
|
|
10568
10586
|
inviteId: args[1].id,
|
|
10569
10587
|
updatedCalleeName: args[2],
|
|
@@ -10583,7 +10601,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10583
10601
|
});
|
|
10584
10602
|
|
|
10585
10603
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
10586
|
-
logger$
|
|
10604
|
+
logger$7.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
10587
10605
|
|
|
10588
10606
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
10589
10607
|
|
|
@@ -10594,22 +10612,22 @@ class WebRTCPhone extends Emitter {
|
|
|
10594
10612
|
this.client.on('ended', () => {});
|
|
10595
10613
|
|
|
10596
10614
|
this.client.on(this.client.ON_ERROR, e => {
|
|
10597
|
-
logger$
|
|
10615
|
+
logger$7.error('WebRTC error', e);
|
|
10598
10616
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10599
10617
|
});
|
|
10600
10618
|
|
|
10601
10619
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10602
|
-
logger$
|
|
10620
|
+
logger$7.info('WebRTC unregistered');
|
|
10603
10621
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10604
10622
|
});
|
|
10605
10623
|
|
|
10606
10624
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
10607
|
-
logger$
|
|
10608
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
10625
|
+
logger$7.info('WebRTC disconnected');
|
|
10626
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10609
10627
|
});
|
|
10610
10628
|
|
|
10611
10629
|
this.client.on(this.client.REGISTERED, () => {
|
|
10612
|
-
logger$
|
|
10630
|
+
logger$7.info('WebRTC registered', {
|
|
10613
10631
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
10614
10632
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
10615
10633
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -10630,19 +10648,19 @@ class WebRTCPhone extends Emitter {
|
|
|
10630
10648
|
// Send reinvite with iceRestart
|
|
10631
10649
|
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10632
10650
|
} catch (e) {
|
|
10633
|
-
logger$
|
|
10651
|
+
logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10634
10652
|
}
|
|
10635
10653
|
}
|
|
10636
10654
|
});
|
|
10637
10655
|
|
|
10638
10656
|
this.client.on(this.client.CONNECTED, () => {
|
|
10639
|
-
logger$
|
|
10657
|
+
logger$7.info('WebRTC client connected');
|
|
10640
10658
|
|
|
10641
10659
|
this.stopHeartbeat();
|
|
10642
10660
|
});
|
|
10643
10661
|
|
|
10644
10662
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
10645
|
-
logger$
|
|
10663
|
+
logger$7.info('WebRTC client disconnected');
|
|
10646
10664
|
|
|
10647
10665
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10648
10666
|
|
|
@@ -10656,7 +10674,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10656
10674
|
});
|
|
10657
10675
|
|
|
10658
10676
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
10659
|
-
this.eventEmitter.emit(ON_TRACK
|
|
10677
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
10660
10678
|
});
|
|
10661
10679
|
|
|
10662
10680
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -10671,7 +10689,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10671
10689
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
10672
10690
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
10673
10691
|
|
|
10674
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
10692
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
10675
10693
|
});
|
|
10676
10694
|
|
|
10677
10695
|
// Used when upgrading directly in screenshare mode
|
|
@@ -10680,7 +10698,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10680
10698
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
10681
10699
|
const callSession = this.callSessions[sipSessionId];
|
|
10682
10700
|
|
|
10683
|
-
logger$
|
|
10701
|
+
logger$7.info('Updrading directly in screensharing mode', {
|
|
10684
10702
|
sipSessionId,
|
|
10685
10703
|
tracks: localStream ? localStream.getTracks() : null,
|
|
10686
10704
|
});
|
|
@@ -10858,8 +10876,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10858
10876
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10859
10877
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10860
10878
|
ON_MESSAGE: ON_MESSAGE,
|
|
10861
|
-
ON_REINVITE: ON_REINVITE
|
|
10862
|
-
ON_TRACK: ON_TRACK
|
|
10879
|
+
ON_REINVITE: ON_REINVITE,
|
|
10880
|
+
ON_TRACK: ON_TRACK,
|
|
10863
10881
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10864
10882
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10865
10883
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10874,13 +10892,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10874
10892
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10875
10893
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10876
10894
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10877
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS
|
|
10895
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10878
10896
|
ON_CHAT: ON_CHAT,
|
|
10879
10897
|
ON_SIGNAL: ON_SIGNAL,
|
|
10880
|
-
ON_DISCONNECTED: ON_DISCONNECTED
|
|
10898
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10881
10899
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10882
10900
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10883
|
-
events: events
|
|
10901
|
+
events: events,
|
|
10884
10902
|
'default': WebRTCPhone
|
|
10885
10903
|
});
|
|
10886
10904
|
|
|
@@ -11051,11 +11069,11 @@ var wazoWebsocket = {
|
|
|
11051
11069
|
resolve();
|
|
11052
11070
|
};
|
|
11053
11071
|
|
|
11054
|
-
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
11072
|
+
client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
|
|
11055
11073
|
handleError(`Connection error : ${error}`);
|
|
11056
11074
|
});
|
|
11057
11075
|
|
|
11058
|
-
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
11076
|
+
client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
|
|
11059
11077
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
11060
11078
|
client.setOnHeartbeatTimeout(() => {
|
|
11061
11079
|
handleError('No response to heartbeat');
|
|
@@ -11156,7 +11174,7 @@ var webrtc = {
|
|
|
11156
11174
|
}),
|
|
11157
11175
|
};
|
|
11158
11176
|
|
|
11159
|
-
const parseCandidate
|
|
11177
|
+
const parseCandidate = line => {
|
|
11160
11178
|
let parts;
|
|
11161
11179
|
// Parse both variants.
|
|
11162
11180
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -11247,7 +11265,7 @@ var SymmetricNat = {
|
|
|
11247
11265
|
}
|
|
11248
11266
|
|
|
11249
11267
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
11250
|
-
const cand = parseCandidate
|
|
11268
|
+
const cand = parseCandidate(e.candidate.candidate);
|
|
11251
11269
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
11252
11270
|
candidates[cand.relatedPort].push(cand.port);
|
|
11253
11271
|
} else if (!e.candidate) {
|
|
@@ -11315,7 +11333,7 @@ var iceIpv4 = {
|
|
|
11315
11333
|
const rawCandidate = e.candidate.candidate;
|
|
11316
11334
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
11317
11335
|
hasSrflxOrRelay = true;
|
|
11318
|
-
const candidate = parseCandidate
|
|
11336
|
+
const candidate = parseCandidate(e.candidate.candidate);
|
|
11319
11337
|
ips.push(candidate.ip);
|
|
11320
11338
|
}
|
|
11321
11339
|
} else if (!e.candidate) {
|
|
@@ -11485,7 +11503,7 @@ const getCallableNumber = (number , country ) => {
|
|
|
11485
11503
|
class InvalidSubscription extends Error {}
|
|
11486
11504
|
class InvalidAuthorization extends Error {}
|
|
11487
11505
|
|
|
11488
|
-
const logger$
|
|
11506
|
+
const logger$5 = IssueReporter$1.loggerFor('simple-auth');
|
|
11489
11507
|
|
|
11490
11508
|
class Auth {
|
|
11491
11509
|
|
|
@@ -11520,7 +11538,7 @@ class Auth {
|
|
|
11520
11538
|
setApiClientId(this.clientId);
|
|
11521
11539
|
setRefreshExpiration(this.expiration);
|
|
11522
11540
|
setOnRefreshToken((token , session ) => {
|
|
11523
|
-
logger$
|
|
11541
|
+
logger$5.info('on refresh token done', { token });
|
|
11524
11542
|
setApiToken(token);
|
|
11525
11543
|
Wazo.Websocket.updateToken(token);
|
|
11526
11544
|
|
|
@@ -11565,7 +11583,7 @@ class Auth {
|
|
|
11565
11583
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
11566
11584
|
return this._onAuthenticated(rawSession);
|
|
11567
11585
|
} catch (e) {
|
|
11568
|
-
logger$
|
|
11586
|
+
logger$5.error('on validate token error', e);
|
|
11569
11587
|
console.warn(e);
|
|
11570
11588
|
return false;
|
|
11571
11589
|
}
|
|
@@ -11921,7 +11939,7 @@ class AdHocAPIConference {
|
|
|
11921
11939
|
|
|
11922
11940
|
//
|
|
11923
11941
|
|
|
11924
|
-
const logger$
|
|
11942
|
+
const logger$4 = IssueReporter$1.loggerFor('simple-phone');
|
|
11925
11943
|
const sipLogger = IssueReporter$1.loggerFor('sip.js');
|
|
11926
11944
|
const protocolLogger = IssueReporter$1.loggerFor('sip');
|
|
11927
11945
|
|
|
@@ -12028,7 +12046,7 @@ class Phone extends Emitter {
|
|
|
12028
12046
|
async disconnect() {
|
|
12029
12047
|
if (this.phone) {
|
|
12030
12048
|
if (this.phone.hasAnActiveCall()) {
|
|
12031
|
-
logger$
|
|
12049
|
+
logger$4.info('hangup call on disconnect');
|
|
12032
12050
|
// $FlowFixMe
|
|
12033
12051
|
await this.phone.hangup();
|
|
12034
12052
|
}
|
|
@@ -12051,13 +12069,13 @@ class Phone extends Emitter {
|
|
|
12051
12069
|
}
|
|
12052
12070
|
|
|
12053
12071
|
async hangup(callSession ) {
|
|
12054
|
-
logger$
|
|
12072
|
+
logger$4.info('hangup via simple phone', { callId: callSession.getId() });
|
|
12055
12073
|
|
|
12056
12074
|
return this.phone && this.phone.hangup(callSession);
|
|
12057
12075
|
}
|
|
12058
12076
|
|
|
12059
12077
|
async accept(callSession , cameraEnabled ) {
|
|
12060
|
-
logger$
|
|
12078
|
+
logger$4.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
|
|
12061
12079
|
|
|
12062
12080
|
return this.phone && this.phone.accept(callSession, cameraEnabled);
|
|
12063
12081
|
}
|
|
@@ -12096,7 +12114,7 @@ class Phone extends Emitter {
|
|
|
12096
12114
|
muteViaAPI(callSession ) {
|
|
12097
12115
|
if (callSession && callSession.callId) {
|
|
12098
12116
|
Wazo.getApiClient().calld.mute(callSession.callId).catch(e => {
|
|
12099
|
-
logger$
|
|
12117
|
+
logger$4.error('Mute via API, error', e);
|
|
12100
12118
|
});
|
|
12101
12119
|
}
|
|
12102
12120
|
}
|
|
@@ -12104,7 +12122,7 @@ class Phone extends Emitter {
|
|
|
12104
12122
|
unmuteViaAPI(callSession ) {
|
|
12105
12123
|
if (callSession && callSession.callId) {
|
|
12106
12124
|
Wazo.getApiClient().calld.unmute(callSession.callId).catch(e => {
|
|
12107
|
-
logger$
|
|
12125
|
+
logger$4.error('Unmute via API, error', e);
|
|
12108
12126
|
});
|
|
12109
12127
|
}
|
|
12110
12128
|
}
|
|
@@ -12212,7 +12230,7 @@ class Phone extends Emitter {
|
|
|
12212
12230
|
|
|
12213
12231
|
// @Deprecated
|
|
12214
12232
|
getLocalMediaStream(callSession ) {
|
|
12215
|
-
logger$
|
|
12233
|
+
logger$4.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
|
|
12216
12234
|
|
|
12217
12235
|
return this.phone && this.phone.getLocalStream(callSession);
|
|
12218
12236
|
}
|
|
@@ -12235,20 +12253,20 @@ class Phone extends Emitter {
|
|
|
12235
12253
|
|
|
12236
12254
|
// @Deprecated
|
|
12237
12255
|
getRemoteStreamForCall(callSession ) {
|
|
12238
|
-
logger$
|
|
12256
|
+
logger$4.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
|
|
12239
12257
|
return this.getRemoteStream(callSession);
|
|
12240
12258
|
}
|
|
12241
12259
|
|
|
12242
12260
|
// Returns remote streams directly from the peerConnection
|
|
12243
12261
|
// @Deprecated
|
|
12244
12262
|
getRemoteStreamsForCall(callSession ) {
|
|
12245
|
-
logger$
|
|
12263
|
+
logger$4.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
|
|
12246
12264
|
return this.getLocalStream(callSession);
|
|
12247
12265
|
}
|
|
12248
12266
|
|
|
12249
12267
|
// @Deprecated
|
|
12250
12268
|
getRemoteVideoStreamForCall(callSession ) {
|
|
12251
|
-
logger$
|
|
12269
|
+
logger$4.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
|
|
12252
12270
|
|
|
12253
12271
|
return this.getRemoteVideoStream(callSession);
|
|
12254
12272
|
}
|
|
@@ -12309,7 +12327,7 @@ class Phone extends Emitter {
|
|
|
12309
12327
|
|
|
12310
12328
|
_transferEvents() {
|
|
12311
12329
|
this.unbind();
|
|
12312
|
-
[...events, ...transportEvents].forEach(event => {
|
|
12330
|
+
[...events$1, ...transportEvents].forEach(event => {
|
|
12313
12331
|
this.client.on(event, (...args) =>
|
|
12314
12332
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
12315
12333
|
});
|
|
@@ -12331,10 +12349,10 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
12331
12349
|
|
|
12332
12350
|
//
|
|
12333
12351
|
|
|
12334
|
-
const { SOCKET_EVENTS
|
|
12335
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS
|
|
12352
|
+
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
12353
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
12336
12354
|
|
|
12337
|
-
const logger$
|
|
12355
|
+
const logger$3 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
12338
12356
|
|
|
12339
12357
|
class Websocket extends Emitter {
|
|
12340
12358
|
|
|
@@ -12348,9 +12366,9 @@ class Websocket extends Emitter {
|
|
|
12348
12366
|
// $FlowFixMe
|
|
12349
12367
|
this[key] = OTHER_EVENTS[key];
|
|
12350
12368
|
});
|
|
12351
|
-
Object.keys(SOCKET_EVENTS
|
|
12369
|
+
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
12352
12370
|
// $FlowFixMe
|
|
12353
|
-
this[key] = SOCKET_EVENTS
|
|
12371
|
+
this[key] = SOCKET_EVENTS[key];
|
|
12354
12372
|
});
|
|
12355
12373
|
this.eventLists = WebSocketClient.eventLists;
|
|
12356
12374
|
|
|
@@ -12358,7 +12376,7 @@ class Websocket extends Emitter {
|
|
|
12358
12376
|
}
|
|
12359
12377
|
|
|
12360
12378
|
open(host , session ) {
|
|
12361
|
-
logger$
|
|
12379
|
+
logger$3.info('open simple WebSocket', { host, token: session.token });
|
|
12362
12380
|
this.ws = new WebSocketClient(
|
|
12363
12381
|
{
|
|
12364
12382
|
host,
|
|
@@ -12386,7 +12404,7 @@ class Websocket extends Emitter {
|
|
|
12386
12404
|
}
|
|
12387
12405
|
|
|
12388
12406
|
updateToken(token ) {
|
|
12389
|
-
logger$
|
|
12407
|
+
logger$3.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
12390
12408
|
|
|
12391
12409
|
if (!this.ws) {
|
|
12392
12410
|
return;
|
|
@@ -12414,7 +12432,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
12414
12432
|
|
|
12415
12433
|
//
|
|
12416
12434
|
|
|
12417
|
-
const logger$
|
|
12435
|
+
const logger$2 = IssueReporter$1.loggerFor('room');
|
|
12418
12436
|
|
|
12419
12437
|
class Participant extends Emitter {
|
|
12420
12438
|
|
|
@@ -12536,7 +12554,7 @@ class Participant extends Emitter {
|
|
|
12536
12554
|
}
|
|
12537
12555
|
|
|
12538
12556
|
onTalking(isTalking ) {
|
|
12539
|
-
logger$
|
|
12557
|
+
logger$2.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
12540
12558
|
this.isTalking = isTalking;
|
|
12541
12559
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
12542
12560
|
// directly from asterisk, there's no need to do so
|
|
@@ -12639,7 +12657,7 @@ class Participant extends Emitter {
|
|
|
12639
12657
|
}
|
|
12640
12658
|
|
|
12641
12659
|
updateStatus(status , broadcast = true) {
|
|
12642
|
-
logger$
|
|
12660
|
+
logger$2.info('updating participant status', { name: this.name, status });
|
|
12643
12661
|
|
|
12644
12662
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
12645
12663
|
if (status.audioMuted) {
|
|
@@ -12687,7 +12705,7 @@ class Participant extends Emitter {
|
|
|
12687
12705
|
|
|
12688
12706
|
broadcastStatus(inboundStatus = null) {
|
|
12689
12707
|
const status = inboundStatus || this.getStatus();
|
|
12690
|
-
logger$
|
|
12708
|
+
logger$2.info('broadcasting participant status', { callId: this.callId, status });
|
|
12691
12709
|
|
|
12692
12710
|
this.room.sendSignal({
|
|
12693
12711
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|
|
@@ -12723,9 +12741,9 @@ class LocalParticipant extends Participant {
|
|
|
12723
12741
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
12724
12742
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
12725
12743
|
|
|
12726
|
-
const logger$
|
|
12744
|
+
const logger$1 = IssueReporter$1.loggerFor('sdk-room');
|
|
12727
12745
|
|
|
12728
|
-
class Room
|
|
12746
|
+
class Room extends Emitter {
|
|
12729
12747
|
|
|
12730
12748
|
|
|
12731
12749
|
|
|
@@ -12783,7 +12801,7 @@ class Room$1 extends Emitter {
|
|
|
12783
12801
|
extra = {},
|
|
12784
12802
|
) {
|
|
12785
12803
|
super();
|
|
12786
|
-
logger$
|
|
12804
|
+
logger$1.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
12787
12805
|
|
|
12788
12806
|
// Represents the room callSession
|
|
12789
12807
|
this.callSession = callSession;
|
|
@@ -12849,7 +12867,7 @@ class Room$1 extends Emitter {
|
|
|
12849
12867
|
* @returns {Promise<Room>}
|
|
12850
12868
|
*/
|
|
12851
12869
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
12852
|
-
logger$
|
|
12870
|
+
logger$1.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
12853
12871
|
|
|
12854
12872
|
if (!room) {
|
|
12855
12873
|
await Wazo.Phone.connect();
|
|
@@ -12862,7 +12880,7 @@ class Room$1 extends Emitter {
|
|
|
12862
12880
|
|
|
12863
12881
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
12864
12882
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
12865
|
-
logger$
|
|
12883
|
+
logger$1.info('room call received via WS', { callId: data.call_id });
|
|
12866
12884
|
if (room) {
|
|
12867
12885
|
room.setCallId(data.call_id);
|
|
12868
12886
|
}
|
|
@@ -12870,7 +12888,7 @@ class Room$1 extends Emitter {
|
|
|
12870
12888
|
|
|
12871
12889
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
12872
12890
|
// eslint-disable-next-line no-param-reassign
|
|
12873
|
-
room = new Room
|
|
12891
|
+
room = new Room(callSession, extension, null, null, extra);
|
|
12874
12892
|
|
|
12875
12893
|
// Wait for the call to be accepted
|
|
12876
12894
|
await new Promise((resolve, reject) => {
|
|
@@ -12891,7 +12909,7 @@ class Room$1 extends Emitter {
|
|
|
12891
12909
|
// Retrieve conference
|
|
12892
12910
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
12893
12911
|
|
|
12894
|
-
logger$
|
|
12912
|
+
logger$1.info('connected to room', {
|
|
12895
12913
|
sourceId: conference ? conference.sourceId : null,
|
|
12896
12914
|
name: conference ? conference.name : null,
|
|
12897
12915
|
});
|
|
@@ -12901,7 +12919,7 @@ class Room$1 extends Emitter {
|
|
|
12901
12919
|
room.setName(conference.name);
|
|
12902
12920
|
}
|
|
12903
12921
|
} else if (meeting) {
|
|
12904
|
-
logger$
|
|
12922
|
+
logger$1.info('Already connected to meeting', {
|
|
12905
12923
|
uuid: meeting.uuid,
|
|
12906
12924
|
name: meeting.name,
|
|
12907
12925
|
});
|
|
@@ -12914,13 +12932,13 @@ class Room$1 extends Emitter {
|
|
|
12914
12932
|
}
|
|
12915
12933
|
|
|
12916
12934
|
static disconnect() {
|
|
12917
|
-
logger$
|
|
12935
|
+
logger$1.info('static disconnection to room');
|
|
12918
12936
|
|
|
12919
12937
|
Wazo.Phone.disconnect();
|
|
12920
12938
|
}
|
|
12921
12939
|
|
|
12922
12940
|
async disconnect() {
|
|
12923
|
-
logger$
|
|
12941
|
+
logger$1.info('disconnection to room called');
|
|
12924
12942
|
|
|
12925
12943
|
await Wazo.Phone.hangup(this.callSession);
|
|
12926
12944
|
this.callSession = null;
|
|
@@ -12940,19 +12958,19 @@ class Room$1 extends Emitter {
|
|
|
12940
12958
|
}
|
|
12941
12959
|
|
|
12942
12960
|
setSourceId(sourceId ) {
|
|
12943
|
-
logger$
|
|
12961
|
+
logger$1.info('set room source id', { sourceId });
|
|
12944
12962
|
|
|
12945
12963
|
this.sourceId = sourceId;
|
|
12946
12964
|
}
|
|
12947
12965
|
|
|
12948
12966
|
setMeetingUuid(meetingUuid ) {
|
|
12949
|
-
logger$
|
|
12967
|
+
logger$1.info('set meeting uuid', { meetingUuid });
|
|
12950
12968
|
|
|
12951
12969
|
this.meetingUuid = meetingUuid;
|
|
12952
12970
|
}
|
|
12953
12971
|
|
|
12954
12972
|
setCallId(callId ) {
|
|
12955
|
-
logger$
|
|
12973
|
+
logger$1.info('set room call id', { callId });
|
|
12956
12974
|
|
|
12957
12975
|
if (callId) {
|
|
12958
12976
|
this.callId = callId;
|
|
@@ -12960,7 +12978,7 @@ class Room$1 extends Emitter {
|
|
|
12960
12978
|
}
|
|
12961
12979
|
|
|
12962
12980
|
setName(name ) {
|
|
12963
|
-
logger$
|
|
12981
|
+
logger$1.info('set room name', { name });
|
|
12964
12982
|
|
|
12965
12983
|
this.name = name;
|
|
12966
12984
|
}
|
|
@@ -12979,7 +12997,7 @@ class Room$1 extends Emitter {
|
|
|
12979
12997
|
}
|
|
12980
12998
|
|
|
12981
12999
|
async startScreenSharing(constraints ) {
|
|
12982
|
-
logger$
|
|
13000
|
+
logger$1.info('start room screen sharing', { constraints });
|
|
12983
13001
|
|
|
12984
13002
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
12985
13003
|
if (!screensharingStream) {
|
|
@@ -12993,7 +13011,7 @@ class Room$1 extends Emitter {
|
|
|
12993
13011
|
}
|
|
12994
13012
|
|
|
12995
13013
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
12996
|
-
logger$
|
|
13014
|
+
logger$1.info('stop room screen sharing');
|
|
12997
13015
|
|
|
12998
13016
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
12999
13017
|
|
|
@@ -13005,7 +13023,7 @@ class Room$1 extends Emitter {
|
|
|
13005
13023
|
}
|
|
13006
13024
|
|
|
13007
13025
|
turnCameraOff() {
|
|
13008
|
-
logger$
|
|
13026
|
+
logger$1.info('turn room camera off');
|
|
13009
13027
|
|
|
13010
13028
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
13011
13029
|
|
|
@@ -13015,7 +13033,7 @@ class Room$1 extends Emitter {
|
|
|
13015
13033
|
}
|
|
13016
13034
|
|
|
13017
13035
|
turnCameraOn() {
|
|
13018
|
-
logger$
|
|
13036
|
+
logger$1.info('turn room camera on');
|
|
13019
13037
|
|
|
13020
13038
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
13021
13039
|
|
|
@@ -13025,7 +13043,7 @@ class Room$1 extends Emitter {
|
|
|
13025
13043
|
}
|
|
13026
13044
|
|
|
13027
13045
|
mute() {
|
|
13028
|
-
logger$
|
|
13046
|
+
logger$1.info('mute room');
|
|
13029
13047
|
|
|
13030
13048
|
Wazo.Phone.mute(this.callSession);
|
|
13031
13049
|
|
|
@@ -13033,7 +13051,7 @@ class Room$1 extends Emitter {
|
|
|
13033
13051
|
}
|
|
13034
13052
|
|
|
13035
13053
|
unmute() {
|
|
13036
|
-
logger$
|
|
13054
|
+
logger$1.info('unmute room');
|
|
13037
13055
|
|
|
13038
13056
|
Wazo.Phone.unmute(this.callSession);
|
|
13039
13057
|
|
|
@@ -13053,7 +13071,7 @@ class Room$1 extends Emitter {
|
|
|
13053
13071
|
}
|
|
13054
13072
|
|
|
13055
13073
|
hold() {
|
|
13056
|
-
logger$
|
|
13074
|
+
logger$1.info('hold room');
|
|
13057
13075
|
|
|
13058
13076
|
Wazo.Phone.hold(this.callSession, true);
|
|
13059
13077
|
|
|
@@ -13063,7 +13081,7 @@ class Room$1 extends Emitter {
|
|
|
13063
13081
|
}
|
|
13064
13082
|
|
|
13065
13083
|
async resume() {
|
|
13066
|
-
logger$
|
|
13084
|
+
logger$1.info('resume room');
|
|
13067
13085
|
|
|
13068
13086
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
13069
13087
|
|
|
@@ -13091,13 +13109,13 @@ class Room$1 extends Emitter {
|
|
|
13091
13109
|
}
|
|
13092
13110
|
|
|
13093
13111
|
sendDTMF(tone ) {
|
|
13094
|
-
logger$
|
|
13112
|
+
logger$1.info('send room DTMF', { tone });
|
|
13095
13113
|
|
|
13096
13114
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
13097
13115
|
}
|
|
13098
13116
|
|
|
13099
13117
|
async sendReinvite(newConstraints = null) {
|
|
13100
|
-
logger$
|
|
13118
|
+
logger$1.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
13101
13119
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
13102
13120
|
|
|
13103
13121
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -13156,7 +13174,7 @@ class Room$1 extends Emitter {
|
|
|
13156
13174
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
13157
13175
|
|
|
13158
13176
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
13159
|
-
logger$
|
|
13177
|
+
logger$1.info('on room audio stream');
|
|
13160
13178
|
|
|
13161
13179
|
this.audioStream = stream;
|
|
13162
13180
|
if (!this.roomAudioElement) {
|
|
@@ -13169,7 +13187,7 @@ class Room$1 extends Emitter {
|
|
|
13169
13187
|
});
|
|
13170
13188
|
|
|
13171
13189
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
13172
|
-
logger$
|
|
13190
|
+
logger$1.info('on room video stream', { streamId });
|
|
13173
13191
|
|
|
13174
13192
|
this._mapMsid(sipSession.body.body);
|
|
13175
13193
|
|
|
@@ -13184,7 +13202,7 @@ class Room$1 extends Emitter {
|
|
|
13184
13202
|
});
|
|
13185
13203
|
|
|
13186
13204
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
13187
|
-
logger$
|
|
13205
|
+
logger$1.info('on room remove stream');
|
|
13188
13206
|
|
|
13189
13207
|
const participant = this.participants.find(someParticipant =>
|
|
13190
13208
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -13316,7 +13334,7 @@ class Room$1 extends Emitter {
|
|
|
13316
13334
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
13317
13335
|
if (requester) {
|
|
13318
13336
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
13319
|
-
logger$
|
|
13337
|
+
logger$1.info('trigger room requester status', { origin });
|
|
13320
13338
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
13321
13339
|
}
|
|
13322
13340
|
break;
|
|
@@ -13347,24 +13365,24 @@ class Room$1 extends Emitter {
|
|
|
13347
13365
|
|
|
13348
13366
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
13349
13367
|
if (participant.user_uuid === session.uuid) {
|
|
13350
|
-
logger$
|
|
13368
|
+
logger$1.info('room current user joined');
|
|
13351
13369
|
|
|
13352
13370
|
// Retrieve participants via an API calls
|
|
13353
13371
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
13354
13372
|
let response;
|
|
13355
13373
|
try {
|
|
13356
13374
|
if (this.meetingUuid) {
|
|
13357
|
-
logger$
|
|
13375
|
+
logger$1.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
13358
13376
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
13359
13377
|
} else {
|
|
13360
|
-
logger$
|
|
13378
|
+
logger$1.info('fetching conference participants', { conferenceId });
|
|
13361
13379
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
13362
13380
|
}
|
|
13363
13381
|
} catch (e) {
|
|
13364
|
-
logger$
|
|
13382
|
+
logger$1.error('room participants fetching, error', e);
|
|
13365
13383
|
}
|
|
13366
13384
|
if (response) {
|
|
13367
|
-
logger$
|
|
13385
|
+
logger$1.info('conference participants fetched', { nb: response.items.length });
|
|
13368
13386
|
participants = response.items.map(item => {
|
|
13369
13387
|
const isMe = item.call_id === this.callId;
|
|
13370
13388
|
|
|
@@ -13391,7 +13409,7 @@ class Room$1 extends Emitter {
|
|
|
13391
13409
|
? new Wazo.RemoteParticipant(this, participant)
|
|
13392
13410
|
: null;
|
|
13393
13411
|
|
|
13394
|
-
logger$
|
|
13412
|
+
logger$1.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
13395
13413
|
|
|
13396
13414
|
if (remoteParticipant) {
|
|
13397
13415
|
this.participants.push(remoteParticipant);
|
|
@@ -13556,12 +13574,12 @@ class Room$1 extends Emitter {
|
|
|
13556
13574
|
|
|
13557
13575
|
//
|
|
13558
13576
|
|
|
13559
|
-
const logger
|
|
13577
|
+
const logger = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
13560
13578
|
|
|
13561
|
-
class SipRoom extends Room
|
|
13579
|
+
class SipRoom extends Room {
|
|
13562
13580
|
|
|
13563
13581
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
13564
|
-
logger
|
|
13582
|
+
logger.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
13565
13583
|
|
|
13566
13584
|
if (!room) {
|
|
13567
13585
|
await Wazo.Phone.connect();
|
|
@@ -13577,7 +13595,7 @@ class SipRoom extends Room$1 {
|
|
|
13577
13595
|
room.setCallId(room.callSession.call.id);
|
|
13578
13596
|
}
|
|
13579
13597
|
|
|
13580
|
-
logger
|
|
13598
|
+
logger.info('connected to room', {
|
|
13581
13599
|
extension: room.extension,
|
|
13582
13600
|
});
|
|
13583
13601
|
|
|
@@ -13585,7 +13603,7 @@ class SipRoom extends Room$1 {
|
|
|
13585
13603
|
}
|
|
13586
13604
|
|
|
13587
13605
|
mute() {
|
|
13588
|
-
logger
|
|
13606
|
+
logger.info('mute sip room');
|
|
13589
13607
|
|
|
13590
13608
|
Wazo.Phone.mute(this.callSession, false);
|
|
13591
13609
|
|
|
@@ -13593,7 +13611,7 @@ class SipRoom extends Room$1 {
|
|
|
13593
13611
|
}
|
|
13594
13612
|
|
|
13595
13613
|
unmute() {
|
|
13596
|
-
logger
|
|
13614
|
+
logger.info('unmute sip room');
|
|
13597
13615
|
|
|
13598
13616
|
Wazo.Phone.unmute(this.callSession, false);
|
|
13599
13617
|
|
|
@@ -13806,7 +13824,7 @@ const Wazo = {
|
|
|
13806
13824
|
Auth: Auth$1,
|
|
13807
13825
|
Phone: Phone$1,
|
|
13808
13826
|
Websocket: Websocket$1,
|
|
13809
|
-
Room
|
|
13827
|
+
Room,
|
|
13810
13828
|
SipRoom,
|
|
13811
13829
|
RemoteParticipant,
|
|
13812
13830
|
LocalParticipant,
|
|
@@ -13839,7 +13857,7 @@ const Wazo = {
|
|
|
13839
13857
|
Session,
|
|
13840
13858
|
Voicemail,
|
|
13841
13859
|
Relocation,
|
|
13842
|
-
ConferenceRoom: Room,
|
|
13860
|
+
ConferenceRoom: Room$1,
|
|
13843
13861
|
CallSession,
|
|
13844
13862
|
IndirectTransfer,
|
|
13845
13863
|
SwitchboardCall,
|
|
@@ -13925,13 +13943,13 @@ var index = {
|
|
|
13925
13943
|
Session,
|
|
13926
13944
|
Voicemail,
|
|
13927
13945
|
Relocation,
|
|
13928
|
-
Room,
|
|
13946
|
+
Room: Room$1,
|
|
13929
13947
|
IssueReporter: IssueReporter$1,
|
|
13930
13948
|
DebugDevice,
|
|
13931
13949
|
PROFILE_STATE: STATE,
|
|
13932
13950
|
FORWARD_KEYS,
|
|
13933
13951
|
LINE_STATE,
|
|
13934
|
-
SOCKET_EVENTS,
|
|
13952
|
+
SOCKET_EVENTS: SOCKET_EVENTS$1,
|
|
13935
13953
|
Wazo,
|
|
13936
13954
|
WebRTCPhone,
|
|
13937
13955
|
Meeting,
|