@wazo/sdk 0.37.24 → 0.37.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -58
- package/dist/wazo-sdk.js +6 -6
- package/esm/__tests__/api-client.test.js +14 -14
- package/esm/__tests__/web-rtc-client.test.js +130 -108
- package/esm/api/agentd.js +1 -1
- package/esm/api/amid.js +2 -2
- package/esm/api/application.js +1 -1
- package/esm/api/auth.js +1 -1
- package/esm/api/call-logd.js +3 -3
- package/esm/api/calld.js +1 -1
- package/esm/api/chatd.js +1 -1
- package/esm/api/confd.js +1 -1
- package/esm/api/ctid-ng.js +4 -4
- package/esm/api/dird.js +3 -3
- package/esm/api/webhookd.js +2 -2
- package/esm/api-client.js +14 -14
- package/esm/checker/Checker.js +155 -133
- package/esm/checker/checks/aor.js +14 -14
- package/esm/checker/checks/api.js +14 -14
- package/esm/checker/checks/index.js +145 -123
- package/esm/checker/checks/wazo-websocket.js +16 -16
- package/esm/checker/checks/webrtc-transport.js +130 -108
- package/esm/checker/checks/webrtc.js +130 -108
- package/esm/domain/AdHocAPIConference.js +14 -14
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/CallSession.js +15 -0
- package/esm/domain/Contact.js +2 -2
- package/esm/domain/Features.js +14 -14
- package/esm/domain/Phone/CTIPhone.js +43 -28
- package/esm/domain/Phone/WebRTCPhone.js +126 -90
- package/esm/domain/SFUNotAvailableError.js +9 -0
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/CallSession.test.js +15 -0
- package/esm/domain/__tests__/Contact.test.js +2 -2
- package/esm/domain/__tests__/IndirectTransfer.test.js +15 -0
- package/esm/domain/__tests__/Room.test.js +15 -0
- package/esm/index.js +415 -346
- package/esm/lib/WazoSessionDescriptionHandler.js +10 -5
- package/esm/service/CallApi.js +14 -14
- package/esm/service/IssueReporter.js +2 -2
- package/esm/service/__tests__/IssueReporter.test.js +2 -2
- package/esm/service/getApiClient.js +14 -14
- package/esm/simple/Auth.js +404 -336
- package/esm/simple/Configuration.js +404 -336
- package/esm/simple/Directory.js +14 -14
- package/esm/simple/Phone.js +404 -336
- package/esm/simple/Websocket.js +18 -18
- package/esm/simple/index.js +408 -340
- package/esm/simple/room/LocalParticipant.js +408 -340
- package/esm/simple/room/Participant.js +408 -340
- package/esm/simple/room/RemoteParticipant.js +408 -340
- package/esm/simple/room/Room.js +409 -341
- package/esm/simple/room/SipRoom.js +408 -340
- package/esm/simple/room/Stream.js +408 -340
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +408 -340
- package/esm/simple/utils.js +408 -340
- package/esm/utils/__tests__/api-requester.test.js +1 -1
- package/esm/utils/api-requester.js +1 -1
- package/esm/web-rtc-client.js +130 -108
- package/esm/websocket-client.js +16 -16
- package/lib/__tests__/api-client.test.js +14 -14
- package/lib/__tests__/web-rtc-client.test.js +130 -108
- package/lib/api/agentd.js +1 -1
- package/lib/api/amid.js +2 -2
- package/lib/api/application.js +1 -1
- package/lib/api/auth.js +1 -1
- package/lib/api/call-logd.js +3 -3
- package/lib/api/calld.js +1 -1
- package/lib/api/chatd.js +1 -1
- package/lib/api/confd.js +1 -1
- package/lib/api/ctid-ng.js +4 -4
- package/lib/api/dird.js +3 -3
- package/lib/api/webhookd.js +2 -2
- package/lib/api-client.js +14 -14
- package/lib/checker/Checker.js +155 -133
- package/lib/checker/checks/aor.js +14 -14
- package/lib/checker/checks/api.js +14 -14
- package/lib/checker/checks/index.js +145 -123
- package/lib/checker/checks/wazo-websocket.js +16 -16
- package/lib/checker/checks/webrtc-transport.js +130 -108
- package/lib/checker/checks/webrtc.js +130 -108
- package/lib/domain/AdHocAPIConference.js +14 -14
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/CallSession.js +15 -0
- package/lib/domain/Contact.js +2 -2
- package/lib/domain/Features.js +14 -14
- package/lib/domain/Phone/CTIPhone.js +43 -28
- package/lib/domain/Phone/WebRTCPhone.js +126 -89
- package/lib/domain/SFUNotAvailableError.js +11 -0
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/CallSession.test.js +15 -0
- package/lib/domain/__tests__/Contact.test.js +2 -2
- package/lib/domain/__tests__/IndirectTransfer.test.js +15 -0
- package/lib/domain/__tests__/Room.test.js +15 -0
- package/lib/index.js +415 -346
- package/lib/lib/WazoSessionDescriptionHandler.js +10 -5
- package/lib/service/CallApi.js +14 -14
- package/lib/service/IssueReporter.js +2 -2
- package/lib/service/__tests__/IssueReporter.test.js +2 -2
- package/lib/service/getApiClient.js +14 -14
- package/lib/simple/Auth.js +404 -336
- package/lib/simple/Configuration.js +404 -336
- package/lib/simple/Directory.js +14 -14
- package/lib/simple/Phone.js +404 -336
- package/lib/simple/Websocket.js +18 -18
- package/lib/simple/index.js +408 -340
- package/lib/simple/room/LocalParticipant.js +408 -340
- package/lib/simple/room/Participant.js +408 -340
- package/lib/simple/room/RemoteParticipant.js +408 -340
- package/lib/simple/room/Room.js +409 -341
- package/lib/simple/room/SipRoom.js +408 -340
- package/lib/simple/room/Stream.js +408 -340
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +408 -340
- package/lib/simple/utils.js +408 -340
- package/lib/utils/__tests__/api-requester.test.js +1 -1
- package/lib/utils/api-requester.js +1 -1
- package/lib/web-rtc-client.js +130 -108
- package/lib/websocket-client.js +16 -16
- package/package.json +1 -1
- package/src/domain/CallSession.js +16 -0
- package/src/domain/Contact.js +1 -1
- package/src/domain/Phone/WebRTCPhone.js +25 -4
- package/src/domain/SFUNotAvailableError.js +7 -0
- package/src/index.js +2 -0
- package/src/lib/WazoSessionDescriptionHandler.js +8 -3
- package/src/simple/Phone.js +2 -1
- package/src/simple/index.js +2 -0
- package/src/utils/api-requester.js +1 -1
- package/src/web-rtc-client.js +27 -10
|
@@ -1246,7 +1246,7 @@ class Contact {
|
|
|
1246
1246
|
this[key] = old[key] || this[key];
|
|
1247
1247
|
});
|
|
1248
1248
|
|
|
1249
|
-
if (old.lineState
|
|
1249
|
+
if (old.lineState) {
|
|
1250
1250
|
this.lineState = old.lineState;
|
|
1251
1251
|
}
|
|
1252
1252
|
|
|
@@ -1957,11 +1957,11 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
1957
1957
|
|
|
1958
1958
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
1959
1959
|
|
|
1960
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1960
|
+
const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1961
1961
|
|
|
1962
1962
|
// Use a function here to be able to mock it in tests
|
|
1963
1963
|
const realFetch = () => {
|
|
1964
|
-
if (typeof document !== 'undefined') {
|
|
1964
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
1965
1965
|
// Browser
|
|
1966
1966
|
return window.fetch;
|
|
1967
1967
|
}
|
|
@@ -2096,7 +2096,7 @@ class ApiRequester {
|
|
|
2096
2096
|
};
|
|
2097
2097
|
|
|
2098
2098
|
if (this.refreshTokenPromise) {
|
|
2099
|
-
logger.info('A token is already refreshing, waiting ...', { url });
|
|
2099
|
+
logger$c.info('A token is already refreshing, waiting ...', { url });
|
|
2100
2100
|
await this.refreshTokenPromise;
|
|
2101
2101
|
}
|
|
2102
2102
|
|
|
@@ -2116,7 +2116,7 @@ class ApiRequester {
|
|
|
2116
2116
|
return promise.then(async (err ) => {
|
|
2117
2117
|
// Check if the token is still valid
|
|
2118
2118
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
2119
|
-
logger.warn('token expired', { error: err.reason });
|
|
2119
|
+
logger$c.warn('token expired', { error: err.reason });
|
|
2120
2120
|
// Replay the call after refreshing the token
|
|
2121
2121
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
2122
2122
|
}
|
|
@@ -2126,7 +2126,7 @@ class ApiRequester {
|
|
|
2126
2126
|
: exceptionClass.fromResponse(err, response.status);
|
|
2127
2127
|
|
|
2128
2128
|
if (this.shouldLogErrors) {
|
|
2129
|
-
logger.error('API error', error);
|
|
2129
|
+
logger$c.error('API error', error);
|
|
2130
2130
|
}
|
|
2131
2131
|
|
|
2132
2132
|
throw error;
|
|
@@ -2136,7 +2136,7 @@ class ApiRequester {
|
|
|
2136
2136
|
return newParse(response, isJson);
|
|
2137
2137
|
}).catch(error => {
|
|
2138
2138
|
if (this.shouldLogErrors) {
|
|
2139
|
-
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2139
|
+
logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2140
2140
|
}
|
|
2141
2141
|
|
|
2142
2142
|
throw error;
|
|
@@ -2164,13 +2164,13 @@ class ApiRequester {
|
|
|
2164
2164
|
) {
|
|
2165
2165
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
2166
2166
|
let newPath = path;
|
|
2167
|
-
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2167
|
+
logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2168
2168
|
|
|
2169
2169
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
2170
2170
|
|
|
2171
2171
|
return this.refreshTokenPromise.then(() => {
|
|
2172
2172
|
this.refreshTokenPromise = null;
|
|
2173
|
-
logger.info('token refreshed', { isTokenNotFound });
|
|
2173
|
+
logger$c.info('token refreshed', { isTokenNotFound });
|
|
2174
2174
|
if (isTokenNotFound) {
|
|
2175
2175
|
const pathParts = path.split('/');
|
|
2176
2176
|
pathParts.pop();
|
|
@@ -3263,8 +3263,10 @@ var updateFrom = (instance , from ) => {
|
|
|
3263
3263
|
|
|
3264
3264
|
|
|
3265
3265
|
|
|
3266
|
+
|
|
3266
3267
|
|
|
3267
3268
|
|
|
3269
|
+
|
|
3268
3270
|
|
|
3269
3271
|
|
|
3270
3272
|
|
|
@@ -3281,6 +3283,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3281
3283
|
|
|
3282
3284
|
|
|
3283
3285
|
|
|
3286
|
+
|
|
3284
3287
|
|
|
3285
3288
|
|
|
3286
3289
|
class CallSession {
|
|
@@ -3300,8 +3303,12 @@ class CallSession {
|
|
|
3300
3303
|
|
|
3301
3304
|
|
|
3302
3305
|
|
|
3306
|
+
|
|
3307
|
+
|
|
3303
3308
|
|
|
3304
3309
|
|
|
3310
|
+
|
|
3311
|
+
|
|
3305
3312
|
|
|
3306
3313
|
|
|
3307
3314
|
|
|
@@ -3339,6 +3346,8 @@ class CallSession {
|
|
|
3339
3346
|
|
|
3340
3347
|
|
|
3341
3348
|
|
|
3349
|
+
|
|
3350
|
+
|
|
3342
3351
|
|
|
3343
3352
|
constructor({
|
|
3344
3353
|
answered,
|
|
@@ -3352,6 +3361,8 @@ class CallSession {
|
|
|
3352
3361
|
paused,
|
|
3353
3362
|
ringing,
|
|
3354
3363
|
startTime,
|
|
3364
|
+
creationTime,
|
|
3365
|
+
endTime,
|
|
3355
3366
|
cameraEnabled,
|
|
3356
3367
|
dialedExtension,
|
|
3357
3368
|
sipCallId,
|
|
@@ -3364,12 +3375,15 @@ class CallSession {
|
|
|
3364
3375
|
recording,
|
|
3365
3376
|
recordingPaused,
|
|
3366
3377
|
videoRemotelyDowngraded,
|
|
3378
|
+
sipSession,
|
|
3367
3379
|
} ) {
|
|
3368
3380
|
this.callId = callId;
|
|
3369
3381
|
this.sipCallId = sipCallId;
|
|
3370
3382
|
this.displayName = displayName;
|
|
3371
3383
|
this.number = number;
|
|
3384
|
+
this.creationTime = creationTime;
|
|
3372
3385
|
this.startTime = startTime;
|
|
3386
|
+
this.endTime = endTime;
|
|
3373
3387
|
this.isCaller = isCaller;
|
|
3374
3388
|
this.answered = answered;
|
|
3375
3389
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -3388,6 +3402,7 @@ class CallSession {
|
|
|
3388
3402
|
this.recording = recording || false;
|
|
3389
3403
|
this.recordingPaused = recordingPaused || false;
|
|
3390
3404
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3405
|
+
this.sipSession = sipSession;
|
|
3391
3406
|
|
|
3392
3407
|
// Useful to compare instead of instanceof with minified code
|
|
3393
3408
|
this.type = 'CallSession';
|
|
@@ -4063,7 +4078,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4063
4078
|
|
|
4064
4079
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4065
4080
|
|
|
4066
|
-
const logger$
|
|
4081
|
+
const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4067
4082
|
|
|
4068
4083
|
class CTIPhone extends Emitter {
|
|
4069
4084
|
|
|
@@ -4076,7 +4091,7 @@ class CTIPhone extends Emitter {
|
|
|
4076
4091
|
|
|
4077
4092
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4078
4093
|
super();
|
|
4079
|
-
logger$
|
|
4094
|
+
logger$b.info('CTI Phone created');
|
|
4080
4095
|
this.session = session;
|
|
4081
4096
|
this.isMobile = isMobile;
|
|
4082
4097
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4137,7 +4152,7 @@ class CTIPhone extends Emitter {
|
|
|
4137
4152
|
}
|
|
4138
4153
|
|
|
4139
4154
|
async makeCall(number , line ) {
|
|
4140
|
-
logger$
|
|
4155
|
+
logger$b.info('make CTI call', { number });
|
|
4141
4156
|
|
|
4142
4157
|
if (!number) {
|
|
4143
4158
|
return null;
|
|
@@ -4160,7 +4175,7 @@ class CTIPhone extends Emitter {
|
|
|
4160
4175
|
if (!callSession) {
|
|
4161
4176
|
return Promise.resolve(null);
|
|
4162
4177
|
}
|
|
4163
|
-
logger$
|
|
4178
|
+
logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4164
4179
|
|
|
4165
4180
|
if (!this.currentCall) {
|
|
4166
4181
|
this.currentCall = callSession.call;
|
|
@@ -4173,7 +4188,7 @@ class CTIPhone extends Emitter {
|
|
|
4173
4188
|
if (!callSession) {
|
|
4174
4189
|
return;
|
|
4175
4190
|
}
|
|
4176
|
-
logger$
|
|
4191
|
+
logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4177
4192
|
|
|
4178
4193
|
this.currentCall = undefined;
|
|
4179
4194
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4183,7 +4198,7 @@ class CTIPhone extends Emitter {
|
|
|
4183
4198
|
if (!callSession) {
|
|
4184
4199
|
return Promise.resolve(false);
|
|
4185
4200
|
}
|
|
4186
|
-
logger$
|
|
4201
|
+
logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4187
4202
|
|
|
4188
4203
|
try {
|
|
4189
4204
|
await CallApi.cancelCall(callSession);
|
|
@@ -4194,7 +4209,7 @@ class CTIPhone extends Emitter {
|
|
|
4194
4209
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4195
4210
|
return true;
|
|
4196
4211
|
} catch (e) {
|
|
4197
|
-
logger$
|
|
4212
|
+
logger$b.error('hangup CTI call, error', e);
|
|
4198
4213
|
|
|
4199
4214
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4200
4215
|
return false;
|
|
@@ -4207,7 +4222,7 @@ class CTIPhone extends Emitter {
|
|
|
4207
4222
|
if (!callSession) {
|
|
4208
4223
|
return;
|
|
4209
4224
|
}
|
|
4210
|
-
logger$
|
|
4225
|
+
logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4211
4226
|
|
|
4212
4227
|
await CallApi.cancelCall(callSession);
|
|
4213
4228
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4217,7 +4232,7 @@ class CTIPhone extends Emitter {
|
|
|
4217
4232
|
if (!callSession) {
|
|
4218
4233
|
return;
|
|
4219
4234
|
}
|
|
4220
|
-
logger$
|
|
4235
|
+
logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4221
4236
|
|
|
4222
4237
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4223
4238
|
}
|
|
@@ -4230,19 +4245,19 @@ class CTIPhone extends Emitter {
|
|
|
4230
4245
|
if (!callSession) {
|
|
4231
4246
|
return;
|
|
4232
4247
|
}
|
|
4233
|
-
logger$
|
|
4248
|
+
logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4234
4249
|
|
|
4235
4250
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4236
4251
|
}
|
|
4237
4252
|
|
|
4238
4253
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4239
|
-
logger$
|
|
4254
|
+
logger$b.info('cancel CTI transfer', { transferId });
|
|
4240
4255
|
|
|
4241
4256
|
return CallApi.cancelCallTransfer(transferId);
|
|
4242
4257
|
}
|
|
4243
4258
|
|
|
4244
4259
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4245
|
-
logger$
|
|
4260
|
+
logger$b.info('confirm CTI transfer', { transferId });
|
|
4246
4261
|
|
|
4247
4262
|
return CallApi.confirmCallTransfer(transferId);
|
|
4248
4263
|
}
|
|
@@ -4251,19 +4266,19 @@ class CTIPhone extends Emitter {
|
|
|
4251
4266
|
if (!callSession) {
|
|
4252
4267
|
return;
|
|
4253
4268
|
}
|
|
4254
|
-
logger$
|
|
4269
|
+
logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4255
4270
|
|
|
4256
4271
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4257
4272
|
}
|
|
4258
4273
|
|
|
4259
4274
|
onConnectionMade() {
|
|
4260
|
-
logger$
|
|
4275
|
+
logger$b.info('on CTI connection made');
|
|
4261
4276
|
|
|
4262
4277
|
this.eventEmitter.emit('onCallAccepted');
|
|
4263
4278
|
}
|
|
4264
4279
|
|
|
4265
4280
|
async close() {
|
|
4266
|
-
logger$
|
|
4281
|
+
logger$b.info('CTI close');
|
|
4267
4282
|
|
|
4268
4283
|
return Promise.resolve();
|
|
4269
4284
|
}
|
|
@@ -4272,7 +4287,7 @@ class CTIPhone extends Emitter {
|
|
|
4272
4287
|
if (!callSession) {
|
|
4273
4288
|
return;
|
|
4274
4289
|
}
|
|
4275
|
-
logger$
|
|
4290
|
+
logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4276
4291
|
|
|
4277
4292
|
return CallApi.hold(callSession.callId);
|
|
4278
4293
|
}
|
|
@@ -4281,7 +4296,7 @@ class CTIPhone extends Emitter {
|
|
|
4281
4296
|
if (!callSession) {
|
|
4282
4297
|
return;
|
|
4283
4298
|
}
|
|
4284
|
-
logger$
|
|
4299
|
+
logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4285
4300
|
|
|
4286
4301
|
return CallApi.resume(callSession.callId);
|
|
4287
4302
|
}
|
|
@@ -4290,7 +4305,7 @@ class CTIPhone extends Emitter {
|
|
|
4290
4305
|
if (!callSession) {
|
|
4291
4306
|
return;
|
|
4292
4307
|
}
|
|
4293
|
-
logger$
|
|
4308
|
+
logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4294
4309
|
|
|
4295
4310
|
return CallApi.mute(callSession.callId);
|
|
4296
4311
|
}
|
|
@@ -4299,7 +4314,7 @@ class CTIPhone extends Emitter {
|
|
|
4299
4314
|
if (!callSession) {
|
|
4300
4315
|
return;
|
|
4301
4316
|
}
|
|
4302
|
-
logger$
|
|
4317
|
+
logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4303
4318
|
|
|
4304
4319
|
return CallApi.unmute(callSession.callId);
|
|
4305
4320
|
}
|
|
@@ -5308,7 +5323,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5308
5323
|
const WEBHOOKD_VERSION = '1.0';
|
|
5309
5324
|
const AMID_VERSION = '1.0';
|
|
5310
5325
|
|
|
5311
|
-
const logger$
|
|
5326
|
+
const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5312
5327
|
|
|
5313
5328
|
class ApiClient {
|
|
5314
5329
|
|
|
@@ -5360,12 +5375,12 @@ class ApiClient {
|
|
|
5360
5375
|
}
|
|
5361
5376
|
|
|
5362
5377
|
async forceRefreshToken() {
|
|
5363
|
-
logger$
|
|
5378
|
+
logger$a.info('forcing refresh token, calling callback');
|
|
5364
5379
|
return this.refreshTokenCallback();
|
|
5365
5380
|
}
|
|
5366
5381
|
|
|
5367
5382
|
async refreshTokenCallback() {
|
|
5368
|
-
logger$
|
|
5383
|
+
logger$a.info('refresh token callback called', {
|
|
5369
5384
|
refreshToken: this.refreshToken,
|
|
5370
5385
|
refreshBackend: this.refreshBackend,
|
|
5371
5386
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5383,7 +5398,7 @@ class ApiClient {
|
|
|
5383
5398
|
this.isMobile,
|
|
5384
5399
|
);
|
|
5385
5400
|
|
|
5386
|
-
logger$
|
|
5401
|
+
logger$a.info('token refreshed', { token: session.token });
|
|
5387
5402
|
|
|
5388
5403
|
if (this.onRefreshToken) {
|
|
5389
5404
|
this.onRefreshToken(session.token, session);
|
|
@@ -5524,7 +5539,7 @@ var getApiClient = (forServer ) => {
|
|
|
5524
5539
|
class InvalidSubscription extends Error {}
|
|
5525
5540
|
class InvalidAuthorization extends Error {}
|
|
5526
5541
|
|
|
5527
|
-
const logger$
|
|
5542
|
+
const logger$9 = IssueReporter$1.loggerFor('simple-auth');
|
|
5528
5543
|
|
|
5529
5544
|
class Auth {
|
|
5530
5545
|
|
|
@@ -5559,7 +5574,7 @@ class Auth {
|
|
|
5559
5574
|
setApiClientId(this.clientId);
|
|
5560
5575
|
setRefreshExpiration(this.expiration);
|
|
5561
5576
|
setOnRefreshToken((token , session ) => {
|
|
5562
|
-
logger$
|
|
5577
|
+
logger$9.info('on refresh token done', { token });
|
|
5563
5578
|
setApiToken(token);
|
|
5564
5579
|
Wazo.Websocket.updateToken(token);
|
|
5565
5580
|
|
|
@@ -5604,7 +5619,7 @@ class Auth {
|
|
|
5604
5619
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
5605
5620
|
return this._onAuthenticated(rawSession);
|
|
5606
5621
|
} catch (e) {
|
|
5607
|
-
logger$
|
|
5622
|
+
logger$9.error('on validate token error', e);
|
|
5608
5623
|
console.warn(e);
|
|
5609
5624
|
return false;
|
|
5610
5625
|
}
|
|
@@ -5960,7 +5975,7 @@ class AdHocAPIConference {
|
|
|
5960
5975
|
|
|
5961
5976
|
/* */
|
|
5962
5977
|
|
|
5963
|
-
const parseCandidate = (candidate ) => {
|
|
5978
|
+
const parseCandidate$1 = (candidate ) => {
|
|
5964
5979
|
if (!candidate) {
|
|
5965
5980
|
return null;
|
|
5966
5981
|
}
|
|
@@ -6072,11 +6087,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6072
6087
|
|
|
6073
6088
|
// $FlowFixMe
|
|
6074
6089
|
setRemoteSessionDescription(sessionDescription ) {
|
|
6075
|
-
|
|
6090
|
+
try {
|
|
6091
|
+
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
6076
6092
|
|
|
6077
|
-
|
|
6093
|
+
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
6078
6094
|
|
|
6079
|
-
|
|
6095
|
+
return result;
|
|
6096
|
+
} catch (error) {
|
|
6097
|
+
this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
|
|
6098
|
+
throw error;
|
|
6099
|
+
}
|
|
6080
6100
|
}
|
|
6081
6101
|
|
|
6082
6102
|
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
@@ -6114,7 +6134,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6114
6134
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
6115
6135
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6116
6136
|
if (event.candidate) {
|
|
6117
|
-
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
6137
|
+
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6118
6138
|
}
|
|
6119
6139
|
};
|
|
6120
6140
|
|
|
@@ -6578,7 +6598,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6578
6598
|
const SEND_STATS_DELAY = 5000;
|
|
6579
6599
|
|
|
6580
6600
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6581
|
-
const logger$
|
|
6601
|
+
const logger$8 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6582
6602
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6583
6603
|
|
|
6584
6604
|
// events
|
|
@@ -6592,14 +6612,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6592
6612
|
const MESSAGE = 'message';
|
|
6593
6613
|
const ACCEPTED = 'accepted';
|
|
6594
6614
|
const REJECTED = 'rejected';
|
|
6595
|
-
const ON_TRACK = 'onTrack';
|
|
6596
|
-
const ON_REINVITE = 'reinvite';
|
|
6615
|
+
const ON_TRACK$1 = 'onTrack';
|
|
6616
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
6597
6617
|
const ON_ERROR = 'onError';
|
|
6598
6618
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6599
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6600
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
6619
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6620
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6601
6621
|
|
|
6602
|
-
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6622
|
+
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6603
6623
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6604
6624
|
class CanceledCallError extends Error {}
|
|
6605
6625
|
|
|
@@ -6735,12 +6755,12 @@ class WebRTCClient extends Emitter {
|
|
|
6735
6755
|
this.MESSAGE = MESSAGE;
|
|
6736
6756
|
this.ACCEPTED = ACCEPTED;
|
|
6737
6757
|
this.REJECTED = REJECTED;
|
|
6738
|
-
this.ON_TRACK = ON_TRACK;
|
|
6739
|
-
this.ON_REINVITE = ON_REINVITE;
|
|
6758
|
+
this.ON_TRACK = ON_TRACK$1;
|
|
6759
|
+
this.ON_REINVITE = ON_REINVITE$1;
|
|
6740
6760
|
this.ON_ERROR = ON_ERROR;
|
|
6741
6761
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6742
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6743
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6762
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6763
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6744
6764
|
}
|
|
6745
6765
|
|
|
6746
6766
|
configureMedia(media ) {
|
|
@@ -6757,13 +6777,13 @@ class WebRTCClient extends Emitter {
|
|
|
6757
6777
|
|
|
6758
6778
|
createUserAgent(configOverrides ) {
|
|
6759
6779
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6760
|
-
logger$
|
|
6780
|
+
logger$8.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6761
6781
|
|
|
6762
6782
|
webRTCConfiguration.delegate = {
|
|
6763
6783
|
onConnect: this.onConnect.bind(this),
|
|
6764
6784
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6765
6785
|
onInvite: (invitation ) => {
|
|
6766
|
-
logger$
|
|
6786
|
+
logger$8.info('sdk webrtc on invite', {
|
|
6767
6787
|
method: 'delegate.onInvite',
|
|
6768
6788
|
id: invitation.id,
|
|
6769
6789
|
remoteURI: invitation.remoteURI,
|
|
@@ -6806,7 +6826,7 @@ class WebRTCClient extends Emitter {
|
|
|
6806
6826
|
}
|
|
6807
6827
|
|
|
6808
6828
|
onConnect() {
|
|
6809
|
-
logger$
|
|
6829
|
+
logger$8.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6810
6830
|
this.eventEmitter.emit(CONNECTED);
|
|
6811
6831
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6812
6832
|
this.registerer.waitingToggle(false);
|
|
@@ -6815,7 +6835,7 @@ class WebRTCClient extends Emitter {
|
|
|
6815
6835
|
}
|
|
6816
6836
|
|
|
6817
6837
|
async onDisconnect(error ) {
|
|
6818
|
-
logger$
|
|
6838
|
+
logger$8.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6819
6839
|
this.connectionPromise = null;
|
|
6820
6840
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6821
6841
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6840,37 +6860,37 @@ class WebRTCClient extends Emitter {
|
|
|
6840
6860
|
};
|
|
6841
6861
|
|
|
6842
6862
|
if (this.skipRegister) {
|
|
6843
|
-
logger$
|
|
6863
|
+
logger$8.info('sdk webrtc skip register...', logInfo);
|
|
6844
6864
|
return Promise.resolve();
|
|
6845
6865
|
}
|
|
6846
6866
|
|
|
6847
|
-
logger$
|
|
6867
|
+
logger$8.info('sdk webrtc registering...', logInfo);
|
|
6848
6868
|
|
|
6849
6869
|
if (!this.userAgent) {
|
|
6850
|
-
logger$
|
|
6870
|
+
logger$8.info('sdk webrtc recreating User Agent');
|
|
6851
6871
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6852
6872
|
}
|
|
6853
6873
|
if (!this.userAgent || this.isRegistered()) {
|
|
6854
|
-
logger$
|
|
6874
|
+
logger$8.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6855
6875
|
return Promise.resolve();
|
|
6856
6876
|
}
|
|
6857
6877
|
|
|
6858
6878
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6859
|
-
logger$
|
|
6879
|
+
logger$8.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6860
6880
|
return Promise.resolve();
|
|
6861
6881
|
}
|
|
6862
6882
|
|
|
6863
6883
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6864
6884
|
|
|
6865
6885
|
const onRegisterFailed = () => {
|
|
6866
|
-
logger$
|
|
6886
|
+
logger$8.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6867
6887
|
this.connectionPromise = null;
|
|
6868
6888
|
if (this.registerer && this.registerer.waiting) {
|
|
6869
6889
|
this.registerer.waitingToggle(false);
|
|
6870
6890
|
}
|
|
6871
6891
|
|
|
6872
6892
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6873
|
-
logger$
|
|
6893
|
+
logger$8.info('sdk webrtc registering, retrying...', { tries });
|
|
6874
6894
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6875
6895
|
}
|
|
6876
6896
|
};
|
|
@@ -6879,18 +6899,18 @@ class WebRTCClient extends Emitter {
|
|
|
6879
6899
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6880
6900
|
// during the resolution of the primise.
|
|
6881
6901
|
if (!this.userAgent) {
|
|
6882
|
-
logger$
|
|
6902
|
+
logger$8.info('sdk webrtc recreating User Agent after connection');
|
|
6883
6903
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6884
6904
|
}
|
|
6885
6905
|
|
|
6886
|
-
logger$
|
|
6906
|
+
logger$8.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6887
6907
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
6888
6908
|
this.connectionPromise = null;
|
|
6889
6909
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6890
6910
|
|
|
6891
6911
|
// Bind registerer events
|
|
6892
6912
|
this.registerer.stateChange.addListener(newState => {
|
|
6893
|
-
logger$
|
|
6913
|
+
logger$8.info('sdk webrtc registering, state changed', { newState });
|
|
6894
6914
|
|
|
6895
6915
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
6896
6916
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -6903,7 +6923,7 @@ class WebRTCClient extends Emitter {
|
|
|
6903
6923
|
const options = {
|
|
6904
6924
|
requestDelegate: {
|
|
6905
6925
|
onReject: response => {
|
|
6906
|
-
logger$
|
|
6926
|
+
logger$8.error('sdk webrtc registering, rejected', { response });
|
|
6907
6927
|
|
|
6908
6928
|
onRegisterFailed();
|
|
6909
6929
|
},
|
|
@@ -6911,13 +6931,13 @@ class WebRTCClient extends Emitter {
|
|
|
6911
6931
|
};
|
|
6912
6932
|
|
|
6913
6933
|
return this.registerer.register(options).catch((e) => {
|
|
6914
|
-
logger$
|
|
6934
|
+
logger$8.error('sdk webrtc registering, error', e);
|
|
6915
6935
|
|
|
6916
6936
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6917
6937
|
return e;
|
|
6918
6938
|
});
|
|
6919
6939
|
}).catch(error => {
|
|
6920
|
-
logger$
|
|
6940
|
+
logger$8.error('sdk webrtc registering, transport error', error);
|
|
6921
6941
|
onRegisterFailed();
|
|
6922
6942
|
});
|
|
6923
6943
|
}
|
|
@@ -6946,21 +6966,21 @@ class WebRTCClient extends Emitter {
|
|
|
6946
6966
|
}
|
|
6947
6967
|
|
|
6948
6968
|
unregister() {
|
|
6949
|
-
logger$
|
|
6969
|
+
logger$8.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6950
6970
|
if (!this.registerer) {
|
|
6951
6971
|
return Promise.resolve();
|
|
6952
6972
|
}
|
|
6953
6973
|
|
|
6954
6974
|
try {
|
|
6955
6975
|
return this.registerer.unregister().then(() => {
|
|
6956
|
-
logger$
|
|
6976
|
+
logger$8.info('sdk webrtc unregistered');
|
|
6957
6977
|
this._cleanupRegister();
|
|
6958
6978
|
}).catch(e => {
|
|
6959
|
-
logger$
|
|
6979
|
+
logger$8.error('sdk webrtc unregistering, promise error', e);
|
|
6960
6980
|
this._cleanupRegister();
|
|
6961
6981
|
});
|
|
6962
6982
|
} catch (e) {
|
|
6963
|
-
logger$
|
|
6983
|
+
logger$8.error('sdk webrtc unregistering, error', e);
|
|
6964
6984
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6965
6985
|
// error when the registerer is in a bad state
|
|
6966
6986
|
this._cleanupRegister();
|
|
@@ -6968,7 +6988,7 @@ class WebRTCClient extends Emitter {
|
|
|
6968
6988
|
}
|
|
6969
6989
|
|
|
6970
6990
|
stop() {
|
|
6971
|
-
logger$
|
|
6991
|
+
logger$8.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6972
6992
|
if (!this.userAgent) {
|
|
6973
6993
|
return Promise.resolve();
|
|
6974
6994
|
}
|
|
@@ -6976,12 +6996,12 @@ class WebRTCClient extends Emitter {
|
|
|
6976
6996
|
return this.userAgent.stop().then(() => {
|
|
6977
6997
|
return this._cleanupRegister();
|
|
6978
6998
|
}).catch(e => {
|
|
6979
|
-
logger$
|
|
6999
|
+
logger$8.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6980
7000
|
});
|
|
6981
7001
|
}
|
|
6982
7002
|
|
|
6983
7003
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6984
|
-
logger$
|
|
7004
|
+
logger$8.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6985
7005
|
const inviterOptions = {
|
|
6986
7006
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6987
7007
|
conference,
|
|
@@ -7012,7 +7032,7 @@ class WebRTCClient extends Emitter {
|
|
|
7012
7032
|
this._onAccepted(session, response.session, true);
|
|
7013
7033
|
},
|
|
7014
7034
|
onReject: (response ) => {
|
|
7015
|
-
logger$
|
|
7035
|
+
logger$8.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
7016
7036
|
this._stopSendingStats(session);
|
|
7017
7037
|
this.stopNetworkMonitoring(session);
|
|
7018
7038
|
|
|
@@ -7035,11 +7055,11 @@ class WebRTCClient extends Emitter {
|
|
|
7035
7055
|
}
|
|
7036
7056
|
|
|
7037
7057
|
answer(session , enableVideo ) {
|
|
7038
|
-
logger$
|
|
7058
|
+
logger$8.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
7039
7059
|
|
|
7040
7060
|
if (!session || !session.accept) {
|
|
7041
7061
|
const error = 'No session to answer, or not an invitation';
|
|
7042
|
-
logger$
|
|
7062
|
+
logger$8.warn(error);
|
|
7043
7063
|
return Promise.reject(new Error(error));
|
|
7044
7064
|
}
|
|
7045
7065
|
const options = {
|
|
@@ -7049,15 +7069,15 @@ class WebRTCClient extends Emitter {
|
|
|
7049
7069
|
return session.accept(options).then(() => {
|
|
7050
7070
|
if (session.isCanceled) {
|
|
7051
7071
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
7052
|
-
logger$
|
|
7072
|
+
logger$8.error(message, { id: session.id });
|
|
7053
7073
|
this.onCallEnded(session);
|
|
7054
7074
|
|
|
7055
7075
|
throw new CanceledCallError(message);
|
|
7056
7076
|
}
|
|
7057
|
-
logger$
|
|
7077
|
+
logger$8.info('sdk webrtc answer, accepted.');
|
|
7058
7078
|
this._onAccepted(session);
|
|
7059
7079
|
}).catch(e => {
|
|
7060
|
-
logger$
|
|
7080
|
+
logger$8.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
7061
7081
|
|
|
7062
7082
|
throw e;
|
|
7063
7083
|
});
|
|
@@ -7065,7 +7085,7 @@ class WebRTCClient extends Emitter {
|
|
|
7065
7085
|
|
|
7066
7086
|
hangup(session ) {
|
|
7067
7087
|
const { state, id } = session;
|
|
7068
|
-
logger$
|
|
7088
|
+
logger$8.info('sdk webrtc hangup call', { id, state });
|
|
7069
7089
|
|
|
7070
7090
|
try {
|
|
7071
7091
|
this._stopSendingStats(session);
|
|
@@ -7094,7 +7114,7 @@ class WebRTCClient extends Emitter {
|
|
|
7094
7114
|
|
|
7095
7115
|
return bye();
|
|
7096
7116
|
} catch (error) {
|
|
7097
|
-
logger$
|
|
7117
|
+
logger$8.warn('sdk webrtc hangup, error', error);
|
|
7098
7118
|
}
|
|
7099
7119
|
|
|
7100
7120
|
return null;
|
|
@@ -7112,7 +7132,7 @@ class WebRTCClient extends Emitter {
|
|
|
7112
7132
|
// Fetch and emit an event at `interval` with session network stats
|
|
7113
7133
|
startNetworkMonitoring(session , interval = 1000) {
|
|
7114
7134
|
const sessionId = this.getSipSessionId(session);
|
|
7115
|
-
logger$
|
|
7135
|
+
logger$8.info('starting network inspection', { id: sessionId });
|
|
7116
7136
|
|
|
7117
7137
|
this.sessionNetworkStats[sessionId] = [];
|
|
7118
7138
|
|
|
@@ -7122,7 +7142,7 @@ class WebRTCClient extends Emitter {
|
|
|
7122
7142
|
stopNetworkMonitoring(session ) {
|
|
7123
7143
|
const sessionId = this.getSipSessionId(session);
|
|
7124
7144
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
7125
|
-
logger$
|
|
7145
|
+
logger$8.info('stopping network inspection', { id: sessionId, exists });
|
|
7126
7146
|
|
|
7127
7147
|
if (exists) {
|
|
7128
7148
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -7132,17 +7152,17 @@ class WebRTCClient extends Emitter {
|
|
|
7132
7152
|
}
|
|
7133
7153
|
|
|
7134
7154
|
reject(session ) {
|
|
7135
|
-
logger$
|
|
7155
|
+
logger$8.info('sdk webrtc reject call', { id: session.id });
|
|
7136
7156
|
|
|
7137
7157
|
try {
|
|
7138
7158
|
return session.reject ? session.reject() : session.cancel();
|
|
7139
7159
|
} catch (e) {
|
|
7140
|
-
logger$
|
|
7160
|
+
logger$8.warn('Error when rejecting call', e.message, e.stack);
|
|
7141
7161
|
}
|
|
7142
7162
|
}
|
|
7143
7163
|
|
|
7144
7164
|
async close() {
|
|
7145
|
-
logger$
|
|
7165
|
+
logger$8.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
7146
7166
|
this._cleanupMedia();
|
|
7147
7167
|
this.connectionPromise = null;
|
|
7148
7168
|
|
|
@@ -7173,7 +7193,7 @@ class WebRTCClient extends Emitter {
|
|
|
7173
7193
|
// eg: "INVITE not rejectable in state Completed"
|
|
7174
7194
|
}
|
|
7175
7195
|
this.userAgent = null;
|
|
7176
|
-
logger$
|
|
7196
|
+
logger$8.info('sdk webrtc client closed');
|
|
7177
7197
|
}
|
|
7178
7198
|
|
|
7179
7199
|
getNumber(session ) {
|
|
@@ -7186,13 +7206,13 @@ class WebRTCClient extends Emitter {
|
|
|
7186
7206
|
}
|
|
7187
7207
|
|
|
7188
7208
|
mute(session ) {
|
|
7189
|
-
logger$
|
|
7209
|
+
logger$8.info('sdk webrtc mute', { id: session.id });
|
|
7190
7210
|
|
|
7191
7211
|
this._toggleAudio(session, true);
|
|
7192
7212
|
}
|
|
7193
7213
|
|
|
7194
7214
|
unmute(session ) {
|
|
7195
|
-
logger$
|
|
7215
|
+
logger$8.info('sdk webrtc unmute', { id: session.id });
|
|
7196
7216
|
|
|
7197
7217
|
this._toggleAudio(session, false);
|
|
7198
7218
|
}
|
|
@@ -7232,13 +7252,13 @@ class WebRTCClient extends Emitter {
|
|
|
7232
7252
|
}
|
|
7233
7253
|
|
|
7234
7254
|
toggleCameraOn(session ) {
|
|
7235
|
-
logger$
|
|
7255
|
+
logger$8.info('sdk webrtc toggle camera on', { id: session.id });
|
|
7236
7256
|
|
|
7237
7257
|
this._toggleVideo(session, false);
|
|
7238
7258
|
}
|
|
7239
7259
|
|
|
7240
7260
|
toggleCameraOff(session ) {
|
|
7241
|
-
logger$
|
|
7261
|
+
logger$8.info('sdk webrtc toggle camera off', { id: session.id });
|
|
7242
7262
|
|
|
7243
7263
|
this._toggleVideo(session, true);
|
|
7244
7264
|
}
|
|
@@ -7247,7 +7267,7 @@ class WebRTCClient extends Emitter {
|
|
|
7247
7267
|
const sessionId = this.getSipSessionId(session);
|
|
7248
7268
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
7249
7269
|
|
|
7250
|
-
logger$
|
|
7270
|
+
logger$8.info('sdk webrtc hold', {
|
|
7251
7271
|
sessionId,
|
|
7252
7272
|
keys: Object.keys(this.heldSessions),
|
|
7253
7273
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7296,7 +7316,7 @@ class WebRTCClient extends Emitter {
|
|
|
7296
7316
|
const sessionId = this.getSipSessionId(session);
|
|
7297
7317
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7298
7318
|
|
|
7299
|
-
logger$
|
|
7319
|
+
logger$8.info('sdk webrtc unhold', {
|
|
7300
7320
|
sessionId,
|
|
7301
7321
|
keys: Object.keys(this.heldSessions),
|
|
7302
7322
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7444,7 +7464,7 @@ class WebRTCClient extends Emitter {
|
|
|
7444
7464
|
if (!session.sessionDescriptionHandler) {
|
|
7445
7465
|
return;
|
|
7446
7466
|
}
|
|
7447
|
-
logger$
|
|
7467
|
+
logger$8.info('Sending DTMF', {
|
|
7448
7468
|
id: this.getSipSessionId(session),
|
|
7449
7469
|
tone,
|
|
7450
7470
|
});
|
|
@@ -7460,7 +7480,7 @@ class WebRTCClient extends Emitter {
|
|
|
7460
7480
|
transfer(session , target ) {
|
|
7461
7481
|
this.hold(session);
|
|
7462
7482
|
|
|
7463
|
-
logger$
|
|
7483
|
+
logger$8.info('Transfering a session', {
|
|
7464
7484
|
id: this.getSipSessionId(session),
|
|
7465
7485
|
target,
|
|
7466
7486
|
});
|
|
@@ -7482,17 +7502,17 @@ class WebRTCClient extends Emitter {
|
|
|
7482
7502
|
atxfer(session ) {
|
|
7483
7503
|
this.hold(session);
|
|
7484
7504
|
|
|
7485
|
-
logger$
|
|
7505
|
+
logger$8.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7486
7506
|
|
|
7487
7507
|
const result = {
|
|
7488
7508
|
newSession: null,
|
|
7489
7509
|
init: async (target ) => {
|
|
7490
|
-
logger$
|
|
7510
|
+
logger$8.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7491
7511
|
|
|
7492
7512
|
result.newSession = await this.call(target);
|
|
7493
7513
|
},
|
|
7494
7514
|
complete: () => {
|
|
7495
|
-
logger$
|
|
7515
|
+
logger$8.info('webrtc transfer completed', {
|
|
7496
7516
|
id: this.getSipSessionId(session),
|
|
7497
7517
|
referId: this.getSipSessionId(result.newSession),
|
|
7498
7518
|
});
|
|
@@ -7513,7 +7533,7 @@ class WebRTCClient extends Emitter {
|
|
|
7513
7533
|
return;
|
|
7514
7534
|
}
|
|
7515
7535
|
|
|
7516
|
-
logger$
|
|
7536
|
+
logger$8.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7517
7537
|
|
|
7518
7538
|
try {
|
|
7519
7539
|
sipSession.message({
|
|
@@ -7555,7 +7575,7 @@ class WebRTCClient extends Emitter {
|
|
|
7555
7575
|
}
|
|
7556
7576
|
|
|
7557
7577
|
changeAudioOutputVolume(volume ) {
|
|
7558
|
-
logger$
|
|
7578
|
+
logger$8.info('Changing audio output volume', { volume });
|
|
7559
7579
|
|
|
7560
7580
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7561
7581
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7567,7 +7587,7 @@ class WebRTCClient extends Emitter {
|
|
|
7567
7587
|
}
|
|
7568
7588
|
|
|
7569
7589
|
changeAudioOutputDevice(id ) {
|
|
7570
|
-
logger$
|
|
7590
|
+
logger$8.info('Changing audio output device', { id });
|
|
7571
7591
|
|
|
7572
7592
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7573
7593
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7584,7 +7604,7 @@ class WebRTCClient extends Emitter {
|
|
|
7584
7604
|
|
|
7585
7605
|
changeAudioInputDevice(id , session ) {
|
|
7586
7606
|
const currentId = this.getAudioDeviceId();
|
|
7587
|
-
logger$
|
|
7607
|
+
logger$8.info('setting audio input device', { id, currentId, session: !!session });
|
|
7588
7608
|
|
|
7589
7609
|
if (id === currentId) {
|
|
7590
7610
|
return null;
|
|
@@ -7630,7 +7650,7 @@ class WebRTCClient extends Emitter {
|
|
|
7630
7650
|
|
|
7631
7651
|
setVideoInputDevice(id ) {
|
|
7632
7652
|
const currentId = this.getVideoDeviceId();
|
|
7633
|
-
logger$
|
|
7653
|
+
logger$8.info('setting video input device', { id, currentId });
|
|
7634
7654
|
|
|
7635
7655
|
if (id === currentId) {
|
|
7636
7656
|
return null;
|
|
@@ -7655,7 +7675,7 @@ class WebRTCClient extends Emitter {
|
|
|
7655
7675
|
const sessionId = this.getSipSessionId(session);
|
|
7656
7676
|
const localStream = this.getLocalStream(sessionId);
|
|
7657
7677
|
|
|
7658
|
-
logger$
|
|
7678
|
+
logger$8.info('changing video input device', { id, sessionId });
|
|
7659
7679
|
|
|
7660
7680
|
// Release old video stream
|
|
7661
7681
|
if (localStream) {
|
|
@@ -7723,7 +7743,7 @@ class WebRTCClient extends Emitter {
|
|
|
7723
7743
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7724
7744
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7725
7745
|
|
|
7726
|
-
logger$
|
|
7746
|
+
logger$8.info('Sending reinvite', {
|
|
7727
7747
|
id: this.getSipSessionId(sipSession),
|
|
7728
7748
|
newConstraints,
|
|
7729
7749
|
conference,
|
|
@@ -7761,7 +7781,7 @@ class WebRTCClient extends Emitter {
|
|
|
7761
7781
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7762
7782
|
}
|
|
7763
7783
|
|
|
7764
|
-
logger$
|
|
7784
|
+
logger$8.info('on re-INVITE accepted', {
|
|
7765
7785
|
id: this.getSipSessionId(sipSession),
|
|
7766
7786
|
wasMuted,
|
|
7767
7787
|
shouldDoScreenSharing,
|
|
@@ -7779,7 +7799,7 @@ class WebRTCClient extends Emitter {
|
|
|
7779
7799
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7780
7800
|
}
|
|
7781
7801
|
|
|
7782
|
-
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7802
|
+
return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
|
|
7783
7803
|
},
|
|
7784
7804
|
},
|
|
7785
7805
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7936,7 +7956,7 @@ class WebRTCClient extends Emitter {
|
|
|
7936
7956
|
}
|
|
7937
7957
|
|
|
7938
7958
|
startHeartbeat() {
|
|
7939
|
-
logger$
|
|
7959
|
+
logger$8.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7940
7960
|
if (!this.userAgent) {
|
|
7941
7961
|
this.heartbeat.stop();
|
|
7942
7962
|
return;
|
|
@@ -7949,7 +7969,7 @@ class WebRTCClient extends Emitter {
|
|
|
7949
7969
|
}
|
|
7950
7970
|
|
|
7951
7971
|
stopHeartbeat() {
|
|
7952
|
-
logger$
|
|
7972
|
+
logger$8.info('sdk webrtc stop heartbeat');
|
|
7953
7973
|
this.heartbeat.stop();
|
|
7954
7974
|
}
|
|
7955
7975
|
|
|
@@ -7970,7 +7990,7 @@ class WebRTCClient extends Emitter {
|
|
|
7970
7990
|
}
|
|
7971
7991
|
|
|
7972
7992
|
attemptReconnection() {
|
|
7973
|
-
logger$
|
|
7993
|
+
logger$8.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7974
7994
|
if (!this.userAgent) {
|
|
7975
7995
|
return;
|
|
7976
7996
|
}
|
|
@@ -7995,7 +8015,7 @@ class WebRTCClient extends Emitter {
|
|
|
7995
8015
|
return;
|
|
7996
8016
|
}
|
|
7997
8017
|
|
|
7998
|
-
logger$
|
|
8018
|
+
logger$8.info('setting local media stream', {
|
|
7999
8019
|
sipSessionId,
|
|
8000
8020
|
tracks: newStream ? newStream.getTracks() : null,
|
|
8001
8021
|
});
|
|
@@ -8012,7 +8032,7 @@ class WebRTCClient extends Emitter {
|
|
|
8012
8032
|
|
|
8013
8033
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
8014
8034
|
|
|
8015
|
-
logger$
|
|
8035
|
+
logger$8.info('updating local stream', {
|
|
8016
8036
|
sipSessionId,
|
|
8017
8037
|
oldStream: !!oldStream,
|
|
8018
8038
|
tracks: newStream.getTracks(),
|
|
@@ -8032,7 +8052,7 @@ class WebRTCClient extends Emitter {
|
|
|
8032
8052
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
8033
8053
|
const pc = this.getPeerConnection(sessionId);
|
|
8034
8054
|
|
|
8035
|
-
logger$
|
|
8055
|
+
logger$8.info('Updating remote stream', {
|
|
8036
8056
|
sessionId,
|
|
8037
8057
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
8038
8058
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -8057,14 +8077,16 @@ class WebRTCClient extends Emitter {
|
|
|
8057
8077
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
8058
8078
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
8059
8079
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
8080
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
8060
8081
|
|
|
8061
|
-
logger$
|
|
8082
|
+
logger$8.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
8062
8083
|
|
|
8063
8084
|
return {
|
|
8064
8085
|
constraints: {
|
|
8065
8086
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
8066
8087
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
8067
|
-
video: screenSharing ? (isDesktop
|
|
8088
|
+
video: screenSharing ? (isDesktop
|
|
8089
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
8068
8090
|
: this._getVideoConstraints(enableVideo),
|
|
8069
8091
|
screen: screenSharing,
|
|
8070
8092
|
desktop: isDesktop,
|
|
@@ -8107,7 +8129,7 @@ class WebRTCClient extends Emitter {
|
|
|
8107
8129
|
}
|
|
8108
8130
|
|
|
8109
8131
|
_onTransportError() {
|
|
8110
|
-
logger$
|
|
8132
|
+
logger$8.error('on transport error');
|
|
8111
8133
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
8112
8134
|
this.attemptReconnection();
|
|
8113
8135
|
}
|
|
@@ -8116,7 +8138,7 @@ class WebRTCClient extends Emitter {
|
|
|
8116
8138
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
8117
8139
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
8118
8140
|
if (this.hasHeartbeat()) {
|
|
8119
|
-
logger$
|
|
8141
|
+
logger$8.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
8120
8142
|
|
|
8121
8143
|
this.heartbeat.onHeartbeat();
|
|
8122
8144
|
if (this.heartbeatCb) {
|
|
@@ -8127,7 +8149,7 @@ class WebRTCClient extends Emitter {
|
|
|
8127
8149
|
}
|
|
8128
8150
|
|
|
8129
8151
|
async _onHeartbeatTimeout() {
|
|
8130
|
-
logger$
|
|
8152
|
+
logger$8.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
8131
8153
|
|
|
8132
8154
|
if (this.heartbeatTimeoutCb) {
|
|
8133
8155
|
this.heartbeatTimeoutCb();
|
|
@@ -8139,7 +8161,7 @@ class WebRTCClient extends Emitter {
|
|
|
8139
8161
|
try {
|
|
8140
8162
|
await this.userAgent.transport.disconnect();
|
|
8141
8163
|
} catch (e) {
|
|
8142
|
-
logger$
|
|
8164
|
+
logger$8.error('Transport disconnection after heartbeat timeout, error', e);
|
|
8143
8165
|
}
|
|
8144
8166
|
}
|
|
8145
8167
|
|
|
@@ -8172,31 +8194,31 @@ class WebRTCClient extends Emitter {
|
|
|
8172
8194
|
}
|
|
8173
8195
|
|
|
8174
8196
|
_connectIfNeeded() {
|
|
8175
|
-
logger$
|
|
8197
|
+
logger$8.info('connect if needed, checking', { connected: this.isConnected() });
|
|
8176
8198
|
if (!this.userAgent) {
|
|
8177
|
-
logger$
|
|
8199
|
+
logger$8.info('need to recreate User Agent');
|
|
8178
8200
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
8179
8201
|
}
|
|
8180
8202
|
|
|
8181
8203
|
if (this.isConnected()) {
|
|
8182
|
-
logger$
|
|
8204
|
+
logger$8.info('webrtc sdk, already connected');
|
|
8183
8205
|
return Promise.resolve();
|
|
8184
8206
|
}
|
|
8185
8207
|
|
|
8186
8208
|
if (this.isConnecting()) {
|
|
8187
|
-
logger$
|
|
8209
|
+
logger$8.info('webrtc sdk, already connecting...');
|
|
8188
8210
|
|
|
8189
8211
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
8190
8212
|
return this.connectionPromise;
|
|
8191
8213
|
}
|
|
8192
8214
|
|
|
8193
8215
|
if (this.connectionPromise) {
|
|
8194
|
-
logger$
|
|
8216
|
+
logger$8.info('webrtc sdk, connection promise connecting...');
|
|
8195
8217
|
// $FlowFixMe
|
|
8196
8218
|
return this.connectionPromise;
|
|
8197
8219
|
}
|
|
8198
8220
|
|
|
8199
|
-
logger$
|
|
8221
|
+
logger$8.info('WebRTC UA needs to connect');
|
|
8200
8222
|
|
|
8201
8223
|
// Force UA to reconnect
|
|
8202
8224
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -8321,7 +8343,7 @@ class WebRTCClient extends Emitter {
|
|
|
8321
8343
|
|
|
8322
8344
|
sdh.peerConnectionDelegate = {
|
|
8323
8345
|
onicecandidateerror: (error ) => {
|
|
8324
|
-
logger$
|
|
8346
|
+
logger$8.error('on icecandidate error', {
|
|
8325
8347
|
address: error.address,
|
|
8326
8348
|
port: error.port,
|
|
8327
8349
|
errorCode: error.errorCode,
|
|
@@ -8350,7 +8372,7 @@ class WebRTCClient extends Emitter {
|
|
|
8350
8372
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8351
8373
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8352
8374
|
}
|
|
8353
|
-
logger$
|
|
8375
|
+
logger$8.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8354
8376
|
|
|
8355
8377
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8356
8378
|
|
|
@@ -8366,12 +8388,12 @@ class WebRTCClient extends Emitter {
|
|
|
8366
8388
|
|
|
8367
8389
|
this._setupMedias(session);
|
|
8368
8390
|
|
|
8369
|
-
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8391
|
+
return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8370
8392
|
};
|
|
8371
8393
|
}
|
|
8372
8394
|
|
|
8373
8395
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8374
|
-
logger$
|
|
8396
|
+
logger$8.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8375
8397
|
|
|
8376
8398
|
this.storeSipSession(session);
|
|
8377
8399
|
|
|
@@ -8383,14 +8405,14 @@ class WebRTCClient extends Emitter {
|
|
|
8383
8405
|
const onTrack = (event ) => {
|
|
8384
8406
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8385
8407
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8386
|
-
logger$
|
|
8408
|
+
logger$8.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8387
8409
|
|
|
8388
8410
|
// Stop video track in audio only mode
|
|
8389
8411
|
if (isAudioOnly && kind === 'video') {
|
|
8390
8412
|
event.track.stop();
|
|
8391
8413
|
}
|
|
8392
8414
|
|
|
8393
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8415
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
8394
8416
|
};
|
|
8395
8417
|
|
|
8396
8418
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8399,12 +8421,14 @@ class WebRTCClient extends Emitter {
|
|
|
8399
8421
|
|
|
8400
8422
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8401
8423
|
|
|
8402
|
-
|
|
8403
|
-
|
|
8404
|
-
|
|
8405
|
-
|
|
8406
|
-
|
|
8407
|
-
|
|
8424
|
+
if (pc) {
|
|
8425
|
+
pc.oniceconnectionstatechange = () => {
|
|
8426
|
+
logger$8.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8427
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8428
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8429
|
+
}
|
|
8430
|
+
};
|
|
8431
|
+
}
|
|
8408
8432
|
|
|
8409
8433
|
if (withEvent) {
|
|
8410
8434
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8573,10 +8597,10 @@ class WebRTCClient extends Emitter {
|
|
|
8573
8597
|
|
|
8574
8598
|
_stopSendingStats(session ) {
|
|
8575
8599
|
const sessionId = this.getSipSessionId(session);
|
|
8576
|
-
logger$
|
|
8600
|
+
logger$8.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8577
8601
|
|
|
8578
8602
|
if (sessionId in this.statsIntervals) {
|
|
8579
|
-
logger$
|
|
8603
|
+
logger$8.trace('Stop sending stats for call', { sessionId });
|
|
8580
8604
|
this.statsIntervals[sessionId]();
|
|
8581
8605
|
delete this.statsIntervals[sessionId];
|
|
8582
8606
|
}
|
|
@@ -8592,7 +8616,7 @@ class WebRTCClient extends Emitter {
|
|
|
8592
8616
|
try {
|
|
8593
8617
|
await this.userAgent.transport.disconnect();
|
|
8594
8618
|
} catch (e) {
|
|
8595
|
-
logger$
|
|
8619
|
+
logger$8.error('WebRTC transport disconnect, error', e);
|
|
8596
8620
|
}
|
|
8597
8621
|
}
|
|
8598
8622
|
}
|
|
@@ -8614,13 +8638,17 @@ class WebRTCClient extends Emitter {
|
|
|
8614
8638
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8615
8639
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8616
8640
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8641
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8617
8642
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8618
8643
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8644
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8619
8645
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8620
8646
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8621
8647
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8622
|
-
let audioBytesSent = 0;
|
|
8623
|
-
let audioBytesReceived = 0;
|
|
8648
|
+
let audioBytesSent = 0; // content + header
|
|
8649
|
+
let audioBytesReceived = 0; // content + header
|
|
8650
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8651
|
+
let audioContentReceived = 0;
|
|
8624
8652
|
let videoBytesSent = 0;
|
|
8625
8653
|
let videoBytesReceived = 0;
|
|
8626
8654
|
let transportSent = 0;
|
|
@@ -8630,6 +8658,7 @@ class WebRTCClient extends Emitter {
|
|
|
8630
8658
|
stats.forEach(report => {
|
|
8631
8659
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8632
8660
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8661
|
+
audioContentSent += Number(report.bytesSent);
|
|
8633
8662
|
}
|
|
8634
8663
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8635
8664
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -8641,6 +8670,7 @@ class WebRTCClient extends Emitter {
|
|
|
8641
8670
|
packetsLost += Number(report.packetsLost);
|
|
8642
8671
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8643
8672
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8673
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8644
8674
|
}
|
|
8645
8675
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8646
8676
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -8669,10 +8699,17 @@ class WebRTCClient extends Emitter {
|
|
|
8669
8699
|
});
|
|
8670
8700
|
|
|
8671
8701
|
networkStats.packetsLost = packetsLost;
|
|
8702
|
+
|
|
8672
8703
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8673
8704
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8674
8705
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8675
8706
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8707
|
+
|
|
8708
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8709
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8710
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8711
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8712
|
+
|
|
8676
8713
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8677
8714
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8678
8715
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8686,7 +8723,7 @@ class WebRTCClient extends Emitter {
|
|
|
8686
8723
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8687
8724
|
+ networkStats.transportSent;
|
|
8688
8725
|
|
|
8689
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8726
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8690
8727
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8691
8728
|
}
|
|
8692
8729
|
|
|
@@ -8711,11 +8748,12 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8711
8748
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8712
8749
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8713
8750
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8751
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8714
8752
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8715
8753
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8716
8754
|
const ON_MESSAGE = 'onMessage';
|
|
8717
|
-
const ON_REINVITE
|
|
8718
|
-
const ON_TRACK
|
|
8755
|
+
const ON_REINVITE = 'reinvite';
|
|
8756
|
+
const ON_TRACK = 'onTrack';
|
|
8719
8757
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8720
8758
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8721
8759
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8730,15 +8768,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8730
8768
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8731
8769
|
const ON_CALL_ERROR = 'onCallError';
|
|
8732
8770
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8733
|
-
const ON_NETWORK_STATS
|
|
8771
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8734
8772
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8735
8773
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8736
|
-
const ON_DISCONNECTED
|
|
8774
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
8737
8775
|
|
|
8738
8776
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8739
8777
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8740
8778
|
|
|
8741
|
-
const events
|
|
8779
|
+
const events = [
|
|
8742
8780
|
ON_USER_AGENT,
|
|
8743
8781
|
ON_REGISTERED,
|
|
8744
8782
|
ON_UNREGISTERED,
|
|
@@ -8755,9 +8793,10 @@ const events$1 = [
|
|
|
8755
8793
|
ON_CAMERA_DISABLED,
|
|
8756
8794
|
ON_CALL_FAILED,
|
|
8757
8795
|
ON_CALL_ENDED,
|
|
8796
|
+
ON_CALL_REJECTED,
|
|
8758
8797
|
ON_MESSAGE,
|
|
8759
|
-
ON_REINVITE
|
|
8760
|
-
ON_TRACK
|
|
8798
|
+
ON_REINVITE,
|
|
8799
|
+
ON_TRACK,
|
|
8761
8800
|
ON_AUDIO_STREAM,
|
|
8762
8801
|
ON_VIDEO_STREAM,
|
|
8763
8802
|
ON_REMOVE_STREAM,
|
|
@@ -8772,11 +8811,11 @@ const events$1 = [
|
|
|
8772
8811
|
ON_CALL_ERROR,
|
|
8773
8812
|
ON_CHAT,
|
|
8774
8813
|
ON_SIGNAL,
|
|
8775
|
-
ON_NETWORK_STATS
|
|
8776
|
-
ON_DISCONNECTED
|
|
8814
|
+
ON_NETWORK_STATS,
|
|
8815
|
+
ON_DISCONNECTED,
|
|
8777
8816
|
];
|
|
8778
8817
|
|
|
8779
|
-
const logger$
|
|
8818
|
+
const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8780
8819
|
|
|
8781
8820
|
class WebRTCPhone extends Emitter {
|
|
8782
8821
|
|
|
@@ -8849,7 +8888,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8849
8888
|
}).catch(error => {
|
|
8850
8889
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8851
8890
|
console.error('register error', error, error.message, error.stack);
|
|
8852
|
-
logger$
|
|
8891
|
+
logger$7.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8853
8892
|
});
|
|
8854
8893
|
}
|
|
8855
8894
|
|
|
@@ -8864,7 +8903,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8864
8903
|
if (!this.client) {
|
|
8865
8904
|
return;
|
|
8866
8905
|
}
|
|
8867
|
-
logger$
|
|
8906
|
+
logger$7.info('WebRTC phone stop');
|
|
8868
8907
|
this.client.stop();
|
|
8869
8908
|
}
|
|
8870
8909
|
|
|
@@ -8879,11 +8918,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8879
8918
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8880
8919
|
audioOnly = false, iceRestart = false) {
|
|
8881
8920
|
const sipSession = this.findSipSession(callSession);
|
|
8882
|
-
logger$
|
|
8921
|
+
logger$7.info('WebRTC phone - send reinvite', {
|
|
8883
8922
|
sessionId: sipSession ? sipSession.id : null,
|
|
8884
8923
|
constraints,
|
|
8885
8924
|
audioOnly,
|
|
8886
8925
|
conference,
|
|
8926
|
+
iceRestart,
|
|
8887
8927
|
});
|
|
8888
8928
|
|
|
8889
8929
|
if (!sipSession) {
|
|
@@ -8916,7 +8956,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8916
8956
|
}
|
|
8917
8957
|
|
|
8918
8958
|
startHeartbeat() {
|
|
8919
|
-
logger$
|
|
8959
|
+
logger$7.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8920
8960
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8921
8961
|
return;
|
|
8922
8962
|
}
|
|
@@ -8925,7 +8965,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8925
8965
|
}
|
|
8926
8966
|
|
|
8927
8967
|
stopHeartbeat() {
|
|
8928
|
-
logger$
|
|
8968
|
+
logger$7.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8929
8969
|
if (!this.client) {
|
|
8930
8970
|
return;
|
|
8931
8971
|
}
|
|
@@ -8942,7 +8982,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8942
8982
|
}
|
|
8943
8983
|
|
|
8944
8984
|
reconnect() {
|
|
8945
|
-
logger$
|
|
8985
|
+
logger$7.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8946
8986
|
if (!this.client) {
|
|
8947
8987
|
return;
|
|
8948
8988
|
}
|
|
@@ -8983,7 +9023,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8983
9023
|
return false;
|
|
8984
9024
|
}
|
|
8985
9025
|
|
|
8986
|
-
logger$
|
|
9026
|
+
logger$7.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8987
9027
|
|
|
8988
9028
|
this.client.downgradeToAudio(sipSession);
|
|
8989
9029
|
|
|
@@ -9006,7 +9046,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9006
9046
|
return Promise.resolve(false);
|
|
9007
9047
|
}
|
|
9008
9048
|
|
|
9009
|
-
logger$
|
|
9049
|
+
logger$7.info('Upgrade to video', {
|
|
9010
9050
|
id: callSession ? callSession.getId() : null,
|
|
9011
9051
|
constraints,
|
|
9012
9052
|
isConference,
|
|
@@ -9046,7 +9086,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9046
9086
|
|
|
9047
9087
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
9048
9088
|
const sipSession = this.findSipSession(callSession);
|
|
9049
|
-
logger$
|
|
9089
|
+
logger$7.info('Sending reinvite message', {
|
|
9050
9090
|
id: callSession ? callSession.getId() : null,
|
|
9051
9091
|
isUpgrade,
|
|
9052
9092
|
});
|
|
@@ -9072,7 +9112,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9072
9112
|
// Monkey patch to know when canceled with the CANCEL message
|
|
9073
9113
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
9074
9114
|
sipSession._onCancel = (message ) => {
|
|
9075
|
-
logger$
|
|
9115
|
+
logger$7.trace('on sip session canceled', { callId: message.callId });
|
|
9076
9116
|
|
|
9077
9117
|
onCancel(message);
|
|
9078
9118
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -9100,16 +9140,17 @@ class WebRTCPhone extends Emitter {
|
|
|
9100
9140
|
this.audioOutputVolume,
|
|
9101
9141
|
);
|
|
9102
9142
|
case sessionState.SessionState.Terminating:
|
|
9103
|
-
logger$
|
|
9143
|
+
logger$7.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
9104
9144
|
|
|
9105
9145
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
9106
9146
|
|
|
9107
9147
|
break;
|
|
9108
9148
|
case sessionState.SessionState.Terminated: {
|
|
9109
|
-
logger$
|
|
9149
|
+
logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9110
9150
|
|
|
9111
9151
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9112
9152
|
const callSession = this._createCallSession(sipSession);
|
|
9153
|
+
callSession.endTime = new Date();
|
|
9113
9154
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9114
9155
|
|
|
9115
9156
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -9128,7 +9169,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9128
9169
|
const [stream] = event.streams;
|
|
9129
9170
|
const kind = event && event.track && event.track.kind;
|
|
9130
9171
|
|
|
9131
|
-
logger$
|
|
9172
|
+
logger$7.info('on track stream called on the peer connection', {
|
|
9132
9173
|
callId: this.getSipSessionId(sipSession),
|
|
9133
9174
|
streamId: stream ? stream.id : null,
|
|
9134
9175
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -9148,7 +9189,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9148
9189
|
};
|
|
9149
9190
|
|
|
9150
9191
|
peerConnection.onremovestream = event => {
|
|
9151
|
-
logger$
|
|
9192
|
+
logger$7.info('on remove stream called on the peer connection', {
|
|
9152
9193
|
id: event.stream.id,
|
|
9153
9194
|
tracks: event.stream.getTracks(),
|
|
9154
9195
|
});
|
|
@@ -9158,7 +9199,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9158
9199
|
}
|
|
9159
9200
|
|
|
9160
9201
|
async startScreenSharing(constraints , callSession ) {
|
|
9161
|
-
logger$
|
|
9202
|
+
logger$7.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
9162
9203
|
|
|
9163
9204
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
9164
9205
|
if (!screenShareStream) {
|
|
@@ -9198,7 +9239,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9198
9239
|
return;
|
|
9199
9240
|
}
|
|
9200
9241
|
|
|
9201
|
-
logger$
|
|
9242
|
+
logger$7.info('WebRTC phone - stop screen sharing', {
|
|
9202
9243
|
restoreLocalStream,
|
|
9203
9244
|
});
|
|
9204
9245
|
|
|
@@ -9254,7 +9295,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9254
9295
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
9255
9296
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9256
9297
|
|
|
9257
|
-
logger$
|
|
9298
|
+
logger$7.info('WebRTC phone - on screensharing', {
|
|
9258
9299
|
hadVideo,
|
|
9259
9300
|
id: this.getSipSessionId(sipSession),
|
|
9260
9301
|
screenTrack,
|
|
@@ -9262,7 +9303,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9262
9303
|
|
|
9263
9304
|
if (screenTrack) {
|
|
9264
9305
|
screenTrack.onended = () => {
|
|
9265
|
-
logger$
|
|
9306
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9266
9307
|
hadVideo,
|
|
9267
9308
|
id: this.getSipSessionId(sipSession),
|
|
9268
9309
|
screenTrack,
|
|
@@ -9293,7 +9334,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9293
9334
|
}
|
|
9294
9335
|
|
|
9295
9336
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9296
|
-
logger$
|
|
9337
|
+
logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9297
9338
|
|
|
9298
9339
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9299
9340
|
this.currentSipSession = sipSession;
|
|
@@ -9311,7 +9352,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9311
9352
|
}
|
|
9312
9353
|
|
|
9313
9354
|
changeAudioDevice(id ) {
|
|
9314
|
-
logger$
|
|
9355
|
+
logger$7.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9315
9356
|
this.audioOutputDeviceId = id;
|
|
9316
9357
|
this.client.changeAudioOutputDevice(id);
|
|
9317
9358
|
}
|
|
@@ -9321,14 +9362,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9321
9362
|
}
|
|
9322
9363
|
|
|
9323
9364
|
changeRingDevice(id ) {
|
|
9324
|
-
logger$
|
|
9365
|
+
logger$7.info('WebRTC phone - changing ring device', { id });
|
|
9325
9366
|
|
|
9326
9367
|
this.audioRingDeviceId = id;
|
|
9327
9368
|
}
|
|
9328
9369
|
|
|
9329
9370
|
// volume is a value between 0 and 1
|
|
9330
9371
|
changeAudioVolume(volume ) {
|
|
9331
|
-
logger$
|
|
9372
|
+
logger$7.info('WebRTC phone - changing audio volume', { volume });
|
|
9332
9373
|
|
|
9333
9374
|
this.audioOutputVolume = volume;
|
|
9334
9375
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9336,32 +9377,33 @@ class WebRTCPhone extends Emitter {
|
|
|
9336
9377
|
|
|
9337
9378
|
// volume is a value between 0 and 1
|
|
9338
9379
|
changeRingVolume(volume ) {
|
|
9339
|
-
logger$
|
|
9380
|
+
logger$7.info('WebRTC phone - changing ring volume', { volume });
|
|
9340
9381
|
|
|
9341
9382
|
this.audioRingVolume = volume;
|
|
9342
9383
|
}
|
|
9343
9384
|
|
|
9344
9385
|
changeAudioInputDevice(id ) {
|
|
9345
|
-
logger$
|
|
9386
|
+
logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9346
9387
|
|
|
9347
9388
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9348
9389
|
}
|
|
9349
9390
|
|
|
9350
9391
|
changeVideoInputDevice(id ) {
|
|
9351
|
-
logger$
|
|
9392
|
+
logger$7.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9352
9393
|
|
|
9353
9394
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9354
9395
|
}
|
|
9355
9396
|
|
|
9356
9397
|
changeSessionVideoInputDevice(id ) {
|
|
9357
|
-
logger$
|
|
9398
|
+
logger$7.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9358
9399
|
|
|
9359
9400
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9360
9401
|
}
|
|
9361
9402
|
|
|
9362
9403
|
_onCallTerminated(sipSession ) {
|
|
9363
|
-
logger$
|
|
9404
|
+
logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9364
9405
|
|
|
9406
|
+
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9365
9407
|
const callSession = this._createCallSession(sipSession);
|
|
9366
9408
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
9367
9409
|
const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
|
|
@@ -9379,7 +9421,6 @@ class WebRTCPhone extends Emitter {
|
|
|
9379
9421
|
}, 5);
|
|
9380
9422
|
}
|
|
9381
9423
|
|
|
9382
|
-
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9383
9424
|
if (sipSessionId) {
|
|
9384
9425
|
this.removeIncomingSessions(sipSessionId);
|
|
9385
9426
|
}
|
|
@@ -9394,7 +9435,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9394
9435
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9395
9436
|
|
|
9396
9437
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9397
|
-
logger$
|
|
9438
|
+
logger$7.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9398
9439
|
sipId: sipSession.id,
|
|
9399
9440
|
shouldRetrigger,
|
|
9400
9441
|
hasIncomingCallSession,
|
|
@@ -9485,37 +9526,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9485
9526
|
|
|
9486
9527
|
// Deprecated
|
|
9487
9528
|
getLocalStreamForCall(callSession ) {
|
|
9488
|
-
logger$
|
|
9529
|
+
logger$7.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9489
9530
|
|
|
9490
9531
|
return this.getLocalStream(callSession);
|
|
9491
9532
|
}
|
|
9492
9533
|
|
|
9493
9534
|
// Deprecated
|
|
9494
9535
|
getRemoteStreamForCall(callSession ) {
|
|
9495
|
-
logger$
|
|
9536
|
+
logger$7.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9496
9537
|
|
|
9497
9538
|
return this.getRemoteVideoStream(callSession);
|
|
9498
9539
|
}
|
|
9499
9540
|
|
|
9500
9541
|
getRemoteStreamsForCall(callSession ) {
|
|
9501
|
-
logger$
|
|
9542
|
+
logger$7.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9502
9543
|
|
|
9503
9544
|
return this.getRemoteStream(callSession);
|
|
9504
9545
|
}
|
|
9505
9546
|
|
|
9506
9547
|
accept(callSession , cameraEnabled ) {
|
|
9507
|
-
logger$
|
|
9548
|
+
logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9508
9549
|
if (this.currentSipSession) {
|
|
9509
9550
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9510
9551
|
}
|
|
9511
9552
|
|
|
9512
9553
|
if (!callSession) {
|
|
9513
|
-
logger$
|
|
9554
|
+
logger$7.warn('no CallSession to accept.');
|
|
9514
9555
|
return Promise.resolve(null);
|
|
9515
9556
|
}
|
|
9516
9557
|
|
|
9517
9558
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9518
|
-
logger$
|
|
9559
|
+
logger$7.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9519
9560
|
return Promise.resolve(callSession.sipCallId);
|
|
9520
9561
|
}
|
|
9521
9562
|
|
|
@@ -9527,24 +9568,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9527
9568
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9528
9569
|
if (sipSession) {
|
|
9529
9570
|
if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
|
|
9530
|
-
logger$
|
|
9571
|
+
logger$7.warn('Trying to answer a terminated sipSession.');
|
|
9531
9572
|
|
|
9532
9573
|
return Promise.resolve(null);
|
|
9533
9574
|
}
|
|
9534
9575
|
|
|
9535
|
-
logger$
|
|
9576
|
+
logger$7.info('accept call, session found', { sipId: sipSession.id });
|
|
9536
9577
|
|
|
9537
9578
|
// $FlowFixMe
|
|
9538
9579
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9539
9580
|
return callSession.sipCallId;
|
|
9540
9581
|
}).catch(e => {
|
|
9541
|
-
logger$
|
|
9582
|
+
logger$7.error(e);
|
|
9542
9583
|
this.endCurrentCall(callSession);
|
|
9543
9584
|
throw e;
|
|
9544
9585
|
});
|
|
9545
9586
|
}
|
|
9546
9587
|
|
|
9547
|
-
logger$
|
|
9588
|
+
logger$7.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9548
9589
|
|
|
9549
9590
|
return Promise.resolve(null);
|
|
9550
9591
|
}
|
|
@@ -9554,7 +9595,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9554
9595
|
}
|
|
9555
9596
|
|
|
9556
9597
|
async reject(callSession ) {
|
|
9557
|
-
logger$
|
|
9598
|
+
logger$7.info('reject WebRTC called', { id: callSession.getId() });
|
|
9558
9599
|
|
|
9559
9600
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9560
9601
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9566,14 +9607,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9566
9607
|
|
|
9567
9608
|
const sipSession = this.findSipSession(callSession);
|
|
9568
9609
|
if (sipSession) {
|
|
9569
|
-
logger$
|
|
9610
|
+
logger$7.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9570
9611
|
|
|
9571
9612
|
this.client.hangup(sipSession);
|
|
9572
9613
|
}
|
|
9573
9614
|
}
|
|
9574
9615
|
|
|
9575
9616
|
async ignore(callSession ) {
|
|
9576
|
-
logger$
|
|
9617
|
+
logger$7.info('WebRTC ignore', { id: callSession.getId() });
|
|
9577
9618
|
|
|
9578
9619
|
// kill the ring
|
|
9579
9620
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9585,14 +9626,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9585
9626
|
const sipSession = this.findSipSession(callSession);
|
|
9586
9627
|
|
|
9587
9628
|
if (sipSession) {
|
|
9588
|
-
logger$
|
|
9629
|
+
logger$7.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9589
9630
|
|
|
9590
9631
|
return this.client.atxfer(sipSession);
|
|
9591
9632
|
}
|
|
9592
9633
|
}
|
|
9593
9634
|
|
|
9594
9635
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9595
|
-
logger$
|
|
9636
|
+
logger$7.info('WebRTC hold', { id: callSession.getId() });
|
|
9596
9637
|
|
|
9597
9638
|
const sipSession = this.findSipSession(callSession);
|
|
9598
9639
|
|
|
@@ -9607,18 +9648,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9607
9648
|
}
|
|
9608
9649
|
|
|
9609
9650
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9610
|
-
logger$
|
|
9651
|
+
logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9611
9652
|
|
|
9612
9653
|
const sipSession = this.findSipSession(callSession);
|
|
9613
9654
|
if (!sipSession) {
|
|
9614
9655
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9615
9656
|
}
|
|
9616
9657
|
|
|
9617
|
-
logger$
|
|
9658
|
+
logger$7.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9618
9659
|
|
|
9619
9660
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9620
9661
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9621
|
-
logger$
|
|
9662
|
+
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9622
9663
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9623
9664
|
}
|
|
9624
9665
|
|
|
@@ -9643,7 +9684,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9643
9684
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9644
9685
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9645
9686
|
|
|
9646
|
-
logger$
|
|
9687
|
+
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9647
9688
|
|
|
9648
9689
|
// Stop screenshre if needed
|
|
9649
9690
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9674,7 +9715,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9674
9715
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9675
9716
|
}
|
|
9676
9717
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9677
|
-
logger$
|
|
9718
|
+
logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9678
9719
|
|
|
9679
9720
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9680
9721
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9718,14 +9759,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9718
9759
|
}
|
|
9719
9760
|
|
|
9720
9761
|
mute(callSession , withEvent = true) {
|
|
9721
|
-
logger$
|
|
9762
|
+
logger$7.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9722
9763
|
|
|
9723
9764
|
const sipSession = this.findSipSession(callSession);
|
|
9724
9765
|
if (!sipSession) {
|
|
9725
9766
|
return;
|
|
9726
9767
|
}
|
|
9727
9768
|
|
|
9728
|
-
logger$
|
|
9769
|
+
logger$7.info('WebRTC muting', { sipId: sipSession.id });
|
|
9729
9770
|
this.client.mute(sipSession);
|
|
9730
9771
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9731
9772
|
|
|
@@ -9739,14 +9780,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9739
9780
|
}
|
|
9740
9781
|
|
|
9741
9782
|
unmute(callSession , withEvent = true) {
|
|
9742
|
-
logger$
|
|
9783
|
+
logger$7.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9743
9784
|
|
|
9744
9785
|
const sipSession = this.findSipSession(callSession);
|
|
9745
9786
|
if (!sipSession) {
|
|
9746
9787
|
return;
|
|
9747
9788
|
}
|
|
9748
9789
|
|
|
9749
|
-
logger$
|
|
9790
|
+
logger$7.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9750
9791
|
this.client.unmute(sipSession);
|
|
9751
9792
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9752
9793
|
|
|
@@ -9773,7 +9814,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9773
9814
|
if (!sipSession) {
|
|
9774
9815
|
return;
|
|
9775
9816
|
}
|
|
9776
|
-
logger$
|
|
9817
|
+
logger$7.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9777
9818
|
|
|
9778
9819
|
this.client.toggleCameraOn(sipSession);
|
|
9779
9820
|
|
|
@@ -9785,7 +9826,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9785
9826
|
if (!sipSession) {
|
|
9786
9827
|
return;
|
|
9787
9828
|
}
|
|
9788
|
-
logger$
|
|
9829
|
+
logger$7.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9789
9830
|
|
|
9790
9831
|
this.client.toggleCameraOff(sipSession);
|
|
9791
9832
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9797,7 +9838,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9797
9838
|
return;
|
|
9798
9839
|
}
|
|
9799
9840
|
|
|
9800
|
-
logger$
|
|
9841
|
+
logger$7.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9801
9842
|
this.client.sendDTMF(sipSession, tone);
|
|
9802
9843
|
}
|
|
9803
9844
|
|
|
@@ -9805,7 +9846,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9805
9846
|
// @TODO: line is not used here
|
|
9806
9847
|
async makeCall(number , line , cameraEnabled ,
|
|
9807
9848
|
audioOnly = false, conference = false) {
|
|
9808
|
-
logger$
|
|
9849
|
+
logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
9809
9850
|
if (!number) {
|
|
9810
9851
|
return Promise.resolve(null);
|
|
9811
9852
|
}
|
|
@@ -9815,7 +9856,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9815
9856
|
}
|
|
9816
9857
|
if (this.currentSipSession) {
|
|
9817
9858
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9818
|
-
logger$
|
|
9859
|
+
logger$7.warn('Unable to hold current session when making another call', e);
|
|
9819
9860
|
});
|
|
9820
9861
|
}
|
|
9821
9862
|
|
|
@@ -9825,10 +9866,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9825
9866
|
this._bindEvents(sipSession);
|
|
9826
9867
|
} catch (error) {
|
|
9827
9868
|
console.warn(error);
|
|
9828
|
-
logger$
|
|
9869
|
+
logger$7.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9829
9870
|
return Promise.resolve(null);
|
|
9830
9871
|
}
|
|
9831
9872
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9873
|
+
callSession.creationTime = new Date();
|
|
9832
9874
|
|
|
9833
9875
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9834
9876
|
|
|
@@ -9853,7 +9895,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9853
9895
|
return;
|
|
9854
9896
|
}
|
|
9855
9897
|
|
|
9856
|
-
logger$
|
|
9898
|
+
logger$7.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9857
9899
|
|
|
9858
9900
|
this.client.transfer(sipSession, target);
|
|
9859
9901
|
}
|
|
@@ -9862,7 +9904,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9862
9904
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9863
9905
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9864
9906
|
|
|
9865
|
-
logger$
|
|
9907
|
+
logger$7.info('WebRTC indirect transfer', {
|
|
9866
9908
|
sipId: sipSession ? sipSession.id : null,
|
|
9867
9909
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9868
9910
|
});
|
|
@@ -9901,7 +9943,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9901
9943
|
return false;
|
|
9902
9944
|
}
|
|
9903
9945
|
|
|
9904
|
-
logger$
|
|
9946
|
+
logger$7.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9905
9947
|
|
|
9906
9948
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9907
9949
|
|
|
@@ -9947,7 +9989,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9947
9989
|
endCurrentCall(callSession ) {
|
|
9948
9990
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9949
9991
|
|
|
9950
|
-
logger$
|
|
9992
|
+
logger$7.info('Ending current call', {
|
|
9951
9993
|
id: callSession ? callSession.getId() : null,
|
|
9952
9994
|
isCurrent,
|
|
9953
9995
|
});
|
|
@@ -9971,7 +10013,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9971
10013
|
}
|
|
9972
10014
|
|
|
9973
10015
|
async close() {
|
|
9974
|
-
logger$
|
|
10016
|
+
logger$7.info('WebRTC close');
|
|
9975
10017
|
|
|
9976
10018
|
try {
|
|
9977
10019
|
await Promise.race([
|
|
@@ -9979,7 +10021,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9979
10021
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9980
10022
|
]);
|
|
9981
10023
|
} catch (e) {
|
|
9982
|
-
logger$
|
|
10024
|
+
logger$7.error('WebRTC close, unregister error', e);
|
|
9983
10025
|
}
|
|
9984
10026
|
|
|
9985
10027
|
this.client.close();
|
|
@@ -9997,12 +10039,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9997
10039
|
}
|
|
9998
10040
|
|
|
9999
10041
|
enableRinging() {
|
|
10000
|
-
logger$
|
|
10042
|
+
logger$7.info('WebRTC enable ringing');
|
|
10001
10043
|
this.ringingEnabled = true;
|
|
10002
10044
|
}
|
|
10003
10045
|
|
|
10004
10046
|
disableRinging() {
|
|
10005
|
-
logger$
|
|
10047
|
+
logger$7.info('WebRTC disable ringing');
|
|
10006
10048
|
this.ringingEnabled = false;
|
|
10007
10049
|
}
|
|
10008
10050
|
|
|
@@ -10024,8 +10066,12 @@ class WebRTCPhone extends Emitter {
|
|
|
10024
10066
|
}
|
|
10025
10067
|
|
|
10026
10068
|
const sessionId = this.incomingSessions[0];
|
|
10069
|
+
const sipSession = this.client.getSipSession(sessionId);
|
|
10070
|
+
if (!sipSession) {
|
|
10071
|
+
return null;
|
|
10072
|
+
}
|
|
10027
10073
|
|
|
10028
|
-
return this._createCallSession(
|
|
10074
|
+
return this._createCallSession(sipSession);
|
|
10029
10075
|
}
|
|
10030
10076
|
|
|
10031
10077
|
sendMessage(sipSession = null, body , contentType = 'text/plain') {
|
|
@@ -10042,7 +10088,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10042
10088
|
|
|
10043
10089
|
// Deprecated
|
|
10044
10090
|
getLocalMediaStream(callSession ) {
|
|
10045
|
-
logger$
|
|
10091
|
+
logger$7.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
10046
10092
|
return this.getLocalStream(callSession);
|
|
10047
10093
|
}
|
|
10048
10094
|
|
|
@@ -10084,7 +10130,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10084
10130
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
10085
10131
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
10086
10132
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
10087
|
-
logger$
|
|
10133
|
+
logger$7.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
10088
10134
|
|
|
10089
10135
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
10090
10136
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -10103,11 +10149,12 @@ class WebRTCPhone extends Emitter {
|
|
|
10103
10149
|
callSession);
|
|
10104
10150
|
}
|
|
10105
10151
|
|
|
10152
|
+
callSession.creationTime = new Date();
|
|
10106
10153
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
10107
10154
|
});
|
|
10108
10155
|
|
|
10109
10156
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
10110
|
-
logger$
|
|
10157
|
+
logger$7.info('WebRTC on reinvite', {
|
|
10111
10158
|
sessionId: args[0].id,
|
|
10112
10159
|
inviteId: args[1].id,
|
|
10113
10160
|
updatedCalleeName: args[2],
|
|
@@ -10127,7 +10174,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10127
10174
|
});
|
|
10128
10175
|
|
|
10129
10176
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
10130
|
-
logger$
|
|
10177
|
+
logger$7.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
10131
10178
|
|
|
10132
10179
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
10133
10180
|
|
|
@@ -10138,22 +10185,29 @@ class WebRTCPhone extends Emitter {
|
|
|
10138
10185
|
this.client.on('ended', () => {});
|
|
10139
10186
|
|
|
10140
10187
|
this.client.on(this.client.ON_ERROR, e => {
|
|
10141
|
-
logger$
|
|
10188
|
+
logger$7.error('WebRTC error', e);
|
|
10142
10189
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10143
10190
|
});
|
|
10144
10191
|
|
|
10192
|
+
this.client.on(this.client.REJECTED, session => {
|
|
10193
|
+
logger$7.info('WebRTC call rejected', session.id);
|
|
10194
|
+
const callSession = this._createCallSession(session);
|
|
10195
|
+
callSession.endTime = new Date();
|
|
10196
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
10197
|
+
});
|
|
10198
|
+
|
|
10145
10199
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10146
|
-
logger$
|
|
10200
|
+
logger$7.info('WebRTC unregistered');
|
|
10147
10201
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10148
10202
|
});
|
|
10149
10203
|
|
|
10150
10204
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
10151
|
-
logger$
|
|
10152
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
10205
|
+
logger$7.info('WebRTC disconnected');
|
|
10206
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10153
10207
|
});
|
|
10154
10208
|
|
|
10155
10209
|
this.client.on(this.client.REGISTERED, () => {
|
|
10156
|
-
logger$
|
|
10210
|
+
logger$7.info('WebRTC registered', {
|
|
10157
10211
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
10158
10212
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
10159
10213
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -10174,19 +10228,19 @@ class WebRTCPhone extends Emitter {
|
|
|
10174
10228
|
// Send reinvite with iceRestart
|
|
10175
10229
|
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10176
10230
|
} catch (e) {
|
|
10177
|
-
logger$
|
|
10231
|
+
logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10178
10232
|
}
|
|
10179
10233
|
}
|
|
10180
10234
|
});
|
|
10181
10235
|
|
|
10182
10236
|
this.client.on(this.client.CONNECTED, () => {
|
|
10183
|
-
logger$
|
|
10237
|
+
logger$7.info('WebRTC client connected');
|
|
10184
10238
|
|
|
10185
10239
|
this.stopHeartbeat();
|
|
10186
10240
|
});
|
|
10187
10241
|
|
|
10188
10242
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
10189
|
-
logger$
|
|
10243
|
+
logger$7.info('WebRTC client disconnected');
|
|
10190
10244
|
|
|
10191
10245
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10192
10246
|
|
|
@@ -10200,7 +10254,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10200
10254
|
});
|
|
10201
10255
|
|
|
10202
10256
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
10203
|
-
this.eventEmitter.emit(ON_TRACK
|
|
10257
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
10204
10258
|
});
|
|
10205
10259
|
|
|
10206
10260
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -10215,7 +10269,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10215
10269
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
10216
10270
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
10217
10271
|
|
|
10218
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
10272
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
10219
10273
|
});
|
|
10220
10274
|
|
|
10221
10275
|
// Used when upgrading directly in screenshare mode
|
|
@@ -10224,7 +10278,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10224
10278
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
10225
10279
|
const callSession = this.callSessions[sipSessionId];
|
|
10226
10280
|
|
|
10227
|
-
logger$
|
|
10281
|
+
logger$7.info('Updrading directly in screensharing mode', {
|
|
10228
10282
|
sipSessionId,
|
|
10229
10283
|
tracks: localStream ? localStream.getTracks() : null,
|
|
10230
10284
|
});
|
|
@@ -10354,6 +10408,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10354
10408
|
const number = identity ? identity.uri._normal.user : null;
|
|
10355
10409
|
const { state } = sipSession || {};
|
|
10356
10410
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10411
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10357
10412
|
|
|
10358
10413
|
const callSession = new CallSession({
|
|
10359
10414
|
callId: fromSession && fromSession.callId,
|
|
@@ -10361,6 +10416,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10361
10416
|
sipStatus: state,
|
|
10362
10417
|
displayName: identity ? identity.displayName || number : number,
|
|
10363
10418
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10419
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10420
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10364
10421
|
answered: state === sessionState.SessionState.Established,
|
|
10365
10422
|
paused: this.client.isCallHeld(sipSession),
|
|
10366
10423
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10371,6 +10428,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10371
10428
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10372
10429
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10373
10430
|
recordingPaused: false, // @TODO
|
|
10431
|
+
sipSession,
|
|
10374
10432
|
...extra,
|
|
10375
10433
|
});
|
|
10376
10434
|
|
|
@@ -10399,11 +10457,12 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10399
10457
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10400
10458
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10401
10459
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10460
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10402
10461
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10403
10462
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10404
10463
|
ON_MESSAGE: ON_MESSAGE,
|
|
10405
|
-
ON_REINVITE: ON_REINVITE
|
|
10406
|
-
ON_TRACK: ON_TRACK
|
|
10464
|
+
ON_REINVITE: ON_REINVITE,
|
|
10465
|
+
ON_TRACK: ON_TRACK,
|
|
10407
10466
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10408
10467
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10409
10468
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10418,16 +10477,24 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10418
10477
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10419
10478
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10420
10479
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10421
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS
|
|
10480
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10422
10481
|
ON_CHAT: ON_CHAT,
|
|
10423
10482
|
ON_SIGNAL: ON_SIGNAL,
|
|
10424
|
-
ON_DISCONNECTED: ON_DISCONNECTED
|
|
10483
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10425
10484
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10426
10485
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10427
|
-
events: events
|
|
10486
|
+
events: events,
|
|
10428
10487
|
'default': WebRTCPhone
|
|
10429
10488
|
});
|
|
10430
10489
|
|
|
10490
|
+
/* */
|
|
10491
|
+
class SFUNotAvailableError extends Error {
|
|
10492
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10493
|
+
super(message);
|
|
10494
|
+
this.name = 'SFUNotAvailableError';
|
|
10495
|
+
}
|
|
10496
|
+
}
|
|
10497
|
+
|
|
10431
10498
|
//
|
|
10432
10499
|
|
|
10433
10500
|
const logger$6 = IssueReporter$1.loggerFor('simple-phone');
|
|
@@ -10812,13 +10879,13 @@ class Phone extends Emitter {
|
|
|
10812
10879
|
|
|
10813
10880
|
checkSfu() {
|
|
10814
10881
|
if (!this.hasSfu()) {
|
|
10815
|
-
throw new
|
|
10882
|
+
throw new SFUNotAvailableError();
|
|
10816
10883
|
}
|
|
10817
10884
|
}
|
|
10818
10885
|
|
|
10819
10886
|
_transferEvents() {
|
|
10820
10887
|
this.unbind();
|
|
10821
|
-
[...events, ...transportEvents].forEach(event => {
|
|
10888
|
+
[...events$1, ...transportEvents].forEach(event => {
|
|
10822
10889
|
this.client.on(event, (...args) =>
|
|
10823
10890
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
10824
10891
|
});
|
|
@@ -10840,7 +10907,7 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
10840
10907
|
|
|
10841
10908
|
//
|
|
10842
10909
|
|
|
10843
|
-
const SOCKET_EVENTS = {
|
|
10910
|
+
const SOCKET_EVENTS$1 = {
|
|
10844
10911
|
ON_OPEN: 'onopen',
|
|
10845
10912
|
ON_MESSAGE: 'onmessage',
|
|
10846
10913
|
ON_ERROR: 'onerror',
|
|
@@ -10936,7 +11003,7 @@ const BLACKLIST_EVENTS = [
|
|
|
10936
11003
|
];
|
|
10937
11004
|
|
|
10938
11005
|
const HEARTBEAT_ENGINE_VERSION = '20.09';
|
|
10939
|
-
const logger$
|
|
11006
|
+
const logger$5 = IssueReporter$1.loggerFor('wazo-ws');
|
|
10940
11007
|
const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
|
|
10941
11008
|
|
|
10942
11009
|
class WebSocketClient extends Emitter {
|
|
@@ -10985,24 +11052,24 @@ class WebSocketClient extends Emitter {
|
|
|
10985
11052
|
}
|
|
10986
11053
|
|
|
10987
11054
|
connect() {
|
|
10988
|
-
logger$
|
|
11055
|
+
logger$5.info('connect method started', { host: this.host, token: this.token });
|
|
10989
11056
|
this.socket = new ReconnectingWebSocket__default['default'](this._getUrl.bind(this), [], this.options);
|
|
10990
11057
|
if (this.options.binaryType) {
|
|
10991
11058
|
this.socket.binaryType = this.options.binaryType;
|
|
10992
11059
|
}
|
|
10993
11060
|
|
|
10994
11061
|
this.socket.onopen = () => {
|
|
10995
|
-
logger$
|
|
10996
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
11062
|
+
logger$5.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
11063
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
|
|
10997
11064
|
};
|
|
10998
11065
|
|
|
10999
11066
|
this.socket.onerror = event => {
|
|
11000
|
-
logger$
|
|
11001
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
11067
|
+
logger$5.error('on Wazo WS error', event.target);
|
|
11068
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
|
|
11002
11069
|
};
|
|
11003
11070
|
|
|
11004
11071
|
this.socket.onmessage = (event ) => {
|
|
11005
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
11072
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
|
|
11006
11073
|
|
|
11007
11074
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
11008
11075
|
let { name } = message;
|
|
@@ -11027,7 +11094,7 @@ class WebSocketClient extends Emitter {
|
|
|
11027
11094
|
|
|
11028
11095
|
this.socket.onclose = event => {
|
|
11029
11096
|
// Can't be converted to JSON (circular structure)
|
|
11030
|
-
logger$
|
|
11097
|
+
logger$5.info('on Wazo WS close', {
|
|
11031
11098
|
reason: event.reason,
|
|
11032
11099
|
code: event.code,
|
|
11033
11100
|
readyState: event.target.readyState,
|
|
@@ -11035,22 +11102,22 @@ class WebSocketClient extends Emitter {
|
|
|
11035
11102
|
token: this.token,
|
|
11036
11103
|
});
|
|
11037
11104
|
this.initialized = false;
|
|
11038
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
11105
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
|
|
11039
11106
|
|
|
11040
11107
|
switch (event.code) {
|
|
11041
11108
|
case 4002:
|
|
11042
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
11109
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
|
|
11043
11110
|
break;
|
|
11044
11111
|
}
|
|
11045
11112
|
};
|
|
11046
11113
|
|
|
11047
11114
|
this.socket.onerror = event => {
|
|
11048
|
-
logger$
|
|
11115
|
+
logger$5.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
|
|
11049
11116
|
};
|
|
11050
11117
|
}
|
|
11051
11118
|
|
|
11052
11119
|
close(force = false) {
|
|
11053
|
-
logger$
|
|
11120
|
+
logger$5.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
|
|
11054
11121
|
|
|
11055
11122
|
if (!this.socket) {
|
|
11056
11123
|
return;
|
|
@@ -11068,7 +11135,7 @@ class WebSocketClient extends Emitter {
|
|
|
11068
11135
|
|
|
11069
11136
|
updateToken(token ) {
|
|
11070
11137
|
this.token = token;
|
|
11071
|
-
logger$
|
|
11138
|
+
logger$5.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
|
|
11072
11139
|
|
|
11073
11140
|
if (this.socket) {
|
|
11074
11141
|
// If still connected, send the token to the WS
|
|
@@ -11086,7 +11153,7 @@ class WebSocketClient extends Emitter {
|
|
|
11086
11153
|
}
|
|
11087
11154
|
|
|
11088
11155
|
startHeartbeat() {
|
|
11089
|
-
logger$
|
|
11156
|
+
logger$5.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
|
|
11090
11157
|
|
|
11091
11158
|
if (!this.socket) {
|
|
11092
11159
|
this.heartbeat.stop();
|
|
@@ -11100,7 +11167,7 @@ class WebSocketClient extends Emitter {
|
|
|
11100
11167
|
}
|
|
11101
11168
|
|
|
11102
11169
|
stopHeartbeat() {
|
|
11103
|
-
logger$
|
|
11170
|
+
logger$5.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
|
|
11104
11171
|
|
|
11105
11172
|
this.heartbeat.stop();
|
|
11106
11173
|
}
|
|
@@ -11130,7 +11197,7 @@ class WebSocketClient extends Emitter {
|
|
|
11130
11197
|
}
|
|
11131
11198
|
|
|
11132
11199
|
reconnect(reason ) {
|
|
11133
|
-
logger$
|
|
11200
|
+
logger$5.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
|
|
11134
11201
|
if (!this.socket) {
|
|
11135
11202
|
return;
|
|
11136
11203
|
}
|
|
@@ -11155,7 +11222,7 @@ class WebSocketClient extends Emitter {
|
|
|
11155
11222
|
break;
|
|
11156
11223
|
case 'start':
|
|
11157
11224
|
this.initialized = true;
|
|
11158
|
-
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
11225
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
|
|
11159
11226
|
break;
|
|
11160
11227
|
default:
|
|
11161
11228
|
this.eventEmitter.emit('message', message);
|
|
@@ -11186,7 +11253,7 @@ class WebSocketClient extends Emitter {
|
|
|
11186
11253
|
this.close();
|
|
11187
11254
|
}
|
|
11188
11255
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
11189
|
-
logger$
|
|
11256
|
+
logger$5.log('Wazo WS url computed to reconnect', { url });
|
|
11190
11257
|
|
|
11191
11258
|
return url;
|
|
11192
11259
|
}
|
|
@@ -11194,15 +11261,15 @@ class WebSocketClient extends Emitter {
|
|
|
11194
11261
|
_onHeartbeat(message ) {
|
|
11195
11262
|
if (message.payload === 'pong') {
|
|
11196
11263
|
this.heartbeat.onHeartbeat();
|
|
11197
|
-
logger$
|
|
11264
|
+
logger$5.log('on heartbeat received from Wazo WS');
|
|
11198
11265
|
}
|
|
11199
11266
|
}
|
|
11200
11267
|
|
|
11201
11268
|
async _onHeartbeatTimeout() {
|
|
11202
|
-
logger$
|
|
11269
|
+
logger$5.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
11203
11270
|
|
|
11204
11271
|
this.close();
|
|
11205
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11272
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11206
11273
|
|
|
11207
11274
|
if (this.onHeartBeatTimeout) {
|
|
11208
11275
|
this.onHeartBeatTimeout();
|
|
@@ -11282,7 +11349,7 @@ WebSocketClient.eventLists = [
|
|
|
11282
11349
|
|
|
11283
11350
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
11284
11351
|
__proto__: null,
|
|
11285
|
-
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
11352
|
+
SOCKET_EVENTS: SOCKET_EVENTS$1,
|
|
11286
11353
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
11287
11354
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
11288
11355
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -11355,10 +11422,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11355
11422
|
|
|
11356
11423
|
//
|
|
11357
11424
|
|
|
11358
|
-
const { SOCKET_EVENTS
|
|
11359
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS
|
|
11425
|
+
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11426
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
11360
11427
|
|
|
11361
|
-
const logger$
|
|
11428
|
+
const logger$4 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
11362
11429
|
|
|
11363
11430
|
class Websocket extends Emitter {
|
|
11364
11431
|
|
|
@@ -11372,9 +11439,9 @@ class Websocket extends Emitter {
|
|
|
11372
11439
|
// $FlowFixMe
|
|
11373
11440
|
this[key] = OTHER_EVENTS[key];
|
|
11374
11441
|
});
|
|
11375
|
-
Object.keys(SOCKET_EVENTS
|
|
11442
|
+
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
11376
11443
|
// $FlowFixMe
|
|
11377
|
-
this[key] = SOCKET_EVENTS
|
|
11444
|
+
this[key] = SOCKET_EVENTS[key];
|
|
11378
11445
|
});
|
|
11379
11446
|
this.eventLists = WebSocketClient.eventLists;
|
|
11380
11447
|
|
|
@@ -11382,7 +11449,7 @@ class Websocket extends Emitter {
|
|
|
11382
11449
|
}
|
|
11383
11450
|
|
|
11384
11451
|
open(host , session ) {
|
|
11385
|
-
logger$
|
|
11452
|
+
logger$4.info('open simple WebSocket', { host, token: session.token });
|
|
11386
11453
|
this.ws = new WebSocketClient(
|
|
11387
11454
|
{
|
|
11388
11455
|
host,
|
|
@@ -11410,7 +11477,7 @@ class Websocket extends Emitter {
|
|
|
11410
11477
|
}
|
|
11411
11478
|
|
|
11412
11479
|
updateToken(token ) {
|
|
11413
|
-
logger$
|
|
11480
|
+
logger$4.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
11414
11481
|
|
|
11415
11482
|
if (!this.ws) {
|
|
11416
11483
|
return;
|
|
@@ -11438,7 +11505,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11438
11505
|
|
|
11439
11506
|
//
|
|
11440
11507
|
|
|
11441
|
-
const logger$
|
|
11508
|
+
const logger$3 = IssueReporter$1.loggerFor('room');
|
|
11442
11509
|
|
|
11443
11510
|
class Participant extends Emitter {
|
|
11444
11511
|
|
|
@@ -11560,7 +11627,7 @@ class Participant extends Emitter {
|
|
|
11560
11627
|
}
|
|
11561
11628
|
|
|
11562
11629
|
onTalking(isTalking ) {
|
|
11563
|
-
logger$
|
|
11630
|
+
logger$3.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
11564
11631
|
this.isTalking = isTalking;
|
|
11565
11632
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
11566
11633
|
// directly from asterisk, there's no need to do so
|
|
@@ -11663,7 +11730,7 @@ class Participant extends Emitter {
|
|
|
11663
11730
|
}
|
|
11664
11731
|
|
|
11665
11732
|
updateStatus(status , broadcast = true) {
|
|
11666
|
-
logger$
|
|
11733
|
+
logger$3.info('updating participant status', { name: this.name, status });
|
|
11667
11734
|
|
|
11668
11735
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
11669
11736
|
if (status.audioMuted) {
|
|
@@ -11711,7 +11778,7 @@ class Participant extends Emitter {
|
|
|
11711
11778
|
|
|
11712
11779
|
broadcastStatus(inboundStatus = null) {
|
|
11713
11780
|
const status = inboundStatus || this.getStatus();
|
|
11714
|
-
logger$
|
|
11781
|
+
logger$3.info('broadcasting participant status', { callId: this.callId, status });
|
|
11715
11782
|
|
|
11716
11783
|
this.room.sendSignal({
|
|
11717
11784
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|
|
@@ -11747,9 +11814,9 @@ class LocalParticipant extends Participant {
|
|
|
11747
11814
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
11748
11815
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
11749
11816
|
|
|
11750
|
-
const logger$
|
|
11817
|
+
const logger$2 = IssueReporter$1.loggerFor('sdk-room');
|
|
11751
11818
|
|
|
11752
|
-
class Room extends Emitter {
|
|
11819
|
+
class Room$1 extends Emitter {
|
|
11753
11820
|
|
|
11754
11821
|
|
|
11755
11822
|
|
|
@@ -11807,7 +11874,7 @@ class Room extends Emitter {
|
|
|
11807
11874
|
extra = {},
|
|
11808
11875
|
) {
|
|
11809
11876
|
super();
|
|
11810
|
-
logger$
|
|
11877
|
+
logger$2.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
11811
11878
|
|
|
11812
11879
|
// Represents the room callSession
|
|
11813
11880
|
this.callSession = callSession;
|
|
@@ -11873,7 +11940,7 @@ class Room extends Emitter {
|
|
|
11873
11940
|
* @returns {Promise<Room>}
|
|
11874
11941
|
*/
|
|
11875
11942
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
11876
|
-
logger$
|
|
11943
|
+
logger$2.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
11877
11944
|
|
|
11878
11945
|
if (!room) {
|
|
11879
11946
|
await Wazo.Phone.connect();
|
|
@@ -11886,7 +11953,7 @@ class Room extends Emitter {
|
|
|
11886
11953
|
|
|
11887
11954
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
11888
11955
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
11889
|
-
logger$
|
|
11956
|
+
logger$2.info('room call received via WS', { callId: data.call_id });
|
|
11890
11957
|
if (room) {
|
|
11891
11958
|
room.setCallId(data.call_id);
|
|
11892
11959
|
}
|
|
@@ -11894,7 +11961,7 @@ class Room extends Emitter {
|
|
|
11894
11961
|
|
|
11895
11962
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
11896
11963
|
// eslint-disable-next-line no-param-reassign
|
|
11897
|
-
room = new Room(callSession, extension, null, null, extra);
|
|
11964
|
+
room = new Room$1(callSession, extension, null, null, extra);
|
|
11898
11965
|
|
|
11899
11966
|
// Wait for the call to be accepted
|
|
11900
11967
|
await new Promise((resolve, reject) => {
|
|
@@ -11915,7 +11982,7 @@ class Room extends Emitter {
|
|
|
11915
11982
|
// Retrieve conference
|
|
11916
11983
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
11917
11984
|
|
|
11918
|
-
logger$
|
|
11985
|
+
logger$2.info('connected to room', {
|
|
11919
11986
|
sourceId: conference ? conference.sourceId : null,
|
|
11920
11987
|
name: conference ? conference.name : null,
|
|
11921
11988
|
});
|
|
@@ -11925,7 +11992,7 @@ class Room extends Emitter {
|
|
|
11925
11992
|
room.setName(conference.name);
|
|
11926
11993
|
}
|
|
11927
11994
|
} else if (meeting) {
|
|
11928
|
-
logger$
|
|
11995
|
+
logger$2.info('Already connected to meeting', {
|
|
11929
11996
|
uuid: meeting.uuid,
|
|
11930
11997
|
name: meeting.name,
|
|
11931
11998
|
});
|
|
@@ -11938,13 +12005,13 @@ class Room extends Emitter {
|
|
|
11938
12005
|
}
|
|
11939
12006
|
|
|
11940
12007
|
static disconnect() {
|
|
11941
|
-
logger$
|
|
12008
|
+
logger$2.info('static disconnection to room');
|
|
11942
12009
|
|
|
11943
12010
|
Wazo.Phone.disconnect();
|
|
11944
12011
|
}
|
|
11945
12012
|
|
|
11946
12013
|
async disconnect() {
|
|
11947
|
-
logger$
|
|
12014
|
+
logger$2.info('disconnection to room called');
|
|
11948
12015
|
|
|
11949
12016
|
await Wazo.Phone.hangup(this.callSession);
|
|
11950
12017
|
this.callSession = null;
|
|
@@ -11964,19 +12031,19 @@ class Room extends Emitter {
|
|
|
11964
12031
|
}
|
|
11965
12032
|
|
|
11966
12033
|
setSourceId(sourceId ) {
|
|
11967
|
-
logger$
|
|
12034
|
+
logger$2.info('set room source id', { sourceId });
|
|
11968
12035
|
|
|
11969
12036
|
this.sourceId = sourceId;
|
|
11970
12037
|
}
|
|
11971
12038
|
|
|
11972
12039
|
setMeetingUuid(meetingUuid ) {
|
|
11973
|
-
logger$
|
|
12040
|
+
logger$2.info('set meeting uuid', { meetingUuid });
|
|
11974
12041
|
|
|
11975
12042
|
this.meetingUuid = meetingUuid;
|
|
11976
12043
|
}
|
|
11977
12044
|
|
|
11978
12045
|
setCallId(callId ) {
|
|
11979
|
-
logger$
|
|
12046
|
+
logger$2.info('set room call id', { callId });
|
|
11980
12047
|
|
|
11981
12048
|
if (callId) {
|
|
11982
12049
|
this.callId = callId;
|
|
@@ -11984,7 +12051,7 @@ class Room extends Emitter {
|
|
|
11984
12051
|
}
|
|
11985
12052
|
|
|
11986
12053
|
setName(name ) {
|
|
11987
|
-
logger$
|
|
12054
|
+
logger$2.info('set room name', { name });
|
|
11988
12055
|
|
|
11989
12056
|
this.name = name;
|
|
11990
12057
|
}
|
|
@@ -12003,7 +12070,7 @@ class Room extends Emitter {
|
|
|
12003
12070
|
}
|
|
12004
12071
|
|
|
12005
12072
|
async startScreenSharing(constraints ) {
|
|
12006
|
-
logger$
|
|
12073
|
+
logger$2.info('start room screen sharing', { constraints });
|
|
12007
12074
|
|
|
12008
12075
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
12009
12076
|
if (!screensharingStream) {
|
|
@@ -12017,7 +12084,7 @@ class Room extends Emitter {
|
|
|
12017
12084
|
}
|
|
12018
12085
|
|
|
12019
12086
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
12020
|
-
logger$
|
|
12087
|
+
logger$2.info('stop room screen sharing');
|
|
12021
12088
|
|
|
12022
12089
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
12023
12090
|
|
|
@@ -12029,7 +12096,7 @@ class Room extends Emitter {
|
|
|
12029
12096
|
}
|
|
12030
12097
|
|
|
12031
12098
|
turnCameraOff() {
|
|
12032
|
-
logger$
|
|
12099
|
+
logger$2.info('turn room camera off');
|
|
12033
12100
|
|
|
12034
12101
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
12035
12102
|
|
|
@@ -12039,7 +12106,7 @@ class Room extends Emitter {
|
|
|
12039
12106
|
}
|
|
12040
12107
|
|
|
12041
12108
|
turnCameraOn() {
|
|
12042
|
-
logger$
|
|
12109
|
+
logger$2.info('turn room camera on');
|
|
12043
12110
|
|
|
12044
12111
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
12045
12112
|
|
|
@@ -12049,7 +12116,7 @@ class Room extends Emitter {
|
|
|
12049
12116
|
}
|
|
12050
12117
|
|
|
12051
12118
|
mute() {
|
|
12052
|
-
logger$
|
|
12119
|
+
logger$2.info('mute room');
|
|
12053
12120
|
|
|
12054
12121
|
Wazo.Phone.mute(this.callSession);
|
|
12055
12122
|
|
|
@@ -12057,7 +12124,7 @@ class Room extends Emitter {
|
|
|
12057
12124
|
}
|
|
12058
12125
|
|
|
12059
12126
|
unmute() {
|
|
12060
|
-
logger$
|
|
12127
|
+
logger$2.info('unmute room');
|
|
12061
12128
|
|
|
12062
12129
|
Wazo.Phone.unmute(this.callSession);
|
|
12063
12130
|
|
|
@@ -12077,7 +12144,7 @@ class Room extends Emitter {
|
|
|
12077
12144
|
}
|
|
12078
12145
|
|
|
12079
12146
|
hold() {
|
|
12080
|
-
logger$
|
|
12147
|
+
logger$2.info('hold room');
|
|
12081
12148
|
|
|
12082
12149
|
Wazo.Phone.hold(this.callSession, true);
|
|
12083
12150
|
|
|
@@ -12087,7 +12154,7 @@ class Room extends Emitter {
|
|
|
12087
12154
|
}
|
|
12088
12155
|
|
|
12089
12156
|
async resume() {
|
|
12090
|
-
logger$
|
|
12157
|
+
logger$2.info('resume room');
|
|
12091
12158
|
|
|
12092
12159
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
12093
12160
|
|
|
@@ -12115,13 +12182,13 @@ class Room extends Emitter {
|
|
|
12115
12182
|
}
|
|
12116
12183
|
|
|
12117
12184
|
sendDTMF(tone ) {
|
|
12118
|
-
logger$
|
|
12185
|
+
logger$2.info('send room DTMF', { tone });
|
|
12119
12186
|
|
|
12120
12187
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
12121
12188
|
}
|
|
12122
12189
|
|
|
12123
12190
|
async sendReinvite(newConstraints = null) {
|
|
12124
|
-
logger$
|
|
12191
|
+
logger$2.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
12125
12192
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
12126
12193
|
|
|
12127
12194
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -12180,7 +12247,7 @@ class Room extends Emitter {
|
|
|
12180
12247
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
12181
12248
|
|
|
12182
12249
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
12183
|
-
logger$
|
|
12250
|
+
logger$2.info('on room audio stream');
|
|
12184
12251
|
|
|
12185
12252
|
this.audioStream = stream;
|
|
12186
12253
|
if (!this.roomAudioElement) {
|
|
@@ -12193,7 +12260,7 @@ class Room extends Emitter {
|
|
|
12193
12260
|
});
|
|
12194
12261
|
|
|
12195
12262
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
12196
|
-
logger$
|
|
12263
|
+
logger$2.info('on room video stream', { streamId });
|
|
12197
12264
|
|
|
12198
12265
|
this._mapMsid(sipSession.body.body);
|
|
12199
12266
|
|
|
@@ -12208,7 +12275,7 @@ class Room extends Emitter {
|
|
|
12208
12275
|
});
|
|
12209
12276
|
|
|
12210
12277
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
12211
|
-
logger$
|
|
12278
|
+
logger$2.info('on room remove stream');
|
|
12212
12279
|
|
|
12213
12280
|
const participant = this.participants.find(someParticipant =>
|
|
12214
12281
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -12340,7 +12407,7 @@ class Room extends Emitter {
|
|
|
12340
12407
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
12341
12408
|
if (requester) {
|
|
12342
12409
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
12343
|
-
logger$
|
|
12410
|
+
logger$2.info('trigger room requester status', { origin });
|
|
12344
12411
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
12345
12412
|
}
|
|
12346
12413
|
break;
|
|
@@ -12371,24 +12438,24 @@ class Room extends Emitter {
|
|
|
12371
12438
|
|
|
12372
12439
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
12373
12440
|
if (participant.user_uuid === session.uuid) {
|
|
12374
|
-
logger$
|
|
12441
|
+
logger$2.info('room current user joined');
|
|
12375
12442
|
|
|
12376
12443
|
// Retrieve participants via an API calls
|
|
12377
12444
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
12378
12445
|
let response;
|
|
12379
12446
|
try {
|
|
12380
12447
|
if (this.meetingUuid) {
|
|
12381
|
-
logger$
|
|
12448
|
+
logger$2.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
12382
12449
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
12383
12450
|
} else {
|
|
12384
|
-
logger$
|
|
12451
|
+
logger$2.info('fetching conference participants', { conferenceId });
|
|
12385
12452
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
12386
12453
|
}
|
|
12387
12454
|
} catch (e) {
|
|
12388
|
-
logger$
|
|
12455
|
+
logger$2.error('room participants fetching, error', e);
|
|
12389
12456
|
}
|
|
12390
12457
|
if (response) {
|
|
12391
|
-
logger$
|
|
12458
|
+
logger$2.info('conference participants fetched', { nb: response.items.length });
|
|
12392
12459
|
participants = response.items.map(item => {
|
|
12393
12460
|
const isMe = item.call_id === this.callId;
|
|
12394
12461
|
|
|
@@ -12415,7 +12482,7 @@ class Room extends Emitter {
|
|
|
12415
12482
|
? new Wazo.RemoteParticipant(this, participant)
|
|
12416
12483
|
: null;
|
|
12417
12484
|
|
|
12418
|
-
logger$
|
|
12485
|
+
logger$2.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
12419
12486
|
|
|
12420
12487
|
if (remoteParticipant) {
|
|
12421
12488
|
this.participants.push(remoteParticipant);
|
|
@@ -12580,12 +12647,12 @@ class Room extends Emitter {
|
|
|
12580
12647
|
|
|
12581
12648
|
//
|
|
12582
12649
|
|
|
12583
|
-
const logger$
|
|
12650
|
+
const logger$1 = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
12584
12651
|
|
|
12585
|
-
class SipRoom extends Room {
|
|
12652
|
+
class SipRoom extends Room$1 {
|
|
12586
12653
|
|
|
12587
12654
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
12588
|
-
logger$
|
|
12655
|
+
logger$1.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
12589
12656
|
|
|
12590
12657
|
if (!room) {
|
|
12591
12658
|
await Wazo.Phone.connect();
|
|
@@ -12601,7 +12668,7 @@ class SipRoom extends Room {
|
|
|
12601
12668
|
room.setCallId(room.callSession.call.id);
|
|
12602
12669
|
}
|
|
12603
12670
|
|
|
12604
|
-
logger$
|
|
12671
|
+
logger$1.info('connected to room', {
|
|
12605
12672
|
extension: room.extension,
|
|
12606
12673
|
});
|
|
12607
12674
|
|
|
@@ -12609,7 +12676,7 @@ class SipRoom extends Room {
|
|
|
12609
12676
|
}
|
|
12610
12677
|
|
|
12611
12678
|
mute() {
|
|
12612
|
-
logger$
|
|
12679
|
+
logger$1.info('mute sip room');
|
|
12613
12680
|
|
|
12614
12681
|
Wazo.Phone.mute(this.callSession, false);
|
|
12615
12682
|
|
|
@@ -12617,7 +12684,7 @@ class SipRoom extends Room {
|
|
|
12617
12684
|
}
|
|
12618
12685
|
|
|
12619
12686
|
unmute() {
|
|
12620
|
-
logger$
|
|
12687
|
+
logger$1.info('unmute sip room');
|
|
12621
12688
|
|
|
12622
12689
|
Wazo.Phone.unmute(this.callSession, false);
|
|
12623
12690
|
|
|
@@ -12901,7 +12968,7 @@ class NotificationOptions {
|
|
|
12901
12968
|
|
|
12902
12969
|
|
|
12903
12970
|
// Represents a conference room, like `9000`.
|
|
12904
|
-
class Room
|
|
12971
|
+
class Room {
|
|
12905
12972
|
|
|
12906
12973
|
|
|
12907
12974
|
|
|
@@ -12922,7 +12989,7 @@ class Room$1 {
|
|
|
12922
12989
|
}
|
|
12923
12990
|
|
|
12924
12991
|
connect(callSession ) {
|
|
12925
|
-
return new Room
|
|
12992
|
+
return new Room({ ...this, connectedCallSession: callSession });
|
|
12926
12993
|
}
|
|
12927
12994
|
|
|
12928
12995
|
has(callSession ) {
|
|
@@ -12931,7 +12998,7 @@ class Room$1 {
|
|
|
12931
12998
|
|
|
12932
12999
|
addParticipant(uuid , extension , talking = null) {
|
|
12933
13000
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
12934
|
-
return new Room
|
|
13001
|
+
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12935
13002
|
}
|
|
12936
13003
|
|
|
12937
13004
|
return this;
|
|
@@ -12950,7 +13017,7 @@ class Room$1 {
|
|
|
12950
13017
|
updatedParticipants.push(participant);
|
|
12951
13018
|
}
|
|
12952
13019
|
|
|
12953
|
-
return new Room
|
|
13020
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12954
13021
|
}
|
|
12955
13022
|
|
|
12956
13023
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -12966,7 +13033,7 @@ class Room$1 {
|
|
|
12966
13033
|
updatedParticipants.push(participant);
|
|
12967
13034
|
}
|
|
12968
13035
|
|
|
12969
|
-
return new Room
|
|
13036
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12970
13037
|
}
|
|
12971
13038
|
|
|
12972
13039
|
hasCallWithId(id ) {
|
|
@@ -12974,18 +13041,18 @@ class Room$1 {
|
|
|
12974
13041
|
}
|
|
12975
13042
|
|
|
12976
13043
|
disconnect() {
|
|
12977
|
-
return new Room
|
|
13044
|
+
return new Room({ ...this, connectedCallSession: null });
|
|
12978
13045
|
}
|
|
12979
13046
|
|
|
12980
13047
|
removeParticipantWithUUID(uuid ) {
|
|
12981
|
-
return new Room
|
|
13048
|
+
return new Room({
|
|
12982
13049
|
...this,
|
|
12983
13050
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
12984
13051
|
});
|
|
12985
13052
|
}
|
|
12986
13053
|
|
|
12987
13054
|
removeParticipantWithExtension(extension ) {
|
|
12988
|
-
return new Room
|
|
13055
|
+
return new Room({
|
|
12989
13056
|
...this,
|
|
12990
13057
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
12991
13058
|
});
|
|
@@ -12996,7 +13063,7 @@ class Room$1 {
|
|
|
12996
13063
|
}
|
|
12997
13064
|
|
|
12998
13065
|
static newFrom(room ) {
|
|
12999
|
-
return newFrom(room, Room
|
|
13066
|
+
return newFrom(room, Room);
|
|
13000
13067
|
}
|
|
13001
13068
|
}
|
|
13002
13069
|
|
|
@@ -13303,11 +13370,11 @@ var wazoWebsocket = {
|
|
|
13303
13370
|
resolve();
|
|
13304
13371
|
};
|
|
13305
13372
|
|
|
13306
|
-
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
13373
|
+
client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
|
|
13307
13374
|
handleError(`Connection error : ${error}`);
|
|
13308
13375
|
});
|
|
13309
13376
|
|
|
13310
|
-
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
13377
|
+
client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
|
|
13311
13378
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
13312
13379
|
client.setOnHeartbeatTimeout(() => {
|
|
13313
13380
|
handleError('No response to heartbeat');
|
|
@@ -13408,7 +13475,7 @@ var webrtc = {
|
|
|
13408
13475
|
}),
|
|
13409
13476
|
};
|
|
13410
13477
|
|
|
13411
|
-
const parseCandidate
|
|
13478
|
+
const parseCandidate = line => {
|
|
13412
13479
|
let parts;
|
|
13413
13480
|
// Parse both variants.
|
|
13414
13481
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -13499,7 +13566,7 @@ var SymmetricNat = {
|
|
|
13499
13566
|
}
|
|
13500
13567
|
|
|
13501
13568
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
13502
|
-
const cand = parseCandidate
|
|
13569
|
+
const cand = parseCandidate(e.candidate.candidate);
|
|
13503
13570
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
13504
13571
|
candidates[cand.relatedPort].push(cand.port);
|
|
13505
13572
|
} else if (!e.candidate) {
|
|
@@ -13567,7 +13634,7 @@ var iceIpv4 = {
|
|
|
13567
13634
|
const rawCandidate = e.candidate.candidate;
|
|
13568
13635
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
13569
13636
|
hasSrflxOrRelay = true;
|
|
13570
|
-
const candidate = parseCandidate
|
|
13637
|
+
const candidate = parseCandidate(e.candidate.candidate);
|
|
13571
13638
|
ips.push(candidate.ip);
|
|
13572
13639
|
}
|
|
13573
13640
|
} else if (!e.candidate) {
|
|
@@ -13604,7 +13671,7 @@ var checks = [
|
|
|
13604
13671
|
|
|
13605
13672
|
//
|
|
13606
13673
|
|
|
13607
|
-
const logger
|
|
13674
|
+
const logger = IssueReporter$1.loggerFor('engine-check');
|
|
13608
13675
|
|
|
13609
13676
|
class Checker {
|
|
13610
13677
|
|
|
@@ -13622,28 +13689,28 @@ class Checker {
|
|
|
13622
13689
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
13623
13690
|
await this._addEngineVersion();
|
|
13624
13691
|
|
|
13625
|
-
logger
|
|
13692
|
+
logger.info('Engine check starting');
|
|
13626
13693
|
|
|
13627
13694
|
for (let i = 0; i < this.checks.length; i++) {
|
|
13628
13695
|
const { name, check } = this.checks[i];
|
|
13629
13696
|
|
|
13630
|
-
logger
|
|
13697
|
+
logger.info(`Checking ${name} ...`);
|
|
13631
13698
|
|
|
13632
13699
|
onCheckBegin(name);
|
|
13633
13700
|
try {
|
|
13634
13701
|
// eslint-disable-next-line no-await-in-loop
|
|
13635
13702
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
13636
|
-
logger
|
|
13703
|
+
logger.info(`Checking ${name} success.`, { result });
|
|
13637
13704
|
|
|
13638
13705
|
onCheckResult(name, result);
|
|
13639
13706
|
} catch (e) {
|
|
13640
|
-
logger
|
|
13707
|
+
logger.info(`Checking ${name} failure`, { message: e.message });
|
|
13641
13708
|
|
|
13642
13709
|
onCheckResult(name, e);
|
|
13643
13710
|
}
|
|
13644
13711
|
}
|
|
13645
13712
|
|
|
13646
|
-
logger
|
|
13713
|
+
logger.info('Engine check done.');
|
|
13647
13714
|
}
|
|
13648
13715
|
|
|
13649
13716
|
addCheck(check ) {
|
|
@@ -13667,7 +13734,7 @@ const Wazo = {
|
|
|
13667
13734
|
Auth: Auth$1,
|
|
13668
13735
|
Phone: Phone$1,
|
|
13669
13736
|
Websocket: Websocket$1,
|
|
13670
|
-
Room,
|
|
13737
|
+
Room: Room$1,
|
|
13671
13738
|
SipRoom,
|
|
13672
13739
|
RemoteParticipant,
|
|
13673
13740
|
LocalParticipant,
|
|
@@ -13700,7 +13767,7 @@ const Wazo = {
|
|
|
13700
13767
|
Session,
|
|
13701
13768
|
Voicemail,
|
|
13702
13769
|
Relocation,
|
|
13703
|
-
ConferenceRoom: Room
|
|
13770
|
+
ConferenceRoom: Room,
|
|
13704
13771
|
CallSession,
|
|
13705
13772
|
IndirectTransfer,
|
|
13706
13773
|
SwitchboardCall,
|
|
@@ -13725,6 +13792,7 @@ const Wazo = {
|
|
|
13725
13792
|
InvalidSubscription,
|
|
13726
13793
|
InvalidAuthorization,
|
|
13727
13794
|
CanceledCallError,
|
|
13795
|
+
SFUNotAvailableError,
|
|
13728
13796
|
};
|
|
13729
13797
|
|
|
13730
13798
|
if (window) {
|