@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
|
@@ -1236,7 +1236,7 @@ class Contact {
|
|
|
1236
1236
|
this[key] = old[key] || this[key];
|
|
1237
1237
|
});
|
|
1238
1238
|
|
|
1239
|
-
if (old.lineState
|
|
1239
|
+
if (old.lineState) {
|
|
1240
1240
|
this.lineState = old.lineState;
|
|
1241
1241
|
}
|
|
1242
1242
|
|
|
@@ -1947,11 +1947,11 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
1947
1947
|
|
|
1948
1948
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
1949
1949
|
|
|
1950
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1950
|
+
const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1951
1951
|
|
|
1952
1952
|
// Use a function here to be able to mock it in tests
|
|
1953
1953
|
const realFetch = () => {
|
|
1954
|
-
if (typeof document !== 'undefined') {
|
|
1954
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
1955
1955
|
// Browser
|
|
1956
1956
|
return window.fetch;
|
|
1957
1957
|
}
|
|
@@ -2086,7 +2086,7 @@ class ApiRequester {
|
|
|
2086
2086
|
};
|
|
2087
2087
|
|
|
2088
2088
|
if (this.refreshTokenPromise) {
|
|
2089
|
-
logger.info('A token is already refreshing, waiting ...', { url });
|
|
2089
|
+
logger$c.info('A token is already refreshing, waiting ...', { url });
|
|
2090
2090
|
await this.refreshTokenPromise;
|
|
2091
2091
|
}
|
|
2092
2092
|
|
|
@@ -2106,7 +2106,7 @@ class ApiRequester {
|
|
|
2106
2106
|
return promise.then(async (err ) => {
|
|
2107
2107
|
// Check if the token is still valid
|
|
2108
2108
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
2109
|
-
logger.warn('token expired', { error: err.reason });
|
|
2109
|
+
logger$c.warn('token expired', { error: err.reason });
|
|
2110
2110
|
// Replay the call after refreshing the token
|
|
2111
2111
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
2112
2112
|
}
|
|
@@ -2116,7 +2116,7 @@ class ApiRequester {
|
|
|
2116
2116
|
: exceptionClass.fromResponse(err, response.status);
|
|
2117
2117
|
|
|
2118
2118
|
if (this.shouldLogErrors) {
|
|
2119
|
-
logger.error('API error', error);
|
|
2119
|
+
logger$c.error('API error', error);
|
|
2120
2120
|
}
|
|
2121
2121
|
|
|
2122
2122
|
throw error;
|
|
@@ -2126,7 +2126,7 @@ class ApiRequester {
|
|
|
2126
2126
|
return newParse(response, isJson);
|
|
2127
2127
|
}).catch(error => {
|
|
2128
2128
|
if (this.shouldLogErrors) {
|
|
2129
|
-
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2129
|
+
logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2130
2130
|
}
|
|
2131
2131
|
|
|
2132
2132
|
throw error;
|
|
@@ -2154,13 +2154,13 @@ class ApiRequester {
|
|
|
2154
2154
|
) {
|
|
2155
2155
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
2156
2156
|
let newPath = path;
|
|
2157
|
-
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2157
|
+
logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2158
2158
|
|
|
2159
2159
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
2160
2160
|
|
|
2161
2161
|
return this.refreshTokenPromise.then(() => {
|
|
2162
2162
|
this.refreshTokenPromise = null;
|
|
2163
|
-
logger.info('token refreshed', { isTokenNotFound });
|
|
2163
|
+
logger$c.info('token refreshed', { isTokenNotFound });
|
|
2164
2164
|
if (isTokenNotFound) {
|
|
2165
2165
|
const pathParts = path.split('/');
|
|
2166
2166
|
pathParts.pop();
|
|
@@ -3253,8 +3253,10 @@ var updateFrom = (instance , from ) => {
|
|
|
3253
3253
|
|
|
3254
3254
|
|
|
3255
3255
|
|
|
3256
|
+
|
|
3256
3257
|
|
|
3257
3258
|
|
|
3259
|
+
|
|
3258
3260
|
|
|
3259
3261
|
|
|
3260
3262
|
|
|
@@ -3271,6 +3273,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3271
3273
|
|
|
3272
3274
|
|
|
3273
3275
|
|
|
3276
|
+
|
|
3274
3277
|
|
|
3275
3278
|
|
|
3276
3279
|
class CallSession {
|
|
@@ -3290,8 +3293,12 @@ class CallSession {
|
|
|
3290
3293
|
|
|
3291
3294
|
|
|
3292
3295
|
|
|
3296
|
+
|
|
3297
|
+
|
|
3293
3298
|
|
|
3294
3299
|
|
|
3300
|
+
|
|
3301
|
+
|
|
3295
3302
|
|
|
3296
3303
|
|
|
3297
3304
|
|
|
@@ -3329,6 +3336,8 @@ class CallSession {
|
|
|
3329
3336
|
|
|
3330
3337
|
|
|
3331
3338
|
|
|
3339
|
+
|
|
3340
|
+
|
|
3332
3341
|
|
|
3333
3342
|
constructor({
|
|
3334
3343
|
answered,
|
|
@@ -3342,6 +3351,8 @@ class CallSession {
|
|
|
3342
3351
|
paused,
|
|
3343
3352
|
ringing,
|
|
3344
3353
|
startTime,
|
|
3354
|
+
creationTime,
|
|
3355
|
+
endTime,
|
|
3345
3356
|
cameraEnabled,
|
|
3346
3357
|
dialedExtension,
|
|
3347
3358
|
sipCallId,
|
|
@@ -3354,12 +3365,15 @@ class CallSession {
|
|
|
3354
3365
|
recording,
|
|
3355
3366
|
recordingPaused,
|
|
3356
3367
|
videoRemotelyDowngraded,
|
|
3368
|
+
sipSession,
|
|
3357
3369
|
} ) {
|
|
3358
3370
|
this.callId = callId;
|
|
3359
3371
|
this.sipCallId = sipCallId;
|
|
3360
3372
|
this.displayName = displayName;
|
|
3361
3373
|
this.number = number;
|
|
3374
|
+
this.creationTime = creationTime;
|
|
3362
3375
|
this.startTime = startTime;
|
|
3376
|
+
this.endTime = endTime;
|
|
3363
3377
|
this.isCaller = isCaller;
|
|
3364
3378
|
this.answered = answered;
|
|
3365
3379
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -3378,6 +3392,7 @@ class CallSession {
|
|
|
3378
3392
|
this.recording = recording || false;
|
|
3379
3393
|
this.recordingPaused = recordingPaused || false;
|
|
3380
3394
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3395
|
+
this.sipSession = sipSession;
|
|
3381
3396
|
|
|
3382
3397
|
// Useful to compare instead of instanceof with minified code
|
|
3383
3398
|
this.type = 'CallSession';
|
|
@@ -4053,7 +4068,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4053
4068
|
|
|
4054
4069
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4055
4070
|
|
|
4056
|
-
const logger$
|
|
4071
|
+
const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4057
4072
|
|
|
4058
4073
|
class CTIPhone extends Emitter {
|
|
4059
4074
|
|
|
@@ -4066,7 +4081,7 @@ class CTIPhone extends Emitter {
|
|
|
4066
4081
|
|
|
4067
4082
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4068
4083
|
super();
|
|
4069
|
-
logger$
|
|
4084
|
+
logger$b.info('CTI Phone created');
|
|
4070
4085
|
this.session = session;
|
|
4071
4086
|
this.isMobile = isMobile;
|
|
4072
4087
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4127,7 +4142,7 @@ class CTIPhone extends Emitter {
|
|
|
4127
4142
|
}
|
|
4128
4143
|
|
|
4129
4144
|
async makeCall(number , line ) {
|
|
4130
|
-
logger$
|
|
4145
|
+
logger$b.info('make CTI call', { number });
|
|
4131
4146
|
|
|
4132
4147
|
if (!number) {
|
|
4133
4148
|
return null;
|
|
@@ -4150,7 +4165,7 @@ class CTIPhone extends Emitter {
|
|
|
4150
4165
|
if (!callSession) {
|
|
4151
4166
|
return Promise.resolve(null);
|
|
4152
4167
|
}
|
|
4153
|
-
logger$
|
|
4168
|
+
logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4154
4169
|
|
|
4155
4170
|
if (!this.currentCall) {
|
|
4156
4171
|
this.currentCall = callSession.call;
|
|
@@ -4163,7 +4178,7 @@ class CTIPhone extends Emitter {
|
|
|
4163
4178
|
if (!callSession) {
|
|
4164
4179
|
return;
|
|
4165
4180
|
}
|
|
4166
|
-
logger$
|
|
4181
|
+
logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4167
4182
|
|
|
4168
4183
|
this.currentCall = undefined;
|
|
4169
4184
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4173,7 +4188,7 @@ class CTIPhone extends Emitter {
|
|
|
4173
4188
|
if (!callSession) {
|
|
4174
4189
|
return Promise.resolve(false);
|
|
4175
4190
|
}
|
|
4176
|
-
logger$
|
|
4191
|
+
logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4177
4192
|
|
|
4178
4193
|
try {
|
|
4179
4194
|
await CallApi.cancelCall(callSession);
|
|
@@ -4184,7 +4199,7 @@ class CTIPhone extends Emitter {
|
|
|
4184
4199
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4185
4200
|
return true;
|
|
4186
4201
|
} catch (e) {
|
|
4187
|
-
logger$
|
|
4202
|
+
logger$b.error('hangup CTI call, error', e);
|
|
4188
4203
|
|
|
4189
4204
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4190
4205
|
return false;
|
|
@@ -4197,7 +4212,7 @@ class CTIPhone extends Emitter {
|
|
|
4197
4212
|
if (!callSession) {
|
|
4198
4213
|
return;
|
|
4199
4214
|
}
|
|
4200
|
-
logger$
|
|
4215
|
+
logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4201
4216
|
|
|
4202
4217
|
await CallApi.cancelCall(callSession);
|
|
4203
4218
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4207,7 +4222,7 @@ class CTIPhone extends Emitter {
|
|
|
4207
4222
|
if (!callSession) {
|
|
4208
4223
|
return;
|
|
4209
4224
|
}
|
|
4210
|
-
logger$
|
|
4225
|
+
logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4211
4226
|
|
|
4212
4227
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4213
4228
|
}
|
|
@@ -4220,19 +4235,19 @@ class CTIPhone extends Emitter {
|
|
|
4220
4235
|
if (!callSession) {
|
|
4221
4236
|
return;
|
|
4222
4237
|
}
|
|
4223
|
-
logger$
|
|
4238
|
+
logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4224
4239
|
|
|
4225
4240
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4226
4241
|
}
|
|
4227
4242
|
|
|
4228
4243
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4229
|
-
logger$
|
|
4244
|
+
logger$b.info('cancel CTI transfer', { transferId });
|
|
4230
4245
|
|
|
4231
4246
|
return CallApi.cancelCallTransfer(transferId);
|
|
4232
4247
|
}
|
|
4233
4248
|
|
|
4234
4249
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4235
|
-
logger$
|
|
4250
|
+
logger$b.info('confirm CTI transfer', { transferId });
|
|
4236
4251
|
|
|
4237
4252
|
return CallApi.confirmCallTransfer(transferId);
|
|
4238
4253
|
}
|
|
@@ -4241,19 +4256,19 @@ class CTIPhone extends Emitter {
|
|
|
4241
4256
|
if (!callSession) {
|
|
4242
4257
|
return;
|
|
4243
4258
|
}
|
|
4244
|
-
logger$
|
|
4259
|
+
logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4245
4260
|
|
|
4246
4261
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4247
4262
|
}
|
|
4248
4263
|
|
|
4249
4264
|
onConnectionMade() {
|
|
4250
|
-
logger$
|
|
4265
|
+
logger$b.info('on CTI connection made');
|
|
4251
4266
|
|
|
4252
4267
|
this.eventEmitter.emit('onCallAccepted');
|
|
4253
4268
|
}
|
|
4254
4269
|
|
|
4255
4270
|
async close() {
|
|
4256
|
-
logger$
|
|
4271
|
+
logger$b.info('CTI close');
|
|
4257
4272
|
|
|
4258
4273
|
return Promise.resolve();
|
|
4259
4274
|
}
|
|
@@ -4262,7 +4277,7 @@ class CTIPhone extends Emitter {
|
|
|
4262
4277
|
if (!callSession) {
|
|
4263
4278
|
return;
|
|
4264
4279
|
}
|
|
4265
|
-
logger$
|
|
4280
|
+
logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4266
4281
|
|
|
4267
4282
|
return CallApi.hold(callSession.callId);
|
|
4268
4283
|
}
|
|
@@ -4271,7 +4286,7 @@ class CTIPhone extends Emitter {
|
|
|
4271
4286
|
if (!callSession) {
|
|
4272
4287
|
return;
|
|
4273
4288
|
}
|
|
4274
|
-
logger$
|
|
4289
|
+
logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4275
4290
|
|
|
4276
4291
|
return CallApi.resume(callSession.callId);
|
|
4277
4292
|
}
|
|
@@ -4280,7 +4295,7 @@ class CTIPhone extends Emitter {
|
|
|
4280
4295
|
if (!callSession) {
|
|
4281
4296
|
return;
|
|
4282
4297
|
}
|
|
4283
|
-
logger$
|
|
4298
|
+
logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4284
4299
|
|
|
4285
4300
|
return CallApi.mute(callSession.callId);
|
|
4286
4301
|
}
|
|
@@ -4289,7 +4304,7 @@ class CTIPhone extends Emitter {
|
|
|
4289
4304
|
if (!callSession) {
|
|
4290
4305
|
return;
|
|
4291
4306
|
}
|
|
4292
|
-
logger$
|
|
4307
|
+
logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4293
4308
|
|
|
4294
4309
|
return CallApi.unmute(callSession.callId);
|
|
4295
4310
|
}
|
|
@@ -5298,7 +5313,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5298
5313
|
const WEBHOOKD_VERSION = '1.0';
|
|
5299
5314
|
const AMID_VERSION = '1.0';
|
|
5300
5315
|
|
|
5301
|
-
const logger$
|
|
5316
|
+
const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5302
5317
|
|
|
5303
5318
|
class ApiClient {
|
|
5304
5319
|
|
|
@@ -5350,12 +5365,12 @@ class ApiClient {
|
|
|
5350
5365
|
}
|
|
5351
5366
|
|
|
5352
5367
|
async forceRefreshToken() {
|
|
5353
|
-
logger$
|
|
5368
|
+
logger$a.info('forcing refresh token, calling callback');
|
|
5354
5369
|
return this.refreshTokenCallback();
|
|
5355
5370
|
}
|
|
5356
5371
|
|
|
5357
5372
|
async refreshTokenCallback() {
|
|
5358
|
-
logger$
|
|
5373
|
+
logger$a.info('refresh token callback called', {
|
|
5359
5374
|
refreshToken: this.refreshToken,
|
|
5360
5375
|
refreshBackend: this.refreshBackend,
|
|
5361
5376
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5373,7 +5388,7 @@ class ApiClient {
|
|
|
5373
5388
|
this.isMobile,
|
|
5374
5389
|
);
|
|
5375
5390
|
|
|
5376
|
-
logger$
|
|
5391
|
+
logger$a.info('token refreshed', { token: session.token });
|
|
5377
5392
|
|
|
5378
5393
|
if (this.onRefreshToken) {
|
|
5379
5394
|
this.onRefreshToken(session.token, session);
|
|
@@ -5514,7 +5529,7 @@ var getApiClient = (forServer ) => {
|
|
|
5514
5529
|
class InvalidSubscription extends Error {}
|
|
5515
5530
|
class InvalidAuthorization extends Error {}
|
|
5516
5531
|
|
|
5517
|
-
const logger$
|
|
5532
|
+
const logger$9 = IssueReporter$1.loggerFor('simple-auth');
|
|
5518
5533
|
|
|
5519
5534
|
class Auth {
|
|
5520
5535
|
|
|
@@ -5549,7 +5564,7 @@ class Auth {
|
|
|
5549
5564
|
setApiClientId(this.clientId);
|
|
5550
5565
|
setRefreshExpiration(this.expiration);
|
|
5551
5566
|
setOnRefreshToken((token , session ) => {
|
|
5552
|
-
logger$
|
|
5567
|
+
logger$9.info('on refresh token done', { token });
|
|
5553
5568
|
setApiToken(token);
|
|
5554
5569
|
Wazo.Websocket.updateToken(token);
|
|
5555
5570
|
|
|
@@ -5594,7 +5609,7 @@ class Auth {
|
|
|
5594
5609
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
5595
5610
|
return this._onAuthenticated(rawSession);
|
|
5596
5611
|
} catch (e) {
|
|
5597
|
-
logger$
|
|
5612
|
+
logger$9.error('on validate token error', e);
|
|
5598
5613
|
console.warn(e);
|
|
5599
5614
|
return false;
|
|
5600
5615
|
}
|
|
@@ -5950,7 +5965,7 @@ class AdHocAPIConference {
|
|
|
5950
5965
|
|
|
5951
5966
|
/* */
|
|
5952
5967
|
|
|
5953
|
-
const parseCandidate = (candidate ) => {
|
|
5968
|
+
const parseCandidate$1 = (candidate ) => {
|
|
5954
5969
|
if (!candidate) {
|
|
5955
5970
|
return null;
|
|
5956
5971
|
}
|
|
@@ -6062,11 +6077,16 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6062
6077
|
|
|
6063
6078
|
// $FlowFixMe
|
|
6064
6079
|
setRemoteSessionDescription(sessionDescription ) {
|
|
6065
|
-
|
|
6080
|
+
try {
|
|
6081
|
+
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
6066
6082
|
|
|
6067
|
-
|
|
6083
|
+
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
6068
6084
|
|
|
6069
|
-
|
|
6085
|
+
return result;
|
|
6086
|
+
} catch (error) {
|
|
6087
|
+
this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
|
|
6088
|
+
throw error;
|
|
6089
|
+
}
|
|
6070
6090
|
}
|
|
6071
6091
|
|
|
6072
6092
|
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
@@ -6104,7 +6124,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6104
6124
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
6105
6125
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6106
6126
|
if (event.candidate) {
|
|
6107
|
-
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
6127
|
+
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6108
6128
|
}
|
|
6109
6129
|
};
|
|
6110
6130
|
|
|
@@ -6568,7 +6588,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6568
6588
|
const SEND_STATS_DELAY = 5000;
|
|
6569
6589
|
|
|
6570
6590
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6571
|
-
const logger$
|
|
6591
|
+
const logger$8 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6572
6592
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6573
6593
|
|
|
6574
6594
|
// events
|
|
@@ -6582,14 +6602,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6582
6602
|
const MESSAGE = 'message';
|
|
6583
6603
|
const ACCEPTED = 'accepted';
|
|
6584
6604
|
const REJECTED = 'rejected';
|
|
6585
|
-
const ON_TRACK = 'onTrack';
|
|
6586
|
-
const ON_REINVITE = 'reinvite';
|
|
6605
|
+
const ON_TRACK$1 = 'onTrack';
|
|
6606
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
6587
6607
|
const ON_ERROR = 'onError';
|
|
6588
6608
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6589
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6590
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
6609
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6610
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6591
6611
|
|
|
6592
|
-
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6612
|
+
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6593
6613
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6594
6614
|
class CanceledCallError extends Error {}
|
|
6595
6615
|
|
|
@@ -6725,12 +6745,12 @@ class WebRTCClient extends Emitter {
|
|
|
6725
6745
|
this.MESSAGE = MESSAGE;
|
|
6726
6746
|
this.ACCEPTED = ACCEPTED;
|
|
6727
6747
|
this.REJECTED = REJECTED;
|
|
6728
|
-
this.ON_TRACK = ON_TRACK;
|
|
6729
|
-
this.ON_REINVITE = ON_REINVITE;
|
|
6748
|
+
this.ON_TRACK = ON_TRACK$1;
|
|
6749
|
+
this.ON_REINVITE = ON_REINVITE$1;
|
|
6730
6750
|
this.ON_ERROR = ON_ERROR;
|
|
6731
6751
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6732
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6733
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6752
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6753
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6734
6754
|
}
|
|
6735
6755
|
|
|
6736
6756
|
configureMedia(media ) {
|
|
@@ -6747,13 +6767,13 @@ class WebRTCClient extends Emitter {
|
|
|
6747
6767
|
|
|
6748
6768
|
createUserAgent(configOverrides ) {
|
|
6749
6769
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6750
|
-
logger$
|
|
6770
|
+
logger$8.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6751
6771
|
|
|
6752
6772
|
webRTCConfiguration.delegate = {
|
|
6753
6773
|
onConnect: this.onConnect.bind(this),
|
|
6754
6774
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6755
6775
|
onInvite: (invitation ) => {
|
|
6756
|
-
logger$
|
|
6776
|
+
logger$8.info('sdk webrtc on invite', {
|
|
6757
6777
|
method: 'delegate.onInvite',
|
|
6758
6778
|
id: invitation.id,
|
|
6759
6779
|
remoteURI: invitation.remoteURI,
|
|
@@ -6796,7 +6816,7 @@ class WebRTCClient extends Emitter {
|
|
|
6796
6816
|
}
|
|
6797
6817
|
|
|
6798
6818
|
onConnect() {
|
|
6799
|
-
logger$
|
|
6819
|
+
logger$8.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6800
6820
|
this.eventEmitter.emit(CONNECTED);
|
|
6801
6821
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6802
6822
|
this.registerer.waitingToggle(false);
|
|
@@ -6805,7 +6825,7 @@ class WebRTCClient extends Emitter {
|
|
|
6805
6825
|
}
|
|
6806
6826
|
|
|
6807
6827
|
async onDisconnect(error ) {
|
|
6808
|
-
logger$
|
|
6828
|
+
logger$8.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6809
6829
|
this.connectionPromise = null;
|
|
6810
6830
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6811
6831
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6830,37 +6850,37 @@ class WebRTCClient extends Emitter {
|
|
|
6830
6850
|
};
|
|
6831
6851
|
|
|
6832
6852
|
if (this.skipRegister) {
|
|
6833
|
-
logger$
|
|
6853
|
+
logger$8.info('sdk webrtc skip register...', logInfo);
|
|
6834
6854
|
return Promise.resolve();
|
|
6835
6855
|
}
|
|
6836
6856
|
|
|
6837
|
-
logger$
|
|
6857
|
+
logger$8.info('sdk webrtc registering...', logInfo);
|
|
6838
6858
|
|
|
6839
6859
|
if (!this.userAgent) {
|
|
6840
|
-
logger$
|
|
6860
|
+
logger$8.info('sdk webrtc recreating User Agent');
|
|
6841
6861
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6842
6862
|
}
|
|
6843
6863
|
if (!this.userAgent || this.isRegistered()) {
|
|
6844
|
-
logger$
|
|
6864
|
+
logger$8.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6845
6865
|
return Promise.resolve();
|
|
6846
6866
|
}
|
|
6847
6867
|
|
|
6848
6868
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6849
|
-
logger$
|
|
6869
|
+
logger$8.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6850
6870
|
return Promise.resolve();
|
|
6851
6871
|
}
|
|
6852
6872
|
|
|
6853
6873
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6854
6874
|
|
|
6855
6875
|
const onRegisterFailed = () => {
|
|
6856
|
-
logger$
|
|
6876
|
+
logger$8.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6857
6877
|
this.connectionPromise = null;
|
|
6858
6878
|
if (this.registerer && this.registerer.waiting) {
|
|
6859
6879
|
this.registerer.waitingToggle(false);
|
|
6860
6880
|
}
|
|
6861
6881
|
|
|
6862
6882
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6863
|
-
logger$
|
|
6883
|
+
logger$8.info('sdk webrtc registering, retrying...', { tries });
|
|
6864
6884
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6865
6885
|
}
|
|
6866
6886
|
};
|
|
@@ -6869,18 +6889,18 @@ class WebRTCClient extends Emitter {
|
|
|
6869
6889
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6870
6890
|
// during the resolution of the primise.
|
|
6871
6891
|
if (!this.userAgent) {
|
|
6872
|
-
logger$
|
|
6892
|
+
logger$8.info('sdk webrtc recreating User Agent after connection');
|
|
6873
6893
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6874
6894
|
}
|
|
6875
6895
|
|
|
6876
|
-
logger$
|
|
6896
|
+
logger$8.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6877
6897
|
this.registerer = new Registerer(this.userAgent, registerOptions);
|
|
6878
6898
|
this.connectionPromise = null;
|
|
6879
6899
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6880
6900
|
|
|
6881
6901
|
// Bind registerer events
|
|
6882
6902
|
this.registerer.stateChange.addListener(newState => {
|
|
6883
|
-
logger$
|
|
6903
|
+
logger$8.info('sdk webrtc registering, state changed', { newState });
|
|
6884
6904
|
|
|
6885
6905
|
if (newState === RegistererState.Registered && this.registerer
|
|
6886
6906
|
&& this.registerer.state === RegistererState.Registered) {
|
|
@@ -6893,7 +6913,7 @@ class WebRTCClient extends Emitter {
|
|
|
6893
6913
|
const options = {
|
|
6894
6914
|
requestDelegate: {
|
|
6895
6915
|
onReject: response => {
|
|
6896
|
-
logger$
|
|
6916
|
+
logger$8.error('sdk webrtc registering, rejected', { response });
|
|
6897
6917
|
|
|
6898
6918
|
onRegisterFailed();
|
|
6899
6919
|
},
|
|
@@ -6901,13 +6921,13 @@ class WebRTCClient extends Emitter {
|
|
|
6901
6921
|
};
|
|
6902
6922
|
|
|
6903
6923
|
return this.registerer.register(options).catch((e) => {
|
|
6904
|
-
logger$
|
|
6924
|
+
logger$8.error('sdk webrtc registering, error', e);
|
|
6905
6925
|
|
|
6906
6926
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6907
6927
|
return e;
|
|
6908
6928
|
});
|
|
6909
6929
|
}).catch(error => {
|
|
6910
|
-
logger$
|
|
6930
|
+
logger$8.error('sdk webrtc registering, transport error', error);
|
|
6911
6931
|
onRegisterFailed();
|
|
6912
6932
|
});
|
|
6913
6933
|
}
|
|
@@ -6936,21 +6956,21 @@ class WebRTCClient extends Emitter {
|
|
|
6936
6956
|
}
|
|
6937
6957
|
|
|
6938
6958
|
unregister() {
|
|
6939
|
-
logger$
|
|
6959
|
+
logger$8.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6940
6960
|
if (!this.registerer) {
|
|
6941
6961
|
return Promise.resolve();
|
|
6942
6962
|
}
|
|
6943
6963
|
|
|
6944
6964
|
try {
|
|
6945
6965
|
return this.registerer.unregister().then(() => {
|
|
6946
|
-
logger$
|
|
6966
|
+
logger$8.info('sdk webrtc unregistered');
|
|
6947
6967
|
this._cleanupRegister();
|
|
6948
6968
|
}).catch(e => {
|
|
6949
|
-
logger$
|
|
6969
|
+
logger$8.error('sdk webrtc unregistering, promise error', e);
|
|
6950
6970
|
this._cleanupRegister();
|
|
6951
6971
|
});
|
|
6952
6972
|
} catch (e) {
|
|
6953
|
-
logger$
|
|
6973
|
+
logger$8.error('sdk webrtc unregistering, error', e);
|
|
6954
6974
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6955
6975
|
// error when the registerer is in a bad state
|
|
6956
6976
|
this._cleanupRegister();
|
|
@@ -6958,7 +6978,7 @@ class WebRTCClient extends Emitter {
|
|
|
6958
6978
|
}
|
|
6959
6979
|
|
|
6960
6980
|
stop() {
|
|
6961
|
-
logger$
|
|
6981
|
+
logger$8.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6962
6982
|
if (!this.userAgent) {
|
|
6963
6983
|
return Promise.resolve();
|
|
6964
6984
|
}
|
|
@@ -6966,12 +6986,12 @@ class WebRTCClient extends Emitter {
|
|
|
6966
6986
|
return this.userAgent.stop().then(() => {
|
|
6967
6987
|
return this._cleanupRegister();
|
|
6968
6988
|
}).catch(e => {
|
|
6969
|
-
logger$
|
|
6989
|
+
logger$8.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6970
6990
|
});
|
|
6971
6991
|
}
|
|
6972
6992
|
|
|
6973
6993
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6974
|
-
logger$
|
|
6994
|
+
logger$8.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6975
6995
|
const inviterOptions = {
|
|
6976
6996
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6977
6997
|
conference,
|
|
@@ -7002,7 +7022,7 @@ class WebRTCClient extends Emitter {
|
|
|
7002
7022
|
this._onAccepted(session, response.session, true);
|
|
7003
7023
|
},
|
|
7004
7024
|
onReject: (response ) => {
|
|
7005
|
-
logger$
|
|
7025
|
+
logger$8.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
7006
7026
|
this._stopSendingStats(session);
|
|
7007
7027
|
this.stopNetworkMonitoring(session);
|
|
7008
7028
|
|
|
@@ -7025,11 +7045,11 @@ class WebRTCClient extends Emitter {
|
|
|
7025
7045
|
}
|
|
7026
7046
|
|
|
7027
7047
|
answer(session , enableVideo ) {
|
|
7028
|
-
logger$
|
|
7048
|
+
logger$8.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
7029
7049
|
|
|
7030
7050
|
if (!session || !session.accept) {
|
|
7031
7051
|
const error = 'No session to answer, or not an invitation';
|
|
7032
|
-
logger$
|
|
7052
|
+
logger$8.warn(error);
|
|
7033
7053
|
return Promise.reject(new Error(error));
|
|
7034
7054
|
}
|
|
7035
7055
|
const options = {
|
|
@@ -7039,15 +7059,15 @@ class WebRTCClient extends Emitter {
|
|
|
7039
7059
|
return session.accept(options).then(() => {
|
|
7040
7060
|
if (session.isCanceled) {
|
|
7041
7061
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
7042
|
-
logger$
|
|
7062
|
+
logger$8.error(message, { id: session.id });
|
|
7043
7063
|
this.onCallEnded(session);
|
|
7044
7064
|
|
|
7045
7065
|
throw new CanceledCallError(message);
|
|
7046
7066
|
}
|
|
7047
|
-
logger$
|
|
7067
|
+
logger$8.info('sdk webrtc answer, accepted.');
|
|
7048
7068
|
this._onAccepted(session);
|
|
7049
7069
|
}).catch(e => {
|
|
7050
|
-
logger$
|
|
7070
|
+
logger$8.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
7051
7071
|
|
|
7052
7072
|
throw e;
|
|
7053
7073
|
});
|
|
@@ -7055,7 +7075,7 @@ class WebRTCClient extends Emitter {
|
|
|
7055
7075
|
|
|
7056
7076
|
hangup(session ) {
|
|
7057
7077
|
const { state, id } = session;
|
|
7058
|
-
logger$
|
|
7078
|
+
logger$8.info('sdk webrtc hangup call', { id, state });
|
|
7059
7079
|
|
|
7060
7080
|
try {
|
|
7061
7081
|
this._stopSendingStats(session);
|
|
@@ -7084,7 +7104,7 @@ class WebRTCClient extends Emitter {
|
|
|
7084
7104
|
|
|
7085
7105
|
return bye();
|
|
7086
7106
|
} catch (error) {
|
|
7087
|
-
logger$
|
|
7107
|
+
logger$8.warn('sdk webrtc hangup, error', error);
|
|
7088
7108
|
}
|
|
7089
7109
|
|
|
7090
7110
|
return null;
|
|
@@ -7102,7 +7122,7 @@ class WebRTCClient extends Emitter {
|
|
|
7102
7122
|
// Fetch and emit an event at `interval` with session network stats
|
|
7103
7123
|
startNetworkMonitoring(session , interval = 1000) {
|
|
7104
7124
|
const sessionId = this.getSipSessionId(session);
|
|
7105
|
-
logger$
|
|
7125
|
+
logger$8.info('starting network inspection', { id: sessionId });
|
|
7106
7126
|
|
|
7107
7127
|
this.sessionNetworkStats[sessionId] = [];
|
|
7108
7128
|
|
|
@@ -7112,7 +7132,7 @@ class WebRTCClient extends Emitter {
|
|
|
7112
7132
|
stopNetworkMonitoring(session ) {
|
|
7113
7133
|
const sessionId = this.getSipSessionId(session);
|
|
7114
7134
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
7115
|
-
logger$
|
|
7135
|
+
logger$8.info('stopping network inspection', { id: sessionId, exists });
|
|
7116
7136
|
|
|
7117
7137
|
if (exists) {
|
|
7118
7138
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -7122,17 +7142,17 @@ class WebRTCClient extends Emitter {
|
|
|
7122
7142
|
}
|
|
7123
7143
|
|
|
7124
7144
|
reject(session ) {
|
|
7125
|
-
logger$
|
|
7145
|
+
logger$8.info('sdk webrtc reject call', { id: session.id });
|
|
7126
7146
|
|
|
7127
7147
|
try {
|
|
7128
7148
|
return session.reject ? session.reject() : session.cancel();
|
|
7129
7149
|
} catch (e) {
|
|
7130
|
-
logger$
|
|
7150
|
+
logger$8.warn('Error when rejecting call', e.message, e.stack);
|
|
7131
7151
|
}
|
|
7132
7152
|
}
|
|
7133
7153
|
|
|
7134
7154
|
async close() {
|
|
7135
|
-
logger$
|
|
7155
|
+
logger$8.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
7136
7156
|
this._cleanupMedia();
|
|
7137
7157
|
this.connectionPromise = null;
|
|
7138
7158
|
|
|
@@ -7163,7 +7183,7 @@ class WebRTCClient extends Emitter {
|
|
|
7163
7183
|
// eg: "INVITE not rejectable in state Completed"
|
|
7164
7184
|
}
|
|
7165
7185
|
this.userAgent = null;
|
|
7166
|
-
logger$
|
|
7186
|
+
logger$8.info('sdk webrtc client closed');
|
|
7167
7187
|
}
|
|
7168
7188
|
|
|
7169
7189
|
getNumber(session ) {
|
|
@@ -7176,13 +7196,13 @@ class WebRTCClient extends Emitter {
|
|
|
7176
7196
|
}
|
|
7177
7197
|
|
|
7178
7198
|
mute(session ) {
|
|
7179
|
-
logger$
|
|
7199
|
+
logger$8.info('sdk webrtc mute', { id: session.id });
|
|
7180
7200
|
|
|
7181
7201
|
this._toggleAudio(session, true);
|
|
7182
7202
|
}
|
|
7183
7203
|
|
|
7184
7204
|
unmute(session ) {
|
|
7185
|
-
logger$
|
|
7205
|
+
logger$8.info('sdk webrtc unmute', { id: session.id });
|
|
7186
7206
|
|
|
7187
7207
|
this._toggleAudio(session, false);
|
|
7188
7208
|
}
|
|
@@ -7222,13 +7242,13 @@ class WebRTCClient extends Emitter {
|
|
|
7222
7242
|
}
|
|
7223
7243
|
|
|
7224
7244
|
toggleCameraOn(session ) {
|
|
7225
|
-
logger$
|
|
7245
|
+
logger$8.info('sdk webrtc toggle camera on', { id: session.id });
|
|
7226
7246
|
|
|
7227
7247
|
this._toggleVideo(session, false);
|
|
7228
7248
|
}
|
|
7229
7249
|
|
|
7230
7250
|
toggleCameraOff(session ) {
|
|
7231
|
-
logger$
|
|
7251
|
+
logger$8.info('sdk webrtc toggle camera off', { id: session.id });
|
|
7232
7252
|
|
|
7233
7253
|
this._toggleVideo(session, true);
|
|
7234
7254
|
}
|
|
@@ -7237,7 +7257,7 @@ class WebRTCClient extends Emitter {
|
|
|
7237
7257
|
const sessionId = this.getSipSessionId(session);
|
|
7238
7258
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
7239
7259
|
|
|
7240
|
-
logger$
|
|
7260
|
+
logger$8.info('sdk webrtc hold', {
|
|
7241
7261
|
sessionId,
|
|
7242
7262
|
keys: Object.keys(this.heldSessions),
|
|
7243
7263
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7286,7 +7306,7 @@ class WebRTCClient extends Emitter {
|
|
|
7286
7306
|
const sessionId = this.getSipSessionId(session);
|
|
7287
7307
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7288
7308
|
|
|
7289
|
-
logger$
|
|
7309
|
+
logger$8.info('sdk webrtc unhold', {
|
|
7290
7310
|
sessionId,
|
|
7291
7311
|
keys: Object.keys(this.heldSessions),
|
|
7292
7312
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7434,7 +7454,7 @@ class WebRTCClient extends Emitter {
|
|
|
7434
7454
|
if (!session.sessionDescriptionHandler) {
|
|
7435
7455
|
return;
|
|
7436
7456
|
}
|
|
7437
|
-
logger$
|
|
7457
|
+
logger$8.info('Sending DTMF', {
|
|
7438
7458
|
id: this.getSipSessionId(session),
|
|
7439
7459
|
tone,
|
|
7440
7460
|
});
|
|
@@ -7450,7 +7470,7 @@ class WebRTCClient extends Emitter {
|
|
|
7450
7470
|
transfer(session , target ) {
|
|
7451
7471
|
this.hold(session);
|
|
7452
7472
|
|
|
7453
|
-
logger$
|
|
7473
|
+
logger$8.info('Transfering a session', {
|
|
7454
7474
|
id: this.getSipSessionId(session),
|
|
7455
7475
|
target,
|
|
7456
7476
|
});
|
|
@@ -7472,17 +7492,17 @@ class WebRTCClient extends Emitter {
|
|
|
7472
7492
|
atxfer(session ) {
|
|
7473
7493
|
this.hold(session);
|
|
7474
7494
|
|
|
7475
|
-
logger$
|
|
7495
|
+
logger$8.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7476
7496
|
|
|
7477
7497
|
const result = {
|
|
7478
7498
|
newSession: null,
|
|
7479
7499
|
init: async (target ) => {
|
|
7480
|
-
logger$
|
|
7500
|
+
logger$8.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7481
7501
|
|
|
7482
7502
|
result.newSession = await this.call(target);
|
|
7483
7503
|
},
|
|
7484
7504
|
complete: () => {
|
|
7485
|
-
logger$
|
|
7505
|
+
logger$8.info('webrtc transfer completed', {
|
|
7486
7506
|
id: this.getSipSessionId(session),
|
|
7487
7507
|
referId: this.getSipSessionId(result.newSession),
|
|
7488
7508
|
});
|
|
@@ -7503,7 +7523,7 @@ class WebRTCClient extends Emitter {
|
|
|
7503
7523
|
return;
|
|
7504
7524
|
}
|
|
7505
7525
|
|
|
7506
|
-
logger$
|
|
7526
|
+
logger$8.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7507
7527
|
|
|
7508
7528
|
try {
|
|
7509
7529
|
sipSession.message({
|
|
@@ -7545,7 +7565,7 @@ class WebRTCClient extends Emitter {
|
|
|
7545
7565
|
}
|
|
7546
7566
|
|
|
7547
7567
|
changeAudioOutputVolume(volume ) {
|
|
7548
|
-
logger$
|
|
7568
|
+
logger$8.info('Changing audio output volume', { volume });
|
|
7549
7569
|
|
|
7550
7570
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7551
7571
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7557,7 +7577,7 @@ class WebRTCClient extends Emitter {
|
|
|
7557
7577
|
}
|
|
7558
7578
|
|
|
7559
7579
|
changeAudioOutputDevice(id ) {
|
|
7560
|
-
logger$
|
|
7580
|
+
logger$8.info('Changing audio output device', { id });
|
|
7561
7581
|
|
|
7562
7582
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7563
7583
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7574,7 +7594,7 @@ class WebRTCClient extends Emitter {
|
|
|
7574
7594
|
|
|
7575
7595
|
changeAudioInputDevice(id , session ) {
|
|
7576
7596
|
const currentId = this.getAudioDeviceId();
|
|
7577
|
-
logger$
|
|
7597
|
+
logger$8.info('setting audio input device', { id, currentId, session: !!session });
|
|
7578
7598
|
|
|
7579
7599
|
if (id === currentId) {
|
|
7580
7600
|
return null;
|
|
@@ -7620,7 +7640,7 @@ class WebRTCClient extends Emitter {
|
|
|
7620
7640
|
|
|
7621
7641
|
setVideoInputDevice(id ) {
|
|
7622
7642
|
const currentId = this.getVideoDeviceId();
|
|
7623
|
-
logger$
|
|
7643
|
+
logger$8.info('setting video input device', { id, currentId });
|
|
7624
7644
|
|
|
7625
7645
|
if (id === currentId) {
|
|
7626
7646
|
return null;
|
|
@@ -7645,7 +7665,7 @@ class WebRTCClient extends Emitter {
|
|
|
7645
7665
|
const sessionId = this.getSipSessionId(session);
|
|
7646
7666
|
const localStream = this.getLocalStream(sessionId);
|
|
7647
7667
|
|
|
7648
|
-
logger$
|
|
7668
|
+
logger$8.info('changing video input device', { id, sessionId });
|
|
7649
7669
|
|
|
7650
7670
|
// Release old video stream
|
|
7651
7671
|
if (localStream) {
|
|
@@ -7713,7 +7733,7 @@ class WebRTCClient extends Emitter {
|
|
|
7713
7733
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7714
7734
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7715
7735
|
|
|
7716
|
-
logger$
|
|
7736
|
+
logger$8.info('Sending reinvite', {
|
|
7717
7737
|
id: this.getSipSessionId(sipSession),
|
|
7718
7738
|
newConstraints,
|
|
7719
7739
|
conference,
|
|
@@ -7751,7 +7771,7 @@ class WebRTCClient extends Emitter {
|
|
|
7751
7771
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7752
7772
|
}
|
|
7753
7773
|
|
|
7754
|
-
logger$
|
|
7774
|
+
logger$8.info('on re-INVITE accepted', {
|
|
7755
7775
|
id: this.getSipSessionId(sipSession),
|
|
7756
7776
|
wasMuted,
|
|
7757
7777
|
shouldDoScreenSharing,
|
|
@@ -7769,7 +7789,7 @@ class WebRTCClient extends Emitter {
|
|
|
7769
7789
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7770
7790
|
}
|
|
7771
7791
|
|
|
7772
|
-
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7792
|
+
return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
|
|
7773
7793
|
},
|
|
7774
7794
|
},
|
|
7775
7795
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7926,7 +7946,7 @@ class WebRTCClient extends Emitter {
|
|
|
7926
7946
|
}
|
|
7927
7947
|
|
|
7928
7948
|
startHeartbeat() {
|
|
7929
|
-
logger$
|
|
7949
|
+
logger$8.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7930
7950
|
if (!this.userAgent) {
|
|
7931
7951
|
this.heartbeat.stop();
|
|
7932
7952
|
return;
|
|
@@ -7939,7 +7959,7 @@ class WebRTCClient extends Emitter {
|
|
|
7939
7959
|
}
|
|
7940
7960
|
|
|
7941
7961
|
stopHeartbeat() {
|
|
7942
|
-
logger$
|
|
7962
|
+
logger$8.info('sdk webrtc stop heartbeat');
|
|
7943
7963
|
this.heartbeat.stop();
|
|
7944
7964
|
}
|
|
7945
7965
|
|
|
@@ -7960,7 +7980,7 @@ class WebRTCClient extends Emitter {
|
|
|
7960
7980
|
}
|
|
7961
7981
|
|
|
7962
7982
|
attemptReconnection() {
|
|
7963
|
-
logger$
|
|
7983
|
+
logger$8.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7964
7984
|
if (!this.userAgent) {
|
|
7965
7985
|
return;
|
|
7966
7986
|
}
|
|
@@ -7985,7 +8005,7 @@ class WebRTCClient extends Emitter {
|
|
|
7985
8005
|
return;
|
|
7986
8006
|
}
|
|
7987
8007
|
|
|
7988
|
-
logger$
|
|
8008
|
+
logger$8.info('setting local media stream', {
|
|
7989
8009
|
sipSessionId,
|
|
7990
8010
|
tracks: newStream ? newStream.getTracks() : null,
|
|
7991
8011
|
});
|
|
@@ -8002,7 +8022,7 @@ class WebRTCClient extends Emitter {
|
|
|
8002
8022
|
|
|
8003
8023
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
8004
8024
|
|
|
8005
|
-
logger$
|
|
8025
|
+
logger$8.info('updating local stream', {
|
|
8006
8026
|
sipSessionId,
|
|
8007
8027
|
oldStream: !!oldStream,
|
|
8008
8028
|
tracks: newStream.getTracks(),
|
|
@@ -8022,7 +8042,7 @@ class WebRTCClient extends Emitter {
|
|
|
8022
8042
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
8023
8043
|
const pc = this.getPeerConnection(sessionId);
|
|
8024
8044
|
|
|
8025
|
-
logger$
|
|
8045
|
+
logger$8.info('Updating remote stream', {
|
|
8026
8046
|
sessionId,
|
|
8027
8047
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
8028
8048
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -8047,14 +8067,16 @@ class WebRTCClient extends Emitter {
|
|
|
8047
8067
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
8048
8068
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
8049
8069
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
8070
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
8050
8071
|
|
|
8051
|
-
logger$
|
|
8072
|
+
logger$8.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
8052
8073
|
|
|
8053
8074
|
return {
|
|
8054
8075
|
constraints: {
|
|
8055
8076
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
8056
8077
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
8057
|
-
video: screenSharing ? (isDesktop
|
|
8078
|
+
video: screenSharing ? (isDesktop
|
|
8079
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
8058
8080
|
: this._getVideoConstraints(enableVideo),
|
|
8059
8081
|
screen: screenSharing,
|
|
8060
8082
|
desktop: isDesktop,
|
|
@@ -8097,7 +8119,7 @@ class WebRTCClient extends Emitter {
|
|
|
8097
8119
|
}
|
|
8098
8120
|
|
|
8099
8121
|
_onTransportError() {
|
|
8100
|
-
logger$
|
|
8122
|
+
logger$8.error('on transport error');
|
|
8101
8123
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
8102
8124
|
this.attemptReconnection();
|
|
8103
8125
|
}
|
|
@@ -8106,7 +8128,7 @@ class WebRTCClient extends Emitter {
|
|
|
8106
8128
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
8107
8129
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
8108
8130
|
if (this.hasHeartbeat()) {
|
|
8109
|
-
logger$
|
|
8131
|
+
logger$8.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
8110
8132
|
|
|
8111
8133
|
this.heartbeat.onHeartbeat();
|
|
8112
8134
|
if (this.heartbeatCb) {
|
|
@@ -8117,7 +8139,7 @@ class WebRTCClient extends Emitter {
|
|
|
8117
8139
|
}
|
|
8118
8140
|
|
|
8119
8141
|
async _onHeartbeatTimeout() {
|
|
8120
|
-
logger$
|
|
8142
|
+
logger$8.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
8121
8143
|
|
|
8122
8144
|
if (this.heartbeatTimeoutCb) {
|
|
8123
8145
|
this.heartbeatTimeoutCb();
|
|
@@ -8129,7 +8151,7 @@ class WebRTCClient extends Emitter {
|
|
|
8129
8151
|
try {
|
|
8130
8152
|
await this.userAgent.transport.disconnect();
|
|
8131
8153
|
} catch (e) {
|
|
8132
|
-
logger$
|
|
8154
|
+
logger$8.error('Transport disconnection after heartbeat timeout, error', e);
|
|
8133
8155
|
}
|
|
8134
8156
|
}
|
|
8135
8157
|
|
|
@@ -8162,31 +8184,31 @@ class WebRTCClient extends Emitter {
|
|
|
8162
8184
|
}
|
|
8163
8185
|
|
|
8164
8186
|
_connectIfNeeded() {
|
|
8165
|
-
logger$
|
|
8187
|
+
logger$8.info('connect if needed, checking', { connected: this.isConnected() });
|
|
8166
8188
|
if (!this.userAgent) {
|
|
8167
|
-
logger$
|
|
8189
|
+
logger$8.info('need to recreate User Agent');
|
|
8168
8190
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
8169
8191
|
}
|
|
8170
8192
|
|
|
8171
8193
|
if (this.isConnected()) {
|
|
8172
|
-
logger$
|
|
8194
|
+
logger$8.info('webrtc sdk, already connected');
|
|
8173
8195
|
return Promise.resolve();
|
|
8174
8196
|
}
|
|
8175
8197
|
|
|
8176
8198
|
if (this.isConnecting()) {
|
|
8177
|
-
logger$
|
|
8199
|
+
logger$8.info('webrtc sdk, already connecting...');
|
|
8178
8200
|
|
|
8179
8201
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
8180
8202
|
return this.connectionPromise;
|
|
8181
8203
|
}
|
|
8182
8204
|
|
|
8183
8205
|
if (this.connectionPromise) {
|
|
8184
|
-
logger$
|
|
8206
|
+
logger$8.info('webrtc sdk, connection promise connecting...');
|
|
8185
8207
|
// $FlowFixMe
|
|
8186
8208
|
return this.connectionPromise;
|
|
8187
8209
|
}
|
|
8188
8210
|
|
|
8189
|
-
logger$
|
|
8211
|
+
logger$8.info('WebRTC UA needs to connect');
|
|
8190
8212
|
|
|
8191
8213
|
// Force UA to reconnect
|
|
8192
8214
|
if (this.userAgent && this.userAgent.state !== UserAgentState.Stopped) {
|
|
@@ -8311,7 +8333,7 @@ class WebRTCClient extends Emitter {
|
|
|
8311
8333
|
|
|
8312
8334
|
sdh.peerConnectionDelegate = {
|
|
8313
8335
|
onicecandidateerror: (error ) => {
|
|
8314
|
-
logger$
|
|
8336
|
+
logger$8.error('on icecandidate error', {
|
|
8315
8337
|
address: error.address,
|
|
8316
8338
|
port: error.port,
|
|
8317
8339
|
errorCode: error.errorCode,
|
|
@@ -8340,7 +8362,7 @@ class WebRTCClient extends Emitter {
|
|
|
8340
8362
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8341
8363
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8342
8364
|
}
|
|
8343
|
-
logger$
|
|
8365
|
+
logger$8.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8344
8366
|
|
|
8345
8367
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8346
8368
|
|
|
@@ -8356,12 +8378,12 @@ class WebRTCClient extends Emitter {
|
|
|
8356
8378
|
|
|
8357
8379
|
this._setupMedias(session);
|
|
8358
8380
|
|
|
8359
|
-
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8381
|
+
return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8360
8382
|
};
|
|
8361
8383
|
}
|
|
8362
8384
|
|
|
8363
8385
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8364
|
-
logger$
|
|
8386
|
+
logger$8.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8365
8387
|
|
|
8366
8388
|
this.storeSipSession(session);
|
|
8367
8389
|
|
|
@@ -8373,14 +8395,14 @@ class WebRTCClient extends Emitter {
|
|
|
8373
8395
|
const onTrack = (event ) => {
|
|
8374
8396
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8375
8397
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8376
|
-
logger$
|
|
8398
|
+
logger$8.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8377
8399
|
|
|
8378
8400
|
// Stop video track in audio only mode
|
|
8379
8401
|
if (isAudioOnly && kind === 'video') {
|
|
8380
8402
|
event.track.stop();
|
|
8381
8403
|
}
|
|
8382
8404
|
|
|
8383
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8405
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
8384
8406
|
};
|
|
8385
8407
|
|
|
8386
8408
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8389,12 +8411,14 @@ class WebRTCClient extends Emitter {
|
|
|
8389
8411
|
|
|
8390
8412
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8391
8413
|
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8414
|
+
if (pc) {
|
|
8415
|
+
pc.oniceconnectionstatechange = () => {
|
|
8416
|
+
logger$8.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8417
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8418
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8419
|
+
}
|
|
8420
|
+
};
|
|
8421
|
+
}
|
|
8398
8422
|
|
|
8399
8423
|
if (withEvent) {
|
|
8400
8424
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8563,10 +8587,10 @@ class WebRTCClient extends Emitter {
|
|
|
8563
8587
|
|
|
8564
8588
|
_stopSendingStats(session ) {
|
|
8565
8589
|
const sessionId = this.getSipSessionId(session);
|
|
8566
|
-
logger$
|
|
8590
|
+
logger$8.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8567
8591
|
|
|
8568
8592
|
if (sessionId in this.statsIntervals) {
|
|
8569
|
-
logger$
|
|
8593
|
+
logger$8.trace('Stop sending stats for call', { sessionId });
|
|
8570
8594
|
this.statsIntervals[sessionId]();
|
|
8571
8595
|
delete this.statsIntervals[sessionId];
|
|
8572
8596
|
}
|
|
@@ -8582,7 +8606,7 @@ class WebRTCClient extends Emitter {
|
|
|
8582
8606
|
try {
|
|
8583
8607
|
await this.userAgent.transport.disconnect();
|
|
8584
8608
|
} catch (e) {
|
|
8585
|
-
logger$
|
|
8609
|
+
logger$8.error('WebRTC transport disconnect, error', e);
|
|
8586
8610
|
}
|
|
8587
8611
|
}
|
|
8588
8612
|
}
|
|
@@ -8604,13 +8628,17 @@ class WebRTCClient extends Emitter {
|
|
|
8604
8628
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8605
8629
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8606
8630
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8631
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8607
8632
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8608
8633
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8634
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8609
8635
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8610
8636
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8611
8637
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8612
|
-
let audioBytesSent = 0;
|
|
8613
|
-
let audioBytesReceived = 0;
|
|
8638
|
+
let audioBytesSent = 0; // content + header
|
|
8639
|
+
let audioBytesReceived = 0; // content + header
|
|
8640
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8641
|
+
let audioContentReceived = 0;
|
|
8614
8642
|
let videoBytesSent = 0;
|
|
8615
8643
|
let videoBytesReceived = 0;
|
|
8616
8644
|
let transportSent = 0;
|
|
@@ -8620,6 +8648,7 @@ class WebRTCClient extends Emitter {
|
|
|
8620
8648
|
stats.forEach(report => {
|
|
8621
8649
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8622
8650
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8651
|
+
audioContentSent += Number(report.bytesSent);
|
|
8623
8652
|
}
|
|
8624
8653
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8625
8654
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -8631,6 +8660,7 @@ class WebRTCClient extends Emitter {
|
|
|
8631
8660
|
packetsLost += Number(report.packetsLost);
|
|
8632
8661
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8633
8662
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8663
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8634
8664
|
}
|
|
8635
8665
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8636
8666
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -8659,10 +8689,17 @@ class WebRTCClient extends Emitter {
|
|
|
8659
8689
|
});
|
|
8660
8690
|
|
|
8661
8691
|
networkStats.packetsLost = packetsLost;
|
|
8692
|
+
|
|
8662
8693
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8663
8694
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8664
8695
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8665
8696
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8697
|
+
|
|
8698
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8699
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8700
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8701
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8702
|
+
|
|
8666
8703
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8667
8704
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8668
8705
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8676,7 +8713,7 @@ class WebRTCClient extends Emitter {
|
|
|
8676
8713
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8677
8714
|
+ networkStats.transportSent;
|
|
8678
8715
|
|
|
8679
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8716
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8680
8717
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8681
8718
|
}
|
|
8682
8719
|
|
|
@@ -8701,11 +8738,12 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8701
8738
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8702
8739
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8703
8740
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8741
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8704
8742
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8705
8743
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8706
8744
|
const ON_MESSAGE = 'onMessage';
|
|
8707
|
-
const ON_REINVITE
|
|
8708
|
-
const ON_TRACK
|
|
8745
|
+
const ON_REINVITE = 'reinvite';
|
|
8746
|
+
const ON_TRACK = 'onTrack';
|
|
8709
8747
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8710
8748
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8711
8749
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8720,15 +8758,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8720
8758
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8721
8759
|
const ON_CALL_ERROR = 'onCallError';
|
|
8722
8760
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8723
|
-
const ON_NETWORK_STATS
|
|
8761
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8724
8762
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8725
8763
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8726
|
-
const ON_DISCONNECTED
|
|
8764
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
8727
8765
|
|
|
8728
8766
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8729
8767
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8730
8768
|
|
|
8731
|
-
const events
|
|
8769
|
+
const events = [
|
|
8732
8770
|
ON_USER_AGENT,
|
|
8733
8771
|
ON_REGISTERED,
|
|
8734
8772
|
ON_UNREGISTERED,
|
|
@@ -8745,9 +8783,10 @@ const events$1 = [
|
|
|
8745
8783
|
ON_CAMERA_DISABLED,
|
|
8746
8784
|
ON_CALL_FAILED,
|
|
8747
8785
|
ON_CALL_ENDED,
|
|
8786
|
+
ON_CALL_REJECTED,
|
|
8748
8787
|
ON_MESSAGE,
|
|
8749
|
-
ON_REINVITE
|
|
8750
|
-
ON_TRACK
|
|
8788
|
+
ON_REINVITE,
|
|
8789
|
+
ON_TRACK,
|
|
8751
8790
|
ON_AUDIO_STREAM,
|
|
8752
8791
|
ON_VIDEO_STREAM,
|
|
8753
8792
|
ON_REMOVE_STREAM,
|
|
@@ -8762,11 +8801,11 @@ const events$1 = [
|
|
|
8762
8801
|
ON_CALL_ERROR,
|
|
8763
8802
|
ON_CHAT,
|
|
8764
8803
|
ON_SIGNAL,
|
|
8765
|
-
ON_NETWORK_STATS
|
|
8766
|
-
ON_DISCONNECTED
|
|
8804
|
+
ON_NETWORK_STATS,
|
|
8805
|
+
ON_DISCONNECTED,
|
|
8767
8806
|
];
|
|
8768
8807
|
|
|
8769
|
-
const logger$
|
|
8808
|
+
const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8770
8809
|
|
|
8771
8810
|
class WebRTCPhone extends Emitter {
|
|
8772
8811
|
|
|
@@ -8839,7 +8878,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8839
8878
|
}).catch(error => {
|
|
8840
8879
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8841
8880
|
console.error('register error', error, error.message, error.stack);
|
|
8842
|
-
logger$
|
|
8881
|
+
logger$7.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8843
8882
|
});
|
|
8844
8883
|
}
|
|
8845
8884
|
|
|
@@ -8854,7 +8893,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8854
8893
|
if (!this.client) {
|
|
8855
8894
|
return;
|
|
8856
8895
|
}
|
|
8857
|
-
logger$
|
|
8896
|
+
logger$7.info('WebRTC phone stop');
|
|
8858
8897
|
this.client.stop();
|
|
8859
8898
|
}
|
|
8860
8899
|
|
|
@@ -8869,11 +8908,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8869
8908
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8870
8909
|
audioOnly = false, iceRestart = false) {
|
|
8871
8910
|
const sipSession = this.findSipSession(callSession);
|
|
8872
|
-
logger$
|
|
8911
|
+
logger$7.info('WebRTC phone - send reinvite', {
|
|
8873
8912
|
sessionId: sipSession ? sipSession.id : null,
|
|
8874
8913
|
constraints,
|
|
8875
8914
|
audioOnly,
|
|
8876
8915
|
conference,
|
|
8916
|
+
iceRestart,
|
|
8877
8917
|
});
|
|
8878
8918
|
|
|
8879
8919
|
if (!sipSession) {
|
|
@@ -8906,7 +8946,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8906
8946
|
}
|
|
8907
8947
|
|
|
8908
8948
|
startHeartbeat() {
|
|
8909
|
-
logger$
|
|
8949
|
+
logger$7.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8910
8950
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8911
8951
|
return;
|
|
8912
8952
|
}
|
|
@@ -8915,7 +8955,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8915
8955
|
}
|
|
8916
8956
|
|
|
8917
8957
|
stopHeartbeat() {
|
|
8918
|
-
logger$
|
|
8958
|
+
logger$7.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8919
8959
|
if (!this.client) {
|
|
8920
8960
|
return;
|
|
8921
8961
|
}
|
|
@@ -8932,7 +8972,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8932
8972
|
}
|
|
8933
8973
|
|
|
8934
8974
|
reconnect() {
|
|
8935
|
-
logger$
|
|
8975
|
+
logger$7.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8936
8976
|
if (!this.client) {
|
|
8937
8977
|
return;
|
|
8938
8978
|
}
|
|
@@ -8973,7 +9013,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8973
9013
|
return false;
|
|
8974
9014
|
}
|
|
8975
9015
|
|
|
8976
|
-
logger$
|
|
9016
|
+
logger$7.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8977
9017
|
|
|
8978
9018
|
this.client.downgradeToAudio(sipSession);
|
|
8979
9019
|
|
|
@@ -8996,7 +9036,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8996
9036
|
return Promise.resolve(false);
|
|
8997
9037
|
}
|
|
8998
9038
|
|
|
8999
|
-
logger$
|
|
9039
|
+
logger$7.info('Upgrade to video', {
|
|
9000
9040
|
id: callSession ? callSession.getId() : null,
|
|
9001
9041
|
constraints,
|
|
9002
9042
|
isConference,
|
|
@@ -9036,7 +9076,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9036
9076
|
|
|
9037
9077
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
9038
9078
|
const sipSession = this.findSipSession(callSession);
|
|
9039
|
-
logger$
|
|
9079
|
+
logger$7.info('Sending reinvite message', {
|
|
9040
9080
|
id: callSession ? callSession.getId() : null,
|
|
9041
9081
|
isUpgrade,
|
|
9042
9082
|
});
|
|
@@ -9062,7 +9102,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9062
9102
|
// Monkey patch to know when canceled with the CANCEL message
|
|
9063
9103
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
9064
9104
|
sipSession._onCancel = (message ) => {
|
|
9065
|
-
logger$
|
|
9105
|
+
logger$7.trace('on sip session canceled', { callId: message.callId });
|
|
9066
9106
|
|
|
9067
9107
|
onCancel(message);
|
|
9068
9108
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -9090,16 +9130,17 @@ class WebRTCPhone extends Emitter {
|
|
|
9090
9130
|
this.audioOutputVolume,
|
|
9091
9131
|
);
|
|
9092
9132
|
case SessionState.Terminating:
|
|
9093
|
-
logger$
|
|
9133
|
+
logger$7.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
9094
9134
|
|
|
9095
9135
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
9096
9136
|
|
|
9097
9137
|
break;
|
|
9098
9138
|
case SessionState.Terminated: {
|
|
9099
|
-
logger$
|
|
9139
|
+
logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9100
9140
|
|
|
9101
9141
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9102
9142
|
const callSession = this._createCallSession(sipSession);
|
|
9143
|
+
callSession.endTime = new Date();
|
|
9103
9144
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
9104
9145
|
|
|
9105
9146
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -9118,7 +9159,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9118
9159
|
const [stream] = event.streams;
|
|
9119
9160
|
const kind = event && event.track && event.track.kind;
|
|
9120
9161
|
|
|
9121
|
-
logger$
|
|
9162
|
+
logger$7.info('on track stream called on the peer connection', {
|
|
9122
9163
|
callId: this.getSipSessionId(sipSession),
|
|
9123
9164
|
streamId: stream ? stream.id : null,
|
|
9124
9165
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -9138,7 +9179,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9138
9179
|
};
|
|
9139
9180
|
|
|
9140
9181
|
peerConnection.onremovestream = event => {
|
|
9141
|
-
logger$
|
|
9182
|
+
logger$7.info('on remove stream called on the peer connection', {
|
|
9142
9183
|
id: event.stream.id,
|
|
9143
9184
|
tracks: event.stream.getTracks(),
|
|
9144
9185
|
});
|
|
@@ -9148,7 +9189,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9148
9189
|
}
|
|
9149
9190
|
|
|
9150
9191
|
async startScreenSharing(constraints , callSession ) {
|
|
9151
|
-
logger$
|
|
9192
|
+
logger$7.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
9152
9193
|
|
|
9153
9194
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
9154
9195
|
if (!screenShareStream) {
|
|
@@ -9188,7 +9229,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9188
9229
|
return;
|
|
9189
9230
|
}
|
|
9190
9231
|
|
|
9191
|
-
logger$
|
|
9232
|
+
logger$7.info('WebRTC phone - stop screen sharing', {
|
|
9192
9233
|
restoreLocalStream,
|
|
9193
9234
|
});
|
|
9194
9235
|
|
|
@@ -9244,7 +9285,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9244
9285
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
9245
9286
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9246
9287
|
|
|
9247
|
-
logger$
|
|
9288
|
+
logger$7.info('WebRTC phone - on screensharing', {
|
|
9248
9289
|
hadVideo,
|
|
9249
9290
|
id: this.getSipSessionId(sipSession),
|
|
9250
9291
|
screenTrack,
|
|
@@ -9252,7 +9293,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9252
9293
|
|
|
9253
9294
|
if (screenTrack) {
|
|
9254
9295
|
screenTrack.onended = () => {
|
|
9255
|
-
logger$
|
|
9296
|
+
logger$7.info('WebRTC phone - on screenshare ended', {
|
|
9256
9297
|
hadVideo,
|
|
9257
9298
|
id: this.getSipSessionId(sipSession),
|
|
9258
9299
|
screenTrack,
|
|
@@ -9283,7 +9324,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9283
9324
|
}
|
|
9284
9325
|
|
|
9285
9326
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9286
|
-
logger$
|
|
9327
|
+
logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9287
9328
|
|
|
9288
9329
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9289
9330
|
this.currentSipSession = sipSession;
|
|
@@ -9301,7 +9342,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9301
9342
|
}
|
|
9302
9343
|
|
|
9303
9344
|
changeAudioDevice(id ) {
|
|
9304
|
-
logger$
|
|
9345
|
+
logger$7.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9305
9346
|
this.audioOutputDeviceId = id;
|
|
9306
9347
|
this.client.changeAudioOutputDevice(id);
|
|
9307
9348
|
}
|
|
@@ -9311,14 +9352,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9311
9352
|
}
|
|
9312
9353
|
|
|
9313
9354
|
changeRingDevice(id ) {
|
|
9314
|
-
logger$
|
|
9355
|
+
logger$7.info('WebRTC phone - changing ring device', { id });
|
|
9315
9356
|
|
|
9316
9357
|
this.audioRingDeviceId = id;
|
|
9317
9358
|
}
|
|
9318
9359
|
|
|
9319
9360
|
// volume is a value between 0 and 1
|
|
9320
9361
|
changeAudioVolume(volume ) {
|
|
9321
|
-
logger$
|
|
9362
|
+
logger$7.info('WebRTC phone - changing audio volume', { volume });
|
|
9322
9363
|
|
|
9323
9364
|
this.audioOutputVolume = volume;
|
|
9324
9365
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9326,32 +9367,33 @@ class WebRTCPhone extends Emitter {
|
|
|
9326
9367
|
|
|
9327
9368
|
// volume is a value between 0 and 1
|
|
9328
9369
|
changeRingVolume(volume ) {
|
|
9329
|
-
logger$
|
|
9370
|
+
logger$7.info('WebRTC phone - changing ring volume', { volume });
|
|
9330
9371
|
|
|
9331
9372
|
this.audioRingVolume = volume;
|
|
9332
9373
|
}
|
|
9333
9374
|
|
|
9334
9375
|
changeAudioInputDevice(id ) {
|
|
9335
|
-
logger$
|
|
9376
|
+
logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9336
9377
|
|
|
9337
9378
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9338
9379
|
}
|
|
9339
9380
|
|
|
9340
9381
|
changeVideoInputDevice(id ) {
|
|
9341
|
-
logger$
|
|
9382
|
+
logger$7.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9342
9383
|
|
|
9343
9384
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9344
9385
|
}
|
|
9345
9386
|
|
|
9346
9387
|
changeSessionVideoInputDevice(id ) {
|
|
9347
|
-
logger$
|
|
9388
|
+
logger$7.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9348
9389
|
|
|
9349
9390
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9350
9391
|
}
|
|
9351
9392
|
|
|
9352
9393
|
_onCallTerminated(sipSession ) {
|
|
9353
|
-
logger$
|
|
9394
|
+
logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9354
9395
|
|
|
9396
|
+
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9355
9397
|
const callSession = this._createCallSession(sipSession);
|
|
9356
9398
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
9357
9399
|
const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
|
|
@@ -9369,7 +9411,6 @@ class WebRTCPhone extends Emitter {
|
|
|
9369
9411
|
}, 5);
|
|
9370
9412
|
}
|
|
9371
9413
|
|
|
9372
|
-
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9373
9414
|
if (sipSessionId) {
|
|
9374
9415
|
this.removeIncomingSessions(sipSessionId);
|
|
9375
9416
|
}
|
|
@@ -9384,7 +9425,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9384
9425
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9385
9426
|
|
|
9386
9427
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9387
|
-
logger$
|
|
9428
|
+
logger$7.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9388
9429
|
sipId: sipSession.id,
|
|
9389
9430
|
shouldRetrigger,
|
|
9390
9431
|
hasIncomingCallSession,
|
|
@@ -9475,37 +9516,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9475
9516
|
|
|
9476
9517
|
// Deprecated
|
|
9477
9518
|
getLocalStreamForCall(callSession ) {
|
|
9478
|
-
logger$
|
|
9519
|
+
logger$7.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9479
9520
|
|
|
9480
9521
|
return this.getLocalStream(callSession);
|
|
9481
9522
|
}
|
|
9482
9523
|
|
|
9483
9524
|
// Deprecated
|
|
9484
9525
|
getRemoteStreamForCall(callSession ) {
|
|
9485
|
-
logger$
|
|
9526
|
+
logger$7.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9486
9527
|
|
|
9487
9528
|
return this.getRemoteVideoStream(callSession);
|
|
9488
9529
|
}
|
|
9489
9530
|
|
|
9490
9531
|
getRemoteStreamsForCall(callSession ) {
|
|
9491
|
-
logger$
|
|
9532
|
+
logger$7.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9492
9533
|
|
|
9493
9534
|
return this.getRemoteStream(callSession);
|
|
9494
9535
|
}
|
|
9495
9536
|
|
|
9496
9537
|
accept(callSession , cameraEnabled ) {
|
|
9497
|
-
logger$
|
|
9538
|
+
logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9498
9539
|
if (this.currentSipSession) {
|
|
9499
9540
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9500
9541
|
}
|
|
9501
9542
|
|
|
9502
9543
|
if (!callSession) {
|
|
9503
|
-
logger$
|
|
9544
|
+
logger$7.warn('no CallSession to accept.');
|
|
9504
9545
|
return Promise.resolve(null);
|
|
9505
9546
|
}
|
|
9506
9547
|
|
|
9507
9548
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9508
|
-
logger$
|
|
9549
|
+
logger$7.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9509
9550
|
return Promise.resolve(callSession.sipCallId);
|
|
9510
9551
|
}
|
|
9511
9552
|
|
|
@@ -9517,24 +9558,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9517
9558
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9518
9559
|
if (sipSession) {
|
|
9519
9560
|
if (sipSession.state === SessionState.Terminated || sipSession.state === SessionState.Terminating) {
|
|
9520
|
-
logger$
|
|
9561
|
+
logger$7.warn('Trying to answer a terminated sipSession.');
|
|
9521
9562
|
|
|
9522
9563
|
return Promise.resolve(null);
|
|
9523
9564
|
}
|
|
9524
9565
|
|
|
9525
|
-
logger$
|
|
9566
|
+
logger$7.info('accept call, session found', { sipId: sipSession.id });
|
|
9526
9567
|
|
|
9527
9568
|
// $FlowFixMe
|
|
9528
9569
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9529
9570
|
return callSession.sipCallId;
|
|
9530
9571
|
}).catch(e => {
|
|
9531
|
-
logger$
|
|
9572
|
+
logger$7.error(e);
|
|
9532
9573
|
this.endCurrentCall(callSession);
|
|
9533
9574
|
throw e;
|
|
9534
9575
|
});
|
|
9535
9576
|
}
|
|
9536
9577
|
|
|
9537
|
-
logger$
|
|
9578
|
+
logger$7.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9538
9579
|
|
|
9539
9580
|
return Promise.resolve(null);
|
|
9540
9581
|
}
|
|
@@ -9544,7 +9585,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9544
9585
|
}
|
|
9545
9586
|
|
|
9546
9587
|
async reject(callSession ) {
|
|
9547
|
-
logger$
|
|
9588
|
+
logger$7.info('reject WebRTC called', { id: callSession.getId() });
|
|
9548
9589
|
|
|
9549
9590
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9550
9591
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9556,14 +9597,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9556
9597
|
|
|
9557
9598
|
const sipSession = this.findSipSession(callSession);
|
|
9558
9599
|
if (sipSession) {
|
|
9559
|
-
logger$
|
|
9600
|
+
logger$7.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9560
9601
|
|
|
9561
9602
|
this.client.hangup(sipSession);
|
|
9562
9603
|
}
|
|
9563
9604
|
}
|
|
9564
9605
|
|
|
9565
9606
|
async ignore(callSession ) {
|
|
9566
|
-
logger$
|
|
9607
|
+
logger$7.info('WebRTC ignore', { id: callSession.getId() });
|
|
9567
9608
|
|
|
9568
9609
|
// kill the ring
|
|
9569
9610
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9575,14 +9616,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9575
9616
|
const sipSession = this.findSipSession(callSession);
|
|
9576
9617
|
|
|
9577
9618
|
if (sipSession) {
|
|
9578
|
-
logger$
|
|
9619
|
+
logger$7.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9579
9620
|
|
|
9580
9621
|
return this.client.atxfer(sipSession);
|
|
9581
9622
|
}
|
|
9582
9623
|
}
|
|
9583
9624
|
|
|
9584
9625
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9585
|
-
logger$
|
|
9626
|
+
logger$7.info('WebRTC hold', { id: callSession.getId() });
|
|
9586
9627
|
|
|
9587
9628
|
const sipSession = this.findSipSession(callSession);
|
|
9588
9629
|
|
|
@@ -9597,18 +9638,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9597
9638
|
}
|
|
9598
9639
|
|
|
9599
9640
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9600
|
-
logger$
|
|
9641
|
+
logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9601
9642
|
|
|
9602
9643
|
const sipSession = this.findSipSession(callSession);
|
|
9603
9644
|
if (!sipSession) {
|
|
9604
9645
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9605
9646
|
}
|
|
9606
9647
|
|
|
9607
|
-
logger$
|
|
9648
|
+
logger$7.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9608
9649
|
|
|
9609
9650
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9610
9651
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9611
|
-
logger$
|
|
9652
|
+
logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9612
9653
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9613
9654
|
}
|
|
9614
9655
|
|
|
@@ -9633,7 +9674,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9633
9674
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9634
9675
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9635
9676
|
|
|
9636
|
-
logger$
|
|
9677
|
+
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9637
9678
|
|
|
9638
9679
|
// Stop screenshre if needed
|
|
9639
9680
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9664,7 +9705,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9664
9705
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9665
9706
|
}
|
|
9666
9707
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9667
|
-
logger$
|
|
9708
|
+
logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9668
9709
|
|
|
9669
9710
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9670
9711
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9708,14 +9749,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9708
9749
|
}
|
|
9709
9750
|
|
|
9710
9751
|
mute(callSession , withEvent = true) {
|
|
9711
|
-
logger$
|
|
9752
|
+
logger$7.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9712
9753
|
|
|
9713
9754
|
const sipSession = this.findSipSession(callSession);
|
|
9714
9755
|
if (!sipSession) {
|
|
9715
9756
|
return;
|
|
9716
9757
|
}
|
|
9717
9758
|
|
|
9718
|
-
logger$
|
|
9759
|
+
logger$7.info('WebRTC muting', { sipId: sipSession.id });
|
|
9719
9760
|
this.client.mute(sipSession);
|
|
9720
9761
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9721
9762
|
|
|
@@ -9729,14 +9770,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9729
9770
|
}
|
|
9730
9771
|
|
|
9731
9772
|
unmute(callSession , withEvent = true) {
|
|
9732
|
-
logger$
|
|
9773
|
+
logger$7.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9733
9774
|
|
|
9734
9775
|
const sipSession = this.findSipSession(callSession);
|
|
9735
9776
|
if (!sipSession) {
|
|
9736
9777
|
return;
|
|
9737
9778
|
}
|
|
9738
9779
|
|
|
9739
|
-
logger$
|
|
9780
|
+
logger$7.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9740
9781
|
this.client.unmute(sipSession);
|
|
9741
9782
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9742
9783
|
|
|
@@ -9763,7 +9804,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9763
9804
|
if (!sipSession) {
|
|
9764
9805
|
return;
|
|
9765
9806
|
}
|
|
9766
|
-
logger$
|
|
9807
|
+
logger$7.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9767
9808
|
|
|
9768
9809
|
this.client.toggleCameraOn(sipSession);
|
|
9769
9810
|
|
|
@@ -9775,7 +9816,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9775
9816
|
if (!sipSession) {
|
|
9776
9817
|
return;
|
|
9777
9818
|
}
|
|
9778
|
-
logger$
|
|
9819
|
+
logger$7.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9779
9820
|
|
|
9780
9821
|
this.client.toggleCameraOff(sipSession);
|
|
9781
9822
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9787,7 +9828,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9787
9828
|
return;
|
|
9788
9829
|
}
|
|
9789
9830
|
|
|
9790
|
-
logger$
|
|
9831
|
+
logger$7.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9791
9832
|
this.client.sendDTMF(sipSession, tone);
|
|
9792
9833
|
}
|
|
9793
9834
|
|
|
@@ -9795,7 +9836,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9795
9836
|
// @TODO: line is not used here
|
|
9796
9837
|
async makeCall(number , line , cameraEnabled ,
|
|
9797
9838
|
audioOnly = false, conference = false) {
|
|
9798
|
-
logger$
|
|
9839
|
+
logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
9799
9840
|
if (!number) {
|
|
9800
9841
|
return Promise.resolve(null);
|
|
9801
9842
|
}
|
|
@@ -9805,7 +9846,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9805
9846
|
}
|
|
9806
9847
|
if (this.currentSipSession) {
|
|
9807
9848
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9808
|
-
logger$
|
|
9849
|
+
logger$7.warn('Unable to hold current session when making another call', e);
|
|
9809
9850
|
});
|
|
9810
9851
|
}
|
|
9811
9852
|
|
|
@@ -9815,10 +9856,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9815
9856
|
this._bindEvents(sipSession);
|
|
9816
9857
|
} catch (error) {
|
|
9817
9858
|
console.warn(error);
|
|
9818
|
-
logger$
|
|
9859
|
+
logger$7.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9819
9860
|
return Promise.resolve(null);
|
|
9820
9861
|
}
|
|
9821
9862
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9863
|
+
callSession.creationTime = new Date();
|
|
9822
9864
|
|
|
9823
9865
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9824
9866
|
|
|
@@ -9843,7 +9885,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9843
9885
|
return;
|
|
9844
9886
|
}
|
|
9845
9887
|
|
|
9846
|
-
logger$
|
|
9888
|
+
logger$7.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9847
9889
|
|
|
9848
9890
|
this.client.transfer(sipSession, target);
|
|
9849
9891
|
}
|
|
@@ -9852,7 +9894,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9852
9894
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9853
9895
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9854
9896
|
|
|
9855
|
-
logger$
|
|
9897
|
+
logger$7.info('WebRTC indirect transfer', {
|
|
9856
9898
|
sipId: sipSession ? sipSession.id : null,
|
|
9857
9899
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9858
9900
|
});
|
|
@@ -9891,7 +9933,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9891
9933
|
return false;
|
|
9892
9934
|
}
|
|
9893
9935
|
|
|
9894
|
-
logger$
|
|
9936
|
+
logger$7.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9895
9937
|
|
|
9896
9938
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9897
9939
|
|
|
@@ -9937,7 +9979,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9937
9979
|
endCurrentCall(callSession ) {
|
|
9938
9980
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9939
9981
|
|
|
9940
|
-
logger$
|
|
9982
|
+
logger$7.info('Ending current call', {
|
|
9941
9983
|
id: callSession ? callSession.getId() : null,
|
|
9942
9984
|
isCurrent,
|
|
9943
9985
|
});
|
|
@@ -9961,7 +10003,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9961
10003
|
}
|
|
9962
10004
|
|
|
9963
10005
|
async close() {
|
|
9964
|
-
logger$
|
|
10006
|
+
logger$7.info('WebRTC close');
|
|
9965
10007
|
|
|
9966
10008
|
try {
|
|
9967
10009
|
await Promise.race([
|
|
@@ -9969,7 +10011,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9969
10011
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9970
10012
|
]);
|
|
9971
10013
|
} catch (e) {
|
|
9972
|
-
logger$
|
|
10014
|
+
logger$7.error('WebRTC close, unregister error', e);
|
|
9973
10015
|
}
|
|
9974
10016
|
|
|
9975
10017
|
this.client.close();
|
|
@@ -9987,12 +10029,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9987
10029
|
}
|
|
9988
10030
|
|
|
9989
10031
|
enableRinging() {
|
|
9990
|
-
logger$
|
|
10032
|
+
logger$7.info('WebRTC enable ringing');
|
|
9991
10033
|
this.ringingEnabled = true;
|
|
9992
10034
|
}
|
|
9993
10035
|
|
|
9994
10036
|
disableRinging() {
|
|
9995
|
-
logger$
|
|
10037
|
+
logger$7.info('WebRTC disable ringing');
|
|
9996
10038
|
this.ringingEnabled = false;
|
|
9997
10039
|
}
|
|
9998
10040
|
|
|
@@ -10014,8 +10056,12 @@ class WebRTCPhone extends Emitter {
|
|
|
10014
10056
|
}
|
|
10015
10057
|
|
|
10016
10058
|
const sessionId = this.incomingSessions[0];
|
|
10059
|
+
const sipSession = this.client.getSipSession(sessionId);
|
|
10060
|
+
if (!sipSession) {
|
|
10061
|
+
return null;
|
|
10062
|
+
}
|
|
10017
10063
|
|
|
10018
|
-
return this._createCallSession(
|
|
10064
|
+
return this._createCallSession(sipSession);
|
|
10019
10065
|
}
|
|
10020
10066
|
|
|
10021
10067
|
sendMessage(sipSession = null, body , contentType = 'text/plain') {
|
|
@@ -10032,7 +10078,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10032
10078
|
|
|
10033
10079
|
// Deprecated
|
|
10034
10080
|
getLocalMediaStream(callSession ) {
|
|
10035
|
-
logger$
|
|
10081
|
+
logger$7.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
10036
10082
|
return this.getLocalStream(callSession);
|
|
10037
10083
|
}
|
|
10038
10084
|
|
|
@@ -10074,7 +10120,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10074
10120
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
10075
10121
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
10076
10122
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
10077
|
-
logger$
|
|
10123
|
+
logger$7.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
10078
10124
|
|
|
10079
10125
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
10080
10126
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -10093,11 +10139,12 @@ class WebRTCPhone extends Emitter {
|
|
|
10093
10139
|
callSession);
|
|
10094
10140
|
}
|
|
10095
10141
|
|
|
10142
|
+
callSession.creationTime = new Date();
|
|
10096
10143
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
10097
10144
|
});
|
|
10098
10145
|
|
|
10099
10146
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
10100
|
-
logger$
|
|
10147
|
+
logger$7.info('WebRTC on reinvite', {
|
|
10101
10148
|
sessionId: args[0].id,
|
|
10102
10149
|
inviteId: args[1].id,
|
|
10103
10150
|
updatedCalleeName: args[2],
|
|
@@ -10117,7 +10164,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10117
10164
|
});
|
|
10118
10165
|
|
|
10119
10166
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
10120
|
-
logger$
|
|
10167
|
+
logger$7.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
10121
10168
|
|
|
10122
10169
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
10123
10170
|
|
|
@@ -10128,22 +10175,29 @@ class WebRTCPhone extends Emitter {
|
|
|
10128
10175
|
this.client.on('ended', () => {});
|
|
10129
10176
|
|
|
10130
10177
|
this.client.on(this.client.ON_ERROR, e => {
|
|
10131
|
-
logger$
|
|
10178
|
+
logger$7.error('WebRTC error', e);
|
|
10132
10179
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10133
10180
|
});
|
|
10134
10181
|
|
|
10182
|
+
this.client.on(this.client.REJECTED, session => {
|
|
10183
|
+
logger$7.info('WebRTC call rejected', session.id);
|
|
10184
|
+
const callSession = this._createCallSession(session);
|
|
10185
|
+
callSession.endTime = new Date();
|
|
10186
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
10187
|
+
});
|
|
10188
|
+
|
|
10135
10189
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10136
|
-
logger$
|
|
10190
|
+
logger$7.info('WebRTC unregistered');
|
|
10137
10191
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10138
10192
|
});
|
|
10139
10193
|
|
|
10140
10194
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
10141
|
-
logger$
|
|
10142
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
10195
|
+
logger$7.info('WebRTC disconnected');
|
|
10196
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10143
10197
|
});
|
|
10144
10198
|
|
|
10145
10199
|
this.client.on(this.client.REGISTERED, () => {
|
|
10146
|
-
logger$
|
|
10200
|
+
logger$7.info('WebRTC registered', {
|
|
10147
10201
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
10148
10202
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
10149
10203
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -10164,19 +10218,19 @@ class WebRTCPhone extends Emitter {
|
|
|
10164
10218
|
// Send reinvite with iceRestart
|
|
10165
10219
|
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10166
10220
|
} catch (e) {
|
|
10167
|
-
logger$
|
|
10221
|
+
logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10168
10222
|
}
|
|
10169
10223
|
}
|
|
10170
10224
|
});
|
|
10171
10225
|
|
|
10172
10226
|
this.client.on(this.client.CONNECTED, () => {
|
|
10173
|
-
logger$
|
|
10227
|
+
logger$7.info('WebRTC client connected');
|
|
10174
10228
|
|
|
10175
10229
|
this.stopHeartbeat();
|
|
10176
10230
|
});
|
|
10177
10231
|
|
|
10178
10232
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
10179
|
-
logger$
|
|
10233
|
+
logger$7.info('WebRTC client disconnected');
|
|
10180
10234
|
|
|
10181
10235
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10182
10236
|
|
|
@@ -10190,7 +10244,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10190
10244
|
});
|
|
10191
10245
|
|
|
10192
10246
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
10193
|
-
this.eventEmitter.emit(ON_TRACK
|
|
10247
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
10194
10248
|
});
|
|
10195
10249
|
|
|
10196
10250
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -10205,7 +10259,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10205
10259
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
10206
10260
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
10207
10261
|
|
|
10208
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
10262
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
10209
10263
|
});
|
|
10210
10264
|
|
|
10211
10265
|
// Used when upgrading directly in screenshare mode
|
|
@@ -10214,7 +10268,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10214
10268
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
10215
10269
|
const callSession = this.callSessions[sipSessionId];
|
|
10216
10270
|
|
|
10217
|
-
logger$
|
|
10271
|
+
logger$7.info('Updrading directly in screensharing mode', {
|
|
10218
10272
|
sipSessionId,
|
|
10219
10273
|
tracks: localStream ? localStream.getTracks() : null,
|
|
10220
10274
|
});
|
|
@@ -10344,6 +10398,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10344
10398
|
const number = identity ? identity.uri._normal.user : null;
|
|
10345
10399
|
const { state } = sipSession || {};
|
|
10346
10400
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10401
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10347
10402
|
|
|
10348
10403
|
const callSession = new CallSession({
|
|
10349
10404
|
callId: fromSession && fromSession.callId,
|
|
@@ -10351,6 +10406,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10351
10406
|
sipStatus: state,
|
|
10352
10407
|
displayName: identity ? identity.displayName || number : number,
|
|
10353
10408
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10409
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10410
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10354
10411
|
answered: state === SessionState.Established,
|
|
10355
10412
|
paused: this.client.isCallHeld(sipSession),
|
|
10356
10413
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10361,6 +10418,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10361
10418
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10362
10419
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10363
10420
|
recordingPaused: false, // @TODO
|
|
10421
|
+
sipSession,
|
|
10364
10422
|
...extra,
|
|
10365
10423
|
});
|
|
10366
10424
|
|
|
@@ -10389,11 +10447,12 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10389
10447
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10390
10448
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10391
10449
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10450
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10392
10451
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10393
10452
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10394
10453
|
ON_MESSAGE: ON_MESSAGE,
|
|
10395
|
-
ON_REINVITE: ON_REINVITE
|
|
10396
|
-
ON_TRACK: ON_TRACK
|
|
10454
|
+
ON_REINVITE: ON_REINVITE,
|
|
10455
|
+
ON_TRACK: ON_TRACK,
|
|
10397
10456
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10398
10457
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10399
10458
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10408,16 +10467,24 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10408
10467
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10409
10468
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10410
10469
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10411
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS
|
|
10470
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10412
10471
|
ON_CHAT: ON_CHAT,
|
|
10413
10472
|
ON_SIGNAL: ON_SIGNAL,
|
|
10414
|
-
ON_DISCONNECTED: ON_DISCONNECTED
|
|
10473
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10415
10474
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10416
10475
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10417
|
-
events: events
|
|
10476
|
+
events: events,
|
|
10418
10477
|
'default': WebRTCPhone
|
|
10419
10478
|
});
|
|
10420
10479
|
|
|
10480
|
+
/* */
|
|
10481
|
+
class SFUNotAvailableError extends Error {
|
|
10482
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10483
|
+
super(message);
|
|
10484
|
+
this.name = 'SFUNotAvailableError';
|
|
10485
|
+
}
|
|
10486
|
+
}
|
|
10487
|
+
|
|
10421
10488
|
//
|
|
10422
10489
|
|
|
10423
10490
|
const logger$6 = IssueReporter$1.loggerFor('simple-phone');
|
|
@@ -10802,13 +10869,13 @@ class Phone extends Emitter {
|
|
|
10802
10869
|
|
|
10803
10870
|
checkSfu() {
|
|
10804
10871
|
if (!this.hasSfu()) {
|
|
10805
|
-
throw new
|
|
10872
|
+
throw new SFUNotAvailableError();
|
|
10806
10873
|
}
|
|
10807
10874
|
}
|
|
10808
10875
|
|
|
10809
10876
|
_transferEvents() {
|
|
10810
10877
|
this.unbind();
|
|
10811
|
-
[...events, ...transportEvents].forEach(event => {
|
|
10878
|
+
[...events$1, ...transportEvents].forEach(event => {
|
|
10812
10879
|
this.client.on(event, (...args) =>
|
|
10813
10880
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
10814
10881
|
});
|
|
@@ -10830,7 +10897,7 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
10830
10897
|
|
|
10831
10898
|
//
|
|
10832
10899
|
|
|
10833
|
-
const SOCKET_EVENTS = {
|
|
10900
|
+
const SOCKET_EVENTS$1 = {
|
|
10834
10901
|
ON_OPEN: 'onopen',
|
|
10835
10902
|
ON_MESSAGE: 'onmessage',
|
|
10836
10903
|
ON_ERROR: 'onerror',
|
|
@@ -10926,7 +10993,7 @@ const BLACKLIST_EVENTS = [
|
|
|
10926
10993
|
];
|
|
10927
10994
|
|
|
10928
10995
|
const HEARTBEAT_ENGINE_VERSION = '20.09';
|
|
10929
|
-
const logger$
|
|
10996
|
+
const logger$5 = IssueReporter$1.loggerFor('wazo-ws');
|
|
10930
10997
|
const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
|
|
10931
10998
|
|
|
10932
10999
|
class WebSocketClient extends Emitter {
|
|
@@ -10975,24 +11042,24 @@ class WebSocketClient extends Emitter {
|
|
|
10975
11042
|
}
|
|
10976
11043
|
|
|
10977
11044
|
connect() {
|
|
10978
|
-
logger$
|
|
11045
|
+
logger$5.info('connect method started', { host: this.host, token: this.token });
|
|
10979
11046
|
this.socket = new ReconnectingWebSocket(this._getUrl.bind(this), [], this.options);
|
|
10980
11047
|
if (this.options.binaryType) {
|
|
10981
11048
|
this.socket.binaryType = this.options.binaryType;
|
|
10982
11049
|
}
|
|
10983
11050
|
|
|
10984
11051
|
this.socket.onopen = () => {
|
|
10985
|
-
logger$
|
|
10986
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
11052
|
+
logger$5.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
11053
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
|
|
10987
11054
|
};
|
|
10988
11055
|
|
|
10989
11056
|
this.socket.onerror = event => {
|
|
10990
|
-
logger$
|
|
10991
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
11057
|
+
logger$5.error('on Wazo WS error', event.target);
|
|
11058
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
|
|
10992
11059
|
};
|
|
10993
11060
|
|
|
10994
11061
|
this.socket.onmessage = (event ) => {
|
|
10995
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
11062
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
|
|
10996
11063
|
|
|
10997
11064
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
10998
11065
|
let { name } = message;
|
|
@@ -11017,7 +11084,7 @@ class WebSocketClient extends Emitter {
|
|
|
11017
11084
|
|
|
11018
11085
|
this.socket.onclose = event => {
|
|
11019
11086
|
// Can't be converted to JSON (circular structure)
|
|
11020
|
-
logger$
|
|
11087
|
+
logger$5.info('on Wazo WS close', {
|
|
11021
11088
|
reason: event.reason,
|
|
11022
11089
|
code: event.code,
|
|
11023
11090
|
readyState: event.target.readyState,
|
|
@@ -11025,22 +11092,22 @@ class WebSocketClient extends Emitter {
|
|
|
11025
11092
|
token: this.token,
|
|
11026
11093
|
});
|
|
11027
11094
|
this.initialized = false;
|
|
11028
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
11095
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
|
|
11029
11096
|
|
|
11030
11097
|
switch (event.code) {
|
|
11031
11098
|
case 4002:
|
|
11032
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
11099
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
|
|
11033
11100
|
break;
|
|
11034
11101
|
}
|
|
11035
11102
|
};
|
|
11036
11103
|
|
|
11037
11104
|
this.socket.onerror = event => {
|
|
11038
|
-
logger$
|
|
11105
|
+
logger$5.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
|
|
11039
11106
|
};
|
|
11040
11107
|
}
|
|
11041
11108
|
|
|
11042
11109
|
close(force = false) {
|
|
11043
|
-
logger$
|
|
11110
|
+
logger$5.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
|
|
11044
11111
|
|
|
11045
11112
|
if (!this.socket) {
|
|
11046
11113
|
return;
|
|
@@ -11058,7 +11125,7 @@ class WebSocketClient extends Emitter {
|
|
|
11058
11125
|
|
|
11059
11126
|
updateToken(token ) {
|
|
11060
11127
|
this.token = token;
|
|
11061
|
-
logger$
|
|
11128
|
+
logger$5.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
|
|
11062
11129
|
|
|
11063
11130
|
if (this.socket) {
|
|
11064
11131
|
// If still connected, send the token to the WS
|
|
@@ -11076,7 +11143,7 @@ class WebSocketClient extends Emitter {
|
|
|
11076
11143
|
}
|
|
11077
11144
|
|
|
11078
11145
|
startHeartbeat() {
|
|
11079
|
-
logger$
|
|
11146
|
+
logger$5.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
|
|
11080
11147
|
|
|
11081
11148
|
if (!this.socket) {
|
|
11082
11149
|
this.heartbeat.stop();
|
|
@@ -11090,7 +11157,7 @@ class WebSocketClient extends Emitter {
|
|
|
11090
11157
|
}
|
|
11091
11158
|
|
|
11092
11159
|
stopHeartbeat() {
|
|
11093
|
-
logger$
|
|
11160
|
+
logger$5.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
|
|
11094
11161
|
|
|
11095
11162
|
this.heartbeat.stop();
|
|
11096
11163
|
}
|
|
@@ -11120,7 +11187,7 @@ class WebSocketClient extends Emitter {
|
|
|
11120
11187
|
}
|
|
11121
11188
|
|
|
11122
11189
|
reconnect(reason ) {
|
|
11123
|
-
logger$
|
|
11190
|
+
logger$5.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
|
|
11124
11191
|
if (!this.socket) {
|
|
11125
11192
|
return;
|
|
11126
11193
|
}
|
|
@@ -11145,7 +11212,7 @@ class WebSocketClient extends Emitter {
|
|
|
11145
11212
|
break;
|
|
11146
11213
|
case 'start':
|
|
11147
11214
|
this.initialized = true;
|
|
11148
|
-
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
11215
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
|
|
11149
11216
|
break;
|
|
11150
11217
|
default:
|
|
11151
11218
|
this.eventEmitter.emit('message', message);
|
|
@@ -11176,7 +11243,7 @@ class WebSocketClient extends Emitter {
|
|
|
11176
11243
|
this.close();
|
|
11177
11244
|
}
|
|
11178
11245
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
11179
|
-
logger$
|
|
11246
|
+
logger$5.log('Wazo WS url computed to reconnect', { url });
|
|
11180
11247
|
|
|
11181
11248
|
return url;
|
|
11182
11249
|
}
|
|
@@ -11184,15 +11251,15 @@ class WebSocketClient extends Emitter {
|
|
|
11184
11251
|
_onHeartbeat(message ) {
|
|
11185
11252
|
if (message.payload === 'pong') {
|
|
11186
11253
|
this.heartbeat.onHeartbeat();
|
|
11187
|
-
logger$
|
|
11254
|
+
logger$5.log('on heartbeat received from Wazo WS');
|
|
11188
11255
|
}
|
|
11189
11256
|
}
|
|
11190
11257
|
|
|
11191
11258
|
async _onHeartbeatTimeout() {
|
|
11192
|
-
logger$
|
|
11259
|
+
logger$5.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
11193
11260
|
|
|
11194
11261
|
this.close();
|
|
11195
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11262
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11196
11263
|
|
|
11197
11264
|
if (this.onHeartBeatTimeout) {
|
|
11198
11265
|
this.onHeartBeatTimeout();
|
|
@@ -11272,7 +11339,7 @@ WebSocketClient.eventLists = [
|
|
|
11272
11339
|
|
|
11273
11340
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
11274
11341
|
__proto__: null,
|
|
11275
|
-
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
11342
|
+
SOCKET_EVENTS: SOCKET_EVENTS$1,
|
|
11276
11343
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
11277
11344
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
11278
11345
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -11345,10 +11412,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11345
11412
|
|
|
11346
11413
|
//
|
|
11347
11414
|
|
|
11348
|
-
const { SOCKET_EVENTS
|
|
11349
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS
|
|
11415
|
+
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11416
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
11350
11417
|
|
|
11351
|
-
const logger$
|
|
11418
|
+
const logger$4 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
11352
11419
|
|
|
11353
11420
|
class Websocket extends Emitter {
|
|
11354
11421
|
|
|
@@ -11362,9 +11429,9 @@ class Websocket extends Emitter {
|
|
|
11362
11429
|
// $FlowFixMe
|
|
11363
11430
|
this[key] = OTHER_EVENTS[key];
|
|
11364
11431
|
});
|
|
11365
|
-
Object.keys(SOCKET_EVENTS
|
|
11432
|
+
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
11366
11433
|
// $FlowFixMe
|
|
11367
|
-
this[key] = SOCKET_EVENTS
|
|
11434
|
+
this[key] = SOCKET_EVENTS[key];
|
|
11368
11435
|
});
|
|
11369
11436
|
this.eventLists = WebSocketClient.eventLists;
|
|
11370
11437
|
|
|
@@ -11372,7 +11439,7 @@ class Websocket extends Emitter {
|
|
|
11372
11439
|
}
|
|
11373
11440
|
|
|
11374
11441
|
open(host , session ) {
|
|
11375
|
-
logger$
|
|
11442
|
+
logger$4.info('open simple WebSocket', { host, token: session.token });
|
|
11376
11443
|
this.ws = new WebSocketClient(
|
|
11377
11444
|
{
|
|
11378
11445
|
host,
|
|
@@ -11400,7 +11467,7 @@ class Websocket extends Emitter {
|
|
|
11400
11467
|
}
|
|
11401
11468
|
|
|
11402
11469
|
updateToken(token ) {
|
|
11403
|
-
logger$
|
|
11470
|
+
logger$4.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
11404
11471
|
|
|
11405
11472
|
if (!this.ws) {
|
|
11406
11473
|
return;
|
|
@@ -11428,7 +11495,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11428
11495
|
|
|
11429
11496
|
//
|
|
11430
11497
|
|
|
11431
|
-
const logger$
|
|
11498
|
+
const logger$3 = IssueReporter$1.loggerFor('room');
|
|
11432
11499
|
|
|
11433
11500
|
class Participant extends Emitter {
|
|
11434
11501
|
|
|
@@ -11550,7 +11617,7 @@ class Participant extends Emitter {
|
|
|
11550
11617
|
}
|
|
11551
11618
|
|
|
11552
11619
|
onTalking(isTalking ) {
|
|
11553
|
-
logger$
|
|
11620
|
+
logger$3.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
11554
11621
|
this.isTalking = isTalking;
|
|
11555
11622
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
11556
11623
|
// directly from asterisk, there's no need to do so
|
|
@@ -11653,7 +11720,7 @@ class Participant extends Emitter {
|
|
|
11653
11720
|
}
|
|
11654
11721
|
|
|
11655
11722
|
updateStatus(status , broadcast = true) {
|
|
11656
|
-
logger$
|
|
11723
|
+
logger$3.info('updating participant status', { name: this.name, status });
|
|
11657
11724
|
|
|
11658
11725
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
11659
11726
|
if (status.audioMuted) {
|
|
@@ -11701,7 +11768,7 @@ class Participant extends Emitter {
|
|
|
11701
11768
|
|
|
11702
11769
|
broadcastStatus(inboundStatus = null) {
|
|
11703
11770
|
const status = inboundStatus || this.getStatus();
|
|
11704
|
-
logger$
|
|
11771
|
+
logger$3.info('broadcasting participant status', { callId: this.callId, status });
|
|
11705
11772
|
|
|
11706
11773
|
this.room.sendSignal({
|
|
11707
11774
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|
|
@@ -11737,9 +11804,9 @@ class LocalParticipant extends Participant {
|
|
|
11737
11804
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
11738
11805
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
11739
11806
|
|
|
11740
|
-
const logger$
|
|
11807
|
+
const logger$2 = IssueReporter$1.loggerFor('sdk-room');
|
|
11741
11808
|
|
|
11742
|
-
class Room extends Emitter {
|
|
11809
|
+
class Room$1 extends Emitter {
|
|
11743
11810
|
|
|
11744
11811
|
|
|
11745
11812
|
|
|
@@ -11797,7 +11864,7 @@ class Room extends Emitter {
|
|
|
11797
11864
|
extra = {},
|
|
11798
11865
|
) {
|
|
11799
11866
|
super();
|
|
11800
|
-
logger$
|
|
11867
|
+
logger$2.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
11801
11868
|
|
|
11802
11869
|
// Represents the room callSession
|
|
11803
11870
|
this.callSession = callSession;
|
|
@@ -11863,7 +11930,7 @@ class Room extends Emitter {
|
|
|
11863
11930
|
* @returns {Promise<Room>}
|
|
11864
11931
|
*/
|
|
11865
11932
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
11866
|
-
logger$
|
|
11933
|
+
logger$2.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
11867
11934
|
|
|
11868
11935
|
if (!room) {
|
|
11869
11936
|
await Wazo.Phone.connect();
|
|
@@ -11876,7 +11943,7 @@ class Room extends Emitter {
|
|
|
11876
11943
|
|
|
11877
11944
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
11878
11945
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
11879
|
-
logger$
|
|
11946
|
+
logger$2.info('room call received via WS', { callId: data.call_id });
|
|
11880
11947
|
if (room) {
|
|
11881
11948
|
room.setCallId(data.call_id);
|
|
11882
11949
|
}
|
|
@@ -11884,7 +11951,7 @@ class Room extends Emitter {
|
|
|
11884
11951
|
|
|
11885
11952
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
11886
11953
|
// eslint-disable-next-line no-param-reassign
|
|
11887
|
-
room = new Room(callSession, extension, null, null, extra);
|
|
11954
|
+
room = new Room$1(callSession, extension, null, null, extra);
|
|
11888
11955
|
|
|
11889
11956
|
// Wait for the call to be accepted
|
|
11890
11957
|
await new Promise((resolve, reject) => {
|
|
@@ -11905,7 +11972,7 @@ class Room extends Emitter {
|
|
|
11905
11972
|
// Retrieve conference
|
|
11906
11973
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
11907
11974
|
|
|
11908
|
-
logger$
|
|
11975
|
+
logger$2.info('connected to room', {
|
|
11909
11976
|
sourceId: conference ? conference.sourceId : null,
|
|
11910
11977
|
name: conference ? conference.name : null,
|
|
11911
11978
|
});
|
|
@@ -11915,7 +11982,7 @@ class Room extends Emitter {
|
|
|
11915
11982
|
room.setName(conference.name);
|
|
11916
11983
|
}
|
|
11917
11984
|
} else if (meeting) {
|
|
11918
|
-
logger$
|
|
11985
|
+
logger$2.info('Already connected to meeting', {
|
|
11919
11986
|
uuid: meeting.uuid,
|
|
11920
11987
|
name: meeting.name,
|
|
11921
11988
|
});
|
|
@@ -11928,13 +11995,13 @@ class Room extends Emitter {
|
|
|
11928
11995
|
}
|
|
11929
11996
|
|
|
11930
11997
|
static disconnect() {
|
|
11931
|
-
logger$
|
|
11998
|
+
logger$2.info('static disconnection to room');
|
|
11932
11999
|
|
|
11933
12000
|
Wazo.Phone.disconnect();
|
|
11934
12001
|
}
|
|
11935
12002
|
|
|
11936
12003
|
async disconnect() {
|
|
11937
|
-
logger$
|
|
12004
|
+
logger$2.info('disconnection to room called');
|
|
11938
12005
|
|
|
11939
12006
|
await Wazo.Phone.hangup(this.callSession);
|
|
11940
12007
|
this.callSession = null;
|
|
@@ -11954,19 +12021,19 @@ class Room extends Emitter {
|
|
|
11954
12021
|
}
|
|
11955
12022
|
|
|
11956
12023
|
setSourceId(sourceId ) {
|
|
11957
|
-
logger$
|
|
12024
|
+
logger$2.info('set room source id', { sourceId });
|
|
11958
12025
|
|
|
11959
12026
|
this.sourceId = sourceId;
|
|
11960
12027
|
}
|
|
11961
12028
|
|
|
11962
12029
|
setMeetingUuid(meetingUuid ) {
|
|
11963
|
-
logger$
|
|
12030
|
+
logger$2.info('set meeting uuid', { meetingUuid });
|
|
11964
12031
|
|
|
11965
12032
|
this.meetingUuid = meetingUuid;
|
|
11966
12033
|
}
|
|
11967
12034
|
|
|
11968
12035
|
setCallId(callId ) {
|
|
11969
|
-
logger$
|
|
12036
|
+
logger$2.info('set room call id', { callId });
|
|
11970
12037
|
|
|
11971
12038
|
if (callId) {
|
|
11972
12039
|
this.callId = callId;
|
|
@@ -11974,7 +12041,7 @@ class Room extends Emitter {
|
|
|
11974
12041
|
}
|
|
11975
12042
|
|
|
11976
12043
|
setName(name ) {
|
|
11977
|
-
logger$
|
|
12044
|
+
logger$2.info('set room name', { name });
|
|
11978
12045
|
|
|
11979
12046
|
this.name = name;
|
|
11980
12047
|
}
|
|
@@ -11993,7 +12060,7 @@ class Room extends Emitter {
|
|
|
11993
12060
|
}
|
|
11994
12061
|
|
|
11995
12062
|
async startScreenSharing(constraints ) {
|
|
11996
|
-
logger$
|
|
12063
|
+
logger$2.info('start room screen sharing', { constraints });
|
|
11997
12064
|
|
|
11998
12065
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
11999
12066
|
if (!screensharingStream) {
|
|
@@ -12007,7 +12074,7 @@ class Room extends Emitter {
|
|
|
12007
12074
|
}
|
|
12008
12075
|
|
|
12009
12076
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
12010
|
-
logger$
|
|
12077
|
+
logger$2.info('stop room screen sharing');
|
|
12011
12078
|
|
|
12012
12079
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
12013
12080
|
|
|
@@ -12019,7 +12086,7 @@ class Room extends Emitter {
|
|
|
12019
12086
|
}
|
|
12020
12087
|
|
|
12021
12088
|
turnCameraOff() {
|
|
12022
|
-
logger$
|
|
12089
|
+
logger$2.info('turn room camera off');
|
|
12023
12090
|
|
|
12024
12091
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
12025
12092
|
|
|
@@ -12029,7 +12096,7 @@ class Room extends Emitter {
|
|
|
12029
12096
|
}
|
|
12030
12097
|
|
|
12031
12098
|
turnCameraOn() {
|
|
12032
|
-
logger$
|
|
12099
|
+
logger$2.info('turn room camera on');
|
|
12033
12100
|
|
|
12034
12101
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
12035
12102
|
|
|
@@ -12039,7 +12106,7 @@ class Room extends Emitter {
|
|
|
12039
12106
|
}
|
|
12040
12107
|
|
|
12041
12108
|
mute() {
|
|
12042
|
-
logger$
|
|
12109
|
+
logger$2.info('mute room');
|
|
12043
12110
|
|
|
12044
12111
|
Wazo.Phone.mute(this.callSession);
|
|
12045
12112
|
|
|
@@ -12047,7 +12114,7 @@ class Room extends Emitter {
|
|
|
12047
12114
|
}
|
|
12048
12115
|
|
|
12049
12116
|
unmute() {
|
|
12050
|
-
logger$
|
|
12117
|
+
logger$2.info('unmute room');
|
|
12051
12118
|
|
|
12052
12119
|
Wazo.Phone.unmute(this.callSession);
|
|
12053
12120
|
|
|
@@ -12067,7 +12134,7 @@ class Room extends Emitter {
|
|
|
12067
12134
|
}
|
|
12068
12135
|
|
|
12069
12136
|
hold() {
|
|
12070
|
-
logger$
|
|
12137
|
+
logger$2.info('hold room');
|
|
12071
12138
|
|
|
12072
12139
|
Wazo.Phone.hold(this.callSession, true);
|
|
12073
12140
|
|
|
@@ -12077,7 +12144,7 @@ class Room extends Emitter {
|
|
|
12077
12144
|
}
|
|
12078
12145
|
|
|
12079
12146
|
async resume() {
|
|
12080
|
-
logger$
|
|
12147
|
+
logger$2.info('resume room');
|
|
12081
12148
|
|
|
12082
12149
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
12083
12150
|
|
|
@@ -12105,13 +12172,13 @@ class Room extends Emitter {
|
|
|
12105
12172
|
}
|
|
12106
12173
|
|
|
12107
12174
|
sendDTMF(tone ) {
|
|
12108
|
-
logger$
|
|
12175
|
+
logger$2.info('send room DTMF', { tone });
|
|
12109
12176
|
|
|
12110
12177
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
12111
12178
|
}
|
|
12112
12179
|
|
|
12113
12180
|
async sendReinvite(newConstraints = null) {
|
|
12114
|
-
logger$
|
|
12181
|
+
logger$2.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
12115
12182
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
12116
12183
|
|
|
12117
12184
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -12170,7 +12237,7 @@ class Room extends Emitter {
|
|
|
12170
12237
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
12171
12238
|
|
|
12172
12239
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
12173
|
-
logger$
|
|
12240
|
+
logger$2.info('on room audio stream');
|
|
12174
12241
|
|
|
12175
12242
|
this.audioStream = stream;
|
|
12176
12243
|
if (!this.roomAudioElement) {
|
|
@@ -12183,7 +12250,7 @@ class Room extends Emitter {
|
|
|
12183
12250
|
});
|
|
12184
12251
|
|
|
12185
12252
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
12186
|
-
logger$
|
|
12253
|
+
logger$2.info('on room video stream', { streamId });
|
|
12187
12254
|
|
|
12188
12255
|
this._mapMsid(sipSession.body.body);
|
|
12189
12256
|
|
|
@@ -12198,7 +12265,7 @@ class Room extends Emitter {
|
|
|
12198
12265
|
});
|
|
12199
12266
|
|
|
12200
12267
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
12201
|
-
logger$
|
|
12268
|
+
logger$2.info('on room remove stream');
|
|
12202
12269
|
|
|
12203
12270
|
const participant = this.participants.find(someParticipant =>
|
|
12204
12271
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -12330,7 +12397,7 @@ class Room extends Emitter {
|
|
|
12330
12397
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
12331
12398
|
if (requester) {
|
|
12332
12399
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
12333
|
-
logger$
|
|
12400
|
+
logger$2.info('trigger room requester status', { origin });
|
|
12334
12401
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
12335
12402
|
}
|
|
12336
12403
|
break;
|
|
@@ -12361,24 +12428,24 @@ class Room extends Emitter {
|
|
|
12361
12428
|
|
|
12362
12429
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
12363
12430
|
if (participant.user_uuid === session.uuid) {
|
|
12364
|
-
logger$
|
|
12431
|
+
logger$2.info('room current user joined');
|
|
12365
12432
|
|
|
12366
12433
|
// Retrieve participants via an API calls
|
|
12367
12434
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
12368
12435
|
let response;
|
|
12369
12436
|
try {
|
|
12370
12437
|
if (this.meetingUuid) {
|
|
12371
|
-
logger$
|
|
12438
|
+
logger$2.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
12372
12439
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
12373
12440
|
} else {
|
|
12374
|
-
logger$
|
|
12441
|
+
logger$2.info('fetching conference participants', { conferenceId });
|
|
12375
12442
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
12376
12443
|
}
|
|
12377
12444
|
} catch (e) {
|
|
12378
|
-
logger$
|
|
12445
|
+
logger$2.error('room participants fetching, error', e);
|
|
12379
12446
|
}
|
|
12380
12447
|
if (response) {
|
|
12381
|
-
logger$
|
|
12448
|
+
logger$2.info('conference participants fetched', { nb: response.items.length });
|
|
12382
12449
|
participants = response.items.map(item => {
|
|
12383
12450
|
const isMe = item.call_id === this.callId;
|
|
12384
12451
|
|
|
@@ -12405,7 +12472,7 @@ class Room extends Emitter {
|
|
|
12405
12472
|
? new Wazo.RemoteParticipant(this, participant)
|
|
12406
12473
|
: null;
|
|
12407
12474
|
|
|
12408
|
-
logger$
|
|
12475
|
+
logger$2.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
12409
12476
|
|
|
12410
12477
|
if (remoteParticipant) {
|
|
12411
12478
|
this.participants.push(remoteParticipant);
|
|
@@ -12570,12 +12637,12 @@ class Room extends Emitter {
|
|
|
12570
12637
|
|
|
12571
12638
|
//
|
|
12572
12639
|
|
|
12573
|
-
const logger$
|
|
12640
|
+
const logger$1 = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
12574
12641
|
|
|
12575
|
-
class SipRoom extends Room {
|
|
12642
|
+
class SipRoom extends Room$1 {
|
|
12576
12643
|
|
|
12577
12644
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
12578
|
-
logger$
|
|
12645
|
+
logger$1.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
12579
12646
|
|
|
12580
12647
|
if (!room) {
|
|
12581
12648
|
await Wazo.Phone.connect();
|
|
@@ -12591,7 +12658,7 @@ class SipRoom extends Room {
|
|
|
12591
12658
|
room.setCallId(room.callSession.call.id);
|
|
12592
12659
|
}
|
|
12593
12660
|
|
|
12594
|
-
logger$
|
|
12661
|
+
logger$1.info('connected to room', {
|
|
12595
12662
|
extension: room.extension,
|
|
12596
12663
|
});
|
|
12597
12664
|
|
|
@@ -12599,7 +12666,7 @@ class SipRoom extends Room {
|
|
|
12599
12666
|
}
|
|
12600
12667
|
|
|
12601
12668
|
mute() {
|
|
12602
|
-
logger$
|
|
12669
|
+
logger$1.info('mute sip room');
|
|
12603
12670
|
|
|
12604
12671
|
Wazo.Phone.mute(this.callSession, false);
|
|
12605
12672
|
|
|
@@ -12607,7 +12674,7 @@ class SipRoom extends Room {
|
|
|
12607
12674
|
}
|
|
12608
12675
|
|
|
12609
12676
|
unmute() {
|
|
12610
|
-
logger$
|
|
12677
|
+
logger$1.info('unmute sip room');
|
|
12611
12678
|
|
|
12612
12679
|
Wazo.Phone.unmute(this.callSession, false);
|
|
12613
12680
|
|
|
@@ -12891,7 +12958,7 @@ class NotificationOptions {
|
|
|
12891
12958
|
|
|
12892
12959
|
|
|
12893
12960
|
// Represents a conference room, like `9000`.
|
|
12894
|
-
class Room
|
|
12961
|
+
class Room {
|
|
12895
12962
|
|
|
12896
12963
|
|
|
12897
12964
|
|
|
@@ -12912,7 +12979,7 @@ class Room$1 {
|
|
|
12912
12979
|
}
|
|
12913
12980
|
|
|
12914
12981
|
connect(callSession ) {
|
|
12915
|
-
return new Room
|
|
12982
|
+
return new Room({ ...this, connectedCallSession: callSession });
|
|
12916
12983
|
}
|
|
12917
12984
|
|
|
12918
12985
|
has(callSession ) {
|
|
@@ -12921,7 +12988,7 @@ class Room$1 {
|
|
|
12921
12988
|
|
|
12922
12989
|
addParticipant(uuid , extension , talking = null) {
|
|
12923
12990
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
12924
|
-
return new Room
|
|
12991
|
+
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12925
12992
|
}
|
|
12926
12993
|
|
|
12927
12994
|
return this;
|
|
@@ -12940,7 +13007,7 @@ class Room$1 {
|
|
|
12940
13007
|
updatedParticipants.push(participant);
|
|
12941
13008
|
}
|
|
12942
13009
|
|
|
12943
|
-
return new Room
|
|
13010
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12944
13011
|
}
|
|
12945
13012
|
|
|
12946
13013
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -12956,7 +13023,7 @@ class Room$1 {
|
|
|
12956
13023
|
updatedParticipants.push(participant);
|
|
12957
13024
|
}
|
|
12958
13025
|
|
|
12959
|
-
return new Room
|
|
13026
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12960
13027
|
}
|
|
12961
13028
|
|
|
12962
13029
|
hasCallWithId(id ) {
|
|
@@ -12964,18 +13031,18 @@ class Room$1 {
|
|
|
12964
13031
|
}
|
|
12965
13032
|
|
|
12966
13033
|
disconnect() {
|
|
12967
|
-
return new Room
|
|
13034
|
+
return new Room({ ...this, connectedCallSession: null });
|
|
12968
13035
|
}
|
|
12969
13036
|
|
|
12970
13037
|
removeParticipantWithUUID(uuid ) {
|
|
12971
|
-
return new Room
|
|
13038
|
+
return new Room({
|
|
12972
13039
|
...this,
|
|
12973
13040
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
12974
13041
|
});
|
|
12975
13042
|
}
|
|
12976
13043
|
|
|
12977
13044
|
removeParticipantWithExtension(extension ) {
|
|
12978
|
-
return new Room
|
|
13045
|
+
return new Room({
|
|
12979
13046
|
...this,
|
|
12980
13047
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
12981
13048
|
});
|
|
@@ -12986,7 +13053,7 @@ class Room$1 {
|
|
|
12986
13053
|
}
|
|
12987
13054
|
|
|
12988
13055
|
static newFrom(room ) {
|
|
12989
|
-
return newFrom(room, Room
|
|
13056
|
+
return newFrom(room, Room);
|
|
12990
13057
|
}
|
|
12991
13058
|
}
|
|
12992
13059
|
|
|
@@ -13293,11 +13360,11 @@ var wazoWebsocket = {
|
|
|
13293
13360
|
resolve();
|
|
13294
13361
|
};
|
|
13295
13362
|
|
|
13296
|
-
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
13363
|
+
client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
|
|
13297
13364
|
handleError(`Connection error : ${error}`);
|
|
13298
13365
|
});
|
|
13299
13366
|
|
|
13300
|
-
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
13367
|
+
client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
|
|
13301
13368
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
13302
13369
|
client.setOnHeartbeatTimeout(() => {
|
|
13303
13370
|
handleError('No response to heartbeat');
|
|
@@ -13398,7 +13465,7 @@ var webrtc = {
|
|
|
13398
13465
|
}),
|
|
13399
13466
|
};
|
|
13400
13467
|
|
|
13401
|
-
const parseCandidate
|
|
13468
|
+
const parseCandidate = line => {
|
|
13402
13469
|
let parts;
|
|
13403
13470
|
// Parse both variants.
|
|
13404
13471
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -13489,7 +13556,7 @@ var SymmetricNat = {
|
|
|
13489
13556
|
}
|
|
13490
13557
|
|
|
13491
13558
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
13492
|
-
const cand = parseCandidate
|
|
13559
|
+
const cand = parseCandidate(e.candidate.candidate);
|
|
13493
13560
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
13494
13561
|
candidates[cand.relatedPort].push(cand.port);
|
|
13495
13562
|
} else if (!e.candidate) {
|
|
@@ -13557,7 +13624,7 @@ var iceIpv4 = {
|
|
|
13557
13624
|
const rawCandidate = e.candidate.candidate;
|
|
13558
13625
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
13559
13626
|
hasSrflxOrRelay = true;
|
|
13560
|
-
const candidate = parseCandidate
|
|
13627
|
+
const candidate = parseCandidate(e.candidate.candidate);
|
|
13561
13628
|
ips.push(candidate.ip);
|
|
13562
13629
|
}
|
|
13563
13630
|
} else if (!e.candidate) {
|
|
@@ -13594,7 +13661,7 @@ var checks = [
|
|
|
13594
13661
|
|
|
13595
13662
|
//
|
|
13596
13663
|
|
|
13597
|
-
const logger
|
|
13664
|
+
const logger = IssueReporter$1.loggerFor('engine-check');
|
|
13598
13665
|
|
|
13599
13666
|
class Checker {
|
|
13600
13667
|
|
|
@@ -13612,28 +13679,28 @@ class Checker {
|
|
|
13612
13679
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
13613
13680
|
await this._addEngineVersion();
|
|
13614
13681
|
|
|
13615
|
-
logger
|
|
13682
|
+
logger.info('Engine check starting');
|
|
13616
13683
|
|
|
13617
13684
|
for (let i = 0; i < this.checks.length; i++) {
|
|
13618
13685
|
const { name, check } = this.checks[i];
|
|
13619
13686
|
|
|
13620
|
-
logger
|
|
13687
|
+
logger.info(`Checking ${name} ...`);
|
|
13621
13688
|
|
|
13622
13689
|
onCheckBegin(name);
|
|
13623
13690
|
try {
|
|
13624
13691
|
// eslint-disable-next-line no-await-in-loop
|
|
13625
13692
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
13626
|
-
logger
|
|
13693
|
+
logger.info(`Checking ${name} success.`, { result });
|
|
13627
13694
|
|
|
13628
13695
|
onCheckResult(name, result);
|
|
13629
13696
|
} catch (e) {
|
|
13630
|
-
logger
|
|
13697
|
+
logger.info(`Checking ${name} failure`, { message: e.message });
|
|
13631
13698
|
|
|
13632
13699
|
onCheckResult(name, e);
|
|
13633
13700
|
}
|
|
13634
13701
|
}
|
|
13635
13702
|
|
|
13636
|
-
logger
|
|
13703
|
+
logger.info('Engine check done.');
|
|
13637
13704
|
}
|
|
13638
13705
|
|
|
13639
13706
|
addCheck(check ) {
|
|
@@ -13657,7 +13724,7 @@ const Wazo = {
|
|
|
13657
13724
|
Auth: Auth$1,
|
|
13658
13725
|
Phone: Phone$1,
|
|
13659
13726
|
Websocket: Websocket$1,
|
|
13660
|
-
Room,
|
|
13727
|
+
Room: Room$1,
|
|
13661
13728
|
SipRoom,
|
|
13662
13729
|
RemoteParticipant,
|
|
13663
13730
|
LocalParticipant,
|
|
@@ -13690,7 +13757,7 @@ const Wazo = {
|
|
|
13690
13757
|
Session,
|
|
13691
13758
|
Voicemail,
|
|
13692
13759
|
Relocation,
|
|
13693
|
-
ConferenceRoom: Room
|
|
13760
|
+
ConferenceRoom: Room,
|
|
13694
13761
|
CallSession,
|
|
13695
13762
|
IndirectTransfer,
|
|
13696
13763
|
SwitchboardCall,
|
|
@@ -13715,6 +13782,7 @@ const Wazo = {
|
|
|
13715
13782
|
InvalidSubscription,
|
|
13716
13783
|
InvalidAuthorization,
|
|
13717
13784
|
CanceledCallError,
|
|
13785
|
+
SFUNotAvailableError,
|
|
13718
13786
|
};
|
|
13719
13787
|
|
|
13720
13788
|
if (window) {
|