@wazo/sdk 0.37.24 → 0.37.28
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/README.md +96 -58
- package/dist/wazo-sdk.js +6 -6
- package/esm/__tests__/api-client.test.js +14 -14
- package/esm/__tests__/web-rtc-client.test.js +130 -108
- package/esm/api/agentd.js +1 -1
- package/esm/api/amid.js +2 -2
- package/esm/api/application.js +1 -1
- package/esm/api/auth.js +1 -1
- package/esm/api/call-logd.js +3 -3
- package/esm/api/calld.js +1 -1
- package/esm/api/chatd.js +1 -1
- package/esm/api/confd.js +1 -1
- package/esm/api/ctid-ng.js +4 -4
- package/esm/api/dird.js +3 -3
- package/esm/api/webhookd.js +2 -2
- package/esm/api-client.js +14 -14
- package/esm/checker/Checker.js +155 -133
- package/esm/checker/checks/aor.js +14 -14
- package/esm/checker/checks/api.js +14 -14
- package/esm/checker/checks/index.js +145 -123
- package/esm/checker/checks/wazo-websocket.js +16 -16
- package/esm/checker/checks/webrtc-transport.js +130 -108
- package/esm/checker/checks/webrtc.js +130 -108
- package/esm/domain/AdHocAPIConference.js +14 -14
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/CallSession.js +15 -0
- package/esm/domain/Contact.js +2 -2
- package/esm/domain/Features.js +14 -14
- package/esm/domain/Phone/CTIPhone.js +43 -28
- package/esm/domain/Phone/WebRTCPhone.js +126 -90
- package/esm/domain/SFUNotAvailableError.js +9 -0
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/CallSession.test.js +15 -0
- package/esm/domain/__tests__/Contact.test.js +2 -2
- package/esm/domain/__tests__/IndirectTransfer.test.js +15 -0
- package/esm/domain/__tests__/Room.test.js +15 -0
- package/esm/index.js +415 -346
- package/esm/lib/WazoSessionDescriptionHandler.js +10 -5
- package/esm/service/CallApi.js +14 -14
- package/esm/service/IssueReporter.js +2 -2
- package/esm/service/__tests__/IssueReporter.test.js +2 -2
- package/esm/service/getApiClient.js +14 -14
- package/esm/simple/Auth.js +404 -336
- package/esm/simple/Configuration.js +404 -336
- package/esm/simple/Directory.js +14 -14
- package/esm/simple/Phone.js +404 -336
- package/esm/simple/Websocket.js +18 -18
- package/esm/simple/index.js +408 -340
- package/esm/simple/room/LocalParticipant.js +408 -340
- package/esm/simple/room/Participant.js +408 -340
- package/esm/simple/room/RemoteParticipant.js +408 -340
- package/esm/simple/room/Room.js +409 -341
- package/esm/simple/room/SipRoom.js +408 -340
- package/esm/simple/room/Stream.js +408 -340
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +408 -340
- package/esm/simple/utils.js +408 -340
- package/esm/utils/__tests__/api-requester.test.js +1 -1
- package/esm/utils/api-requester.js +1 -1
- package/esm/web-rtc-client.js +130 -108
- package/esm/websocket-client.js +16 -16
- package/lib/__tests__/api-client.test.js +14 -14
- package/lib/__tests__/web-rtc-client.test.js +130 -108
- package/lib/api/agentd.js +1 -1
- package/lib/api/amid.js +2 -2
- package/lib/api/application.js +1 -1
- package/lib/api/auth.js +1 -1
- package/lib/api/call-logd.js +3 -3
- package/lib/api/calld.js +1 -1
- package/lib/api/chatd.js +1 -1
- package/lib/api/confd.js +1 -1
- package/lib/api/ctid-ng.js +4 -4
- package/lib/api/dird.js +3 -3
- package/lib/api/webhookd.js +2 -2
- package/lib/api-client.js +14 -14
- package/lib/checker/Checker.js +155 -133
- package/lib/checker/checks/aor.js +14 -14
- package/lib/checker/checks/api.js +14 -14
- package/lib/checker/checks/index.js +145 -123
- package/lib/checker/checks/wazo-websocket.js +16 -16
- package/lib/checker/checks/webrtc-transport.js +130 -108
- package/lib/checker/checks/webrtc.js +130 -108
- package/lib/domain/AdHocAPIConference.js +14 -14
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/CallSession.js +15 -0
- package/lib/domain/Contact.js +2 -2
- package/lib/domain/Features.js +14 -14
- package/lib/domain/Phone/CTIPhone.js +43 -28
- package/lib/domain/Phone/WebRTCPhone.js +126 -89
- package/lib/domain/SFUNotAvailableError.js +11 -0
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/CallSession.test.js +15 -0
- package/lib/domain/__tests__/Contact.test.js +2 -2
- package/lib/domain/__tests__/IndirectTransfer.test.js +15 -0
- package/lib/domain/__tests__/Room.test.js +15 -0
- package/lib/index.js +415 -346
- package/lib/lib/WazoSessionDescriptionHandler.js +10 -5
- package/lib/service/CallApi.js +14 -14
- package/lib/service/IssueReporter.js +2 -2
- package/lib/service/__tests__/IssueReporter.test.js +2 -2
- package/lib/service/getApiClient.js +14 -14
- package/lib/simple/Auth.js +404 -336
- package/lib/simple/Configuration.js +404 -336
- package/lib/simple/Directory.js +14 -14
- package/lib/simple/Phone.js +404 -336
- package/lib/simple/Websocket.js +18 -18
- package/lib/simple/index.js +408 -340
- package/lib/simple/room/LocalParticipant.js +408 -340
- package/lib/simple/room/Participant.js +408 -340
- package/lib/simple/room/RemoteParticipant.js +408 -340
- package/lib/simple/room/Room.js +409 -341
- package/lib/simple/room/SipRoom.js +408 -340
- package/lib/simple/room/Stream.js +408 -340
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +408 -340
- package/lib/simple/utils.js +408 -340
- package/lib/utils/__tests__/api-requester.test.js +1 -1
- package/lib/utils/api-requester.js +1 -1
- package/lib/web-rtc-client.js +130 -108
- package/lib/websocket-client.js +16 -16
- package/package.json +1 -1
- package/src/domain/CallSession.js +16 -0
- package/src/domain/Contact.js +1 -1
- package/src/domain/Phone/WebRTCPhone.js +25 -4
- package/src/domain/SFUNotAvailableError.js +7 -0
- package/src/index.js +2 -0
- package/src/lib/WazoSessionDescriptionHandler.js +8 -3
- package/src/simple/Phone.js +2 -1
- package/src/simple/index.js +2 -0
- package/src/utils/api-requester.js +1 -1
- package/src/web-rtc-client.js +27 -10
package/lib/simple/room/Room.js
CHANGED
|
@@ -471,11 +471,11 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
471
471
|
|
|
472
472
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
473
473
|
|
|
474
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
474
|
+
const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
475
475
|
|
|
476
476
|
// Use a function here to be able to mock it in tests
|
|
477
477
|
const realFetch = () => {
|
|
478
|
-
if (typeof document !== 'undefined') {
|
|
478
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
479
479
|
// Browser
|
|
480
480
|
return window.fetch;
|
|
481
481
|
}
|
|
@@ -610,7 +610,7 @@ class ApiRequester {
|
|
|
610
610
|
};
|
|
611
611
|
|
|
612
612
|
if (this.refreshTokenPromise) {
|
|
613
|
-
logger.info('A token is already refreshing, waiting ...', { url });
|
|
613
|
+
logger$c.info('A token is already refreshing, waiting ...', { url });
|
|
614
614
|
await this.refreshTokenPromise;
|
|
615
615
|
}
|
|
616
616
|
|
|
@@ -630,7 +630,7 @@ class ApiRequester {
|
|
|
630
630
|
return promise.then(async (err ) => {
|
|
631
631
|
// Check if the token is still valid
|
|
632
632
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
633
|
-
logger.warn('token expired', { error: err.reason });
|
|
633
|
+
logger$c.warn('token expired', { error: err.reason });
|
|
634
634
|
// Replay the call after refreshing the token
|
|
635
635
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
636
636
|
}
|
|
@@ -640,7 +640,7 @@ class ApiRequester {
|
|
|
640
640
|
: exceptionClass.fromResponse(err, response.status);
|
|
641
641
|
|
|
642
642
|
if (this.shouldLogErrors) {
|
|
643
|
-
logger.error('API error', error);
|
|
643
|
+
logger$c.error('API error', error);
|
|
644
644
|
}
|
|
645
645
|
|
|
646
646
|
throw error;
|
|
@@ -650,7 +650,7 @@ class ApiRequester {
|
|
|
650
650
|
return newParse(response, isJson);
|
|
651
651
|
}).catch(error => {
|
|
652
652
|
if (this.shouldLogErrors) {
|
|
653
|
-
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
653
|
+
logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
654
654
|
}
|
|
655
655
|
|
|
656
656
|
throw error;
|
|
@@ -678,13 +678,13 @@ class ApiRequester {
|
|
|
678
678
|
) {
|
|
679
679
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
680
680
|
let newPath = path;
|
|
681
|
-
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
681
|
+
logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
682
682
|
|
|
683
683
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
684
684
|
|
|
685
685
|
return this.refreshTokenPromise.then(() => {
|
|
686
686
|
this.refreshTokenPromise = null;
|
|
687
|
-
logger.info('token refreshed', { isTokenNotFound });
|
|
687
|
+
logger$c.info('token refreshed', { isTokenNotFound });
|
|
688
688
|
if (isTokenNotFound) {
|
|
689
689
|
const pathParts = path.split('/');
|
|
690
690
|
pathParts.pop();
|
|
@@ -1935,7 +1935,7 @@ class Contact {
|
|
|
1935
1935
|
this[key] = old[key] || this[key];
|
|
1936
1936
|
});
|
|
1937
1937
|
|
|
1938
|
-
if (old.lineState
|
|
1938
|
+
if (old.lineState) {
|
|
1939
1939
|
this.lineState = old.lineState;
|
|
1940
1940
|
}
|
|
1941
1941
|
|
|
@@ -3265,8 +3265,10 @@ var updateFrom = (instance , from ) => {
|
|
|
3265
3265
|
|
|
3266
3266
|
|
|
3267
3267
|
|
|
3268
|
+
|
|
3268
3269
|
|
|
3269
3270
|
|
|
3271
|
+
|
|
3270
3272
|
|
|
3271
3273
|
|
|
3272
3274
|
|
|
@@ -3283,6 +3285,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3283
3285
|
|
|
3284
3286
|
|
|
3285
3287
|
|
|
3288
|
+
|
|
3286
3289
|
|
|
3287
3290
|
|
|
3288
3291
|
class CallSession {
|
|
@@ -3302,8 +3305,12 @@ class CallSession {
|
|
|
3302
3305
|
|
|
3303
3306
|
|
|
3304
3307
|
|
|
3308
|
+
|
|
3309
|
+
|
|
3305
3310
|
|
|
3306
3311
|
|
|
3312
|
+
|
|
3313
|
+
|
|
3307
3314
|
|
|
3308
3315
|
|
|
3309
3316
|
|
|
@@ -3341,6 +3348,8 @@ class CallSession {
|
|
|
3341
3348
|
|
|
3342
3349
|
|
|
3343
3350
|
|
|
3351
|
+
|
|
3352
|
+
|
|
3344
3353
|
|
|
3345
3354
|
constructor({
|
|
3346
3355
|
answered,
|
|
@@ -3354,6 +3363,8 @@ class CallSession {
|
|
|
3354
3363
|
paused,
|
|
3355
3364
|
ringing,
|
|
3356
3365
|
startTime,
|
|
3366
|
+
creationTime,
|
|
3367
|
+
endTime,
|
|
3357
3368
|
cameraEnabled,
|
|
3358
3369
|
dialedExtension,
|
|
3359
3370
|
sipCallId,
|
|
@@ -3366,12 +3377,15 @@ class CallSession {
|
|
|
3366
3377
|
recording,
|
|
3367
3378
|
recordingPaused,
|
|
3368
3379
|
videoRemotelyDowngraded,
|
|
3380
|
+
sipSession,
|
|
3369
3381
|
} ) {
|
|
3370
3382
|
this.callId = callId;
|
|
3371
3383
|
this.sipCallId = sipCallId;
|
|
3372
3384
|
this.displayName = displayName;
|
|
3373
3385
|
this.number = number;
|
|
3386
|
+
this.creationTime = creationTime;
|
|
3374
3387
|
this.startTime = startTime;
|
|
3388
|
+
this.endTime = endTime;
|
|
3375
3389
|
this.isCaller = isCaller;
|
|
3376
3390
|
this.answered = answered;
|
|
3377
3391
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -3390,6 +3404,7 @@ class CallSession {
|
|
|
3390
3404
|
this.recording = recording || false;
|
|
3391
3405
|
this.recordingPaused = recordingPaused || false;
|
|
3392
3406
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3407
|
+
this.sipSession = sipSession;
|
|
3393
3408
|
|
|
3394
3409
|
// Useful to compare instead of instanceof with minified code
|
|
3395
3410
|
this.type = 'CallSession';
|
|
@@ -4065,7 +4080,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4065
4080
|
|
|
4066
4081
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4067
4082
|
|
|
4068
|
-
const logger$
|
|
4083
|
+
const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4069
4084
|
|
|
4070
4085
|
class CTIPhone extends Emitter {
|
|
4071
4086
|
|
|
@@ -4078,7 +4093,7 @@ class CTIPhone extends Emitter {
|
|
|
4078
4093
|
|
|
4079
4094
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4080
4095
|
super();
|
|
4081
|
-
logger$
|
|
4096
|
+
logger$b.info('CTI Phone created');
|
|
4082
4097
|
this.session = session;
|
|
4083
4098
|
this.isMobile = isMobile;
|
|
4084
4099
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4139,7 +4154,7 @@ class CTIPhone extends Emitter {
|
|
|
4139
4154
|
}
|
|
4140
4155
|
|
|
4141
4156
|
async makeCall(number , line ) {
|
|
4142
|
-
logger$
|
|
4157
|
+
logger$b.info('make CTI call', { number });
|
|
4143
4158
|
|
|
4144
4159
|
if (!number) {
|
|
4145
4160
|
return null;
|
|
@@ -4162,7 +4177,7 @@ class CTIPhone extends Emitter {
|
|
|
4162
4177
|
if (!callSession) {
|
|
4163
4178
|
return Promise.resolve(null);
|
|
4164
4179
|
}
|
|
4165
|
-
logger$
|
|
4180
|
+
logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4166
4181
|
|
|
4167
4182
|
if (!this.currentCall) {
|
|
4168
4183
|
this.currentCall = callSession.call;
|
|
@@ -4175,7 +4190,7 @@ class CTIPhone extends Emitter {
|
|
|
4175
4190
|
if (!callSession) {
|
|
4176
4191
|
return;
|
|
4177
4192
|
}
|
|
4178
|
-
logger$
|
|
4193
|
+
logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4179
4194
|
|
|
4180
4195
|
this.currentCall = undefined;
|
|
4181
4196
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4185,7 +4200,7 @@ class CTIPhone extends Emitter {
|
|
|
4185
4200
|
if (!callSession) {
|
|
4186
4201
|
return Promise.resolve(false);
|
|
4187
4202
|
}
|
|
4188
|
-
logger$
|
|
4203
|
+
logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4189
4204
|
|
|
4190
4205
|
try {
|
|
4191
4206
|
await CallApi.cancelCall(callSession);
|
|
@@ -4196,7 +4211,7 @@ class CTIPhone extends Emitter {
|
|
|
4196
4211
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4197
4212
|
return true;
|
|
4198
4213
|
} catch (e) {
|
|
4199
|
-
logger$
|
|
4214
|
+
logger$b.error('hangup CTI call, error', e);
|
|
4200
4215
|
|
|
4201
4216
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4202
4217
|
return false;
|
|
@@ -4209,7 +4224,7 @@ class CTIPhone extends Emitter {
|
|
|
4209
4224
|
if (!callSession) {
|
|
4210
4225
|
return;
|
|
4211
4226
|
}
|
|
4212
|
-
logger$
|
|
4227
|
+
logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4213
4228
|
|
|
4214
4229
|
await CallApi.cancelCall(callSession);
|
|
4215
4230
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4219,7 +4234,7 @@ class CTIPhone extends Emitter {
|
|
|
4219
4234
|
if (!callSession) {
|
|
4220
4235
|
return;
|
|
4221
4236
|
}
|
|
4222
|
-
logger$
|
|
4237
|
+
logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4223
4238
|
|
|
4224
4239
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4225
4240
|
}
|
|
@@ -4232,19 +4247,19 @@ class CTIPhone extends Emitter {
|
|
|
4232
4247
|
if (!callSession) {
|
|
4233
4248
|
return;
|
|
4234
4249
|
}
|
|
4235
|
-
logger$
|
|
4250
|
+
logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4236
4251
|
|
|
4237
4252
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4238
4253
|
}
|
|
4239
4254
|
|
|
4240
4255
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4241
|
-
logger$
|
|
4256
|
+
logger$b.info('cancel CTI transfer', { transferId });
|
|
4242
4257
|
|
|
4243
4258
|
return CallApi.cancelCallTransfer(transferId);
|
|
4244
4259
|
}
|
|
4245
4260
|
|
|
4246
4261
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4247
|
-
logger$
|
|
4262
|
+
logger$b.info('confirm CTI transfer', { transferId });
|
|
4248
4263
|
|
|
4249
4264
|
return CallApi.confirmCallTransfer(transferId);
|
|
4250
4265
|
}
|
|
@@ -4253,19 +4268,19 @@ class CTIPhone extends Emitter {
|
|
|
4253
4268
|
if (!callSession) {
|
|
4254
4269
|
return;
|
|
4255
4270
|
}
|
|
4256
|
-
logger$
|
|
4271
|
+
logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4257
4272
|
|
|
4258
4273
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4259
4274
|
}
|
|
4260
4275
|
|
|
4261
4276
|
onConnectionMade() {
|
|
4262
|
-
logger$
|
|
4277
|
+
logger$b.info('on CTI connection made');
|
|
4263
4278
|
|
|
4264
4279
|
this.eventEmitter.emit('onCallAccepted');
|
|
4265
4280
|
}
|
|
4266
4281
|
|
|
4267
4282
|
async close() {
|
|
4268
|
-
logger$
|
|
4283
|
+
logger$b.info('CTI close');
|
|
4269
4284
|
|
|
4270
4285
|
return Promise.resolve();
|
|
4271
4286
|
}
|
|
@@ -4274,7 +4289,7 @@ class CTIPhone extends Emitter {
|
|
|
4274
4289
|
if (!callSession) {
|
|
4275
4290
|
return;
|
|
4276
4291
|
}
|
|
4277
|
-
logger$
|
|
4292
|
+
logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4278
4293
|
|
|
4279
4294
|
return CallApi.hold(callSession.callId);
|
|
4280
4295
|
}
|
|
@@ -4283,7 +4298,7 @@ class CTIPhone extends Emitter {
|
|
|
4283
4298
|
if (!callSession) {
|
|
4284
4299
|
return;
|
|
4285
4300
|
}
|
|
4286
|
-
logger$
|
|
4301
|
+
logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4287
4302
|
|
|
4288
4303
|
return CallApi.resume(callSession.callId);
|
|
4289
4304
|
}
|
|
@@ -4292,7 +4307,7 @@ class CTIPhone extends Emitter {
|
|
|
4292
4307
|
if (!callSession) {
|
|
4293
4308
|
return;
|
|
4294
4309
|
}
|
|
4295
|
-
logger$
|
|
4310
|
+
logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4296
4311
|
|
|
4297
4312
|
return CallApi.mute(callSession.callId);
|
|
4298
4313
|
}
|
|
@@ -4301,7 +4316,7 @@ class CTIPhone extends Emitter {
|
|
|
4301
4316
|
if (!callSession) {
|
|
4302
4317
|
return;
|
|
4303
4318
|
}
|
|
4304
|
-
logger$
|
|
4319
|
+
logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4305
4320
|
|
|
4306
4321
|
return CallApi.unmute(callSession.callId);
|
|
4307
4322
|
}
|
|
@@ -5310,7 +5325,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5310
5325
|
const WEBHOOKD_VERSION = '1.0';
|
|
5311
5326
|
const AMID_VERSION = '1.0';
|
|
5312
5327
|
|
|
5313
|
-
const logger$
|
|
5328
|
+
const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5314
5329
|
|
|
5315
5330
|
class ApiClient {
|
|
5316
5331
|
|
|
@@ -5362,12 +5377,12 @@ class ApiClient {
|
|
|
5362
5377
|
}
|
|
5363
5378
|
|
|
5364
5379
|
async forceRefreshToken() {
|
|
5365
|
-
logger$
|
|
5380
|
+
logger$a.info('forcing refresh token, calling callback');
|
|
5366
5381
|
return this.refreshTokenCallback();
|
|
5367
5382
|
}
|
|
5368
5383
|
|
|
5369
5384
|
async refreshTokenCallback() {
|
|
5370
|
-
logger$
|
|
5385
|
+
logger$a.info('refresh token callback called', {
|
|
5371
5386
|
refreshToken: this.refreshToken,
|
|
5372
5387
|
refreshBackend: this.refreshBackend,
|
|
5373
5388
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5385,7 +5400,7 @@ class ApiClient {
|
|
|
5385
5400
|
this.isMobile,
|
|
5386
5401
|
);
|
|
5387
5402
|
|
|
5388
|
-
logger$
|
|
5403
|
+
logger$a.info('token refreshed', { token: session.token });
|
|
5389
5404
|
|
|
5390
5405
|
if (this.onRefreshToken) {
|
|
5391
5406
|
this.onRefreshToken(session.token, session);
|
|
@@ -5526,7 +5541,7 @@ var getApiClient = (forServer ) => {
|
|
|
5526
5541
|
class InvalidSubscription extends Error {}
|
|
5527
5542
|
class InvalidAuthorization extends Error {}
|
|
5528
5543
|
|
|
5529
|
-
const logger$
|
|
5544
|
+
const logger$9 = IssueReporter$1.loggerFor('simple-auth');
|
|
5530
5545
|
|
|
5531
5546
|
class Auth {
|
|
5532
5547
|
|
|
@@ -5561,7 +5576,7 @@ class Auth {
|
|
|
5561
5576
|
setApiClientId(this.clientId);
|
|
5562
5577
|
setRefreshExpiration(this.expiration);
|
|
5563
5578
|
setOnRefreshToken((token , session ) => {
|
|
5564
|
-
logger$
|
|
5579
|
+
logger$9.info('on refresh token done', { token });
|
|
5565
5580
|
setApiToken(token);
|
|
5566
5581
|
Wazo.Websocket.updateToken(token);
|
|
5567
5582
|
|
|
@@ -5606,7 +5621,7 @@ class Auth {
|
|
|
5606
5621
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
5607
5622
|
return this._onAuthenticated(rawSession);
|
|
5608
5623
|
} catch (e) {
|
|
5609
|
-
logger$
|
|
5624
|
+
logger$9.error('on validate token error', e);
|
|
5610
5625
|
console.warn(e);
|
|
5611
5626
|
return false;
|
|
5612
5627
|
}
|
|
@@ -5962,7 +5977,7 @@ class AdHocAPIConference {
|
|
|
5962
5977
|
|
|
5963
5978
|
/* */
|
|
5964
5979
|
|
|
5965
|
-
const parseCandidate = (candidate ) => {
|
|
5980
|
+
const parseCandidate$1 = (candidate ) => {
|
|
5966
5981
|
if (!candidate) {
|
|
5967
5982
|
return null;
|
|
5968
5983
|
}
|
|
@@ -6074,11 +6089,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6074
6089
|
|
|
6075
6090
|
// $FlowFixMe
|
|
6076
6091
|
setRemoteSessionDescription(sessionDescription ) {
|
|
6077
|
-
|
|
6092
|
+
try {
|
|
6093
|
+
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
6078
6094
|
|
|
6079
|
-
|
|
6095
|
+
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
6080
6096
|
|
|
6081
|
-
|
|
6097
|
+
return result;
|
|
6098
|
+
} catch (error) {
|
|
6099
|
+
this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
|
|
6100
|
+
throw error;
|
|
6101
|
+
}
|
|
6082
6102
|
}
|
|
6083
6103
|
|
|
6084
6104
|
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
@@ -6116,7 +6136,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6116
6136
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
6117
6137
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6118
6138
|
if (event.candidate) {
|
|
6119
|
-
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
6139
|
+
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6120
6140
|
}
|
|
6121
6141
|
};
|
|
6122
6142
|
|
|
@@ -6580,7 +6600,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6580
6600
|
const SEND_STATS_DELAY = 5000;
|
|
6581
6601
|
|
|
6582
6602
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6583
|
-
const logger$
|
|
6603
|
+
const logger$8 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6584
6604
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6585
6605
|
|
|
6586
6606
|
// events
|
|
@@ -6594,14 +6614,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6594
6614
|
const MESSAGE = 'message';
|
|
6595
6615
|
const ACCEPTED = 'accepted';
|
|
6596
6616
|
const REJECTED = 'rejected';
|
|
6597
|
-
const ON_TRACK = 'onTrack';
|
|
6598
|
-
const ON_REINVITE = 'reinvite';
|
|
6617
|
+
const ON_TRACK$1 = 'onTrack';
|
|
6618
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
6599
6619
|
const ON_ERROR = 'onError';
|
|
6600
6620
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6601
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6602
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
6621
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6622
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6603
6623
|
|
|
6604
|
-
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6624
|
+
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6605
6625
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6606
6626
|
class CanceledCallError extends Error {}
|
|
6607
6627
|
|
|
@@ -6737,12 +6757,12 @@ class WebRTCClient extends Emitter {
|
|
|
6737
6757
|
this.MESSAGE = MESSAGE;
|
|
6738
6758
|
this.ACCEPTED = ACCEPTED;
|
|
6739
6759
|
this.REJECTED = REJECTED;
|
|
6740
|
-
this.ON_TRACK = ON_TRACK;
|
|
6741
|
-
this.ON_REINVITE = ON_REINVITE;
|
|
6760
|
+
this.ON_TRACK = ON_TRACK$1;
|
|
6761
|
+
this.ON_REINVITE = ON_REINVITE$1;
|
|
6742
6762
|
this.ON_ERROR = ON_ERROR;
|
|
6743
6763
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6744
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6745
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6764
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6765
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6746
6766
|
}
|
|
6747
6767
|
|
|
6748
6768
|
configureMedia(media ) {
|
|
@@ -6759,13 +6779,13 @@ class WebRTCClient extends Emitter {
|
|
|
6759
6779
|
|
|
6760
6780
|
createUserAgent(configOverrides ) {
|
|
6761
6781
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6762
|
-
logger$
|
|
6782
|
+
logger$8.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6763
6783
|
|
|
6764
6784
|
webRTCConfiguration.delegate = {
|
|
6765
6785
|
onConnect: this.onConnect.bind(this),
|
|
6766
6786
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6767
6787
|
onInvite: (invitation ) => {
|
|
6768
|
-
logger$
|
|
6788
|
+
logger$8.info('sdk webrtc on invite', {
|
|
6769
6789
|
method: 'delegate.onInvite',
|
|
6770
6790
|
id: invitation.id,
|
|
6771
6791
|
remoteURI: invitation.remoteURI,
|
|
@@ -6808,7 +6828,7 @@ class WebRTCClient extends Emitter {
|
|
|
6808
6828
|
}
|
|
6809
6829
|
|
|
6810
6830
|
onConnect() {
|
|
6811
|
-
logger$
|
|
6831
|
+
logger$8.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6812
6832
|
this.eventEmitter.emit(CONNECTED);
|
|
6813
6833
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6814
6834
|
this.registerer.waitingToggle(false);
|
|
@@ -6817,7 +6837,7 @@ class WebRTCClient extends Emitter {
|
|
|
6817
6837
|
}
|
|
6818
6838
|
|
|
6819
6839
|
async onDisconnect(error ) {
|
|
6820
|
-
logger$
|
|
6840
|
+
logger$8.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6821
6841
|
this.connectionPromise = null;
|
|
6822
6842
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6823
6843
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6842,37 +6862,37 @@ class WebRTCClient extends Emitter {
|
|
|
6842
6862
|
};
|
|
6843
6863
|
|
|
6844
6864
|
if (this.skipRegister) {
|
|
6845
|
-
logger$
|
|
6865
|
+
logger$8.info('sdk webrtc skip register...', logInfo);
|
|
6846
6866
|
return Promise.resolve();
|
|
6847
6867
|
}
|
|
6848
6868
|
|
|
6849
|
-
logger$
|
|
6869
|
+
logger$8.info('sdk webrtc registering...', logInfo);
|
|
6850
6870
|
|
|
6851
6871
|
if (!this.userAgent) {
|
|
6852
|
-
logger$
|
|
6872
|
+
logger$8.info('sdk webrtc recreating User Agent');
|
|
6853
6873
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6854
6874
|
}
|
|
6855
6875
|
if (!this.userAgent || this.isRegistered()) {
|
|
6856
|
-
logger$
|
|
6876
|
+
logger$8.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6857
6877
|
return Promise.resolve();
|
|
6858
6878
|
}
|
|
6859
6879
|
|
|
6860
6880
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6861
|
-
logger$
|
|
6881
|
+
logger$8.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6862
6882
|
return Promise.resolve();
|
|
6863
6883
|
}
|
|
6864
6884
|
|
|
6865
6885
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6866
6886
|
|
|
6867
6887
|
const onRegisterFailed = () => {
|
|
6868
|
-
logger$
|
|
6888
|
+
logger$8.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6869
6889
|
this.connectionPromise = null;
|
|
6870
6890
|
if (this.registerer && this.registerer.waiting) {
|
|
6871
6891
|
this.registerer.waitingToggle(false);
|
|
6872
6892
|
}
|
|
6873
6893
|
|
|
6874
6894
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6875
|
-
logger$
|
|
6895
|
+
logger$8.info('sdk webrtc registering, retrying...', { tries });
|
|
6876
6896
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6877
6897
|
}
|
|
6878
6898
|
};
|
|
@@ -6881,18 +6901,18 @@ class WebRTCClient extends Emitter {
|
|
|
6881
6901
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6882
6902
|
// during the resolution of the primise.
|
|
6883
6903
|
if (!this.userAgent) {
|
|
6884
|
-
logger$
|
|
6904
|
+
logger$8.info('sdk webrtc recreating User Agent after connection');
|
|
6885
6905
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6886
6906
|
}
|
|
6887
6907
|
|
|
6888
|
-
logger$
|
|
6908
|
+
logger$8.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6889
6909
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
6890
6910
|
this.connectionPromise = null;
|
|
6891
6911
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6892
6912
|
|
|
6893
6913
|
// Bind registerer events
|
|
6894
6914
|
this.registerer.stateChange.addListener(newState => {
|
|
6895
|
-
logger$
|
|
6915
|
+
logger$8.info('sdk webrtc registering, state changed', { newState });
|
|
6896
6916
|
|
|
6897
6917
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
6898
6918
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -6905,7 +6925,7 @@ class WebRTCClient extends Emitter {
|
|
|
6905
6925
|
const options = {
|
|
6906
6926
|
requestDelegate: {
|
|
6907
6927
|
onReject: response => {
|
|
6908
|
-
logger$
|
|
6928
|
+
logger$8.error('sdk webrtc registering, rejected', { response });
|
|
6909
6929
|
|
|
6910
6930
|
onRegisterFailed();
|
|
6911
6931
|
},
|
|
@@ -6913,13 +6933,13 @@ class WebRTCClient extends Emitter {
|
|
|
6913
6933
|
};
|
|
6914
6934
|
|
|
6915
6935
|
return this.registerer.register(options).catch((e) => {
|
|
6916
|
-
logger$
|
|
6936
|
+
logger$8.error('sdk webrtc registering, error', e);
|
|
6917
6937
|
|
|
6918
6938
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6919
6939
|
return e;
|
|
6920
6940
|
});
|
|
6921
6941
|
}).catch(error => {
|
|
6922
|
-
logger$
|
|
6942
|
+
logger$8.error('sdk webrtc registering, transport error', error);
|
|
6923
6943
|
onRegisterFailed();
|
|
6924
6944
|
});
|
|
6925
6945
|
}
|
|
@@ -6948,21 +6968,21 @@ class WebRTCClient extends Emitter {
|
|
|
6948
6968
|
}
|
|
6949
6969
|
|
|
6950
6970
|
unregister() {
|
|
6951
|
-
logger$
|
|
6971
|
+
logger$8.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6952
6972
|
if (!this.registerer) {
|
|
6953
6973
|
return Promise.resolve();
|
|
6954
6974
|
}
|
|
6955
6975
|
|
|
6956
6976
|
try {
|
|
6957
6977
|
return this.registerer.unregister().then(() => {
|
|
6958
|
-
logger$
|
|
6978
|
+
logger$8.info('sdk webrtc unregistered');
|
|
6959
6979
|
this._cleanupRegister();
|
|
6960
6980
|
}).catch(e => {
|
|
6961
|
-
logger$
|
|
6981
|
+
logger$8.error('sdk webrtc unregistering, promise error', e);
|
|
6962
6982
|
this._cleanupRegister();
|
|
6963
6983
|
});
|
|
6964
6984
|
} catch (e) {
|
|
6965
|
-
logger$
|
|
6985
|
+
logger$8.error('sdk webrtc unregistering, error', e);
|
|
6966
6986
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6967
6987
|
// error when the registerer is in a bad state
|
|
6968
6988
|
this._cleanupRegister();
|
|
@@ -6970,7 +6990,7 @@ class WebRTCClient extends Emitter {
|
|
|
6970
6990
|
}
|
|
6971
6991
|
|
|
6972
6992
|
stop() {
|
|
6973
|
-
logger$
|
|
6993
|
+
logger$8.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6974
6994
|
if (!this.userAgent) {
|
|
6975
6995
|
return Promise.resolve();
|
|
6976
6996
|
}
|
|
@@ -6978,12 +6998,12 @@ class WebRTCClient extends Emitter {
|
|
|
6978
6998
|
return this.userAgent.stop().then(() => {
|
|
6979
6999
|
return this._cleanupRegister();
|
|
6980
7000
|
}).catch(e => {
|
|
6981
|
-
logger$
|
|
7001
|
+
logger$8.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6982
7002
|
});
|
|
6983
7003
|
}
|
|
6984
7004
|
|
|
6985
7005
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6986
|
-
logger$
|
|
7006
|
+
logger$8.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6987
7007
|
const inviterOptions = {
|
|
6988
7008
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6989
7009
|
conference,
|
|
@@ -7014,7 +7034,7 @@ class WebRTCClient extends Emitter {
|
|
|
7014
7034
|
this._onAccepted(session, response.session, true);
|
|
7015
7035
|
},
|
|
7016
7036
|
onReject: (response ) => {
|
|
7017
|
-
logger$
|
|
7037
|
+
logger$8.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
7018
7038
|
this._stopSendingStats(session);
|
|
7019
7039
|
this.stopNetworkMonitoring(session);
|
|
7020
7040
|
|
|
@@ -7037,11 +7057,11 @@ class WebRTCClient extends Emitter {
|
|
|
7037
7057
|
}
|
|
7038
7058
|
|
|
7039
7059
|
answer(session , enableVideo ) {
|
|
7040
|
-
logger$
|
|
7060
|
+
logger$8.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
7041
7061
|
|
|
7042
7062
|
if (!session || !session.accept) {
|
|
7043
7063
|
const error = 'No session to answer, or not an invitation';
|
|
7044
|
-
logger$
|
|
7064
|
+
logger$8.warn(error);
|
|
7045
7065
|
return Promise.reject(new Error(error));
|
|
7046
7066
|
}
|
|
7047
7067
|
const options = {
|
|
@@ -7051,15 +7071,15 @@ class WebRTCClient extends Emitter {
|
|
|
7051
7071
|
return session.accept(options).then(() => {
|
|
7052
7072
|
if (session.isCanceled) {
|
|
7053
7073
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
7054
|
-
logger$
|
|
7074
|
+
logger$8.error(message, { id: session.id });
|
|
7055
7075
|
this.onCallEnded(session);
|
|
7056
7076
|
|
|
7057
7077
|
throw new CanceledCallError(message);
|
|
7058
7078
|
}
|
|
7059
|
-
logger$
|
|
7079
|
+
logger$8.info('sdk webrtc answer, accepted.');
|
|
7060
7080
|
this._onAccepted(session);
|
|
7061
7081
|
}).catch(e => {
|
|
7062
|
-
logger$
|
|
7082
|
+
logger$8.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
7063
7083
|
|
|
7064
7084
|
throw e;
|
|
7065
7085
|
});
|
|
@@ -7067,7 +7087,7 @@ class WebRTCClient extends Emitter {
|
|
|
7067
7087
|
|
|
7068
7088
|
hangup(session ) {
|
|
7069
7089
|
const { state, id } = session;
|
|
7070
|
-
logger$
|
|
7090
|
+
logger$8.info('sdk webrtc hangup call', { id, state });
|
|
7071
7091
|
|
|
7072
7092
|
try {
|
|
7073
7093
|
this._stopSendingStats(session);
|
|
@@ -7096,7 +7116,7 @@ class WebRTCClient extends Emitter {
|
|
|
7096
7116
|
|
|
7097
7117
|
return bye();
|
|
7098
7118
|
} catch (error) {
|
|
7099
|
-
logger$
|
|
7119
|
+
logger$8.warn('sdk webrtc hangup, error', error);
|
|
7100
7120
|
}
|
|
7101
7121
|
|
|
7102
7122
|
return null;
|
|
@@ -7114,7 +7134,7 @@ class WebRTCClient extends Emitter {
|
|
|
7114
7134
|
// Fetch and emit an event at `interval` with session network stats
|
|
7115
7135
|
startNetworkMonitoring(session , interval = 1000) {
|
|
7116
7136
|
const sessionId = this.getSipSessionId(session);
|
|
7117
|
-
logger$
|
|
7137
|
+
logger$8.info('starting network inspection', { id: sessionId });
|
|
7118
7138
|
|
|
7119
7139
|
this.sessionNetworkStats[sessionId] = [];
|
|
7120
7140
|
|
|
@@ -7124,7 +7144,7 @@ class WebRTCClient extends Emitter {
|
|
|
7124
7144
|
stopNetworkMonitoring(session ) {
|
|
7125
7145
|
const sessionId = this.getSipSessionId(session);
|
|
7126
7146
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
7127
|
-
logger$
|
|
7147
|
+
logger$8.info('stopping network inspection', { id: sessionId, exists });
|
|
7128
7148
|
|
|
7129
7149
|
if (exists) {
|
|
7130
7150
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -7134,17 +7154,17 @@ class WebRTCClient extends Emitter {
|
|
|
7134
7154
|
}
|
|
7135
7155
|
|
|
7136
7156
|
reject(session ) {
|
|
7137
|
-
logger$
|
|
7157
|
+
logger$8.info('sdk webrtc reject call', { id: session.id });
|
|
7138
7158
|
|
|
7139
7159
|
try {
|
|
7140
7160
|
return session.reject ? session.reject() : session.cancel();
|
|
7141
7161
|
} catch (e) {
|
|
7142
|
-
logger$
|
|
7162
|
+
logger$8.warn('Error when rejecting call', e.message, e.stack);
|
|
7143
7163
|
}
|
|
7144
7164
|
}
|
|
7145
7165
|
|
|
7146
7166
|
async close() {
|
|
7147
|
-
logger$
|
|
7167
|
+
logger$8.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
7148
7168
|
this._cleanupMedia();
|
|
7149
7169
|
this.connectionPromise = null;
|
|
7150
7170
|
|
|
@@ -7175,7 +7195,7 @@ class WebRTCClient extends Emitter {
|
|
|
7175
7195
|
// eg: "INVITE not rejectable in state Completed"
|
|
7176
7196
|
}
|
|
7177
7197
|
this.userAgent = null;
|
|
7178
|
-
logger$
|
|
7198
|
+
logger$8.info('sdk webrtc client closed');
|
|
7179
7199
|
}
|
|
7180
7200
|
|
|
7181
7201
|
getNumber(session ) {
|
|
@@ -7188,13 +7208,13 @@ class WebRTCClient extends Emitter {
|
|
|
7188
7208
|
}
|
|
7189
7209
|
|
|
7190
7210
|
mute(session ) {
|
|
7191
|
-
logger$
|
|
7211
|
+
logger$8.info('sdk webrtc mute', { id: session.id });
|
|
7192
7212
|
|
|
7193
7213
|
this._toggleAudio(session, true);
|
|
7194
7214
|
}
|
|
7195
7215
|
|
|
7196
7216
|
unmute(session ) {
|
|
7197
|
-
logger$
|
|
7217
|
+
logger$8.info('sdk webrtc unmute', { id: session.id });
|
|
7198
7218
|
|
|
7199
7219
|
this._toggleAudio(session, false);
|
|
7200
7220
|
}
|
|
@@ -7234,13 +7254,13 @@ class WebRTCClient extends Emitter {
|
|
|
7234
7254
|
}
|
|
7235
7255
|
|
|
7236
7256
|
toggleCameraOn(session ) {
|
|
7237
|
-
logger$
|
|
7257
|
+
logger$8.info('sdk webrtc toggle camera on', { id: session.id });
|
|
7238
7258
|
|
|
7239
7259
|
this._toggleVideo(session, false);
|
|
7240
7260
|
}
|
|
7241
7261
|
|
|
7242
7262
|
toggleCameraOff(session ) {
|
|
7243
|
-
logger$
|
|
7263
|
+
logger$8.info('sdk webrtc toggle camera off', { id: session.id });
|
|
7244
7264
|
|
|
7245
7265
|
this._toggleVideo(session, true);
|
|
7246
7266
|
}
|
|
@@ -7249,7 +7269,7 @@ class WebRTCClient extends Emitter {
|
|
|
7249
7269
|
const sessionId = this.getSipSessionId(session);
|
|
7250
7270
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
7251
7271
|
|
|
7252
|
-
logger$
|
|
7272
|
+
logger$8.info('sdk webrtc hold', {
|
|
7253
7273
|
sessionId,
|
|
7254
7274
|
keys: Object.keys(this.heldSessions),
|
|
7255
7275
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7298,7 +7318,7 @@ class WebRTCClient extends Emitter {
|
|
|
7298
7318
|
const sessionId = this.getSipSessionId(session);
|
|
7299
7319
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7300
7320
|
|
|
7301
|
-
logger$
|
|
7321
|
+
logger$8.info('sdk webrtc unhold', {
|
|
7302
7322
|
sessionId,
|
|
7303
7323
|
keys: Object.keys(this.heldSessions),
|
|
7304
7324
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7446,7 +7466,7 @@ class WebRTCClient extends Emitter {
|
|
|
7446
7466
|
if (!session.sessionDescriptionHandler) {
|
|
7447
7467
|
return;
|
|
7448
7468
|
}
|
|
7449
|
-
logger$
|
|
7469
|
+
logger$8.info('Sending DTMF', {
|
|
7450
7470
|
id: this.getSipSessionId(session),
|
|
7451
7471
|
tone,
|
|
7452
7472
|
});
|
|
@@ -7462,7 +7482,7 @@ class WebRTCClient extends Emitter {
|
|
|
7462
7482
|
transfer(session , target ) {
|
|
7463
7483
|
this.hold(session);
|
|
7464
7484
|
|
|
7465
|
-
logger$
|
|
7485
|
+
logger$8.info('Transfering a session', {
|
|
7466
7486
|
id: this.getSipSessionId(session),
|
|
7467
7487
|
target,
|
|
7468
7488
|
});
|
|
@@ -7484,17 +7504,17 @@ class WebRTCClient extends Emitter {
|
|
|
7484
7504
|
atxfer(session ) {
|
|
7485
7505
|
this.hold(session);
|
|
7486
7506
|
|
|
7487
|
-
logger$
|
|
7507
|
+
logger$8.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7488
7508
|
|
|
7489
7509
|
const result = {
|
|
7490
7510
|
newSession: null,
|
|
7491
7511
|
init: async (target ) => {
|
|
7492
|
-
logger$
|
|
7512
|
+
logger$8.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7493
7513
|
|
|
7494
7514
|
result.newSession = await this.call(target);
|
|
7495
7515
|
},
|
|
7496
7516
|
complete: () => {
|
|
7497
|
-
logger$
|
|
7517
|
+
logger$8.info('webrtc transfer completed', {
|
|
7498
7518
|
id: this.getSipSessionId(session),
|
|
7499
7519
|
referId: this.getSipSessionId(result.newSession),
|
|
7500
7520
|
});
|
|
@@ -7515,7 +7535,7 @@ class WebRTCClient extends Emitter {
|
|
|
7515
7535
|
return;
|
|
7516
7536
|
}
|
|
7517
7537
|
|
|
7518
|
-
logger$
|
|
7538
|
+
logger$8.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7519
7539
|
|
|
7520
7540
|
try {
|
|
7521
7541
|
sipSession.message({
|
|
@@ -7557,7 +7577,7 @@ class WebRTCClient extends Emitter {
|
|
|
7557
7577
|
}
|
|
7558
7578
|
|
|
7559
7579
|
changeAudioOutputVolume(volume ) {
|
|
7560
|
-
logger$
|
|
7580
|
+
logger$8.info('Changing audio output volume', { volume });
|
|
7561
7581
|
|
|
7562
7582
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7563
7583
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7569,7 +7589,7 @@ class WebRTCClient extends Emitter {
|
|
|
7569
7589
|
}
|
|
7570
7590
|
|
|
7571
7591
|
changeAudioOutputDevice(id ) {
|
|
7572
|
-
logger$
|
|
7592
|
+
logger$8.info('Changing audio output device', { id });
|
|
7573
7593
|
|
|
7574
7594
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7575
7595
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7586,7 +7606,7 @@ class WebRTCClient extends Emitter {
|
|
|
7586
7606
|
|
|
7587
7607
|
changeAudioInputDevice(id , session ) {
|
|
7588
7608
|
const currentId = this.getAudioDeviceId();
|
|
7589
|
-
logger$
|
|
7609
|
+
logger$8.info('setting audio input device', { id, currentId, session: !!session });
|
|
7590
7610
|
|
|
7591
7611
|
if (id === currentId) {
|
|
7592
7612
|
return null;
|
|
@@ -7632,7 +7652,7 @@ class WebRTCClient extends Emitter {
|
|
|
7632
7652
|
|
|
7633
7653
|
setVideoInputDevice(id ) {
|
|
7634
7654
|
const currentId = this.getVideoDeviceId();
|
|
7635
|
-
logger$
|
|
7655
|
+
logger$8.info('setting video input device', { id, currentId });
|
|
7636
7656
|
|
|
7637
7657
|
if (id === currentId) {
|
|
7638
7658
|
return null;
|
|
@@ -7657,7 +7677,7 @@ class WebRTCClient extends Emitter {
|
|
|
7657
7677
|
const sessionId = this.getSipSessionId(session);
|
|
7658
7678
|
const localStream = this.getLocalStream(sessionId);
|
|
7659
7679
|
|
|
7660
|
-
logger$
|
|
7680
|
+
logger$8.info('changing video input device', { id, sessionId });
|
|
7661
7681
|
|
|
7662
7682
|
// Release old video stream
|
|
7663
7683
|
if (localStream) {
|
|
@@ -7725,7 +7745,7 @@ class WebRTCClient extends Emitter {
|
|
|
7725
7745
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7726
7746
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7727
7747
|
|
|
7728
|
-
logger$
|
|
7748
|
+
logger$8.info('Sending reinvite', {
|
|
7729
7749
|
id: this.getSipSessionId(sipSession),
|
|
7730
7750
|
newConstraints,
|
|
7731
7751
|
conference,
|
|
@@ -7763,7 +7783,7 @@ class WebRTCClient extends Emitter {
|
|
|
7763
7783
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7764
7784
|
}
|
|
7765
7785
|
|
|
7766
|
-
logger$
|
|
7786
|
+
logger$8.info('on re-INVITE accepted', {
|
|
7767
7787
|
id: this.getSipSessionId(sipSession),
|
|
7768
7788
|
wasMuted,
|
|
7769
7789
|
shouldDoScreenSharing,
|
|
@@ -7781,7 +7801,7 @@ class WebRTCClient extends Emitter {
|
|
|
7781
7801
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7782
7802
|
}
|
|
7783
7803
|
|
|
7784
|
-
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7804
|
+
return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
|
|
7785
7805
|
},
|
|
7786
7806
|
},
|
|
7787
7807
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7938,7 +7958,7 @@ class WebRTCClient extends Emitter {
|
|
|
7938
7958
|
}
|
|
7939
7959
|
|
|
7940
7960
|
startHeartbeat() {
|
|
7941
|
-
logger$
|
|
7961
|
+
logger$8.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7942
7962
|
if (!this.userAgent) {
|
|
7943
7963
|
this.heartbeat.stop();
|
|
7944
7964
|
return;
|
|
@@ -7951,7 +7971,7 @@ class WebRTCClient extends Emitter {
|
|
|
7951
7971
|
}
|
|
7952
7972
|
|
|
7953
7973
|
stopHeartbeat() {
|
|
7954
|
-
logger$
|
|
7974
|
+
logger$8.info('sdk webrtc stop heartbeat');
|
|
7955
7975
|
this.heartbeat.stop();
|
|
7956
7976
|
}
|
|
7957
7977
|
|
|
@@ -7972,7 +7992,7 @@ class WebRTCClient extends Emitter {
|
|
|
7972
7992
|
}
|
|
7973
7993
|
|
|
7974
7994
|
attemptReconnection() {
|
|
7975
|
-
logger$
|
|
7995
|
+
logger$8.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7976
7996
|
if (!this.userAgent) {
|
|
7977
7997
|
return;
|
|
7978
7998
|
}
|
|
@@ -7997,7 +8017,7 @@ class WebRTCClient extends Emitter {
|
|
|
7997
8017
|
return;
|
|
7998
8018
|
}
|
|
7999
8019
|
|
|
8000
|
-
logger$
|
|
8020
|
+
logger$8.info('setting local media stream', {
|
|
8001
8021
|
sipSessionId,
|
|
8002
8022
|
tracks: newStream ? newStream.getTracks() : null,
|
|
8003
8023
|
});
|
|
@@ -8014,7 +8034,7 @@ class WebRTCClient extends Emitter {
|
|
|
8014
8034
|
|
|
8015
8035
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
8016
8036
|
|
|
8017
|
-
logger$
|
|
8037
|
+
logger$8.info('updating local stream', {
|
|
8018
8038
|
sipSessionId,
|
|
8019
8039
|
oldStream: !!oldStream,
|
|
8020
8040
|
tracks: newStream.getTracks(),
|
|
@@ -8034,7 +8054,7 @@ class WebRTCClient extends Emitter {
|
|
|
8034
8054
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
8035
8055
|
const pc = this.getPeerConnection(sessionId);
|
|
8036
8056
|
|
|
8037
|
-
logger$
|
|
8057
|
+
logger$8.info('Updating remote stream', {
|
|
8038
8058
|
sessionId,
|
|
8039
8059
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
8040
8060
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -8059,14 +8079,16 @@ class WebRTCClient extends Emitter {
|
|
|
8059
8079
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
8060
8080
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
8061
8081
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
8082
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
8062
8083
|
|
|
8063
|
-
logger$
|
|
8084
|
+
logger$8.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
8064
8085
|
|
|
8065
8086
|
return {
|
|
8066
8087
|
constraints: {
|
|
8067
8088
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
8068
8089
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
8069
|
-
video: screenSharing ? (isDesktop
|
|
8090
|
+
video: screenSharing ? (isDesktop
|
|
8091
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
8070
8092
|
: this._getVideoConstraints(enableVideo),
|
|
8071
8093
|
screen: screenSharing,
|
|
8072
8094
|
desktop: isDesktop,
|
|
@@ -8109,7 +8131,7 @@ class WebRTCClient extends Emitter {
|
|
|
8109
8131
|
}
|
|
8110
8132
|
|
|
8111
8133
|
_onTransportError() {
|
|
8112
|
-
logger$
|
|
8134
|
+
logger$8.error('on transport error');
|
|
8113
8135
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
8114
8136
|
this.attemptReconnection();
|
|
8115
8137
|
}
|
|
@@ -8118,7 +8140,7 @@ class WebRTCClient extends Emitter {
|
|
|
8118
8140
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
8119
8141
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
8120
8142
|
if (this.hasHeartbeat()) {
|
|
8121
|
-
logger$
|
|
8143
|
+
logger$8.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
8122
8144
|
|
|
8123
8145
|
this.heartbeat.onHeartbeat();
|
|
8124
8146
|
if (this.heartbeatCb) {
|
|
@@ -8129,7 +8151,7 @@ class WebRTCClient extends Emitter {
|
|
|
8129
8151
|
}
|
|
8130
8152
|
|
|
8131
8153
|
async _onHeartbeatTimeout() {
|
|
8132
|
-
logger$
|
|
8154
|
+
logger$8.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
8133
8155
|
|
|
8134
8156
|
if (this.heartbeatTimeoutCb) {
|
|
8135
8157
|
this.heartbeatTimeoutCb();
|
|
@@ -8141,7 +8163,7 @@ class WebRTCClient extends Emitter {
|
|
|
8141
8163
|
try {
|
|
8142
8164
|
await this.userAgent.transport.disconnect();
|
|
8143
8165
|
} catch (e) {
|
|
8144
|
-
logger$
|
|
8166
|
+
logger$8.error('Transport disconnection after heartbeat timeout, error', e);
|
|
8145
8167
|
}
|
|
8146
8168
|
}
|
|
8147
8169
|
|
|
@@ -8174,31 +8196,31 @@ class WebRTCClient extends Emitter {
|
|
|
8174
8196
|
}
|
|
8175
8197
|
|
|
8176
8198
|
_connectIfNeeded() {
|
|
8177
|
-
logger$
|
|
8199
|
+
logger$8.info('connect if needed, checking', { connected: this.isConnected() });
|
|
8178
8200
|
if (!this.userAgent) {
|
|
8179
|
-
logger$
|
|
8201
|
+
logger$8.info('need to recreate User Agent');
|
|
8180
8202
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
8181
8203
|
}
|
|
8182
8204
|
|
|
8183
8205
|
if (this.isConnected()) {
|
|
8184
|
-
logger$
|
|
8206
|
+
logger$8.info('webrtc sdk, already connected');
|
|
8185
8207
|
return Promise.resolve();
|
|
8186
8208
|
}
|
|
8187
8209
|
|
|
8188
8210
|
if (this.isConnecting()) {
|
|
8189
|
-
logger$
|
|
8211
|
+
logger$8.info('webrtc sdk, already connecting...');
|
|
8190
8212
|
|
|
8191
8213
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
8192
8214
|
return this.connectionPromise;
|
|
8193
8215
|
}
|
|
8194
8216
|
|
|
8195
8217
|
if (this.connectionPromise) {
|
|
8196
|
-
logger$
|
|
8218
|
+
logger$8.info('webrtc sdk, connection promise connecting...');
|
|
8197
8219
|
// $FlowFixMe
|
|
8198
8220
|
return this.connectionPromise;
|
|
8199
8221
|
}
|
|
8200
8222
|
|
|
8201
|
-
logger$
|
|
8223
|
+
logger$8.info('WebRTC UA needs to connect');
|
|
8202
8224
|
|
|
8203
8225
|
// Force UA to reconnect
|
|
8204
8226
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -8323,7 +8345,7 @@ class WebRTCClient extends Emitter {
|
|
|
8323
8345
|
|
|
8324
8346
|
sdh.peerConnectionDelegate = {
|
|
8325
8347
|
onicecandidateerror: (error ) => {
|
|
8326
|
-
logger$
|
|
8348
|
+
logger$8.error('on icecandidate error', {
|
|
8327
8349
|
address: error.address,
|
|
8328
8350
|
port: error.port,
|
|
8329
8351
|
errorCode: error.errorCode,
|
|
@@ -8352,7 +8374,7 @@ class WebRTCClient extends Emitter {
|
|
|
8352
8374
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8353
8375
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8354
8376
|
}
|
|
8355
|
-
logger$
|
|
8377
|
+
logger$8.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8356
8378
|
|
|
8357
8379
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8358
8380
|
|
|
@@ -8368,12 +8390,12 @@ class WebRTCClient extends Emitter {
|
|
|
8368
8390
|
|
|
8369
8391
|
this._setupMedias(session);
|
|
8370
8392
|
|
|
8371
|
-
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8393
|
+
return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8372
8394
|
};
|
|
8373
8395
|
}
|
|
8374
8396
|
|
|
8375
8397
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8376
|
-
logger$
|
|
8398
|
+
logger$8.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8377
8399
|
|
|
8378
8400
|
this.storeSipSession(session);
|
|
8379
8401
|
|
|
@@ -8385,14 +8407,14 @@ class WebRTCClient extends Emitter {
|
|
|
8385
8407
|
const onTrack = (event ) => {
|
|
8386
8408
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8387
8409
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8388
|
-
logger$
|
|
8410
|
+
logger$8.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8389
8411
|
|
|
8390
8412
|
// Stop video track in audio only mode
|
|
8391
8413
|
if (isAudioOnly && kind === 'video') {
|
|
8392
8414
|
event.track.stop();
|
|
8393
8415
|
}
|
|
8394
8416
|
|
|
8395
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8417
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
8396
8418
|
};
|
|
8397
8419
|
|
|
8398
8420
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8401,12 +8423,14 @@ class WebRTCClient extends Emitter {
|
|
|
8401
8423
|
|
|
8402
8424
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8403
8425
|
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8408
|
-
|
|
8409
|
-
|
|
8426
|
+
if (pc) {
|
|
8427
|
+
pc.oniceconnectionstatechange = () => {
|
|
8428
|
+
logger$8.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8429
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8430
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8431
|
+
}
|
|
8432
|
+
};
|
|
8433
|
+
}
|
|
8410
8434
|
|
|
8411
8435
|
if (withEvent) {
|
|
8412
8436
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8575,10 +8599,10 @@ class WebRTCClient extends Emitter {
|
|
|
8575
8599
|
|
|
8576
8600
|
_stopSendingStats(session ) {
|
|
8577
8601
|
const sessionId = this.getSipSessionId(session);
|
|
8578
|
-
logger$
|
|
8602
|
+
logger$8.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8579
8603
|
|
|
8580
8604
|
if (sessionId in this.statsIntervals) {
|
|
8581
|
-
logger$
|
|
8605
|
+
logger$8.trace('Stop sending stats for call', { sessionId });
|
|
8582
8606
|
this.statsIntervals[sessionId]();
|
|
8583
8607
|
delete this.statsIntervals[sessionId];
|
|
8584
8608
|
}
|
|
@@ -8594,7 +8618,7 @@ class WebRTCClient extends Emitter {
|
|
|
8594
8618
|
try {
|
|
8595
8619
|
await this.userAgent.transport.disconnect();
|
|
8596
8620
|
} catch (e) {
|
|
8597
|
-
logger$
|
|
8621
|
+
logger$8.error('WebRTC transport disconnect, error', e);
|
|
8598
8622
|
}
|
|
8599
8623
|
}
|
|
8600
8624
|
}
|
|
@@ -8616,13 +8640,17 @@ class WebRTCClient extends Emitter {
|
|
|
8616
8640
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8617
8641
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8618
8642
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8643
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8619
8644
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8620
8645
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8646
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8621
8647
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8622
8648
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8623
8649
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8624
|
-
let audioBytesSent = 0;
|
|
8625
|
-
let audioBytesReceived = 0;
|
|
8650
|
+
let audioBytesSent = 0; // content + header
|
|
8651
|
+
let audioBytesReceived = 0; // content + header
|
|
8652
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8653
|
+
let audioContentReceived = 0;
|
|
8626
8654
|
let videoBytesSent = 0;
|
|
8627
8655
|
let videoBytesReceived = 0;
|
|
8628
8656
|
let transportSent = 0;
|
|
@@ -8632,6 +8660,7 @@ class WebRTCClient extends Emitter {
|
|
|
8632
8660
|
stats.forEach(report => {
|
|
8633
8661
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8634
8662
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8663
|
+
audioContentSent += Number(report.bytesSent);
|
|
8635
8664
|
}
|
|
8636
8665
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8637
8666
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -8643,6 +8672,7 @@ class WebRTCClient extends Emitter {
|
|
|
8643
8672
|
packetsLost += Number(report.packetsLost);
|
|
8644
8673
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8645
8674
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8675
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8646
8676
|
}
|
|
8647
8677
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8648
8678
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -8671,10 +8701,17 @@ class WebRTCClient extends Emitter {
|
|
|
8671
8701
|
});
|
|
8672
8702
|
|
|
8673
8703
|
networkStats.packetsLost = packetsLost;
|
|
8704
|
+
|
|
8674
8705
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8675
8706
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8676
8707
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8677
8708
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8709
|
+
|
|
8710
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8711
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8712
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8713
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8714
|
+
|
|
8678
8715
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8679
8716
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8680
8717
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8688,7 +8725,7 @@ class WebRTCClient extends Emitter {
|
|
|
8688
8725
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8689
8726
|
+ networkStats.transportSent;
|
|
8690
8727
|
|
|
8691
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8728
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8692
8729
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8693
8730
|
}
|
|
8694
8731
|
|
|
@@ -8713,11 +8750,12 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8713
8750
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8714
8751
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8715
8752
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8753
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8716
8754
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8717
8755
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8718
8756
|
const ON_MESSAGE = 'onMessage';
|
|
8719
|
-
const ON_REINVITE
|
|
8720
|
-
const ON_TRACK
|
|
8757
|
+
const ON_REINVITE = 'reinvite';
|
|
8758
|
+
const ON_TRACK = 'onTrack';
|
|
8721
8759
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8722
8760
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8723
8761
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8732,15 +8770,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8732
8770
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8733
8771
|
const ON_CALL_ERROR = 'onCallError';
|
|
8734
8772
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8735
|
-
const ON_NETWORK_STATS
|
|
8773
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8736
8774
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8737
8775
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8738
|
-
const ON_DISCONNECTED
|
|
8776
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
8739
8777
|
|
|
8740
8778
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8741
8779
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8742
8780
|
|
|
8743
|
-
const events
|
|
8781
|
+
const events = [
|
|
8744
8782
|
ON_USER_AGENT,
|
|
8745
8783
|
ON_REGISTERED,
|
|
8746
8784
|
ON_UNREGISTERED,
|
|
@@ -8757,9 +8795,10 @@ const events$1 = [
|
|
|
8757
8795
|
ON_CAMERA_DISABLED,
|
|
8758
8796
|
ON_CALL_FAILED,
|
|
8759
8797
|
ON_CALL_ENDED,
|
|
8798
|
+
ON_CALL_REJECTED,
|
|
8760
8799
|
ON_MESSAGE,
|
|
8761
|
-
ON_REINVITE
|
|
8762
|
-
ON_TRACK
|
|
8800
|
+
ON_REINVITE,
|
|
8801
|
+
ON_TRACK,
|
|
8763
8802
|
ON_AUDIO_STREAM,
|
|
8764
8803
|
ON_VIDEO_STREAM,
|
|
8765
8804
|
ON_REMOVE_STREAM,
|
|
@@ -8774,11 +8813,11 @@ const events$1 = [
|
|
|
8774
8813
|
ON_CALL_ERROR,
|
|
8775
8814
|
ON_CHAT,
|
|
8776
8815
|
ON_SIGNAL,
|
|
8777
|
-
ON_NETWORK_STATS
|
|
8778
|
-
ON_DISCONNECTED
|
|
8816
|
+
ON_NETWORK_STATS,
|
|
8817
|
+
ON_DISCONNECTED,
|
|
8779
8818
|
];
|
|
8780
8819
|
|
|
8781
|
-
const logger$
|
|
8820
|
+
const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8782
8821
|
|
|
8783
8822
|
class WebRTCPhone extends Emitter {
|
|
8784
8823
|
|
|
@@ -8851,7 +8890,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8851
8890
|
}).catch(error => {
|
|
8852
8891
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8853
8892
|
console.error('register error', error, error.message, error.stack);
|
|
8854
|
-
logger$
|
|
8893
|
+
logger$7.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8855
8894
|
});
|
|
8856
8895
|
}
|
|
8857
8896
|
|
|
@@ -8866,7 +8905,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8866
8905
|
if (!this.client) {
|
|
8867
8906
|
return;
|
|
8868
8907
|
}
|
|
8869
|
-
logger$
|
|
8908
|
+
logger$7.info('WebRTC phone stop');
|
|
8870
8909
|
this.client.stop();
|
|
8871
8910
|
}
|
|
8872
8911
|
|
|
@@ -8881,11 +8920,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8881
8920
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8882
8921
|
audioOnly = false, iceRestart = false) {
|
|
8883
8922
|
const sipSession = this.findSipSession(callSession);
|
|
8884
|
-
logger$
|
|
8923
|
+
logger$7.info('WebRTC phone - send reinvite', {
|
|
8885
8924
|
sessionId: sipSession ? sipSession.id : null,
|
|
8886
8925
|
constraints,
|
|
8887
8926
|
audioOnly,
|
|
8888
8927
|
conference,
|
|
8928
|
+
iceRestart,
|
|
8889
8929
|
});
|
|
8890
8930
|
|
|
8891
8931
|
if (!sipSession) {
|
|
@@ -8918,7 +8958,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8918
8958
|
}
|
|
8919
8959
|
|
|
8920
8960
|
startHeartbeat() {
|
|
8921
|
-
logger$
|
|
8961
|
+
logger$7.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8922
8962
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8923
8963
|
return;
|
|
8924
8964
|
}
|
|
@@ -8927,7 +8967,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8927
8967
|
}
|
|
8928
8968
|
|
|
8929
8969
|
stopHeartbeat() {
|
|
8930
|
-
logger$
|
|
8970
|
+
logger$7.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8931
8971
|
if (!this.client) {
|
|
8932
8972
|
return;
|
|
8933
8973
|
}
|
|
@@ -8944,7 +8984,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8944
8984
|
}
|
|
8945
8985
|
|
|
8946
8986
|
reconnect() {
|
|
8947
|
-
logger$
|
|
8987
|
+
logger$7.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8948
8988
|
if (!this.client) {
|
|
8949
8989
|
return;
|
|
8950
8990
|
}
|
|
@@ -8985,7 +9025,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8985
9025
|
return false;
|
|
8986
9026
|
}
|
|
8987
9027
|
|
|
8988
|
-
logger$
|
|
9028
|
+
logger$7.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8989
9029
|
|
|
8990
9030
|
this.client.downgradeToAudio(sipSession);
|
|
8991
9031
|
|
|
@@ -9008,7 +9048,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9008
9048
|
return Promise.resolve(false);
|
|
9009
9049
|
}
|
|
9010
9050
|
|
|
9011
|
-
logger$
|
|
9051
|
+
logger$7.info('Upgrade to video', {
|
|
9012
9052
|
id: callSession ? callSession.getId() : null,
|
|
9013
9053
|
constraints,
|
|
9014
9054
|
isConference,
|
|
@@ -9048,7 +9088,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9048
9088
|
|
|
9049
9089
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
9050
9090
|
const sipSession = this.findSipSession(callSession);
|
|
9051
|
-
logger$
|
|
9091
|
+
logger$7.info('Sending reinvite message', {
|
|
9052
9092
|
id: callSession ? callSession.getId() : null,
|
|
9053
9093
|
isUpgrade,
|
|
9054
9094
|
});
|
|
@@ -9074,7 +9114,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9074
9114
|
// Monkey patch to know when canceled with the CANCEL message
|
|
9075
9115
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
9076
9116
|
sipSession._onCancel = (message ) => {
|
|
9077
|
-
logger$
|
|
9117
|
+
logger$7.trace('on sip session canceled', { callId: message.callId });
|
|
9078
9118
|
|
|
9079
9119
|
onCancel(message);
|
|
9080
9120
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -9102,16 +9142,17 @@ class WebRTCPhone extends Emitter {
|
|
|
9102
9142
|
this.audioOutputVolume,
|
|
9103
9143
|
);
|
|
9104
9144
|
case sessionState.SessionState.Terminating:
|
|
9105
|
-
logger$
|
|
9145
|
+
logger$7.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
9106
9146
|
|
|
9107
9147
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
9108
9148
|
|
|
9109
9149
|
break;
|
|
9110
9150
|
case sessionState.SessionState.Terminated: {
|
|
9111
|
-
logger$
|
|
9151
|
+
logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9112
9152
|
|
|
9113
9153
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9114
9154
|
const callSession = this._createCallSession(sipSession);
|
|
9155
|
+
callSession.endTime = new Date();
|
|
9115
9156
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9116
9157
|
|
|
9117
9158
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -9130,7 +9171,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9130
9171
|
const [stream] = event.streams;
|
|
9131
9172
|
const kind = event && event.track && event.track.kind;
|
|
9132
9173
|
|
|
9133
|
-
logger$
|
|
9174
|
+
logger$7.info('on track stream called on the peer connection', {
|
|
9134
9175
|
callId: this.getSipSessionId(sipSession),
|
|
9135
9176
|
streamId: stream ? stream.id : null,
|
|
9136
9177
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -9150,7 +9191,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9150
9191
|
};
|
|
9151
9192
|
|
|
9152
9193
|
peerConnection.onremovestream = event => {
|
|
9153
|
-
logger$
|
|
9194
|
+
logger$7.info('on remove stream called on the peer connection', {
|
|
9154
9195
|
id: event.stream.id,
|
|
9155
9196
|
tracks: event.stream.getTracks(),
|
|
9156
9197
|
});
|
|
@@ -9160,7 +9201,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9160
9201
|
}
|
|
9161
9202
|
|
|
9162
9203
|
async startScreenSharing(constraints , callSession ) {
|
|
9163
|
-
logger$
|
|
9204
|
+
logger$7.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
9164
9205
|
|
|
9165
9206
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
9166
9207
|
if (!screenShareStream) {
|
|
@@ -9200,7 +9241,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9200
9241
|
return;
|
|
9201
9242
|
}
|
|
9202
9243
|
|
|
9203
|
-
logger$
|
|
9244
|
+
logger$7.info('WebRTC phone - stop screen sharing', {
|
|
9204
9245
|
restoreLocalStream,
|
|
9205
9246
|
});
|
|
9206
9247
|
|
|
@@ -9256,7 +9297,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9256
9297
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
9257
9298
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9258
9299
|
|
|
9259
|
-
logger$
|
|
9300
|
+
logger$7.info('WebRTC phone - on screensharing', {
|
|
9260
9301
|
hadVideo,
|
|
9261
9302
|
id: this.getSipSessionId(sipSession),
|
|
9262
9303
|
screenTrack,
|
|
@@ -9264,7 +9305,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9264
9305
|
|
|
9265
9306
|
if (screenTrack) {
|
|
9266
9307
|
screenTrack.onended = () => {
|
|
9267
|
-
logger$
|
|
9308
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9268
9309
|
hadVideo,
|
|
9269
9310
|
id: this.getSipSessionId(sipSession),
|
|
9270
9311
|
screenTrack,
|
|
@@ -9295,7 +9336,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9295
9336
|
}
|
|
9296
9337
|
|
|
9297
9338
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9298
|
-
logger$
|
|
9339
|
+
logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9299
9340
|
|
|
9300
9341
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9301
9342
|
this.currentSipSession = sipSession;
|
|
@@ -9313,7 +9354,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9313
9354
|
}
|
|
9314
9355
|
|
|
9315
9356
|
changeAudioDevice(id ) {
|
|
9316
|
-
logger$
|
|
9357
|
+
logger$7.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9317
9358
|
this.audioOutputDeviceId = id;
|
|
9318
9359
|
this.client.changeAudioOutputDevice(id);
|
|
9319
9360
|
}
|
|
@@ -9323,14 +9364,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9323
9364
|
}
|
|
9324
9365
|
|
|
9325
9366
|
changeRingDevice(id ) {
|
|
9326
|
-
logger$
|
|
9367
|
+
logger$7.info('WebRTC phone - changing ring device', { id });
|
|
9327
9368
|
|
|
9328
9369
|
this.audioRingDeviceId = id;
|
|
9329
9370
|
}
|
|
9330
9371
|
|
|
9331
9372
|
// volume is a value between 0 and 1
|
|
9332
9373
|
changeAudioVolume(volume ) {
|
|
9333
|
-
logger$
|
|
9374
|
+
logger$7.info('WebRTC phone - changing audio volume', { volume });
|
|
9334
9375
|
|
|
9335
9376
|
this.audioOutputVolume = volume;
|
|
9336
9377
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9338,32 +9379,33 @@ class WebRTCPhone extends Emitter {
|
|
|
9338
9379
|
|
|
9339
9380
|
// volume is a value between 0 and 1
|
|
9340
9381
|
changeRingVolume(volume ) {
|
|
9341
|
-
logger$
|
|
9382
|
+
logger$7.info('WebRTC phone - changing ring volume', { volume });
|
|
9342
9383
|
|
|
9343
9384
|
this.audioRingVolume = volume;
|
|
9344
9385
|
}
|
|
9345
9386
|
|
|
9346
9387
|
changeAudioInputDevice(id ) {
|
|
9347
|
-
logger$
|
|
9388
|
+
logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9348
9389
|
|
|
9349
9390
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9350
9391
|
}
|
|
9351
9392
|
|
|
9352
9393
|
changeVideoInputDevice(id ) {
|
|
9353
|
-
logger$
|
|
9394
|
+
logger$7.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9354
9395
|
|
|
9355
9396
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9356
9397
|
}
|
|
9357
9398
|
|
|
9358
9399
|
changeSessionVideoInputDevice(id ) {
|
|
9359
|
-
logger$
|
|
9400
|
+
logger$7.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9360
9401
|
|
|
9361
9402
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9362
9403
|
}
|
|
9363
9404
|
|
|
9364
9405
|
_onCallTerminated(sipSession ) {
|
|
9365
|
-
logger$
|
|
9406
|
+
logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9366
9407
|
|
|
9408
|
+
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9367
9409
|
const callSession = this._createCallSession(sipSession);
|
|
9368
9410
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
9369
9411
|
const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
|
|
@@ -9381,7 +9423,6 @@ class WebRTCPhone extends Emitter {
|
|
|
9381
9423
|
}, 5);
|
|
9382
9424
|
}
|
|
9383
9425
|
|
|
9384
|
-
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9385
9426
|
if (sipSessionId) {
|
|
9386
9427
|
this.removeIncomingSessions(sipSessionId);
|
|
9387
9428
|
}
|
|
@@ -9396,7 +9437,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9396
9437
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9397
9438
|
|
|
9398
9439
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9399
|
-
logger$
|
|
9440
|
+
logger$7.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9400
9441
|
sipId: sipSession.id,
|
|
9401
9442
|
shouldRetrigger,
|
|
9402
9443
|
hasIncomingCallSession,
|
|
@@ -9487,37 +9528,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9487
9528
|
|
|
9488
9529
|
// Deprecated
|
|
9489
9530
|
getLocalStreamForCall(callSession ) {
|
|
9490
|
-
logger$
|
|
9531
|
+
logger$7.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9491
9532
|
|
|
9492
9533
|
return this.getLocalStream(callSession);
|
|
9493
9534
|
}
|
|
9494
9535
|
|
|
9495
9536
|
// Deprecated
|
|
9496
9537
|
getRemoteStreamForCall(callSession ) {
|
|
9497
|
-
logger$
|
|
9538
|
+
logger$7.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9498
9539
|
|
|
9499
9540
|
return this.getRemoteVideoStream(callSession);
|
|
9500
9541
|
}
|
|
9501
9542
|
|
|
9502
9543
|
getRemoteStreamsForCall(callSession ) {
|
|
9503
|
-
logger$
|
|
9544
|
+
logger$7.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9504
9545
|
|
|
9505
9546
|
return this.getRemoteStream(callSession);
|
|
9506
9547
|
}
|
|
9507
9548
|
|
|
9508
9549
|
accept(callSession , cameraEnabled ) {
|
|
9509
|
-
logger$
|
|
9550
|
+
logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9510
9551
|
if (this.currentSipSession) {
|
|
9511
9552
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9512
9553
|
}
|
|
9513
9554
|
|
|
9514
9555
|
if (!callSession) {
|
|
9515
|
-
logger$
|
|
9556
|
+
logger$7.warn('no CallSession to accept.');
|
|
9516
9557
|
return Promise.resolve(null);
|
|
9517
9558
|
}
|
|
9518
9559
|
|
|
9519
9560
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9520
|
-
logger$
|
|
9561
|
+
logger$7.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9521
9562
|
return Promise.resolve(callSession.sipCallId);
|
|
9522
9563
|
}
|
|
9523
9564
|
|
|
@@ -9529,24 +9570,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9529
9570
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9530
9571
|
if (sipSession) {
|
|
9531
9572
|
if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
|
|
9532
|
-
logger$
|
|
9573
|
+
logger$7.warn('Trying to answer a terminated sipSession.');
|
|
9533
9574
|
|
|
9534
9575
|
return Promise.resolve(null);
|
|
9535
9576
|
}
|
|
9536
9577
|
|
|
9537
|
-
logger$
|
|
9578
|
+
logger$7.info('accept call, session found', { sipId: sipSession.id });
|
|
9538
9579
|
|
|
9539
9580
|
// $FlowFixMe
|
|
9540
9581
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9541
9582
|
return callSession.sipCallId;
|
|
9542
9583
|
}).catch(e => {
|
|
9543
|
-
logger$
|
|
9584
|
+
logger$7.error(e);
|
|
9544
9585
|
this.endCurrentCall(callSession);
|
|
9545
9586
|
throw e;
|
|
9546
9587
|
});
|
|
9547
9588
|
}
|
|
9548
9589
|
|
|
9549
|
-
logger$
|
|
9590
|
+
logger$7.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9550
9591
|
|
|
9551
9592
|
return Promise.resolve(null);
|
|
9552
9593
|
}
|
|
@@ -9556,7 +9597,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9556
9597
|
}
|
|
9557
9598
|
|
|
9558
9599
|
async reject(callSession ) {
|
|
9559
|
-
logger$
|
|
9600
|
+
logger$7.info('reject WebRTC called', { id: callSession.getId() });
|
|
9560
9601
|
|
|
9561
9602
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9562
9603
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9568,14 +9609,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9568
9609
|
|
|
9569
9610
|
const sipSession = this.findSipSession(callSession);
|
|
9570
9611
|
if (sipSession) {
|
|
9571
|
-
logger$
|
|
9612
|
+
logger$7.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9572
9613
|
|
|
9573
9614
|
this.client.hangup(sipSession);
|
|
9574
9615
|
}
|
|
9575
9616
|
}
|
|
9576
9617
|
|
|
9577
9618
|
async ignore(callSession ) {
|
|
9578
|
-
logger$
|
|
9619
|
+
logger$7.info('WebRTC ignore', { id: callSession.getId() });
|
|
9579
9620
|
|
|
9580
9621
|
// kill the ring
|
|
9581
9622
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9587,14 +9628,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9587
9628
|
const sipSession = this.findSipSession(callSession);
|
|
9588
9629
|
|
|
9589
9630
|
if (sipSession) {
|
|
9590
|
-
logger$
|
|
9631
|
+
logger$7.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9591
9632
|
|
|
9592
9633
|
return this.client.atxfer(sipSession);
|
|
9593
9634
|
}
|
|
9594
9635
|
}
|
|
9595
9636
|
|
|
9596
9637
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9597
|
-
logger$
|
|
9638
|
+
logger$7.info('WebRTC hold', { id: callSession.getId() });
|
|
9598
9639
|
|
|
9599
9640
|
const sipSession = this.findSipSession(callSession);
|
|
9600
9641
|
|
|
@@ -9609,18 +9650,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9609
9650
|
}
|
|
9610
9651
|
|
|
9611
9652
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9612
|
-
logger$
|
|
9653
|
+
logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9613
9654
|
|
|
9614
9655
|
const sipSession = this.findSipSession(callSession);
|
|
9615
9656
|
if (!sipSession) {
|
|
9616
9657
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9617
9658
|
}
|
|
9618
9659
|
|
|
9619
|
-
logger$
|
|
9660
|
+
logger$7.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9620
9661
|
|
|
9621
9662
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9622
9663
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9623
|
-
logger$
|
|
9664
|
+
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9624
9665
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9625
9666
|
}
|
|
9626
9667
|
|
|
@@ -9645,7 +9686,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9645
9686
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9646
9687
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9647
9688
|
|
|
9648
|
-
logger$
|
|
9689
|
+
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9649
9690
|
|
|
9650
9691
|
// Stop screenshre if needed
|
|
9651
9692
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9676,7 +9717,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9676
9717
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9677
9718
|
}
|
|
9678
9719
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9679
|
-
logger$
|
|
9720
|
+
logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9680
9721
|
|
|
9681
9722
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9682
9723
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9720,14 +9761,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9720
9761
|
}
|
|
9721
9762
|
|
|
9722
9763
|
mute(callSession , withEvent = true) {
|
|
9723
|
-
logger$
|
|
9764
|
+
logger$7.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9724
9765
|
|
|
9725
9766
|
const sipSession = this.findSipSession(callSession);
|
|
9726
9767
|
if (!sipSession) {
|
|
9727
9768
|
return;
|
|
9728
9769
|
}
|
|
9729
9770
|
|
|
9730
|
-
logger$
|
|
9771
|
+
logger$7.info('WebRTC muting', { sipId: sipSession.id });
|
|
9731
9772
|
this.client.mute(sipSession);
|
|
9732
9773
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9733
9774
|
|
|
@@ -9741,14 +9782,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9741
9782
|
}
|
|
9742
9783
|
|
|
9743
9784
|
unmute(callSession , withEvent = true) {
|
|
9744
|
-
logger$
|
|
9785
|
+
logger$7.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9745
9786
|
|
|
9746
9787
|
const sipSession = this.findSipSession(callSession);
|
|
9747
9788
|
if (!sipSession) {
|
|
9748
9789
|
return;
|
|
9749
9790
|
}
|
|
9750
9791
|
|
|
9751
|
-
logger$
|
|
9792
|
+
logger$7.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9752
9793
|
this.client.unmute(sipSession);
|
|
9753
9794
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9754
9795
|
|
|
@@ -9775,7 +9816,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9775
9816
|
if (!sipSession) {
|
|
9776
9817
|
return;
|
|
9777
9818
|
}
|
|
9778
|
-
logger$
|
|
9819
|
+
logger$7.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9779
9820
|
|
|
9780
9821
|
this.client.toggleCameraOn(sipSession);
|
|
9781
9822
|
|
|
@@ -9787,7 +9828,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9787
9828
|
if (!sipSession) {
|
|
9788
9829
|
return;
|
|
9789
9830
|
}
|
|
9790
|
-
logger$
|
|
9831
|
+
logger$7.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9791
9832
|
|
|
9792
9833
|
this.client.toggleCameraOff(sipSession);
|
|
9793
9834
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9799,7 +9840,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9799
9840
|
return;
|
|
9800
9841
|
}
|
|
9801
9842
|
|
|
9802
|
-
logger$
|
|
9843
|
+
logger$7.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9803
9844
|
this.client.sendDTMF(sipSession, tone);
|
|
9804
9845
|
}
|
|
9805
9846
|
|
|
@@ -9807,7 +9848,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9807
9848
|
// @TODO: line is not used here
|
|
9808
9849
|
async makeCall(number , line , cameraEnabled ,
|
|
9809
9850
|
audioOnly = false, conference = false) {
|
|
9810
|
-
logger$
|
|
9851
|
+
logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
9811
9852
|
if (!number) {
|
|
9812
9853
|
return Promise.resolve(null);
|
|
9813
9854
|
}
|
|
@@ -9817,7 +9858,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9817
9858
|
}
|
|
9818
9859
|
if (this.currentSipSession) {
|
|
9819
9860
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9820
|
-
logger$
|
|
9861
|
+
logger$7.warn('Unable to hold current session when making another call', e);
|
|
9821
9862
|
});
|
|
9822
9863
|
}
|
|
9823
9864
|
|
|
@@ -9827,10 +9868,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9827
9868
|
this._bindEvents(sipSession);
|
|
9828
9869
|
} catch (error) {
|
|
9829
9870
|
console.warn(error);
|
|
9830
|
-
logger$
|
|
9871
|
+
logger$7.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9831
9872
|
return Promise.resolve(null);
|
|
9832
9873
|
}
|
|
9833
9874
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9875
|
+
callSession.creationTime = new Date();
|
|
9834
9876
|
|
|
9835
9877
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9836
9878
|
|
|
@@ -9855,7 +9897,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9855
9897
|
return;
|
|
9856
9898
|
}
|
|
9857
9899
|
|
|
9858
|
-
logger$
|
|
9900
|
+
logger$7.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9859
9901
|
|
|
9860
9902
|
this.client.transfer(sipSession, target);
|
|
9861
9903
|
}
|
|
@@ -9864,7 +9906,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9864
9906
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9865
9907
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9866
9908
|
|
|
9867
|
-
logger$
|
|
9909
|
+
logger$7.info('WebRTC indirect transfer', {
|
|
9868
9910
|
sipId: sipSession ? sipSession.id : null,
|
|
9869
9911
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9870
9912
|
});
|
|
@@ -9903,7 +9945,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9903
9945
|
return false;
|
|
9904
9946
|
}
|
|
9905
9947
|
|
|
9906
|
-
logger$
|
|
9948
|
+
logger$7.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9907
9949
|
|
|
9908
9950
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9909
9951
|
|
|
@@ -9949,7 +9991,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9949
9991
|
endCurrentCall(callSession ) {
|
|
9950
9992
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9951
9993
|
|
|
9952
|
-
logger$
|
|
9994
|
+
logger$7.info('Ending current call', {
|
|
9953
9995
|
id: callSession ? callSession.getId() : null,
|
|
9954
9996
|
isCurrent,
|
|
9955
9997
|
});
|
|
@@ -9973,7 +10015,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9973
10015
|
}
|
|
9974
10016
|
|
|
9975
10017
|
async close() {
|
|
9976
|
-
logger$
|
|
10018
|
+
logger$7.info('WebRTC close');
|
|
9977
10019
|
|
|
9978
10020
|
try {
|
|
9979
10021
|
await Promise.race([
|
|
@@ -9981,7 +10023,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9981
10023
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9982
10024
|
]);
|
|
9983
10025
|
} catch (e) {
|
|
9984
|
-
logger$
|
|
10026
|
+
logger$7.error('WebRTC close, unregister error', e);
|
|
9985
10027
|
}
|
|
9986
10028
|
|
|
9987
10029
|
this.client.close();
|
|
@@ -9999,12 +10041,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9999
10041
|
}
|
|
10000
10042
|
|
|
10001
10043
|
enableRinging() {
|
|
10002
|
-
logger$
|
|
10044
|
+
logger$7.info('WebRTC enable ringing');
|
|
10003
10045
|
this.ringingEnabled = true;
|
|
10004
10046
|
}
|
|
10005
10047
|
|
|
10006
10048
|
disableRinging() {
|
|
10007
|
-
logger$
|
|
10049
|
+
logger$7.info('WebRTC disable ringing');
|
|
10008
10050
|
this.ringingEnabled = false;
|
|
10009
10051
|
}
|
|
10010
10052
|
|
|
@@ -10026,8 +10068,12 @@ class WebRTCPhone extends Emitter {
|
|
|
10026
10068
|
}
|
|
10027
10069
|
|
|
10028
10070
|
const sessionId = this.incomingSessions[0];
|
|
10071
|
+
const sipSession = this.client.getSipSession(sessionId);
|
|
10072
|
+
if (!sipSession) {
|
|
10073
|
+
return null;
|
|
10074
|
+
}
|
|
10029
10075
|
|
|
10030
|
-
return this._createCallSession(
|
|
10076
|
+
return this._createCallSession(sipSession);
|
|
10031
10077
|
}
|
|
10032
10078
|
|
|
10033
10079
|
sendMessage(sipSession = null, body , contentType = 'text/plain') {
|
|
@@ -10044,7 +10090,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10044
10090
|
|
|
10045
10091
|
// Deprecated
|
|
10046
10092
|
getLocalMediaStream(callSession ) {
|
|
10047
|
-
logger$
|
|
10093
|
+
logger$7.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
10048
10094
|
return this.getLocalStream(callSession);
|
|
10049
10095
|
}
|
|
10050
10096
|
|
|
@@ -10086,7 +10132,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10086
10132
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
10087
10133
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
10088
10134
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
10089
|
-
logger$
|
|
10135
|
+
logger$7.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
10090
10136
|
|
|
10091
10137
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
10092
10138
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -10105,11 +10151,12 @@ class WebRTCPhone extends Emitter {
|
|
|
10105
10151
|
callSession);
|
|
10106
10152
|
}
|
|
10107
10153
|
|
|
10154
|
+
callSession.creationTime = new Date();
|
|
10108
10155
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
10109
10156
|
});
|
|
10110
10157
|
|
|
10111
10158
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
10112
|
-
logger$
|
|
10159
|
+
logger$7.info('WebRTC on reinvite', {
|
|
10113
10160
|
sessionId: args[0].id,
|
|
10114
10161
|
inviteId: args[1].id,
|
|
10115
10162
|
updatedCalleeName: args[2],
|
|
@@ -10129,7 +10176,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10129
10176
|
});
|
|
10130
10177
|
|
|
10131
10178
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
10132
|
-
logger$
|
|
10179
|
+
logger$7.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
10133
10180
|
|
|
10134
10181
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
10135
10182
|
|
|
@@ -10140,22 +10187,29 @@ class WebRTCPhone extends Emitter {
|
|
|
10140
10187
|
this.client.on('ended', () => {});
|
|
10141
10188
|
|
|
10142
10189
|
this.client.on(this.client.ON_ERROR, e => {
|
|
10143
|
-
logger$
|
|
10190
|
+
logger$7.error('WebRTC error', e);
|
|
10144
10191
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10145
10192
|
});
|
|
10146
10193
|
|
|
10194
|
+
this.client.on(this.client.REJECTED, session => {
|
|
10195
|
+
logger$7.info('WebRTC call rejected', session.id);
|
|
10196
|
+
const callSession = this._createCallSession(session);
|
|
10197
|
+
callSession.endTime = new Date();
|
|
10198
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
10199
|
+
});
|
|
10200
|
+
|
|
10147
10201
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10148
|
-
logger$
|
|
10202
|
+
logger$7.info('WebRTC unregistered');
|
|
10149
10203
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10150
10204
|
});
|
|
10151
10205
|
|
|
10152
10206
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
10153
|
-
logger$
|
|
10154
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
10207
|
+
logger$7.info('WebRTC disconnected');
|
|
10208
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10155
10209
|
});
|
|
10156
10210
|
|
|
10157
10211
|
this.client.on(this.client.REGISTERED, () => {
|
|
10158
|
-
logger$
|
|
10212
|
+
logger$7.info('WebRTC registered', {
|
|
10159
10213
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
10160
10214
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
10161
10215
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -10176,19 +10230,19 @@ class WebRTCPhone extends Emitter {
|
|
|
10176
10230
|
// Send reinvite with iceRestart
|
|
10177
10231
|
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10178
10232
|
} catch (e) {
|
|
10179
|
-
logger$
|
|
10233
|
+
logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10180
10234
|
}
|
|
10181
10235
|
}
|
|
10182
10236
|
});
|
|
10183
10237
|
|
|
10184
10238
|
this.client.on(this.client.CONNECTED, () => {
|
|
10185
|
-
logger$
|
|
10239
|
+
logger$7.info('WebRTC client connected');
|
|
10186
10240
|
|
|
10187
10241
|
this.stopHeartbeat();
|
|
10188
10242
|
});
|
|
10189
10243
|
|
|
10190
10244
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
10191
|
-
logger$
|
|
10245
|
+
logger$7.info('WebRTC client disconnected');
|
|
10192
10246
|
|
|
10193
10247
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10194
10248
|
|
|
@@ -10202,7 +10256,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10202
10256
|
});
|
|
10203
10257
|
|
|
10204
10258
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
10205
|
-
this.eventEmitter.emit(ON_TRACK
|
|
10259
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
10206
10260
|
});
|
|
10207
10261
|
|
|
10208
10262
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -10217,7 +10271,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10217
10271
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
10218
10272
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
10219
10273
|
|
|
10220
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
10274
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
10221
10275
|
});
|
|
10222
10276
|
|
|
10223
10277
|
// Used when upgrading directly in screenshare mode
|
|
@@ -10226,7 +10280,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10226
10280
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
10227
10281
|
const callSession = this.callSessions[sipSessionId];
|
|
10228
10282
|
|
|
10229
|
-
logger$
|
|
10283
|
+
logger$7.info('Updrading directly in screensharing mode', {
|
|
10230
10284
|
sipSessionId,
|
|
10231
10285
|
tracks: localStream ? localStream.getTracks() : null,
|
|
10232
10286
|
});
|
|
@@ -10356,6 +10410,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10356
10410
|
const number = identity ? identity.uri._normal.user : null;
|
|
10357
10411
|
const { state } = sipSession || {};
|
|
10358
10412
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10413
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10359
10414
|
|
|
10360
10415
|
const callSession = new CallSession({
|
|
10361
10416
|
callId: fromSession && fromSession.callId,
|
|
@@ -10363,6 +10418,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10363
10418
|
sipStatus: state,
|
|
10364
10419
|
displayName: identity ? identity.displayName || number : number,
|
|
10365
10420
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10421
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10422
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10366
10423
|
answered: state === sessionState.SessionState.Established,
|
|
10367
10424
|
paused: this.client.isCallHeld(sipSession),
|
|
10368
10425
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10373,6 +10430,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10373
10430
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10374
10431
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10375
10432
|
recordingPaused: false, // @TODO
|
|
10433
|
+
sipSession,
|
|
10376
10434
|
...extra,
|
|
10377
10435
|
});
|
|
10378
10436
|
|
|
@@ -10401,11 +10459,12 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10401
10459
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10402
10460
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10403
10461
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10462
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10404
10463
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10405
10464
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10406
10465
|
ON_MESSAGE: ON_MESSAGE,
|
|
10407
|
-
ON_REINVITE: ON_REINVITE
|
|
10408
|
-
ON_TRACK: ON_TRACK
|
|
10466
|
+
ON_REINVITE: ON_REINVITE,
|
|
10467
|
+
ON_TRACK: ON_TRACK,
|
|
10409
10468
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10410
10469
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10411
10470
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10420,16 +10479,24 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10420
10479
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10421
10480
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10422
10481
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10423
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS
|
|
10482
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10424
10483
|
ON_CHAT: ON_CHAT,
|
|
10425
10484
|
ON_SIGNAL: ON_SIGNAL,
|
|
10426
|
-
ON_DISCONNECTED: ON_DISCONNECTED
|
|
10485
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10427
10486
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10428
10487
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10429
|
-
events: events
|
|
10488
|
+
events: events,
|
|
10430
10489
|
'default': WebRTCPhone
|
|
10431
10490
|
});
|
|
10432
10491
|
|
|
10492
|
+
/* */
|
|
10493
|
+
class SFUNotAvailableError extends Error {
|
|
10494
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10495
|
+
super(message);
|
|
10496
|
+
this.name = 'SFUNotAvailableError';
|
|
10497
|
+
}
|
|
10498
|
+
}
|
|
10499
|
+
|
|
10433
10500
|
//
|
|
10434
10501
|
|
|
10435
10502
|
const logger$6 = IssueReporter$1.loggerFor('simple-phone');
|
|
@@ -10814,13 +10881,13 @@ class Phone extends Emitter {
|
|
|
10814
10881
|
|
|
10815
10882
|
checkSfu() {
|
|
10816
10883
|
if (!this.hasSfu()) {
|
|
10817
|
-
throw new
|
|
10884
|
+
throw new SFUNotAvailableError();
|
|
10818
10885
|
}
|
|
10819
10886
|
}
|
|
10820
10887
|
|
|
10821
10888
|
_transferEvents() {
|
|
10822
10889
|
this.unbind();
|
|
10823
|
-
[...events, ...transportEvents].forEach(event => {
|
|
10890
|
+
[...events$1, ...transportEvents].forEach(event => {
|
|
10824
10891
|
this.client.on(event, (...args) =>
|
|
10825
10892
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
10826
10893
|
});
|
|
@@ -10842,7 +10909,7 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
10842
10909
|
|
|
10843
10910
|
//
|
|
10844
10911
|
|
|
10845
|
-
const SOCKET_EVENTS = {
|
|
10912
|
+
const SOCKET_EVENTS$1 = {
|
|
10846
10913
|
ON_OPEN: 'onopen',
|
|
10847
10914
|
ON_MESSAGE: 'onmessage',
|
|
10848
10915
|
ON_ERROR: 'onerror',
|
|
@@ -10938,7 +11005,7 @@ const BLACKLIST_EVENTS = [
|
|
|
10938
11005
|
];
|
|
10939
11006
|
|
|
10940
11007
|
const HEARTBEAT_ENGINE_VERSION = '20.09';
|
|
10941
|
-
const logger$
|
|
11008
|
+
const logger$5 = IssueReporter$1.loggerFor('wazo-ws');
|
|
10942
11009
|
const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
|
|
10943
11010
|
|
|
10944
11011
|
class WebSocketClient extends Emitter {
|
|
@@ -10987,24 +11054,24 @@ class WebSocketClient extends Emitter {
|
|
|
10987
11054
|
}
|
|
10988
11055
|
|
|
10989
11056
|
connect() {
|
|
10990
|
-
logger$
|
|
11057
|
+
logger$5.info('connect method started', { host: this.host, token: this.token });
|
|
10991
11058
|
this.socket = new ReconnectingWebSocket__default['default'](this._getUrl.bind(this), [], this.options);
|
|
10992
11059
|
if (this.options.binaryType) {
|
|
10993
11060
|
this.socket.binaryType = this.options.binaryType;
|
|
10994
11061
|
}
|
|
10995
11062
|
|
|
10996
11063
|
this.socket.onopen = () => {
|
|
10997
|
-
logger$
|
|
10998
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
11064
|
+
logger$5.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
11065
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
|
|
10999
11066
|
};
|
|
11000
11067
|
|
|
11001
11068
|
this.socket.onerror = event => {
|
|
11002
|
-
logger$
|
|
11003
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
11069
|
+
logger$5.error('on Wazo WS error', event.target);
|
|
11070
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
|
|
11004
11071
|
};
|
|
11005
11072
|
|
|
11006
11073
|
this.socket.onmessage = (event ) => {
|
|
11007
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
11074
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
|
|
11008
11075
|
|
|
11009
11076
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
11010
11077
|
let { name } = message;
|
|
@@ -11029,7 +11096,7 @@ class WebSocketClient extends Emitter {
|
|
|
11029
11096
|
|
|
11030
11097
|
this.socket.onclose = event => {
|
|
11031
11098
|
// Can't be converted to JSON (circular structure)
|
|
11032
|
-
logger$
|
|
11099
|
+
logger$5.info('on Wazo WS close', {
|
|
11033
11100
|
reason: event.reason,
|
|
11034
11101
|
code: event.code,
|
|
11035
11102
|
readyState: event.target.readyState,
|
|
@@ -11037,22 +11104,22 @@ class WebSocketClient extends Emitter {
|
|
|
11037
11104
|
token: this.token,
|
|
11038
11105
|
});
|
|
11039
11106
|
this.initialized = false;
|
|
11040
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
11107
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
|
|
11041
11108
|
|
|
11042
11109
|
switch (event.code) {
|
|
11043
11110
|
case 4002:
|
|
11044
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
11111
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
|
|
11045
11112
|
break;
|
|
11046
11113
|
}
|
|
11047
11114
|
};
|
|
11048
11115
|
|
|
11049
11116
|
this.socket.onerror = event => {
|
|
11050
|
-
logger$
|
|
11117
|
+
logger$5.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
|
|
11051
11118
|
};
|
|
11052
11119
|
}
|
|
11053
11120
|
|
|
11054
11121
|
close(force = false) {
|
|
11055
|
-
logger$
|
|
11122
|
+
logger$5.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
|
|
11056
11123
|
|
|
11057
11124
|
if (!this.socket) {
|
|
11058
11125
|
return;
|
|
@@ -11070,7 +11137,7 @@ class WebSocketClient extends Emitter {
|
|
|
11070
11137
|
|
|
11071
11138
|
updateToken(token ) {
|
|
11072
11139
|
this.token = token;
|
|
11073
|
-
logger$
|
|
11140
|
+
logger$5.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
|
|
11074
11141
|
|
|
11075
11142
|
if (this.socket) {
|
|
11076
11143
|
// If still connected, send the token to the WS
|
|
@@ -11088,7 +11155,7 @@ class WebSocketClient extends Emitter {
|
|
|
11088
11155
|
}
|
|
11089
11156
|
|
|
11090
11157
|
startHeartbeat() {
|
|
11091
|
-
logger$
|
|
11158
|
+
logger$5.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
|
|
11092
11159
|
|
|
11093
11160
|
if (!this.socket) {
|
|
11094
11161
|
this.heartbeat.stop();
|
|
@@ -11102,7 +11169,7 @@ class WebSocketClient extends Emitter {
|
|
|
11102
11169
|
}
|
|
11103
11170
|
|
|
11104
11171
|
stopHeartbeat() {
|
|
11105
|
-
logger$
|
|
11172
|
+
logger$5.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
|
|
11106
11173
|
|
|
11107
11174
|
this.heartbeat.stop();
|
|
11108
11175
|
}
|
|
@@ -11132,7 +11199,7 @@ class WebSocketClient extends Emitter {
|
|
|
11132
11199
|
}
|
|
11133
11200
|
|
|
11134
11201
|
reconnect(reason ) {
|
|
11135
|
-
logger$
|
|
11202
|
+
logger$5.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
|
|
11136
11203
|
if (!this.socket) {
|
|
11137
11204
|
return;
|
|
11138
11205
|
}
|
|
@@ -11157,7 +11224,7 @@ class WebSocketClient extends Emitter {
|
|
|
11157
11224
|
break;
|
|
11158
11225
|
case 'start':
|
|
11159
11226
|
this.initialized = true;
|
|
11160
|
-
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
11227
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
|
|
11161
11228
|
break;
|
|
11162
11229
|
default:
|
|
11163
11230
|
this.eventEmitter.emit('message', message);
|
|
@@ -11188,7 +11255,7 @@ class WebSocketClient extends Emitter {
|
|
|
11188
11255
|
this.close();
|
|
11189
11256
|
}
|
|
11190
11257
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
11191
|
-
logger$
|
|
11258
|
+
logger$5.log('Wazo WS url computed to reconnect', { url });
|
|
11192
11259
|
|
|
11193
11260
|
return url;
|
|
11194
11261
|
}
|
|
@@ -11196,15 +11263,15 @@ class WebSocketClient extends Emitter {
|
|
|
11196
11263
|
_onHeartbeat(message ) {
|
|
11197
11264
|
if (message.payload === 'pong') {
|
|
11198
11265
|
this.heartbeat.onHeartbeat();
|
|
11199
|
-
logger$
|
|
11266
|
+
logger$5.log('on heartbeat received from Wazo WS');
|
|
11200
11267
|
}
|
|
11201
11268
|
}
|
|
11202
11269
|
|
|
11203
11270
|
async _onHeartbeatTimeout() {
|
|
11204
|
-
logger$
|
|
11271
|
+
logger$5.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
11205
11272
|
|
|
11206
11273
|
this.close();
|
|
11207
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11274
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11208
11275
|
|
|
11209
11276
|
if (this.onHeartBeatTimeout) {
|
|
11210
11277
|
this.onHeartBeatTimeout();
|
|
@@ -11284,7 +11351,7 @@ WebSocketClient.eventLists = [
|
|
|
11284
11351
|
|
|
11285
11352
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
11286
11353
|
__proto__: null,
|
|
11287
|
-
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
11354
|
+
SOCKET_EVENTS: SOCKET_EVENTS$1,
|
|
11288
11355
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
11289
11356
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
11290
11357
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -11357,10 +11424,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11357
11424
|
|
|
11358
11425
|
//
|
|
11359
11426
|
|
|
11360
|
-
const { SOCKET_EVENTS
|
|
11361
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS
|
|
11427
|
+
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11428
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
11362
11429
|
|
|
11363
|
-
const logger$
|
|
11430
|
+
const logger$4 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
11364
11431
|
|
|
11365
11432
|
class Websocket extends Emitter {
|
|
11366
11433
|
|
|
@@ -11374,9 +11441,9 @@ class Websocket extends Emitter {
|
|
|
11374
11441
|
// $FlowFixMe
|
|
11375
11442
|
this[key] = OTHER_EVENTS[key];
|
|
11376
11443
|
});
|
|
11377
|
-
Object.keys(SOCKET_EVENTS
|
|
11444
|
+
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
11378
11445
|
// $FlowFixMe
|
|
11379
|
-
this[key] = SOCKET_EVENTS
|
|
11446
|
+
this[key] = SOCKET_EVENTS[key];
|
|
11380
11447
|
});
|
|
11381
11448
|
this.eventLists = WebSocketClient.eventLists;
|
|
11382
11449
|
|
|
@@ -11384,7 +11451,7 @@ class Websocket extends Emitter {
|
|
|
11384
11451
|
}
|
|
11385
11452
|
|
|
11386
11453
|
open(host , session ) {
|
|
11387
|
-
logger$
|
|
11454
|
+
logger$4.info('open simple WebSocket', { host, token: session.token });
|
|
11388
11455
|
this.ws = new WebSocketClient(
|
|
11389
11456
|
{
|
|
11390
11457
|
host,
|
|
@@ -11412,7 +11479,7 @@ class Websocket extends Emitter {
|
|
|
11412
11479
|
}
|
|
11413
11480
|
|
|
11414
11481
|
updateToken(token ) {
|
|
11415
|
-
logger$
|
|
11482
|
+
logger$4.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
11416
11483
|
|
|
11417
11484
|
if (!this.ws) {
|
|
11418
11485
|
return;
|
|
@@ -11440,12 +11507,12 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11440
11507
|
|
|
11441
11508
|
//
|
|
11442
11509
|
|
|
11443
|
-
const logger$
|
|
11510
|
+
const logger$3 = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
11444
11511
|
|
|
11445
|
-
class SipRoom extends Room
|
|
11512
|
+
class SipRoom extends Room {
|
|
11446
11513
|
|
|
11447
11514
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
11448
|
-
logger$
|
|
11515
|
+
logger$3.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
11449
11516
|
|
|
11450
11517
|
if (!room) {
|
|
11451
11518
|
await Wazo.Phone.connect();
|
|
@@ -11461,7 +11528,7 @@ class SipRoom extends Room$1 {
|
|
|
11461
11528
|
room.setCallId(room.callSession.call.id);
|
|
11462
11529
|
}
|
|
11463
11530
|
|
|
11464
|
-
logger$
|
|
11531
|
+
logger$3.info('connected to room', {
|
|
11465
11532
|
extension: room.extension,
|
|
11466
11533
|
});
|
|
11467
11534
|
|
|
@@ -11469,7 +11536,7 @@ class SipRoom extends Room$1 {
|
|
|
11469
11536
|
}
|
|
11470
11537
|
|
|
11471
11538
|
mute() {
|
|
11472
|
-
logger$
|
|
11539
|
+
logger$3.info('mute sip room');
|
|
11473
11540
|
|
|
11474
11541
|
Wazo.Phone.mute(this.callSession, false);
|
|
11475
11542
|
|
|
@@ -11477,7 +11544,7 @@ class SipRoom extends Room$1 {
|
|
|
11477
11544
|
}
|
|
11478
11545
|
|
|
11479
11546
|
unmute() {
|
|
11480
|
-
logger$
|
|
11547
|
+
logger$3.info('unmute sip room');
|
|
11481
11548
|
|
|
11482
11549
|
Wazo.Phone.unmute(this.callSession, false);
|
|
11483
11550
|
|
|
@@ -11579,7 +11646,7 @@ class SipRoom extends Room$1 {
|
|
|
11579
11646
|
|
|
11580
11647
|
//
|
|
11581
11648
|
|
|
11582
|
-
const logger$
|
|
11649
|
+
const logger$2 = IssueReporter$1.loggerFor('room');
|
|
11583
11650
|
|
|
11584
11651
|
class Participant extends Emitter {
|
|
11585
11652
|
|
|
@@ -11701,7 +11768,7 @@ class Participant extends Emitter {
|
|
|
11701
11768
|
}
|
|
11702
11769
|
|
|
11703
11770
|
onTalking(isTalking ) {
|
|
11704
|
-
logger$
|
|
11771
|
+
logger$2.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
11705
11772
|
this.isTalking = isTalking;
|
|
11706
11773
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
11707
11774
|
// directly from asterisk, there's no need to do so
|
|
@@ -11804,7 +11871,7 @@ class Participant extends Emitter {
|
|
|
11804
11871
|
}
|
|
11805
11872
|
|
|
11806
11873
|
updateStatus(status , broadcast = true) {
|
|
11807
|
-
logger$
|
|
11874
|
+
logger$2.info('updating participant status', { name: this.name, status });
|
|
11808
11875
|
|
|
11809
11876
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
11810
11877
|
if (status.audioMuted) {
|
|
@@ -11852,7 +11919,7 @@ class Participant extends Emitter {
|
|
|
11852
11919
|
|
|
11853
11920
|
broadcastStatus(inboundStatus = null) {
|
|
11854
11921
|
const status = inboundStatus || this.getStatus();
|
|
11855
|
-
logger$
|
|
11922
|
+
logger$2.info('broadcasting participant status', { callId: this.callId, status });
|
|
11856
11923
|
|
|
11857
11924
|
this.room.sendSignal({
|
|
11858
11925
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|
|
@@ -12067,7 +12134,7 @@ class NotificationOptions {
|
|
|
12067
12134
|
|
|
12068
12135
|
|
|
12069
12136
|
// Represents a conference room, like `9000`.
|
|
12070
|
-
class Room {
|
|
12137
|
+
class Room$1 {
|
|
12071
12138
|
|
|
12072
12139
|
|
|
12073
12140
|
|
|
@@ -12088,7 +12155,7 @@ class Room {
|
|
|
12088
12155
|
}
|
|
12089
12156
|
|
|
12090
12157
|
connect(callSession ) {
|
|
12091
|
-
return new Room({ ...this, connectedCallSession: callSession });
|
|
12158
|
+
return new Room$1({ ...this, connectedCallSession: callSession });
|
|
12092
12159
|
}
|
|
12093
12160
|
|
|
12094
12161
|
has(callSession ) {
|
|
@@ -12097,7 +12164,7 @@ class Room {
|
|
|
12097
12164
|
|
|
12098
12165
|
addParticipant(uuid , extension , talking = null) {
|
|
12099
12166
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
12100
|
-
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12167
|
+
return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12101
12168
|
}
|
|
12102
12169
|
|
|
12103
12170
|
return this;
|
|
@@ -12116,7 +12183,7 @@ class Room {
|
|
|
12116
12183
|
updatedParticipants.push(participant);
|
|
12117
12184
|
}
|
|
12118
12185
|
|
|
12119
|
-
return new Room({ ...this, participants: updatedParticipants });
|
|
12186
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
12120
12187
|
}
|
|
12121
12188
|
|
|
12122
12189
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -12132,7 +12199,7 @@ class Room {
|
|
|
12132
12199
|
updatedParticipants.push(participant);
|
|
12133
12200
|
}
|
|
12134
12201
|
|
|
12135
|
-
return new Room({ ...this, participants: updatedParticipants });
|
|
12202
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
12136
12203
|
}
|
|
12137
12204
|
|
|
12138
12205
|
hasCallWithId(id ) {
|
|
@@ -12140,18 +12207,18 @@ class Room {
|
|
|
12140
12207
|
}
|
|
12141
12208
|
|
|
12142
12209
|
disconnect() {
|
|
12143
|
-
return new Room({ ...this, connectedCallSession: null });
|
|
12210
|
+
return new Room$1({ ...this, connectedCallSession: null });
|
|
12144
12211
|
}
|
|
12145
12212
|
|
|
12146
12213
|
removeParticipantWithUUID(uuid ) {
|
|
12147
|
-
return new Room({
|
|
12214
|
+
return new Room$1({
|
|
12148
12215
|
...this,
|
|
12149
12216
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
12150
12217
|
});
|
|
12151
12218
|
}
|
|
12152
12219
|
|
|
12153
12220
|
removeParticipantWithExtension(extension ) {
|
|
12154
|
-
return new Room({
|
|
12221
|
+
return new Room$1({
|
|
12155
12222
|
...this,
|
|
12156
12223
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
12157
12224
|
});
|
|
@@ -12162,7 +12229,7 @@ class Room {
|
|
|
12162
12229
|
}
|
|
12163
12230
|
|
|
12164
12231
|
static newFrom(room ) {
|
|
12165
|
-
return newFrom(room, Room);
|
|
12232
|
+
return newFrom(room, Room$1);
|
|
12166
12233
|
}
|
|
12167
12234
|
}
|
|
12168
12235
|
|
|
@@ -12469,11 +12536,11 @@ var wazoWebsocket = {
|
|
|
12469
12536
|
resolve();
|
|
12470
12537
|
};
|
|
12471
12538
|
|
|
12472
|
-
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
12539
|
+
client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
|
|
12473
12540
|
handleError(`Connection error : ${error}`);
|
|
12474
12541
|
});
|
|
12475
12542
|
|
|
12476
|
-
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
12543
|
+
client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
|
|
12477
12544
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
12478
12545
|
client.setOnHeartbeatTimeout(() => {
|
|
12479
12546
|
handleError('No response to heartbeat');
|
|
@@ -12574,7 +12641,7 @@ var webrtc = {
|
|
|
12574
12641
|
}),
|
|
12575
12642
|
};
|
|
12576
12643
|
|
|
12577
|
-
const parseCandidate
|
|
12644
|
+
const parseCandidate = line => {
|
|
12578
12645
|
let parts;
|
|
12579
12646
|
// Parse both variants.
|
|
12580
12647
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -12665,7 +12732,7 @@ var SymmetricNat = {
|
|
|
12665
12732
|
}
|
|
12666
12733
|
|
|
12667
12734
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
12668
|
-
const cand = parseCandidate
|
|
12735
|
+
const cand = parseCandidate(e.candidate.candidate);
|
|
12669
12736
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
12670
12737
|
candidates[cand.relatedPort].push(cand.port);
|
|
12671
12738
|
} else if (!e.candidate) {
|
|
@@ -12733,7 +12800,7 @@ var iceIpv4 = {
|
|
|
12733
12800
|
const rawCandidate = e.candidate.candidate;
|
|
12734
12801
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
12735
12802
|
hasSrflxOrRelay = true;
|
|
12736
|
-
const candidate = parseCandidate
|
|
12803
|
+
const candidate = parseCandidate(e.candidate.candidate);
|
|
12737
12804
|
ips.push(candidate.ip);
|
|
12738
12805
|
}
|
|
12739
12806
|
} else if (!e.candidate) {
|
|
@@ -12770,7 +12837,7 @@ var checks = [
|
|
|
12770
12837
|
|
|
12771
12838
|
//
|
|
12772
12839
|
|
|
12773
|
-
const logger$
|
|
12840
|
+
const logger$1 = IssueReporter$1.loggerFor('engine-check');
|
|
12774
12841
|
|
|
12775
12842
|
class Checker {
|
|
12776
12843
|
|
|
@@ -12788,28 +12855,28 @@ class Checker {
|
|
|
12788
12855
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
12789
12856
|
await this._addEngineVersion();
|
|
12790
12857
|
|
|
12791
|
-
logger$
|
|
12858
|
+
logger$1.info('Engine check starting');
|
|
12792
12859
|
|
|
12793
12860
|
for (let i = 0; i < this.checks.length; i++) {
|
|
12794
12861
|
const { name, check } = this.checks[i];
|
|
12795
12862
|
|
|
12796
|
-
logger$
|
|
12863
|
+
logger$1.info(`Checking ${name} ...`);
|
|
12797
12864
|
|
|
12798
12865
|
onCheckBegin(name);
|
|
12799
12866
|
try {
|
|
12800
12867
|
// eslint-disable-next-line no-await-in-loop
|
|
12801
12868
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
12802
|
-
logger$
|
|
12869
|
+
logger$1.info(`Checking ${name} success.`, { result });
|
|
12803
12870
|
|
|
12804
12871
|
onCheckResult(name, result);
|
|
12805
12872
|
} catch (e) {
|
|
12806
|
-
logger$
|
|
12873
|
+
logger$1.info(`Checking ${name} failure`, { message: e.message });
|
|
12807
12874
|
|
|
12808
12875
|
onCheckResult(name, e);
|
|
12809
12876
|
}
|
|
12810
12877
|
}
|
|
12811
12878
|
|
|
12812
|
-
logger$
|
|
12879
|
+
logger$1.info('Engine check done.');
|
|
12813
12880
|
}
|
|
12814
12881
|
|
|
12815
12882
|
addCheck(check ) {
|
|
@@ -12833,7 +12900,7 @@ const Wazo = {
|
|
|
12833
12900
|
Auth: Auth$1,
|
|
12834
12901
|
Phone: Phone$1,
|
|
12835
12902
|
Websocket: Websocket$1,
|
|
12836
|
-
Room
|
|
12903
|
+
Room,
|
|
12837
12904
|
SipRoom,
|
|
12838
12905
|
RemoteParticipant,
|
|
12839
12906
|
LocalParticipant,
|
|
@@ -12866,7 +12933,7 @@ const Wazo = {
|
|
|
12866
12933
|
Session,
|
|
12867
12934
|
Voicemail,
|
|
12868
12935
|
Relocation,
|
|
12869
|
-
ConferenceRoom: Room,
|
|
12936
|
+
ConferenceRoom: Room$1,
|
|
12870
12937
|
CallSession,
|
|
12871
12938
|
IndirectTransfer,
|
|
12872
12939
|
SwitchboardCall,
|
|
@@ -12891,6 +12958,7 @@ const Wazo = {
|
|
|
12891
12958
|
InvalidSubscription,
|
|
12892
12959
|
InvalidAuthorization,
|
|
12893
12960
|
CanceledCallError,
|
|
12961
|
+
SFUNotAvailableError,
|
|
12894
12962
|
};
|
|
12895
12963
|
|
|
12896
12964
|
if (window) {
|
|
@@ -12905,9 +12973,9 @@ if (global) {
|
|
|
12905
12973
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
12906
12974
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
12907
12975
|
|
|
12908
|
-
const logger
|
|
12976
|
+
const logger = IssueReporter$1.loggerFor('sdk-room');
|
|
12909
12977
|
|
|
12910
|
-
class Room
|
|
12978
|
+
class Room extends Emitter {
|
|
12911
12979
|
|
|
12912
12980
|
|
|
12913
12981
|
|
|
@@ -12965,7 +13033,7 @@ class Room$1 extends Emitter {
|
|
|
12965
13033
|
extra = {},
|
|
12966
13034
|
) {
|
|
12967
13035
|
super();
|
|
12968
|
-
logger
|
|
13036
|
+
logger.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
12969
13037
|
|
|
12970
13038
|
// Represents the room callSession
|
|
12971
13039
|
this.callSession = callSession;
|
|
@@ -13031,7 +13099,7 @@ class Room$1 extends Emitter {
|
|
|
13031
13099
|
* @returns {Promise<Room>}
|
|
13032
13100
|
*/
|
|
13033
13101
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
13034
|
-
logger
|
|
13102
|
+
logger.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
13035
13103
|
|
|
13036
13104
|
if (!room) {
|
|
13037
13105
|
await Wazo.Phone.connect();
|
|
@@ -13044,7 +13112,7 @@ class Room$1 extends Emitter {
|
|
|
13044
13112
|
|
|
13045
13113
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
13046
13114
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
13047
|
-
logger
|
|
13115
|
+
logger.info('room call received via WS', { callId: data.call_id });
|
|
13048
13116
|
if (room) {
|
|
13049
13117
|
room.setCallId(data.call_id);
|
|
13050
13118
|
}
|
|
@@ -13052,7 +13120,7 @@ class Room$1 extends Emitter {
|
|
|
13052
13120
|
|
|
13053
13121
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
13054
13122
|
// eslint-disable-next-line no-param-reassign
|
|
13055
|
-
room = new Room
|
|
13123
|
+
room = new Room(callSession, extension, null, null, extra);
|
|
13056
13124
|
|
|
13057
13125
|
// Wait for the call to be accepted
|
|
13058
13126
|
await new Promise((resolve, reject) => {
|
|
@@ -13073,7 +13141,7 @@ class Room$1 extends Emitter {
|
|
|
13073
13141
|
// Retrieve conference
|
|
13074
13142
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
13075
13143
|
|
|
13076
|
-
logger
|
|
13144
|
+
logger.info('connected to room', {
|
|
13077
13145
|
sourceId: conference ? conference.sourceId : null,
|
|
13078
13146
|
name: conference ? conference.name : null,
|
|
13079
13147
|
});
|
|
@@ -13083,7 +13151,7 @@ class Room$1 extends Emitter {
|
|
|
13083
13151
|
room.setName(conference.name);
|
|
13084
13152
|
}
|
|
13085
13153
|
} else if (meeting) {
|
|
13086
|
-
logger
|
|
13154
|
+
logger.info('Already connected to meeting', {
|
|
13087
13155
|
uuid: meeting.uuid,
|
|
13088
13156
|
name: meeting.name,
|
|
13089
13157
|
});
|
|
@@ -13096,13 +13164,13 @@ class Room$1 extends Emitter {
|
|
|
13096
13164
|
}
|
|
13097
13165
|
|
|
13098
13166
|
static disconnect() {
|
|
13099
|
-
logger
|
|
13167
|
+
logger.info('static disconnection to room');
|
|
13100
13168
|
|
|
13101
13169
|
Wazo.Phone.disconnect();
|
|
13102
13170
|
}
|
|
13103
13171
|
|
|
13104
13172
|
async disconnect() {
|
|
13105
|
-
logger
|
|
13173
|
+
logger.info('disconnection to room called');
|
|
13106
13174
|
|
|
13107
13175
|
await Wazo.Phone.hangup(this.callSession);
|
|
13108
13176
|
this.callSession = null;
|
|
@@ -13122,19 +13190,19 @@ class Room$1 extends Emitter {
|
|
|
13122
13190
|
}
|
|
13123
13191
|
|
|
13124
13192
|
setSourceId(sourceId ) {
|
|
13125
|
-
logger
|
|
13193
|
+
logger.info('set room source id', { sourceId });
|
|
13126
13194
|
|
|
13127
13195
|
this.sourceId = sourceId;
|
|
13128
13196
|
}
|
|
13129
13197
|
|
|
13130
13198
|
setMeetingUuid(meetingUuid ) {
|
|
13131
|
-
logger
|
|
13199
|
+
logger.info('set meeting uuid', { meetingUuid });
|
|
13132
13200
|
|
|
13133
13201
|
this.meetingUuid = meetingUuid;
|
|
13134
13202
|
}
|
|
13135
13203
|
|
|
13136
13204
|
setCallId(callId ) {
|
|
13137
|
-
logger
|
|
13205
|
+
logger.info('set room call id', { callId });
|
|
13138
13206
|
|
|
13139
13207
|
if (callId) {
|
|
13140
13208
|
this.callId = callId;
|
|
@@ -13142,7 +13210,7 @@ class Room$1 extends Emitter {
|
|
|
13142
13210
|
}
|
|
13143
13211
|
|
|
13144
13212
|
setName(name ) {
|
|
13145
|
-
logger
|
|
13213
|
+
logger.info('set room name', { name });
|
|
13146
13214
|
|
|
13147
13215
|
this.name = name;
|
|
13148
13216
|
}
|
|
@@ -13161,7 +13229,7 @@ class Room$1 extends Emitter {
|
|
|
13161
13229
|
}
|
|
13162
13230
|
|
|
13163
13231
|
async startScreenSharing(constraints ) {
|
|
13164
|
-
logger
|
|
13232
|
+
logger.info('start room screen sharing', { constraints });
|
|
13165
13233
|
|
|
13166
13234
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
13167
13235
|
if (!screensharingStream) {
|
|
@@ -13175,7 +13243,7 @@ class Room$1 extends Emitter {
|
|
|
13175
13243
|
}
|
|
13176
13244
|
|
|
13177
13245
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
13178
|
-
logger
|
|
13246
|
+
logger.info('stop room screen sharing');
|
|
13179
13247
|
|
|
13180
13248
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
13181
13249
|
|
|
@@ -13187,7 +13255,7 @@ class Room$1 extends Emitter {
|
|
|
13187
13255
|
}
|
|
13188
13256
|
|
|
13189
13257
|
turnCameraOff() {
|
|
13190
|
-
logger
|
|
13258
|
+
logger.info('turn room camera off');
|
|
13191
13259
|
|
|
13192
13260
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
13193
13261
|
|
|
@@ -13197,7 +13265,7 @@ class Room$1 extends Emitter {
|
|
|
13197
13265
|
}
|
|
13198
13266
|
|
|
13199
13267
|
turnCameraOn() {
|
|
13200
|
-
logger
|
|
13268
|
+
logger.info('turn room camera on');
|
|
13201
13269
|
|
|
13202
13270
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
13203
13271
|
|
|
@@ -13207,7 +13275,7 @@ class Room$1 extends Emitter {
|
|
|
13207
13275
|
}
|
|
13208
13276
|
|
|
13209
13277
|
mute() {
|
|
13210
|
-
logger
|
|
13278
|
+
logger.info('mute room');
|
|
13211
13279
|
|
|
13212
13280
|
Wazo.Phone.mute(this.callSession);
|
|
13213
13281
|
|
|
@@ -13215,7 +13283,7 @@ class Room$1 extends Emitter {
|
|
|
13215
13283
|
}
|
|
13216
13284
|
|
|
13217
13285
|
unmute() {
|
|
13218
|
-
logger
|
|
13286
|
+
logger.info('unmute room');
|
|
13219
13287
|
|
|
13220
13288
|
Wazo.Phone.unmute(this.callSession);
|
|
13221
13289
|
|
|
@@ -13235,7 +13303,7 @@ class Room$1 extends Emitter {
|
|
|
13235
13303
|
}
|
|
13236
13304
|
|
|
13237
13305
|
hold() {
|
|
13238
|
-
logger
|
|
13306
|
+
logger.info('hold room');
|
|
13239
13307
|
|
|
13240
13308
|
Wazo.Phone.hold(this.callSession, true);
|
|
13241
13309
|
|
|
@@ -13245,7 +13313,7 @@ class Room$1 extends Emitter {
|
|
|
13245
13313
|
}
|
|
13246
13314
|
|
|
13247
13315
|
async resume() {
|
|
13248
|
-
logger
|
|
13316
|
+
logger.info('resume room');
|
|
13249
13317
|
|
|
13250
13318
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
13251
13319
|
|
|
@@ -13273,13 +13341,13 @@ class Room$1 extends Emitter {
|
|
|
13273
13341
|
}
|
|
13274
13342
|
|
|
13275
13343
|
sendDTMF(tone ) {
|
|
13276
|
-
logger
|
|
13344
|
+
logger.info('send room DTMF', { tone });
|
|
13277
13345
|
|
|
13278
13346
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
13279
13347
|
}
|
|
13280
13348
|
|
|
13281
13349
|
async sendReinvite(newConstraints = null) {
|
|
13282
|
-
logger
|
|
13350
|
+
logger.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
13283
13351
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
13284
13352
|
|
|
13285
13353
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -13338,7 +13406,7 @@ class Room$1 extends Emitter {
|
|
|
13338
13406
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
13339
13407
|
|
|
13340
13408
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
13341
|
-
logger
|
|
13409
|
+
logger.info('on room audio stream');
|
|
13342
13410
|
|
|
13343
13411
|
this.audioStream = stream;
|
|
13344
13412
|
if (!this.roomAudioElement) {
|
|
@@ -13351,7 +13419,7 @@ class Room$1 extends Emitter {
|
|
|
13351
13419
|
});
|
|
13352
13420
|
|
|
13353
13421
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
13354
|
-
logger
|
|
13422
|
+
logger.info('on room video stream', { streamId });
|
|
13355
13423
|
|
|
13356
13424
|
this._mapMsid(sipSession.body.body);
|
|
13357
13425
|
|
|
@@ -13366,7 +13434,7 @@ class Room$1 extends Emitter {
|
|
|
13366
13434
|
});
|
|
13367
13435
|
|
|
13368
13436
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
13369
|
-
logger
|
|
13437
|
+
logger.info('on room remove stream');
|
|
13370
13438
|
|
|
13371
13439
|
const participant = this.participants.find(someParticipant =>
|
|
13372
13440
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -13498,7 +13566,7 @@ class Room$1 extends Emitter {
|
|
|
13498
13566
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
13499
13567
|
if (requester) {
|
|
13500
13568
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
13501
|
-
logger
|
|
13569
|
+
logger.info('trigger room requester status', { origin });
|
|
13502
13570
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
13503
13571
|
}
|
|
13504
13572
|
break;
|
|
@@ -13529,24 +13597,24 @@ class Room$1 extends Emitter {
|
|
|
13529
13597
|
|
|
13530
13598
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
13531
13599
|
if (participant.user_uuid === session.uuid) {
|
|
13532
|
-
logger
|
|
13600
|
+
logger.info('room current user joined');
|
|
13533
13601
|
|
|
13534
13602
|
// Retrieve participants via an API calls
|
|
13535
13603
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
13536
13604
|
let response;
|
|
13537
13605
|
try {
|
|
13538
13606
|
if (this.meetingUuid) {
|
|
13539
|
-
logger
|
|
13607
|
+
logger.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
13540
13608
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
13541
13609
|
} else {
|
|
13542
|
-
logger
|
|
13610
|
+
logger.info('fetching conference participants', { conferenceId });
|
|
13543
13611
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
13544
13612
|
}
|
|
13545
13613
|
} catch (e) {
|
|
13546
|
-
logger
|
|
13614
|
+
logger.error('room participants fetching, error', e);
|
|
13547
13615
|
}
|
|
13548
13616
|
if (response) {
|
|
13549
|
-
logger
|
|
13617
|
+
logger.info('conference participants fetched', { nb: response.items.length });
|
|
13550
13618
|
participants = response.items.map(item => {
|
|
13551
13619
|
const isMe = item.call_id === this.callId;
|
|
13552
13620
|
|
|
@@ -13573,7 +13641,7 @@ class Room$1 extends Emitter {
|
|
|
13573
13641
|
? new Wazo.RemoteParticipant(this, participant)
|
|
13574
13642
|
: null;
|
|
13575
13643
|
|
|
13576
|
-
logger
|
|
13644
|
+
logger.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
13577
13645
|
|
|
13578
13646
|
if (remoteParticipant) {
|
|
13579
13647
|
this.participants.push(remoteParticipant);
|
|
@@ -13738,4 +13806,4 @@ class Room$1 extends Emitter {
|
|
|
13738
13806
|
|
|
13739
13807
|
exports.SIGNAL_TYPE_PARTICIPANT_REQUEST = SIGNAL_TYPE_PARTICIPANT_REQUEST;
|
|
13740
13808
|
exports.SIGNAL_TYPE_PARTICIPANT_UPDATE = SIGNAL_TYPE_PARTICIPANT_UPDATE;
|
|
13741
|
-
exports.default = Room
|
|
13809
|
+
exports.default = Room;
|