@wazo/sdk 0.37.23 → 0.37.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wazo-sdk.js +6 -6
- package/esm/__tests__/api-client.test.js +22 -17
- package/esm/__tests__/web-rtc-client.test.js +105 -100
- package/esm/api/amid.js +1 -1
- package/esm/api/call-logd.js +2 -2
- package/esm/api/confd.js +10 -5
- package/esm/api/ctid-ng.js +3 -3
- package/esm/api/dird.js +1 -1
- package/esm/api/webhookd.js +1 -1
- package/esm/api-client.js +22 -17
- package/esm/checker/Checker.js +130 -125
- package/esm/checker/checks/aor.js +22 -17
- package/esm/checker/checks/api.js +22 -17
- package/esm/checker/checks/index.js +120 -115
- package/esm/checker/checks/wazo-websocket.js +15 -15
- package/esm/checker/checks/webrtc-transport.js +105 -100
- package/esm/checker/checks/webrtc.js +105 -100
- package/esm/domain/AdHocAPIConference.js +22 -17
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/Contact.js +1 -1
- package/esm/domain/Features.js +22 -17
- package/esm/domain/Meeting.js +12 -5
- package/esm/domain/Phone/CTIPhone.js +36 -31
- package/esm/domain/Phone/WebRTCPhone.js +110 -87
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/Contact.test.js +1 -1
- package/esm/domain/__tests__/Meeting.test.js +144 -0
- package/esm/index.js +365 -337
- package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
- package/esm/service/CallApi.js +22 -17
- package/esm/service/IssueReporter.js +1 -1
- package/esm/service/__tests__/IssueReporter.test.js +1 -1
- package/esm/service/getApiClient.js +22 -17
- package/esm/simple/Auth.js +355 -327
- package/esm/simple/Configuration.js +355 -327
- package/esm/simple/Directory.js +22 -17
- package/esm/simple/Phone.js +355 -327
- package/esm/simple/Websocket.js +17 -17
- package/esm/simple/index.js +359 -331
- package/esm/simple/room/LocalParticipant.js +359 -331
- package/esm/simple/room/Participant.js +359 -331
- package/esm/simple/room/RemoteParticipant.js +359 -331
- package/esm/simple/room/Room.js +360 -332
- package/esm/simple/room/SipRoom.js +359 -331
- package/esm/simple/room/Stream.js +359 -331
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/esm/simple/utils.js +359 -331
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/web-rtc-client.js +105 -100
- package/esm/websocket-client.js +15 -15
- package/lib/__tests__/api-client.test.js +22 -17
- package/lib/__tests__/web-rtc-client.test.js +105 -100
- package/lib/api/amid.js +1 -1
- package/lib/api/call-logd.js +2 -2
- package/lib/api/confd.js +10 -5
- package/lib/api/ctid-ng.js +3 -3
- package/lib/api/dird.js +1 -1
- package/lib/api/webhookd.js +1 -1
- package/lib/api-client.js +22 -17
- package/lib/checker/Checker.js +130 -125
- package/lib/checker/checks/aor.js +22 -17
- package/lib/checker/checks/api.js +22 -17
- package/lib/checker/checks/index.js +120 -115
- package/lib/checker/checks/wazo-websocket.js +15 -15
- package/lib/checker/checks/webrtc-transport.js +105 -100
- package/lib/checker/checks/webrtc.js +105 -100
- package/lib/domain/AdHocAPIConference.js +22 -17
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +22 -17
- package/lib/domain/Meeting.js +16 -5
- package/lib/domain/Phone/CTIPhone.js +36 -31
- package/lib/domain/Phone/WebRTCPhone.js +110 -87
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/Contact.test.js +1 -1
- package/lib/domain/__tests__/Meeting.test.js +150 -0
- package/lib/index.js +365 -337
- package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
- package/lib/service/CallApi.js +22 -17
- package/lib/service/IssueReporter.js +1 -1
- package/lib/service/__tests__/IssueReporter.test.js +1 -1
- package/lib/service/getApiClient.js +22 -17
- package/lib/simple/Auth.js +355 -327
- package/lib/simple/Configuration.js +355 -327
- package/lib/simple/Directory.js +22 -17
- package/lib/simple/Phone.js +355 -327
- package/lib/simple/Websocket.js +17 -17
- package/lib/simple/index.js +359 -331
- package/lib/simple/room/LocalParticipant.js +359 -331
- package/lib/simple/room/Participant.js +359 -331
- package/lib/simple/room/RemoteParticipant.js +359 -331
- package/lib/simple/room/Room.js +360 -332
- package/lib/simple/room/SipRoom.js +359 -331
- package/lib/simple/room/Stream.js +359 -331
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/lib/simple/utils.js +359 -331
- package/lib/types/WebSocketMessage.js +2 -0
- package/lib/web-rtc-client.js +105 -100
- package/lib/websocket-client.js +15 -15
- package/package.json +1 -1
- package/src/domain/Meeting.js +12 -5
- package/src/domain/Phone/WebRTCPhone.js +24 -1
- package/src/domain/__tests__/Meeting.test.js +50 -0
package/lib/simple/room/Room.js
CHANGED
|
@@ -471,7 +471,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
471
471
|
|
|
472
472
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
473
473
|
|
|
474
|
-
const logger
|
|
474
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
475
475
|
|
|
476
476
|
// Use a function here to be able to mock it in tests
|
|
477
477
|
const realFetch = () => {
|
|
@@ -610,7 +610,7 @@ class ApiRequester {
|
|
|
610
610
|
};
|
|
611
611
|
|
|
612
612
|
if (this.refreshTokenPromise) {
|
|
613
|
-
logger
|
|
613
|
+
logger.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
|
|
633
|
+
logger.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
|
|
643
|
+
logger.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
|
|
653
|
+
logger.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
|
|
681
|
+
logger.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
|
|
687
|
+
logger.info('token refreshed', { isTokenNotFound });
|
|
688
688
|
if (isTokenNotFound) {
|
|
689
689
|
const pathParts = path.split('/');
|
|
690
690
|
pathParts.pop();
|
|
@@ -2642,8 +2642,9 @@ class ExternalApp {
|
|
|
2642
2642
|
|
|
2643
2643
|
|
|
2644
2644
|
|
|
2645
|
-
|
|
2645
|
+
|
|
2646
2646
|
|
|
2647
|
+
|
|
2647
2648
|
|
|
2648
2649
|
|
|
2649
2650
|
class Meeting {
|
|
@@ -2654,9 +2655,10 @@ class Meeting {
|
|
|
2654
2655
|
|
|
2655
2656
|
|
|
2656
2657
|
|
|
2657
|
-
|
|
2658
|
+
|
|
2658
2659
|
|
|
2659
2660
|
|
|
2661
|
+
|
|
2660
2662
|
|
|
2661
2663
|
static parse(plain ) {
|
|
2662
2664
|
return new Meeting({
|
|
@@ -2666,8 +2668,9 @@ class Meeting {
|
|
|
2666
2668
|
ownerUuids: plain.owner_uuids,
|
|
2667
2669
|
port: plain.port,
|
|
2668
2670
|
uuid: plain.uuid,
|
|
2669
|
-
|
|
2671
|
+
extension: plain.exten,
|
|
2670
2672
|
persistent: plain.persistent,
|
|
2673
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2671
2674
|
});
|
|
2672
2675
|
}
|
|
2673
2676
|
|
|
@@ -2689,8 +2692,9 @@ class Meeting {
|
|
|
2689
2692
|
ownerUuids,
|
|
2690
2693
|
port,
|
|
2691
2694
|
uri,
|
|
2692
|
-
|
|
2695
|
+
extension,
|
|
2693
2696
|
persistent,
|
|
2697
|
+
creationTime,
|
|
2694
2698
|
} = {}) {
|
|
2695
2699
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2696
2700
|
this.uri = uri;
|
|
@@ -2698,8 +2702,9 @@ class Meeting {
|
|
|
2698
2702
|
this.ownerUuids = ownerUuids;
|
|
2699
2703
|
this.port = port;
|
|
2700
2704
|
this.uuid = uuid;
|
|
2701
|
-
this.
|
|
2705
|
+
this.extension = extension;
|
|
2702
2706
|
this.persistent = persistent;
|
|
2707
|
+
this.creationTime = creationTime;
|
|
2703
2708
|
|
|
2704
2709
|
// Useful to compare instead of instanceof with minified code
|
|
2705
2710
|
this.type = 'Meeting';
|
|
@@ -4060,7 +4065,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4060
4065
|
|
|
4061
4066
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4062
4067
|
|
|
4063
|
-
const logger$
|
|
4068
|
+
const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4064
4069
|
|
|
4065
4070
|
class CTIPhone extends Emitter {
|
|
4066
4071
|
|
|
@@ -4073,7 +4078,7 @@ class CTIPhone extends Emitter {
|
|
|
4073
4078
|
|
|
4074
4079
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4075
4080
|
super();
|
|
4076
|
-
logger$
|
|
4081
|
+
logger$1.info('CTI Phone created');
|
|
4077
4082
|
this.session = session;
|
|
4078
4083
|
this.isMobile = isMobile;
|
|
4079
4084
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4134,7 +4139,7 @@ class CTIPhone extends Emitter {
|
|
|
4134
4139
|
}
|
|
4135
4140
|
|
|
4136
4141
|
async makeCall(number , line ) {
|
|
4137
|
-
logger$
|
|
4142
|
+
logger$1.info('make CTI call', { number });
|
|
4138
4143
|
|
|
4139
4144
|
if (!number) {
|
|
4140
4145
|
return null;
|
|
@@ -4157,7 +4162,7 @@ class CTIPhone extends Emitter {
|
|
|
4157
4162
|
if (!callSession) {
|
|
4158
4163
|
return Promise.resolve(null);
|
|
4159
4164
|
}
|
|
4160
|
-
logger$
|
|
4165
|
+
logger$1.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4161
4166
|
|
|
4162
4167
|
if (!this.currentCall) {
|
|
4163
4168
|
this.currentCall = callSession.call;
|
|
@@ -4170,7 +4175,7 @@ class CTIPhone extends Emitter {
|
|
|
4170
4175
|
if (!callSession) {
|
|
4171
4176
|
return;
|
|
4172
4177
|
}
|
|
4173
|
-
logger$
|
|
4178
|
+
logger$1.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4174
4179
|
|
|
4175
4180
|
this.currentCall = undefined;
|
|
4176
4181
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4180,7 +4185,7 @@ class CTIPhone extends Emitter {
|
|
|
4180
4185
|
if (!callSession) {
|
|
4181
4186
|
return Promise.resolve(false);
|
|
4182
4187
|
}
|
|
4183
|
-
logger$
|
|
4188
|
+
logger$1.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4184
4189
|
|
|
4185
4190
|
try {
|
|
4186
4191
|
await CallApi.cancelCall(callSession);
|
|
@@ -4191,7 +4196,7 @@ class CTIPhone extends Emitter {
|
|
|
4191
4196
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4192
4197
|
return true;
|
|
4193
4198
|
} catch (e) {
|
|
4194
|
-
logger$
|
|
4199
|
+
logger$1.error('hangup CTI call, error', e);
|
|
4195
4200
|
|
|
4196
4201
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4197
4202
|
return false;
|
|
@@ -4204,7 +4209,7 @@ class CTIPhone extends Emitter {
|
|
|
4204
4209
|
if (!callSession) {
|
|
4205
4210
|
return;
|
|
4206
4211
|
}
|
|
4207
|
-
logger$
|
|
4212
|
+
logger$1.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4208
4213
|
|
|
4209
4214
|
await CallApi.cancelCall(callSession);
|
|
4210
4215
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4214,7 +4219,7 @@ class CTIPhone extends Emitter {
|
|
|
4214
4219
|
if (!callSession) {
|
|
4215
4220
|
return;
|
|
4216
4221
|
}
|
|
4217
|
-
logger$
|
|
4222
|
+
logger$1.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4218
4223
|
|
|
4219
4224
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4220
4225
|
}
|
|
@@ -4227,19 +4232,19 @@ class CTIPhone extends Emitter {
|
|
|
4227
4232
|
if (!callSession) {
|
|
4228
4233
|
return;
|
|
4229
4234
|
}
|
|
4230
|
-
logger$
|
|
4235
|
+
logger$1.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4231
4236
|
|
|
4232
4237
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4233
4238
|
}
|
|
4234
4239
|
|
|
4235
4240
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4236
|
-
logger$
|
|
4241
|
+
logger$1.info('cancel CTI transfer', { transferId });
|
|
4237
4242
|
|
|
4238
4243
|
return CallApi.cancelCallTransfer(transferId);
|
|
4239
4244
|
}
|
|
4240
4245
|
|
|
4241
4246
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4242
|
-
logger$
|
|
4247
|
+
logger$1.info('confirm CTI transfer', { transferId });
|
|
4243
4248
|
|
|
4244
4249
|
return CallApi.confirmCallTransfer(transferId);
|
|
4245
4250
|
}
|
|
@@ -4248,19 +4253,19 @@ class CTIPhone extends Emitter {
|
|
|
4248
4253
|
if (!callSession) {
|
|
4249
4254
|
return;
|
|
4250
4255
|
}
|
|
4251
|
-
logger$
|
|
4256
|
+
logger$1.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4252
4257
|
|
|
4253
4258
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4254
4259
|
}
|
|
4255
4260
|
|
|
4256
4261
|
onConnectionMade() {
|
|
4257
|
-
logger$
|
|
4262
|
+
logger$1.info('on CTI connection made');
|
|
4258
4263
|
|
|
4259
4264
|
this.eventEmitter.emit('onCallAccepted');
|
|
4260
4265
|
}
|
|
4261
4266
|
|
|
4262
4267
|
async close() {
|
|
4263
|
-
logger$
|
|
4268
|
+
logger$1.info('CTI close');
|
|
4264
4269
|
|
|
4265
4270
|
return Promise.resolve();
|
|
4266
4271
|
}
|
|
@@ -4269,7 +4274,7 @@ class CTIPhone extends Emitter {
|
|
|
4269
4274
|
if (!callSession) {
|
|
4270
4275
|
return;
|
|
4271
4276
|
}
|
|
4272
|
-
logger$
|
|
4277
|
+
logger$1.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4273
4278
|
|
|
4274
4279
|
return CallApi.hold(callSession.callId);
|
|
4275
4280
|
}
|
|
@@ -4278,7 +4283,7 @@ class CTIPhone extends Emitter {
|
|
|
4278
4283
|
if (!callSession) {
|
|
4279
4284
|
return;
|
|
4280
4285
|
}
|
|
4281
|
-
logger$
|
|
4286
|
+
logger$1.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4282
4287
|
|
|
4283
4288
|
return CallApi.resume(callSession.callId);
|
|
4284
4289
|
}
|
|
@@ -4287,7 +4292,7 @@ class CTIPhone extends Emitter {
|
|
|
4287
4292
|
if (!callSession) {
|
|
4288
4293
|
return;
|
|
4289
4294
|
}
|
|
4290
|
-
logger$
|
|
4295
|
+
logger$1.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4291
4296
|
|
|
4292
4297
|
return CallApi.mute(callSession.callId);
|
|
4293
4298
|
}
|
|
@@ -4296,7 +4301,7 @@ class CTIPhone extends Emitter {
|
|
|
4296
4301
|
if (!callSession) {
|
|
4297
4302
|
return;
|
|
4298
4303
|
}
|
|
4299
|
-
logger$
|
|
4304
|
+
logger$1.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4300
4305
|
|
|
4301
4306
|
return CallApi.unmute(callSession.callId);
|
|
4302
4307
|
}
|
|
@@ -5305,7 +5310,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5305
5310
|
const WEBHOOKD_VERSION = '1.0';
|
|
5306
5311
|
const AMID_VERSION = '1.0';
|
|
5307
5312
|
|
|
5308
|
-
const logger$
|
|
5313
|
+
const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5309
5314
|
|
|
5310
5315
|
class ApiClient {
|
|
5311
5316
|
|
|
@@ -5357,12 +5362,12 @@ class ApiClient {
|
|
|
5357
5362
|
}
|
|
5358
5363
|
|
|
5359
5364
|
async forceRefreshToken() {
|
|
5360
|
-
logger$
|
|
5365
|
+
logger$2.info('forcing refresh token, calling callback');
|
|
5361
5366
|
return this.refreshTokenCallback();
|
|
5362
5367
|
}
|
|
5363
5368
|
|
|
5364
5369
|
async refreshTokenCallback() {
|
|
5365
|
-
logger$
|
|
5370
|
+
logger$2.info('refresh token callback called', {
|
|
5366
5371
|
refreshToken: this.refreshToken,
|
|
5367
5372
|
refreshBackend: this.refreshBackend,
|
|
5368
5373
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5380,7 +5385,7 @@ class ApiClient {
|
|
|
5380
5385
|
this.isMobile,
|
|
5381
5386
|
);
|
|
5382
5387
|
|
|
5383
|
-
logger$
|
|
5388
|
+
logger$2.info('token refreshed', { token: session.token });
|
|
5384
5389
|
|
|
5385
5390
|
if (this.onRefreshToken) {
|
|
5386
5391
|
this.onRefreshToken(session.token, session);
|
|
@@ -5521,7 +5526,7 @@ var getApiClient = (forServer ) => {
|
|
|
5521
5526
|
class InvalidSubscription extends Error {}
|
|
5522
5527
|
class InvalidAuthorization extends Error {}
|
|
5523
5528
|
|
|
5524
|
-
const logger$
|
|
5529
|
+
const logger$3 = IssueReporter$1.loggerFor('simple-auth');
|
|
5525
5530
|
|
|
5526
5531
|
class Auth {
|
|
5527
5532
|
|
|
@@ -5556,7 +5561,7 @@ class Auth {
|
|
|
5556
5561
|
setApiClientId(this.clientId);
|
|
5557
5562
|
setRefreshExpiration(this.expiration);
|
|
5558
5563
|
setOnRefreshToken((token , session ) => {
|
|
5559
|
-
logger$
|
|
5564
|
+
logger$3.info('on refresh token done', { token });
|
|
5560
5565
|
setApiToken(token);
|
|
5561
5566
|
Wazo.Websocket.updateToken(token);
|
|
5562
5567
|
|
|
@@ -5601,7 +5606,7 @@ class Auth {
|
|
|
5601
5606
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
5602
5607
|
return this._onAuthenticated(rawSession);
|
|
5603
5608
|
} catch (e) {
|
|
5604
|
-
logger$
|
|
5609
|
+
logger$3.error('on validate token error', e);
|
|
5605
5610
|
console.warn(e);
|
|
5606
5611
|
return false;
|
|
5607
5612
|
}
|
|
@@ -5957,7 +5962,7 @@ class AdHocAPIConference {
|
|
|
5957
5962
|
|
|
5958
5963
|
/* */
|
|
5959
5964
|
|
|
5960
|
-
const parseCandidate
|
|
5965
|
+
const parseCandidate = (candidate ) => {
|
|
5961
5966
|
if (!candidate) {
|
|
5962
5967
|
return null;
|
|
5963
5968
|
}
|
|
@@ -6111,7 +6116,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6111
6116
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
6112
6117
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6113
6118
|
if (event.candidate) {
|
|
6114
|
-
this.gatheredCandidates.push(parseCandidate
|
|
6119
|
+
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
6115
6120
|
}
|
|
6116
6121
|
};
|
|
6117
6122
|
|
|
@@ -6575,7 +6580,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6575
6580
|
const SEND_STATS_DELAY = 5000;
|
|
6576
6581
|
|
|
6577
6582
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6578
|
-
const logger$
|
|
6583
|
+
const logger$4 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6579
6584
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6580
6585
|
|
|
6581
6586
|
// events
|
|
@@ -6589,14 +6594,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6589
6594
|
const MESSAGE = 'message';
|
|
6590
6595
|
const ACCEPTED = 'accepted';
|
|
6591
6596
|
const REJECTED = 'rejected';
|
|
6592
|
-
const ON_TRACK
|
|
6593
|
-
const ON_REINVITE
|
|
6597
|
+
const ON_TRACK = 'onTrack';
|
|
6598
|
+
const ON_REINVITE = 'reinvite';
|
|
6594
6599
|
const ON_ERROR = 'onError';
|
|
6595
6600
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6596
|
-
const ON_NETWORK_STATS
|
|
6597
|
-
const ON_DISCONNECTED
|
|
6601
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6602
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
6598
6603
|
|
|
6599
|
-
const events
|
|
6604
|
+
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6600
6605
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6601
6606
|
class CanceledCallError extends Error {}
|
|
6602
6607
|
|
|
@@ -6732,12 +6737,12 @@ class WebRTCClient extends Emitter {
|
|
|
6732
6737
|
this.MESSAGE = MESSAGE;
|
|
6733
6738
|
this.ACCEPTED = ACCEPTED;
|
|
6734
6739
|
this.REJECTED = REJECTED;
|
|
6735
|
-
this.ON_TRACK = ON_TRACK
|
|
6736
|
-
this.ON_REINVITE = ON_REINVITE
|
|
6740
|
+
this.ON_TRACK = ON_TRACK;
|
|
6741
|
+
this.ON_REINVITE = ON_REINVITE;
|
|
6737
6742
|
this.ON_ERROR = ON_ERROR;
|
|
6738
6743
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6739
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS
|
|
6740
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED
|
|
6744
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6745
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6741
6746
|
}
|
|
6742
6747
|
|
|
6743
6748
|
configureMedia(media ) {
|
|
@@ -6754,13 +6759,13 @@ class WebRTCClient extends Emitter {
|
|
|
6754
6759
|
|
|
6755
6760
|
createUserAgent(configOverrides ) {
|
|
6756
6761
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6757
|
-
logger$
|
|
6762
|
+
logger$4.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6758
6763
|
|
|
6759
6764
|
webRTCConfiguration.delegate = {
|
|
6760
6765
|
onConnect: this.onConnect.bind(this),
|
|
6761
6766
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6762
6767
|
onInvite: (invitation ) => {
|
|
6763
|
-
logger$
|
|
6768
|
+
logger$4.info('sdk webrtc on invite', {
|
|
6764
6769
|
method: 'delegate.onInvite',
|
|
6765
6770
|
id: invitation.id,
|
|
6766
6771
|
remoteURI: invitation.remoteURI,
|
|
@@ -6803,7 +6808,7 @@ class WebRTCClient extends Emitter {
|
|
|
6803
6808
|
}
|
|
6804
6809
|
|
|
6805
6810
|
onConnect() {
|
|
6806
|
-
logger$
|
|
6811
|
+
logger$4.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6807
6812
|
this.eventEmitter.emit(CONNECTED);
|
|
6808
6813
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6809
6814
|
this.registerer.waitingToggle(false);
|
|
@@ -6812,7 +6817,7 @@ class WebRTCClient extends Emitter {
|
|
|
6812
6817
|
}
|
|
6813
6818
|
|
|
6814
6819
|
async onDisconnect(error ) {
|
|
6815
|
-
logger$
|
|
6820
|
+
logger$4.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6816
6821
|
this.connectionPromise = null;
|
|
6817
6822
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6818
6823
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6837,37 +6842,37 @@ class WebRTCClient extends Emitter {
|
|
|
6837
6842
|
};
|
|
6838
6843
|
|
|
6839
6844
|
if (this.skipRegister) {
|
|
6840
|
-
logger$
|
|
6845
|
+
logger$4.info('sdk webrtc skip register...', logInfo);
|
|
6841
6846
|
return Promise.resolve();
|
|
6842
6847
|
}
|
|
6843
6848
|
|
|
6844
|
-
logger$
|
|
6849
|
+
logger$4.info('sdk webrtc registering...', logInfo);
|
|
6845
6850
|
|
|
6846
6851
|
if (!this.userAgent) {
|
|
6847
|
-
logger$
|
|
6852
|
+
logger$4.info('sdk webrtc recreating User Agent');
|
|
6848
6853
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6849
6854
|
}
|
|
6850
6855
|
if (!this.userAgent || this.isRegistered()) {
|
|
6851
|
-
logger$
|
|
6856
|
+
logger$4.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6852
6857
|
return Promise.resolve();
|
|
6853
6858
|
}
|
|
6854
6859
|
|
|
6855
6860
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6856
|
-
logger$
|
|
6861
|
+
logger$4.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6857
6862
|
return Promise.resolve();
|
|
6858
6863
|
}
|
|
6859
6864
|
|
|
6860
6865
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6861
6866
|
|
|
6862
6867
|
const onRegisterFailed = () => {
|
|
6863
|
-
logger$
|
|
6868
|
+
logger$4.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6864
6869
|
this.connectionPromise = null;
|
|
6865
6870
|
if (this.registerer && this.registerer.waiting) {
|
|
6866
6871
|
this.registerer.waitingToggle(false);
|
|
6867
6872
|
}
|
|
6868
6873
|
|
|
6869
6874
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6870
|
-
logger$
|
|
6875
|
+
logger$4.info('sdk webrtc registering, retrying...', { tries });
|
|
6871
6876
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6872
6877
|
}
|
|
6873
6878
|
};
|
|
@@ -6876,18 +6881,18 @@ class WebRTCClient extends Emitter {
|
|
|
6876
6881
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6877
6882
|
// during the resolution of the primise.
|
|
6878
6883
|
if (!this.userAgent) {
|
|
6879
|
-
logger$
|
|
6884
|
+
logger$4.info('sdk webrtc recreating User Agent after connection');
|
|
6880
6885
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6881
6886
|
}
|
|
6882
6887
|
|
|
6883
|
-
logger$
|
|
6888
|
+
logger$4.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6884
6889
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
6885
6890
|
this.connectionPromise = null;
|
|
6886
6891
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6887
6892
|
|
|
6888
6893
|
// Bind registerer events
|
|
6889
6894
|
this.registerer.stateChange.addListener(newState => {
|
|
6890
|
-
logger$
|
|
6895
|
+
logger$4.info('sdk webrtc registering, state changed', { newState });
|
|
6891
6896
|
|
|
6892
6897
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
6893
6898
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -6900,7 +6905,7 @@ class WebRTCClient extends Emitter {
|
|
|
6900
6905
|
const options = {
|
|
6901
6906
|
requestDelegate: {
|
|
6902
6907
|
onReject: response => {
|
|
6903
|
-
logger$
|
|
6908
|
+
logger$4.error('sdk webrtc registering, rejected', { response });
|
|
6904
6909
|
|
|
6905
6910
|
onRegisterFailed();
|
|
6906
6911
|
},
|
|
@@ -6908,13 +6913,13 @@ class WebRTCClient extends Emitter {
|
|
|
6908
6913
|
};
|
|
6909
6914
|
|
|
6910
6915
|
return this.registerer.register(options).catch((e) => {
|
|
6911
|
-
logger$
|
|
6916
|
+
logger$4.error('sdk webrtc registering, error', e);
|
|
6912
6917
|
|
|
6913
6918
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6914
6919
|
return e;
|
|
6915
6920
|
});
|
|
6916
6921
|
}).catch(error => {
|
|
6917
|
-
logger$
|
|
6922
|
+
logger$4.error('sdk webrtc registering, transport error', error);
|
|
6918
6923
|
onRegisterFailed();
|
|
6919
6924
|
});
|
|
6920
6925
|
}
|
|
@@ -6943,21 +6948,21 @@ class WebRTCClient extends Emitter {
|
|
|
6943
6948
|
}
|
|
6944
6949
|
|
|
6945
6950
|
unregister() {
|
|
6946
|
-
logger$
|
|
6951
|
+
logger$4.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6947
6952
|
if (!this.registerer) {
|
|
6948
6953
|
return Promise.resolve();
|
|
6949
6954
|
}
|
|
6950
6955
|
|
|
6951
6956
|
try {
|
|
6952
6957
|
return this.registerer.unregister().then(() => {
|
|
6953
|
-
logger$
|
|
6958
|
+
logger$4.info('sdk webrtc unregistered');
|
|
6954
6959
|
this._cleanupRegister();
|
|
6955
6960
|
}).catch(e => {
|
|
6956
|
-
logger$
|
|
6961
|
+
logger$4.error('sdk webrtc unregistering, promise error', e);
|
|
6957
6962
|
this._cleanupRegister();
|
|
6958
6963
|
});
|
|
6959
6964
|
} catch (e) {
|
|
6960
|
-
logger$
|
|
6965
|
+
logger$4.error('sdk webrtc unregistering, error', e);
|
|
6961
6966
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6962
6967
|
// error when the registerer is in a bad state
|
|
6963
6968
|
this._cleanupRegister();
|
|
@@ -6965,7 +6970,7 @@ class WebRTCClient extends Emitter {
|
|
|
6965
6970
|
}
|
|
6966
6971
|
|
|
6967
6972
|
stop() {
|
|
6968
|
-
logger$
|
|
6973
|
+
logger$4.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6969
6974
|
if (!this.userAgent) {
|
|
6970
6975
|
return Promise.resolve();
|
|
6971
6976
|
}
|
|
@@ -6973,12 +6978,12 @@ class WebRTCClient extends Emitter {
|
|
|
6973
6978
|
return this.userAgent.stop().then(() => {
|
|
6974
6979
|
return this._cleanupRegister();
|
|
6975
6980
|
}).catch(e => {
|
|
6976
|
-
logger$
|
|
6981
|
+
logger$4.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6977
6982
|
});
|
|
6978
6983
|
}
|
|
6979
6984
|
|
|
6980
6985
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6981
|
-
logger$
|
|
6986
|
+
logger$4.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
6982
6987
|
const inviterOptions = {
|
|
6983
6988
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6984
6989
|
conference,
|
|
@@ -7009,7 +7014,7 @@ class WebRTCClient extends Emitter {
|
|
|
7009
7014
|
this._onAccepted(session, response.session, true);
|
|
7010
7015
|
},
|
|
7011
7016
|
onReject: (response ) => {
|
|
7012
|
-
logger$
|
|
7017
|
+
logger$4.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
7013
7018
|
this._stopSendingStats(session);
|
|
7014
7019
|
this.stopNetworkMonitoring(session);
|
|
7015
7020
|
|
|
@@ -7032,11 +7037,11 @@ class WebRTCClient extends Emitter {
|
|
|
7032
7037
|
}
|
|
7033
7038
|
|
|
7034
7039
|
answer(session , enableVideo ) {
|
|
7035
|
-
logger$
|
|
7040
|
+
logger$4.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
7036
7041
|
|
|
7037
7042
|
if (!session || !session.accept) {
|
|
7038
7043
|
const error = 'No session to answer, or not an invitation';
|
|
7039
|
-
logger$
|
|
7044
|
+
logger$4.warn(error);
|
|
7040
7045
|
return Promise.reject(new Error(error));
|
|
7041
7046
|
}
|
|
7042
7047
|
const options = {
|
|
@@ -7046,15 +7051,15 @@ class WebRTCClient extends Emitter {
|
|
|
7046
7051
|
return session.accept(options).then(() => {
|
|
7047
7052
|
if (session.isCanceled) {
|
|
7048
7053
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
7049
|
-
logger$
|
|
7054
|
+
logger$4.error(message, { id: session.id });
|
|
7050
7055
|
this.onCallEnded(session);
|
|
7051
7056
|
|
|
7052
7057
|
throw new CanceledCallError(message);
|
|
7053
7058
|
}
|
|
7054
|
-
logger$
|
|
7059
|
+
logger$4.info('sdk webrtc answer, accepted.');
|
|
7055
7060
|
this._onAccepted(session);
|
|
7056
7061
|
}).catch(e => {
|
|
7057
|
-
logger$
|
|
7062
|
+
logger$4.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
7058
7063
|
|
|
7059
7064
|
throw e;
|
|
7060
7065
|
});
|
|
@@ -7062,7 +7067,7 @@ class WebRTCClient extends Emitter {
|
|
|
7062
7067
|
|
|
7063
7068
|
hangup(session ) {
|
|
7064
7069
|
const { state, id } = session;
|
|
7065
|
-
logger$
|
|
7070
|
+
logger$4.info('sdk webrtc hangup call', { id, state });
|
|
7066
7071
|
|
|
7067
7072
|
try {
|
|
7068
7073
|
this._stopSendingStats(session);
|
|
@@ -7091,7 +7096,7 @@ class WebRTCClient extends Emitter {
|
|
|
7091
7096
|
|
|
7092
7097
|
return bye();
|
|
7093
7098
|
} catch (error) {
|
|
7094
|
-
logger$
|
|
7099
|
+
logger$4.warn('sdk webrtc hangup, error', error);
|
|
7095
7100
|
}
|
|
7096
7101
|
|
|
7097
7102
|
return null;
|
|
@@ -7109,7 +7114,7 @@ class WebRTCClient extends Emitter {
|
|
|
7109
7114
|
// Fetch and emit an event at `interval` with session network stats
|
|
7110
7115
|
startNetworkMonitoring(session , interval = 1000) {
|
|
7111
7116
|
const sessionId = this.getSipSessionId(session);
|
|
7112
|
-
logger$
|
|
7117
|
+
logger$4.info('starting network inspection', { id: sessionId });
|
|
7113
7118
|
|
|
7114
7119
|
this.sessionNetworkStats[sessionId] = [];
|
|
7115
7120
|
|
|
@@ -7119,7 +7124,7 @@ class WebRTCClient extends Emitter {
|
|
|
7119
7124
|
stopNetworkMonitoring(session ) {
|
|
7120
7125
|
const sessionId = this.getSipSessionId(session);
|
|
7121
7126
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
7122
|
-
logger$
|
|
7127
|
+
logger$4.info('stopping network inspection', { id: sessionId, exists });
|
|
7123
7128
|
|
|
7124
7129
|
if (exists) {
|
|
7125
7130
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -7129,17 +7134,17 @@ class WebRTCClient extends Emitter {
|
|
|
7129
7134
|
}
|
|
7130
7135
|
|
|
7131
7136
|
reject(session ) {
|
|
7132
|
-
logger$
|
|
7137
|
+
logger$4.info('sdk webrtc reject call', { id: session.id });
|
|
7133
7138
|
|
|
7134
7139
|
try {
|
|
7135
7140
|
return session.reject ? session.reject() : session.cancel();
|
|
7136
7141
|
} catch (e) {
|
|
7137
|
-
logger$
|
|
7142
|
+
logger$4.warn('Error when rejecting call', e.message, e.stack);
|
|
7138
7143
|
}
|
|
7139
7144
|
}
|
|
7140
7145
|
|
|
7141
7146
|
async close() {
|
|
7142
|
-
logger$
|
|
7147
|
+
logger$4.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
7143
7148
|
this._cleanupMedia();
|
|
7144
7149
|
this.connectionPromise = null;
|
|
7145
7150
|
|
|
@@ -7170,7 +7175,7 @@ class WebRTCClient extends Emitter {
|
|
|
7170
7175
|
// eg: "INVITE not rejectable in state Completed"
|
|
7171
7176
|
}
|
|
7172
7177
|
this.userAgent = null;
|
|
7173
|
-
logger$
|
|
7178
|
+
logger$4.info('sdk webrtc client closed');
|
|
7174
7179
|
}
|
|
7175
7180
|
|
|
7176
7181
|
getNumber(session ) {
|
|
@@ -7183,13 +7188,13 @@ class WebRTCClient extends Emitter {
|
|
|
7183
7188
|
}
|
|
7184
7189
|
|
|
7185
7190
|
mute(session ) {
|
|
7186
|
-
logger$
|
|
7191
|
+
logger$4.info('sdk webrtc mute', { id: session.id });
|
|
7187
7192
|
|
|
7188
7193
|
this._toggleAudio(session, true);
|
|
7189
7194
|
}
|
|
7190
7195
|
|
|
7191
7196
|
unmute(session ) {
|
|
7192
|
-
logger$
|
|
7197
|
+
logger$4.info('sdk webrtc unmute', { id: session.id });
|
|
7193
7198
|
|
|
7194
7199
|
this._toggleAudio(session, false);
|
|
7195
7200
|
}
|
|
@@ -7229,13 +7234,13 @@ class WebRTCClient extends Emitter {
|
|
|
7229
7234
|
}
|
|
7230
7235
|
|
|
7231
7236
|
toggleCameraOn(session ) {
|
|
7232
|
-
logger$
|
|
7237
|
+
logger$4.info('sdk webrtc toggle camera on', { id: session.id });
|
|
7233
7238
|
|
|
7234
7239
|
this._toggleVideo(session, false);
|
|
7235
7240
|
}
|
|
7236
7241
|
|
|
7237
7242
|
toggleCameraOff(session ) {
|
|
7238
|
-
logger$
|
|
7243
|
+
logger$4.info('sdk webrtc toggle camera off', { id: session.id });
|
|
7239
7244
|
|
|
7240
7245
|
this._toggleVideo(session, true);
|
|
7241
7246
|
}
|
|
@@ -7244,7 +7249,7 @@ class WebRTCClient extends Emitter {
|
|
|
7244
7249
|
const sessionId = this.getSipSessionId(session);
|
|
7245
7250
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
7246
7251
|
|
|
7247
|
-
logger$
|
|
7252
|
+
logger$4.info('sdk webrtc hold', {
|
|
7248
7253
|
sessionId,
|
|
7249
7254
|
keys: Object.keys(this.heldSessions),
|
|
7250
7255
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7293,7 +7298,7 @@ class WebRTCClient extends Emitter {
|
|
|
7293
7298
|
const sessionId = this.getSipSessionId(session);
|
|
7294
7299
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7295
7300
|
|
|
7296
|
-
logger$
|
|
7301
|
+
logger$4.info('sdk webrtc unhold', {
|
|
7297
7302
|
sessionId,
|
|
7298
7303
|
keys: Object.keys(this.heldSessions),
|
|
7299
7304
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7441,7 +7446,7 @@ class WebRTCClient extends Emitter {
|
|
|
7441
7446
|
if (!session.sessionDescriptionHandler) {
|
|
7442
7447
|
return;
|
|
7443
7448
|
}
|
|
7444
|
-
logger$
|
|
7449
|
+
logger$4.info('Sending DTMF', {
|
|
7445
7450
|
id: this.getSipSessionId(session),
|
|
7446
7451
|
tone,
|
|
7447
7452
|
});
|
|
@@ -7457,7 +7462,7 @@ class WebRTCClient extends Emitter {
|
|
|
7457
7462
|
transfer(session , target ) {
|
|
7458
7463
|
this.hold(session);
|
|
7459
7464
|
|
|
7460
|
-
logger$
|
|
7465
|
+
logger$4.info('Transfering a session', {
|
|
7461
7466
|
id: this.getSipSessionId(session),
|
|
7462
7467
|
target,
|
|
7463
7468
|
});
|
|
@@ -7479,17 +7484,17 @@ class WebRTCClient extends Emitter {
|
|
|
7479
7484
|
atxfer(session ) {
|
|
7480
7485
|
this.hold(session);
|
|
7481
7486
|
|
|
7482
|
-
logger$
|
|
7487
|
+
logger$4.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7483
7488
|
|
|
7484
7489
|
const result = {
|
|
7485
7490
|
newSession: null,
|
|
7486
7491
|
init: async (target ) => {
|
|
7487
|
-
logger$
|
|
7492
|
+
logger$4.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7488
7493
|
|
|
7489
7494
|
result.newSession = await this.call(target);
|
|
7490
7495
|
},
|
|
7491
7496
|
complete: () => {
|
|
7492
|
-
logger$
|
|
7497
|
+
logger$4.info('webrtc transfer completed', {
|
|
7493
7498
|
id: this.getSipSessionId(session),
|
|
7494
7499
|
referId: this.getSipSessionId(result.newSession),
|
|
7495
7500
|
});
|
|
@@ -7510,7 +7515,7 @@ class WebRTCClient extends Emitter {
|
|
|
7510
7515
|
return;
|
|
7511
7516
|
}
|
|
7512
7517
|
|
|
7513
|
-
logger$
|
|
7518
|
+
logger$4.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7514
7519
|
|
|
7515
7520
|
try {
|
|
7516
7521
|
sipSession.message({
|
|
@@ -7552,7 +7557,7 @@ class WebRTCClient extends Emitter {
|
|
|
7552
7557
|
}
|
|
7553
7558
|
|
|
7554
7559
|
changeAudioOutputVolume(volume ) {
|
|
7555
|
-
logger$
|
|
7560
|
+
logger$4.info('Changing audio output volume', { volume });
|
|
7556
7561
|
|
|
7557
7562
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7558
7563
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7564,7 +7569,7 @@ class WebRTCClient extends Emitter {
|
|
|
7564
7569
|
}
|
|
7565
7570
|
|
|
7566
7571
|
changeAudioOutputDevice(id ) {
|
|
7567
|
-
logger$
|
|
7572
|
+
logger$4.info('Changing audio output device', { id });
|
|
7568
7573
|
|
|
7569
7574
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7570
7575
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7581,7 +7586,7 @@ class WebRTCClient extends Emitter {
|
|
|
7581
7586
|
|
|
7582
7587
|
changeAudioInputDevice(id , session ) {
|
|
7583
7588
|
const currentId = this.getAudioDeviceId();
|
|
7584
|
-
logger$
|
|
7589
|
+
logger$4.info('setting audio input device', { id, currentId, session: !!session });
|
|
7585
7590
|
|
|
7586
7591
|
if (id === currentId) {
|
|
7587
7592
|
return null;
|
|
@@ -7627,7 +7632,7 @@ class WebRTCClient extends Emitter {
|
|
|
7627
7632
|
|
|
7628
7633
|
setVideoInputDevice(id ) {
|
|
7629
7634
|
const currentId = this.getVideoDeviceId();
|
|
7630
|
-
logger$
|
|
7635
|
+
logger$4.info('setting video input device', { id, currentId });
|
|
7631
7636
|
|
|
7632
7637
|
if (id === currentId) {
|
|
7633
7638
|
return null;
|
|
@@ -7652,7 +7657,7 @@ class WebRTCClient extends Emitter {
|
|
|
7652
7657
|
const sessionId = this.getSipSessionId(session);
|
|
7653
7658
|
const localStream = this.getLocalStream(sessionId);
|
|
7654
7659
|
|
|
7655
|
-
logger$
|
|
7660
|
+
logger$4.info('changing video input device', { id, sessionId });
|
|
7656
7661
|
|
|
7657
7662
|
// Release old video stream
|
|
7658
7663
|
if (localStream) {
|
|
@@ -7720,7 +7725,7 @@ class WebRTCClient extends Emitter {
|
|
|
7720
7725
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7721
7726
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7722
7727
|
|
|
7723
|
-
logger$
|
|
7728
|
+
logger$4.info('Sending reinvite', {
|
|
7724
7729
|
id: this.getSipSessionId(sipSession),
|
|
7725
7730
|
newConstraints,
|
|
7726
7731
|
conference,
|
|
@@ -7758,7 +7763,7 @@ class WebRTCClient extends Emitter {
|
|
|
7758
7763
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7759
7764
|
}
|
|
7760
7765
|
|
|
7761
|
-
logger$
|
|
7766
|
+
logger$4.info('on re-INVITE accepted', {
|
|
7762
7767
|
id: this.getSipSessionId(sipSession),
|
|
7763
7768
|
wasMuted,
|
|
7764
7769
|
shouldDoScreenSharing,
|
|
@@ -7776,7 +7781,7 @@ class WebRTCClient extends Emitter {
|
|
|
7776
7781
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7777
7782
|
}
|
|
7778
7783
|
|
|
7779
|
-
return this.eventEmitter.emit(ON_REINVITE
|
|
7784
|
+
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7780
7785
|
},
|
|
7781
7786
|
},
|
|
7782
7787
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7933,7 +7938,7 @@ class WebRTCClient extends Emitter {
|
|
|
7933
7938
|
}
|
|
7934
7939
|
|
|
7935
7940
|
startHeartbeat() {
|
|
7936
|
-
logger$
|
|
7941
|
+
logger$4.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7937
7942
|
if (!this.userAgent) {
|
|
7938
7943
|
this.heartbeat.stop();
|
|
7939
7944
|
return;
|
|
@@ -7946,7 +7951,7 @@ class WebRTCClient extends Emitter {
|
|
|
7946
7951
|
}
|
|
7947
7952
|
|
|
7948
7953
|
stopHeartbeat() {
|
|
7949
|
-
logger$
|
|
7954
|
+
logger$4.info('sdk webrtc stop heartbeat');
|
|
7950
7955
|
this.heartbeat.stop();
|
|
7951
7956
|
}
|
|
7952
7957
|
|
|
@@ -7967,7 +7972,7 @@ class WebRTCClient extends Emitter {
|
|
|
7967
7972
|
}
|
|
7968
7973
|
|
|
7969
7974
|
attemptReconnection() {
|
|
7970
|
-
logger$
|
|
7975
|
+
logger$4.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7971
7976
|
if (!this.userAgent) {
|
|
7972
7977
|
return;
|
|
7973
7978
|
}
|
|
@@ -7992,7 +7997,7 @@ class WebRTCClient extends Emitter {
|
|
|
7992
7997
|
return;
|
|
7993
7998
|
}
|
|
7994
7999
|
|
|
7995
|
-
logger$
|
|
8000
|
+
logger$4.info('setting local media stream', {
|
|
7996
8001
|
sipSessionId,
|
|
7997
8002
|
tracks: newStream ? newStream.getTracks() : null,
|
|
7998
8003
|
});
|
|
@@ -8009,7 +8014,7 @@ class WebRTCClient extends Emitter {
|
|
|
8009
8014
|
|
|
8010
8015
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
8011
8016
|
|
|
8012
|
-
logger$
|
|
8017
|
+
logger$4.info('updating local stream', {
|
|
8013
8018
|
sipSessionId,
|
|
8014
8019
|
oldStream: !!oldStream,
|
|
8015
8020
|
tracks: newStream.getTracks(),
|
|
@@ -8029,7 +8034,7 @@ class WebRTCClient extends Emitter {
|
|
|
8029
8034
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
8030
8035
|
const pc = this.getPeerConnection(sessionId);
|
|
8031
8036
|
|
|
8032
|
-
logger$
|
|
8037
|
+
logger$4.info('Updating remote stream', {
|
|
8033
8038
|
sessionId,
|
|
8034
8039
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
8035
8040
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -8055,7 +8060,7 @@ class WebRTCClient extends Emitter {
|
|
|
8055
8060
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
8056
8061
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
8057
8062
|
|
|
8058
|
-
logger$
|
|
8063
|
+
logger$4.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
8059
8064
|
|
|
8060
8065
|
return {
|
|
8061
8066
|
constraints: {
|
|
@@ -8104,7 +8109,7 @@ class WebRTCClient extends Emitter {
|
|
|
8104
8109
|
}
|
|
8105
8110
|
|
|
8106
8111
|
_onTransportError() {
|
|
8107
|
-
logger$
|
|
8112
|
+
logger$4.error('on transport error');
|
|
8108
8113
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
8109
8114
|
this.attemptReconnection();
|
|
8110
8115
|
}
|
|
@@ -8113,7 +8118,7 @@ class WebRTCClient extends Emitter {
|
|
|
8113
8118
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
8114
8119
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
8115
8120
|
if (this.hasHeartbeat()) {
|
|
8116
|
-
logger$
|
|
8121
|
+
logger$4.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
8117
8122
|
|
|
8118
8123
|
this.heartbeat.onHeartbeat();
|
|
8119
8124
|
if (this.heartbeatCb) {
|
|
@@ -8124,7 +8129,7 @@ class WebRTCClient extends Emitter {
|
|
|
8124
8129
|
}
|
|
8125
8130
|
|
|
8126
8131
|
async _onHeartbeatTimeout() {
|
|
8127
|
-
logger$
|
|
8132
|
+
logger$4.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
8128
8133
|
|
|
8129
8134
|
if (this.heartbeatTimeoutCb) {
|
|
8130
8135
|
this.heartbeatTimeoutCb();
|
|
@@ -8136,7 +8141,7 @@ class WebRTCClient extends Emitter {
|
|
|
8136
8141
|
try {
|
|
8137
8142
|
await this.userAgent.transport.disconnect();
|
|
8138
8143
|
} catch (e) {
|
|
8139
|
-
logger$
|
|
8144
|
+
logger$4.error('Transport disconnection after heartbeat timeout, error', e);
|
|
8140
8145
|
}
|
|
8141
8146
|
}
|
|
8142
8147
|
|
|
@@ -8169,31 +8174,31 @@ class WebRTCClient extends Emitter {
|
|
|
8169
8174
|
}
|
|
8170
8175
|
|
|
8171
8176
|
_connectIfNeeded() {
|
|
8172
|
-
logger$
|
|
8177
|
+
logger$4.info('connect if needed, checking', { connected: this.isConnected() });
|
|
8173
8178
|
if (!this.userAgent) {
|
|
8174
|
-
logger$
|
|
8179
|
+
logger$4.info('need to recreate User Agent');
|
|
8175
8180
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
8176
8181
|
}
|
|
8177
8182
|
|
|
8178
8183
|
if (this.isConnected()) {
|
|
8179
|
-
logger$
|
|
8184
|
+
logger$4.info('webrtc sdk, already connected');
|
|
8180
8185
|
return Promise.resolve();
|
|
8181
8186
|
}
|
|
8182
8187
|
|
|
8183
8188
|
if (this.isConnecting()) {
|
|
8184
|
-
logger$
|
|
8189
|
+
logger$4.info('webrtc sdk, already connecting...');
|
|
8185
8190
|
|
|
8186
8191
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
8187
8192
|
return this.connectionPromise;
|
|
8188
8193
|
}
|
|
8189
8194
|
|
|
8190
8195
|
if (this.connectionPromise) {
|
|
8191
|
-
logger$
|
|
8196
|
+
logger$4.info('webrtc sdk, connection promise connecting...');
|
|
8192
8197
|
// $FlowFixMe
|
|
8193
8198
|
return this.connectionPromise;
|
|
8194
8199
|
}
|
|
8195
8200
|
|
|
8196
|
-
logger$
|
|
8201
|
+
logger$4.info('WebRTC UA needs to connect');
|
|
8197
8202
|
|
|
8198
8203
|
// Force UA to reconnect
|
|
8199
8204
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -8318,7 +8323,7 @@ class WebRTCClient extends Emitter {
|
|
|
8318
8323
|
|
|
8319
8324
|
sdh.peerConnectionDelegate = {
|
|
8320
8325
|
onicecandidateerror: (error ) => {
|
|
8321
|
-
logger$
|
|
8326
|
+
logger$4.error('on icecandidate error', {
|
|
8322
8327
|
address: error.address,
|
|
8323
8328
|
port: error.port,
|
|
8324
8329
|
errorCode: error.errorCode,
|
|
@@ -8347,7 +8352,7 @@ class WebRTCClient extends Emitter {
|
|
|
8347
8352
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8348
8353
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8349
8354
|
}
|
|
8350
|
-
logger$
|
|
8355
|
+
logger$4.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8351
8356
|
|
|
8352
8357
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8353
8358
|
|
|
@@ -8363,12 +8368,12 @@ class WebRTCClient extends Emitter {
|
|
|
8363
8368
|
|
|
8364
8369
|
this._setupMedias(session);
|
|
8365
8370
|
|
|
8366
|
-
return this.eventEmitter.emit(ON_REINVITE
|
|
8371
|
+
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8367
8372
|
};
|
|
8368
8373
|
}
|
|
8369
8374
|
|
|
8370
8375
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8371
|
-
logger$
|
|
8376
|
+
logger$4.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8372
8377
|
|
|
8373
8378
|
this.storeSipSession(session);
|
|
8374
8379
|
|
|
@@ -8380,14 +8385,14 @@ class WebRTCClient extends Emitter {
|
|
|
8380
8385
|
const onTrack = (event ) => {
|
|
8381
8386
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8382
8387
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8383
|
-
logger$
|
|
8388
|
+
logger$4.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8384
8389
|
|
|
8385
8390
|
// Stop video track in audio only mode
|
|
8386
8391
|
if (isAudioOnly && kind === 'video') {
|
|
8387
8392
|
event.track.stop();
|
|
8388
8393
|
}
|
|
8389
8394
|
|
|
8390
|
-
this.eventEmitter.emit(ON_TRACK
|
|
8395
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8391
8396
|
};
|
|
8392
8397
|
|
|
8393
8398
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8397,9 +8402,9 @@ class WebRTCClient extends Emitter {
|
|
|
8397
8402
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8398
8403
|
|
|
8399
8404
|
pc.oniceconnectionstatechange = () => {
|
|
8400
|
-
logger$
|
|
8405
|
+
logger$4.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8401
8406
|
if (pc.iceConnectionState === 'disconnected') {
|
|
8402
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
8407
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
8403
8408
|
}
|
|
8404
8409
|
};
|
|
8405
8410
|
|
|
@@ -8570,10 +8575,10 @@ class WebRTCClient extends Emitter {
|
|
|
8570
8575
|
|
|
8571
8576
|
_stopSendingStats(session ) {
|
|
8572
8577
|
const sessionId = this.getSipSessionId(session);
|
|
8573
|
-
logger$
|
|
8578
|
+
logger$4.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8574
8579
|
|
|
8575
8580
|
if (sessionId in this.statsIntervals) {
|
|
8576
|
-
logger$
|
|
8581
|
+
logger$4.trace('Stop sending stats for call', { sessionId });
|
|
8577
8582
|
this.statsIntervals[sessionId]();
|
|
8578
8583
|
delete this.statsIntervals[sessionId];
|
|
8579
8584
|
}
|
|
@@ -8589,7 +8594,7 @@ class WebRTCClient extends Emitter {
|
|
|
8589
8594
|
try {
|
|
8590
8595
|
await this.userAgent.transport.disconnect();
|
|
8591
8596
|
} catch (e) {
|
|
8592
|
-
logger$
|
|
8597
|
+
logger$4.error('WebRTC transport disconnect, error', e);
|
|
8593
8598
|
}
|
|
8594
8599
|
}
|
|
8595
8600
|
}
|
|
@@ -8683,7 +8688,7 @@ class WebRTCClient extends Emitter {
|
|
|
8683
8688
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8684
8689
|
+ networkStats.transportSent;
|
|
8685
8690
|
|
|
8686
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
8691
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8687
8692
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8688
8693
|
}
|
|
8689
8694
|
|
|
@@ -8711,8 +8716,8 @@ const ON_CALL_FAILED = 'onCallFailed';
|
|
|
8711
8716
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8712
8717
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8713
8718
|
const ON_MESSAGE = 'onMessage';
|
|
8714
|
-
const ON_REINVITE = 'reinvite';
|
|
8715
|
-
const ON_TRACK = 'onTrack';
|
|
8719
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
8720
|
+
const ON_TRACK$1 = 'onTrack';
|
|
8716
8721
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8717
8722
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8718
8723
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8727,15 +8732,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8727
8732
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8728
8733
|
const ON_CALL_ERROR = 'onCallError';
|
|
8729
8734
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8730
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8735
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
8731
8736
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8732
8737
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8733
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
8738
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
8734
8739
|
|
|
8735
8740
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8736
8741
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8737
8742
|
|
|
8738
|
-
const events = [
|
|
8743
|
+
const events$1 = [
|
|
8739
8744
|
ON_USER_AGENT,
|
|
8740
8745
|
ON_REGISTERED,
|
|
8741
8746
|
ON_UNREGISTERED,
|
|
@@ -8753,8 +8758,8 @@ const events = [
|
|
|
8753
8758
|
ON_CALL_FAILED,
|
|
8754
8759
|
ON_CALL_ENDED,
|
|
8755
8760
|
ON_MESSAGE,
|
|
8756
|
-
ON_REINVITE,
|
|
8757
|
-
ON_TRACK,
|
|
8761
|
+
ON_REINVITE$1,
|
|
8762
|
+
ON_TRACK$1,
|
|
8758
8763
|
ON_AUDIO_STREAM,
|
|
8759
8764
|
ON_VIDEO_STREAM,
|
|
8760
8765
|
ON_REMOVE_STREAM,
|
|
@@ -8769,11 +8774,11 @@ const events = [
|
|
|
8769
8774
|
ON_CALL_ERROR,
|
|
8770
8775
|
ON_CHAT,
|
|
8771
8776
|
ON_SIGNAL,
|
|
8772
|
-
ON_NETWORK_STATS,
|
|
8773
|
-
ON_DISCONNECTED,
|
|
8777
|
+
ON_NETWORK_STATS$1,
|
|
8778
|
+
ON_DISCONNECTED$1,
|
|
8774
8779
|
];
|
|
8775
8780
|
|
|
8776
|
-
const logger$
|
|
8781
|
+
const logger$5 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8777
8782
|
|
|
8778
8783
|
class WebRTCPhone extends Emitter {
|
|
8779
8784
|
|
|
@@ -8846,7 +8851,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8846
8851
|
}).catch(error => {
|
|
8847
8852
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8848
8853
|
console.error('register error', error, error.message, error.stack);
|
|
8849
|
-
logger$
|
|
8854
|
+
logger$5.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8850
8855
|
});
|
|
8851
8856
|
}
|
|
8852
8857
|
|
|
@@ -8861,7 +8866,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8861
8866
|
if (!this.client) {
|
|
8862
8867
|
return;
|
|
8863
8868
|
}
|
|
8864
|
-
logger$
|
|
8869
|
+
logger$5.info('WebRTC phone stop');
|
|
8865
8870
|
this.client.stop();
|
|
8866
8871
|
}
|
|
8867
8872
|
|
|
@@ -8876,7 +8881,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8876
8881
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8877
8882
|
audioOnly = false, iceRestart = false) {
|
|
8878
8883
|
const sipSession = this.findSipSession(callSession);
|
|
8879
|
-
logger$
|
|
8884
|
+
logger$5.info('WebRTC phone - send reinvite', {
|
|
8880
8885
|
sessionId: sipSession ? sipSession.id : null,
|
|
8881
8886
|
constraints,
|
|
8882
8887
|
audioOnly,
|
|
@@ -8913,7 +8918,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8913
8918
|
}
|
|
8914
8919
|
|
|
8915
8920
|
startHeartbeat() {
|
|
8916
|
-
logger$
|
|
8921
|
+
logger$5.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8917
8922
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8918
8923
|
return;
|
|
8919
8924
|
}
|
|
@@ -8922,7 +8927,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8922
8927
|
}
|
|
8923
8928
|
|
|
8924
8929
|
stopHeartbeat() {
|
|
8925
|
-
logger$
|
|
8930
|
+
logger$5.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8926
8931
|
if (!this.client) {
|
|
8927
8932
|
return;
|
|
8928
8933
|
}
|
|
@@ -8939,7 +8944,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8939
8944
|
}
|
|
8940
8945
|
|
|
8941
8946
|
reconnect() {
|
|
8942
|
-
logger$
|
|
8947
|
+
logger$5.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8943
8948
|
if (!this.client) {
|
|
8944
8949
|
return;
|
|
8945
8950
|
}
|
|
@@ -8980,10 +8985,15 @@ class WebRTCPhone extends Emitter {
|
|
|
8980
8985
|
return false;
|
|
8981
8986
|
}
|
|
8982
8987
|
|
|
8983
|
-
logger$
|
|
8988
|
+
logger$5.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8984
8989
|
|
|
8985
8990
|
this.client.downgradeToAudio(sipSession);
|
|
8986
8991
|
|
|
8992
|
+
if (callSession) {
|
|
8993
|
+
callSession.cameraEnabled = false;
|
|
8994
|
+
this._updateCallSession(callSession);
|
|
8995
|
+
}
|
|
8996
|
+
|
|
8987
8997
|
if (withMessage) {
|
|
8988
8998
|
this._sendReinviteMessage(callSession, false);
|
|
8989
8999
|
}
|
|
@@ -8998,7 +9008,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8998
9008
|
return Promise.resolve(false);
|
|
8999
9009
|
}
|
|
9000
9010
|
|
|
9001
|
-
logger$
|
|
9011
|
+
logger$5.info('Upgrade to video', {
|
|
9002
9012
|
id: callSession ? callSession.getId() : null,
|
|
9003
9013
|
constraints,
|
|
9004
9014
|
isConference,
|
|
@@ -9011,6 +9021,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9011
9021
|
|
|
9012
9022
|
const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
|
|
9013
9023
|
|
|
9024
|
+
if (callSession) {
|
|
9025
|
+
callSession.cameraEnabled = true;
|
|
9026
|
+
this._updateCallSession(callSession);
|
|
9027
|
+
}
|
|
9028
|
+
|
|
9014
9029
|
// If no stream is returned, it means we have to reinvite
|
|
9015
9030
|
if (!newStream) {
|
|
9016
9031
|
return true;
|
|
@@ -9033,7 +9048,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9033
9048
|
|
|
9034
9049
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
9035
9050
|
const sipSession = this.findSipSession(callSession);
|
|
9036
|
-
logger$
|
|
9051
|
+
logger$5.info('Sending reinvite message', {
|
|
9037
9052
|
id: callSession ? callSession.getId() : null,
|
|
9038
9053
|
isUpgrade,
|
|
9039
9054
|
});
|
|
@@ -9059,7 +9074,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9059
9074
|
// Monkey patch to know when canceled with the CANCEL message
|
|
9060
9075
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
9061
9076
|
sipSession._onCancel = (message ) => {
|
|
9062
|
-
logger$
|
|
9077
|
+
logger$5.trace('on sip session canceled', { callId: message.callId });
|
|
9063
9078
|
|
|
9064
9079
|
onCancel(message);
|
|
9065
9080
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -9087,13 +9102,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9087
9102
|
this.audioOutputVolume,
|
|
9088
9103
|
);
|
|
9089
9104
|
case sessionState.SessionState.Terminating:
|
|
9090
|
-
logger$
|
|
9105
|
+
logger$5.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
9091
9106
|
|
|
9092
9107
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
9093
9108
|
|
|
9094
9109
|
break;
|
|
9095
9110
|
case sessionState.SessionState.Terminated: {
|
|
9096
|
-
logger$
|
|
9111
|
+
logger$5.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9097
9112
|
|
|
9098
9113
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9099
9114
|
const callSession = this._createCallSession(sipSession);
|
|
@@ -9115,7 +9130,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9115
9130
|
const [stream] = event.streams;
|
|
9116
9131
|
const kind = event && event.track && event.track.kind;
|
|
9117
9132
|
|
|
9118
|
-
logger$
|
|
9133
|
+
logger$5.info('on track stream called on the peer connection', {
|
|
9119
9134
|
callId: this.getSipSessionId(sipSession),
|
|
9120
9135
|
streamId: stream ? stream.id : null,
|
|
9121
9136
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -9135,7 +9150,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9135
9150
|
};
|
|
9136
9151
|
|
|
9137
9152
|
peerConnection.onremovestream = event => {
|
|
9138
|
-
logger$
|
|
9153
|
+
logger$5.info('on remove stream called on the peer connection', {
|
|
9139
9154
|
id: event.stream.id,
|
|
9140
9155
|
tracks: event.stream.getTracks(),
|
|
9141
9156
|
});
|
|
@@ -9145,7 +9160,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9145
9160
|
}
|
|
9146
9161
|
|
|
9147
9162
|
async startScreenSharing(constraints , callSession ) {
|
|
9148
|
-
logger$
|
|
9163
|
+
logger$5.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
9149
9164
|
|
|
9150
9165
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
9151
9166
|
if (!screenShareStream) {
|
|
@@ -9185,7 +9200,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9185
9200
|
return;
|
|
9186
9201
|
}
|
|
9187
9202
|
|
|
9188
|
-
logger$
|
|
9203
|
+
logger$5.info('WebRTC phone - stop screen sharing', {
|
|
9189
9204
|
restoreLocalStream,
|
|
9190
9205
|
});
|
|
9191
9206
|
|
|
@@ -9241,7 +9256,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9241
9256
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
9242
9257
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9243
9258
|
|
|
9244
|
-
logger$
|
|
9259
|
+
logger$5.info('WebRTC phone - on screensharing', {
|
|
9245
9260
|
hadVideo,
|
|
9246
9261
|
id: this.getSipSessionId(sipSession),
|
|
9247
9262
|
screenTrack,
|
|
@@ -9249,7 +9264,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9249
9264
|
|
|
9250
9265
|
if (screenTrack) {
|
|
9251
9266
|
screenTrack.onended = () => {
|
|
9252
|
-
logger$
|
|
9267
|
+
logger$5.info('WebRTC phone - on screenshare ended', {
|
|
9253
9268
|
hadVideo,
|
|
9254
9269
|
id: this.getSipSessionId(sipSession),
|
|
9255
9270
|
screenTrack,
|
|
@@ -9280,7 +9295,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9280
9295
|
}
|
|
9281
9296
|
|
|
9282
9297
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9283
|
-
logger$
|
|
9298
|
+
logger$5.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9284
9299
|
|
|
9285
9300
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9286
9301
|
this.currentSipSession = sipSession;
|
|
@@ -9298,7 +9313,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9298
9313
|
}
|
|
9299
9314
|
|
|
9300
9315
|
changeAudioDevice(id ) {
|
|
9301
|
-
logger$
|
|
9316
|
+
logger$5.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9302
9317
|
this.audioOutputDeviceId = id;
|
|
9303
9318
|
this.client.changeAudioOutputDevice(id);
|
|
9304
9319
|
}
|
|
@@ -9308,14 +9323,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9308
9323
|
}
|
|
9309
9324
|
|
|
9310
9325
|
changeRingDevice(id ) {
|
|
9311
|
-
logger$
|
|
9326
|
+
logger$5.info('WebRTC phone - changing ring device', { id });
|
|
9312
9327
|
|
|
9313
9328
|
this.audioRingDeviceId = id;
|
|
9314
9329
|
}
|
|
9315
9330
|
|
|
9316
9331
|
// volume is a value between 0 and 1
|
|
9317
9332
|
changeAudioVolume(volume ) {
|
|
9318
|
-
logger$
|
|
9333
|
+
logger$5.info('WebRTC phone - changing audio volume', { volume });
|
|
9319
9334
|
|
|
9320
9335
|
this.audioOutputVolume = volume;
|
|
9321
9336
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9323,31 +9338,31 @@ class WebRTCPhone extends Emitter {
|
|
|
9323
9338
|
|
|
9324
9339
|
// volume is a value between 0 and 1
|
|
9325
9340
|
changeRingVolume(volume ) {
|
|
9326
|
-
logger$
|
|
9341
|
+
logger$5.info('WebRTC phone - changing ring volume', { volume });
|
|
9327
9342
|
|
|
9328
9343
|
this.audioRingVolume = volume;
|
|
9329
9344
|
}
|
|
9330
9345
|
|
|
9331
9346
|
changeAudioInputDevice(id ) {
|
|
9332
|
-
logger$
|
|
9347
|
+
logger$5.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9333
9348
|
|
|
9334
9349
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9335
9350
|
}
|
|
9336
9351
|
|
|
9337
9352
|
changeVideoInputDevice(id ) {
|
|
9338
|
-
logger$
|
|
9353
|
+
logger$5.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9339
9354
|
|
|
9340
9355
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9341
9356
|
}
|
|
9342
9357
|
|
|
9343
9358
|
changeSessionVideoInputDevice(id ) {
|
|
9344
|
-
logger$
|
|
9359
|
+
logger$5.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9345
9360
|
|
|
9346
9361
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9347
9362
|
}
|
|
9348
9363
|
|
|
9349
9364
|
_onCallTerminated(sipSession ) {
|
|
9350
|
-
logger$
|
|
9365
|
+
logger$5.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9351
9366
|
|
|
9352
9367
|
const callSession = this._createCallSession(sipSession);
|
|
9353
9368
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
@@ -9381,7 +9396,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9381
9396
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9382
9397
|
|
|
9383
9398
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9384
|
-
logger$
|
|
9399
|
+
logger$5.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9385
9400
|
sipId: sipSession.id,
|
|
9386
9401
|
shouldRetrigger,
|
|
9387
9402
|
hasIncomingCallSession,
|
|
@@ -9472,37 +9487,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9472
9487
|
|
|
9473
9488
|
// Deprecated
|
|
9474
9489
|
getLocalStreamForCall(callSession ) {
|
|
9475
|
-
logger$
|
|
9490
|
+
logger$5.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9476
9491
|
|
|
9477
9492
|
return this.getLocalStream(callSession);
|
|
9478
9493
|
}
|
|
9479
9494
|
|
|
9480
9495
|
// Deprecated
|
|
9481
9496
|
getRemoteStreamForCall(callSession ) {
|
|
9482
|
-
logger$
|
|
9497
|
+
logger$5.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9483
9498
|
|
|
9484
9499
|
return this.getRemoteVideoStream(callSession);
|
|
9485
9500
|
}
|
|
9486
9501
|
|
|
9487
9502
|
getRemoteStreamsForCall(callSession ) {
|
|
9488
|
-
logger$
|
|
9503
|
+
logger$5.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9489
9504
|
|
|
9490
9505
|
return this.getRemoteStream(callSession);
|
|
9491
9506
|
}
|
|
9492
9507
|
|
|
9493
9508
|
accept(callSession , cameraEnabled ) {
|
|
9494
|
-
logger$
|
|
9509
|
+
logger$5.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9495
9510
|
if (this.currentSipSession) {
|
|
9496
9511
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9497
9512
|
}
|
|
9498
9513
|
|
|
9499
9514
|
if (!callSession) {
|
|
9500
|
-
logger$
|
|
9515
|
+
logger$5.warn('no CallSession to accept.');
|
|
9501
9516
|
return Promise.resolve(null);
|
|
9502
9517
|
}
|
|
9503
9518
|
|
|
9504
9519
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9505
|
-
logger$
|
|
9520
|
+
logger$5.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9506
9521
|
return Promise.resolve(callSession.sipCallId);
|
|
9507
9522
|
}
|
|
9508
9523
|
|
|
@@ -9514,24 +9529,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9514
9529
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9515
9530
|
if (sipSession) {
|
|
9516
9531
|
if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
|
|
9517
|
-
logger$
|
|
9532
|
+
logger$5.warn('Trying to answer a terminated sipSession.');
|
|
9518
9533
|
|
|
9519
9534
|
return Promise.resolve(null);
|
|
9520
9535
|
}
|
|
9521
9536
|
|
|
9522
|
-
logger$
|
|
9537
|
+
logger$5.info('accept call, session found', { sipId: sipSession.id });
|
|
9523
9538
|
|
|
9524
9539
|
// $FlowFixMe
|
|
9525
9540
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9526
9541
|
return callSession.sipCallId;
|
|
9527
9542
|
}).catch(e => {
|
|
9528
|
-
logger$
|
|
9543
|
+
logger$5.error(e);
|
|
9529
9544
|
this.endCurrentCall(callSession);
|
|
9530
9545
|
throw e;
|
|
9531
9546
|
});
|
|
9532
9547
|
}
|
|
9533
9548
|
|
|
9534
|
-
logger$
|
|
9549
|
+
logger$5.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9535
9550
|
|
|
9536
9551
|
return Promise.resolve(null);
|
|
9537
9552
|
}
|
|
@@ -9541,7 +9556,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9541
9556
|
}
|
|
9542
9557
|
|
|
9543
9558
|
async reject(callSession ) {
|
|
9544
|
-
logger$
|
|
9559
|
+
logger$5.info('reject WebRTC called', { id: callSession.getId() });
|
|
9545
9560
|
|
|
9546
9561
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9547
9562
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9553,14 +9568,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9553
9568
|
|
|
9554
9569
|
const sipSession = this.findSipSession(callSession);
|
|
9555
9570
|
if (sipSession) {
|
|
9556
|
-
logger$
|
|
9571
|
+
logger$5.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9557
9572
|
|
|
9558
9573
|
this.client.hangup(sipSession);
|
|
9559
9574
|
}
|
|
9560
9575
|
}
|
|
9561
9576
|
|
|
9562
9577
|
async ignore(callSession ) {
|
|
9563
|
-
logger$
|
|
9578
|
+
logger$5.info('WebRTC ignore', { id: callSession.getId() });
|
|
9564
9579
|
|
|
9565
9580
|
// kill the ring
|
|
9566
9581
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9572,14 +9587,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9572
9587
|
const sipSession = this.findSipSession(callSession);
|
|
9573
9588
|
|
|
9574
9589
|
if (sipSession) {
|
|
9575
|
-
logger$
|
|
9590
|
+
logger$5.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9576
9591
|
|
|
9577
9592
|
return this.client.atxfer(sipSession);
|
|
9578
9593
|
}
|
|
9579
9594
|
}
|
|
9580
9595
|
|
|
9581
9596
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9582
|
-
logger$
|
|
9597
|
+
logger$5.info('WebRTC hold', { id: callSession.getId() });
|
|
9583
9598
|
|
|
9584
9599
|
const sipSession = this.findSipSession(callSession);
|
|
9585
9600
|
|
|
@@ -9594,18 +9609,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9594
9609
|
}
|
|
9595
9610
|
|
|
9596
9611
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9597
|
-
logger$
|
|
9612
|
+
logger$5.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9598
9613
|
|
|
9599
9614
|
const sipSession = this.findSipSession(callSession);
|
|
9600
9615
|
if (!sipSession) {
|
|
9601
9616
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9602
9617
|
}
|
|
9603
9618
|
|
|
9604
|
-
logger$
|
|
9619
|
+
logger$5.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9605
9620
|
|
|
9606
9621
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9607
9622
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9608
|
-
logger$
|
|
9623
|
+
logger$5.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9609
9624
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9610
9625
|
}
|
|
9611
9626
|
|
|
@@ -9630,7 +9645,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9630
9645
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9631
9646
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9632
9647
|
|
|
9633
|
-
logger$
|
|
9648
|
+
logger$5.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9634
9649
|
|
|
9635
9650
|
// Stop screenshre if needed
|
|
9636
9651
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9661,7 +9676,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9661
9676
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9662
9677
|
}
|
|
9663
9678
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9664
|
-
logger$
|
|
9679
|
+
logger$5.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9665
9680
|
|
|
9666
9681
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9667
9682
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9705,14 +9720,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9705
9720
|
}
|
|
9706
9721
|
|
|
9707
9722
|
mute(callSession , withEvent = true) {
|
|
9708
|
-
logger$
|
|
9723
|
+
logger$5.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9709
9724
|
|
|
9710
9725
|
const sipSession = this.findSipSession(callSession);
|
|
9711
9726
|
if (!sipSession) {
|
|
9712
9727
|
return;
|
|
9713
9728
|
}
|
|
9714
9729
|
|
|
9715
|
-
logger$
|
|
9730
|
+
logger$5.info('WebRTC muting', { sipId: sipSession.id });
|
|
9716
9731
|
this.client.mute(sipSession);
|
|
9717
9732
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9718
9733
|
|
|
@@ -9726,14 +9741,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9726
9741
|
}
|
|
9727
9742
|
|
|
9728
9743
|
unmute(callSession , withEvent = true) {
|
|
9729
|
-
logger$
|
|
9744
|
+
logger$5.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9730
9745
|
|
|
9731
9746
|
const sipSession = this.findSipSession(callSession);
|
|
9732
9747
|
if (!sipSession) {
|
|
9733
9748
|
return;
|
|
9734
9749
|
}
|
|
9735
9750
|
|
|
9736
|
-
logger$
|
|
9751
|
+
logger$5.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9737
9752
|
this.client.unmute(sipSession);
|
|
9738
9753
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9739
9754
|
|
|
@@ -9760,7 +9775,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9760
9775
|
if (!sipSession) {
|
|
9761
9776
|
return;
|
|
9762
9777
|
}
|
|
9763
|
-
logger$
|
|
9778
|
+
logger$5.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9764
9779
|
|
|
9765
9780
|
this.client.toggleCameraOn(sipSession);
|
|
9766
9781
|
|
|
@@ -9772,7 +9787,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9772
9787
|
if (!sipSession) {
|
|
9773
9788
|
return;
|
|
9774
9789
|
}
|
|
9775
|
-
logger$
|
|
9790
|
+
logger$5.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9776
9791
|
|
|
9777
9792
|
this.client.toggleCameraOff(sipSession);
|
|
9778
9793
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9784,7 +9799,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9784
9799
|
return;
|
|
9785
9800
|
}
|
|
9786
9801
|
|
|
9787
|
-
logger$
|
|
9802
|
+
logger$5.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9788
9803
|
this.client.sendDTMF(sipSession, tone);
|
|
9789
9804
|
}
|
|
9790
9805
|
|
|
@@ -9792,7 +9807,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9792
9807
|
// @TODO: line is not used here
|
|
9793
9808
|
async makeCall(number , line , cameraEnabled ,
|
|
9794
9809
|
audioOnly = false, conference = false) {
|
|
9795
|
-
logger$
|
|
9810
|
+
logger$5.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
|
|
9796
9811
|
if (!number) {
|
|
9797
9812
|
return Promise.resolve(null);
|
|
9798
9813
|
}
|
|
@@ -9802,7 +9817,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9802
9817
|
}
|
|
9803
9818
|
if (this.currentSipSession) {
|
|
9804
9819
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9805
|
-
logger$
|
|
9820
|
+
logger$5.warn('Unable to hold current session when making another call', e);
|
|
9806
9821
|
});
|
|
9807
9822
|
}
|
|
9808
9823
|
|
|
@@ -9812,7 +9827,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9812
9827
|
this._bindEvents(sipSession);
|
|
9813
9828
|
} catch (error) {
|
|
9814
9829
|
console.warn(error);
|
|
9815
|
-
logger$
|
|
9830
|
+
logger$5.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9816
9831
|
return Promise.resolve(null);
|
|
9817
9832
|
}
|
|
9818
9833
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
@@ -9840,7 +9855,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9840
9855
|
return;
|
|
9841
9856
|
}
|
|
9842
9857
|
|
|
9843
|
-
logger$
|
|
9858
|
+
logger$5.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9844
9859
|
|
|
9845
9860
|
this.client.transfer(sipSession, target);
|
|
9846
9861
|
}
|
|
@@ -9849,7 +9864,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9849
9864
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9850
9865
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9851
9866
|
|
|
9852
|
-
logger$
|
|
9867
|
+
logger$5.info('WebRTC indirect transfer', {
|
|
9853
9868
|
sipId: sipSession ? sipSession.id : null,
|
|
9854
9869
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9855
9870
|
});
|
|
@@ -9888,7 +9903,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9888
9903
|
return false;
|
|
9889
9904
|
}
|
|
9890
9905
|
|
|
9891
|
-
logger$
|
|
9906
|
+
logger$5.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9892
9907
|
|
|
9893
9908
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9894
9909
|
|
|
@@ -9934,7 +9949,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9934
9949
|
endCurrentCall(callSession ) {
|
|
9935
9950
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9936
9951
|
|
|
9937
|
-
logger$
|
|
9952
|
+
logger$5.info('Ending current call', {
|
|
9938
9953
|
id: callSession ? callSession.getId() : null,
|
|
9939
9954
|
isCurrent,
|
|
9940
9955
|
});
|
|
@@ -9958,7 +9973,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9958
9973
|
}
|
|
9959
9974
|
|
|
9960
9975
|
async close() {
|
|
9961
|
-
logger$
|
|
9976
|
+
logger$5.info('WebRTC close');
|
|
9962
9977
|
|
|
9963
9978
|
try {
|
|
9964
9979
|
await Promise.race([
|
|
@@ -9966,7 +9981,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9966
9981
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9967
9982
|
]);
|
|
9968
9983
|
} catch (e) {
|
|
9969
|
-
logger$
|
|
9984
|
+
logger$5.error('WebRTC close, unregister error', e);
|
|
9970
9985
|
}
|
|
9971
9986
|
|
|
9972
9987
|
this.client.close();
|
|
@@ -9984,12 +9999,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9984
9999
|
}
|
|
9985
10000
|
|
|
9986
10001
|
enableRinging() {
|
|
9987
|
-
logger$
|
|
10002
|
+
logger$5.info('WebRTC enable ringing');
|
|
9988
10003
|
this.ringingEnabled = true;
|
|
9989
10004
|
}
|
|
9990
10005
|
|
|
9991
10006
|
disableRinging() {
|
|
9992
|
-
logger$
|
|
10007
|
+
logger$5.info('WebRTC disable ringing');
|
|
9993
10008
|
this.ringingEnabled = false;
|
|
9994
10009
|
}
|
|
9995
10010
|
|
|
@@ -10029,7 +10044,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10029
10044
|
|
|
10030
10045
|
// Deprecated
|
|
10031
10046
|
getLocalMediaStream(callSession ) {
|
|
10032
|
-
logger$
|
|
10047
|
+
logger$5.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
10033
10048
|
return this.getLocalStream(callSession);
|
|
10034
10049
|
}
|
|
10035
10050
|
|
|
@@ -10071,7 +10086,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10071
10086
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
10072
10087
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
10073
10088
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
10074
|
-
logger$
|
|
10089
|
+
logger$5.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
10075
10090
|
|
|
10076
10091
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
10077
10092
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -10094,7 +10109,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10094
10109
|
});
|
|
10095
10110
|
|
|
10096
10111
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
10097
|
-
logger$
|
|
10112
|
+
logger$5.info('WebRTC on reinvite', {
|
|
10098
10113
|
sessionId: args[0].id,
|
|
10099
10114
|
inviteId: args[1].id,
|
|
10100
10115
|
updatedCalleeName: args[2],
|
|
@@ -10114,7 +10129,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10114
10129
|
});
|
|
10115
10130
|
|
|
10116
10131
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
10117
|
-
logger$
|
|
10132
|
+
logger$5.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
10118
10133
|
|
|
10119
10134
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
10120
10135
|
|
|
@@ -10125,22 +10140,22 @@ class WebRTCPhone extends Emitter {
|
|
|
10125
10140
|
this.client.on('ended', () => {});
|
|
10126
10141
|
|
|
10127
10142
|
this.client.on(this.client.ON_ERROR, e => {
|
|
10128
|
-
logger$
|
|
10143
|
+
logger$5.error('WebRTC error', e);
|
|
10129
10144
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10130
10145
|
});
|
|
10131
10146
|
|
|
10132
10147
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10133
|
-
logger$
|
|
10148
|
+
logger$5.info('WebRTC unregistered');
|
|
10134
10149
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10135
10150
|
});
|
|
10136
10151
|
|
|
10137
10152
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
10138
|
-
logger$
|
|
10139
|
-
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10153
|
+
logger$5.info('WebRTC disconnected');
|
|
10154
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
10140
10155
|
});
|
|
10141
10156
|
|
|
10142
10157
|
this.client.on(this.client.REGISTERED, () => {
|
|
10143
|
-
logger$
|
|
10158
|
+
logger$5.info('WebRTC registered', {
|
|
10144
10159
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
10145
10160
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
10146
10161
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -10153,23 +10168,27 @@ class WebRTCPhone extends Emitter {
|
|
|
10153
10168
|
if (this.shouldSendReinvite && this.currentSipSession
|
|
10154
10169
|
&& this.currentSipSession.state === sessionState.SessionState.Established) {
|
|
10155
10170
|
this.shouldSendReinvite = false;
|
|
10171
|
+
const pc = this.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
10172
|
+
const isConference = pc ? pc.sfu : false;
|
|
10173
|
+
const hasVideo = this.currentCallSession && this.currentCallSession.cameraEnabled;
|
|
10174
|
+
|
|
10156
10175
|
try {
|
|
10157
10176
|
// Send reinvite with iceRestart
|
|
10158
|
-
this.sendReinvite(this.currentCallSession, null,
|
|
10177
|
+
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10159
10178
|
} catch (e) {
|
|
10160
|
-
logger$
|
|
10179
|
+
logger$5.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10161
10180
|
}
|
|
10162
10181
|
}
|
|
10163
10182
|
});
|
|
10164
10183
|
|
|
10165
10184
|
this.client.on(this.client.CONNECTED, () => {
|
|
10166
|
-
logger$
|
|
10185
|
+
logger$5.info('WebRTC client connected');
|
|
10167
10186
|
|
|
10168
10187
|
this.stopHeartbeat();
|
|
10169
10188
|
});
|
|
10170
10189
|
|
|
10171
10190
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
10172
|
-
logger$
|
|
10191
|
+
logger$5.info('WebRTC client disconnected');
|
|
10173
10192
|
|
|
10174
10193
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10175
10194
|
|
|
@@ -10183,7 +10202,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10183
10202
|
});
|
|
10184
10203
|
|
|
10185
10204
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
10186
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
10205
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
10187
10206
|
});
|
|
10188
10207
|
|
|
10189
10208
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -10198,7 +10217,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10198
10217
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
10199
10218
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
10200
10219
|
|
|
10201
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
10220
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, callSession, stats, previousStats);
|
|
10202
10221
|
});
|
|
10203
10222
|
|
|
10204
10223
|
// Used when upgrading directly in screenshare mode
|
|
@@ -10207,7 +10226,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10207
10226
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
10208
10227
|
const callSession = this.callSessions[sipSessionId];
|
|
10209
10228
|
|
|
10210
|
-
logger$
|
|
10229
|
+
logger$5.info('Updrading directly in screensharing mode', {
|
|
10211
10230
|
sipSessionId,
|
|
10212
10231
|
tracks: localStream ? localStream.getTracks() : null,
|
|
10213
10232
|
});
|
|
@@ -10239,6 +10258,15 @@ class WebRTCPhone extends Emitter {
|
|
|
10239
10258
|
return this.client.getSipSessionId(sipSession);
|
|
10240
10259
|
}
|
|
10241
10260
|
|
|
10261
|
+
_updateCallSession(callSession ) {
|
|
10262
|
+
const sipSession = this.findSipSession(callSession);
|
|
10263
|
+
const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
|
|
10264
|
+
|
|
10265
|
+
if (sipSessionId) {
|
|
10266
|
+
this.callSessions[sipSessionId] = callSession;
|
|
10267
|
+
}
|
|
10268
|
+
}
|
|
10269
|
+
|
|
10242
10270
|
_onMessage(message ) {
|
|
10243
10271
|
if (!message || message.method !== 'MESSAGE') {
|
|
10244
10272
|
return;
|
|
@@ -10376,8 +10404,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10376
10404
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10377
10405
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10378
10406
|
ON_MESSAGE: ON_MESSAGE,
|
|
10379
|
-
ON_REINVITE: ON_REINVITE,
|
|
10380
|
-
ON_TRACK: ON_TRACK,
|
|
10407
|
+
ON_REINVITE: ON_REINVITE$1,
|
|
10408
|
+
ON_TRACK: ON_TRACK$1,
|
|
10381
10409
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10382
10410
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10383
10411
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10392,13 +10420,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10392
10420
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10393
10421
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10394
10422
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10395
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10423
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS$1,
|
|
10396
10424
|
ON_CHAT: ON_CHAT,
|
|
10397
10425
|
ON_SIGNAL: ON_SIGNAL,
|
|
10398
|
-
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10426
|
+
ON_DISCONNECTED: ON_DISCONNECTED$1,
|
|
10399
10427
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10400
10428
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10401
|
-
events: events,
|
|
10429
|
+
events: events$1,
|
|
10402
10430
|
'default': WebRTCPhone
|
|
10403
10431
|
});
|
|
10404
10432
|
|
|
@@ -10792,7 +10820,7 @@ class Phone extends Emitter {
|
|
|
10792
10820
|
|
|
10793
10821
|
_transferEvents() {
|
|
10794
10822
|
this.unbind();
|
|
10795
|
-
[...events
|
|
10823
|
+
[...events, ...transportEvents].forEach(event => {
|
|
10796
10824
|
this.client.on(event, (...args) =>
|
|
10797
10825
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
10798
10826
|
});
|
|
@@ -10814,7 +10842,7 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
10814
10842
|
|
|
10815
10843
|
//
|
|
10816
10844
|
|
|
10817
|
-
const SOCKET_EVENTS
|
|
10845
|
+
const SOCKET_EVENTS = {
|
|
10818
10846
|
ON_OPEN: 'onopen',
|
|
10819
10847
|
ON_MESSAGE: 'onmessage',
|
|
10820
10848
|
ON_ERROR: 'onerror',
|
|
@@ -10910,7 +10938,7 @@ const BLACKLIST_EVENTS = [
|
|
|
10910
10938
|
];
|
|
10911
10939
|
|
|
10912
10940
|
const HEARTBEAT_ENGINE_VERSION = '20.09';
|
|
10913
|
-
const logger$
|
|
10941
|
+
const logger$7 = IssueReporter$1.loggerFor('wazo-ws');
|
|
10914
10942
|
const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
|
|
10915
10943
|
|
|
10916
10944
|
class WebSocketClient extends Emitter {
|
|
@@ -10959,24 +10987,24 @@ class WebSocketClient extends Emitter {
|
|
|
10959
10987
|
}
|
|
10960
10988
|
|
|
10961
10989
|
connect() {
|
|
10962
|
-
logger$
|
|
10990
|
+
logger$7.info('connect method started', { host: this.host, token: this.token });
|
|
10963
10991
|
this.socket = new ReconnectingWebSocket__default['default'](this._getUrl.bind(this), [], this.options);
|
|
10964
10992
|
if (this.options.binaryType) {
|
|
10965
10993
|
this.socket.binaryType = this.options.binaryType;
|
|
10966
10994
|
}
|
|
10967
10995
|
|
|
10968
10996
|
this.socket.onopen = () => {
|
|
10969
|
-
logger$
|
|
10970
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
10997
|
+
logger$7.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
10998
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
10971
10999
|
};
|
|
10972
11000
|
|
|
10973
11001
|
this.socket.onerror = event => {
|
|
10974
|
-
logger$
|
|
10975
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11002
|
+
logger$7.error('on Wazo WS error', event.target);
|
|
11003
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
10976
11004
|
};
|
|
10977
11005
|
|
|
10978
11006
|
this.socket.onmessage = (event ) => {
|
|
10979
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11007
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
10980
11008
|
|
|
10981
11009
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
10982
11010
|
let { name } = message;
|
|
@@ -11001,7 +11029,7 @@ class WebSocketClient extends Emitter {
|
|
|
11001
11029
|
|
|
11002
11030
|
this.socket.onclose = event => {
|
|
11003
11031
|
// Can't be converted to JSON (circular structure)
|
|
11004
|
-
logger$
|
|
11032
|
+
logger$7.info('on Wazo WS close', {
|
|
11005
11033
|
reason: event.reason,
|
|
11006
11034
|
code: event.code,
|
|
11007
11035
|
readyState: event.target.readyState,
|
|
@@ -11009,22 +11037,22 @@ class WebSocketClient extends Emitter {
|
|
|
11009
11037
|
token: this.token,
|
|
11010
11038
|
});
|
|
11011
11039
|
this.initialized = false;
|
|
11012
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11040
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
11013
11041
|
|
|
11014
11042
|
switch (event.code) {
|
|
11015
11043
|
case 4002:
|
|
11016
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11044
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
11017
11045
|
break;
|
|
11018
11046
|
}
|
|
11019
11047
|
};
|
|
11020
11048
|
|
|
11021
11049
|
this.socket.onerror = event => {
|
|
11022
|
-
logger$
|
|
11050
|
+
logger$7.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
|
|
11023
11051
|
};
|
|
11024
11052
|
}
|
|
11025
11053
|
|
|
11026
11054
|
close(force = false) {
|
|
11027
|
-
logger$
|
|
11055
|
+
logger$7.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
|
|
11028
11056
|
|
|
11029
11057
|
if (!this.socket) {
|
|
11030
11058
|
return;
|
|
@@ -11042,7 +11070,7 @@ class WebSocketClient extends Emitter {
|
|
|
11042
11070
|
|
|
11043
11071
|
updateToken(token ) {
|
|
11044
11072
|
this.token = token;
|
|
11045
|
-
logger$
|
|
11073
|
+
logger$7.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
|
|
11046
11074
|
|
|
11047
11075
|
if (this.socket) {
|
|
11048
11076
|
// If still connected, send the token to the WS
|
|
@@ -11060,7 +11088,7 @@ class WebSocketClient extends Emitter {
|
|
|
11060
11088
|
}
|
|
11061
11089
|
|
|
11062
11090
|
startHeartbeat() {
|
|
11063
|
-
logger$
|
|
11091
|
+
logger$7.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
|
|
11064
11092
|
|
|
11065
11093
|
if (!this.socket) {
|
|
11066
11094
|
this.heartbeat.stop();
|
|
@@ -11074,7 +11102,7 @@ class WebSocketClient extends Emitter {
|
|
|
11074
11102
|
}
|
|
11075
11103
|
|
|
11076
11104
|
stopHeartbeat() {
|
|
11077
|
-
logger$
|
|
11105
|
+
logger$7.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
|
|
11078
11106
|
|
|
11079
11107
|
this.heartbeat.stop();
|
|
11080
11108
|
}
|
|
@@ -11104,7 +11132,7 @@ class WebSocketClient extends Emitter {
|
|
|
11104
11132
|
}
|
|
11105
11133
|
|
|
11106
11134
|
reconnect(reason ) {
|
|
11107
|
-
logger$
|
|
11135
|
+
logger$7.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
|
|
11108
11136
|
if (!this.socket) {
|
|
11109
11137
|
return;
|
|
11110
11138
|
}
|
|
@@ -11129,7 +11157,7 @@ class WebSocketClient extends Emitter {
|
|
|
11129
11157
|
break;
|
|
11130
11158
|
case 'start':
|
|
11131
11159
|
this.initialized = true;
|
|
11132
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11160
|
+
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
11133
11161
|
break;
|
|
11134
11162
|
default:
|
|
11135
11163
|
this.eventEmitter.emit('message', message);
|
|
@@ -11160,7 +11188,7 @@ class WebSocketClient extends Emitter {
|
|
|
11160
11188
|
this.close();
|
|
11161
11189
|
}
|
|
11162
11190
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
11163
|
-
logger$
|
|
11191
|
+
logger$7.log('Wazo WS url computed to reconnect', { url });
|
|
11164
11192
|
|
|
11165
11193
|
return url;
|
|
11166
11194
|
}
|
|
@@ -11168,15 +11196,15 @@ class WebSocketClient extends Emitter {
|
|
|
11168
11196
|
_onHeartbeat(message ) {
|
|
11169
11197
|
if (message.payload === 'pong') {
|
|
11170
11198
|
this.heartbeat.onHeartbeat();
|
|
11171
|
-
logger$
|
|
11199
|
+
logger$7.log('on heartbeat received from Wazo WS');
|
|
11172
11200
|
}
|
|
11173
11201
|
}
|
|
11174
11202
|
|
|
11175
11203
|
async _onHeartbeatTimeout() {
|
|
11176
|
-
logger$
|
|
11204
|
+
logger$7.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
11177
11205
|
|
|
11178
11206
|
this.close();
|
|
11179
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11207
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11180
11208
|
|
|
11181
11209
|
if (this.onHeartBeatTimeout) {
|
|
11182
11210
|
this.onHeartBeatTimeout();
|
|
@@ -11256,7 +11284,7 @@ WebSocketClient.eventLists = [
|
|
|
11256
11284
|
|
|
11257
11285
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
11258
11286
|
__proto__: null,
|
|
11259
|
-
SOCKET_EVENTS: SOCKET_EVENTS
|
|
11287
|
+
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
11260
11288
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
11261
11289
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
11262
11290
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -11329,10 +11357,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11329
11357
|
|
|
11330
11358
|
//
|
|
11331
11359
|
|
|
11332
|
-
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11333
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
11360
|
+
const { SOCKET_EVENTS: SOCKET_EVENTS$1, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11361
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS$1), ...Object.values(OTHER_EVENTS)];
|
|
11334
11362
|
|
|
11335
|
-
const logger$
|
|
11363
|
+
const logger$8 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
11336
11364
|
|
|
11337
11365
|
class Websocket extends Emitter {
|
|
11338
11366
|
|
|
@@ -11346,9 +11374,9 @@ class Websocket extends Emitter {
|
|
|
11346
11374
|
// $FlowFixMe
|
|
11347
11375
|
this[key] = OTHER_EVENTS[key];
|
|
11348
11376
|
});
|
|
11349
|
-
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
11377
|
+
Object.keys(SOCKET_EVENTS$1).forEach(key => {
|
|
11350
11378
|
// $FlowFixMe
|
|
11351
|
-
this[key] = SOCKET_EVENTS[key];
|
|
11379
|
+
this[key] = SOCKET_EVENTS$1[key];
|
|
11352
11380
|
});
|
|
11353
11381
|
this.eventLists = WebSocketClient.eventLists;
|
|
11354
11382
|
|
|
@@ -11356,7 +11384,7 @@ class Websocket extends Emitter {
|
|
|
11356
11384
|
}
|
|
11357
11385
|
|
|
11358
11386
|
open(host , session ) {
|
|
11359
|
-
logger$
|
|
11387
|
+
logger$8.info('open simple WebSocket', { host, token: session.token });
|
|
11360
11388
|
this.ws = new WebSocketClient(
|
|
11361
11389
|
{
|
|
11362
11390
|
host,
|
|
@@ -11384,7 +11412,7 @@ class Websocket extends Emitter {
|
|
|
11384
11412
|
}
|
|
11385
11413
|
|
|
11386
11414
|
updateToken(token ) {
|
|
11387
|
-
logger$
|
|
11415
|
+
logger$8.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
11388
11416
|
|
|
11389
11417
|
if (!this.ws) {
|
|
11390
11418
|
return;
|
|
@@ -11412,12 +11440,12 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11412
11440
|
|
|
11413
11441
|
//
|
|
11414
11442
|
|
|
11415
|
-
const logger$
|
|
11443
|
+
const logger$9 = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
11416
11444
|
|
|
11417
|
-
class SipRoom extends Room {
|
|
11445
|
+
class SipRoom extends Room$1 {
|
|
11418
11446
|
|
|
11419
11447
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
11420
|
-
logger$
|
|
11448
|
+
logger$9.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
11421
11449
|
|
|
11422
11450
|
if (!room) {
|
|
11423
11451
|
await Wazo.Phone.connect();
|
|
@@ -11433,7 +11461,7 @@ class SipRoom extends Room {
|
|
|
11433
11461
|
room.setCallId(room.callSession.call.id);
|
|
11434
11462
|
}
|
|
11435
11463
|
|
|
11436
|
-
logger$
|
|
11464
|
+
logger$9.info('connected to room', {
|
|
11437
11465
|
extension: room.extension,
|
|
11438
11466
|
});
|
|
11439
11467
|
|
|
@@ -11441,7 +11469,7 @@ class SipRoom extends Room {
|
|
|
11441
11469
|
}
|
|
11442
11470
|
|
|
11443
11471
|
mute() {
|
|
11444
|
-
logger$
|
|
11472
|
+
logger$9.info('mute sip room');
|
|
11445
11473
|
|
|
11446
11474
|
Wazo.Phone.mute(this.callSession, false);
|
|
11447
11475
|
|
|
@@ -11449,7 +11477,7 @@ class SipRoom extends Room {
|
|
|
11449
11477
|
}
|
|
11450
11478
|
|
|
11451
11479
|
unmute() {
|
|
11452
|
-
logger$
|
|
11480
|
+
logger$9.info('unmute sip room');
|
|
11453
11481
|
|
|
11454
11482
|
Wazo.Phone.unmute(this.callSession, false);
|
|
11455
11483
|
|
|
@@ -11551,7 +11579,7 @@ class SipRoom extends Room {
|
|
|
11551
11579
|
|
|
11552
11580
|
//
|
|
11553
11581
|
|
|
11554
|
-
const logger$
|
|
11582
|
+
const logger$a = IssueReporter$1.loggerFor('room');
|
|
11555
11583
|
|
|
11556
11584
|
class Participant extends Emitter {
|
|
11557
11585
|
|
|
@@ -11673,7 +11701,7 @@ class Participant extends Emitter {
|
|
|
11673
11701
|
}
|
|
11674
11702
|
|
|
11675
11703
|
onTalking(isTalking ) {
|
|
11676
|
-
logger$
|
|
11704
|
+
logger$a.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
11677
11705
|
this.isTalking = isTalking;
|
|
11678
11706
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
11679
11707
|
// directly from asterisk, there's no need to do so
|
|
@@ -11776,7 +11804,7 @@ class Participant extends Emitter {
|
|
|
11776
11804
|
}
|
|
11777
11805
|
|
|
11778
11806
|
updateStatus(status , broadcast = true) {
|
|
11779
|
-
logger$
|
|
11807
|
+
logger$a.info('updating participant status', { name: this.name, status });
|
|
11780
11808
|
|
|
11781
11809
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
11782
11810
|
if (status.audioMuted) {
|
|
@@ -11824,7 +11852,7 @@ class Participant extends Emitter {
|
|
|
11824
11852
|
|
|
11825
11853
|
broadcastStatus(inboundStatus = null) {
|
|
11826
11854
|
const status = inboundStatus || this.getStatus();
|
|
11827
|
-
logger$
|
|
11855
|
+
logger$a.info('broadcasting participant status', { callId: this.callId, status });
|
|
11828
11856
|
|
|
11829
11857
|
this.room.sendSignal({
|
|
11830
11858
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|
|
@@ -12039,7 +12067,7 @@ class NotificationOptions {
|
|
|
12039
12067
|
|
|
12040
12068
|
|
|
12041
12069
|
// Represents a conference room, like `9000`.
|
|
12042
|
-
class Room
|
|
12070
|
+
class Room {
|
|
12043
12071
|
|
|
12044
12072
|
|
|
12045
12073
|
|
|
@@ -12060,7 +12088,7 @@ class Room$1 {
|
|
|
12060
12088
|
}
|
|
12061
12089
|
|
|
12062
12090
|
connect(callSession ) {
|
|
12063
|
-
return new Room
|
|
12091
|
+
return new Room({ ...this, connectedCallSession: callSession });
|
|
12064
12092
|
}
|
|
12065
12093
|
|
|
12066
12094
|
has(callSession ) {
|
|
@@ -12069,7 +12097,7 @@ class Room$1 {
|
|
|
12069
12097
|
|
|
12070
12098
|
addParticipant(uuid , extension , talking = null) {
|
|
12071
12099
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
12072
|
-
return new Room
|
|
12100
|
+
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12073
12101
|
}
|
|
12074
12102
|
|
|
12075
12103
|
return this;
|
|
@@ -12088,7 +12116,7 @@ class Room$1 {
|
|
|
12088
12116
|
updatedParticipants.push(participant);
|
|
12089
12117
|
}
|
|
12090
12118
|
|
|
12091
|
-
return new Room
|
|
12119
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12092
12120
|
}
|
|
12093
12121
|
|
|
12094
12122
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -12104,7 +12132,7 @@ class Room$1 {
|
|
|
12104
12132
|
updatedParticipants.push(participant);
|
|
12105
12133
|
}
|
|
12106
12134
|
|
|
12107
|
-
return new Room
|
|
12135
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12108
12136
|
}
|
|
12109
12137
|
|
|
12110
12138
|
hasCallWithId(id ) {
|
|
@@ -12112,18 +12140,18 @@ class Room$1 {
|
|
|
12112
12140
|
}
|
|
12113
12141
|
|
|
12114
12142
|
disconnect() {
|
|
12115
|
-
return new Room
|
|
12143
|
+
return new Room({ ...this, connectedCallSession: null });
|
|
12116
12144
|
}
|
|
12117
12145
|
|
|
12118
12146
|
removeParticipantWithUUID(uuid ) {
|
|
12119
|
-
return new Room
|
|
12147
|
+
return new Room({
|
|
12120
12148
|
...this,
|
|
12121
12149
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
12122
12150
|
});
|
|
12123
12151
|
}
|
|
12124
12152
|
|
|
12125
12153
|
removeParticipantWithExtension(extension ) {
|
|
12126
|
-
return new Room
|
|
12154
|
+
return new Room({
|
|
12127
12155
|
...this,
|
|
12128
12156
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
12129
12157
|
});
|
|
@@ -12134,7 +12162,7 @@ class Room$1 {
|
|
|
12134
12162
|
}
|
|
12135
12163
|
|
|
12136
12164
|
static newFrom(room ) {
|
|
12137
|
-
return newFrom(room, Room
|
|
12165
|
+
return newFrom(room, Room);
|
|
12138
12166
|
}
|
|
12139
12167
|
}
|
|
12140
12168
|
|
|
@@ -12441,11 +12469,11 @@ var wazoWebsocket = {
|
|
|
12441
12469
|
resolve();
|
|
12442
12470
|
};
|
|
12443
12471
|
|
|
12444
|
-
client.on(SOCKET_EVENTS
|
|
12472
|
+
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
12445
12473
|
handleError(`Connection error : ${error}`);
|
|
12446
12474
|
});
|
|
12447
12475
|
|
|
12448
|
-
client.on(SOCKET_EVENTS
|
|
12476
|
+
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
12449
12477
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
12450
12478
|
client.setOnHeartbeatTimeout(() => {
|
|
12451
12479
|
handleError('No response to heartbeat');
|
|
@@ -12546,7 +12574,7 @@ var webrtc = {
|
|
|
12546
12574
|
}),
|
|
12547
12575
|
};
|
|
12548
12576
|
|
|
12549
|
-
const parseCandidate = line => {
|
|
12577
|
+
const parseCandidate$1 = line => {
|
|
12550
12578
|
let parts;
|
|
12551
12579
|
// Parse both variants.
|
|
12552
12580
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -12637,7 +12665,7 @@ var SymmetricNat = {
|
|
|
12637
12665
|
}
|
|
12638
12666
|
|
|
12639
12667
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
12640
|
-
const cand = parseCandidate(e.candidate.candidate);
|
|
12668
|
+
const cand = parseCandidate$1(e.candidate.candidate);
|
|
12641
12669
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
12642
12670
|
candidates[cand.relatedPort].push(cand.port);
|
|
12643
12671
|
} else if (!e.candidate) {
|
|
@@ -12705,7 +12733,7 @@ var iceIpv4 = {
|
|
|
12705
12733
|
const rawCandidate = e.candidate.candidate;
|
|
12706
12734
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
12707
12735
|
hasSrflxOrRelay = true;
|
|
12708
|
-
const candidate = parseCandidate(e.candidate.candidate);
|
|
12736
|
+
const candidate = parseCandidate$1(e.candidate.candidate);
|
|
12709
12737
|
ips.push(candidate.ip);
|
|
12710
12738
|
}
|
|
12711
12739
|
} else if (!e.candidate) {
|
|
@@ -12742,7 +12770,7 @@ var checks = [
|
|
|
12742
12770
|
|
|
12743
12771
|
//
|
|
12744
12772
|
|
|
12745
|
-
const logger$
|
|
12773
|
+
const logger$b = IssueReporter$1.loggerFor('engine-check');
|
|
12746
12774
|
|
|
12747
12775
|
class Checker {
|
|
12748
12776
|
|
|
@@ -12760,28 +12788,28 @@ class Checker {
|
|
|
12760
12788
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
12761
12789
|
await this._addEngineVersion();
|
|
12762
12790
|
|
|
12763
|
-
logger$
|
|
12791
|
+
logger$b.info('Engine check starting');
|
|
12764
12792
|
|
|
12765
12793
|
for (let i = 0; i < this.checks.length; i++) {
|
|
12766
12794
|
const { name, check } = this.checks[i];
|
|
12767
12795
|
|
|
12768
|
-
logger$
|
|
12796
|
+
logger$b.info(`Checking ${name} ...`);
|
|
12769
12797
|
|
|
12770
12798
|
onCheckBegin(name);
|
|
12771
12799
|
try {
|
|
12772
12800
|
// eslint-disable-next-line no-await-in-loop
|
|
12773
12801
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
12774
|
-
logger$
|
|
12802
|
+
logger$b.info(`Checking ${name} success.`, { result });
|
|
12775
12803
|
|
|
12776
12804
|
onCheckResult(name, result);
|
|
12777
12805
|
} catch (e) {
|
|
12778
|
-
logger$
|
|
12806
|
+
logger$b.info(`Checking ${name} failure`, { message: e.message });
|
|
12779
12807
|
|
|
12780
12808
|
onCheckResult(name, e);
|
|
12781
12809
|
}
|
|
12782
12810
|
}
|
|
12783
12811
|
|
|
12784
|
-
logger$
|
|
12812
|
+
logger$b.info('Engine check done.');
|
|
12785
12813
|
}
|
|
12786
12814
|
|
|
12787
12815
|
addCheck(check ) {
|
|
@@ -12805,7 +12833,7 @@ const Wazo = {
|
|
|
12805
12833
|
Auth: Auth$1,
|
|
12806
12834
|
Phone: Phone$1,
|
|
12807
12835
|
Websocket: Websocket$1,
|
|
12808
|
-
Room,
|
|
12836
|
+
Room: Room$1,
|
|
12809
12837
|
SipRoom,
|
|
12810
12838
|
RemoteParticipant,
|
|
12811
12839
|
LocalParticipant,
|
|
@@ -12838,7 +12866,7 @@ const Wazo = {
|
|
|
12838
12866
|
Session,
|
|
12839
12867
|
Voicemail,
|
|
12840
12868
|
Relocation,
|
|
12841
|
-
ConferenceRoom: Room
|
|
12869
|
+
ConferenceRoom: Room,
|
|
12842
12870
|
CallSession,
|
|
12843
12871
|
IndirectTransfer,
|
|
12844
12872
|
SwitchboardCall,
|
|
@@ -12877,9 +12905,9 @@ if (global) {
|
|
|
12877
12905
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
12878
12906
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
12879
12907
|
|
|
12880
|
-
const logger = IssueReporter$1.loggerFor('sdk-room');
|
|
12908
|
+
const logger$c = IssueReporter$1.loggerFor('sdk-room');
|
|
12881
12909
|
|
|
12882
|
-
class Room extends Emitter {
|
|
12910
|
+
class Room$1 extends Emitter {
|
|
12883
12911
|
|
|
12884
12912
|
|
|
12885
12913
|
|
|
@@ -12937,7 +12965,7 @@ class Room extends Emitter {
|
|
|
12937
12965
|
extra = {},
|
|
12938
12966
|
) {
|
|
12939
12967
|
super();
|
|
12940
|
-
logger.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
12968
|
+
logger$c.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
12941
12969
|
|
|
12942
12970
|
// Represents the room callSession
|
|
12943
12971
|
this.callSession = callSession;
|
|
@@ -13003,7 +13031,7 @@ class Room extends Emitter {
|
|
|
13003
13031
|
* @returns {Promise<Room>}
|
|
13004
13032
|
*/
|
|
13005
13033
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
13006
|
-
logger.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
13034
|
+
logger$c.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
13007
13035
|
|
|
13008
13036
|
if (!room) {
|
|
13009
13037
|
await Wazo.Phone.connect();
|
|
@@ -13016,7 +13044,7 @@ class Room extends Emitter {
|
|
|
13016
13044
|
|
|
13017
13045
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
13018
13046
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
13019
|
-
logger.info('room call received via WS', { callId: data.call_id });
|
|
13047
|
+
logger$c.info('room call received via WS', { callId: data.call_id });
|
|
13020
13048
|
if (room) {
|
|
13021
13049
|
room.setCallId(data.call_id);
|
|
13022
13050
|
}
|
|
@@ -13024,7 +13052,7 @@ class Room extends Emitter {
|
|
|
13024
13052
|
|
|
13025
13053
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
13026
13054
|
// eslint-disable-next-line no-param-reassign
|
|
13027
|
-
room = new Room(callSession, extension, null, null, extra);
|
|
13055
|
+
room = new Room$1(callSession, extension, null, null, extra);
|
|
13028
13056
|
|
|
13029
13057
|
// Wait for the call to be accepted
|
|
13030
13058
|
await new Promise((resolve, reject) => {
|
|
@@ -13045,7 +13073,7 @@ class Room extends Emitter {
|
|
|
13045
13073
|
// Retrieve conference
|
|
13046
13074
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
13047
13075
|
|
|
13048
|
-
logger.info('connected to room', {
|
|
13076
|
+
logger$c.info('connected to room', {
|
|
13049
13077
|
sourceId: conference ? conference.sourceId : null,
|
|
13050
13078
|
name: conference ? conference.name : null,
|
|
13051
13079
|
});
|
|
@@ -13055,7 +13083,7 @@ class Room extends Emitter {
|
|
|
13055
13083
|
room.setName(conference.name);
|
|
13056
13084
|
}
|
|
13057
13085
|
} else if (meeting) {
|
|
13058
|
-
logger.info('Already connected to meeting', {
|
|
13086
|
+
logger$c.info('Already connected to meeting', {
|
|
13059
13087
|
uuid: meeting.uuid,
|
|
13060
13088
|
name: meeting.name,
|
|
13061
13089
|
});
|
|
@@ -13068,13 +13096,13 @@ class Room extends Emitter {
|
|
|
13068
13096
|
}
|
|
13069
13097
|
|
|
13070
13098
|
static disconnect() {
|
|
13071
|
-
logger.info('static disconnection to room');
|
|
13099
|
+
logger$c.info('static disconnection to room');
|
|
13072
13100
|
|
|
13073
13101
|
Wazo.Phone.disconnect();
|
|
13074
13102
|
}
|
|
13075
13103
|
|
|
13076
13104
|
async disconnect() {
|
|
13077
|
-
logger.info('disconnection to room called');
|
|
13105
|
+
logger$c.info('disconnection to room called');
|
|
13078
13106
|
|
|
13079
13107
|
await Wazo.Phone.hangup(this.callSession);
|
|
13080
13108
|
this.callSession = null;
|
|
@@ -13094,19 +13122,19 @@ class Room extends Emitter {
|
|
|
13094
13122
|
}
|
|
13095
13123
|
|
|
13096
13124
|
setSourceId(sourceId ) {
|
|
13097
|
-
logger.info('set room source id', { sourceId });
|
|
13125
|
+
logger$c.info('set room source id', { sourceId });
|
|
13098
13126
|
|
|
13099
13127
|
this.sourceId = sourceId;
|
|
13100
13128
|
}
|
|
13101
13129
|
|
|
13102
13130
|
setMeetingUuid(meetingUuid ) {
|
|
13103
|
-
logger.info('set meeting uuid', { meetingUuid });
|
|
13131
|
+
logger$c.info('set meeting uuid', { meetingUuid });
|
|
13104
13132
|
|
|
13105
13133
|
this.meetingUuid = meetingUuid;
|
|
13106
13134
|
}
|
|
13107
13135
|
|
|
13108
13136
|
setCallId(callId ) {
|
|
13109
|
-
logger.info('set room call id', { callId });
|
|
13137
|
+
logger$c.info('set room call id', { callId });
|
|
13110
13138
|
|
|
13111
13139
|
if (callId) {
|
|
13112
13140
|
this.callId = callId;
|
|
@@ -13114,7 +13142,7 @@ class Room extends Emitter {
|
|
|
13114
13142
|
}
|
|
13115
13143
|
|
|
13116
13144
|
setName(name ) {
|
|
13117
|
-
logger.info('set room name', { name });
|
|
13145
|
+
logger$c.info('set room name', { name });
|
|
13118
13146
|
|
|
13119
13147
|
this.name = name;
|
|
13120
13148
|
}
|
|
@@ -13133,7 +13161,7 @@ class Room extends Emitter {
|
|
|
13133
13161
|
}
|
|
13134
13162
|
|
|
13135
13163
|
async startScreenSharing(constraints ) {
|
|
13136
|
-
logger.info('start room screen sharing', { constraints });
|
|
13164
|
+
logger$c.info('start room screen sharing', { constraints });
|
|
13137
13165
|
|
|
13138
13166
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
13139
13167
|
if (!screensharingStream) {
|
|
@@ -13147,7 +13175,7 @@ class Room extends Emitter {
|
|
|
13147
13175
|
}
|
|
13148
13176
|
|
|
13149
13177
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
13150
|
-
logger.info('stop room screen sharing');
|
|
13178
|
+
logger$c.info('stop room screen sharing');
|
|
13151
13179
|
|
|
13152
13180
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
13153
13181
|
|
|
@@ -13159,7 +13187,7 @@ class Room extends Emitter {
|
|
|
13159
13187
|
}
|
|
13160
13188
|
|
|
13161
13189
|
turnCameraOff() {
|
|
13162
|
-
logger.info('turn room camera off');
|
|
13190
|
+
logger$c.info('turn room camera off');
|
|
13163
13191
|
|
|
13164
13192
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
13165
13193
|
|
|
@@ -13169,7 +13197,7 @@ class Room extends Emitter {
|
|
|
13169
13197
|
}
|
|
13170
13198
|
|
|
13171
13199
|
turnCameraOn() {
|
|
13172
|
-
logger.info('turn room camera on');
|
|
13200
|
+
logger$c.info('turn room camera on');
|
|
13173
13201
|
|
|
13174
13202
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
13175
13203
|
|
|
@@ -13179,7 +13207,7 @@ class Room extends Emitter {
|
|
|
13179
13207
|
}
|
|
13180
13208
|
|
|
13181
13209
|
mute() {
|
|
13182
|
-
logger.info('mute room');
|
|
13210
|
+
logger$c.info('mute room');
|
|
13183
13211
|
|
|
13184
13212
|
Wazo.Phone.mute(this.callSession);
|
|
13185
13213
|
|
|
@@ -13187,7 +13215,7 @@ class Room extends Emitter {
|
|
|
13187
13215
|
}
|
|
13188
13216
|
|
|
13189
13217
|
unmute() {
|
|
13190
|
-
logger.info('unmute room');
|
|
13218
|
+
logger$c.info('unmute room');
|
|
13191
13219
|
|
|
13192
13220
|
Wazo.Phone.unmute(this.callSession);
|
|
13193
13221
|
|
|
@@ -13207,7 +13235,7 @@ class Room extends Emitter {
|
|
|
13207
13235
|
}
|
|
13208
13236
|
|
|
13209
13237
|
hold() {
|
|
13210
|
-
logger.info('hold room');
|
|
13238
|
+
logger$c.info('hold room');
|
|
13211
13239
|
|
|
13212
13240
|
Wazo.Phone.hold(this.callSession, true);
|
|
13213
13241
|
|
|
@@ -13217,7 +13245,7 @@ class Room extends Emitter {
|
|
|
13217
13245
|
}
|
|
13218
13246
|
|
|
13219
13247
|
async resume() {
|
|
13220
|
-
logger.info('resume room');
|
|
13248
|
+
logger$c.info('resume room');
|
|
13221
13249
|
|
|
13222
13250
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
13223
13251
|
|
|
@@ -13245,13 +13273,13 @@ class Room extends Emitter {
|
|
|
13245
13273
|
}
|
|
13246
13274
|
|
|
13247
13275
|
sendDTMF(tone ) {
|
|
13248
|
-
logger.info('send room DTMF', { tone });
|
|
13276
|
+
logger$c.info('send room DTMF', { tone });
|
|
13249
13277
|
|
|
13250
13278
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
13251
13279
|
}
|
|
13252
13280
|
|
|
13253
13281
|
async sendReinvite(newConstraints = null) {
|
|
13254
|
-
logger.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
13282
|
+
logger$c.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
13255
13283
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
13256
13284
|
|
|
13257
13285
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -13310,7 +13338,7 @@ class Room extends Emitter {
|
|
|
13310
13338
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
13311
13339
|
|
|
13312
13340
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
13313
|
-
logger.info('on room audio stream');
|
|
13341
|
+
logger$c.info('on room audio stream');
|
|
13314
13342
|
|
|
13315
13343
|
this.audioStream = stream;
|
|
13316
13344
|
if (!this.roomAudioElement) {
|
|
@@ -13323,7 +13351,7 @@ class Room extends Emitter {
|
|
|
13323
13351
|
});
|
|
13324
13352
|
|
|
13325
13353
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
13326
|
-
logger.info('on room video stream', { streamId });
|
|
13354
|
+
logger$c.info('on room video stream', { streamId });
|
|
13327
13355
|
|
|
13328
13356
|
this._mapMsid(sipSession.body.body);
|
|
13329
13357
|
|
|
@@ -13338,7 +13366,7 @@ class Room extends Emitter {
|
|
|
13338
13366
|
});
|
|
13339
13367
|
|
|
13340
13368
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
13341
|
-
logger.info('on room remove stream');
|
|
13369
|
+
logger$c.info('on room remove stream');
|
|
13342
13370
|
|
|
13343
13371
|
const participant = this.participants.find(someParticipant =>
|
|
13344
13372
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -13470,7 +13498,7 @@ class Room extends Emitter {
|
|
|
13470
13498
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
13471
13499
|
if (requester) {
|
|
13472
13500
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
13473
|
-
logger.info('trigger room requester status', { origin });
|
|
13501
|
+
logger$c.info('trigger room requester status', { origin });
|
|
13474
13502
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
13475
13503
|
}
|
|
13476
13504
|
break;
|
|
@@ -13501,24 +13529,24 @@ class Room extends Emitter {
|
|
|
13501
13529
|
|
|
13502
13530
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
13503
13531
|
if (participant.user_uuid === session.uuid) {
|
|
13504
|
-
logger.info('room current user joined');
|
|
13532
|
+
logger$c.info('room current user joined');
|
|
13505
13533
|
|
|
13506
13534
|
// Retrieve participants via an API calls
|
|
13507
13535
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
13508
13536
|
let response;
|
|
13509
13537
|
try {
|
|
13510
13538
|
if (this.meetingUuid) {
|
|
13511
|
-
logger.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
13539
|
+
logger$c.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
13512
13540
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
13513
13541
|
} else {
|
|
13514
|
-
logger.info('fetching conference participants', { conferenceId });
|
|
13542
|
+
logger$c.info('fetching conference participants', { conferenceId });
|
|
13515
13543
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
13516
13544
|
}
|
|
13517
13545
|
} catch (e) {
|
|
13518
|
-
logger.error('room participants fetching, error', e);
|
|
13546
|
+
logger$c.error('room participants fetching, error', e);
|
|
13519
13547
|
}
|
|
13520
13548
|
if (response) {
|
|
13521
|
-
logger.info('conference participants fetched', { nb: response.items.length });
|
|
13549
|
+
logger$c.info('conference participants fetched', { nb: response.items.length });
|
|
13522
13550
|
participants = response.items.map(item => {
|
|
13523
13551
|
const isMe = item.call_id === this.callId;
|
|
13524
13552
|
|
|
@@ -13545,7 +13573,7 @@ class Room extends Emitter {
|
|
|
13545
13573
|
? new Wazo.RemoteParticipant(this, participant)
|
|
13546
13574
|
: null;
|
|
13547
13575
|
|
|
13548
|
-
logger.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
13576
|
+
logger$c.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
13549
13577
|
|
|
13550
13578
|
if (remoteParticipant) {
|
|
13551
13579
|
this.participants.push(remoteParticipant);
|
|
@@ -13710,4 +13738,4 @@ class Room extends Emitter {
|
|
|
13710
13738
|
|
|
13711
13739
|
exports.SIGNAL_TYPE_PARTICIPANT_REQUEST = SIGNAL_TYPE_PARTICIPANT_REQUEST;
|
|
13712
13740
|
exports.SIGNAL_TYPE_PARTICIPANT_UPDATE = SIGNAL_TYPE_PARTICIPANT_UPDATE;
|
|
13713
|
-
exports.default = Room;
|
|
13741
|
+
exports.default = Room$1;
|