@wazo/sdk 0.37.24 → 0.37.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -58
- package/dist/wazo-sdk.js +6 -6
- package/esm/__tests__/api-client.test.js +14 -14
- package/esm/__tests__/web-rtc-client.test.js +130 -108
- package/esm/api/agentd.js +1 -1
- package/esm/api/amid.js +2 -2
- package/esm/api/application.js +1 -1
- package/esm/api/auth.js +1 -1
- package/esm/api/call-logd.js +3 -3
- package/esm/api/calld.js +1 -1
- package/esm/api/chatd.js +1 -1
- package/esm/api/confd.js +1 -1
- package/esm/api/ctid-ng.js +4 -4
- package/esm/api/dird.js +3 -3
- package/esm/api/webhookd.js +2 -2
- package/esm/api-client.js +14 -14
- package/esm/checker/Checker.js +155 -133
- package/esm/checker/checks/aor.js +14 -14
- package/esm/checker/checks/api.js +14 -14
- package/esm/checker/checks/index.js +145 -123
- package/esm/checker/checks/wazo-websocket.js +16 -16
- package/esm/checker/checks/webrtc-transport.js +130 -108
- package/esm/checker/checks/webrtc.js +130 -108
- package/esm/domain/AdHocAPIConference.js +14 -14
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/CallSession.js +15 -0
- package/esm/domain/Contact.js +2 -2
- package/esm/domain/Features.js +14 -14
- package/esm/domain/Phone/CTIPhone.js +43 -28
- package/esm/domain/Phone/WebRTCPhone.js +126 -90
- package/esm/domain/SFUNotAvailableError.js +9 -0
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/CallSession.test.js +15 -0
- package/esm/domain/__tests__/Contact.test.js +2 -2
- package/esm/domain/__tests__/IndirectTransfer.test.js +15 -0
- package/esm/domain/__tests__/Room.test.js +15 -0
- package/esm/index.js +415 -346
- package/esm/lib/WazoSessionDescriptionHandler.js +10 -5
- package/esm/service/CallApi.js +14 -14
- package/esm/service/IssueReporter.js +2 -2
- package/esm/service/__tests__/IssueReporter.test.js +2 -2
- package/esm/service/getApiClient.js +14 -14
- package/esm/simple/Auth.js +404 -336
- package/esm/simple/Configuration.js +404 -336
- package/esm/simple/Directory.js +14 -14
- package/esm/simple/Phone.js +404 -336
- package/esm/simple/Websocket.js +18 -18
- package/esm/simple/index.js +408 -340
- package/esm/simple/room/LocalParticipant.js +408 -340
- package/esm/simple/room/Participant.js +408 -340
- package/esm/simple/room/RemoteParticipant.js +408 -340
- package/esm/simple/room/Room.js +409 -341
- package/esm/simple/room/SipRoom.js +408 -340
- package/esm/simple/room/Stream.js +408 -340
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +408 -340
- package/esm/simple/utils.js +408 -340
- package/esm/utils/__tests__/api-requester.test.js +1 -1
- package/esm/utils/api-requester.js +1 -1
- package/esm/web-rtc-client.js +130 -108
- package/esm/websocket-client.js +16 -16
- package/lib/__tests__/api-client.test.js +14 -14
- package/lib/__tests__/web-rtc-client.test.js +130 -108
- package/lib/api/agentd.js +1 -1
- package/lib/api/amid.js +2 -2
- package/lib/api/application.js +1 -1
- package/lib/api/auth.js +1 -1
- package/lib/api/call-logd.js +3 -3
- package/lib/api/calld.js +1 -1
- package/lib/api/chatd.js +1 -1
- package/lib/api/confd.js +1 -1
- package/lib/api/ctid-ng.js +4 -4
- package/lib/api/dird.js +3 -3
- package/lib/api/webhookd.js +2 -2
- package/lib/api-client.js +14 -14
- package/lib/checker/Checker.js +155 -133
- package/lib/checker/checks/aor.js +14 -14
- package/lib/checker/checks/api.js +14 -14
- package/lib/checker/checks/index.js +145 -123
- package/lib/checker/checks/wazo-websocket.js +16 -16
- package/lib/checker/checks/webrtc-transport.js +130 -108
- package/lib/checker/checks/webrtc.js +130 -108
- package/lib/domain/AdHocAPIConference.js +14 -14
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/CallSession.js +15 -0
- package/lib/domain/Contact.js +2 -2
- package/lib/domain/Features.js +14 -14
- package/lib/domain/Phone/CTIPhone.js +43 -28
- package/lib/domain/Phone/WebRTCPhone.js +126 -89
- package/lib/domain/SFUNotAvailableError.js +11 -0
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/CallSession.test.js +15 -0
- package/lib/domain/__tests__/Contact.test.js +2 -2
- package/lib/domain/__tests__/IndirectTransfer.test.js +15 -0
- package/lib/domain/__tests__/Room.test.js +15 -0
- package/lib/index.js +415 -346
- package/lib/lib/WazoSessionDescriptionHandler.js +10 -5
- package/lib/service/CallApi.js +14 -14
- package/lib/service/IssueReporter.js +2 -2
- package/lib/service/__tests__/IssueReporter.test.js +2 -2
- package/lib/service/getApiClient.js +14 -14
- package/lib/simple/Auth.js +404 -336
- package/lib/simple/Configuration.js +404 -336
- package/lib/simple/Directory.js +14 -14
- package/lib/simple/Phone.js +404 -336
- package/lib/simple/Websocket.js +18 -18
- package/lib/simple/index.js +408 -340
- package/lib/simple/room/LocalParticipant.js +408 -340
- package/lib/simple/room/Participant.js +408 -340
- package/lib/simple/room/RemoteParticipant.js +408 -340
- package/lib/simple/room/Room.js +409 -341
- package/lib/simple/room/SipRoom.js +408 -340
- package/lib/simple/room/Stream.js +408 -340
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +408 -340
- package/lib/simple/utils.js +408 -340
- package/lib/utils/__tests__/api-requester.test.js +1 -1
- package/lib/utils/api-requester.js +1 -1
- package/lib/web-rtc-client.js +130 -108
- package/lib/websocket-client.js +16 -16
- package/package.json +1 -1
- package/src/domain/CallSession.js +16 -0
- package/src/domain/Contact.js +1 -1
- package/src/domain/Phone/WebRTCPhone.js +25 -4
- package/src/domain/SFUNotAvailableError.js +7 -0
- package/src/index.js +2 -0
- package/src/lib/WazoSessionDescriptionHandler.js +8 -3
- package/src/simple/Phone.js +2 -1
- package/src/simple/index.js +2 -0
- package/src/utils/api-requester.js +1 -1
- package/src/web-rtc-client.js +27 -10
|
@@ -1246,7 +1246,7 @@ class Contact {
|
|
|
1246
1246
|
this[key] = old[key] || this[key];
|
|
1247
1247
|
});
|
|
1248
1248
|
|
|
1249
|
-
if (old.lineState
|
|
1249
|
+
if (old.lineState) {
|
|
1250
1250
|
this.lineState = old.lineState;
|
|
1251
1251
|
}
|
|
1252
1252
|
|
|
@@ -1957,11 +1957,11 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
1957
1957
|
|
|
1958
1958
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
1959
1959
|
|
|
1960
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1960
|
+
const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1961
1961
|
|
|
1962
1962
|
// Use a function here to be able to mock it in tests
|
|
1963
1963
|
const realFetch = () => {
|
|
1964
|
-
if (typeof document !== 'undefined') {
|
|
1964
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
1965
1965
|
// Browser
|
|
1966
1966
|
return window.fetch;
|
|
1967
1967
|
}
|
|
@@ -2096,7 +2096,7 @@ class ApiRequester {
|
|
|
2096
2096
|
};
|
|
2097
2097
|
|
|
2098
2098
|
if (this.refreshTokenPromise) {
|
|
2099
|
-
logger.info('A token is already refreshing, waiting ...', { url });
|
|
2099
|
+
logger$c.info('A token is already refreshing, waiting ...', { url });
|
|
2100
2100
|
await this.refreshTokenPromise;
|
|
2101
2101
|
}
|
|
2102
2102
|
|
|
@@ -2116,7 +2116,7 @@ class ApiRequester {
|
|
|
2116
2116
|
return promise.then(async (err ) => {
|
|
2117
2117
|
// Check if the token is still valid
|
|
2118
2118
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
2119
|
-
logger.warn('token expired', { error: err.reason });
|
|
2119
|
+
logger$c.warn('token expired', { error: err.reason });
|
|
2120
2120
|
// Replay the call after refreshing the token
|
|
2121
2121
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
2122
2122
|
}
|
|
@@ -2126,7 +2126,7 @@ class ApiRequester {
|
|
|
2126
2126
|
: exceptionClass.fromResponse(err, response.status);
|
|
2127
2127
|
|
|
2128
2128
|
if (this.shouldLogErrors) {
|
|
2129
|
-
logger.error('API error', error);
|
|
2129
|
+
logger$c.error('API error', error);
|
|
2130
2130
|
}
|
|
2131
2131
|
|
|
2132
2132
|
throw error;
|
|
@@ -2136,7 +2136,7 @@ class ApiRequester {
|
|
|
2136
2136
|
return newParse(response, isJson);
|
|
2137
2137
|
}).catch(error => {
|
|
2138
2138
|
if (this.shouldLogErrors) {
|
|
2139
|
-
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2139
|
+
logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2140
2140
|
}
|
|
2141
2141
|
|
|
2142
2142
|
throw error;
|
|
@@ -2164,13 +2164,13 @@ class ApiRequester {
|
|
|
2164
2164
|
) {
|
|
2165
2165
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
2166
2166
|
let newPath = path;
|
|
2167
|
-
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2167
|
+
logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2168
2168
|
|
|
2169
2169
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
2170
2170
|
|
|
2171
2171
|
return this.refreshTokenPromise.then(() => {
|
|
2172
2172
|
this.refreshTokenPromise = null;
|
|
2173
|
-
logger.info('token refreshed', { isTokenNotFound });
|
|
2173
|
+
logger$c.info('token refreshed', { isTokenNotFound });
|
|
2174
2174
|
if (isTokenNotFound) {
|
|
2175
2175
|
const pathParts = path.split('/');
|
|
2176
2176
|
pathParts.pop();
|
|
@@ -3263,8 +3263,10 @@ var updateFrom = (instance , from ) => {
|
|
|
3263
3263
|
|
|
3264
3264
|
|
|
3265
3265
|
|
|
3266
|
+
|
|
3266
3267
|
|
|
3267
3268
|
|
|
3269
|
+
|
|
3268
3270
|
|
|
3269
3271
|
|
|
3270
3272
|
|
|
@@ -3281,6 +3283,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3281
3283
|
|
|
3282
3284
|
|
|
3283
3285
|
|
|
3286
|
+
|
|
3284
3287
|
|
|
3285
3288
|
|
|
3286
3289
|
class CallSession {
|
|
@@ -3300,8 +3303,12 @@ class CallSession {
|
|
|
3300
3303
|
|
|
3301
3304
|
|
|
3302
3305
|
|
|
3306
|
+
|
|
3307
|
+
|
|
3303
3308
|
|
|
3304
3309
|
|
|
3310
|
+
|
|
3311
|
+
|
|
3305
3312
|
|
|
3306
3313
|
|
|
3307
3314
|
|
|
@@ -3339,6 +3346,8 @@ class CallSession {
|
|
|
3339
3346
|
|
|
3340
3347
|
|
|
3341
3348
|
|
|
3349
|
+
|
|
3350
|
+
|
|
3342
3351
|
|
|
3343
3352
|
constructor({
|
|
3344
3353
|
answered,
|
|
@@ -3352,6 +3361,8 @@ class CallSession {
|
|
|
3352
3361
|
paused,
|
|
3353
3362
|
ringing,
|
|
3354
3363
|
startTime,
|
|
3364
|
+
creationTime,
|
|
3365
|
+
endTime,
|
|
3355
3366
|
cameraEnabled,
|
|
3356
3367
|
dialedExtension,
|
|
3357
3368
|
sipCallId,
|
|
@@ -3364,12 +3375,15 @@ class CallSession {
|
|
|
3364
3375
|
recording,
|
|
3365
3376
|
recordingPaused,
|
|
3366
3377
|
videoRemotelyDowngraded,
|
|
3378
|
+
sipSession,
|
|
3367
3379
|
} ) {
|
|
3368
3380
|
this.callId = callId;
|
|
3369
3381
|
this.sipCallId = sipCallId;
|
|
3370
3382
|
this.displayName = displayName;
|
|
3371
3383
|
this.number = number;
|
|
3384
|
+
this.creationTime = creationTime;
|
|
3372
3385
|
this.startTime = startTime;
|
|
3386
|
+
this.endTime = endTime;
|
|
3373
3387
|
this.isCaller = isCaller;
|
|
3374
3388
|
this.answered = answered;
|
|
3375
3389
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -3388,6 +3402,7 @@ class CallSession {
|
|
|
3388
3402
|
this.recording = recording || false;
|
|
3389
3403
|
this.recordingPaused = recordingPaused || false;
|
|
3390
3404
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3405
|
+
this.sipSession = sipSession;
|
|
3391
3406
|
|
|
3392
3407
|
// Useful to compare instead of instanceof with minified code
|
|
3393
3408
|
this.type = 'CallSession';
|
|
@@ -4063,7 +4078,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4063
4078
|
|
|
4064
4079
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4065
4080
|
|
|
4066
|
-
const logger$
|
|
4081
|
+
const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4067
4082
|
|
|
4068
4083
|
class CTIPhone extends Emitter {
|
|
4069
4084
|
|
|
@@ -4076,7 +4091,7 @@ class CTIPhone extends Emitter {
|
|
|
4076
4091
|
|
|
4077
4092
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4078
4093
|
super();
|
|
4079
|
-
logger$
|
|
4094
|
+
logger$b.info('CTI Phone created');
|
|
4080
4095
|
this.session = session;
|
|
4081
4096
|
this.isMobile = isMobile;
|
|
4082
4097
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4137,7 +4152,7 @@ class CTIPhone extends Emitter {
|
|
|
4137
4152
|
}
|
|
4138
4153
|
|
|
4139
4154
|
async makeCall(number , line ) {
|
|
4140
|
-
logger$
|
|
4155
|
+
logger$b.info('make CTI call', { number });
|
|
4141
4156
|
|
|
4142
4157
|
if (!number) {
|
|
4143
4158
|
return null;
|
|
@@ -4160,7 +4175,7 @@ class CTIPhone extends Emitter {
|
|
|
4160
4175
|
if (!callSession) {
|
|
4161
4176
|
return Promise.resolve(null);
|
|
4162
4177
|
}
|
|
4163
|
-
logger$
|
|
4178
|
+
logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4164
4179
|
|
|
4165
4180
|
if (!this.currentCall) {
|
|
4166
4181
|
this.currentCall = callSession.call;
|
|
@@ -4173,7 +4188,7 @@ class CTIPhone extends Emitter {
|
|
|
4173
4188
|
if (!callSession) {
|
|
4174
4189
|
return;
|
|
4175
4190
|
}
|
|
4176
|
-
logger$
|
|
4191
|
+
logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4177
4192
|
|
|
4178
4193
|
this.currentCall = undefined;
|
|
4179
4194
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4183,7 +4198,7 @@ class CTIPhone extends Emitter {
|
|
|
4183
4198
|
if (!callSession) {
|
|
4184
4199
|
return Promise.resolve(false);
|
|
4185
4200
|
}
|
|
4186
|
-
logger$
|
|
4201
|
+
logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4187
4202
|
|
|
4188
4203
|
try {
|
|
4189
4204
|
await CallApi.cancelCall(callSession);
|
|
@@ -4194,7 +4209,7 @@ class CTIPhone extends Emitter {
|
|
|
4194
4209
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4195
4210
|
return true;
|
|
4196
4211
|
} catch (e) {
|
|
4197
|
-
logger$
|
|
4212
|
+
logger$b.error('hangup CTI call, error', e);
|
|
4198
4213
|
|
|
4199
4214
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4200
4215
|
return false;
|
|
@@ -4207,7 +4222,7 @@ class CTIPhone extends Emitter {
|
|
|
4207
4222
|
if (!callSession) {
|
|
4208
4223
|
return;
|
|
4209
4224
|
}
|
|
4210
|
-
logger$
|
|
4225
|
+
logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4211
4226
|
|
|
4212
4227
|
await CallApi.cancelCall(callSession);
|
|
4213
4228
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4217,7 +4232,7 @@ class CTIPhone extends Emitter {
|
|
|
4217
4232
|
if (!callSession) {
|
|
4218
4233
|
return;
|
|
4219
4234
|
}
|
|
4220
|
-
logger$
|
|
4235
|
+
logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4221
4236
|
|
|
4222
4237
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4223
4238
|
}
|
|
@@ -4230,19 +4245,19 @@ class CTIPhone extends Emitter {
|
|
|
4230
4245
|
if (!callSession) {
|
|
4231
4246
|
return;
|
|
4232
4247
|
}
|
|
4233
|
-
logger$
|
|
4248
|
+
logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4234
4249
|
|
|
4235
4250
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4236
4251
|
}
|
|
4237
4252
|
|
|
4238
4253
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4239
|
-
logger$
|
|
4254
|
+
logger$b.info('cancel CTI transfer', { transferId });
|
|
4240
4255
|
|
|
4241
4256
|
return CallApi.cancelCallTransfer(transferId);
|
|
4242
4257
|
}
|
|
4243
4258
|
|
|
4244
4259
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4245
|
-
logger$
|
|
4260
|
+
logger$b.info('confirm CTI transfer', { transferId });
|
|
4246
4261
|
|
|
4247
4262
|
return CallApi.confirmCallTransfer(transferId);
|
|
4248
4263
|
}
|
|
@@ -4251,19 +4266,19 @@ class CTIPhone extends Emitter {
|
|
|
4251
4266
|
if (!callSession) {
|
|
4252
4267
|
return;
|
|
4253
4268
|
}
|
|
4254
|
-
logger$
|
|
4269
|
+
logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4255
4270
|
|
|
4256
4271
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4257
4272
|
}
|
|
4258
4273
|
|
|
4259
4274
|
onConnectionMade() {
|
|
4260
|
-
logger$
|
|
4275
|
+
logger$b.info('on CTI connection made');
|
|
4261
4276
|
|
|
4262
4277
|
this.eventEmitter.emit('onCallAccepted');
|
|
4263
4278
|
}
|
|
4264
4279
|
|
|
4265
4280
|
async close() {
|
|
4266
|
-
logger$
|
|
4281
|
+
logger$b.info('CTI close');
|
|
4267
4282
|
|
|
4268
4283
|
return Promise.resolve();
|
|
4269
4284
|
}
|
|
@@ -4272,7 +4287,7 @@ class CTIPhone extends Emitter {
|
|
|
4272
4287
|
if (!callSession) {
|
|
4273
4288
|
return;
|
|
4274
4289
|
}
|
|
4275
|
-
logger$
|
|
4290
|
+
logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4276
4291
|
|
|
4277
4292
|
return CallApi.hold(callSession.callId);
|
|
4278
4293
|
}
|
|
@@ -4281,7 +4296,7 @@ class CTIPhone extends Emitter {
|
|
|
4281
4296
|
if (!callSession) {
|
|
4282
4297
|
return;
|
|
4283
4298
|
}
|
|
4284
|
-
logger$
|
|
4299
|
+
logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4285
4300
|
|
|
4286
4301
|
return CallApi.resume(callSession.callId);
|
|
4287
4302
|
}
|
|
@@ -4290,7 +4305,7 @@ class CTIPhone extends Emitter {
|
|
|
4290
4305
|
if (!callSession) {
|
|
4291
4306
|
return;
|
|
4292
4307
|
}
|
|
4293
|
-
logger$
|
|
4308
|
+
logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4294
4309
|
|
|
4295
4310
|
return CallApi.mute(callSession.callId);
|
|
4296
4311
|
}
|
|
@@ -4299,7 +4314,7 @@ class CTIPhone extends Emitter {
|
|
|
4299
4314
|
if (!callSession) {
|
|
4300
4315
|
return;
|
|
4301
4316
|
}
|
|
4302
|
-
logger$
|
|
4317
|
+
logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4303
4318
|
|
|
4304
4319
|
return CallApi.unmute(callSession.callId);
|
|
4305
4320
|
}
|
|
@@ -5308,7 +5323,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5308
5323
|
const WEBHOOKD_VERSION = '1.0';
|
|
5309
5324
|
const AMID_VERSION = '1.0';
|
|
5310
5325
|
|
|
5311
|
-
const logger$
|
|
5326
|
+
const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5312
5327
|
|
|
5313
5328
|
class ApiClient {
|
|
5314
5329
|
|
|
@@ -5360,12 +5375,12 @@ class ApiClient {
|
|
|
5360
5375
|
}
|
|
5361
5376
|
|
|
5362
5377
|
async forceRefreshToken() {
|
|
5363
|
-
logger$
|
|
5378
|
+
logger$a.info('forcing refresh token, calling callback');
|
|
5364
5379
|
return this.refreshTokenCallback();
|
|
5365
5380
|
}
|
|
5366
5381
|
|
|
5367
5382
|
async refreshTokenCallback() {
|
|
5368
|
-
logger$
|
|
5383
|
+
logger$a.info('refresh token callback called', {
|
|
5369
5384
|
refreshToken: this.refreshToken,
|
|
5370
5385
|
refreshBackend: this.refreshBackend,
|
|
5371
5386
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5383,7 +5398,7 @@ class ApiClient {
|
|
|
5383
5398
|
this.isMobile,
|
|
5384
5399
|
);
|
|
5385
5400
|
|
|
5386
|
-
logger$
|
|
5401
|
+
logger$a.info('token refreshed', { token: session.token });
|
|
5387
5402
|
|
|
5388
5403
|
if (this.onRefreshToken) {
|
|
5389
5404
|
this.onRefreshToken(session.token, session);
|
|
@@ -5696,7 +5711,7 @@ class AdHocAPIConference {
|
|
|
5696
5711
|
|
|
5697
5712
|
/* */
|
|
5698
5713
|
|
|
5699
|
-
const parseCandidate = (candidate ) => {
|
|
5714
|
+
const parseCandidate$1 = (candidate ) => {
|
|
5700
5715
|
if (!candidate) {
|
|
5701
5716
|
return null;
|
|
5702
5717
|
}
|
|
@@ -5808,11 +5823,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5808
5823
|
|
|
5809
5824
|
// $FlowFixMe
|
|
5810
5825
|
setRemoteSessionDescription(sessionDescription ) {
|
|
5811
|
-
|
|
5826
|
+
try {
|
|
5827
|
+
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
5812
5828
|
|
|
5813
|
-
|
|
5829
|
+
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
5814
5830
|
|
|
5815
|
-
|
|
5831
|
+
return result;
|
|
5832
|
+
} catch (error) {
|
|
5833
|
+
this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
|
|
5834
|
+
throw error;
|
|
5835
|
+
}
|
|
5816
5836
|
}
|
|
5817
5837
|
|
|
5818
5838
|
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
@@ -5850,7 +5870,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5850
5870
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
5851
5871
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
5852
5872
|
if (event.candidate) {
|
|
5853
|
-
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
5873
|
+
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
5854
5874
|
}
|
|
5855
5875
|
};
|
|
5856
5876
|
|
|
@@ -6314,7 +6334,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6314
6334
|
const SEND_STATS_DELAY = 5000;
|
|
6315
6335
|
|
|
6316
6336
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6317
|
-
const logger$
|
|
6337
|
+
const logger$9 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6318
6338
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6319
6339
|
|
|
6320
6340
|
// events
|
|
@@ -6328,14 +6348,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6328
6348
|
const MESSAGE = 'message';
|
|
6329
6349
|
const ACCEPTED = 'accepted';
|
|
6330
6350
|
const REJECTED = 'rejected';
|
|
6331
|
-
const ON_TRACK = 'onTrack';
|
|
6332
|
-
const ON_REINVITE = 'reinvite';
|
|
6351
|
+
const ON_TRACK$1 = 'onTrack';
|
|
6352
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
6333
6353
|
const ON_ERROR = 'onError';
|
|
6334
6354
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6335
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6336
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
6355
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6356
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6337
6357
|
|
|
6338
|
-
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6358
|
+
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6339
6359
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6340
6360
|
class CanceledCallError extends Error {}
|
|
6341
6361
|
|
|
@@ -6471,12 +6491,12 @@ class WebRTCClient extends Emitter {
|
|
|
6471
6491
|
this.MESSAGE = MESSAGE;
|
|
6472
6492
|
this.ACCEPTED = ACCEPTED;
|
|
6473
6493
|
this.REJECTED = REJECTED;
|
|
6474
|
-
this.ON_TRACK = ON_TRACK;
|
|
6475
|
-
this.ON_REINVITE = ON_REINVITE;
|
|
6494
|
+
this.ON_TRACK = ON_TRACK$1;
|
|
6495
|
+
this.ON_REINVITE = ON_REINVITE$1;
|
|
6476
6496
|
this.ON_ERROR = ON_ERROR;
|
|
6477
6497
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6478
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6479
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6498
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6499
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6480
6500
|
}
|
|
6481
6501
|
|
|
6482
6502
|
configureMedia(media ) {
|
|
@@ -6493,13 +6513,13 @@ class WebRTCClient extends Emitter {
|
|
|
6493
6513
|
|
|
6494
6514
|
createUserAgent(configOverrides ) {
|
|
6495
6515
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6496
|
-
logger$
|
|
6516
|
+
logger$9.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6497
6517
|
|
|
6498
6518
|
webRTCConfiguration.delegate = {
|
|
6499
6519
|
onConnect: this.onConnect.bind(this),
|
|
6500
6520
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6501
6521
|
onInvite: (invitation ) => {
|
|
6502
|
-
logger$
|
|
6522
|
+
logger$9.info('sdk webrtc on invite', {
|
|
6503
6523
|
method: 'delegate.onInvite',
|
|
6504
6524
|
id: invitation.id,
|
|
6505
6525
|
remoteURI: invitation.remoteURI,
|
|
@@ -6542,7 +6562,7 @@ class WebRTCClient extends Emitter {
|
|
|
6542
6562
|
}
|
|
6543
6563
|
|
|
6544
6564
|
onConnect() {
|
|
6545
|
-
logger$
|
|
6565
|
+
logger$9.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6546
6566
|
this.eventEmitter.emit(CONNECTED);
|
|
6547
6567
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6548
6568
|
this.registerer.waitingToggle(false);
|
|
@@ -6551,7 +6571,7 @@ class WebRTCClient extends Emitter {
|
|
|
6551
6571
|
}
|
|
6552
6572
|
|
|
6553
6573
|
async onDisconnect(error ) {
|
|
6554
|
-
logger$
|
|
6574
|
+
logger$9.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6555
6575
|
this.connectionPromise = null;
|
|
6556
6576
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6557
6577
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6576,37 +6596,37 @@ class WebRTCClient extends Emitter {
|
|
|
6576
6596
|
};
|
|
6577
6597
|
|
|
6578
6598
|
if (this.skipRegister) {
|
|
6579
|
-
logger$
|
|
6599
|
+
logger$9.info('sdk webrtc skip register...', logInfo);
|
|
6580
6600
|
return Promise.resolve();
|
|
6581
6601
|
}
|
|
6582
6602
|
|
|
6583
|
-
logger$
|
|
6603
|
+
logger$9.info('sdk webrtc registering...', logInfo);
|
|
6584
6604
|
|
|
6585
6605
|
if (!this.userAgent) {
|
|
6586
|
-
logger$
|
|
6606
|
+
logger$9.info('sdk webrtc recreating User Agent');
|
|
6587
6607
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6588
6608
|
}
|
|
6589
6609
|
if (!this.userAgent || this.isRegistered()) {
|
|
6590
|
-
logger$
|
|
6610
|
+
logger$9.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6591
6611
|
return Promise.resolve();
|
|
6592
6612
|
}
|
|
6593
6613
|
|
|
6594
6614
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6595
|
-
logger$
|
|
6615
|
+
logger$9.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6596
6616
|
return Promise.resolve();
|
|
6597
6617
|
}
|
|
6598
6618
|
|
|
6599
6619
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6600
6620
|
|
|
6601
6621
|
const onRegisterFailed = () => {
|
|
6602
|
-
logger$
|
|
6622
|
+
logger$9.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6603
6623
|
this.connectionPromise = null;
|
|
6604
6624
|
if (this.registerer && this.registerer.waiting) {
|
|
6605
6625
|
this.registerer.waitingToggle(false);
|
|
6606
6626
|
}
|
|
6607
6627
|
|
|
6608
6628
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6609
|
-
logger$
|
|
6629
|
+
logger$9.info('sdk webrtc registering, retrying...', { tries });
|
|
6610
6630
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6611
6631
|
}
|
|
6612
6632
|
};
|
|
@@ -6615,18 +6635,18 @@ class WebRTCClient extends Emitter {
|
|
|
6615
6635
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6616
6636
|
// during the resolution of the primise.
|
|
6617
6637
|
if (!this.userAgent) {
|
|
6618
|
-
logger$
|
|
6638
|
+
logger$9.info('sdk webrtc recreating User Agent after connection');
|
|
6619
6639
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6620
6640
|
}
|
|
6621
6641
|
|
|
6622
|
-
logger$
|
|
6642
|
+
logger$9.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6623
6643
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
6624
6644
|
this.connectionPromise = null;
|
|
6625
6645
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6626
6646
|
|
|
6627
6647
|
// Bind registerer events
|
|
6628
6648
|
this.registerer.stateChange.addListener(newState => {
|
|
6629
|
-
logger$
|
|
6649
|
+
logger$9.info('sdk webrtc registering, state changed', { newState });
|
|
6630
6650
|
|
|
6631
6651
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
6632
6652
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -6639,7 +6659,7 @@ class WebRTCClient extends Emitter {
|
|
|
6639
6659
|
const options = {
|
|
6640
6660
|
requestDelegate: {
|
|
6641
6661
|
onReject: response => {
|
|
6642
|
-
logger$
|
|
6662
|
+
logger$9.error('sdk webrtc registering, rejected', { response });
|
|
6643
6663
|
|
|
6644
6664
|
onRegisterFailed();
|
|
6645
6665
|
},
|
|
@@ -6647,13 +6667,13 @@ class WebRTCClient extends Emitter {
|
|
|
6647
6667
|
};
|
|
6648
6668
|
|
|
6649
6669
|
return this.registerer.register(options).catch((e) => {
|
|
6650
|
-
logger$
|
|
6670
|
+
logger$9.error('sdk webrtc registering, error', e);
|
|
6651
6671
|
|
|
6652
6672
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6653
6673
|
return e;
|
|
6654
6674
|
});
|
|
6655
6675
|
}).catch(error => {
|
|
6656
|
-
logger$
|
|
6676
|
+
logger$9.error('sdk webrtc registering, transport error', error);
|
|
6657
6677
|
onRegisterFailed();
|
|
6658
6678
|
});
|
|
6659
6679
|
}
|
|
@@ -6682,21 +6702,21 @@ class WebRTCClient extends Emitter {
|
|
|
6682
6702
|
}
|
|
6683
6703
|
|
|
6684
6704
|
unregister() {
|
|
6685
|
-
logger$
|
|
6705
|
+
logger$9.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6686
6706
|
if (!this.registerer) {
|
|
6687
6707
|
return Promise.resolve();
|
|
6688
6708
|
}
|
|
6689
6709
|
|
|
6690
6710
|
try {
|
|
6691
6711
|
return this.registerer.unregister().then(() => {
|
|
6692
|
-
logger$
|
|
6712
|
+
logger$9.info('sdk webrtc unregistered');
|
|
6693
6713
|
this._cleanupRegister();
|
|
6694
6714
|
}).catch(e => {
|
|
6695
|
-
logger$
|
|
6715
|
+
logger$9.error('sdk webrtc unregistering, promise error', e);
|
|
6696
6716
|
this._cleanupRegister();
|
|
6697
6717
|
});
|
|
6698
6718
|
} catch (e) {
|
|
6699
|
-
logger$
|
|
6719
|
+
logger$9.error('sdk webrtc unregistering, error', e);
|
|
6700
6720
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6701
6721
|
// error when the registerer is in a bad state
|
|
6702
6722
|
this._cleanupRegister();
|
|
@@ -6704,7 +6724,7 @@ class WebRTCClient extends Emitter {
|
|
|
6704
6724
|
}
|
|
6705
6725
|
|
|
6706
6726
|
stop() {
|
|
6707
|
-
logger$
|
|
6727
|
+
logger$9.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6708
6728
|
if (!this.userAgent) {
|
|
6709
6729
|
return Promise.resolve();
|
|
6710
6730
|
}
|
|
@@ -6712,12 +6732,12 @@ class WebRTCClient extends Emitter {
|
|
|
6712
6732
|
return this.userAgent.stop().then(() => {
|
|
6713
6733
|
return this._cleanupRegister();
|
|
6714
6734
|
}).catch(e => {
|
|
6715
|
-
logger$
|
|
6735
|
+
logger$9.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6716
6736
|
});
|
|
6717
6737
|
}
|
|
6718
6738
|
|
|
6719
6739
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6720
|
-
logger$
|
|
6740
|
+
logger$9.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6721
6741
|
const inviterOptions = {
|
|
6722
6742
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6723
6743
|
conference,
|
|
@@ -6748,7 +6768,7 @@ class WebRTCClient extends Emitter {
|
|
|
6748
6768
|
this._onAccepted(session, response.session, true);
|
|
6749
6769
|
},
|
|
6750
6770
|
onReject: (response ) => {
|
|
6751
|
-
logger$
|
|
6771
|
+
logger$9.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
6752
6772
|
this._stopSendingStats(session);
|
|
6753
6773
|
this.stopNetworkMonitoring(session);
|
|
6754
6774
|
|
|
@@ -6771,11 +6791,11 @@ class WebRTCClient extends Emitter {
|
|
|
6771
6791
|
}
|
|
6772
6792
|
|
|
6773
6793
|
answer(session , enableVideo ) {
|
|
6774
|
-
logger$
|
|
6794
|
+
logger$9.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
6775
6795
|
|
|
6776
6796
|
if (!session || !session.accept) {
|
|
6777
6797
|
const error = 'No session to answer, or not an invitation';
|
|
6778
|
-
logger$
|
|
6798
|
+
logger$9.warn(error);
|
|
6779
6799
|
return Promise.reject(new Error(error));
|
|
6780
6800
|
}
|
|
6781
6801
|
const options = {
|
|
@@ -6785,15 +6805,15 @@ class WebRTCClient extends Emitter {
|
|
|
6785
6805
|
return session.accept(options).then(() => {
|
|
6786
6806
|
if (session.isCanceled) {
|
|
6787
6807
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
6788
|
-
logger$
|
|
6808
|
+
logger$9.error(message, { id: session.id });
|
|
6789
6809
|
this.onCallEnded(session);
|
|
6790
6810
|
|
|
6791
6811
|
throw new CanceledCallError(message);
|
|
6792
6812
|
}
|
|
6793
|
-
logger$
|
|
6813
|
+
logger$9.info('sdk webrtc answer, accepted.');
|
|
6794
6814
|
this._onAccepted(session);
|
|
6795
6815
|
}).catch(e => {
|
|
6796
|
-
logger$
|
|
6816
|
+
logger$9.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
6797
6817
|
|
|
6798
6818
|
throw e;
|
|
6799
6819
|
});
|
|
@@ -6801,7 +6821,7 @@ class WebRTCClient extends Emitter {
|
|
|
6801
6821
|
|
|
6802
6822
|
hangup(session ) {
|
|
6803
6823
|
const { state, id } = session;
|
|
6804
|
-
logger$
|
|
6824
|
+
logger$9.info('sdk webrtc hangup call', { id, state });
|
|
6805
6825
|
|
|
6806
6826
|
try {
|
|
6807
6827
|
this._stopSendingStats(session);
|
|
@@ -6830,7 +6850,7 @@ class WebRTCClient extends Emitter {
|
|
|
6830
6850
|
|
|
6831
6851
|
return bye();
|
|
6832
6852
|
} catch (error) {
|
|
6833
|
-
logger$
|
|
6853
|
+
logger$9.warn('sdk webrtc hangup, error', error);
|
|
6834
6854
|
}
|
|
6835
6855
|
|
|
6836
6856
|
return null;
|
|
@@ -6848,7 +6868,7 @@ class WebRTCClient extends Emitter {
|
|
|
6848
6868
|
// Fetch and emit an event at `interval` with session network stats
|
|
6849
6869
|
startNetworkMonitoring(session , interval = 1000) {
|
|
6850
6870
|
const sessionId = this.getSipSessionId(session);
|
|
6851
|
-
logger$
|
|
6871
|
+
logger$9.info('starting network inspection', { id: sessionId });
|
|
6852
6872
|
|
|
6853
6873
|
this.sessionNetworkStats[sessionId] = [];
|
|
6854
6874
|
|
|
@@ -6858,7 +6878,7 @@ class WebRTCClient extends Emitter {
|
|
|
6858
6878
|
stopNetworkMonitoring(session ) {
|
|
6859
6879
|
const sessionId = this.getSipSessionId(session);
|
|
6860
6880
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
6861
|
-
logger$
|
|
6881
|
+
logger$9.info('stopping network inspection', { id: sessionId, exists });
|
|
6862
6882
|
|
|
6863
6883
|
if (exists) {
|
|
6864
6884
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -6868,17 +6888,17 @@ class WebRTCClient extends Emitter {
|
|
|
6868
6888
|
}
|
|
6869
6889
|
|
|
6870
6890
|
reject(session ) {
|
|
6871
|
-
logger$
|
|
6891
|
+
logger$9.info('sdk webrtc reject call', { id: session.id });
|
|
6872
6892
|
|
|
6873
6893
|
try {
|
|
6874
6894
|
return session.reject ? session.reject() : session.cancel();
|
|
6875
6895
|
} catch (e) {
|
|
6876
|
-
logger$
|
|
6896
|
+
logger$9.warn('Error when rejecting call', e.message, e.stack);
|
|
6877
6897
|
}
|
|
6878
6898
|
}
|
|
6879
6899
|
|
|
6880
6900
|
async close() {
|
|
6881
|
-
logger$
|
|
6901
|
+
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6882
6902
|
this._cleanupMedia();
|
|
6883
6903
|
this.connectionPromise = null;
|
|
6884
6904
|
|
|
@@ -6909,7 +6929,7 @@ class WebRTCClient extends Emitter {
|
|
|
6909
6929
|
// eg: "INVITE not rejectable in state Completed"
|
|
6910
6930
|
}
|
|
6911
6931
|
this.userAgent = null;
|
|
6912
|
-
logger$
|
|
6932
|
+
logger$9.info('sdk webrtc client closed');
|
|
6913
6933
|
}
|
|
6914
6934
|
|
|
6915
6935
|
getNumber(session ) {
|
|
@@ -6922,13 +6942,13 @@ class WebRTCClient extends Emitter {
|
|
|
6922
6942
|
}
|
|
6923
6943
|
|
|
6924
6944
|
mute(session ) {
|
|
6925
|
-
logger$
|
|
6945
|
+
logger$9.info('sdk webrtc mute', { id: session.id });
|
|
6926
6946
|
|
|
6927
6947
|
this._toggleAudio(session, true);
|
|
6928
6948
|
}
|
|
6929
6949
|
|
|
6930
6950
|
unmute(session ) {
|
|
6931
|
-
logger$
|
|
6951
|
+
logger$9.info('sdk webrtc unmute', { id: session.id });
|
|
6932
6952
|
|
|
6933
6953
|
this._toggleAudio(session, false);
|
|
6934
6954
|
}
|
|
@@ -6968,13 +6988,13 @@ class WebRTCClient extends Emitter {
|
|
|
6968
6988
|
}
|
|
6969
6989
|
|
|
6970
6990
|
toggleCameraOn(session ) {
|
|
6971
|
-
logger$
|
|
6991
|
+
logger$9.info('sdk webrtc toggle camera on', { id: session.id });
|
|
6972
6992
|
|
|
6973
6993
|
this._toggleVideo(session, false);
|
|
6974
6994
|
}
|
|
6975
6995
|
|
|
6976
6996
|
toggleCameraOff(session ) {
|
|
6977
|
-
logger$
|
|
6997
|
+
logger$9.info('sdk webrtc toggle camera off', { id: session.id });
|
|
6978
6998
|
|
|
6979
6999
|
this._toggleVideo(session, true);
|
|
6980
7000
|
}
|
|
@@ -6983,7 +7003,7 @@ class WebRTCClient extends Emitter {
|
|
|
6983
7003
|
const sessionId = this.getSipSessionId(session);
|
|
6984
7004
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
6985
7005
|
|
|
6986
|
-
logger$
|
|
7006
|
+
logger$9.info('sdk webrtc hold', {
|
|
6987
7007
|
sessionId,
|
|
6988
7008
|
keys: Object.keys(this.heldSessions),
|
|
6989
7009
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7032,7 +7052,7 @@ class WebRTCClient extends Emitter {
|
|
|
7032
7052
|
const sessionId = this.getSipSessionId(session);
|
|
7033
7053
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7034
7054
|
|
|
7035
|
-
logger$
|
|
7055
|
+
logger$9.info('sdk webrtc unhold', {
|
|
7036
7056
|
sessionId,
|
|
7037
7057
|
keys: Object.keys(this.heldSessions),
|
|
7038
7058
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7180,7 +7200,7 @@ class WebRTCClient extends Emitter {
|
|
|
7180
7200
|
if (!session.sessionDescriptionHandler) {
|
|
7181
7201
|
return;
|
|
7182
7202
|
}
|
|
7183
|
-
logger$
|
|
7203
|
+
logger$9.info('Sending DTMF', {
|
|
7184
7204
|
id: this.getSipSessionId(session),
|
|
7185
7205
|
tone,
|
|
7186
7206
|
});
|
|
@@ -7196,7 +7216,7 @@ class WebRTCClient extends Emitter {
|
|
|
7196
7216
|
transfer(session , target ) {
|
|
7197
7217
|
this.hold(session);
|
|
7198
7218
|
|
|
7199
|
-
logger$
|
|
7219
|
+
logger$9.info('Transfering a session', {
|
|
7200
7220
|
id: this.getSipSessionId(session),
|
|
7201
7221
|
target,
|
|
7202
7222
|
});
|
|
@@ -7218,17 +7238,17 @@ class WebRTCClient extends Emitter {
|
|
|
7218
7238
|
atxfer(session ) {
|
|
7219
7239
|
this.hold(session);
|
|
7220
7240
|
|
|
7221
|
-
logger$
|
|
7241
|
+
logger$9.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7222
7242
|
|
|
7223
7243
|
const result = {
|
|
7224
7244
|
newSession: null,
|
|
7225
7245
|
init: async (target ) => {
|
|
7226
|
-
logger$
|
|
7246
|
+
logger$9.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7227
7247
|
|
|
7228
7248
|
result.newSession = await this.call(target);
|
|
7229
7249
|
},
|
|
7230
7250
|
complete: () => {
|
|
7231
|
-
logger$
|
|
7251
|
+
logger$9.info('webrtc transfer completed', {
|
|
7232
7252
|
id: this.getSipSessionId(session),
|
|
7233
7253
|
referId: this.getSipSessionId(result.newSession),
|
|
7234
7254
|
});
|
|
@@ -7249,7 +7269,7 @@ class WebRTCClient extends Emitter {
|
|
|
7249
7269
|
return;
|
|
7250
7270
|
}
|
|
7251
7271
|
|
|
7252
|
-
logger$
|
|
7272
|
+
logger$9.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7253
7273
|
|
|
7254
7274
|
try {
|
|
7255
7275
|
sipSession.message({
|
|
@@ -7291,7 +7311,7 @@ class WebRTCClient extends Emitter {
|
|
|
7291
7311
|
}
|
|
7292
7312
|
|
|
7293
7313
|
changeAudioOutputVolume(volume ) {
|
|
7294
|
-
logger$
|
|
7314
|
+
logger$9.info('Changing audio output volume', { volume });
|
|
7295
7315
|
|
|
7296
7316
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7297
7317
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7303,7 +7323,7 @@ class WebRTCClient extends Emitter {
|
|
|
7303
7323
|
}
|
|
7304
7324
|
|
|
7305
7325
|
changeAudioOutputDevice(id ) {
|
|
7306
|
-
logger$
|
|
7326
|
+
logger$9.info('Changing audio output device', { id });
|
|
7307
7327
|
|
|
7308
7328
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7309
7329
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7320,7 +7340,7 @@ class WebRTCClient extends Emitter {
|
|
|
7320
7340
|
|
|
7321
7341
|
changeAudioInputDevice(id , session ) {
|
|
7322
7342
|
const currentId = this.getAudioDeviceId();
|
|
7323
|
-
logger$
|
|
7343
|
+
logger$9.info('setting audio input device', { id, currentId, session: !!session });
|
|
7324
7344
|
|
|
7325
7345
|
if (id === currentId) {
|
|
7326
7346
|
return null;
|
|
@@ -7366,7 +7386,7 @@ class WebRTCClient extends Emitter {
|
|
|
7366
7386
|
|
|
7367
7387
|
setVideoInputDevice(id ) {
|
|
7368
7388
|
const currentId = this.getVideoDeviceId();
|
|
7369
|
-
logger$
|
|
7389
|
+
logger$9.info('setting video input device', { id, currentId });
|
|
7370
7390
|
|
|
7371
7391
|
if (id === currentId) {
|
|
7372
7392
|
return null;
|
|
@@ -7391,7 +7411,7 @@ class WebRTCClient extends Emitter {
|
|
|
7391
7411
|
const sessionId = this.getSipSessionId(session);
|
|
7392
7412
|
const localStream = this.getLocalStream(sessionId);
|
|
7393
7413
|
|
|
7394
|
-
logger$
|
|
7414
|
+
logger$9.info('changing video input device', { id, sessionId });
|
|
7395
7415
|
|
|
7396
7416
|
// Release old video stream
|
|
7397
7417
|
if (localStream) {
|
|
@@ -7459,7 +7479,7 @@ class WebRTCClient extends Emitter {
|
|
|
7459
7479
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7460
7480
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7461
7481
|
|
|
7462
|
-
logger$
|
|
7482
|
+
logger$9.info('Sending reinvite', {
|
|
7463
7483
|
id: this.getSipSessionId(sipSession),
|
|
7464
7484
|
newConstraints,
|
|
7465
7485
|
conference,
|
|
@@ -7497,7 +7517,7 @@ class WebRTCClient extends Emitter {
|
|
|
7497
7517
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7498
7518
|
}
|
|
7499
7519
|
|
|
7500
|
-
logger$
|
|
7520
|
+
logger$9.info('on re-INVITE accepted', {
|
|
7501
7521
|
id: this.getSipSessionId(sipSession),
|
|
7502
7522
|
wasMuted,
|
|
7503
7523
|
shouldDoScreenSharing,
|
|
@@ -7515,7 +7535,7 @@ class WebRTCClient extends Emitter {
|
|
|
7515
7535
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7516
7536
|
}
|
|
7517
7537
|
|
|
7518
|
-
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7538
|
+
return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
|
|
7519
7539
|
},
|
|
7520
7540
|
},
|
|
7521
7541
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7672,7 +7692,7 @@ class WebRTCClient extends Emitter {
|
|
|
7672
7692
|
}
|
|
7673
7693
|
|
|
7674
7694
|
startHeartbeat() {
|
|
7675
|
-
logger$
|
|
7695
|
+
logger$9.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7676
7696
|
if (!this.userAgent) {
|
|
7677
7697
|
this.heartbeat.stop();
|
|
7678
7698
|
return;
|
|
@@ -7685,7 +7705,7 @@ class WebRTCClient extends Emitter {
|
|
|
7685
7705
|
}
|
|
7686
7706
|
|
|
7687
7707
|
stopHeartbeat() {
|
|
7688
|
-
logger$
|
|
7708
|
+
logger$9.info('sdk webrtc stop heartbeat');
|
|
7689
7709
|
this.heartbeat.stop();
|
|
7690
7710
|
}
|
|
7691
7711
|
|
|
@@ -7706,7 +7726,7 @@ class WebRTCClient extends Emitter {
|
|
|
7706
7726
|
}
|
|
7707
7727
|
|
|
7708
7728
|
attemptReconnection() {
|
|
7709
|
-
logger$
|
|
7729
|
+
logger$9.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7710
7730
|
if (!this.userAgent) {
|
|
7711
7731
|
return;
|
|
7712
7732
|
}
|
|
@@ -7731,7 +7751,7 @@ class WebRTCClient extends Emitter {
|
|
|
7731
7751
|
return;
|
|
7732
7752
|
}
|
|
7733
7753
|
|
|
7734
|
-
logger$
|
|
7754
|
+
logger$9.info('setting local media stream', {
|
|
7735
7755
|
sipSessionId,
|
|
7736
7756
|
tracks: newStream ? newStream.getTracks() : null,
|
|
7737
7757
|
});
|
|
@@ -7748,7 +7768,7 @@ class WebRTCClient extends Emitter {
|
|
|
7748
7768
|
|
|
7749
7769
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
7750
7770
|
|
|
7751
|
-
logger$
|
|
7771
|
+
logger$9.info('updating local stream', {
|
|
7752
7772
|
sipSessionId,
|
|
7753
7773
|
oldStream: !!oldStream,
|
|
7754
7774
|
tracks: newStream.getTracks(),
|
|
@@ -7768,7 +7788,7 @@ class WebRTCClient extends Emitter {
|
|
|
7768
7788
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
7769
7789
|
const pc = this.getPeerConnection(sessionId);
|
|
7770
7790
|
|
|
7771
|
-
logger$
|
|
7791
|
+
logger$9.info('Updating remote stream', {
|
|
7772
7792
|
sessionId,
|
|
7773
7793
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
7774
7794
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -7793,14 +7813,16 @@ class WebRTCClient extends Emitter {
|
|
|
7793
7813
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
7794
7814
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
7795
7815
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
7816
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
7796
7817
|
|
|
7797
|
-
logger$
|
|
7818
|
+
logger$9.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
7798
7819
|
|
|
7799
7820
|
return {
|
|
7800
7821
|
constraints: {
|
|
7801
7822
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
7802
7823
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
7803
|
-
video: screenSharing ? (isDesktop
|
|
7824
|
+
video: screenSharing ? (isDesktop
|
|
7825
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
7804
7826
|
: this._getVideoConstraints(enableVideo),
|
|
7805
7827
|
screen: screenSharing,
|
|
7806
7828
|
desktop: isDesktop,
|
|
@@ -7843,7 +7865,7 @@ class WebRTCClient extends Emitter {
|
|
|
7843
7865
|
}
|
|
7844
7866
|
|
|
7845
7867
|
_onTransportError() {
|
|
7846
|
-
logger$
|
|
7868
|
+
logger$9.error('on transport error');
|
|
7847
7869
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
7848
7870
|
this.attemptReconnection();
|
|
7849
7871
|
}
|
|
@@ -7852,7 +7874,7 @@ class WebRTCClient extends Emitter {
|
|
|
7852
7874
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
7853
7875
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
7854
7876
|
if (this.hasHeartbeat()) {
|
|
7855
|
-
logger$
|
|
7877
|
+
logger$9.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
7856
7878
|
|
|
7857
7879
|
this.heartbeat.onHeartbeat();
|
|
7858
7880
|
if (this.heartbeatCb) {
|
|
@@ -7863,7 +7885,7 @@ class WebRTCClient extends Emitter {
|
|
|
7863
7885
|
}
|
|
7864
7886
|
|
|
7865
7887
|
async _onHeartbeatTimeout() {
|
|
7866
|
-
logger$
|
|
7888
|
+
logger$9.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7867
7889
|
|
|
7868
7890
|
if (this.heartbeatTimeoutCb) {
|
|
7869
7891
|
this.heartbeatTimeoutCb();
|
|
@@ -7875,7 +7897,7 @@ class WebRTCClient extends Emitter {
|
|
|
7875
7897
|
try {
|
|
7876
7898
|
await this.userAgent.transport.disconnect();
|
|
7877
7899
|
} catch (e) {
|
|
7878
|
-
logger$
|
|
7900
|
+
logger$9.error('Transport disconnection after heartbeat timeout, error', e);
|
|
7879
7901
|
}
|
|
7880
7902
|
}
|
|
7881
7903
|
|
|
@@ -7908,31 +7930,31 @@ class WebRTCClient extends Emitter {
|
|
|
7908
7930
|
}
|
|
7909
7931
|
|
|
7910
7932
|
_connectIfNeeded() {
|
|
7911
|
-
logger$
|
|
7933
|
+
logger$9.info('connect if needed, checking', { connected: this.isConnected() });
|
|
7912
7934
|
if (!this.userAgent) {
|
|
7913
|
-
logger$
|
|
7935
|
+
logger$9.info('need to recreate User Agent');
|
|
7914
7936
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
7915
7937
|
}
|
|
7916
7938
|
|
|
7917
7939
|
if (this.isConnected()) {
|
|
7918
|
-
logger$
|
|
7940
|
+
logger$9.info('webrtc sdk, already connected');
|
|
7919
7941
|
return Promise.resolve();
|
|
7920
7942
|
}
|
|
7921
7943
|
|
|
7922
7944
|
if (this.isConnecting()) {
|
|
7923
|
-
logger$
|
|
7945
|
+
logger$9.info('webrtc sdk, already connecting...');
|
|
7924
7946
|
|
|
7925
7947
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
7926
7948
|
return this.connectionPromise;
|
|
7927
7949
|
}
|
|
7928
7950
|
|
|
7929
7951
|
if (this.connectionPromise) {
|
|
7930
|
-
logger$
|
|
7952
|
+
logger$9.info('webrtc sdk, connection promise connecting...');
|
|
7931
7953
|
// $FlowFixMe
|
|
7932
7954
|
return this.connectionPromise;
|
|
7933
7955
|
}
|
|
7934
7956
|
|
|
7935
|
-
logger$
|
|
7957
|
+
logger$9.info('WebRTC UA needs to connect');
|
|
7936
7958
|
|
|
7937
7959
|
// Force UA to reconnect
|
|
7938
7960
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -8057,7 +8079,7 @@ class WebRTCClient extends Emitter {
|
|
|
8057
8079
|
|
|
8058
8080
|
sdh.peerConnectionDelegate = {
|
|
8059
8081
|
onicecandidateerror: (error ) => {
|
|
8060
|
-
logger$
|
|
8082
|
+
logger$9.error('on icecandidate error', {
|
|
8061
8083
|
address: error.address,
|
|
8062
8084
|
port: error.port,
|
|
8063
8085
|
errorCode: error.errorCode,
|
|
@@ -8086,7 +8108,7 @@ class WebRTCClient extends Emitter {
|
|
|
8086
8108
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8087
8109
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8088
8110
|
}
|
|
8089
|
-
logger$
|
|
8111
|
+
logger$9.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8090
8112
|
|
|
8091
8113
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8092
8114
|
|
|
@@ -8102,12 +8124,12 @@ class WebRTCClient extends Emitter {
|
|
|
8102
8124
|
|
|
8103
8125
|
this._setupMedias(session);
|
|
8104
8126
|
|
|
8105
|
-
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8127
|
+
return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8106
8128
|
};
|
|
8107
8129
|
}
|
|
8108
8130
|
|
|
8109
8131
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8110
|
-
logger$
|
|
8132
|
+
logger$9.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8111
8133
|
|
|
8112
8134
|
this.storeSipSession(session);
|
|
8113
8135
|
|
|
@@ -8119,14 +8141,14 @@ class WebRTCClient extends Emitter {
|
|
|
8119
8141
|
const onTrack = (event ) => {
|
|
8120
8142
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8121
8143
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8122
|
-
logger$
|
|
8144
|
+
logger$9.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8123
8145
|
|
|
8124
8146
|
// Stop video track in audio only mode
|
|
8125
8147
|
if (isAudioOnly && kind === 'video') {
|
|
8126
8148
|
event.track.stop();
|
|
8127
8149
|
}
|
|
8128
8150
|
|
|
8129
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8151
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
8130
8152
|
};
|
|
8131
8153
|
|
|
8132
8154
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8135,12 +8157,14 @@ class WebRTCClient extends Emitter {
|
|
|
8135
8157
|
|
|
8136
8158
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8137
8159
|
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8160
|
+
if (pc) {
|
|
8161
|
+
pc.oniceconnectionstatechange = () => {
|
|
8162
|
+
logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8163
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8164
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8165
|
+
}
|
|
8166
|
+
};
|
|
8167
|
+
}
|
|
8144
8168
|
|
|
8145
8169
|
if (withEvent) {
|
|
8146
8170
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8309,10 +8333,10 @@ class WebRTCClient extends Emitter {
|
|
|
8309
8333
|
|
|
8310
8334
|
_stopSendingStats(session ) {
|
|
8311
8335
|
const sessionId = this.getSipSessionId(session);
|
|
8312
|
-
logger$
|
|
8336
|
+
logger$9.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8313
8337
|
|
|
8314
8338
|
if (sessionId in this.statsIntervals) {
|
|
8315
|
-
logger$
|
|
8339
|
+
logger$9.trace('Stop sending stats for call', { sessionId });
|
|
8316
8340
|
this.statsIntervals[sessionId]();
|
|
8317
8341
|
delete this.statsIntervals[sessionId];
|
|
8318
8342
|
}
|
|
@@ -8328,7 +8352,7 @@ class WebRTCClient extends Emitter {
|
|
|
8328
8352
|
try {
|
|
8329
8353
|
await this.userAgent.transport.disconnect();
|
|
8330
8354
|
} catch (e) {
|
|
8331
|
-
logger$
|
|
8355
|
+
logger$9.error('WebRTC transport disconnect, error', e);
|
|
8332
8356
|
}
|
|
8333
8357
|
}
|
|
8334
8358
|
}
|
|
@@ -8350,13 +8374,17 @@ class WebRTCClient extends Emitter {
|
|
|
8350
8374
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8351
8375
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8352
8376
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8377
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8353
8378
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8354
8379
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8380
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8355
8381
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8356
8382
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8357
8383
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8358
|
-
let audioBytesSent = 0;
|
|
8359
|
-
let audioBytesReceived = 0;
|
|
8384
|
+
let audioBytesSent = 0; // content + header
|
|
8385
|
+
let audioBytesReceived = 0; // content + header
|
|
8386
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8387
|
+
let audioContentReceived = 0;
|
|
8360
8388
|
let videoBytesSent = 0;
|
|
8361
8389
|
let videoBytesReceived = 0;
|
|
8362
8390
|
let transportSent = 0;
|
|
@@ -8366,6 +8394,7 @@ class WebRTCClient extends Emitter {
|
|
|
8366
8394
|
stats.forEach(report => {
|
|
8367
8395
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8368
8396
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8397
|
+
audioContentSent += Number(report.bytesSent);
|
|
8369
8398
|
}
|
|
8370
8399
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8371
8400
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -8377,6 +8406,7 @@ class WebRTCClient extends Emitter {
|
|
|
8377
8406
|
packetsLost += Number(report.packetsLost);
|
|
8378
8407
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8379
8408
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8409
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8380
8410
|
}
|
|
8381
8411
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8382
8412
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -8405,10 +8435,17 @@ class WebRTCClient extends Emitter {
|
|
|
8405
8435
|
});
|
|
8406
8436
|
|
|
8407
8437
|
networkStats.packetsLost = packetsLost;
|
|
8438
|
+
|
|
8408
8439
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8409
8440
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8410
8441
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8411
8442
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8443
|
+
|
|
8444
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8445
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8446
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8447
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8448
|
+
|
|
8412
8449
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8413
8450
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8414
8451
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8422,7 +8459,7 @@ class WebRTCClient extends Emitter {
|
|
|
8422
8459
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8423
8460
|
+ networkStats.transportSent;
|
|
8424
8461
|
|
|
8425
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8462
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8426
8463
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8427
8464
|
}
|
|
8428
8465
|
|
|
@@ -8447,11 +8484,12 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8447
8484
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8448
8485
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8449
8486
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8487
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8450
8488
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8451
8489
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8452
8490
|
const ON_MESSAGE = 'onMessage';
|
|
8453
|
-
const ON_REINVITE
|
|
8454
|
-
const ON_TRACK
|
|
8491
|
+
const ON_REINVITE = 'reinvite';
|
|
8492
|
+
const ON_TRACK = 'onTrack';
|
|
8455
8493
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8456
8494
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8457
8495
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8466,15 +8504,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8466
8504
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8467
8505
|
const ON_CALL_ERROR = 'onCallError';
|
|
8468
8506
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8469
|
-
const ON_NETWORK_STATS
|
|
8507
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8470
8508
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8471
8509
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8472
|
-
const ON_DISCONNECTED
|
|
8510
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
8473
8511
|
|
|
8474
8512
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8475
8513
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8476
8514
|
|
|
8477
|
-
const events
|
|
8515
|
+
const events = [
|
|
8478
8516
|
ON_USER_AGENT,
|
|
8479
8517
|
ON_REGISTERED,
|
|
8480
8518
|
ON_UNREGISTERED,
|
|
@@ -8491,9 +8529,10 @@ const events$1 = [
|
|
|
8491
8529
|
ON_CAMERA_DISABLED,
|
|
8492
8530
|
ON_CALL_FAILED,
|
|
8493
8531
|
ON_CALL_ENDED,
|
|
8532
|
+
ON_CALL_REJECTED,
|
|
8494
8533
|
ON_MESSAGE,
|
|
8495
|
-
ON_REINVITE
|
|
8496
|
-
ON_TRACK
|
|
8534
|
+
ON_REINVITE,
|
|
8535
|
+
ON_TRACK,
|
|
8497
8536
|
ON_AUDIO_STREAM,
|
|
8498
8537
|
ON_VIDEO_STREAM,
|
|
8499
8538
|
ON_REMOVE_STREAM,
|
|
@@ -8508,11 +8547,11 @@ const events$1 = [
|
|
|
8508
8547
|
ON_CALL_ERROR,
|
|
8509
8548
|
ON_CHAT,
|
|
8510
8549
|
ON_SIGNAL,
|
|
8511
|
-
ON_NETWORK_STATS
|
|
8512
|
-
ON_DISCONNECTED
|
|
8550
|
+
ON_NETWORK_STATS,
|
|
8551
|
+
ON_DISCONNECTED,
|
|
8513
8552
|
];
|
|
8514
8553
|
|
|
8515
|
-
const logger$
|
|
8554
|
+
const logger$8 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8516
8555
|
|
|
8517
8556
|
class WebRTCPhone extends Emitter {
|
|
8518
8557
|
|
|
@@ -8585,7 +8624,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8585
8624
|
}).catch(error => {
|
|
8586
8625
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8587
8626
|
console.error('register error', error, error.message, error.stack);
|
|
8588
|
-
logger$
|
|
8627
|
+
logger$8.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8589
8628
|
});
|
|
8590
8629
|
}
|
|
8591
8630
|
|
|
@@ -8600,7 +8639,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8600
8639
|
if (!this.client) {
|
|
8601
8640
|
return;
|
|
8602
8641
|
}
|
|
8603
|
-
logger$
|
|
8642
|
+
logger$8.info('WebRTC phone stop');
|
|
8604
8643
|
this.client.stop();
|
|
8605
8644
|
}
|
|
8606
8645
|
|
|
@@ -8615,11 +8654,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8615
8654
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8616
8655
|
audioOnly = false, iceRestart = false) {
|
|
8617
8656
|
const sipSession = this.findSipSession(callSession);
|
|
8618
|
-
logger$
|
|
8657
|
+
logger$8.info('WebRTC phone - send reinvite', {
|
|
8619
8658
|
sessionId: sipSession ? sipSession.id : null,
|
|
8620
8659
|
constraints,
|
|
8621
8660
|
audioOnly,
|
|
8622
8661
|
conference,
|
|
8662
|
+
iceRestart,
|
|
8623
8663
|
});
|
|
8624
8664
|
|
|
8625
8665
|
if (!sipSession) {
|
|
@@ -8652,7 +8692,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8652
8692
|
}
|
|
8653
8693
|
|
|
8654
8694
|
startHeartbeat() {
|
|
8655
|
-
logger$
|
|
8695
|
+
logger$8.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8656
8696
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8657
8697
|
return;
|
|
8658
8698
|
}
|
|
@@ -8661,7 +8701,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8661
8701
|
}
|
|
8662
8702
|
|
|
8663
8703
|
stopHeartbeat() {
|
|
8664
|
-
logger$
|
|
8704
|
+
logger$8.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8665
8705
|
if (!this.client) {
|
|
8666
8706
|
return;
|
|
8667
8707
|
}
|
|
@@ -8678,7 +8718,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8678
8718
|
}
|
|
8679
8719
|
|
|
8680
8720
|
reconnect() {
|
|
8681
|
-
logger$
|
|
8721
|
+
logger$8.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8682
8722
|
if (!this.client) {
|
|
8683
8723
|
return;
|
|
8684
8724
|
}
|
|
@@ -8719,7 +8759,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8719
8759
|
return false;
|
|
8720
8760
|
}
|
|
8721
8761
|
|
|
8722
|
-
logger$
|
|
8762
|
+
logger$8.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8723
8763
|
|
|
8724
8764
|
this.client.downgradeToAudio(sipSession);
|
|
8725
8765
|
|
|
@@ -8742,7 +8782,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8742
8782
|
return Promise.resolve(false);
|
|
8743
8783
|
}
|
|
8744
8784
|
|
|
8745
|
-
logger$
|
|
8785
|
+
logger$8.info('Upgrade to video', {
|
|
8746
8786
|
id: callSession ? callSession.getId() : null,
|
|
8747
8787
|
constraints,
|
|
8748
8788
|
isConference,
|
|
@@ -8782,7 +8822,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8782
8822
|
|
|
8783
8823
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
8784
8824
|
const sipSession = this.findSipSession(callSession);
|
|
8785
|
-
logger$
|
|
8825
|
+
logger$8.info('Sending reinvite message', {
|
|
8786
8826
|
id: callSession ? callSession.getId() : null,
|
|
8787
8827
|
isUpgrade,
|
|
8788
8828
|
});
|
|
@@ -8808,7 +8848,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8808
8848
|
// Monkey patch to know when canceled with the CANCEL message
|
|
8809
8849
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
8810
8850
|
sipSession._onCancel = (message ) => {
|
|
8811
|
-
logger$
|
|
8851
|
+
logger$8.trace('on sip session canceled', { callId: message.callId });
|
|
8812
8852
|
|
|
8813
8853
|
onCancel(message);
|
|
8814
8854
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -8836,16 +8876,17 @@ class WebRTCPhone extends Emitter {
|
|
|
8836
8876
|
this.audioOutputVolume,
|
|
8837
8877
|
);
|
|
8838
8878
|
case sessionState.SessionState.Terminating:
|
|
8839
|
-
logger$
|
|
8879
|
+
logger$8.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
8840
8880
|
|
|
8841
8881
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
8842
8882
|
|
|
8843
8883
|
break;
|
|
8844
8884
|
case sessionState.SessionState.Terminated: {
|
|
8845
|
-
logger$
|
|
8885
|
+
logger$8.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
8846
8886
|
|
|
8847
8887
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8848
8888
|
const callSession = this._createCallSession(sipSession);
|
|
8889
|
+
callSession.endTime = new Date();
|
|
8849
8890
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
8850
8891
|
|
|
8851
8892
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -8864,7 +8905,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8864
8905
|
const [stream] = event.streams;
|
|
8865
8906
|
const kind = event && event.track && event.track.kind;
|
|
8866
8907
|
|
|
8867
|
-
logger$
|
|
8908
|
+
logger$8.info('on track stream called on the peer connection', {
|
|
8868
8909
|
callId: this.getSipSessionId(sipSession),
|
|
8869
8910
|
streamId: stream ? stream.id : null,
|
|
8870
8911
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -8884,7 +8925,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8884
8925
|
};
|
|
8885
8926
|
|
|
8886
8927
|
peerConnection.onremovestream = event => {
|
|
8887
|
-
logger$
|
|
8928
|
+
logger$8.info('on remove stream called on the peer connection', {
|
|
8888
8929
|
id: event.stream.id,
|
|
8889
8930
|
tracks: event.stream.getTracks(),
|
|
8890
8931
|
});
|
|
@@ -8894,7 +8935,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8894
8935
|
}
|
|
8895
8936
|
|
|
8896
8937
|
async startScreenSharing(constraints , callSession ) {
|
|
8897
|
-
logger$
|
|
8938
|
+
logger$8.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
8898
8939
|
|
|
8899
8940
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
8900
8941
|
if (!screenShareStream) {
|
|
@@ -8934,7 +8975,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8934
8975
|
return;
|
|
8935
8976
|
}
|
|
8936
8977
|
|
|
8937
|
-
logger$
|
|
8978
|
+
logger$8.info('WebRTC phone - stop screen sharing', {
|
|
8938
8979
|
restoreLocalStream,
|
|
8939
8980
|
});
|
|
8940
8981
|
|
|
@@ -8990,7 +9031,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8990
9031
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
8991
9032
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
8992
9033
|
|
|
8993
|
-
logger$
|
|
9034
|
+
logger$8.info('WebRTC phone - on screensharing', {
|
|
8994
9035
|
hadVideo,
|
|
8995
9036
|
id: this.getSipSessionId(sipSession),
|
|
8996
9037
|
screenTrack,
|
|
@@ -8998,7 +9039,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8998
9039
|
|
|
8999
9040
|
if (screenTrack) {
|
|
9000
9041
|
screenTrack.onended = () => {
|
|
9001
|
-
logger$
|
|
9042
|
+
logger$8.info('WebRTC phone - on screenshare ended', {
|
|
9002
9043
|
hadVideo,
|
|
9003
9044
|
id: this.getSipSessionId(sipSession),
|
|
9004
9045
|
screenTrack,
|
|
@@ -9029,7 +9070,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9029
9070
|
}
|
|
9030
9071
|
|
|
9031
9072
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9032
|
-
logger$
|
|
9073
|
+
logger$8.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9033
9074
|
|
|
9034
9075
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9035
9076
|
this.currentSipSession = sipSession;
|
|
@@ -9047,7 +9088,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9047
9088
|
}
|
|
9048
9089
|
|
|
9049
9090
|
changeAudioDevice(id ) {
|
|
9050
|
-
logger$
|
|
9091
|
+
logger$8.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9051
9092
|
this.audioOutputDeviceId = id;
|
|
9052
9093
|
this.client.changeAudioOutputDevice(id);
|
|
9053
9094
|
}
|
|
@@ -9057,14 +9098,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9057
9098
|
}
|
|
9058
9099
|
|
|
9059
9100
|
changeRingDevice(id ) {
|
|
9060
|
-
logger$
|
|
9101
|
+
logger$8.info('WebRTC phone - changing ring device', { id });
|
|
9061
9102
|
|
|
9062
9103
|
this.audioRingDeviceId = id;
|
|
9063
9104
|
}
|
|
9064
9105
|
|
|
9065
9106
|
// volume is a value between 0 and 1
|
|
9066
9107
|
changeAudioVolume(volume ) {
|
|
9067
|
-
logger$
|
|
9108
|
+
logger$8.info('WebRTC phone - changing audio volume', { volume });
|
|
9068
9109
|
|
|
9069
9110
|
this.audioOutputVolume = volume;
|
|
9070
9111
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9072,32 +9113,33 @@ class WebRTCPhone extends Emitter {
|
|
|
9072
9113
|
|
|
9073
9114
|
// volume is a value between 0 and 1
|
|
9074
9115
|
changeRingVolume(volume ) {
|
|
9075
|
-
logger$
|
|
9116
|
+
logger$8.info('WebRTC phone - changing ring volume', { volume });
|
|
9076
9117
|
|
|
9077
9118
|
this.audioRingVolume = volume;
|
|
9078
9119
|
}
|
|
9079
9120
|
|
|
9080
9121
|
changeAudioInputDevice(id ) {
|
|
9081
|
-
logger$
|
|
9122
|
+
logger$8.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9082
9123
|
|
|
9083
9124
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9084
9125
|
}
|
|
9085
9126
|
|
|
9086
9127
|
changeVideoInputDevice(id ) {
|
|
9087
|
-
logger$
|
|
9128
|
+
logger$8.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9088
9129
|
|
|
9089
9130
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9090
9131
|
}
|
|
9091
9132
|
|
|
9092
9133
|
changeSessionVideoInputDevice(id ) {
|
|
9093
|
-
logger$
|
|
9134
|
+
logger$8.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9094
9135
|
|
|
9095
9136
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9096
9137
|
}
|
|
9097
9138
|
|
|
9098
9139
|
_onCallTerminated(sipSession ) {
|
|
9099
|
-
logger$
|
|
9140
|
+
logger$8.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9100
9141
|
|
|
9142
|
+
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9101
9143
|
const callSession = this._createCallSession(sipSession);
|
|
9102
9144
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
9103
9145
|
const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
|
|
@@ -9115,7 +9157,6 @@ class WebRTCPhone extends Emitter {
|
|
|
9115
9157
|
}, 5);
|
|
9116
9158
|
}
|
|
9117
9159
|
|
|
9118
|
-
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9119
9160
|
if (sipSessionId) {
|
|
9120
9161
|
this.removeIncomingSessions(sipSessionId);
|
|
9121
9162
|
}
|
|
@@ -9130,7 +9171,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9130
9171
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9131
9172
|
|
|
9132
9173
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9133
|
-
logger$
|
|
9174
|
+
logger$8.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9134
9175
|
sipId: sipSession.id,
|
|
9135
9176
|
shouldRetrigger,
|
|
9136
9177
|
hasIncomingCallSession,
|
|
@@ -9221,37 +9262,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9221
9262
|
|
|
9222
9263
|
// Deprecated
|
|
9223
9264
|
getLocalStreamForCall(callSession ) {
|
|
9224
|
-
logger$
|
|
9265
|
+
logger$8.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9225
9266
|
|
|
9226
9267
|
return this.getLocalStream(callSession);
|
|
9227
9268
|
}
|
|
9228
9269
|
|
|
9229
9270
|
// Deprecated
|
|
9230
9271
|
getRemoteStreamForCall(callSession ) {
|
|
9231
|
-
logger$
|
|
9272
|
+
logger$8.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9232
9273
|
|
|
9233
9274
|
return this.getRemoteVideoStream(callSession);
|
|
9234
9275
|
}
|
|
9235
9276
|
|
|
9236
9277
|
getRemoteStreamsForCall(callSession ) {
|
|
9237
|
-
logger$
|
|
9278
|
+
logger$8.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9238
9279
|
|
|
9239
9280
|
return this.getRemoteStream(callSession);
|
|
9240
9281
|
}
|
|
9241
9282
|
|
|
9242
9283
|
accept(callSession , cameraEnabled ) {
|
|
9243
|
-
logger$
|
|
9284
|
+
logger$8.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9244
9285
|
if (this.currentSipSession) {
|
|
9245
9286
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9246
9287
|
}
|
|
9247
9288
|
|
|
9248
9289
|
if (!callSession) {
|
|
9249
|
-
logger$
|
|
9290
|
+
logger$8.warn('no CallSession to accept.');
|
|
9250
9291
|
return Promise.resolve(null);
|
|
9251
9292
|
}
|
|
9252
9293
|
|
|
9253
9294
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9254
|
-
logger$
|
|
9295
|
+
logger$8.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9255
9296
|
return Promise.resolve(callSession.sipCallId);
|
|
9256
9297
|
}
|
|
9257
9298
|
|
|
@@ -9263,24 +9304,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9263
9304
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9264
9305
|
if (sipSession) {
|
|
9265
9306
|
if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
|
|
9266
|
-
logger$
|
|
9307
|
+
logger$8.warn('Trying to answer a terminated sipSession.');
|
|
9267
9308
|
|
|
9268
9309
|
return Promise.resolve(null);
|
|
9269
9310
|
}
|
|
9270
9311
|
|
|
9271
|
-
logger$
|
|
9312
|
+
logger$8.info('accept call, session found', { sipId: sipSession.id });
|
|
9272
9313
|
|
|
9273
9314
|
// $FlowFixMe
|
|
9274
9315
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9275
9316
|
return callSession.sipCallId;
|
|
9276
9317
|
}).catch(e => {
|
|
9277
|
-
logger$
|
|
9318
|
+
logger$8.error(e);
|
|
9278
9319
|
this.endCurrentCall(callSession);
|
|
9279
9320
|
throw e;
|
|
9280
9321
|
});
|
|
9281
9322
|
}
|
|
9282
9323
|
|
|
9283
|
-
logger$
|
|
9324
|
+
logger$8.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9284
9325
|
|
|
9285
9326
|
return Promise.resolve(null);
|
|
9286
9327
|
}
|
|
@@ -9290,7 +9331,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9290
9331
|
}
|
|
9291
9332
|
|
|
9292
9333
|
async reject(callSession ) {
|
|
9293
|
-
logger$
|
|
9334
|
+
logger$8.info('reject WebRTC called', { id: callSession.getId() });
|
|
9294
9335
|
|
|
9295
9336
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9296
9337
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9302,14 +9343,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9302
9343
|
|
|
9303
9344
|
const sipSession = this.findSipSession(callSession);
|
|
9304
9345
|
if (sipSession) {
|
|
9305
|
-
logger$
|
|
9346
|
+
logger$8.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9306
9347
|
|
|
9307
9348
|
this.client.hangup(sipSession);
|
|
9308
9349
|
}
|
|
9309
9350
|
}
|
|
9310
9351
|
|
|
9311
9352
|
async ignore(callSession ) {
|
|
9312
|
-
logger$
|
|
9353
|
+
logger$8.info('WebRTC ignore', { id: callSession.getId() });
|
|
9313
9354
|
|
|
9314
9355
|
// kill the ring
|
|
9315
9356
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9321,14 +9362,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9321
9362
|
const sipSession = this.findSipSession(callSession);
|
|
9322
9363
|
|
|
9323
9364
|
if (sipSession) {
|
|
9324
|
-
logger$
|
|
9365
|
+
logger$8.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9325
9366
|
|
|
9326
9367
|
return this.client.atxfer(sipSession);
|
|
9327
9368
|
}
|
|
9328
9369
|
}
|
|
9329
9370
|
|
|
9330
9371
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9331
|
-
logger$
|
|
9372
|
+
logger$8.info('WebRTC hold', { id: callSession.getId() });
|
|
9332
9373
|
|
|
9333
9374
|
const sipSession = this.findSipSession(callSession);
|
|
9334
9375
|
|
|
@@ -9343,18 +9384,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9343
9384
|
}
|
|
9344
9385
|
|
|
9345
9386
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9346
|
-
logger$
|
|
9387
|
+
logger$8.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9347
9388
|
|
|
9348
9389
|
const sipSession = this.findSipSession(callSession);
|
|
9349
9390
|
if (!sipSession) {
|
|
9350
9391
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9351
9392
|
}
|
|
9352
9393
|
|
|
9353
|
-
logger$
|
|
9394
|
+
logger$8.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9354
9395
|
|
|
9355
9396
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9356
9397
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9357
|
-
logger$
|
|
9398
|
+
logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9358
9399
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9359
9400
|
}
|
|
9360
9401
|
|
|
@@ -9379,7 +9420,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9379
9420
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9380
9421
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9381
9422
|
|
|
9382
|
-
logger$
|
|
9423
|
+
logger$8.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9383
9424
|
|
|
9384
9425
|
// Stop screenshre if needed
|
|
9385
9426
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9410,7 +9451,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9410
9451
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9411
9452
|
}
|
|
9412
9453
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9413
|
-
logger$
|
|
9454
|
+
logger$8.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9414
9455
|
|
|
9415
9456
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9416
9457
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9454,14 +9495,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9454
9495
|
}
|
|
9455
9496
|
|
|
9456
9497
|
mute(callSession , withEvent = true) {
|
|
9457
|
-
logger$
|
|
9498
|
+
logger$8.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9458
9499
|
|
|
9459
9500
|
const sipSession = this.findSipSession(callSession);
|
|
9460
9501
|
if (!sipSession) {
|
|
9461
9502
|
return;
|
|
9462
9503
|
}
|
|
9463
9504
|
|
|
9464
|
-
logger$
|
|
9505
|
+
logger$8.info('WebRTC muting', { sipId: sipSession.id });
|
|
9465
9506
|
this.client.mute(sipSession);
|
|
9466
9507
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9467
9508
|
|
|
@@ -9475,14 +9516,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9475
9516
|
}
|
|
9476
9517
|
|
|
9477
9518
|
unmute(callSession , withEvent = true) {
|
|
9478
|
-
logger$
|
|
9519
|
+
logger$8.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9479
9520
|
|
|
9480
9521
|
const sipSession = this.findSipSession(callSession);
|
|
9481
9522
|
if (!sipSession) {
|
|
9482
9523
|
return;
|
|
9483
9524
|
}
|
|
9484
9525
|
|
|
9485
|
-
logger$
|
|
9526
|
+
logger$8.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9486
9527
|
this.client.unmute(sipSession);
|
|
9487
9528
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9488
9529
|
|
|
@@ -9509,7 +9550,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9509
9550
|
if (!sipSession) {
|
|
9510
9551
|
return;
|
|
9511
9552
|
}
|
|
9512
|
-
logger$
|
|
9553
|
+
logger$8.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9513
9554
|
|
|
9514
9555
|
this.client.toggleCameraOn(sipSession);
|
|
9515
9556
|
|
|
@@ -9521,7 +9562,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9521
9562
|
if (!sipSession) {
|
|
9522
9563
|
return;
|
|
9523
9564
|
}
|
|
9524
|
-
logger$
|
|
9565
|
+
logger$8.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9525
9566
|
|
|
9526
9567
|
this.client.toggleCameraOff(sipSession);
|
|
9527
9568
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9533,7 +9574,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9533
9574
|
return;
|
|
9534
9575
|
}
|
|
9535
9576
|
|
|
9536
|
-
logger$
|
|
9577
|
+
logger$8.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9537
9578
|
this.client.sendDTMF(sipSession, tone);
|
|
9538
9579
|
}
|
|
9539
9580
|
|
|
@@ -9541,7 +9582,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9541
9582
|
// @TODO: line is not used here
|
|
9542
9583
|
async makeCall(number , line , cameraEnabled ,
|
|
9543
9584
|
audioOnly = false, conference = false) {
|
|
9544
|
-
logger$
|
|
9585
|
+
logger$8.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
9545
9586
|
if (!number) {
|
|
9546
9587
|
return Promise.resolve(null);
|
|
9547
9588
|
}
|
|
@@ -9551,7 +9592,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9551
9592
|
}
|
|
9552
9593
|
if (this.currentSipSession) {
|
|
9553
9594
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9554
|
-
logger$
|
|
9595
|
+
logger$8.warn('Unable to hold current session when making another call', e);
|
|
9555
9596
|
});
|
|
9556
9597
|
}
|
|
9557
9598
|
|
|
@@ -9561,10 +9602,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9561
9602
|
this._bindEvents(sipSession);
|
|
9562
9603
|
} catch (error) {
|
|
9563
9604
|
console.warn(error);
|
|
9564
|
-
logger$
|
|
9605
|
+
logger$8.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9565
9606
|
return Promise.resolve(null);
|
|
9566
9607
|
}
|
|
9567
9608
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9609
|
+
callSession.creationTime = new Date();
|
|
9568
9610
|
|
|
9569
9611
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9570
9612
|
|
|
@@ -9589,7 +9631,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9589
9631
|
return;
|
|
9590
9632
|
}
|
|
9591
9633
|
|
|
9592
|
-
logger$
|
|
9634
|
+
logger$8.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9593
9635
|
|
|
9594
9636
|
this.client.transfer(sipSession, target);
|
|
9595
9637
|
}
|
|
@@ -9598,7 +9640,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9598
9640
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9599
9641
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9600
9642
|
|
|
9601
|
-
logger$
|
|
9643
|
+
logger$8.info('WebRTC indirect transfer', {
|
|
9602
9644
|
sipId: sipSession ? sipSession.id : null,
|
|
9603
9645
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9604
9646
|
});
|
|
@@ -9637,7 +9679,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9637
9679
|
return false;
|
|
9638
9680
|
}
|
|
9639
9681
|
|
|
9640
|
-
logger$
|
|
9682
|
+
logger$8.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9641
9683
|
|
|
9642
9684
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9643
9685
|
|
|
@@ -9683,7 +9725,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9683
9725
|
endCurrentCall(callSession ) {
|
|
9684
9726
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9685
9727
|
|
|
9686
|
-
logger$
|
|
9728
|
+
logger$8.info('Ending current call', {
|
|
9687
9729
|
id: callSession ? callSession.getId() : null,
|
|
9688
9730
|
isCurrent,
|
|
9689
9731
|
});
|
|
@@ -9707,7 +9749,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9707
9749
|
}
|
|
9708
9750
|
|
|
9709
9751
|
async close() {
|
|
9710
|
-
logger$
|
|
9752
|
+
logger$8.info('WebRTC close');
|
|
9711
9753
|
|
|
9712
9754
|
try {
|
|
9713
9755
|
await Promise.race([
|
|
@@ -9715,7 +9757,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9715
9757
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9716
9758
|
]);
|
|
9717
9759
|
} catch (e) {
|
|
9718
|
-
logger$
|
|
9760
|
+
logger$8.error('WebRTC close, unregister error', e);
|
|
9719
9761
|
}
|
|
9720
9762
|
|
|
9721
9763
|
this.client.close();
|
|
@@ -9733,12 +9775,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9733
9775
|
}
|
|
9734
9776
|
|
|
9735
9777
|
enableRinging() {
|
|
9736
|
-
logger$
|
|
9778
|
+
logger$8.info('WebRTC enable ringing');
|
|
9737
9779
|
this.ringingEnabled = true;
|
|
9738
9780
|
}
|
|
9739
9781
|
|
|
9740
9782
|
disableRinging() {
|
|
9741
|
-
logger$
|
|
9783
|
+
logger$8.info('WebRTC disable ringing');
|
|
9742
9784
|
this.ringingEnabled = false;
|
|
9743
9785
|
}
|
|
9744
9786
|
|
|
@@ -9760,8 +9802,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9760
9802
|
}
|
|
9761
9803
|
|
|
9762
9804
|
const sessionId = this.incomingSessions[0];
|
|
9805
|
+
const sipSession = this.client.getSipSession(sessionId);
|
|
9806
|
+
if (!sipSession) {
|
|
9807
|
+
return null;
|
|
9808
|
+
}
|
|
9763
9809
|
|
|
9764
|
-
return this._createCallSession(
|
|
9810
|
+
return this._createCallSession(sipSession);
|
|
9765
9811
|
}
|
|
9766
9812
|
|
|
9767
9813
|
sendMessage(sipSession = null, body , contentType = 'text/plain') {
|
|
@@ -9778,7 +9824,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9778
9824
|
|
|
9779
9825
|
// Deprecated
|
|
9780
9826
|
getLocalMediaStream(callSession ) {
|
|
9781
|
-
logger$
|
|
9827
|
+
logger$8.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9782
9828
|
return this.getLocalStream(callSession);
|
|
9783
9829
|
}
|
|
9784
9830
|
|
|
@@ -9820,7 +9866,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9820
9866
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
9821
9867
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
9822
9868
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
9823
|
-
logger$
|
|
9869
|
+
logger$8.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
9824
9870
|
|
|
9825
9871
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
9826
9872
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -9839,11 +9885,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9839
9885
|
callSession);
|
|
9840
9886
|
}
|
|
9841
9887
|
|
|
9888
|
+
callSession.creationTime = new Date();
|
|
9842
9889
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
9843
9890
|
});
|
|
9844
9891
|
|
|
9845
9892
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
9846
|
-
logger$
|
|
9893
|
+
logger$8.info('WebRTC on reinvite', {
|
|
9847
9894
|
sessionId: args[0].id,
|
|
9848
9895
|
inviteId: args[1].id,
|
|
9849
9896
|
updatedCalleeName: args[2],
|
|
@@ -9863,7 +9910,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9863
9910
|
});
|
|
9864
9911
|
|
|
9865
9912
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
9866
|
-
logger$
|
|
9913
|
+
logger$8.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
9867
9914
|
|
|
9868
9915
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
9869
9916
|
|
|
@@ -9874,22 +9921,29 @@ class WebRTCPhone extends Emitter {
|
|
|
9874
9921
|
this.client.on('ended', () => {});
|
|
9875
9922
|
|
|
9876
9923
|
this.client.on(this.client.ON_ERROR, e => {
|
|
9877
|
-
logger$
|
|
9924
|
+
logger$8.error('WebRTC error', e);
|
|
9878
9925
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
9879
9926
|
});
|
|
9880
9927
|
|
|
9928
|
+
this.client.on(this.client.REJECTED, session => {
|
|
9929
|
+
logger$8.info('WebRTC call rejected', session.id);
|
|
9930
|
+
const callSession = this._createCallSession(session);
|
|
9931
|
+
callSession.endTime = new Date();
|
|
9932
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
9933
|
+
});
|
|
9934
|
+
|
|
9881
9935
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
9882
|
-
logger$
|
|
9936
|
+
logger$8.info('WebRTC unregistered');
|
|
9883
9937
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
9884
9938
|
});
|
|
9885
9939
|
|
|
9886
9940
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
9887
|
-
logger$
|
|
9888
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
9941
|
+
logger$8.info('WebRTC disconnected');
|
|
9942
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
9889
9943
|
});
|
|
9890
9944
|
|
|
9891
9945
|
this.client.on(this.client.REGISTERED, () => {
|
|
9892
|
-
logger$
|
|
9946
|
+
logger$8.info('WebRTC registered', {
|
|
9893
9947
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
9894
9948
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
9895
9949
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -9910,19 +9964,19 @@ class WebRTCPhone extends Emitter {
|
|
|
9910
9964
|
// Send reinvite with iceRestart
|
|
9911
9965
|
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
9912
9966
|
} catch (e) {
|
|
9913
|
-
logger$
|
|
9967
|
+
logger$8.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
9914
9968
|
}
|
|
9915
9969
|
}
|
|
9916
9970
|
});
|
|
9917
9971
|
|
|
9918
9972
|
this.client.on(this.client.CONNECTED, () => {
|
|
9919
|
-
logger$
|
|
9973
|
+
logger$8.info('WebRTC client connected');
|
|
9920
9974
|
|
|
9921
9975
|
this.stopHeartbeat();
|
|
9922
9976
|
});
|
|
9923
9977
|
|
|
9924
9978
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
9925
|
-
logger$
|
|
9979
|
+
logger$8.info('WebRTC client disconnected');
|
|
9926
9980
|
|
|
9927
9981
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
9928
9982
|
|
|
@@ -9936,7 +9990,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9936
9990
|
});
|
|
9937
9991
|
|
|
9938
9992
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
9939
|
-
this.eventEmitter.emit(ON_TRACK
|
|
9993
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
9940
9994
|
});
|
|
9941
9995
|
|
|
9942
9996
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -9951,7 +10005,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9951
10005
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
9952
10006
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
9953
10007
|
|
|
9954
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
10008
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
9955
10009
|
});
|
|
9956
10010
|
|
|
9957
10011
|
// Used when upgrading directly in screenshare mode
|
|
@@ -9960,7 +10014,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9960
10014
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
9961
10015
|
const callSession = this.callSessions[sipSessionId];
|
|
9962
10016
|
|
|
9963
|
-
logger$
|
|
10017
|
+
logger$8.info('Updrading directly in screensharing mode', {
|
|
9964
10018
|
sipSessionId,
|
|
9965
10019
|
tracks: localStream ? localStream.getTracks() : null,
|
|
9966
10020
|
});
|
|
@@ -10090,6 +10144,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10090
10144
|
const number = identity ? identity.uri._normal.user : null;
|
|
10091
10145
|
const { state } = sipSession || {};
|
|
10092
10146
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10147
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10093
10148
|
|
|
10094
10149
|
const callSession = new CallSession({
|
|
10095
10150
|
callId: fromSession && fromSession.callId,
|
|
@@ -10097,6 +10152,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10097
10152
|
sipStatus: state,
|
|
10098
10153
|
displayName: identity ? identity.displayName || number : number,
|
|
10099
10154
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10155
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10156
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10100
10157
|
answered: state === sessionState.SessionState.Established,
|
|
10101
10158
|
paused: this.client.isCallHeld(sipSession),
|
|
10102
10159
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10107,6 +10164,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10107
10164
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10108
10165
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10109
10166
|
recordingPaused: false, // @TODO
|
|
10167
|
+
sipSession,
|
|
10110
10168
|
...extra,
|
|
10111
10169
|
});
|
|
10112
10170
|
|
|
@@ -10135,11 +10193,12 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10135
10193
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10136
10194
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10137
10195
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10196
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10138
10197
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10139
10198
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10140
10199
|
ON_MESSAGE: ON_MESSAGE,
|
|
10141
|
-
ON_REINVITE: ON_REINVITE
|
|
10142
|
-
ON_TRACK: ON_TRACK
|
|
10200
|
+
ON_REINVITE: ON_REINVITE,
|
|
10201
|
+
ON_TRACK: ON_TRACK,
|
|
10143
10202
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10144
10203
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10145
10204
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10154,19 +10213,27 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10154
10213
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10155
10214
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10156
10215
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10157
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS
|
|
10216
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10158
10217
|
ON_CHAT: ON_CHAT,
|
|
10159
10218
|
ON_SIGNAL: ON_SIGNAL,
|
|
10160
|
-
ON_DISCONNECTED: ON_DISCONNECTED
|
|
10219
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10161
10220
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10162
10221
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10163
|
-
events: events
|
|
10222
|
+
events: events,
|
|
10164
10223
|
'default': WebRTCPhone
|
|
10165
10224
|
});
|
|
10166
10225
|
|
|
10226
|
+
/* */
|
|
10227
|
+
class SFUNotAvailableError extends Error {
|
|
10228
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10229
|
+
super(message);
|
|
10230
|
+
this.name = 'SFUNotAvailableError';
|
|
10231
|
+
}
|
|
10232
|
+
}
|
|
10233
|
+
|
|
10167
10234
|
//
|
|
10168
10235
|
|
|
10169
|
-
const logger$
|
|
10236
|
+
const logger$7 = IssueReporter$1.loggerFor('simple-phone');
|
|
10170
10237
|
const sipLogger = IssueReporter$1.loggerFor('sip.js');
|
|
10171
10238
|
const protocolLogger = IssueReporter$1.loggerFor('sip');
|
|
10172
10239
|
|
|
@@ -10273,7 +10340,7 @@ class Phone extends Emitter {
|
|
|
10273
10340
|
async disconnect() {
|
|
10274
10341
|
if (this.phone) {
|
|
10275
10342
|
if (this.phone.hasAnActiveCall()) {
|
|
10276
|
-
logger$
|
|
10343
|
+
logger$7.info('hangup call on disconnect');
|
|
10277
10344
|
// $FlowFixMe
|
|
10278
10345
|
await this.phone.hangup();
|
|
10279
10346
|
}
|
|
@@ -10296,13 +10363,13 @@ class Phone extends Emitter {
|
|
|
10296
10363
|
}
|
|
10297
10364
|
|
|
10298
10365
|
async hangup(callSession ) {
|
|
10299
|
-
logger$
|
|
10366
|
+
logger$7.info('hangup via simple phone', { callId: callSession.getId() });
|
|
10300
10367
|
|
|
10301
10368
|
return this.phone && this.phone.hangup(callSession);
|
|
10302
10369
|
}
|
|
10303
10370
|
|
|
10304
10371
|
async accept(callSession , cameraEnabled ) {
|
|
10305
|
-
logger$
|
|
10372
|
+
logger$7.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
|
|
10306
10373
|
|
|
10307
10374
|
return this.phone && this.phone.accept(callSession, cameraEnabled);
|
|
10308
10375
|
}
|
|
@@ -10341,7 +10408,7 @@ class Phone extends Emitter {
|
|
|
10341
10408
|
muteViaAPI(callSession ) {
|
|
10342
10409
|
if (callSession && callSession.callId) {
|
|
10343
10410
|
Wazo.getApiClient().calld.mute(callSession.callId).catch(e => {
|
|
10344
|
-
logger$
|
|
10411
|
+
logger$7.error('Mute via API, error', e);
|
|
10345
10412
|
});
|
|
10346
10413
|
}
|
|
10347
10414
|
}
|
|
@@ -10349,7 +10416,7 @@ class Phone extends Emitter {
|
|
|
10349
10416
|
unmuteViaAPI(callSession ) {
|
|
10350
10417
|
if (callSession && callSession.callId) {
|
|
10351
10418
|
Wazo.getApiClient().calld.unmute(callSession.callId).catch(e => {
|
|
10352
|
-
logger$
|
|
10419
|
+
logger$7.error('Unmute via API, error', e);
|
|
10353
10420
|
});
|
|
10354
10421
|
}
|
|
10355
10422
|
}
|
|
@@ -10457,7 +10524,7 @@ class Phone extends Emitter {
|
|
|
10457
10524
|
|
|
10458
10525
|
// @Deprecated
|
|
10459
10526
|
getLocalMediaStream(callSession ) {
|
|
10460
|
-
logger$
|
|
10527
|
+
logger$7.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
|
|
10461
10528
|
|
|
10462
10529
|
return this.phone && this.phone.getLocalStream(callSession);
|
|
10463
10530
|
}
|
|
@@ -10480,20 +10547,20 @@ class Phone extends Emitter {
|
|
|
10480
10547
|
|
|
10481
10548
|
// @Deprecated
|
|
10482
10549
|
getRemoteStreamForCall(callSession ) {
|
|
10483
|
-
logger$
|
|
10550
|
+
logger$7.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
|
|
10484
10551
|
return this.getRemoteStream(callSession);
|
|
10485
10552
|
}
|
|
10486
10553
|
|
|
10487
10554
|
// Returns remote streams directly from the peerConnection
|
|
10488
10555
|
// @Deprecated
|
|
10489
10556
|
getRemoteStreamsForCall(callSession ) {
|
|
10490
|
-
logger$
|
|
10557
|
+
logger$7.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
|
|
10491
10558
|
return this.getLocalStream(callSession);
|
|
10492
10559
|
}
|
|
10493
10560
|
|
|
10494
10561
|
// @Deprecated
|
|
10495
10562
|
getRemoteVideoStreamForCall(callSession ) {
|
|
10496
|
-
logger$
|
|
10563
|
+
logger$7.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
|
|
10497
10564
|
|
|
10498
10565
|
return this.getRemoteVideoStream(callSession);
|
|
10499
10566
|
}
|
|
@@ -10548,13 +10615,13 @@ class Phone extends Emitter {
|
|
|
10548
10615
|
|
|
10549
10616
|
checkSfu() {
|
|
10550
10617
|
if (!this.hasSfu()) {
|
|
10551
|
-
throw new
|
|
10618
|
+
throw new SFUNotAvailableError();
|
|
10552
10619
|
}
|
|
10553
10620
|
}
|
|
10554
10621
|
|
|
10555
10622
|
_transferEvents() {
|
|
10556
10623
|
this.unbind();
|
|
10557
|
-
[...events, ...transportEvents].forEach(event => {
|
|
10624
|
+
[...events$1, ...transportEvents].forEach(event => {
|
|
10558
10625
|
this.client.on(event, (...args) =>
|
|
10559
10626
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
10560
10627
|
});
|
|
@@ -10576,7 +10643,7 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
10576
10643
|
|
|
10577
10644
|
//
|
|
10578
10645
|
|
|
10579
|
-
const SOCKET_EVENTS = {
|
|
10646
|
+
const SOCKET_EVENTS$1 = {
|
|
10580
10647
|
ON_OPEN: 'onopen',
|
|
10581
10648
|
ON_MESSAGE: 'onmessage',
|
|
10582
10649
|
ON_ERROR: 'onerror',
|
|
@@ -10729,16 +10796,16 @@ class WebSocketClient extends Emitter {
|
|
|
10729
10796
|
|
|
10730
10797
|
this.socket.onopen = () => {
|
|
10731
10798
|
logger$6.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
10732
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
10799
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
|
|
10733
10800
|
};
|
|
10734
10801
|
|
|
10735
10802
|
this.socket.onerror = event => {
|
|
10736
10803
|
logger$6.error('on Wazo WS error', event.target);
|
|
10737
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
10804
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
|
|
10738
10805
|
};
|
|
10739
10806
|
|
|
10740
10807
|
this.socket.onmessage = (event ) => {
|
|
10741
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
10808
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
|
|
10742
10809
|
|
|
10743
10810
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
10744
10811
|
let { name } = message;
|
|
@@ -10771,11 +10838,11 @@ class WebSocketClient extends Emitter {
|
|
|
10771
10838
|
token: this.token,
|
|
10772
10839
|
});
|
|
10773
10840
|
this.initialized = false;
|
|
10774
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
10841
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
|
|
10775
10842
|
|
|
10776
10843
|
switch (event.code) {
|
|
10777
10844
|
case 4002:
|
|
10778
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
10845
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
|
|
10779
10846
|
break;
|
|
10780
10847
|
}
|
|
10781
10848
|
};
|
|
@@ -10891,7 +10958,7 @@ class WebSocketClient extends Emitter {
|
|
|
10891
10958
|
break;
|
|
10892
10959
|
case 'start':
|
|
10893
10960
|
this.initialized = true;
|
|
10894
|
-
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
10961
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
|
|
10895
10962
|
break;
|
|
10896
10963
|
default:
|
|
10897
10964
|
this.eventEmitter.emit('message', message);
|
|
@@ -10938,7 +11005,7 @@ class WebSocketClient extends Emitter {
|
|
|
10938
11005
|
logger$6.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
10939
11006
|
|
|
10940
11007
|
this.close();
|
|
10941
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11008
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
10942
11009
|
|
|
10943
11010
|
if (this.onHeartBeatTimeout) {
|
|
10944
11011
|
this.onHeartBeatTimeout();
|
|
@@ -11018,7 +11085,7 @@ WebSocketClient.eventLists = [
|
|
|
11018
11085
|
|
|
11019
11086
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
11020
11087
|
__proto__: null,
|
|
11021
|
-
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
11088
|
+
SOCKET_EVENTS: SOCKET_EVENTS$1,
|
|
11022
11089
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
11023
11090
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
11024
11091
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -11091,10 +11158,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11091
11158
|
|
|
11092
11159
|
//
|
|
11093
11160
|
|
|
11094
|
-
const { SOCKET_EVENTS
|
|
11095
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS
|
|
11161
|
+
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11162
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
11096
11163
|
|
|
11097
|
-
const logger$
|
|
11164
|
+
const logger$5 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
11098
11165
|
|
|
11099
11166
|
class Websocket extends Emitter {
|
|
11100
11167
|
|
|
@@ -11108,9 +11175,9 @@ class Websocket extends Emitter {
|
|
|
11108
11175
|
// $FlowFixMe
|
|
11109
11176
|
this[key] = OTHER_EVENTS[key];
|
|
11110
11177
|
});
|
|
11111
|
-
Object.keys(SOCKET_EVENTS
|
|
11178
|
+
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
11112
11179
|
// $FlowFixMe
|
|
11113
|
-
this[key] = SOCKET_EVENTS
|
|
11180
|
+
this[key] = SOCKET_EVENTS[key];
|
|
11114
11181
|
});
|
|
11115
11182
|
this.eventLists = WebSocketClient.eventLists;
|
|
11116
11183
|
|
|
@@ -11118,7 +11185,7 @@ class Websocket extends Emitter {
|
|
|
11118
11185
|
}
|
|
11119
11186
|
|
|
11120
11187
|
open(host , session ) {
|
|
11121
|
-
logger$
|
|
11188
|
+
logger$5.info('open simple WebSocket', { host, token: session.token });
|
|
11122
11189
|
this.ws = new WebSocketClient(
|
|
11123
11190
|
{
|
|
11124
11191
|
host,
|
|
@@ -11146,7 +11213,7 @@ class Websocket extends Emitter {
|
|
|
11146
11213
|
}
|
|
11147
11214
|
|
|
11148
11215
|
updateToken(token ) {
|
|
11149
|
-
logger$
|
|
11216
|
+
logger$5.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
11150
11217
|
|
|
11151
11218
|
if (!this.ws) {
|
|
11152
11219
|
return;
|
|
@@ -11174,7 +11241,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11174
11241
|
|
|
11175
11242
|
//
|
|
11176
11243
|
|
|
11177
|
-
const logger$
|
|
11244
|
+
const logger$4 = IssueReporter$1.loggerFor('room');
|
|
11178
11245
|
|
|
11179
11246
|
class Participant extends Emitter {
|
|
11180
11247
|
|
|
@@ -11296,7 +11363,7 @@ class Participant extends Emitter {
|
|
|
11296
11363
|
}
|
|
11297
11364
|
|
|
11298
11365
|
onTalking(isTalking ) {
|
|
11299
|
-
logger$
|
|
11366
|
+
logger$4.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
11300
11367
|
this.isTalking = isTalking;
|
|
11301
11368
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
11302
11369
|
// directly from asterisk, there's no need to do so
|
|
@@ -11399,7 +11466,7 @@ class Participant extends Emitter {
|
|
|
11399
11466
|
}
|
|
11400
11467
|
|
|
11401
11468
|
updateStatus(status , broadcast = true) {
|
|
11402
|
-
logger$
|
|
11469
|
+
logger$4.info('updating participant status', { name: this.name, status });
|
|
11403
11470
|
|
|
11404
11471
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
11405
11472
|
if (status.audioMuted) {
|
|
@@ -11447,7 +11514,7 @@ class Participant extends Emitter {
|
|
|
11447
11514
|
|
|
11448
11515
|
broadcastStatus(inboundStatus = null) {
|
|
11449
11516
|
const status = inboundStatus || this.getStatus();
|
|
11450
|
-
logger$
|
|
11517
|
+
logger$4.info('broadcasting participant status', { callId: this.callId, status });
|
|
11451
11518
|
|
|
11452
11519
|
this.room.sendSignal({
|
|
11453
11520
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|
|
@@ -11483,9 +11550,9 @@ class LocalParticipant extends Participant {
|
|
|
11483
11550
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
11484
11551
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
11485
11552
|
|
|
11486
|
-
const logger$
|
|
11553
|
+
const logger$3 = IssueReporter$1.loggerFor('sdk-room');
|
|
11487
11554
|
|
|
11488
|
-
class Room extends Emitter {
|
|
11555
|
+
class Room$1 extends Emitter {
|
|
11489
11556
|
|
|
11490
11557
|
|
|
11491
11558
|
|
|
@@ -11543,7 +11610,7 @@ class Room extends Emitter {
|
|
|
11543
11610
|
extra = {},
|
|
11544
11611
|
) {
|
|
11545
11612
|
super();
|
|
11546
|
-
logger$
|
|
11613
|
+
logger$3.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
11547
11614
|
|
|
11548
11615
|
// Represents the room callSession
|
|
11549
11616
|
this.callSession = callSession;
|
|
@@ -11609,7 +11676,7 @@ class Room extends Emitter {
|
|
|
11609
11676
|
* @returns {Promise<Room>}
|
|
11610
11677
|
*/
|
|
11611
11678
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
11612
|
-
logger$
|
|
11679
|
+
logger$3.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
11613
11680
|
|
|
11614
11681
|
if (!room) {
|
|
11615
11682
|
await Wazo.Phone.connect();
|
|
@@ -11622,7 +11689,7 @@ class Room extends Emitter {
|
|
|
11622
11689
|
|
|
11623
11690
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
11624
11691
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
11625
|
-
logger$
|
|
11692
|
+
logger$3.info('room call received via WS', { callId: data.call_id });
|
|
11626
11693
|
if (room) {
|
|
11627
11694
|
room.setCallId(data.call_id);
|
|
11628
11695
|
}
|
|
@@ -11630,7 +11697,7 @@ class Room extends Emitter {
|
|
|
11630
11697
|
|
|
11631
11698
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
11632
11699
|
// eslint-disable-next-line no-param-reassign
|
|
11633
|
-
room = new Room(callSession, extension, null, null, extra);
|
|
11700
|
+
room = new Room$1(callSession, extension, null, null, extra);
|
|
11634
11701
|
|
|
11635
11702
|
// Wait for the call to be accepted
|
|
11636
11703
|
await new Promise((resolve, reject) => {
|
|
@@ -11651,7 +11718,7 @@ class Room extends Emitter {
|
|
|
11651
11718
|
// Retrieve conference
|
|
11652
11719
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
11653
11720
|
|
|
11654
|
-
logger$
|
|
11721
|
+
logger$3.info('connected to room', {
|
|
11655
11722
|
sourceId: conference ? conference.sourceId : null,
|
|
11656
11723
|
name: conference ? conference.name : null,
|
|
11657
11724
|
});
|
|
@@ -11661,7 +11728,7 @@ class Room extends Emitter {
|
|
|
11661
11728
|
room.setName(conference.name);
|
|
11662
11729
|
}
|
|
11663
11730
|
} else if (meeting) {
|
|
11664
|
-
logger$
|
|
11731
|
+
logger$3.info('Already connected to meeting', {
|
|
11665
11732
|
uuid: meeting.uuid,
|
|
11666
11733
|
name: meeting.name,
|
|
11667
11734
|
});
|
|
@@ -11674,13 +11741,13 @@ class Room extends Emitter {
|
|
|
11674
11741
|
}
|
|
11675
11742
|
|
|
11676
11743
|
static disconnect() {
|
|
11677
|
-
logger$
|
|
11744
|
+
logger$3.info('static disconnection to room');
|
|
11678
11745
|
|
|
11679
11746
|
Wazo.Phone.disconnect();
|
|
11680
11747
|
}
|
|
11681
11748
|
|
|
11682
11749
|
async disconnect() {
|
|
11683
|
-
logger$
|
|
11750
|
+
logger$3.info('disconnection to room called');
|
|
11684
11751
|
|
|
11685
11752
|
await Wazo.Phone.hangup(this.callSession);
|
|
11686
11753
|
this.callSession = null;
|
|
@@ -11700,19 +11767,19 @@ class Room extends Emitter {
|
|
|
11700
11767
|
}
|
|
11701
11768
|
|
|
11702
11769
|
setSourceId(sourceId ) {
|
|
11703
|
-
logger$
|
|
11770
|
+
logger$3.info('set room source id', { sourceId });
|
|
11704
11771
|
|
|
11705
11772
|
this.sourceId = sourceId;
|
|
11706
11773
|
}
|
|
11707
11774
|
|
|
11708
11775
|
setMeetingUuid(meetingUuid ) {
|
|
11709
|
-
logger$
|
|
11776
|
+
logger$3.info('set meeting uuid', { meetingUuid });
|
|
11710
11777
|
|
|
11711
11778
|
this.meetingUuid = meetingUuid;
|
|
11712
11779
|
}
|
|
11713
11780
|
|
|
11714
11781
|
setCallId(callId ) {
|
|
11715
|
-
logger$
|
|
11782
|
+
logger$3.info('set room call id', { callId });
|
|
11716
11783
|
|
|
11717
11784
|
if (callId) {
|
|
11718
11785
|
this.callId = callId;
|
|
@@ -11720,7 +11787,7 @@ class Room extends Emitter {
|
|
|
11720
11787
|
}
|
|
11721
11788
|
|
|
11722
11789
|
setName(name ) {
|
|
11723
|
-
logger$
|
|
11790
|
+
logger$3.info('set room name', { name });
|
|
11724
11791
|
|
|
11725
11792
|
this.name = name;
|
|
11726
11793
|
}
|
|
@@ -11739,7 +11806,7 @@ class Room extends Emitter {
|
|
|
11739
11806
|
}
|
|
11740
11807
|
|
|
11741
11808
|
async startScreenSharing(constraints ) {
|
|
11742
|
-
logger$
|
|
11809
|
+
logger$3.info('start room screen sharing', { constraints });
|
|
11743
11810
|
|
|
11744
11811
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
11745
11812
|
if (!screensharingStream) {
|
|
@@ -11753,7 +11820,7 @@ class Room extends Emitter {
|
|
|
11753
11820
|
}
|
|
11754
11821
|
|
|
11755
11822
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
11756
|
-
logger$
|
|
11823
|
+
logger$3.info('stop room screen sharing');
|
|
11757
11824
|
|
|
11758
11825
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
11759
11826
|
|
|
@@ -11765,7 +11832,7 @@ class Room extends Emitter {
|
|
|
11765
11832
|
}
|
|
11766
11833
|
|
|
11767
11834
|
turnCameraOff() {
|
|
11768
|
-
logger$
|
|
11835
|
+
logger$3.info('turn room camera off');
|
|
11769
11836
|
|
|
11770
11837
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
11771
11838
|
|
|
@@ -11775,7 +11842,7 @@ class Room extends Emitter {
|
|
|
11775
11842
|
}
|
|
11776
11843
|
|
|
11777
11844
|
turnCameraOn() {
|
|
11778
|
-
logger$
|
|
11845
|
+
logger$3.info('turn room camera on');
|
|
11779
11846
|
|
|
11780
11847
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
11781
11848
|
|
|
@@ -11785,7 +11852,7 @@ class Room extends Emitter {
|
|
|
11785
11852
|
}
|
|
11786
11853
|
|
|
11787
11854
|
mute() {
|
|
11788
|
-
logger$
|
|
11855
|
+
logger$3.info('mute room');
|
|
11789
11856
|
|
|
11790
11857
|
Wazo.Phone.mute(this.callSession);
|
|
11791
11858
|
|
|
@@ -11793,7 +11860,7 @@ class Room extends Emitter {
|
|
|
11793
11860
|
}
|
|
11794
11861
|
|
|
11795
11862
|
unmute() {
|
|
11796
|
-
logger$
|
|
11863
|
+
logger$3.info('unmute room');
|
|
11797
11864
|
|
|
11798
11865
|
Wazo.Phone.unmute(this.callSession);
|
|
11799
11866
|
|
|
@@ -11813,7 +11880,7 @@ class Room extends Emitter {
|
|
|
11813
11880
|
}
|
|
11814
11881
|
|
|
11815
11882
|
hold() {
|
|
11816
|
-
logger$
|
|
11883
|
+
logger$3.info('hold room');
|
|
11817
11884
|
|
|
11818
11885
|
Wazo.Phone.hold(this.callSession, true);
|
|
11819
11886
|
|
|
@@ -11823,7 +11890,7 @@ class Room extends Emitter {
|
|
|
11823
11890
|
}
|
|
11824
11891
|
|
|
11825
11892
|
async resume() {
|
|
11826
|
-
logger$
|
|
11893
|
+
logger$3.info('resume room');
|
|
11827
11894
|
|
|
11828
11895
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
11829
11896
|
|
|
@@ -11851,13 +11918,13 @@ class Room extends Emitter {
|
|
|
11851
11918
|
}
|
|
11852
11919
|
|
|
11853
11920
|
sendDTMF(tone ) {
|
|
11854
|
-
logger$
|
|
11921
|
+
logger$3.info('send room DTMF', { tone });
|
|
11855
11922
|
|
|
11856
11923
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
11857
11924
|
}
|
|
11858
11925
|
|
|
11859
11926
|
async sendReinvite(newConstraints = null) {
|
|
11860
|
-
logger$
|
|
11927
|
+
logger$3.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
11861
11928
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
11862
11929
|
|
|
11863
11930
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -11916,7 +11983,7 @@ class Room extends Emitter {
|
|
|
11916
11983
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
11917
11984
|
|
|
11918
11985
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
11919
|
-
logger$
|
|
11986
|
+
logger$3.info('on room audio stream');
|
|
11920
11987
|
|
|
11921
11988
|
this.audioStream = stream;
|
|
11922
11989
|
if (!this.roomAudioElement) {
|
|
@@ -11929,7 +11996,7 @@ class Room extends Emitter {
|
|
|
11929
11996
|
});
|
|
11930
11997
|
|
|
11931
11998
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
11932
|
-
logger$
|
|
11999
|
+
logger$3.info('on room video stream', { streamId });
|
|
11933
12000
|
|
|
11934
12001
|
this._mapMsid(sipSession.body.body);
|
|
11935
12002
|
|
|
@@ -11944,7 +12011,7 @@ class Room extends Emitter {
|
|
|
11944
12011
|
});
|
|
11945
12012
|
|
|
11946
12013
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
11947
|
-
logger$
|
|
12014
|
+
logger$3.info('on room remove stream');
|
|
11948
12015
|
|
|
11949
12016
|
const participant = this.participants.find(someParticipant =>
|
|
11950
12017
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -12076,7 +12143,7 @@ class Room extends Emitter {
|
|
|
12076
12143
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
12077
12144
|
if (requester) {
|
|
12078
12145
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
12079
|
-
logger$
|
|
12146
|
+
logger$3.info('trigger room requester status', { origin });
|
|
12080
12147
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
12081
12148
|
}
|
|
12082
12149
|
break;
|
|
@@ -12107,24 +12174,24 @@ class Room extends Emitter {
|
|
|
12107
12174
|
|
|
12108
12175
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
12109
12176
|
if (participant.user_uuid === session.uuid) {
|
|
12110
|
-
logger$
|
|
12177
|
+
logger$3.info('room current user joined');
|
|
12111
12178
|
|
|
12112
12179
|
// Retrieve participants via an API calls
|
|
12113
12180
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
12114
12181
|
let response;
|
|
12115
12182
|
try {
|
|
12116
12183
|
if (this.meetingUuid) {
|
|
12117
|
-
logger$
|
|
12184
|
+
logger$3.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
12118
12185
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
12119
12186
|
} else {
|
|
12120
|
-
logger$
|
|
12187
|
+
logger$3.info('fetching conference participants', { conferenceId });
|
|
12121
12188
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
12122
12189
|
}
|
|
12123
12190
|
} catch (e) {
|
|
12124
|
-
logger$
|
|
12191
|
+
logger$3.error('room participants fetching, error', e);
|
|
12125
12192
|
}
|
|
12126
12193
|
if (response) {
|
|
12127
|
-
logger$
|
|
12194
|
+
logger$3.info('conference participants fetched', { nb: response.items.length });
|
|
12128
12195
|
participants = response.items.map(item => {
|
|
12129
12196
|
const isMe = item.call_id === this.callId;
|
|
12130
12197
|
|
|
@@ -12151,7 +12218,7 @@ class Room extends Emitter {
|
|
|
12151
12218
|
? new Wazo.RemoteParticipant(this, participant)
|
|
12152
12219
|
: null;
|
|
12153
12220
|
|
|
12154
|
-
logger$
|
|
12221
|
+
logger$3.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
12155
12222
|
|
|
12156
12223
|
if (remoteParticipant) {
|
|
12157
12224
|
this.participants.push(remoteParticipant);
|
|
@@ -12316,12 +12383,12 @@ class Room extends Emitter {
|
|
|
12316
12383
|
|
|
12317
12384
|
//
|
|
12318
12385
|
|
|
12319
|
-
const logger$
|
|
12386
|
+
const logger$2 = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
12320
12387
|
|
|
12321
|
-
class SipRoom extends Room {
|
|
12388
|
+
class SipRoom extends Room$1 {
|
|
12322
12389
|
|
|
12323
12390
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
12324
|
-
logger$
|
|
12391
|
+
logger$2.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
12325
12392
|
|
|
12326
12393
|
if (!room) {
|
|
12327
12394
|
await Wazo.Phone.connect();
|
|
@@ -12337,7 +12404,7 @@ class SipRoom extends Room {
|
|
|
12337
12404
|
room.setCallId(room.callSession.call.id);
|
|
12338
12405
|
}
|
|
12339
12406
|
|
|
12340
|
-
logger$
|
|
12407
|
+
logger$2.info('connected to room', {
|
|
12341
12408
|
extension: room.extension,
|
|
12342
12409
|
});
|
|
12343
12410
|
|
|
@@ -12345,7 +12412,7 @@ class SipRoom extends Room {
|
|
|
12345
12412
|
}
|
|
12346
12413
|
|
|
12347
12414
|
mute() {
|
|
12348
|
-
logger$
|
|
12415
|
+
logger$2.info('mute sip room');
|
|
12349
12416
|
|
|
12350
12417
|
Wazo.Phone.mute(this.callSession, false);
|
|
12351
12418
|
|
|
@@ -12353,7 +12420,7 @@ class SipRoom extends Room {
|
|
|
12353
12420
|
}
|
|
12354
12421
|
|
|
12355
12422
|
unmute() {
|
|
12356
|
-
logger$
|
|
12423
|
+
logger$2.info('unmute sip room');
|
|
12357
12424
|
|
|
12358
12425
|
Wazo.Phone.unmute(this.callSession, false);
|
|
12359
12426
|
|
|
@@ -12620,7 +12687,7 @@ class NotificationOptions {
|
|
|
12620
12687
|
|
|
12621
12688
|
|
|
12622
12689
|
// Represents a conference room, like `9000`.
|
|
12623
|
-
class Room
|
|
12690
|
+
class Room {
|
|
12624
12691
|
|
|
12625
12692
|
|
|
12626
12693
|
|
|
@@ -12641,7 +12708,7 @@ class Room$1 {
|
|
|
12641
12708
|
}
|
|
12642
12709
|
|
|
12643
12710
|
connect(callSession ) {
|
|
12644
|
-
return new Room
|
|
12711
|
+
return new Room({ ...this, connectedCallSession: callSession });
|
|
12645
12712
|
}
|
|
12646
12713
|
|
|
12647
12714
|
has(callSession ) {
|
|
@@ -12650,7 +12717,7 @@ class Room$1 {
|
|
|
12650
12717
|
|
|
12651
12718
|
addParticipant(uuid , extension , talking = null) {
|
|
12652
12719
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
12653
|
-
return new Room
|
|
12720
|
+
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12654
12721
|
}
|
|
12655
12722
|
|
|
12656
12723
|
return this;
|
|
@@ -12669,7 +12736,7 @@ class Room$1 {
|
|
|
12669
12736
|
updatedParticipants.push(participant);
|
|
12670
12737
|
}
|
|
12671
12738
|
|
|
12672
|
-
return new Room
|
|
12739
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12673
12740
|
}
|
|
12674
12741
|
|
|
12675
12742
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -12685,7 +12752,7 @@ class Room$1 {
|
|
|
12685
12752
|
updatedParticipants.push(participant);
|
|
12686
12753
|
}
|
|
12687
12754
|
|
|
12688
|
-
return new Room
|
|
12755
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12689
12756
|
}
|
|
12690
12757
|
|
|
12691
12758
|
hasCallWithId(id ) {
|
|
@@ -12693,18 +12760,18 @@ class Room$1 {
|
|
|
12693
12760
|
}
|
|
12694
12761
|
|
|
12695
12762
|
disconnect() {
|
|
12696
|
-
return new Room
|
|
12763
|
+
return new Room({ ...this, connectedCallSession: null });
|
|
12697
12764
|
}
|
|
12698
12765
|
|
|
12699
12766
|
removeParticipantWithUUID(uuid ) {
|
|
12700
|
-
return new Room
|
|
12767
|
+
return new Room({
|
|
12701
12768
|
...this,
|
|
12702
12769
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
12703
12770
|
});
|
|
12704
12771
|
}
|
|
12705
12772
|
|
|
12706
12773
|
removeParticipantWithExtension(extension ) {
|
|
12707
|
-
return new Room
|
|
12774
|
+
return new Room({
|
|
12708
12775
|
...this,
|
|
12709
12776
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
12710
12777
|
});
|
|
@@ -12715,7 +12782,7 @@ class Room$1 {
|
|
|
12715
12782
|
}
|
|
12716
12783
|
|
|
12717
12784
|
static newFrom(room ) {
|
|
12718
|
-
return newFrom(room, Room
|
|
12785
|
+
return newFrom(room, Room);
|
|
12719
12786
|
}
|
|
12720
12787
|
}
|
|
12721
12788
|
|
|
@@ -13022,11 +13089,11 @@ var wazoWebsocket = {
|
|
|
13022
13089
|
resolve();
|
|
13023
13090
|
};
|
|
13024
13091
|
|
|
13025
|
-
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
13092
|
+
client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
|
|
13026
13093
|
handleError(`Connection error : ${error}`);
|
|
13027
13094
|
});
|
|
13028
13095
|
|
|
13029
|
-
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
13096
|
+
client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
|
|
13030
13097
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
13031
13098
|
client.setOnHeartbeatTimeout(() => {
|
|
13032
13099
|
handleError('No response to heartbeat');
|
|
@@ -13127,7 +13194,7 @@ var webrtc = {
|
|
|
13127
13194
|
}),
|
|
13128
13195
|
};
|
|
13129
13196
|
|
|
13130
|
-
const parseCandidate
|
|
13197
|
+
const parseCandidate = line => {
|
|
13131
13198
|
let parts;
|
|
13132
13199
|
// Parse both variants.
|
|
13133
13200
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -13218,7 +13285,7 @@ var SymmetricNat = {
|
|
|
13218
13285
|
}
|
|
13219
13286
|
|
|
13220
13287
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
13221
|
-
const cand = parseCandidate
|
|
13288
|
+
const cand = parseCandidate(e.candidate.candidate);
|
|
13222
13289
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
13223
13290
|
candidates[cand.relatedPort].push(cand.port);
|
|
13224
13291
|
} else if (!e.candidate) {
|
|
@@ -13286,7 +13353,7 @@ var iceIpv4 = {
|
|
|
13286
13353
|
const rawCandidate = e.candidate.candidate;
|
|
13287
13354
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
13288
13355
|
hasSrflxOrRelay = true;
|
|
13289
|
-
const candidate = parseCandidate
|
|
13356
|
+
const candidate = parseCandidate(e.candidate.candidate);
|
|
13290
13357
|
ips.push(candidate.ip);
|
|
13291
13358
|
}
|
|
13292
13359
|
} else if (!e.candidate) {
|
|
@@ -13323,7 +13390,7 @@ var checks = [
|
|
|
13323
13390
|
|
|
13324
13391
|
//
|
|
13325
13392
|
|
|
13326
|
-
const logger$
|
|
13393
|
+
const logger$1 = IssueReporter$1.loggerFor('engine-check');
|
|
13327
13394
|
|
|
13328
13395
|
class Checker {
|
|
13329
13396
|
|
|
@@ -13341,28 +13408,28 @@ class Checker {
|
|
|
13341
13408
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
13342
13409
|
await this._addEngineVersion();
|
|
13343
13410
|
|
|
13344
|
-
logger$
|
|
13411
|
+
logger$1.info('Engine check starting');
|
|
13345
13412
|
|
|
13346
13413
|
for (let i = 0; i < this.checks.length; i++) {
|
|
13347
13414
|
const { name, check } = this.checks[i];
|
|
13348
13415
|
|
|
13349
|
-
logger$
|
|
13416
|
+
logger$1.info(`Checking ${name} ...`);
|
|
13350
13417
|
|
|
13351
13418
|
onCheckBegin(name);
|
|
13352
13419
|
try {
|
|
13353
13420
|
// eslint-disable-next-line no-await-in-loop
|
|
13354
13421
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
13355
|
-
logger$
|
|
13422
|
+
logger$1.info(`Checking ${name} success.`, { result });
|
|
13356
13423
|
|
|
13357
13424
|
onCheckResult(name, result);
|
|
13358
13425
|
} catch (e) {
|
|
13359
|
-
logger$
|
|
13426
|
+
logger$1.info(`Checking ${name} failure`, { message: e.message });
|
|
13360
13427
|
|
|
13361
13428
|
onCheckResult(name, e);
|
|
13362
13429
|
}
|
|
13363
13430
|
}
|
|
13364
13431
|
|
|
13365
|
-
logger$
|
|
13432
|
+
logger$1.info('Engine check done.');
|
|
13366
13433
|
}
|
|
13367
13434
|
|
|
13368
13435
|
addCheck(check ) {
|
|
@@ -13386,7 +13453,7 @@ const Wazo = {
|
|
|
13386
13453
|
Auth: Auth$1,
|
|
13387
13454
|
Phone: Phone$1,
|
|
13388
13455
|
Websocket: Websocket$1,
|
|
13389
|
-
Room,
|
|
13456
|
+
Room: Room$1,
|
|
13390
13457
|
SipRoom,
|
|
13391
13458
|
RemoteParticipant,
|
|
13392
13459
|
LocalParticipant,
|
|
@@ -13419,7 +13486,7 @@ const Wazo = {
|
|
|
13419
13486
|
Session,
|
|
13420
13487
|
Voicemail,
|
|
13421
13488
|
Relocation,
|
|
13422
|
-
ConferenceRoom: Room
|
|
13489
|
+
ConferenceRoom: Room,
|
|
13423
13490
|
CallSession,
|
|
13424
13491
|
IndirectTransfer,
|
|
13425
13492
|
SwitchboardCall,
|
|
@@ -13444,6 +13511,7 @@ const Wazo = {
|
|
|
13444
13511
|
InvalidSubscription,
|
|
13445
13512
|
InvalidAuthorization,
|
|
13446
13513
|
CanceledCallError,
|
|
13514
|
+
SFUNotAvailableError,
|
|
13447
13515
|
};
|
|
13448
13516
|
|
|
13449
13517
|
if (window) {
|
|
@@ -13458,7 +13526,7 @@ if (global) {
|
|
|
13458
13526
|
class InvalidSubscription extends Error {}
|
|
13459
13527
|
class InvalidAuthorization extends Error {}
|
|
13460
13528
|
|
|
13461
|
-
const logger
|
|
13529
|
+
const logger = IssueReporter$1.loggerFor('simple-auth');
|
|
13462
13530
|
|
|
13463
13531
|
class Auth {
|
|
13464
13532
|
|
|
@@ -13493,7 +13561,7 @@ class Auth {
|
|
|
13493
13561
|
setApiClientId(this.clientId);
|
|
13494
13562
|
setRefreshExpiration(this.expiration);
|
|
13495
13563
|
setOnRefreshToken((token , session ) => {
|
|
13496
|
-
logger
|
|
13564
|
+
logger.info('on refresh token done', { token });
|
|
13497
13565
|
setApiToken(token);
|
|
13498
13566
|
Wazo.Websocket.updateToken(token);
|
|
13499
13567
|
|
|
@@ -13538,7 +13606,7 @@ class Auth {
|
|
|
13538
13606
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
13539
13607
|
return this._onAuthenticated(rawSession);
|
|
13540
13608
|
} catch (e) {
|
|
13541
|
-
logger
|
|
13609
|
+
logger.error('on validate token error', e);
|
|
13542
13610
|
console.warn(e);
|
|
13543
13611
|
return false;
|
|
13544
13612
|
}
|