@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/esm/index.js
CHANGED
|
@@ -460,7 +460,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
460
460
|
|
|
461
461
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
462
462
|
|
|
463
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
463
|
+
const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
464
464
|
|
|
465
465
|
// Use a function here to be able to mock it in tests
|
|
466
466
|
const realFetch = () => {
|
|
@@ -599,7 +599,7 @@ class ApiRequester {
|
|
|
599
599
|
};
|
|
600
600
|
|
|
601
601
|
if (this.refreshTokenPromise) {
|
|
602
|
-
logger.info('A token is already refreshing, waiting ...', { url });
|
|
602
|
+
logger$c.info('A token is already refreshing, waiting ...', { url });
|
|
603
603
|
await this.refreshTokenPromise;
|
|
604
604
|
}
|
|
605
605
|
|
|
@@ -619,7 +619,7 @@ class ApiRequester {
|
|
|
619
619
|
return promise.then(async (err ) => {
|
|
620
620
|
// Check if the token is still valid
|
|
621
621
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
622
|
-
logger.warn('token expired', { error: err.reason });
|
|
622
|
+
logger$c.warn('token expired', { error: err.reason });
|
|
623
623
|
// Replay the call after refreshing the token
|
|
624
624
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
625
625
|
}
|
|
@@ -629,7 +629,7 @@ class ApiRequester {
|
|
|
629
629
|
: exceptionClass.fromResponse(err, response.status);
|
|
630
630
|
|
|
631
631
|
if (this.shouldLogErrors) {
|
|
632
|
-
logger.error('API error', error);
|
|
632
|
+
logger$c.error('API error', error);
|
|
633
633
|
}
|
|
634
634
|
|
|
635
635
|
throw error;
|
|
@@ -639,7 +639,7 @@ class ApiRequester {
|
|
|
639
639
|
return newParse(response, isJson);
|
|
640
640
|
}).catch(error => {
|
|
641
641
|
if (this.shouldLogErrors) {
|
|
642
|
-
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
642
|
+
logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
643
643
|
}
|
|
644
644
|
|
|
645
645
|
throw error;
|
|
@@ -667,13 +667,13 @@ class ApiRequester {
|
|
|
667
667
|
) {
|
|
668
668
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
669
669
|
let newPath = path;
|
|
670
|
-
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
670
|
+
logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
671
671
|
|
|
672
672
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
673
673
|
|
|
674
674
|
return this.refreshTokenPromise.then(() => {
|
|
675
675
|
this.refreshTokenPromise = null;
|
|
676
|
-
logger.info('token refreshed', { isTokenNotFound });
|
|
676
|
+
logger$c.info('token refreshed', { isTokenNotFound });
|
|
677
677
|
if (isTokenNotFound) {
|
|
678
678
|
const pathParts = path.split('/');
|
|
679
679
|
pathParts.pop();
|
|
@@ -4137,7 +4137,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4137
4137
|
|
|
4138
4138
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4139
4139
|
|
|
4140
|
-
const logger$
|
|
4140
|
+
const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4141
4141
|
|
|
4142
4142
|
class CTIPhone extends Emitter {
|
|
4143
4143
|
|
|
@@ -4150,7 +4150,7 @@ class CTIPhone extends Emitter {
|
|
|
4150
4150
|
|
|
4151
4151
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4152
4152
|
super();
|
|
4153
|
-
logger$
|
|
4153
|
+
logger$b.info('CTI Phone created');
|
|
4154
4154
|
this.session = session;
|
|
4155
4155
|
this.isMobile = isMobile;
|
|
4156
4156
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4211,7 +4211,7 @@ class CTIPhone extends Emitter {
|
|
|
4211
4211
|
}
|
|
4212
4212
|
|
|
4213
4213
|
async makeCall(number , line ) {
|
|
4214
|
-
logger$
|
|
4214
|
+
logger$b.info('make CTI call', { number });
|
|
4215
4215
|
|
|
4216
4216
|
if (!number) {
|
|
4217
4217
|
return null;
|
|
@@ -4234,7 +4234,7 @@ class CTIPhone extends Emitter {
|
|
|
4234
4234
|
if (!callSession) {
|
|
4235
4235
|
return Promise.resolve(null);
|
|
4236
4236
|
}
|
|
4237
|
-
logger$
|
|
4237
|
+
logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4238
4238
|
|
|
4239
4239
|
if (!this.currentCall) {
|
|
4240
4240
|
this.currentCall = callSession.call;
|
|
@@ -4247,7 +4247,7 @@ class CTIPhone extends Emitter {
|
|
|
4247
4247
|
if (!callSession) {
|
|
4248
4248
|
return;
|
|
4249
4249
|
}
|
|
4250
|
-
logger$
|
|
4250
|
+
logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4251
4251
|
|
|
4252
4252
|
this.currentCall = undefined;
|
|
4253
4253
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4257,7 +4257,7 @@ class CTIPhone extends Emitter {
|
|
|
4257
4257
|
if (!callSession) {
|
|
4258
4258
|
return Promise.resolve(false);
|
|
4259
4259
|
}
|
|
4260
|
-
logger$
|
|
4260
|
+
logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4261
4261
|
|
|
4262
4262
|
try {
|
|
4263
4263
|
await CallApi.cancelCall(callSession);
|
|
@@ -4268,7 +4268,7 @@ class CTIPhone extends Emitter {
|
|
|
4268
4268
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4269
4269
|
return true;
|
|
4270
4270
|
} catch (e) {
|
|
4271
|
-
logger$
|
|
4271
|
+
logger$b.error('hangup CTI call, error', e);
|
|
4272
4272
|
|
|
4273
4273
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4274
4274
|
return false;
|
|
@@ -4281,7 +4281,7 @@ class CTIPhone extends Emitter {
|
|
|
4281
4281
|
if (!callSession) {
|
|
4282
4282
|
return;
|
|
4283
4283
|
}
|
|
4284
|
-
logger$
|
|
4284
|
+
logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4285
4285
|
|
|
4286
4286
|
await CallApi.cancelCall(callSession);
|
|
4287
4287
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4291,7 +4291,7 @@ class CTIPhone extends Emitter {
|
|
|
4291
4291
|
if (!callSession) {
|
|
4292
4292
|
return;
|
|
4293
4293
|
}
|
|
4294
|
-
logger$
|
|
4294
|
+
logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4295
4295
|
|
|
4296
4296
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4297
4297
|
}
|
|
@@ -4304,19 +4304,19 @@ class CTIPhone extends Emitter {
|
|
|
4304
4304
|
if (!callSession) {
|
|
4305
4305
|
return;
|
|
4306
4306
|
}
|
|
4307
|
-
logger$
|
|
4307
|
+
logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4308
4308
|
|
|
4309
4309
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4310
4310
|
}
|
|
4311
4311
|
|
|
4312
4312
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4313
|
-
logger$
|
|
4313
|
+
logger$b.info('cancel CTI transfer', { transferId });
|
|
4314
4314
|
|
|
4315
4315
|
return CallApi.cancelCallTransfer(transferId);
|
|
4316
4316
|
}
|
|
4317
4317
|
|
|
4318
4318
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4319
|
-
logger$
|
|
4319
|
+
logger$b.info('confirm CTI transfer', { transferId });
|
|
4320
4320
|
|
|
4321
4321
|
return CallApi.confirmCallTransfer(transferId);
|
|
4322
4322
|
}
|
|
@@ -4325,19 +4325,19 @@ class CTIPhone extends Emitter {
|
|
|
4325
4325
|
if (!callSession) {
|
|
4326
4326
|
return;
|
|
4327
4327
|
}
|
|
4328
|
-
logger$
|
|
4328
|
+
logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4329
4329
|
|
|
4330
4330
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4331
4331
|
}
|
|
4332
4332
|
|
|
4333
4333
|
onConnectionMade() {
|
|
4334
|
-
logger$
|
|
4334
|
+
logger$b.info('on CTI connection made');
|
|
4335
4335
|
|
|
4336
4336
|
this.eventEmitter.emit('onCallAccepted');
|
|
4337
4337
|
}
|
|
4338
4338
|
|
|
4339
4339
|
async close() {
|
|
4340
|
-
logger$
|
|
4340
|
+
logger$b.info('CTI close');
|
|
4341
4341
|
|
|
4342
4342
|
return Promise.resolve();
|
|
4343
4343
|
}
|
|
@@ -4346,7 +4346,7 @@ class CTIPhone extends Emitter {
|
|
|
4346
4346
|
if (!callSession) {
|
|
4347
4347
|
return;
|
|
4348
4348
|
}
|
|
4349
|
-
logger$
|
|
4349
|
+
logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4350
4350
|
|
|
4351
4351
|
return CallApi.hold(callSession.callId);
|
|
4352
4352
|
}
|
|
@@ -4355,7 +4355,7 @@ class CTIPhone extends Emitter {
|
|
|
4355
4355
|
if (!callSession) {
|
|
4356
4356
|
return;
|
|
4357
4357
|
}
|
|
4358
|
-
logger$
|
|
4358
|
+
logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4359
4359
|
|
|
4360
4360
|
return CallApi.resume(callSession.callId);
|
|
4361
4361
|
}
|
|
@@ -4364,7 +4364,7 @@ class CTIPhone extends Emitter {
|
|
|
4364
4364
|
if (!callSession) {
|
|
4365
4365
|
return;
|
|
4366
4366
|
}
|
|
4367
|
-
logger$
|
|
4367
|
+
logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4368
4368
|
|
|
4369
4369
|
return CallApi.mute(callSession.callId);
|
|
4370
4370
|
}
|
|
@@ -4373,7 +4373,7 @@ class CTIPhone extends Emitter {
|
|
|
4373
4373
|
if (!callSession) {
|
|
4374
4374
|
return;
|
|
4375
4375
|
}
|
|
4376
|
-
logger$
|
|
4376
|
+
logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4377
4377
|
|
|
4378
4378
|
return CallApi.unmute(callSession.callId);
|
|
4379
4379
|
}
|
|
@@ -5382,7 +5382,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5382
5382
|
const WEBHOOKD_VERSION = '1.0';
|
|
5383
5383
|
const AMID_VERSION = '1.0';
|
|
5384
5384
|
|
|
5385
|
-
const logger$
|
|
5385
|
+
const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5386
5386
|
|
|
5387
5387
|
class ApiClient {
|
|
5388
5388
|
|
|
@@ -5434,12 +5434,12 @@ class ApiClient {
|
|
|
5434
5434
|
}
|
|
5435
5435
|
|
|
5436
5436
|
async forceRefreshToken() {
|
|
5437
|
-
logger$
|
|
5437
|
+
logger$a.info('forcing refresh token, calling callback');
|
|
5438
5438
|
return this.refreshTokenCallback();
|
|
5439
5439
|
}
|
|
5440
5440
|
|
|
5441
5441
|
async refreshTokenCallback() {
|
|
5442
|
-
logger$
|
|
5442
|
+
logger$a.info('refresh token callback called', {
|
|
5443
5443
|
refreshToken: this.refreshToken,
|
|
5444
5444
|
refreshBackend: this.refreshBackend,
|
|
5445
5445
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5457,7 +5457,7 @@ class ApiClient {
|
|
|
5457
5457
|
this.isMobile,
|
|
5458
5458
|
);
|
|
5459
5459
|
|
|
5460
|
-
logger$
|
|
5460
|
+
logger$a.info('token refreshed', { token: session.token });
|
|
5461
5461
|
|
|
5462
5462
|
if (this.onRefreshToken) {
|
|
5463
5463
|
this.onRefreshToken(session.token, session);
|
|
@@ -5512,7 +5512,7 @@ class ApiClient {
|
|
|
5512
5512
|
|
|
5513
5513
|
/* */
|
|
5514
5514
|
|
|
5515
|
-
const parseCandidate = (candidate ) => {
|
|
5515
|
+
const parseCandidate$1 = (candidate ) => {
|
|
5516
5516
|
if (!candidate) {
|
|
5517
5517
|
return null;
|
|
5518
5518
|
}
|
|
@@ -5666,7 +5666,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
5666
5666
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
5667
5667
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
5668
5668
|
if (event.candidate) {
|
|
5669
|
-
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
5669
|
+
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
5670
5670
|
}
|
|
5671
5671
|
};
|
|
5672
5672
|
|
|
@@ -6130,7 +6130,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6130
6130
|
const SEND_STATS_DELAY = 5000;
|
|
6131
6131
|
|
|
6132
6132
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6133
|
-
const logger$
|
|
6133
|
+
const logger$9 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6134
6134
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6135
6135
|
|
|
6136
6136
|
// events
|
|
@@ -6144,14 +6144,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6144
6144
|
const MESSAGE = 'message';
|
|
6145
6145
|
const ACCEPTED = 'accepted';
|
|
6146
6146
|
const REJECTED = 'rejected';
|
|
6147
|
-
const ON_TRACK = 'onTrack';
|
|
6148
|
-
const ON_REINVITE = 'reinvite';
|
|
6147
|
+
const ON_TRACK$1 = 'onTrack';
|
|
6148
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
6149
6149
|
const ON_ERROR = 'onError';
|
|
6150
6150
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6151
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6152
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
6151
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6152
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6153
6153
|
|
|
6154
|
-
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6154
|
+
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6155
6155
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6156
6156
|
class CanceledCallError extends Error {}
|
|
6157
6157
|
|
|
@@ -6287,12 +6287,12 @@ class WebRTCClient extends Emitter {
|
|
|
6287
6287
|
this.MESSAGE = MESSAGE;
|
|
6288
6288
|
this.ACCEPTED = ACCEPTED;
|
|
6289
6289
|
this.REJECTED = REJECTED;
|
|
6290
|
-
this.ON_TRACK = ON_TRACK;
|
|
6291
|
-
this.ON_REINVITE = ON_REINVITE;
|
|
6290
|
+
this.ON_TRACK = ON_TRACK$1;
|
|
6291
|
+
this.ON_REINVITE = ON_REINVITE$1;
|
|
6292
6292
|
this.ON_ERROR = ON_ERROR;
|
|
6293
6293
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6294
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6295
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6294
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6295
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6296
6296
|
}
|
|
6297
6297
|
|
|
6298
6298
|
configureMedia(media ) {
|
|
@@ -6309,13 +6309,13 @@ class WebRTCClient extends Emitter {
|
|
|
6309
6309
|
|
|
6310
6310
|
createUserAgent(configOverrides ) {
|
|
6311
6311
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6312
|
-
logger$
|
|
6312
|
+
logger$9.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6313
6313
|
|
|
6314
6314
|
webRTCConfiguration.delegate = {
|
|
6315
6315
|
onConnect: this.onConnect.bind(this),
|
|
6316
6316
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6317
6317
|
onInvite: (invitation ) => {
|
|
6318
|
-
logger$
|
|
6318
|
+
logger$9.info('sdk webrtc on invite', {
|
|
6319
6319
|
method: 'delegate.onInvite',
|
|
6320
6320
|
id: invitation.id,
|
|
6321
6321
|
remoteURI: invitation.remoteURI,
|
|
@@ -6358,7 +6358,7 @@ class WebRTCClient extends Emitter {
|
|
|
6358
6358
|
}
|
|
6359
6359
|
|
|
6360
6360
|
onConnect() {
|
|
6361
|
-
logger$
|
|
6361
|
+
logger$9.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6362
6362
|
this.eventEmitter.emit(CONNECTED);
|
|
6363
6363
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6364
6364
|
this.registerer.waitingToggle(false);
|
|
@@ -6367,7 +6367,7 @@ class WebRTCClient extends Emitter {
|
|
|
6367
6367
|
}
|
|
6368
6368
|
|
|
6369
6369
|
async onDisconnect(error ) {
|
|
6370
|
-
logger$
|
|
6370
|
+
logger$9.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6371
6371
|
this.connectionPromise = null;
|
|
6372
6372
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6373
6373
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6392,37 +6392,37 @@ class WebRTCClient extends Emitter {
|
|
|
6392
6392
|
};
|
|
6393
6393
|
|
|
6394
6394
|
if (this.skipRegister) {
|
|
6395
|
-
logger$
|
|
6395
|
+
logger$9.info('sdk webrtc skip register...', logInfo);
|
|
6396
6396
|
return Promise.resolve();
|
|
6397
6397
|
}
|
|
6398
6398
|
|
|
6399
|
-
logger$
|
|
6399
|
+
logger$9.info('sdk webrtc registering...', logInfo);
|
|
6400
6400
|
|
|
6401
6401
|
if (!this.userAgent) {
|
|
6402
|
-
logger$
|
|
6402
|
+
logger$9.info('sdk webrtc recreating User Agent');
|
|
6403
6403
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6404
6404
|
}
|
|
6405
6405
|
if (!this.userAgent || this.isRegistered()) {
|
|
6406
|
-
logger$
|
|
6406
|
+
logger$9.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6407
6407
|
return Promise.resolve();
|
|
6408
6408
|
}
|
|
6409
6409
|
|
|
6410
6410
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6411
|
-
logger$
|
|
6411
|
+
logger$9.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6412
6412
|
return Promise.resolve();
|
|
6413
6413
|
}
|
|
6414
6414
|
|
|
6415
6415
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6416
6416
|
|
|
6417
6417
|
const onRegisterFailed = () => {
|
|
6418
|
-
logger$
|
|
6418
|
+
logger$9.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6419
6419
|
this.connectionPromise = null;
|
|
6420
6420
|
if (this.registerer && this.registerer.waiting) {
|
|
6421
6421
|
this.registerer.waitingToggle(false);
|
|
6422
6422
|
}
|
|
6423
6423
|
|
|
6424
6424
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6425
|
-
logger$
|
|
6425
|
+
logger$9.info('sdk webrtc registering, retrying...', { tries });
|
|
6426
6426
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6427
6427
|
}
|
|
6428
6428
|
};
|
|
@@ -6431,18 +6431,18 @@ class WebRTCClient extends Emitter {
|
|
|
6431
6431
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6432
6432
|
// during the resolution of the primise.
|
|
6433
6433
|
if (!this.userAgent) {
|
|
6434
|
-
logger$
|
|
6434
|
+
logger$9.info('sdk webrtc recreating User Agent after connection');
|
|
6435
6435
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6436
6436
|
}
|
|
6437
6437
|
|
|
6438
|
-
logger$
|
|
6438
|
+
logger$9.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6439
6439
|
this.registerer = new Registerer(this.userAgent, registerOptions);
|
|
6440
6440
|
this.connectionPromise = null;
|
|
6441
6441
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6442
6442
|
|
|
6443
6443
|
// Bind registerer events
|
|
6444
6444
|
this.registerer.stateChange.addListener(newState => {
|
|
6445
|
-
logger$
|
|
6445
|
+
logger$9.info('sdk webrtc registering, state changed', { newState });
|
|
6446
6446
|
|
|
6447
6447
|
if (newState === RegistererState.Registered && this.registerer
|
|
6448
6448
|
&& this.registerer.state === RegistererState.Registered) {
|
|
@@ -6455,7 +6455,7 @@ class WebRTCClient extends Emitter {
|
|
|
6455
6455
|
const options = {
|
|
6456
6456
|
requestDelegate: {
|
|
6457
6457
|
onReject: response => {
|
|
6458
|
-
logger$
|
|
6458
|
+
logger$9.error('sdk webrtc registering, rejected', { response });
|
|
6459
6459
|
|
|
6460
6460
|
onRegisterFailed();
|
|
6461
6461
|
},
|
|
@@ -6463,13 +6463,13 @@ class WebRTCClient extends Emitter {
|
|
|
6463
6463
|
};
|
|
6464
6464
|
|
|
6465
6465
|
return this.registerer.register(options).catch((e) => {
|
|
6466
|
-
logger$
|
|
6466
|
+
logger$9.error('sdk webrtc registering, error', e);
|
|
6467
6467
|
|
|
6468
6468
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6469
6469
|
return e;
|
|
6470
6470
|
});
|
|
6471
6471
|
}).catch(error => {
|
|
6472
|
-
logger$
|
|
6472
|
+
logger$9.error('sdk webrtc registering, transport error', error);
|
|
6473
6473
|
onRegisterFailed();
|
|
6474
6474
|
});
|
|
6475
6475
|
}
|
|
@@ -6498,21 +6498,21 @@ class WebRTCClient extends Emitter {
|
|
|
6498
6498
|
}
|
|
6499
6499
|
|
|
6500
6500
|
unregister() {
|
|
6501
|
-
logger$
|
|
6501
|
+
logger$9.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6502
6502
|
if (!this.registerer) {
|
|
6503
6503
|
return Promise.resolve();
|
|
6504
6504
|
}
|
|
6505
6505
|
|
|
6506
6506
|
try {
|
|
6507
6507
|
return this.registerer.unregister().then(() => {
|
|
6508
|
-
logger$
|
|
6508
|
+
logger$9.info('sdk webrtc unregistered');
|
|
6509
6509
|
this._cleanupRegister();
|
|
6510
6510
|
}).catch(e => {
|
|
6511
|
-
logger$
|
|
6511
|
+
logger$9.error('sdk webrtc unregistering, promise error', e);
|
|
6512
6512
|
this._cleanupRegister();
|
|
6513
6513
|
});
|
|
6514
6514
|
} catch (e) {
|
|
6515
|
-
logger$
|
|
6515
|
+
logger$9.error('sdk webrtc unregistering, error', e);
|
|
6516
6516
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6517
6517
|
// error when the registerer is in a bad state
|
|
6518
6518
|
this._cleanupRegister();
|
|
@@ -6520,7 +6520,7 @@ class WebRTCClient extends Emitter {
|
|
|
6520
6520
|
}
|
|
6521
6521
|
|
|
6522
6522
|
stop() {
|
|
6523
|
-
logger$
|
|
6523
|
+
logger$9.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6524
6524
|
if (!this.userAgent) {
|
|
6525
6525
|
return Promise.resolve();
|
|
6526
6526
|
}
|
|
@@ -6528,12 +6528,12 @@ class WebRTCClient extends Emitter {
|
|
|
6528
6528
|
return this.userAgent.stop().then(() => {
|
|
6529
6529
|
return this._cleanupRegister();
|
|
6530
6530
|
}).catch(e => {
|
|
6531
|
-
logger$
|
|
6531
|
+
logger$9.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6532
6532
|
});
|
|
6533
6533
|
}
|
|
6534
6534
|
|
|
6535
6535
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6536
|
-
logger$
|
|
6536
|
+
logger$9.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6537
6537
|
const inviterOptions = {
|
|
6538
6538
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6539
6539
|
conference,
|
|
@@ -6564,7 +6564,7 @@ class WebRTCClient extends Emitter {
|
|
|
6564
6564
|
this._onAccepted(session, response.session, true);
|
|
6565
6565
|
},
|
|
6566
6566
|
onReject: (response ) => {
|
|
6567
|
-
logger$
|
|
6567
|
+
logger$9.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
6568
6568
|
this._stopSendingStats(session);
|
|
6569
6569
|
this.stopNetworkMonitoring(session);
|
|
6570
6570
|
|
|
@@ -6587,11 +6587,11 @@ class WebRTCClient extends Emitter {
|
|
|
6587
6587
|
}
|
|
6588
6588
|
|
|
6589
6589
|
answer(session , enableVideo ) {
|
|
6590
|
-
logger$
|
|
6590
|
+
logger$9.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
6591
6591
|
|
|
6592
6592
|
if (!session || !session.accept) {
|
|
6593
6593
|
const error = 'No session to answer, or not an invitation';
|
|
6594
|
-
logger$
|
|
6594
|
+
logger$9.warn(error);
|
|
6595
6595
|
return Promise.reject(new Error(error));
|
|
6596
6596
|
}
|
|
6597
6597
|
const options = {
|
|
@@ -6601,15 +6601,15 @@ class WebRTCClient extends Emitter {
|
|
|
6601
6601
|
return session.accept(options).then(() => {
|
|
6602
6602
|
if (session.isCanceled) {
|
|
6603
6603
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
6604
|
-
logger$
|
|
6604
|
+
logger$9.error(message, { id: session.id });
|
|
6605
6605
|
this.onCallEnded(session);
|
|
6606
6606
|
|
|
6607
6607
|
throw new CanceledCallError(message);
|
|
6608
6608
|
}
|
|
6609
|
-
logger$
|
|
6609
|
+
logger$9.info('sdk webrtc answer, accepted.');
|
|
6610
6610
|
this._onAccepted(session);
|
|
6611
6611
|
}).catch(e => {
|
|
6612
|
-
logger$
|
|
6612
|
+
logger$9.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
6613
6613
|
|
|
6614
6614
|
throw e;
|
|
6615
6615
|
});
|
|
@@ -6617,7 +6617,7 @@ class WebRTCClient extends Emitter {
|
|
|
6617
6617
|
|
|
6618
6618
|
hangup(session ) {
|
|
6619
6619
|
const { state, id } = session;
|
|
6620
|
-
logger$
|
|
6620
|
+
logger$9.info('sdk webrtc hangup call', { id, state });
|
|
6621
6621
|
|
|
6622
6622
|
try {
|
|
6623
6623
|
this._stopSendingStats(session);
|
|
@@ -6646,7 +6646,7 @@ class WebRTCClient extends Emitter {
|
|
|
6646
6646
|
|
|
6647
6647
|
return bye();
|
|
6648
6648
|
} catch (error) {
|
|
6649
|
-
logger$
|
|
6649
|
+
logger$9.warn('sdk webrtc hangup, error', error);
|
|
6650
6650
|
}
|
|
6651
6651
|
|
|
6652
6652
|
return null;
|
|
@@ -6664,7 +6664,7 @@ class WebRTCClient extends Emitter {
|
|
|
6664
6664
|
// Fetch and emit an event at `interval` with session network stats
|
|
6665
6665
|
startNetworkMonitoring(session , interval = 1000) {
|
|
6666
6666
|
const sessionId = this.getSipSessionId(session);
|
|
6667
|
-
logger$
|
|
6667
|
+
logger$9.info('starting network inspection', { id: sessionId });
|
|
6668
6668
|
|
|
6669
6669
|
this.sessionNetworkStats[sessionId] = [];
|
|
6670
6670
|
|
|
@@ -6674,7 +6674,7 @@ class WebRTCClient extends Emitter {
|
|
|
6674
6674
|
stopNetworkMonitoring(session ) {
|
|
6675
6675
|
const sessionId = this.getSipSessionId(session);
|
|
6676
6676
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
6677
|
-
logger$
|
|
6677
|
+
logger$9.info('stopping network inspection', { id: sessionId, exists });
|
|
6678
6678
|
|
|
6679
6679
|
if (exists) {
|
|
6680
6680
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -6684,17 +6684,17 @@ class WebRTCClient extends Emitter {
|
|
|
6684
6684
|
}
|
|
6685
6685
|
|
|
6686
6686
|
reject(session ) {
|
|
6687
|
-
logger$
|
|
6687
|
+
logger$9.info('sdk webrtc reject call', { id: session.id });
|
|
6688
6688
|
|
|
6689
6689
|
try {
|
|
6690
6690
|
return session.reject ? session.reject() : session.cancel();
|
|
6691
6691
|
} catch (e) {
|
|
6692
|
-
logger$
|
|
6692
|
+
logger$9.warn('Error when rejecting call', e.message, e.stack);
|
|
6693
6693
|
}
|
|
6694
6694
|
}
|
|
6695
6695
|
|
|
6696
6696
|
async close() {
|
|
6697
|
-
logger$
|
|
6697
|
+
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6698
6698
|
this._cleanupMedia();
|
|
6699
6699
|
this.connectionPromise = null;
|
|
6700
6700
|
|
|
@@ -6725,7 +6725,7 @@ class WebRTCClient extends Emitter {
|
|
|
6725
6725
|
// eg: "INVITE not rejectable in state Completed"
|
|
6726
6726
|
}
|
|
6727
6727
|
this.userAgent = null;
|
|
6728
|
-
logger$
|
|
6728
|
+
logger$9.info('sdk webrtc client closed');
|
|
6729
6729
|
}
|
|
6730
6730
|
|
|
6731
6731
|
getNumber(session ) {
|
|
@@ -6738,13 +6738,13 @@ class WebRTCClient extends Emitter {
|
|
|
6738
6738
|
}
|
|
6739
6739
|
|
|
6740
6740
|
mute(session ) {
|
|
6741
|
-
logger$
|
|
6741
|
+
logger$9.info('sdk webrtc mute', { id: session.id });
|
|
6742
6742
|
|
|
6743
6743
|
this._toggleAudio(session, true);
|
|
6744
6744
|
}
|
|
6745
6745
|
|
|
6746
6746
|
unmute(session ) {
|
|
6747
|
-
logger$
|
|
6747
|
+
logger$9.info('sdk webrtc unmute', { id: session.id });
|
|
6748
6748
|
|
|
6749
6749
|
this._toggleAudio(session, false);
|
|
6750
6750
|
}
|
|
@@ -6784,13 +6784,13 @@ class WebRTCClient extends Emitter {
|
|
|
6784
6784
|
}
|
|
6785
6785
|
|
|
6786
6786
|
toggleCameraOn(session ) {
|
|
6787
|
-
logger$
|
|
6787
|
+
logger$9.info('sdk webrtc toggle camera on', { id: session.id });
|
|
6788
6788
|
|
|
6789
6789
|
this._toggleVideo(session, false);
|
|
6790
6790
|
}
|
|
6791
6791
|
|
|
6792
6792
|
toggleCameraOff(session ) {
|
|
6793
|
-
logger$
|
|
6793
|
+
logger$9.info('sdk webrtc toggle camera off', { id: session.id });
|
|
6794
6794
|
|
|
6795
6795
|
this._toggleVideo(session, true);
|
|
6796
6796
|
}
|
|
@@ -6799,7 +6799,7 @@ class WebRTCClient extends Emitter {
|
|
|
6799
6799
|
const sessionId = this.getSipSessionId(session);
|
|
6800
6800
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
6801
6801
|
|
|
6802
|
-
logger$
|
|
6802
|
+
logger$9.info('sdk webrtc hold', {
|
|
6803
6803
|
sessionId,
|
|
6804
6804
|
keys: Object.keys(this.heldSessions),
|
|
6805
6805
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -6848,7 +6848,7 @@ class WebRTCClient extends Emitter {
|
|
|
6848
6848
|
const sessionId = this.getSipSessionId(session);
|
|
6849
6849
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
6850
6850
|
|
|
6851
|
-
logger$
|
|
6851
|
+
logger$9.info('sdk webrtc unhold', {
|
|
6852
6852
|
sessionId,
|
|
6853
6853
|
keys: Object.keys(this.heldSessions),
|
|
6854
6854
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -6996,7 +6996,7 @@ class WebRTCClient extends Emitter {
|
|
|
6996
6996
|
if (!session.sessionDescriptionHandler) {
|
|
6997
6997
|
return;
|
|
6998
6998
|
}
|
|
6999
|
-
logger$
|
|
6999
|
+
logger$9.info('Sending DTMF', {
|
|
7000
7000
|
id: this.getSipSessionId(session),
|
|
7001
7001
|
tone,
|
|
7002
7002
|
});
|
|
@@ -7012,7 +7012,7 @@ class WebRTCClient extends Emitter {
|
|
|
7012
7012
|
transfer(session , target ) {
|
|
7013
7013
|
this.hold(session);
|
|
7014
7014
|
|
|
7015
|
-
logger$
|
|
7015
|
+
logger$9.info('Transfering a session', {
|
|
7016
7016
|
id: this.getSipSessionId(session),
|
|
7017
7017
|
target,
|
|
7018
7018
|
});
|
|
@@ -7034,17 +7034,17 @@ class WebRTCClient extends Emitter {
|
|
|
7034
7034
|
atxfer(session ) {
|
|
7035
7035
|
this.hold(session);
|
|
7036
7036
|
|
|
7037
|
-
logger$
|
|
7037
|
+
logger$9.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7038
7038
|
|
|
7039
7039
|
const result = {
|
|
7040
7040
|
newSession: null,
|
|
7041
7041
|
init: async (target ) => {
|
|
7042
|
-
logger$
|
|
7042
|
+
logger$9.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7043
7043
|
|
|
7044
7044
|
result.newSession = await this.call(target);
|
|
7045
7045
|
},
|
|
7046
7046
|
complete: () => {
|
|
7047
|
-
logger$
|
|
7047
|
+
logger$9.info('webrtc transfer completed', {
|
|
7048
7048
|
id: this.getSipSessionId(session),
|
|
7049
7049
|
referId: this.getSipSessionId(result.newSession),
|
|
7050
7050
|
});
|
|
@@ -7065,7 +7065,7 @@ class WebRTCClient extends Emitter {
|
|
|
7065
7065
|
return;
|
|
7066
7066
|
}
|
|
7067
7067
|
|
|
7068
|
-
logger$
|
|
7068
|
+
logger$9.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7069
7069
|
|
|
7070
7070
|
try {
|
|
7071
7071
|
sipSession.message({
|
|
@@ -7107,7 +7107,7 @@ class WebRTCClient extends Emitter {
|
|
|
7107
7107
|
}
|
|
7108
7108
|
|
|
7109
7109
|
changeAudioOutputVolume(volume ) {
|
|
7110
|
-
logger$
|
|
7110
|
+
logger$9.info('Changing audio output volume', { volume });
|
|
7111
7111
|
|
|
7112
7112
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7113
7113
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7119,7 +7119,7 @@ class WebRTCClient extends Emitter {
|
|
|
7119
7119
|
}
|
|
7120
7120
|
|
|
7121
7121
|
changeAudioOutputDevice(id ) {
|
|
7122
|
-
logger$
|
|
7122
|
+
logger$9.info('Changing audio output device', { id });
|
|
7123
7123
|
|
|
7124
7124
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7125
7125
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7136,7 +7136,7 @@ class WebRTCClient extends Emitter {
|
|
|
7136
7136
|
|
|
7137
7137
|
changeAudioInputDevice(id , session ) {
|
|
7138
7138
|
const currentId = this.getAudioDeviceId();
|
|
7139
|
-
logger$
|
|
7139
|
+
logger$9.info('setting audio input device', { id, currentId, session: !!session });
|
|
7140
7140
|
|
|
7141
7141
|
if (id === currentId) {
|
|
7142
7142
|
return null;
|
|
@@ -7182,7 +7182,7 @@ class WebRTCClient extends Emitter {
|
|
|
7182
7182
|
|
|
7183
7183
|
setVideoInputDevice(id ) {
|
|
7184
7184
|
const currentId = this.getVideoDeviceId();
|
|
7185
|
-
logger$
|
|
7185
|
+
logger$9.info('setting video input device', { id, currentId });
|
|
7186
7186
|
|
|
7187
7187
|
if (id === currentId) {
|
|
7188
7188
|
return null;
|
|
@@ -7207,7 +7207,7 @@ class WebRTCClient extends Emitter {
|
|
|
7207
7207
|
const sessionId = this.getSipSessionId(session);
|
|
7208
7208
|
const localStream = this.getLocalStream(sessionId);
|
|
7209
7209
|
|
|
7210
|
-
logger$
|
|
7210
|
+
logger$9.info('changing video input device', { id, sessionId });
|
|
7211
7211
|
|
|
7212
7212
|
// Release old video stream
|
|
7213
7213
|
if (localStream) {
|
|
@@ -7275,7 +7275,7 @@ class WebRTCClient extends Emitter {
|
|
|
7275
7275
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7276
7276
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7277
7277
|
|
|
7278
|
-
logger$
|
|
7278
|
+
logger$9.info('Sending reinvite', {
|
|
7279
7279
|
id: this.getSipSessionId(sipSession),
|
|
7280
7280
|
newConstraints,
|
|
7281
7281
|
conference,
|
|
@@ -7313,7 +7313,7 @@ class WebRTCClient extends Emitter {
|
|
|
7313
7313
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7314
7314
|
}
|
|
7315
7315
|
|
|
7316
|
-
logger$
|
|
7316
|
+
logger$9.info('on re-INVITE accepted', {
|
|
7317
7317
|
id: this.getSipSessionId(sipSession),
|
|
7318
7318
|
wasMuted,
|
|
7319
7319
|
shouldDoScreenSharing,
|
|
@@ -7331,7 +7331,7 @@ class WebRTCClient extends Emitter {
|
|
|
7331
7331
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7332
7332
|
}
|
|
7333
7333
|
|
|
7334
|
-
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7334
|
+
return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
|
|
7335
7335
|
},
|
|
7336
7336
|
},
|
|
7337
7337
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7488,7 +7488,7 @@ class WebRTCClient extends Emitter {
|
|
|
7488
7488
|
}
|
|
7489
7489
|
|
|
7490
7490
|
startHeartbeat() {
|
|
7491
|
-
logger$
|
|
7491
|
+
logger$9.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7492
7492
|
if (!this.userAgent) {
|
|
7493
7493
|
this.heartbeat.stop();
|
|
7494
7494
|
return;
|
|
@@ -7501,7 +7501,7 @@ class WebRTCClient extends Emitter {
|
|
|
7501
7501
|
}
|
|
7502
7502
|
|
|
7503
7503
|
stopHeartbeat() {
|
|
7504
|
-
logger$
|
|
7504
|
+
logger$9.info('sdk webrtc stop heartbeat');
|
|
7505
7505
|
this.heartbeat.stop();
|
|
7506
7506
|
}
|
|
7507
7507
|
|
|
@@ -7522,7 +7522,7 @@ class WebRTCClient extends Emitter {
|
|
|
7522
7522
|
}
|
|
7523
7523
|
|
|
7524
7524
|
attemptReconnection() {
|
|
7525
|
-
logger$
|
|
7525
|
+
logger$9.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7526
7526
|
if (!this.userAgent) {
|
|
7527
7527
|
return;
|
|
7528
7528
|
}
|
|
@@ -7547,7 +7547,7 @@ class WebRTCClient extends Emitter {
|
|
|
7547
7547
|
return;
|
|
7548
7548
|
}
|
|
7549
7549
|
|
|
7550
|
-
logger$
|
|
7550
|
+
logger$9.info('setting local media stream', {
|
|
7551
7551
|
sipSessionId,
|
|
7552
7552
|
tracks: newStream ? newStream.getTracks() : null,
|
|
7553
7553
|
});
|
|
@@ -7564,7 +7564,7 @@ class WebRTCClient extends Emitter {
|
|
|
7564
7564
|
|
|
7565
7565
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
7566
7566
|
|
|
7567
|
-
logger$
|
|
7567
|
+
logger$9.info('updating local stream', {
|
|
7568
7568
|
sipSessionId,
|
|
7569
7569
|
oldStream: !!oldStream,
|
|
7570
7570
|
tracks: newStream.getTracks(),
|
|
@@ -7584,7 +7584,7 @@ class WebRTCClient extends Emitter {
|
|
|
7584
7584
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
7585
7585
|
const pc = this.getPeerConnection(sessionId);
|
|
7586
7586
|
|
|
7587
|
-
logger$
|
|
7587
|
+
logger$9.info('Updating remote stream', {
|
|
7588
7588
|
sessionId,
|
|
7589
7589
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
7590
7590
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -7609,14 +7609,16 @@ class WebRTCClient extends Emitter {
|
|
|
7609
7609
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
7610
7610
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
7611
7611
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
7612
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
7612
7613
|
|
|
7613
|
-
logger$
|
|
7614
|
+
logger$9.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
7614
7615
|
|
|
7615
7616
|
return {
|
|
7616
7617
|
constraints: {
|
|
7617
7618
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
7618
7619
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
7619
|
-
video: screenSharing ? (isDesktop
|
|
7620
|
+
video: screenSharing ? (isDesktop
|
|
7621
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
7620
7622
|
: this._getVideoConstraints(enableVideo),
|
|
7621
7623
|
screen: screenSharing,
|
|
7622
7624
|
desktop: isDesktop,
|
|
@@ -7659,7 +7661,7 @@ class WebRTCClient extends Emitter {
|
|
|
7659
7661
|
}
|
|
7660
7662
|
|
|
7661
7663
|
_onTransportError() {
|
|
7662
|
-
logger$
|
|
7664
|
+
logger$9.error('on transport error');
|
|
7663
7665
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
7664
7666
|
this.attemptReconnection();
|
|
7665
7667
|
}
|
|
@@ -7668,7 +7670,7 @@ class WebRTCClient extends Emitter {
|
|
|
7668
7670
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
7669
7671
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
7670
7672
|
if (this.hasHeartbeat()) {
|
|
7671
|
-
logger$
|
|
7673
|
+
logger$9.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
7672
7674
|
|
|
7673
7675
|
this.heartbeat.onHeartbeat();
|
|
7674
7676
|
if (this.heartbeatCb) {
|
|
@@ -7679,7 +7681,7 @@ class WebRTCClient extends Emitter {
|
|
|
7679
7681
|
}
|
|
7680
7682
|
|
|
7681
7683
|
async _onHeartbeatTimeout() {
|
|
7682
|
-
logger$
|
|
7684
|
+
logger$9.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7683
7685
|
|
|
7684
7686
|
if (this.heartbeatTimeoutCb) {
|
|
7685
7687
|
this.heartbeatTimeoutCb();
|
|
@@ -7691,7 +7693,7 @@ class WebRTCClient extends Emitter {
|
|
|
7691
7693
|
try {
|
|
7692
7694
|
await this.userAgent.transport.disconnect();
|
|
7693
7695
|
} catch (e) {
|
|
7694
|
-
logger$
|
|
7696
|
+
logger$9.error('Transport disconnection after heartbeat timeout, error', e);
|
|
7695
7697
|
}
|
|
7696
7698
|
}
|
|
7697
7699
|
|
|
@@ -7724,31 +7726,31 @@ class WebRTCClient extends Emitter {
|
|
|
7724
7726
|
}
|
|
7725
7727
|
|
|
7726
7728
|
_connectIfNeeded() {
|
|
7727
|
-
logger$
|
|
7729
|
+
logger$9.info('connect if needed, checking', { connected: this.isConnected() });
|
|
7728
7730
|
if (!this.userAgent) {
|
|
7729
|
-
logger$
|
|
7731
|
+
logger$9.info('need to recreate User Agent');
|
|
7730
7732
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
7731
7733
|
}
|
|
7732
7734
|
|
|
7733
7735
|
if (this.isConnected()) {
|
|
7734
|
-
logger$
|
|
7736
|
+
logger$9.info('webrtc sdk, already connected');
|
|
7735
7737
|
return Promise.resolve();
|
|
7736
7738
|
}
|
|
7737
7739
|
|
|
7738
7740
|
if (this.isConnecting()) {
|
|
7739
|
-
logger$
|
|
7741
|
+
logger$9.info('webrtc sdk, already connecting...');
|
|
7740
7742
|
|
|
7741
7743
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
7742
7744
|
return this.connectionPromise;
|
|
7743
7745
|
}
|
|
7744
7746
|
|
|
7745
7747
|
if (this.connectionPromise) {
|
|
7746
|
-
logger$
|
|
7748
|
+
logger$9.info('webrtc sdk, connection promise connecting...');
|
|
7747
7749
|
// $FlowFixMe
|
|
7748
7750
|
return this.connectionPromise;
|
|
7749
7751
|
}
|
|
7750
7752
|
|
|
7751
|
-
logger$
|
|
7753
|
+
logger$9.info('WebRTC UA needs to connect');
|
|
7752
7754
|
|
|
7753
7755
|
// Force UA to reconnect
|
|
7754
7756
|
if (this.userAgent && this.userAgent.state !== UserAgentState.Stopped) {
|
|
@@ -7873,7 +7875,7 @@ class WebRTCClient extends Emitter {
|
|
|
7873
7875
|
|
|
7874
7876
|
sdh.peerConnectionDelegate = {
|
|
7875
7877
|
onicecandidateerror: (error ) => {
|
|
7876
|
-
logger$
|
|
7878
|
+
logger$9.error('on icecandidate error', {
|
|
7877
7879
|
address: error.address,
|
|
7878
7880
|
port: error.port,
|
|
7879
7881
|
errorCode: error.errorCode,
|
|
@@ -7902,7 +7904,7 @@ class WebRTCClient extends Emitter {
|
|
|
7902
7904
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
7903
7905
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
7904
7906
|
}
|
|
7905
|
-
logger$
|
|
7907
|
+
logger$9.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
7906
7908
|
|
|
7907
7909
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
7908
7910
|
|
|
@@ -7918,12 +7920,12 @@ class WebRTCClient extends Emitter {
|
|
|
7918
7920
|
|
|
7919
7921
|
this._setupMedias(session);
|
|
7920
7922
|
|
|
7921
|
-
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
7923
|
+
return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
7922
7924
|
};
|
|
7923
7925
|
}
|
|
7924
7926
|
|
|
7925
7927
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
7926
|
-
logger$
|
|
7928
|
+
logger$9.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
7927
7929
|
|
|
7928
7930
|
this.storeSipSession(session);
|
|
7929
7931
|
|
|
@@ -7935,14 +7937,14 @@ class WebRTCClient extends Emitter {
|
|
|
7935
7937
|
const onTrack = (event ) => {
|
|
7936
7938
|
const isAudioOnly = this._isAudioOnly(session);
|
|
7937
7939
|
const { kind, label, readyState, id, muted } = event.track;
|
|
7938
|
-
logger$
|
|
7940
|
+
logger$9.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
7939
7941
|
|
|
7940
7942
|
// Stop video track in audio only mode
|
|
7941
7943
|
if (isAudioOnly && kind === 'video') {
|
|
7942
7944
|
event.track.stop();
|
|
7943
7945
|
}
|
|
7944
7946
|
|
|
7945
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
7947
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
7946
7948
|
};
|
|
7947
7949
|
|
|
7948
7950
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -7951,12 +7953,14 @@ class WebRTCClient extends Emitter {
|
|
|
7951
7953
|
|
|
7952
7954
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7953
7955
|
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7956
|
+
if (pc) {
|
|
7957
|
+
pc.oniceconnectionstatechange = () => {
|
|
7958
|
+
logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7959
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
7960
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
7961
|
+
}
|
|
7962
|
+
};
|
|
7963
|
+
}
|
|
7960
7964
|
|
|
7961
7965
|
if (withEvent) {
|
|
7962
7966
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8125,10 +8129,10 @@ class WebRTCClient extends Emitter {
|
|
|
8125
8129
|
|
|
8126
8130
|
_stopSendingStats(session ) {
|
|
8127
8131
|
const sessionId = this.getSipSessionId(session);
|
|
8128
|
-
logger$
|
|
8132
|
+
logger$9.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8129
8133
|
|
|
8130
8134
|
if (sessionId in this.statsIntervals) {
|
|
8131
|
-
logger$
|
|
8135
|
+
logger$9.trace('Stop sending stats for call', { sessionId });
|
|
8132
8136
|
this.statsIntervals[sessionId]();
|
|
8133
8137
|
delete this.statsIntervals[sessionId];
|
|
8134
8138
|
}
|
|
@@ -8144,7 +8148,7 @@ class WebRTCClient extends Emitter {
|
|
|
8144
8148
|
try {
|
|
8145
8149
|
await this.userAgent.transport.disconnect();
|
|
8146
8150
|
} catch (e) {
|
|
8147
|
-
logger$
|
|
8151
|
+
logger$9.error('WebRTC transport disconnect, error', e);
|
|
8148
8152
|
}
|
|
8149
8153
|
}
|
|
8150
8154
|
}
|
|
@@ -8166,13 +8170,17 @@ class WebRTCClient extends Emitter {
|
|
|
8166
8170
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8167
8171
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8168
8172
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8173
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8169
8174
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8170
8175
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8176
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8171
8177
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8172
8178
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8173
8179
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8174
|
-
let audioBytesSent = 0;
|
|
8175
|
-
let audioBytesReceived = 0;
|
|
8180
|
+
let audioBytesSent = 0; // content + header
|
|
8181
|
+
let audioBytesReceived = 0; // content + header
|
|
8182
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8183
|
+
let audioContentReceived = 0;
|
|
8176
8184
|
let videoBytesSent = 0;
|
|
8177
8185
|
let videoBytesReceived = 0;
|
|
8178
8186
|
let transportSent = 0;
|
|
@@ -8182,6 +8190,7 @@ class WebRTCClient extends Emitter {
|
|
|
8182
8190
|
stats.forEach(report => {
|
|
8183
8191
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8184
8192
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8193
|
+
audioContentSent += Number(report.bytesSent);
|
|
8185
8194
|
}
|
|
8186
8195
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8187
8196
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -8193,6 +8202,7 @@ class WebRTCClient extends Emitter {
|
|
|
8193
8202
|
packetsLost += Number(report.packetsLost);
|
|
8194
8203
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8195
8204
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8205
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8196
8206
|
}
|
|
8197
8207
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8198
8208
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -8221,10 +8231,17 @@ class WebRTCClient extends Emitter {
|
|
|
8221
8231
|
});
|
|
8222
8232
|
|
|
8223
8233
|
networkStats.packetsLost = packetsLost;
|
|
8234
|
+
|
|
8224
8235
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8225
8236
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8226
8237
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8227
8238
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8239
|
+
|
|
8240
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8241
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8242
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8243
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8244
|
+
|
|
8228
8245
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8229
8246
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8230
8247
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8238,7 +8255,7 @@ class WebRTCClient extends Emitter {
|
|
|
8238
8255
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8239
8256
|
+ networkStats.transportSent;
|
|
8240
8257
|
|
|
8241
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8258
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8242
8259
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8243
8260
|
}
|
|
8244
8261
|
|
|
@@ -8246,7 +8263,7 @@ class WebRTCClient extends Emitter {
|
|
|
8246
8263
|
|
|
8247
8264
|
//
|
|
8248
8265
|
|
|
8249
|
-
const SOCKET_EVENTS = {
|
|
8266
|
+
const SOCKET_EVENTS$1 = {
|
|
8250
8267
|
ON_OPEN: 'onopen',
|
|
8251
8268
|
ON_MESSAGE: 'onmessage',
|
|
8252
8269
|
ON_ERROR: 'onerror',
|
|
@@ -8342,7 +8359,7 @@ const BLACKLIST_EVENTS = [
|
|
|
8342
8359
|
];
|
|
8343
8360
|
|
|
8344
8361
|
const HEARTBEAT_ENGINE_VERSION = '20.09';
|
|
8345
|
-
const logger$
|
|
8362
|
+
const logger$8 = IssueReporter$1.loggerFor('wazo-ws');
|
|
8346
8363
|
const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
|
|
8347
8364
|
|
|
8348
8365
|
class WebSocketClient extends Emitter {
|
|
@@ -8391,24 +8408,24 @@ class WebSocketClient extends Emitter {
|
|
|
8391
8408
|
}
|
|
8392
8409
|
|
|
8393
8410
|
connect() {
|
|
8394
|
-
logger$
|
|
8411
|
+
logger$8.info('connect method started', { host: this.host, token: this.token });
|
|
8395
8412
|
this.socket = new ReconnectingWebSocket(this._getUrl.bind(this), [], this.options);
|
|
8396
8413
|
if (this.options.binaryType) {
|
|
8397
8414
|
this.socket.binaryType = this.options.binaryType;
|
|
8398
8415
|
}
|
|
8399
8416
|
|
|
8400
8417
|
this.socket.onopen = () => {
|
|
8401
|
-
logger$
|
|
8402
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
8418
|
+
logger$8.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
8419
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
|
|
8403
8420
|
};
|
|
8404
8421
|
|
|
8405
8422
|
this.socket.onerror = event => {
|
|
8406
|
-
logger$
|
|
8407
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
8423
|
+
logger$8.error('on Wazo WS error', event.target);
|
|
8424
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
|
|
8408
8425
|
};
|
|
8409
8426
|
|
|
8410
8427
|
this.socket.onmessage = (event ) => {
|
|
8411
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
8428
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
|
|
8412
8429
|
|
|
8413
8430
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
8414
8431
|
let { name } = message;
|
|
@@ -8433,7 +8450,7 @@ class WebSocketClient extends Emitter {
|
|
|
8433
8450
|
|
|
8434
8451
|
this.socket.onclose = event => {
|
|
8435
8452
|
// Can't be converted to JSON (circular structure)
|
|
8436
|
-
logger$
|
|
8453
|
+
logger$8.info('on Wazo WS close', {
|
|
8437
8454
|
reason: event.reason,
|
|
8438
8455
|
code: event.code,
|
|
8439
8456
|
readyState: event.target.readyState,
|
|
@@ -8441,22 +8458,22 @@ class WebSocketClient extends Emitter {
|
|
|
8441
8458
|
token: this.token,
|
|
8442
8459
|
});
|
|
8443
8460
|
this.initialized = false;
|
|
8444
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
8461
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
|
|
8445
8462
|
|
|
8446
8463
|
switch (event.code) {
|
|
8447
8464
|
case 4002:
|
|
8448
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
8465
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
|
|
8449
8466
|
break;
|
|
8450
8467
|
}
|
|
8451
8468
|
};
|
|
8452
8469
|
|
|
8453
8470
|
this.socket.onerror = event => {
|
|
8454
|
-
logger$
|
|
8471
|
+
logger$8.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
|
|
8455
8472
|
};
|
|
8456
8473
|
}
|
|
8457
8474
|
|
|
8458
8475
|
close(force = false) {
|
|
8459
|
-
logger$
|
|
8476
|
+
logger$8.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
|
|
8460
8477
|
|
|
8461
8478
|
if (!this.socket) {
|
|
8462
8479
|
return;
|
|
@@ -8474,7 +8491,7 @@ class WebSocketClient extends Emitter {
|
|
|
8474
8491
|
|
|
8475
8492
|
updateToken(token ) {
|
|
8476
8493
|
this.token = token;
|
|
8477
|
-
logger$
|
|
8494
|
+
logger$8.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
|
|
8478
8495
|
|
|
8479
8496
|
if (this.socket) {
|
|
8480
8497
|
// If still connected, send the token to the WS
|
|
@@ -8492,7 +8509,7 @@ class WebSocketClient extends Emitter {
|
|
|
8492
8509
|
}
|
|
8493
8510
|
|
|
8494
8511
|
startHeartbeat() {
|
|
8495
|
-
logger$
|
|
8512
|
+
logger$8.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
|
|
8496
8513
|
|
|
8497
8514
|
if (!this.socket) {
|
|
8498
8515
|
this.heartbeat.stop();
|
|
@@ -8506,7 +8523,7 @@ class WebSocketClient extends Emitter {
|
|
|
8506
8523
|
}
|
|
8507
8524
|
|
|
8508
8525
|
stopHeartbeat() {
|
|
8509
|
-
logger$
|
|
8526
|
+
logger$8.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
|
|
8510
8527
|
|
|
8511
8528
|
this.heartbeat.stop();
|
|
8512
8529
|
}
|
|
@@ -8536,7 +8553,7 @@ class WebSocketClient extends Emitter {
|
|
|
8536
8553
|
}
|
|
8537
8554
|
|
|
8538
8555
|
reconnect(reason ) {
|
|
8539
|
-
logger$
|
|
8556
|
+
logger$8.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
|
|
8540
8557
|
if (!this.socket) {
|
|
8541
8558
|
return;
|
|
8542
8559
|
}
|
|
@@ -8561,7 +8578,7 @@ class WebSocketClient extends Emitter {
|
|
|
8561
8578
|
break;
|
|
8562
8579
|
case 'start':
|
|
8563
8580
|
this.initialized = true;
|
|
8564
|
-
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
8581
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
|
|
8565
8582
|
break;
|
|
8566
8583
|
default:
|
|
8567
8584
|
this.eventEmitter.emit('message', message);
|
|
@@ -8592,7 +8609,7 @@ class WebSocketClient extends Emitter {
|
|
|
8592
8609
|
this.close();
|
|
8593
8610
|
}
|
|
8594
8611
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
8595
|
-
logger$
|
|
8612
|
+
logger$8.log('Wazo WS url computed to reconnect', { url });
|
|
8596
8613
|
|
|
8597
8614
|
return url;
|
|
8598
8615
|
}
|
|
@@ -8600,15 +8617,15 @@ class WebSocketClient extends Emitter {
|
|
|
8600
8617
|
_onHeartbeat(message ) {
|
|
8601
8618
|
if (message.payload === 'pong') {
|
|
8602
8619
|
this.heartbeat.onHeartbeat();
|
|
8603
|
-
logger$
|
|
8620
|
+
logger$8.log('on heartbeat received from Wazo WS');
|
|
8604
8621
|
}
|
|
8605
8622
|
}
|
|
8606
8623
|
|
|
8607
8624
|
async _onHeartbeatTimeout() {
|
|
8608
|
-
logger$
|
|
8625
|
+
logger$8.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
8609
8626
|
|
|
8610
8627
|
this.close();
|
|
8611
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
8628
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
8612
8629
|
|
|
8613
8630
|
if (this.onHeartBeatTimeout) {
|
|
8614
8631
|
this.onHeartBeatTimeout();
|
|
@@ -8688,7 +8705,7 @@ WebSocketClient.eventLists = [
|
|
|
8688
8705
|
|
|
8689
8706
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
8690
8707
|
__proto__: null,
|
|
8691
|
-
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
8708
|
+
SOCKET_EVENTS: SOCKET_EVENTS$1,
|
|
8692
8709
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
8693
8710
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
8694
8711
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -8921,7 +8938,7 @@ class NotificationOptions {
|
|
|
8921
8938
|
|
|
8922
8939
|
|
|
8923
8940
|
// Represents a conference room, like `9000`.
|
|
8924
|
-
class Room {
|
|
8941
|
+
class Room$1 {
|
|
8925
8942
|
|
|
8926
8943
|
|
|
8927
8944
|
|
|
@@ -8942,7 +8959,7 @@ class Room {
|
|
|
8942
8959
|
}
|
|
8943
8960
|
|
|
8944
8961
|
connect(callSession ) {
|
|
8945
|
-
return new Room({ ...this, connectedCallSession: callSession });
|
|
8962
|
+
return new Room$1({ ...this, connectedCallSession: callSession });
|
|
8946
8963
|
}
|
|
8947
8964
|
|
|
8948
8965
|
has(callSession ) {
|
|
@@ -8951,7 +8968,7 @@ class Room {
|
|
|
8951
8968
|
|
|
8952
8969
|
addParticipant(uuid , extension , talking = null) {
|
|
8953
8970
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
8954
|
-
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
8971
|
+
return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
8955
8972
|
}
|
|
8956
8973
|
|
|
8957
8974
|
return this;
|
|
@@ -8970,7 +8987,7 @@ class Room {
|
|
|
8970
8987
|
updatedParticipants.push(participant);
|
|
8971
8988
|
}
|
|
8972
8989
|
|
|
8973
|
-
return new Room({ ...this, participants: updatedParticipants });
|
|
8990
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
8974
8991
|
}
|
|
8975
8992
|
|
|
8976
8993
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -8986,7 +9003,7 @@ class Room {
|
|
|
8986
9003
|
updatedParticipants.push(participant);
|
|
8987
9004
|
}
|
|
8988
9005
|
|
|
8989
|
-
return new Room({ ...this, participants: updatedParticipants });
|
|
9006
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
8990
9007
|
}
|
|
8991
9008
|
|
|
8992
9009
|
hasCallWithId(id ) {
|
|
@@ -8994,18 +9011,18 @@ class Room {
|
|
|
8994
9011
|
}
|
|
8995
9012
|
|
|
8996
9013
|
disconnect() {
|
|
8997
|
-
return new Room({ ...this, connectedCallSession: null });
|
|
9014
|
+
return new Room$1({ ...this, connectedCallSession: null });
|
|
8998
9015
|
}
|
|
8999
9016
|
|
|
9000
9017
|
removeParticipantWithUUID(uuid ) {
|
|
9001
|
-
return new Room({
|
|
9018
|
+
return new Room$1({
|
|
9002
9019
|
...this,
|
|
9003
9020
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
9004
9021
|
});
|
|
9005
9022
|
}
|
|
9006
9023
|
|
|
9007
9024
|
removeParticipantWithExtension(extension ) {
|
|
9008
|
-
return new Room({
|
|
9025
|
+
return new Room$1({
|
|
9009
9026
|
...this,
|
|
9010
9027
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
9011
9028
|
});
|
|
@@ -9016,7 +9033,7 @@ class Room {
|
|
|
9016
9033
|
}
|
|
9017
9034
|
|
|
9018
9035
|
static newFrom(room ) {
|
|
9019
|
-
return newFrom(room, Room);
|
|
9036
|
+
return newFrom(room, Room$1);
|
|
9020
9037
|
}
|
|
9021
9038
|
}
|
|
9022
9039
|
|
|
@@ -9159,8 +9176,8 @@ const ON_CALL_FAILED = 'onCallFailed';
|
|
|
9159
9176
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
9160
9177
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
9161
9178
|
const ON_MESSAGE = 'onMessage';
|
|
9162
|
-
const ON_REINVITE
|
|
9163
|
-
const ON_TRACK
|
|
9179
|
+
const ON_REINVITE = 'reinvite';
|
|
9180
|
+
const ON_TRACK = 'onTrack';
|
|
9164
9181
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
9165
9182
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
9166
9183
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -9175,15 +9192,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
9175
9192
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
9176
9193
|
const ON_CALL_ERROR = 'onCallError';
|
|
9177
9194
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
9178
|
-
const ON_NETWORK_STATS
|
|
9195
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
9179
9196
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
9180
9197
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
9181
|
-
const ON_DISCONNECTED
|
|
9198
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
9182
9199
|
|
|
9183
9200
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
9184
9201
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
9185
9202
|
|
|
9186
|
-
const events
|
|
9203
|
+
const events = [
|
|
9187
9204
|
ON_USER_AGENT,
|
|
9188
9205
|
ON_REGISTERED,
|
|
9189
9206
|
ON_UNREGISTERED,
|
|
@@ -9201,8 +9218,8 @@ const events$1 = [
|
|
|
9201
9218
|
ON_CALL_FAILED,
|
|
9202
9219
|
ON_CALL_ENDED,
|
|
9203
9220
|
ON_MESSAGE,
|
|
9204
|
-
ON_REINVITE
|
|
9205
|
-
ON_TRACK
|
|
9221
|
+
ON_REINVITE,
|
|
9222
|
+
ON_TRACK,
|
|
9206
9223
|
ON_AUDIO_STREAM,
|
|
9207
9224
|
ON_VIDEO_STREAM,
|
|
9208
9225
|
ON_REMOVE_STREAM,
|
|
@@ -9217,11 +9234,11 @@ const events$1 = [
|
|
|
9217
9234
|
ON_CALL_ERROR,
|
|
9218
9235
|
ON_CHAT,
|
|
9219
9236
|
ON_SIGNAL,
|
|
9220
|
-
ON_NETWORK_STATS
|
|
9221
|
-
ON_DISCONNECTED
|
|
9237
|
+
ON_NETWORK_STATS,
|
|
9238
|
+
ON_DISCONNECTED,
|
|
9222
9239
|
];
|
|
9223
9240
|
|
|
9224
|
-
const logger$
|
|
9241
|
+
const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
9225
9242
|
|
|
9226
9243
|
class WebRTCPhone extends Emitter {
|
|
9227
9244
|
|
|
@@ -9294,7 +9311,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9294
9311
|
}).catch(error => {
|
|
9295
9312
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
9296
9313
|
console.error('register error', error, error.message, error.stack);
|
|
9297
|
-
logger$
|
|
9314
|
+
logger$7.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
9298
9315
|
});
|
|
9299
9316
|
}
|
|
9300
9317
|
|
|
@@ -9309,7 +9326,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9309
9326
|
if (!this.client) {
|
|
9310
9327
|
return;
|
|
9311
9328
|
}
|
|
9312
|
-
logger$
|
|
9329
|
+
logger$7.info('WebRTC phone stop');
|
|
9313
9330
|
this.client.stop();
|
|
9314
9331
|
}
|
|
9315
9332
|
|
|
@@ -9324,11 +9341,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9324
9341
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
9325
9342
|
audioOnly = false, iceRestart = false) {
|
|
9326
9343
|
const sipSession = this.findSipSession(callSession);
|
|
9327
|
-
logger$
|
|
9344
|
+
logger$7.info('WebRTC phone - send reinvite', {
|
|
9328
9345
|
sessionId: sipSession ? sipSession.id : null,
|
|
9329
9346
|
constraints,
|
|
9330
9347
|
audioOnly,
|
|
9331
9348
|
conference,
|
|
9349
|
+
iceRestart,
|
|
9332
9350
|
});
|
|
9333
9351
|
|
|
9334
9352
|
if (!sipSession) {
|
|
@@ -9361,7 +9379,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9361
9379
|
}
|
|
9362
9380
|
|
|
9363
9381
|
startHeartbeat() {
|
|
9364
|
-
logger$
|
|
9382
|
+
logger$7.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
9365
9383
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
9366
9384
|
return;
|
|
9367
9385
|
}
|
|
@@ -9370,7 +9388,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9370
9388
|
}
|
|
9371
9389
|
|
|
9372
9390
|
stopHeartbeat() {
|
|
9373
|
-
logger$
|
|
9391
|
+
logger$7.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
9374
9392
|
if (!this.client) {
|
|
9375
9393
|
return;
|
|
9376
9394
|
}
|
|
@@ -9387,7 +9405,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9387
9405
|
}
|
|
9388
9406
|
|
|
9389
9407
|
reconnect() {
|
|
9390
|
-
logger$
|
|
9408
|
+
logger$7.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
9391
9409
|
if (!this.client) {
|
|
9392
9410
|
return;
|
|
9393
9411
|
}
|
|
@@ -9428,7 +9446,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9428
9446
|
return false;
|
|
9429
9447
|
}
|
|
9430
9448
|
|
|
9431
|
-
logger$
|
|
9449
|
+
logger$7.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
9432
9450
|
|
|
9433
9451
|
this.client.downgradeToAudio(sipSession);
|
|
9434
9452
|
|
|
@@ -9451,7 +9469,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9451
9469
|
return Promise.resolve(false);
|
|
9452
9470
|
}
|
|
9453
9471
|
|
|
9454
|
-
logger$
|
|
9472
|
+
logger$7.info('Upgrade to video', {
|
|
9455
9473
|
id: callSession ? callSession.getId() : null,
|
|
9456
9474
|
constraints,
|
|
9457
9475
|
isConference,
|
|
@@ -9491,7 +9509,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9491
9509
|
|
|
9492
9510
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
9493
9511
|
const sipSession = this.findSipSession(callSession);
|
|
9494
|
-
logger$
|
|
9512
|
+
logger$7.info('Sending reinvite message', {
|
|
9495
9513
|
id: callSession ? callSession.getId() : null,
|
|
9496
9514
|
isUpgrade,
|
|
9497
9515
|
});
|
|
@@ -9517,7 +9535,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9517
9535
|
// Monkey patch to know when canceled with the CANCEL message
|
|
9518
9536
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
9519
9537
|
sipSession._onCancel = (message ) => {
|
|
9520
|
-
logger$
|
|
9538
|
+
logger$7.trace('on sip session canceled', { callId: message.callId });
|
|
9521
9539
|
|
|
9522
9540
|
onCancel(message);
|
|
9523
9541
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -9545,13 +9563,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9545
9563
|
this.audioOutputVolume,
|
|
9546
9564
|
);
|
|
9547
9565
|
case SessionState.Terminating:
|
|
9548
|
-
logger$
|
|
9566
|
+
logger$7.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
9549
9567
|
|
|
9550
9568
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
9551
9569
|
|
|
9552
9570
|
break;
|
|
9553
9571
|
case SessionState.Terminated: {
|
|
9554
|
-
logger$
|
|
9572
|
+
logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9555
9573
|
|
|
9556
9574
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9557
9575
|
const callSession = this._createCallSession(sipSession);
|
|
@@ -9573,7 +9591,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9573
9591
|
const [stream] = event.streams;
|
|
9574
9592
|
const kind = event && event.track && event.track.kind;
|
|
9575
9593
|
|
|
9576
|
-
logger$
|
|
9594
|
+
logger$7.info('on track stream called on the peer connection', {
|
|
9577
9595
|
callId: this.getSipSessionId(sipSession),
|
|
9578
9596
|
streamId: stream ? stream.id : null,
|
|
9579
9597
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -9593,7 +9611,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9593
9611
|
};
|
|
9594
9612
|
|
|
9595
9613
|
peerConnection.onremovestream = event => {
|
|
9596
|
-
logger$
|
|
9614
|
+
logger$7.info('on remove stream called on the peer connection', {
|
|
9597
9615
|
id: event.stream.id,
|
|
9598
9616
|
tracks: event.stream.getTracks(),
|
|
9599
9617
|
});
|
|
@@ -9603,7 +9621,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9603
9621
|
}
|
|
9604
9622
|
|
|
9605
9623
|
async startScreenSharing(constraints , callSession ) {
|
|
9606
|
-
logger$
|
|
9624
|
+
logger$7.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
9607
9625
|
|
|
9608
9626
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
9609
9627
|
if (!screenShareStream) {
|
|
@@ -9643,7 +9661,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9643
9661
|
return;
|
|
9644
9662
|
}
|
|
9645
9663
|
|
|
9646
|
-
logger$
|
|
9664
|
+
logger$7.info('WebRTC phone - stop screen sharing', {
|
|
9647
9665
|
restoreLocalStream,
|
|
9648
9666
|
});
|
|
9649
9667
|
|
|
@@ -9699,7 +9717,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9699
9717
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
9700
9718
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9701
9719
|
|
|
9702
|
-
logger$
|
|
9720
|
+
logger$7.info('WebRTC phone - on screensharing', {
|
|
9703
9721
|
hadVideo,
|
|
9704
9722
|
id: this.getSipSessionId(sipSession),
|
|
9705
9723
|
screenTrack,
|
|
@@ -9707,7 +9725,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9707
9725
|
|
|
9708
9726
|
if (screenTrack) {
|
|
9709
9727
|
screenTrack.onended = () => {
|
|
9710
|
-
logger$
|
|
9728
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9711
9729
|
hadVideo,
|
|
9712
9730
|
id: this.getSipSessionId(sipSession),
|
|
9713
9731
|
screenTrack,
|
|
@@ -9738,7 +9756,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9738
9756
|
}
|
|
9739
9757
|
|
|
9740
9758
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9741
|
-
logger$
|
|
9759
|
+
logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9742
9760
|
|
|
9743
9761
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9744
9762
|
this.currentSipSession = sipSession;
|
|
@@ -9756,7 +9774,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9756
9774
|
}
|
|
9757
9775
|
|
|
9758
9776
|
changeAudioDevice(id ) {
|
|
9759
|
-
logger$
|
|
9777
|
+
logger$7.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9760
9778
|
this.audioOutputDeviceId = id;
|
|
9761
9779
|
this.client.changeAudioOutputDevice(id);
|
|
9762
9780
|
}
|
|
@@ -9766,14 +9784,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9766
9784
|
}
|
|
9767
9785
|
|
|
9768
9786
|
changeRingDevice(id ) {
|
|
9769
|
-
logger$
|
|
9787
|
+
logger$7.info('WebRTC phone - changing ring device', { id });
|
|
9770
9788
|
|
|
9771
9789
|
this.audioRingDeviceId = id;
|
|
9772
9790
|
}
|
|
9773
9791
|
|
|
9774
9792
|
// volume is a value between 0 and 1
|
|
9775
9793
|
changeAudioVolume(volume ) {
|
|
9776
|
-
logger$
|
|
9794
|
+
logger$7.info('WebRTC phone - changing audio volume', { volume });
|
|
9777
9795
|
|
|
9778
9796
|
this.audioOutputVolume = volume;
|
|
9779
9797
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9781,31 +9799,31 @@ class WebRTCPhone extends Emitter {
|
|
|
9781
9799
|
|
|
9782
9800
|
// volume is a value between 0 and 1
|
|
9783
9801
|
changeRingVolume(volume ) {
|
|
9784
|
-
logger$
|
|
9802
|
+
logger$7.info('WebRTC phone - changing ring volume', { volume });
|
|
9785
9803
|
|
|
9786
9804
|
this.audioRingVolume = volume;
|
|
9787
9805
|
}
|
|
9788
9806
|
|
|
9789
9807
|
changeAudioInputDevice(id ) {
|
|
9790
|
-
logger$
|
|
9808
|
+
logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9791
9809
|
|
|
9792
9810
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9793
9811
|
}
|
|
9794
9812
|
|
|
9795
9813
|
changeVideoInputDevice(id ) {
|
|
9796
|
-
logger$
|
|
9814
|
+
logger$7.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9797
9815
|
|
|
9798
9816
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9799
9817
|
}
|
|
9800
9818
|
|
|
9801
9819
|
changeSessionVideoInputDevice(id ) {
|
|
9802
|
-
logger$
|
|
9820
|
+
logger$7.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9803
9821
|
|
|
9804
9822
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9805
9823
|
}
|
|
9806
9824
|
|
|
9807
9825
|
_onCallTerminated(sipSession ) {
|
|
9808
|
-
logger$
|
|
9826
|
+
logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9809
9827
|
|
|
9810
9828
|
const callSession = this._createCallSession(sipSession);
|
|
9811
9829
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
@@ -9839,7 +9857,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9839
9857
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9840
9858
|
|
|
9841
9859
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9842
|
-
logger$
|
|
9860
|
+
logger$7.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9843
9861
|
sipId: sipSession.id,
|
|
9844
9862
|
shouldRetrigger,
|
|
9845
9863
|
hasIncomingCallSession,
|
|
@@ -9930,37 +9948,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9930
9948
|
|
|
9931
9949
|
// Deprecated
|
|
9932
9950
|
getLocalStreamForCall(callSession ) {
|
|
9933
|
-
logger$
|
|
9951
|
+
logger$7.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9934
9952
|
|
|
9935
9953
|
return this.getLocalStream(callSession);
|
|
9936
9954
|
}
|
|
9937
9955
|
|
|
9938
9956
|
// Deprecated
|
|
9939
9957
|
getRemoteStreamForCall(callSession ) {
|
|
9940
|
-
logger$
|
|
9958
|
+
logger$7.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9941
9959
|
|
|
9942
9960
|
return this.getRemoteVideoStream(callSession);
|
|
9943
9961
|
}
|
|
9944
9962
|
|
|
9945
9963
|
getRemoteStreamsForCall(callSession ) {
|
|
9946
|
-
logger$
|
|
9964
|
+
logger$7.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9947
9965
|
|
|
9948
9966
|
return this.getRemoteStream(callSession);
|
|
9949
9967
|
}
|
|
9950
9968
|
|
|
9951
9969
|
accept(callSession , cameraEnabled ) {
|
|
9952
|
-
logger$
|
|
9970
|
+
logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9953
9971
|
if (this.currentSipSession) {
|
|
9954
9972
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9955
9973
|
}
|
|
9956
9974
|
|
|
9957
9975
|
if (!callSession) {
|
|
9958
|
-
logger$
|
|
9976
|
+
logger$7.warn('no CallSession to accept.');
|
|
9959
9977
|
return Promise.resolve(null);
|
|
9960
9978
|
}
|
|
9961
9979
|
|
|
9962
9980
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9963
|
-
logger$
|
|
9981
|
+
logger$7.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9964
9982
|
return Promise.resolve(callSession.sipCallId);
|
|
9965
9983
|
}
|
|
9966
9984
|
|
|
@@ -9972,24 +9990,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9972
9990
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9973
9991
|
if (sipSession) {
|
|
9974
9992
|
if (sipSession.state === SessionState.Terminated || sipSession.state === SessionState.Terminating) {
|
|
9975
|
-
logger$
|
|
9993
|
+
logger$7.warn('Trying to answer a terminated sipSession.');
|
|
9976
9994
|
|
|
9977
9995
|
return Promise.resolve(null);
|
|
9978
9996
|
}
|
|
9979
9997
|
|
|
9980
|
-
logger$
|
|
9998
|
+
logger$7.info('accept call, session found', { sipId: sipSession.id });
|
|
9981
9999
|
|
|
9982
10000
|
// $FlowFixMe
|
|
9983
10001
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9984
10002
|
return callSession.sipCallId;
|
|
9985
10003
|
}).catch(e => {
|
|
9986
|
-
logger$
|
|
10004
|
+
logger$7.error(e);
|
|
9987
10005
|
this.endCurrentCall(callSession);
|
|
9988
10006
|
throw e;
|
|
9989
10007
|
});
|
|
9990
10008
|
}
|
|
9991
10009
|
|
|
9992
|
-
logger$
|
|
10010
|
+
logger$7.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9993
10011
|
|
|
9994
10012
|
return Promise.resolve(null);
|
|
9995
10013
|
}
|
|
@@ -9999,7 +10017,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9999
10017
|
}
|
|
10000
10018
|
|
|
10001
10019
|
async reject(callSession ) {
|
|
10002
|
-
logger$
|
|
10020
|
+
logger$7.info('reject WebRTC called', { id: callSession.getId() });
|
|
10003
10021
|
|
|
10004
10022
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
10005
10023
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -10011,14 +10029,14 @@ class WebRTCPhone extends Emitter {
|
|
|
10011
10029
|
|
|
10012
10030
|
const sipSession = this.findSipSession(callSession);
|
|
10013
10031
|
if (sipSession) {
|
|
10014
|
-
logger$
|
|
10032
|
+
logger$7.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
10015
10033
|
|
|
10016
10034
|
this.client.hangup(sipSession);
|
|
10017
10035
|
}
|
|
10018
10036
|
}
|
|
10019
10037
|
|
|
10020
10038
|
async ignore(callSession ) {
|
|
10021
|
-
logger$
|
|
10039
|
+
logger$7.info('WebRTC ignore', { id: callSession.getId() });
|
|
10022
10040
|
|
|
10023
10041
|
// kill the ring
|
|
10024
10042
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -10030,14 +10048,14 @@ class WebRTCPhone extends Emitter {
|
|
|
10030
10048
|
const sipSession = this.findSipSession(callSession);
|
|
10031
10049
|
|
|
10032
10050
|
if (sipSession) {
|
|
10033
|
-
logger$
|
|
10051
|
+
logger$7.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
10034
10052
|
|
|
10035
10053
|
return this.client.atxfer(sipSession);
|
|
10036
10054
|
}
|
|
10037
10055
|
}
|
|
10038
10056
|
|
|
10039
10057
|
hold(callSession , withEvent = true, isConference = false) {
|
|
10040
|
-
logger$
|
|
10058
|
+
logger$7.info('WebRTC hold', { id: callSession.getId() });
|
|
10041
10059
|
|
|
10042
10060
|
const sipSession = this.findSipSession(callSession);
|
|
10043
10061
|
|
|
@@ -10052,18 +10070,18 @@ class WebRTCPhone extends Emitter {
|
|
|
10052
10070
|
}
|
|
10053
10071
|
|
|
10054
10072
|
resume(callSession , isConference = false, withEvent = true) {
|
|
10055
|
-
logger$
|
|
10073
|
+
logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
10056
10074
|
|
|
10057
10075
|
const sipSession = this.findSipSession(callSession);
|
|
10058
10076
|
if (!sipSession) {
|
|
10059
10077
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
10060
10078
|
}
|
|
10061
10079
|
|
|
10062
|
-
logger$
|
|
10080
|
+
logger$7.info('WebRTC resuming', { sipId: sipSession.id });
|
|
10063
10081
|
|
|
10064
10082
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
10065
10083
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
10066
|
-
logger$
|
|
10084
|
+
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
10067
10085
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
10068
10086
|
}
|
|
10069
10087
|
|
|
@@ -10088,7 +10106,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10088
10106
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10089
10107
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
10090
10108
|
|
|
10091
|
-
logger$
|
|
10109
|
+
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
10092
10110
|
|
|
10093
10111
|
// Stop screenshre if needed
|
|
10094
10112
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -10119,7 +10137,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10119
10137
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
10120
10138
|
}
|
|
10121
10139
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10122
|
-
logger$
|
|
10140
|
+
logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
10123
10141
|
|
|
10124
10142
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
10125
10143
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -10163,14 +10181,14 @@ class WebRTCPhone extends Emitter {
|
|
|
10163
10181
|
}
|
|
10164
10182
|
|
|
10165
10183
|
mute(callSession , withEvent = true) {
|
|
10166
|
-
logger$
|
|
10184
|
+
logger$7.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
10167
10185
|
|
|
10168
10186
|
const sipSession = this.findSipSession(callSession);
|
|
10169
10187
|
if (!sipSession) {
|
|
10170
10188
|
return;
|
|
10171
10189
|
}
|
|
10172
10190
|
|
|
10173
|
-
logger$
|
|
10191
|
+
logger$7.info('WebRTC muting', { sipId: sipSession.id });
|
|
10174
10192
|
this.client.mute(sipSession);
|
|
10175
10193
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
10176
10194
|
|
|
@@ -10184,14 +10202,14 @@ class WebRTCPhone extends Emitter {
|
|
|
10184
10202
|
}
|
|
10185
10203
|
|
|
10186
10204
|
unmute(callSession , withEvent = true) {
|
|
10187
|
-
logger$
|
|
10205
|
+
logger$7.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
10188
10206
|
|
|
10189
10207
|
const sipSession = this.findSipSession(callSession);
|
|
10190
10208
|
if (!sipSession) {
|
|
10191
10209
|
return;
|
|
10192
10210
|
}
|
|
10193
10211
|
|
|
10194
|
-
logger$
|
|
10212
|
+
logger$7.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
10195
10213
|
this.client.unmute(sipSession);
|
|
10196
10214
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
10197
10215
|
|
|
@@ -10218,7 +10236,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10218
10236
|
if (!sipSession) {
|
|
10219
10237
|
return;
|
|
10220
10238
|
}
|
|
10221
|
-
logger$
|
|
10239
|
+
logger$7.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
10222
10240
|
|
|
10223
10241
|
this.client.toggleCameraOn(sipSession);
|
|
10224
10242
|
|
|
@@ -10230,7 +10248,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10230
10248
|
if (!sipSession) {
|
|
10231
10249
|
return;
|
|
10232
10250
|
}
|
|
10233
|
-
logger$
|
|
10251
|
+
logger$7.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
10234
10252
|
|
|
10235
10253
|
this.client.toggleCameraOff(sipSession);
|
|
10236
10254
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -10242,7 +10260,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10242
10260
|
return;
|
|
10243
10261
|
}
|
|
10244
10262
|
|
|
10245
|
-
logger$
|
|
10263
|
+
logger$7.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
10246
10264
|
this.client.sendDTMF(sipSession, tone);
|
|
10247
10265
|
}
|
|
10248
10266
|
|
|
@@ -10250,7 +10268,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10250
10268
|
// @TODO: line is not used here
|
|
10251
10269
|
async makeCall(number , line , cameraEnabled ,
|
|
10252
10270
|
audioOnly = false, conference = false) {
|
|
10253
|
-
logger$
|
|
10271
|
+
logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
10254
10272
|
if (!number) {
|
|
10255
10273
|
return Promise.resolve(null);
|
|
10256
10274
|
}
|
|
@@ -10260,7 +10278,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10260
10278
|
}
|
|
10261
10279
|
if (this.currentSipSession) {
|
|
10262
10280
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
10263
|
-
logger$
|
|
10281
|
+
logger$7.warn('Unable to hold current session when making another call', e);
|
|
10264
10282
|
});
|
|
10265
10283
|
}
|
|
10266
10284
|
|
|
@@ -10270,7 +10288,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10270
10288
|
this._bindEvents(sipSession);
|
|
10271
10289
|
} catch (error) {
|
|
10272
10290
|
console.warn(error);
|
|
10273
|
-
logger$
|
|
10291
|
+
logger$7.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
10274
10292
|
return Promise.resolve(null);
|
|
10275
10293
|
}
|
|
10276
10294
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
@@ -10298,7 +10316,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10298
10316
|
return;
|
|
10299
10317
|
}
|
|
10300
10318
|
|
|
10301
|
-
logger$
|
|
10319
|
+
logger$7.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
10302
10320
|
|
|
10303
10321
|
this.client.transfer(sipSession, target);
|
|
10304
10322
|
}
|
|
@@ -10307,7 +10325,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10307
10325
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
10308
10326
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
10309
10327
|
|
|
10310
|
-
logger$
|
|
10328
|
+
logger$7.info('WebRTC indirect transfer', {
|
|
10311
10329
|
sipId: sipSession ? sipSession.id : null,
|
|
10312
10330
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
10313
10331
|
});
|
|
@@ -10346,7 +10364,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10346
10364
|
return false;
|
|
10347
10365
|
}
|
|
10348
10366
|
|
|
10349
|
-
logger$
|
|
10367
|
+
logger$7.info('WebRTC hangup', { sipId: sipSession.id });
|
|
10350
10368
|
|
|
10351
10369
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
10352
10370
|
|
|
@@ -10392,7 +10410,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10392
10410
|
endCurrentCall(callSession ) {
|
|
10393
10411
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
10394
10412
|
|
|
10395
|
-
logger$
|
|
10413
|
+
logger$7.info('Ending current call', {
|
|
10396
10414
|
id: callSession ? callSession.getId() : null,
|
|
10397
10415
|
isCurrent,
|
|
10398
10416
|
});
|
|
@@ -10416,7 +10434,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10416
10434
|
}
|
|
10417
10435
|
|
|
10418
10436
|
async close() {
|
|
10419
|
-
logger$
|
|
10437
|
+
logger$7.info('WebRTC close');
|
|
10420
10438
|
|
|
10421
10439
|
try {
|
|
10422
10440
|
await Promise.race([
|
|
@@ -10424,7 +10442,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10424
10442
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
10425
10443
|
]);
|
|
10426
10444
|
} catch (e) {
|
|
10427
|
-
logger$
|
|
10445
|
+
logger$7.error('WebRTC close, unregister error', e);
|
|
10428
10446
|
}
|
|
10429
10447
|
|
|
10430
10448
|
this.client.close();
|
|
@@ -10442,12 +10460,12 @@ class WebRTCPhone extends Emitter {
|
|
|
10442
10460
|
}
|
|
10443
10461
|
|
|
10444
10462
|
enableRinging() {
|
|
10445
|
-
logger$
|
|
10463
|
+
logger$7.info('WebRTC enable ringing');
|
|
10446
10464
|
this.ringingEnabled = true;
|
|
10447
10465
|
}
|
|
10448
10466
|
|
|
10449
10467
|
disableRinging() {
|
|
10450
|
-
logger$
|
|
10468
|
+
logger$7.info('WebRTC disable ringing');
|
|
10451
10469
|
this.ringingEnabled = false;
|
|
10452
10470
|
}
|
|
10453
10471
|
|
|
@@ -10487,7 +10505,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10487
10505
|
|
|
10488
10506
|
// Deprecated
|
|
10489
10507
|
getLocalMediaStream(callSession ) {
|
|
10490
|
-
logger$
|
|
10508
|
+
logger$7.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
10491
10509
|
return this.getLocalStream(callSession);
|
|
10492
10510
|
}
|
|
10493
10511
|
|
|
@@ -10529,7 +10547,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10529
10547
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
10530
10548
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
10531
10549
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
10532
|
-
logger$
|
|
10550
|
+
logger$7.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
10533
10551
|
|
|
10534
10552
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
10535
10553
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -10552,7 +10570,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10552
10570
|
});
|
|
10553
10571
|
|
|
10554
10572
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
10555
|
-
logger$
|
|
10573
|
+
logger$7.info('WebRTC on reinvite', {
|
|
10556
10574
|
sessionId: args[0].id,
|
|
10557
10575
|
inviteId: args[1].id,
|
|
10558
10576
|
updatedCalleeName: args[2],
|
|
@@ -10572,7 +10590,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10572
10590
|
});
|
|
10573
10591
|
|
|
10574
10592
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
10575
|
-
logger$
|
|
10593
|
+
logger$7.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
10576
10594
|
|
|
10577
10595
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
10578
10596
|
|
|
@@ -10583,22 +10601,22 @@ class WebRTCPhone extends Emitter {
|
|
|
10583
10601
|
this.client.on('ended', () => {});
|
|
10584
10602
|
|
|
10585
10603
|
this.client.on(this.client.ON_ERROR, e => {
|
|
10586
|
-
logger$
|
|
10604
|
+
logger$7.error('WebRTC error', e);
|
|
10587
10605
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10588
10606
|
});
|
|
10589
10607
|
|
|
10590
10608
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10591
|
-
logger$
|
|
10609
|
+
logger$7.info('WebRTC unregistered');
|
|
10592
10610
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10593
10611
|
});
|
|
10594
10612
|
|
|
10595
10613
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
10596
|
-
logger$
|
|
10597
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
10614
|
+
logger$7.info('WebRTC disconnected');
|
|
10615
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10598
10616
|
});
|
|
10599
10617
|
|
|
10600
10618
|
this.client.on(this.client.REGISTERED, () => {
|
|
10601
|
-
logger$
|
|
10619
|
+
logger$7.info('WebRTC registered', {
|
|
10602
10620
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
10603
10621
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
10604
10622
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -10619,19 +10637,19 @@ class WebRTCPhone extends Emitter {
|
|
|
10619
10637
|
// Send reinvite with iceRestart
|
|
10620
10638
|
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10621
10639
|
} catch (e) {
|
|
10622
|
-
logger$
|
|
10640
|
+
logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10623
10641
|
}
|
|
10624
10642
|
}
|
|
10625
10643
|
});
|
|
10626
10644
|
|
|
10627
10645
|
this.client.on(this.client.CONNECTED, () => {
|
|
10628
|
-
logger$
|
|
10646
|
+
logger$7.info('WebRTC client connected');
|
|
10629
10647
|
|
|
10630
10648
|
this.stopHeartbeat();
|
|
10631
10649
|
});
|
|
10632
10650
|
|
|
10633
10651
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
10634
|
-
logger$
|
|
10652
|
+
logger$7.info('WebRTC client disconnected');
|
|
10635
10653
|
|
|
10636
10654
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10637
10655
|
|
|
@@ -10645,7 +10663,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10645
10663
|
});
|
|
10646
10664
|
|
|
10647
10665
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
10648
|
-
this.eventEmitter.emit(ON_TRACK
|
|
10666
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
10649
10667
|
});
|
|
10650
10668
|
|
|
10651
10669
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -10660,7 +10678,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10660
10678
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
10661
10679
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
10662
10680
|
|
|
10663
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
10681
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
10664
10682
|
});
|
|
10665
10683
|
|
|
10666
10684
|
// Used when upgrading directly in screenshare mode
|
|
@@ -10669,7 +10687,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10669
10687
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
10670
10688
|
const callSession = this.callSessions[sipSessionId];
|
|
10671
10689
|
|
|
10672
|
-
logger$
|
|
10690
|
+
logger$7.info('Updrading directly in screensharing mode', {
|
|
10673
10691
|
sipSessionId,
|
|
10674
10692
|
tracks: localStream ? localStream.getTracks() : null,
|
|
10675
10693
|
});
|
|
@@ -10847,8 +10865,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10847
10865
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10848
10866
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10849
10867
|
ON_MESSAGE: ON_MESSAGE,
|
|
10850
|
-
ON_REINVITE: ON_REINVITE
|
|
10851
|
-
ON_TRACK: ON_TRACK
|
|
10868
|
+
ON_REINVITE: ON_REINVITE,
|
|
10869
|
+
ON_TRACK: ON_TRACK,
|
|
10852
10870
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10853
10871
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10854
10872
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10863,13 +10881,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10863
10881
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10864
10882
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10865
10883
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10866
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS
|
|
10884
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10867
10885
|
ON_CHAT: ON_CHAT,
|
|
10868
10886
|
ON_SIGNAL: ON_SIGNAL,
|
|
10869
|
-
ON_DISCONNECTED: ON_DISCONNECTED
|
|
10887
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10870
10888
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10871
10889
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10872
|
-
events: events
|
|
10890
|
+
events: events,
|
|
10873
10891
|
'default': WebRTCPhone
|
|
10874
10892
|
});
|
|
10875
10893
|
|
|
@@ -11040,11 +11058,11 @@ var wazoWebsocket = {
|
|
|
11040
11058
|
resolve();
|
|
11041
11059
|
};
|
|
11042
11060
|
|
|
11043
|
-
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
11061
|
+
client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
|
|
11044
11062
|
handleError(`Connection error : ${error}`);
|
|
11045
11063
|
});
|
|
11046
11064
|
|
|
11047
|
-
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
11065
|
+
client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
|
|
11048
11066
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
11049
11067
|
client.setOnHeartbeatTimeout(() => {
|
|
11050
11068
|
handleError('No response to heartbeat');
|
|
@@ -11145,7 +11163,7 @@ var webrtc = {
|
|
|
11145
11163
|
}),
|
|
11146
11164
|
};
|
|
11147
11165
|
|
|
11148
|
-
const parseCandidate
|
|
11166
|
+
const parseCandidate = line => {
|
|
11149
11167
|
let parts;
|
|
11150
11168
|
// Parse both variants.
|
|
11151
11169
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -11236,7 +11254,7 @@ var SymmetricNat = {
|
|
|
11236
11254
|
}
|
|
11237
11255
|
|
|
11238
11256
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
11239
|
-
const cand = parseCandidate
|
|
11257
|
+
const cand = parseCandidate(e.candidate.candidate);
|
|
11240
11258
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
11241
11259
|
candidates[cand.relatedPort].push(cand.port);
|
|
11242
11260
|
} else if (!e.candidate) {
|
|
@@ -11304,7 +11322,7 @@ var iceIpv4 = {
|
|
|
11304
11322
|
const rawCandidate = e.candidate.candidate;
|
|
11305
11323
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
11306
11324
|
hasSrflxOrRelay = true;
|
|
11307
|
-
const candidate = parseCandidate
|
|
11325
|
+
const candidate = parseCandidate(e.candidate.candidate);
|
|
11308
11326
|
ips.push(candidate.ip);
|
|
11309
11327
|
}
|
|
11310
11328
|
} else if (!e.candidate) {
|
|
@@ -11474,7 +11492,7 @@ const getCallableNumber = (number , country ) => {
|
|
|
11474
11492
|
class InvalidSubscription extends Error {}
|
|
11475
11493
|
class InvalidAuthorization extends Error {}
|
|
11476
11494
|
|
|
11477
|
-
const logger$
|
|
11495
|
+
const logger$5 = IssueReporter$1.loggerFor('simple-auth');
|
|
11478
11496
|
|
|
11479
11497
|
class Auth {
|
|
11480
11498
|
|
|
@@ -11509,7 +11527,7 @@ class Auth {
|
|
|
11509
11527
|
setApiClientId(this.clientId);
|
|
11510
11528
|
setRefreshExpiration(this.expiration);
|
|
11511
11529
|
setOnRefreshToken((token , session ) => {
|
|
11512
|
-
logger$
|
|
11530
|
+
logger$5.info('on refresh token done', { token });
|
|
11513
11531
|
setApiToken(token);
|
|
11514
11532
|
Wazo.Websocket.updateToken(token);
|
|
11515
11533
|
|
|
@@ -11554,7 +11572,7 @@ class Auth {
|
|
|
11554
11572
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
11555
11573
|
return this._onAuthenticated(rawSession);
|
|
11556
11574
|
} catch (e) {
|
|
11557
|
-
logger$
|
|
11575
|
+
logger$5.error('on validate token error', e);
|
|
11558
11576
|
console.warn(e);
|
|
11559
11577
|
return false;
|
|
11560
11578
|
}
|
|
@@ -11910,7 +11928,7 @@ class AdHocAPIConference {
|
|
|
11910
11928
|
|
|
11911
11929
|
//
|
|
11912
11930
|
|
|
11913
|
-
const logger$
|
|
11931
|
+
const logger$4 = IssueReporter$1.loggerFor('simple-phone');
|
|
11914
11932
|
const sipLogger = IssueReporter$1.loggerFor('sip.js');
|
|
11915
11933
|
const protocolLogger = IssueReporter$1.loggerFor('sip');
|
|
11916
11934
|
|
|
@@ -12017,7 +12035,7 @@ class Phone extends Emitter {
|
|
|
12017
12035
|
async disconnect() {
|
|
12018
12036
|
if (this.phone) {
|
|
12019
12037
|
if (this.phone.hasAnActiveCall()) {
|
|
12020
|
-
logger$
|
|
12038
|
+
logger$4.info('hangup call on disconnect');
|
|
12021
12039
|
// $FlowFixMe
|
|
12022
12040
|
await this.phone.hangup();
|
|
12023
12041
|
}
|
|
@@ -12040,13 +12058,13 @@ class Phone extends Emitter {
|
|
|
12040
12058
|
}
|
|
12041
12059
|
|
|
12042
12060
|
async hangup(callSession ) {
|
|
12043
|
-
logger$
|
|
12061
|
+
logger$4.info('hangup via simple phone', { callId: callSession.getId() });
|
|
12044
12062
|
|
|
12045
12063
|
return this.phone && this.phone.hangup(callSession);
|
|
12046
12064
|
}
|
|
12047
12065
|
|
|
12048
12066
|
async accept(callSession , cameraEnabled ) {
|
|
12049
|
-
logger$
|
|
12067
|
+
logger$4.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
|
|
12050
12068
|
|
|
12051
12069
|
return this.phone && this.phone.accept(callSession, cameraEnabled);
|
|
12052
12070
|
}
|
|
@@ -12085,7 +12103,7 @@ class Phone extends Emitter {
|
|
|
12085
12103
|
muteViaAPI(callSession ) {
|
|
12086
12104
|
if (callSession && callSession.callId) {
|
|
12087
12105
|
Wazo.getApiClient().calld.mute(callSession.callId).catch(e => {
|
|
12088
|
-
logger$
|
|
12106
|
+
logger$4.error('Mute via API, error', e);
|
|
12089
12107
|
});
|
|
12090
12108
|
}
|
|
12091
12109
|
}
|
|
@@ -12093,7 +12111,7 @@ class Phone extends Emitter {
|
|
|
12093
12111
|
unmuteViaAPI(callSession ) {
|
|
12094
12112
|
if (callSession && callSession.callId) {
|
|
12095
12113
|
Wazo.getApiClient().calld.unmute(callSession.callId).catch(e => {
|
|
12096
|
-
logger$
|
|
12114
|
+
logger$4.error('Unmute via API, error', e);
|
|
12097
12115
|
});
|
|
12098
12116
|
}
|
|
12099
12117
|
}
|
|
@@ -12201,7 +12219,7 @@ class Phone extends Emitter {
|
|
|
12201
12219
|
|
|
12202
12220
|
// @Deprecated
|
|
12203
12221
|
getLocalMediaStream(callSession ) {
|
|
12204
|
-
logger$
|
|
12222
|
+
logger$4.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
|
|
12205
12223
|
|
|
12206
12224
|
return this.phone && this.phone.getLocalStream(callSession);
|
|
12207
12225
|
}
|
|
@@ -12224,20 +12242,20 @@ class Phone extends Emitter {
|
|
|
12224
12242
|
|
|
12225
12243
|
// @Deprecated
|
|
12226
12244
|
getRemoteStreamForCall(callSession ) {
|
|
12227
|
-
logger$
|
|
12245
|
+
logger$4.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
|
|
12228
12246
|
return this.getRemoteStream(callSession);
|
|
12229
12247
|
}
|
|
12230
12248
|
|
|
12231
12249
|
// Returns remote streams directly from the peerConnection
|
|
12232
12250
|
// @Deprecated
|
|
12233
12251
|
getRemoteStreamsForCall(callSession ) {
|
|
12234
|
-
logger$
|
|
12252
|
+
logger$4.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
|
|
12235
12253
|
return this.getLocalStream(callSession);
|
|
12236
12254
|
}
|
|
12237
12255
|
|
|
12238
12256
|
// @Deprecated
|
|
12239
12257
|
getRemoteVideoStreamForCall(callSession ) {
|
|
12240
|
-
logger$
|
|
12258
|
+
logger$4.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
|
|
12241
12259
|
|
|
12242
12260
|
return this.getRemoteVideoStream(callSession);
|
|
12243
12261
|
}
|
|
@@ -12298,7 +12316,7 @@ class Phone extends Emitter {
|
|
|
12298
12316
|
|
|
12299
12317
|
_transferEvents() {
|
|
12300
12318
|
this.unbind();
|
|
12301
|
-
[...events, ...transportEvents].forEach(event => {
|
|
12319
|
+
[...events$1, ...transportEvents].forEach(event => {
|
|
12302
12320
|
this.client.on(event, (...args) =>
|
|
12303
12321
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
12304
12322
|
});
|
|
@@ -12320,10 +12338,10 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
12320
12338
|
|
|
12321
12339
|
//
|
|
12322
12340
|
|
|
12323
|
-
const { SOCKET_EVENTS
|
|
12324
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS
|
|
12341
|
+
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
12342
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
12325
12343
|
|
|
12326
|
-
const logger$
|
|
12344
|
+
const logger$3 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
12327
12345
|
|
|
12328
12346
|
class Websocket extends Emitter {
|
|
12329
12347
|
|
|
@@ -12337,9 +12355,9 @@ class Websocket extends Emitter {
|
|
|
12337
12355
|
// $FlowFixMe
|
|
12338
12356
|
this[key] = OTHER_EVENTS[key];
|
|
12339
12357
|
});
|
|
12340
|
-
Object.keys(SOCKET_EVENTS
|
|
12358
|
+
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
12341
12359
|
// $FlowFixMe
|
|
12342
|
-
this[key] = SOCKET_EVENTS
|
|
12360
|
+
this[key] = SOCKET_EVENTS[key];
|
|
12343
12361
|
});
|
|
12344
12362
|
this.eventLists = WebSocketClient.eventLists;
|
|
12345
12363
|
|
|
@@ -12347,7 +12365,7 @@ class Websocket extends Emitter {
|
|
|
12347
12365
|
}
|
|
12348
12366
|
|
|
12349
12367
|
open(host , session ) {
|
|
12350
|
-
logger$
|
|
12368
|
+
logger$3.info('open simple WebSocket', { host, token: session.token });
|
|
12351
12369
|
this.ws = new WebSocketClient(
|
|
12352
12370
|
{
|
|
12353
12371
|
host,
|
|
@@ -12375,7 +12393,7 @@ class Websocket extends Emitter {
|
|
|
12375
12393
|
}
|
|
12376
12394
|
|
|
12377
12395
|
updateToken(token ) {
|
|
12378
|
-
logger$
|
|
12396
|
+
logger$3.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
12379
12397
|
|
|
12380
12398
|
if (!this.ws) {
|
|
12381
12399
|
return;
|
|
@@ -12403,7 +12421,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
12403
12421
|
|
|
12404
12422
|
//
|
|
12405
12423
|
|
|
12406
|
-
const logger$
|
|
12424
|
+
const logger$2 = IssueReporter$1.loggerFor('room');
|
|
12407
12425
|
|
|
12408
12426
|
class Participant extends Emitter {
|
|
12409
12427
|
|
|
@@ -12525,7 +12543,7 @@ class Participant extends Emitter {
|
|
|
12525
12543
|
}
|
|
12526
12544
|
|
|
12527
12545
|
onTalking(isTalking ) {
|
|
12528
|
-
logger$
|
|
12546
|
+
logger$2.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
12529
12547
|
this.isTalking = isTalking;
|
|
12530
12548
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
12531
12549
|
// directly from asterisk, there's no need to do so
|
|
@@ -12628,7 +12646,7 @@ class Participant extends Emitter {
|
|
|
12628
12646
|
}
|
|
12629
12647
|
|
|
12630
12648
|
updateStatus(status , broadcast = true) {
|
|
12631
|
-
logger$
|
|
12649
|
+
logger$2.info('updating participant status', { name: this.name, status });
|
|
12632
12650
|
|
|
12633
12651
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
12634
12652
|
if (status.audioMuted) {
|
|
@@ -12676,7 +12694,7 @@ class Participant extends Emitter {
|
|
|
12676
12694
|
|
|
12677
12695
|
broadcastStatus(inboundStatus = null) {
|
|
12678
12696
|
const status = inboundStatus || this.getStatus();
|
|
12679
|
-
logger$
|
|
12697
|
+
logger$2.info('broadcasting participant status', { callId: this.callId, status });
|
|
12680
12698
|
|
|
12681
12699
|
this.room.sendSignal({
|
|
12682
12700
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|
|
@@ -12712,9 +12730,9 @@ class LocalParticipant extends Participant {
|
|
|
12712
12730
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
12713
12731
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
12714
12732
|
|
|
12715
|
-
const logger$
|
|
12733
|
+
const logger$1 = IssueReporter$1.loggerFor('sdk-room');
|
|
12716
12734
|
|
|
12717
|
-
class Room
|
|
12735
|
+
class Room extends Emitter {
|
|
12718
12736
|
|
|
12719
12737
|
|
|
12720
12738
|
|
|
@@ -12772,7 +12790,7 @@ class Room$1 extends Emitter {
|
|
|
12772
12790
|
extra = {},
|
|
12773
12791
|
) {
|
|
12774
12792
|
super();
|
|
12775
|
-
logger$
|
|
12793
|
+
logger$1.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
12776
12794
|
|
|
12777
12795
|
// Represents the room callSession
|
|
12778
12796
|
this.callSession = callSession;
|
|
@@ -12838,7 +12856,7 @@ class Room$1 extends Emitter {
|
|
|
12838
12856
|
* @returns {Promise<Room>}
|
|
12839
12857
|
*/
|
|
12840
12858
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
12841
|
-
logger$
|
|
12859
|
+
logger$1.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
12842
12860
|
|
|
12843
12861
|
if (!room) {
|
|
12844
12862
|
await Wazo.Phone.connect();
|
|
@@ -12851,7 +12869,7 @@ class Room$1 extends Emitter {
|
|
|
12851
12869
|
|
|
12852
12870
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
12853
12871
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
12854
|
-
logger$
|
|
12872
|
+
logger$1.info('room call received via WS', { callId: data.call_id });
|
|
12855
12873
|
if (room) {
|
|
12856
12874
|
room.setCallId(data.call_id);
|
|
12857
12875
|
}
|
|
@@ -12859,7 +12877,7 @@ class Room$1 extends Emitter {
|
|
|
12859
12877
|
|
|
12860
12878
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
12861
12879
|
// eslint-disable-next-line no-param-reassign
|
|
12862
|
-
room = new Room
|
|
12880
|
+
room = new Room(callSession, extension, null, null, extra);
|
|
12863
12881
|
|
|
12864
12882
|
// Wait for the call to be accepted
|
|
12865
12883
|
await new Promise((resolve, reject) => {
|
|
@@ -12880,7 +12898,7 @@ class Room$1 extends Emitter {
|
|
|
12880
12898
|
// Retrieve conference
|
|
12881
12899
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
12882
12900
|
|
|
12883
|
-
logger$
|
|
12901
|
+
logger$1.info('connected to room', {
|
|
12884
12902
|
sourceId: conference ? conference.sourceId : null,
|
|
12885
12903
|
name: conference ? conference.name : null,
|
|
12886
12904
|
});
|
|
@@ -12890,7 +12908,7 @@ class Room$1 extends Emitter {
|
|
|
12890
12908
|
room.setName(conference.name);
|
|
12891
12909
|
}
|
|
12892
12910
|
} else if (meeting) {
|
|
12893
|
-
logger$
|
|
12911
|
+
logger$1.info('Already connected to meeting', {
|
|
12894
12912
|
uuid: meeting.uuid,
|
|
12895
12913
|
name: meeting.name,
|
|
12896
12914
|
});
|
|
@@ -12903,13 +12921,13 @@ class Room$1 extends Emitter {
|
|
|
12903
12921
|
}
|
|
12904
12922
|
|
|
12905
12923
|
static disconnect() {
|
|
12906
|
-
logger$
|
|
12924
|
+
logger$1.info('static disconnection to room');
|
|
12907
12925
|
|
|
12908
12926
|
Wazo.Phone.disconnect();
|
|
12909
12927
|
}
|
|
12910
12928
|
|
|
12911
12929
|
async disconnect() {
|
|
12912
|
-
logger$
|
|
12930
|
+
logger$1.info('disconnection to room called');
|
|
12913
12931
|
|
|
12914
12932
|
await Wazo.Phone.hangup(this.callSession);
|
|
12915
12933
|
this.callSession = null;
|
|
@@ -12929,19 +12947,19 @@ class Room$1 extends Emitter {
|
|
|
12929
12947
|
}
|
|
12930
12948
|
|
|
12931
12949
|
setSourceId(sourceId ) {
|
|
12932
|
-
logger$
|
|
12950
|
+
logger$1.info('set room source id', { sourceId });
|
|
12933
12951
|
|
|
12934
12952
|
this.sourceId = sourceId;
|
|
12935
12953
|
}
|
|
12936
12954
|
|
|
12937
12955
|
setMeetingUuid(meetingUuid ) {
|
|
12938
|
-
logger$
|
|
12956
|
+
logger$1.info('set meeting uuid', { meetingUuid });
|
|
12939
12957
|
|
|
12940
12958
|
this.meetingUuid = meetingUuid;
|
|
12941
12959
|
}
|
|
12942
12960
|
|
|
12943
12961
|
setCallId(callId ) {
|
|
12944
|
-
logger$
|
|
12962
|
+
logger$1.info('set room call id', { callId });
|
|
12945
12963
|
|
|
12946
12964
|
if (callId) {
|
|
12947
12965
|
this.callId = callId;
|
|
@@ -12949,7 +12967,7 @@ class Room$1 extends Emitter {
|
|
|
12949
12967
|
}
|
|
12950
12968
|
|
|
12951
12969
|
setName(name ) {
|
|
12952
|
-
logger$
|
|
12970
|
+
logger$1.info('set room name', { name });
|
|
12953
12971
|
|
|
12954
12972
|
this.name = name;
|
|
12955
12973
|
}
|
|
@@ -12968,7 +12986,7 @@ class Room$1 extends Emitter {
|
|
|
12968
12986
|
}
|
|
12969
12987
|
|
|
12970
12988
|
async startScreenSharing(constraints ) {
|
|
12971
|
-
logger$
|
|
12989
|
+
logger$1.info('start room screen sharing', { constraints });
|
|
12972
12990
|
|
|
12973
12991
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
12974
12992
|
if (!screensharingStream) {
|
|
@@ -12982,7 +13000,7 @@ class Room$1 extends Emitter {
|
|
|
12982
13000
|
}
|
|
12983
13001
|
|
|
12984
13002
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
12985
|
-
logger$
|
|
13003
|
+
logger$1.info('stop room screen sharing');
|
|
12986
13004
|
|
|
12987
13005
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
12988
13006
|
|
|
@@ -12994,7 +13012,7 @@ class Room$1 extends Emitter {
|
|
|
12994
13012
|
}
|
|
12995
13013
|
|
|
12996
13014
|
turnCameraOff() {
|
|
12997
|
-
logger$
|
|
13015
|
+
logger$1.info('turn room camera off');
|
|
12998
13016
|
|
|
12999
13017
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
13000
13018
|
|
|
@@ -13004,7 +13022,7 @@ class Room$1 extends Emitter {
|
|
|
13004
13022
|
}
|
|
13005
13023
|
|
|
13006
13024
|
turnCameraOn() {
|
|
13007
|
-
logger$
|
|
13025
|
+
logger$1.info('turn room camera on');
|
|
13008
13026
|
|
|
13009
13027
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
13010
13028
|
|
|
@@ -13014,7 +13032,7 @@ class Room$1 extends Emitter {
|
|
|
13014
13032
|
}
|
|
13015
13033
|
|
|
13016
13034
|
mute() {
|
|
13017
|
-
logger$
|
|
13035
|
+
logger$1.info('mute room');
|
|
13018
13036
|
|
|
13019
13037
|
Wazo.Phone.mute(this.callSession);
|
|
13020
13038
|
|
|
@@ -13022,7 +13040,7 @@ class Room$1 extends Emitter {
|
|
|
13022
13040
|
}
|
|
13023
13041
|
|
|
13024
13042
|
unmute() {
|
|
13025
|
-
logger$
|
|
13043
|
+
logger$1.info('unmute room');
|
|
13026
13044
|
|
|
13027
13045
|
Wazo.Phone.unmute(this.callSession);
|
|
13028
13046
|
|
|
@@ -13042,7 +13060,7 @@ class Room$1 extends Emitter {
|
|
|
13042
13060
|
}
|
|
13043
13061
|
|
|
13044
13062
|
hold() {
|
|
13045
|
-
logger$
|
|
13063
|
+
logger$1.info('hold room');
|
|
13046
13064
|
|
|
13047
13065
|
Wazo.Phone.hold(this.callSession, true);
|
|
13048
13066
|
|
|
@@ -13052,7 +13070,7 @@ class Room$1 extends Emitter {
|
|
|
13052
13070
|
}
|
|
13053
13071
|
|
|
13054
13072
|
async resume() {
|
|
13055
|
-
logger$
|
|
13073
|
+
logger$1.info('resume room');
|
|
13056
13074
|
|
|
13057
13075
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
13058
13076
|
|
|
@@ -13080,13 +13098,13 @@ class Room$1 extends Emitter {
|
|
|
13080
13098
|
}
|
|
13081
13099
|
|
|
13082
13100
|
sendDTMF(tone ) {
|
|
13083
|
-
logger$
|
|
13101
|
+
logger$1.info('send room DTMF', { tone });
|
|
13084
13102
|
|
|
13085
13103
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
13086
13104
|
}
|
|
13087
13105
|
|
|
13088
13106
|
async sendReinvite(newConstraints = null) {
|
|
13089
|
-
logger$
|
|
13107
|
+
logger$1.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
13090
13108
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
13091
13109
|
|
|
13092
13110
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -13145,7 +13163,7 @@ class Room$1 extends Emitter {
|
|
|
13145
13163
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
13146
13164
|
|
|
13147
13165
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
13148
|
-
logger$
|
|
13166
|
+
logger$1.info('on room audio stream');
|
|
13149
13167
|
|
|
13150
13168
|
this.audioStream = stream;
|
|
13151
13169
|
if (!this.roomAudioElement) {
|
|
@@ -13158,7 +13176,7 @@ class Room$1 extends Emitter {
|
|
|
13158
13176
|
});
|
|
13159
13177
|
|
|
13160
13178
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
13161
|
-
logger$
|
|
13179
|
+
logger$1.info('on room video stream', { streamId });
|
|
13162
13180
|
|
|
13163
13181
|
this._mapMsid(sipSession.body.body);
|
|
13164
13182
|
|
|
@@ -13173,7 +13191,7 @@ class Room$1 extends Emitter {
|
|
|
13173
13191
|
});
|
|
13174
13192
|
|
|
13175
13193
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
13176
|
-
logger$
|
|
13194
|
+
logger$1.info('on room remove stream');
|
|
13177
13195
|
|
|
13178
13196
|
const participant = this.participants.find(someParticipant =>
|
|
13179
13197
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -13305,7 +13323,7 @@ class Room$1 extends Emitter {
|
|
|
13305
13323
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
13306
13324
|
if (requester) {
|
|
13307
13325
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
13308
|
-
logger$
|
|
13326
|
+
logger$1.info('trigger room requester status', { origin });
|
|
13309
13327
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
13310
13328
|
}
|
|
13311
13329
|
break;
|
|
@@ -13336,24 +13354,24 @@ class Room$1 extends Emitter {
|
|
|
13336
13354
|
|
|
13337
13355
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
13338
13356
|
if (participant.user_uuid === session.uuid) {
|
|
13339
|
-
logger$
|
|
13357
|
+
logger$1.info('room current user joined');
|
|
13340
13358
|
|
|
13341
13359
|
// Retrieve participants via an API calls
|
|
13342
13360
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
13343
13361
|
let response;
|
|
13344
13362
|
try {
|
|
13345
13363
|
if (this.meetingUuid) {
|
|
13346
|
-
logger$
|
|
13364
|
+
logger$1.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
13347
13365
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
13348
13366
|
} else {
|
|
13349
|
-
logger$
|
|
13367
|
+
logger$1.info('fetching conference participants', { conferenceId });
|
|
13350
13368
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
13351
13369
|
}
|
|
13352
13370
|
} catch (e) {
|
|
13353
|
-
logger$
|
|
13371
|
+
logger$1.error('room participants fetching, error', e);
|
|
13354
13372
|
}
|
|
13355
13373
|
if (response) {
|
|
13356
|
-
logger$
|
|
13374
|
+
logger$1.info('conference participants fetched', { nb: response.items.length });
|
|
13357
13375
|
participants = response.items.map(item => {
|
|
13358
13376
|
const isMe = item.call_id === this.callId;
|
|
13359
13377
|
|
|
@@ -13380,7 +13398,7 @@ class Room$1 extends Emitter {
|
|
|
13380
13398
|
? new Wazo.RemoteParticipant(this, participant)
|
|
13381
13399
|
: null;
|
|
13382
13400
|
|
|
13383
|
-
logger$
|
|
13401
|
+
logger$1.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
13384
13402
|
|
|
13385
13403
|
if (remoteParticipant) {
|
|
13386
13404
|
this.participants.push(remoteParticipant);
|
|
@@ -13545,12 +13563,12 @@ class Room$1 extends Emitter {
|
|
|
13545
13563
|
|
|
13546
13564
|
//
|
|
13547
13565
|
|
|
13548
|
-
const logger
|
|
13566
|
+
const logger = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
13549
13567
|
|
|
13550
|
-
class SipRoom extends Room
|
|
13568
|
+
class SipRoom extends Room {
|
|
13551
13569
|
|
|
13552
13570
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
13553
|
-
logger
|
|
13571
|
+
logger.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
13554
13572
|
|
|
13555
13573
|
if (!room) {
|
|
13556
13574
|
await Wazo.Phone.connect();
|
|
@@ -13566,7 +13584,7 @@ class SipRoom extends Room$1 {
|
|
|
13566
13584
|
room.setCallId(room.callSession.call.id);
|
|
13567
13585
|
}
|
|
13568
13586
|
|
|
13569
|
-
logger
|
|
13587
|
+
logger.info('connected to room', {
|
|
13570
13588
|
extension: room.extension,
|
|
13571
13589
|
});
|
|
13572
13590
|
|
|
@@ -13574,7 +13592,7 @@ class SipRoom extends Room$1 {
|
|
|
13574
13592
|
}
|
|
13575
13593
|
|
|
13576
13594
|
mute() {
|
|
13577
|
-
logger
|
|
13595
|
+
logger.info('mute sip room');
|
|
13578
13596
|
|
|
13579
13597
|
Wazo.Phone.mute(this.callSession, false);
|
|
13580
13598
|
|
|
@@ -13582,7 +13600,7 @@ class SipRoom extends Room$1 {
|
|
|
13582
13600
|
}
|
|
13583
13601
|
|
|
13584
13602
|
unmute() {
|
|
13585
|
-
logger
|
|
13603
|
+
logger.info('unmute sip room');
|
|
13586
13604
|
|
|
13587
13605
|
Wazo.Phone.unmute(this.callSession, false);
|
|
13588
13606
|
|
|
@@ -13795,7 +13813,7 @@ const Wazo = {
|
|
|
13795
13813
|
Auth: Auth$1,
|
|
13796
13814
|
Phone: Phone$1,
|
|
13797
13815
|
Websocket: Websocket$1,
|
|
13798
|
-
Room
|
|
13816
|
+
Room,
|
|
13799
13817
|
SipRoom,
|
|
13800
13818
|
RemoteParticipant,
|
|
13801
13819
|
LocalParticipant,
|
|
@@ -13828,7 +13846,7 @@ const Wazo = {
|
|
|
13828
13846
|
Session,
|
|
13829
13847
|
Voicemail,
|
|
13830
13848
|
Relocation,
|
|
13831
|
-
ConferenceRoom: Room,
|
|
13849
|
+
ConferenceRoom: Room$1,
|
|
13832
13850
|
CallSession,
|
|
13833
13851
|
IndirectTransfer,
|
|
13834
13852
|
SwitchboardCall,
|
|
@@ -13914,13 +13932,13 @@ var index = {
|
|
|
13914
13932
|
Session,
|
|
13915
13933
|
Voicemail,
|
|
13916
13934
|
Relocation,
|
|
13917
|
-
Room,
|
|
13935
|
+
Room: Room$1,
|
|
13918
13936
|
IssueReporter: IssueReporter$1,
|
|
13919
13937
|
DebugDevice,
|
|
13920
13938
|
PROFILE_STATE: STATE,
|
|
13921
13939
|
FORWARD_KEYS,
|
|
13922
13940
|
LINE_STATE,
|
|
13923
|
-
SOCKET_EVENTS,
|
|
13941
|
+
SOCKET_EVENTS: SOCKET_EVENTS$1,
|
|
13924
13942
|
Wazo,
|
|
13925
13943
|
WebRTCPhone,
|
|
13926
13944
|
Meeting,
|