@wazo/sdk 0.37.24 → 0.37.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -58
- package/dist/wazo-sdk.js +6 -6
- package/esm/__tests__/api-client.test.js +14 -14
- package/esm/__tests__/web-rtc-client.test.js +130 -108
- package/esm/api/agentd.js +1 -1
- package/esm/api/amid.js +2 -2
- package/esm/api/application.js +1 -1
- package/esm/api/auth.js +1 -1
- package/esm/api/call-logd.js +3 -3
- package/esm/api/calld.js +1 -1
- package/esm/api/chatd.js +1 -1
- package/esm/api/confd.js +1 -1
- package/esm/api/ctid-ng.js +4 -4
- package/esm/api/dird.js +3 -3
- package/esm/api/webhookd.js +2 -2
- package/esm/api-client.js +14 -14
- package/esm/checker/Checker.js +155 -133
- package/esm/checker/checks/aor.js +14 -14
- package/esm/checker/checks/api.js +14 -14
- package/esm/checker/checks/index.js +145 -123
- package/esm/checker/checks/wazo-websocket.js +16 -16
- package/esm/checker/checks/webrtc-transport.js +130 -108
- package/esm/checker/checks/webrtc.js +130 -108
- package/esm/domain/AdHocAPIConference.js +14 -14
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/CallSession.js +15 -0
- package/esm/domain/Contact.js +2 -2
- package/esm/domain/Features.js +14 -14
- package/esm/domain/Phone/CTIPhone.js +43 -28
- package/esm/domain/Phone/WebRTCPhone.js +126 -90
- package/esm/domain/SFUNotAvailableError.js +9 -0
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/CallSession.test.js +15 -0
- package/esm/domain/__tests__/Contact.test.js +2 -2
- package/esm/domain/__tests__/IndirectTransfer.test.js +15 -0
- package/esm/domain/__tests__/Room.test.js +15 -0
- package/esm/index.js +415 -346
- package/esm/lib/WazoSessionDescriptionHandler.js +10 -5
- package/esm/service/CallApi.js +14 -14
- package/esm/service/IssueReporter.js +2 -2
- package/esm/service/__tests__/IssueReporter.test.js +2 -2
- package/esm/service/getApiClient.js +14 -14
- package/esm/simple/Auth.js +404 -336
- package/esm/simple/Configuration.js +404 -336
- package/esm/simple/Directory.js +14 -14
- package/esm/simple/Phone.js +404 -336
- package/esm/simple/Websocket.js +18 -18
- package/esm/simple/index.js +408 -340
- package/esm/simple/room/LocalParticipant.js +408 -340
- package/esm/simple/room/Participant.js +408 -340
- package/esm/simple/room/RemoteParticipant.js +408 -340
- package/esm/simple/room/Room.js +409 -341
- package/esm/simple/room/SipRoom.js +408 -340
- package/esm/simple/room/Stream.js +408 -340
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +408 -340
- package/esm/simple/utils.js +408 -340
- package/esm/utils/__tests__/api-requester.test.js +1 -1
- package/esm/utils/api-requester.js +1 -1
- package/esm/web-rtc-client.js +130 -108
- package/esm/websocket-client.js +16 -16
- package/lib/__tests__/api-client.test.js +14 -14
- package/lib/__tests__/web-rtc-client.test.js +130 -108
- package/lib/api/agentd.js +1 -1
- package/lib/api/amid.js +2 -2
- package/lib/api/application.js +1 -1
- package/lib/api/auth.js +1 -1
- package/lib/api/call-logd.js +3 -3
- package/lib/api/calld.js +1 -1
- package/lib/api/chatd.js +1 -1
- package/lib/api/confd.js +1 -1
- package/lib/api/ctid-ng.js +4 -4
- package/lib/api/dird.js +3 -3
- package/lib/api/webhookd.js +2 -2
- package/lib/api-client.js +14 -14
- package/lib/checker/Checker.js +155 -133
- package/lib/checker/checks/aor.js +14 -14
- package/lib/checker/checks/api.js +14 -14
- package/lib/checker/checks/index.js +145 -123
- package/lib/checker/checks/wazo-websocket.js +16 -16
- package/lib/checker/checks/webrtc-transport.js +130 -108
- package/lib/checker/checks/webrtc.js +130 -108
- package/lib/domain/AdHocAPIConference.js +14 -14
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/CallSession.js +15 -0
- package/lib/domain/Contact.js +2 -2
- package/lib/domain/Features.js +14 -14
- package/lib/domain/Phone/CTIPhone.js +43 -28
- package/lib/domain/Phone/WebRTCPhone.js +126 -89
- package/lib/domain/SFUNotAvailableError.js +11 -0
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/CallSession.test.js +15 -0
- package/lib/domain/__tests__/Contact.test.js +2 -2
- package/lib/domain/__tests__/IndirectTransfer.test.js +15 -0
- package/lib/domain/__tests__/Room.test.js +15 -0
- package/lib/index.js +415 -346
- package/lib/lib/WazoSessionDescriptionHandler.js +10 -5
- package/lib/service/CallApi.js +14 -14
- package/lib/service/IssueReporter.js +2 -2
- package/lib/service/__tests__/IssueReporter.test.js +2 -2
- package/lib/service/getApiClient.js +14 -14
- package/lib/simple/Auth.js +404 -336
- package/lib/simple/Configuration.js +404 -336
- package/lib/simple/Directory.js +14 -14
- package/lib/simple/Phone.js +404 -336
- package/lib/simple/Websocket.js +18 -18
- package/lib/simple/index.js +408 -340
- package/lib/simple/room/LocalParticipant.js +408 -340
- package/lib/simple/room/Participant.js +408 -340
- package/lib/simple/room/RemoteParticipant.js +408 -340
- package/lib/simple/room/Room.js +409 -341
- package/lib/simple/room/SipRoom.js +408 -340
- package/lib/simple/room/Stream.js +408 -340
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +408 -340
- package/lib/simple/utils.js +408 -340
- package/lib/utils/__tests__/api-requester.test.js +1 -1
- package/lib/utils/api-requester.js +1 -1
- package/lib/web-rtc-client.js +130 -108
- package/lib/websocket-client.js +16 -16
- package/package.json +1 -1
- package/src/domain/CallSession.js +16 -0
- package/src/domain/Contact.js +1 -1
- package/src/domain/Phone/WebRTCPhone.js +25 -4
- package/src/domain/SFUNotAvailableError.js +7 -0
- package/src/index.js +2 -0
- package/src/lib/WazoSessionDescriptionHandler.js +8 -3
- package/src/simple/Phone.js +2 -1
- package/src/simple/index.js +2 -0
- package/src/utils/api-requester.js +1 -1
- package/src/web-rtc-client.js +27 -10
package/lib/simple/Auth.js
CHANGED
|
@@ -1248,7 +1248,7 @@ class Contact {
|
|
|
1248
1248
|
this[key] = old[key] || this[key];
|
|
1249
1249
|
});
|
|
1250
1250
|
|
|
1251
|
-
if (old.lineState
|
|
1251
|
+
if (old.lineState) {
|
|
1252
1252
|
this.lineState = old.lineState;
|
|
1253
1253
|
}
|
|
1254
1254
|
|
|
@@ -1959,11 +1959,11 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
1959
1959
|
|
|
1960
1960
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
1961
1961
|
|
|
1962
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1962
|
+
const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1963
1963
|
|
|
1964
1964
|
// Use a function here to be able to mock it in tests
|
|
1965
1965
|
const realFetch = () => {
|
|
1966
|
-
if (typeof document !== 'undefined') {
|
|
1966
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
1967
1967
|
// Browser
|
|
1968
1968
|
return window.fetch;
|
|
1969
1969
|
}
|
|
@@ -2098,7 +2098,7 @@ class ApiRequester {
|
|
|
2098
2098
|
};
|
|
2099
2099
|
|
|
2100
2100
|
if (this.refreshTokenPromise) {
|
|
2101
|
-
logger.info('A token is already refreshing, waiting ...', { url });
|
|
2101
|
+
logger$c.info('A token is already refreshing, waiting ...', { url });
|
|
2102
2102
|
await this.refreshTokenPromise;
|
|
2103
2103
|
}
|
|
2104
2104
|
|
|
@@ -2118,7 +2118,7 @@ class ApiRequester {
|
|
|
2118
2118
|
return promise.then(async (err ) => {
|
|
2119
2119
|
// Check if the token is still valid
|
|
2120
2120
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
2121
|
-
logger.warn('token expired', { error: err.reason });
|
|
2121
|
+
logger$c.warn('token expired', { error: err.reason });
|
|
2122
2122
|
// Replay the call after refreshing the token
|
|
2123
2123
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
2124
2124
|
}
|
|
@@ -2128,7 +2128,7 @@ class ApiRequester {
|
|
|
2128
2128
|
: exceptionClass.fromResponse(err, response.status);
|
|
2129
2129
|
|
|
2130
2130
|
if (this.shouldLogErrors) {
|
|
2131
|
-
logger.error('API error', error);
|
|
2131
|
+
logger$c.error('API error', error);
|
|
2132
2132
|
}
|
|
2133
2133
|
|
|
2134
2134
|
throw error;
|
|
@@ -2138,7 +2138,7 @@ class ApiRequester {
|
|
|
2138
2138
|
return newParse(response, isJson);
|
|
2139
2139
|
}).catch(error => {
|
|
2140
2140
|
if (this.shouldLogErrors) {
|
|
2141
|
-
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2141
|
+
logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2142
2142
|
}
|
|
2143
2143
|
|
|
2144
2144
|
throw error;
|
|
@@ -2166,13 +2166,13 @@ class ApiRequester {
|
|
|
2166
2166
|
) {
|
|
2167
2167
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
2168
2168
|
let newPath = path;
|
|
2169
|
-
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2169
|
+
logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2170
2170
|
|
|
2171
2171
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
2172
2172
|
|
|
2173
2173
|
return this.refreshTokenPromise.then(() => {
|
|
2174
2174
|
this.refreshTokenPromise = null;
|
|
2175
|
-
logger.info('token refreshed', { isTokenNotFound });
|
|
2175
|
+
logger$c.info('token refreshed', { isTokenNotFound });
|
|
2176
2176
|
if (isTokenNotFound) {
|
|
2177
2177
|
const pathParts = path.split('/');
|
|
2178
2178
|
pathParts.pop();
|
|
@@ -3265,8 +3265,10 @@ var updateFrom = (instance , from ) => {
|
|
|
3265
3265
|
|
|
3266
3266
|
|
|
3267
3267
|
|
|
3268
|
+
|
|
3268
3269
|
|
|
3269
3270
|
|
|
3271
|
+
|
|
3270
3272
|
|
|
3271
3273
|
|
|
3272
3274
|
|
|
@@ -3283,6 +3285,7 @@ var updateFrom = (instance , from ) => {
|
|
|
3283
3285
|
|
|
3284
3286
|
|
|
3285
3287
|
|
|
3288
|
+
|
|
3286
3289
|
|
|
3287
3290
|
|
|
3288
3291
|
class CallSession {
|
|
@@ -3302,8 +3305,12 @@ class CallSession {
|
|
|
3302
3305
|
|
|
3303
3306
|
|
|
3304
3307
|
|
|
3308
|
+
|
|
3309
|
+
|
|
3305
3310
|
|
|
3306
3311
|
|
|
3312
|
+
|
|
3313
|
+
|
|
3307
3314
|
|
|
3308
3315
|
|
|
3309
3316
|
|
|
@@ -3341,6 +3348,8 @@ class CallSession {
|
|
|
3341
3348
|
|
|
3342
3349
|
|
|
3343
3350
|
|
|
3351
|
+
|
|
3352
|
+
|
|
3344
3353
|
|
|
3345
3354
|
constructor({
|
|
3346
3355
|
answered,
|
|
@@ -3354,6 +3363,8 @@ class CallSession {
|
|
|
3354
3363
|
paused,
|
|
3355
3364
|
ringing,
|
|
3356
3365
|
startTime,
|
|
3366
|
+
creationTime,
|
|
3367
|
+
endTime,
|
|
3357
3368
|
cameraEnabled,
|
|
3358
3369
|
dialedExtension,
|
|
3359
3370
|
sipCallId,
|
|
@@ -3366,12 +3377,15 @@ class CallSession {
|
|
|
3366
3377
|
recording,
|
|
3367
3378
|
recordingPaused,
|
|
3368
3379
|
videoRemotelyDowngraded,
|
|
3380
|
+
sipSession,
|
|
3369
3381
|
} ) {
|
|
3370
3382
|
this.callId = callId;
|
|
3371
3383
|
this.sipCallId = sipCallId;
|
|
3372
3384
|
this.displayName = displayName;
|
|
3373
3385
|
this.number = number;
|
|
3386
|
+
this.creationTime = creationTime;
|
|
3374
3387
|
this.startTime = startTime;
|
|
3388
|
+
this.endTime = endTime;
|
|
3375
3389
|
this.isCaller = isCaller;
|
|
3376
3390
|
this.answered = answered;
|
|
3377
3391
|
this.answeredBySystem = answeredBySystem;
|
|
@@ -3390,6 +3404,7 @@ class CallSession {
|
|
|
3390
3404
|
this.recording = recording || false;
|
|
3391
3405
|
this.recordingPaused = recordingPaused || false;
|
|
3392
3406
|
this.videoRemotelyDowngraded = videoRemotelyDowngraded;
|
|
3407
|
+
this.sipSession = sipSession;
|
|
3393
3408
|
|
|
3394
3409
|
// Useful to compare instead of instanceof with minified code
|
|
3395
3410
|
this.type = 'CallSession';
|
|
@@ -4065,7 +4080,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4065
4080
|
|
|
4066
4081
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4067
4082
|
|
|
4068
|
-
const logger$
|
|
4083
|
+
const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4069
4084
|
|
|
4070
4085
|
class CTIPhone extends Emitter {
|
|
4071
4086
|
|
|
@@ -4078,7 +4093,7 @@ class CTIPhone extends Emitter {
|
|
|
4078
4093
|
|
|
4079
4094
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4080
4095
|
super();
|
|
4081
|
-
logger$
|
|
4096
|
+
logger$b.info('CTI Phone created');
|
|
4082
4097
|
this.session = session;
|
|
4083
4098
|
this.isMobile = isMobile;
|
|
4084
4099
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4139,7 +4154,7 @@ class CTIPhone extends Emitter {
|
|
|
4139
4154
|
}
|
|
4140
4155
|
|
|
4141
4156
|
async makeCall(number , line ) {
|
|
4142
|
-
logger$
|
|
4157
|
+
logger$b.info('make CTI call', { number });
|
|
4143
4158
|
|
|
4144
4159
|
if (!number) {
|
|
4145
4160
|
return null;
|
|
@@ -4162,7 +4177,7 @@ class CTIPhone extends Emitter {
|
|
|
4162
4177
|
if (!callSession) {
|
|
4163
4178
|
return Promise.resolve(null);
|
|
4164
4179
|
}
|
|
4165
|
-
logger$
|
|
4180
|
+
logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4166
4181
|
|
|
4167
4182
|
if (!this.currentCall) {
|
|
4168
4183
|
this.currentCall = callSession.call;
|
|
@@ -4175,7 +4190,7 @@ class CTIPhone extends Emitter {
|
|
|
4175
4190
|
if (!callSession) {
|
|
4176
4191
|
return;
|
|
4177
4192
|
}
|
|
4178
|
-
logger$
|
|
4193
|
+
logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4179
4194
|
|
|
4180
4195
|
this.currentCall = undefined;
|
|
4181
4196
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4185,7 +4200,7 @@ class CTIPhone extends Emitter {
|
|
|
4185
4200
|
if (!callSession) {
|
|
4186
4201
|
return Promise.resolve(false);
|
|
4187
4202
|
}
|
|
4188
|
-
logger$
|
|
4203
|
+
logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4189
4204
|
|
|
4190
4205
|
try {
|
|
4191
4206
|
await CallApi.cancelCall(callSession);
|
|
@@ -4196,7 +4211,7 @@ class CTIPhone extends Emitter {
|
|
|
4196
4211
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4197
4212
|
return true;
|
|
4198
4213
|
} catch (e) {
|
|
4199
|
-
logger$
|
|
4214
|
+
logger$b.error('hangup CTI call, error', e);
|
|
4200
4215
|
|
|
4201
4216
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4202
4217
|
return false;
|
|
@@ -4209,7 +4224,7 @@ class CTIPhone extends Emitter {
|
|
|
4209
4224
|
if (!callSession) {
|
|
4210
4225
|
return;
|
|
4211
4226
|
}
|
|
4212
|
-
logger$
|
|
4227
|
+
logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4213
4228
|
|
|
4214
4229
|
await CallApi.cancelCall(callSession);
|
|
4215
4230
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4219,7 +4234,7 @@ class CTIPhone extends Emitter {
|
|
|
4219
4234
|
if (!callSession) {
|
|
4220
4235
|
return;
|
|
4221
4236
|
}
|
|
4222
|
-
logger$
|
|
4237
|
+
logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4223
4238
|
|
|
4224
4239
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4225
4240
|
}
|
|
@@ -4232,19 +4247,19 @@ class CTIPhone extends Emitter {
|
|
|
4232
4247
|
if (!callSession) {
|
|
4233
4248
|
return;
|
|
4234
4249
|
}
|
|
4235
|
-
logger$
|
|
4250
|
+
logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4236
4251
|
|
|
4237
4252
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4238
4253
|
}
|
|
4239
4254
|
|
|
4240
4255
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4241
|
-
logger$
|
|
4256
|
+
logger$b.info('cancel CTI transfer', { transferId });
|
|
4242
4257
|
|
|
4243
4258
|
return CallApi.cancelCallTransfer(transferId);
|
|
4244
4259
|
}
|
|
4245
4260
|
|
|
4246
4261
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4247
|
-
logger$
|
|
4262
|
+
logger$b.info('confirm CTI transfer', { transferId });
|
|
4248
4263
|
|
|
4249
4264
|
return CallApi.confirmCallTransfer(transferId);
|
|
4250
4265
|
}
|
|
@@ -4253,19 +4268,19 @@ class CTIPhone extends Emitter {
|
|
|
4253
4268
|
if (!callSession) {
|
|
4254
4269
|
return;
|
|
4255
4270
|
}
|
|
4256
|
-
logger$
|
|
4271
|
+
logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4257
4272
|
|
|
4258
4273
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4259
4274
|
}
|
|
4260
4275
|
|
|
4261
4276
|
onConnectionMade() {
|
|
4262
|
-
logger$
|
|
4277
|
+
logger$b.info('on CTI connection made');
|
|
4263
4278
|
|
|
4264
4279
|
this.eventEmitter.emit('onCallAccepted');
|
|
4265
4280
|
}
|
|
4266
4281
|
|
|
4267
4282
|
async close() {
|
|
4268
|
-
logger$
|
|
4283
|
+
logger$b.info('CTI close');
|
|
4269
4284
|
|
|
4270
4285
|
return Promise.resolve();
|
|
4271
4286
|
}
|
|
@@ -4274,7 +4289,7 @@ class CTIPhone extends Emitter {
|
|
|
4274
4289
|
if (!callSession) {
|
|
4275
4290
|
return;
|
|
4276
4291
|
}
|
|
4277
|
-
logger$
|
|
4292
|
+
logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4278
4293
|
|
|
4279
4294
|
return CallApi.hold(callSession.callId);
|
|
4280
4295
|
}
|
|
@@ -4283,7 +4298,7 @@ class CTIPhone extends Emitter {
|
|
|
4283
4298
|
if (!callSession) {
|
|
4284
4299
|
return;
|
|
4285
4300
|
}
|
|
4286
|
-
logger$
|
|
4301
|
+
logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4287
4302
|
|
|
4288
4303
|
return CallApi.resume(callSession.callId);
|
|
4289
4304
|
}
|
|
@@ -4292,7 +4307,7 @@ class CTIPhone extends Emitter {
|
|
|
4292
4307
|
if (!callSession) {
|
|
4293
4308
|
return;
|
|
4294
4309
|
}
|
|
4295
|
-
logger$
|
|
4310
|
+
logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4296
4311
|
|
|
4297
4312
|
return CallApi.mute(callSession.callId);
|
|
4298
4313
|
}
|
|
@@ -4301,7 +4316,7 @@ class CTIPhone extends Emitter {
|
|
|
4301
4316
|
if (!callSession) {
|
|
4302
4317
|
return;
|
|
4303
4318
|
}
|
|
4304
|
-
logger$
|
|
4319
|
+
logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4305
4320
|
|
|
4306
4321
|
return CallApi.unmute(callSession.callId);
|
|
4307
4322
|
}
|
|
@@ -5310,7 +5325,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5310
5325
|
const WEBHOOKD_VERSION = '1.0';
|
|
5311
5326
|
const AMID_VERSION = '1.0';
|
|
5312
5327
|
|
|
5313
|
-
const logger$
|
|
5328
|
+
const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5314
5329
|
|
|
5315
5330
|
class ApiClient {
|
|
5316
5331
|
|
|
@@ -5362,12 +5377,12 @@ class ApiClient {
|
|
|
5362
5377
|
}
|
|
5363
5378
|
|
|
5364
5379
|
async forceRefreshToken() {
|
|
5365
|
-
logger$
|
|
5380
|
+
logger$a.info('forcing refresh token, calling callback');
|
|
5366
5381
|
return this.refreshTokenCallback();
|
|
5367
5382
|
}
|
|
5368
5383
|
|
|
5369
5384
|
async refreshTokenCallback() {
|
|
5370
|
-
logger$
|
|
5385
|
+
logger$a.info('refresh token callback called', {
|
|
5371
5386
|
refreshToken: this.refreshToken,
|
|
5372
5387
|
refreshBackend: this.refreshBackend,
|
|
5373
5388
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5385,7 +5400,7 @@ class ApiClient {
|
|
|
5385
5400
|
this.isMobile,
|
|
5386
5401
|
);
|
|
5387
5402
|
|
|
5388
|
-
logger$
|
|
5403
|
+
logger$a.info('token refreshed', { token: session.token });
|
|
5389
5404
|
|
|
5390
5405
|
if (this.onRefreshToken) {
|
|
5391
5406
|
this.onRefreshToken(session.token, session);
|
|
@@ -5698,7 +5713,7 @@ class AdHocAPIConference {
|
|
|
5698
5713
|
|
|
5699
5714
|
/* */
|
|
5700
5715
|
|
|
5701
|
-
const parseCandidate = (candidate ) => {
|
|
5716
|
+
const parseCandidate$1 = (candidate ) => {
|
|
5702
5717
|
if (!candidate) {
|
|
5703
5718
|
return null;
|
|
5704
5719
|
}
|
|
@@ -5810,11 +5825,16 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5810
5825
|
|
|
5811
5826
|
// $FlowFixMe
|
|
5812
5827
|
setRemoteSessionDescription(sessionDescription ) {
|
|
5813
|
-
|
|
5828
|
+
try {
|
|
5829
|
+
const result = super.setRemoteSessionDescription(sessionDescription);
|
|
5814
5830
|
|
|
5815
|
-
|
|
5831
|
+
this.eventEmitter.emit('setDescription', sessionDescription);
|
|
5816
5832
|
|
|
5817
|
-
|
|
5833
|
+
return result;
|
|
5834
|
+
} catch (error) {
|
|
5835
|
+
this.logger.error('SessionDescriptionHandler.setRemoteSessionDescription error', error);
|
|
5836
|
+
throw error;
|
|
5837
|
+
}
|
|
5818
5838
|
}
|
|
5819
5839
|
|
|
5820
5840
|
// Overridden to avoid to fix ice-candidates missing in the SDP in react-native and chrome canary.
|
|
@@ -5852,7 +5872,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5852
5872
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
5853
5873
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
5854
5874
|
if (event.candidate) {
|
|
5855
|
-
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
5875
|
+
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
5856
5876
|
}
|
|
5857
5877
|
};
|
|
5858
5878
|
|
|
@@ -6316,7 +6336,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6316
6336
|
const SEND_STATS_DELAY = 5000;
|
|
6317
6337
|
|
|
6318
6338
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6319
|
-
const logger$
|
|
6339
|
+
const logger$9 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6320
6340
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6321
6341
|
|
|
6322
6342
|
// events
|
|
@@ -6330,14 +6350,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6330
6350
|
const MESSAGE = 'message';
|
|
6331
6351
|
const ACCEPTED = 'accepted';
|
|
6332
6352
|
const REJECTED = 'rejected';
|
|
6333
|
-
const ON_TRACK = 'onTrack';
|
|
6334
|
-
const ON_REINVITE = 'reinvite';
|
|
6353
|
+
const ON_TRACK$1 = 'onTrack';
|
|
6354
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
6335
6355
|
const ON_ERROR = 'onError';
|
|
6336
6356
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6337
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6338
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
6357
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6358
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6339
6359
|
|
|
6340
|
-
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6360
|
+
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6341
6361
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6342
6362
|
class CanceledCallError extends Error {}
|
|
6343
6363
|
|
|
@@ -6473,12 +6493,12 @@ class WebRTCClient extends Emitter {
|
|
|
6473
6493
|
this.MESSAGE = MESSAGE;
|
|
6474
6494
|
this.ACCEPTED = ACCEPTED;
|
|
6475
6495
|
this.REJECTED = REJECTED;
|
|
6476
|
-
this.ON_TRACK = ON_TRACK;
|
|
6477
|
-
this.ON_REINVITE = ON_REINVITE;
|
|
6496
|
+
this.ON_TRACK = ON_TRACK$1;
|
|
6497
|
+
this.ON_REINVITE = ON_REINVITE$1;
|
|
6478
6498
|
this.ON_ERROR = ON_ERROR;
|
|
6479
6499
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6480
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6481
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6500
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6501
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6482
6502
|
}
|
|
6483
6503
|
|
|
6484
6504
|
configureMedia(media ) {
|
|
@@ -6495,13 +6515,13 @@ class WebRTCClient extends Emitter {
|
|
|
6495
6515
|
|
|
6496
6516
|
createUserAgent(configOverrides ) {
|
|
6497
6517
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6498
|
-
logger$
|
|
6518
|
+
logger$9.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6499
6519
|
|
|
6500
6520
|
webRTCConfiguration.delegate = {
|
|
6501
6521
|
onConnect: this.onConnect.bind(this),
|
|
6502
6522
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6503
6523
|
onInvite: (invitation ) => {
|
|
6504
|
-
logger$
|
|
6524
|
+
logger$9.info('sdk webrtc on invite', {
|
|
6505
6525
|
method: 'delegate.onInvite',
|
|
6506
6526
|
id: invitation.id,
|
|
6507
6527
|
remoteURI: invitation.remoteURI,
|
|
@@ -6544,7 +6564,7 @@ class WebRTCClient extends Emitter {
|
|
|
6544
6564
|
}
|
|
6545
6565
|
|
|
6546
6566
|
onConnect() {
|
|
6547
|
-
logger$
|
|
6567
|
+
logger$9.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6548
6568
|
this.eventEmitter.emit(CONNECTED);
|
|
6549
6569
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6550
6570
|
this.registerer.waitingToggle(false);
|
|
@@ -6553,7 +6573,7 @@ class WebRTCClient extends Emitter {
|
|
|
6553
6573
|
}
|
|
6554
6574
|
|
|
6555
6575
|
async onDisconnect(error ) {
|
|
6556
|
-
logger$
|
|
6576
|
+
logger$9.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6557
6577
|
this.connectionPromise = null;
|
|
6558
6578
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6559
6579
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6578,37 +6598,37 @@ class WebRTCClient extends Emitter {
|
|
|
6578
6598
|
};
|
|
6579
6599
|
|
|
6580
6600
|
if (this.skipRegister) {
|
|
6581
|
-
logger$
|
|
6601
|
+
logger$9.info('sdk webrtc skip register...', logInfo);
|
|
6582
6602
|
return Promise.resolve();
|
|
6583
6603
|
}
|
|
6584
6604
|
|
|
6585
|
-
logger$
|
|
6605
|
+
logger$9.info('sdk webrtc registering...', logInfo);
|
|
6586
6606
|
|
|
6587
6607
|
if (!this.userAgent) {
|
|
6588
|
-
logger$
|
|
6608
|
+
logger$9.info('sdk webrtc recreating User Agent');
|
|
6589
6609
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6590
6610
|
}
|
|
6591
6611
|
if (!this.userAgent || this.isRegistered()) {
|
|
6592
|
-
logger$
|
|
6612
|
+
logger$9.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6593
6613
|
return Promise.resolve();
|
|
6594
6614
|
}
|
|
6595
6615
|
|
|
6596
6616
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6597
|
-
logger$
|
|
6617
|
+
logger$9.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6598
6618
|
return Promise.resolve();
|
|
6599
6619
|
}
|
|
6600
6620
|
|
|
6601
6621
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6602
6622
|
|
|
6603
6623
|
const onRegisterFailed = () => {
|
|
6604
|
-
logger$
|
|
6624
|
+
logger$9.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6605
6625
|
this.connectionPromise = null;
|
|
6606
6626
|
if (this.registerer && this.registerer.waiting) {
|
|
6607
6627
|
this.registerer.waitingToggle(false);
|
|
6608
6628
|
}
|
|
6609
6629
|
|
|
6610
6630
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6611
|
-
logger$
|
|
6631
|
+
logger$9.info('sdk webrtc registering, retrying...', { tries });
|
|
6612
6632
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6613
6633
|
}
|
|
6614
6634
|
};
|
|
@@ -6617,18 +6637,18 @@ class WebRTCClient extends Emitter {
|
|
|
6617
6637
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6618
6638
|
// during the resolution of the primise.
|
|
6619
6639
|
if (!this.userAgent) {
|
|
6620
|
-
logger$
|
|
6640
|
+
logger$9.info('sdk webrtc recreating User Agent after connection');
|
|
6621
6641
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6622
6642
|
}
|
|
6623
6643
|
|
|
6624
|
-
logger$
|
|
6644
|
+
logger$9.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6625
6645
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
6626
6646
|
this.connectionPromise = null;
|
|
6627
6647
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6628
6648
|
|
|
6629
6649
|
// Bind registerer events
|
|
6630
6650
|
this.registerer.stateChange.addListener(newState => {
|
|
6631
|
-
logger$
|
|
6651
|
+
logger$9.info('sdk webrtc registering, state changed', { newState });
|
|
6632
6652
|
|
|
6633
6653
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
6634
6654
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -6641,7 +6661,7 @@ class WebRTCClient extends Emitter {
|
|
|
6641
6661
|
const options = {
|
|
6642
6662
|
requestDelegate: {
|
|
6643
6663
|
onReject: response => {
|
|
6644
|
-
logger$
|
|
6664
|
+
logger$9.error('sdk webrtc registering, rejected', { response });
|
|
6645
6665
|
|
|
6646
6666
|
onRegisterFailed();
|
|
6647
6667
|
},
|
|
@@ -6649,13 +6669,13 @@ class WebRTCClient extends Emitter {
|
|
|
6649
6669
|
};
|
|
6650
6670
|
|
|
6651
6671
|
return this.registerer.register(options).catch((e) => {
|
|
6652
|
-
logger$
|
|
6672
|
+
logger$9.error('sdk webrtc registering, error', e);
|
|
6653
6673
|
|
|
6654
6674
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6655
6675
|
return e;
|
|
6656
6676
|
});
|
|
6657
6677
|
}).catch(error => {
|
|
6658
|
-
logger$
|
|
6678
|
+
logger$9.error('sdk webrtc registering, transport error', error);
|
|
6659
6679
|
onRegisterFailed();
|
|
6660
6680
|
});
|
|
6661
6681
|
}
|
|
@@ -6684,21 +6704,21 @@ class WebRTCClient extends Emitter {
|
|
|
6684
6704
|
}
|
|
6685
6705
|
|
|
6686
6706
|
unregister() {
|
|
6687
|
-
logger$
|
|
6707
|
+
logger$9.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6688
6708
|
if (!this.registerer) {
|
|
6689
6709
|
return Promise.resolve();
|
|
6690
6710
|
}
|
|
6691
6711
|
|
|
6692
6712
|
try {
|
|
6693
6713
|
return this.registerer.unregister().then(() => {
|
|
6694
|
-
logger$
|
|
6714
|
+
logger$9.info('sdk webrtc unregistered');
|
|
6695
6715
|
this._cleanupRegister();
|
|
6696
6716
|
}).catch(e => {
|
|
6697
|
-
logger$
|
|
6717
|
+
logger$9.error('sdk webrtc unregistering, promise error', e);
|
|
6698
6718
|
this._cleanupRegister();
|
|
6699
6719
|
});
|
|
6700
6720
|
} catch (e) {
|
|
6701
|
-
logger$
|
|
6721
|
+
logger$9.error('sdk webrtc unregistering, error', e);
|
|
6702
6722
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6703
6723
|
// error when the registerer is in a bad state
|
|
6704
6724
|
this._cleanupRegister();
|
|
@@ -6706,7 +6726,7 @@ class WebRTCClient extends Emitter {
|
|
|
6706
6726
|
}
|
|
6707
6727
|
|
|
6708
6728
|
stop() {
|
|
6709
|
-
logger$
|
|
6729
|
+
logger$9.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6710
6730
|
if (!this.userAgent) {
|
|
6711
6731
|
return Promise.resolve();
|
|
6712
6732
|
}
|
|
@@ -6714,12 +6734,12 @@ class WebRTCClient extends Emitter {
|
|
|
6714
6734
|
return this.userAgent.stop().then(() => {
|
|
6715
6735
|
return this._cleanupRegister();
|
|
6716
6736
|
}).catch(e => {
|
|
6717
|
-
logger$
|
|
6737
|
+
logger$9.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6718
6738
|
});
|
|
6719
6739
|
}
|
|
6720
6740
|
|
|
6721
6741
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6722
|
-
logger$
|
|
6742
|
+
logger$9.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6723
6743
|
const inviterOptions = {
|
|
6724
6744
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6725
6745
|
conference,
|
|
@@ -6750,7 +6770,7 @@ class WebRTCClient extends Emitter {
|
|
|
6750
6770
|
this._onAccepted(session, response.session, true);
|
|
6751
6771
|
},
|
|
6752
6772
|
onReject: (response ) => {
|
|
6753
|
-
logger$
|
|
6773
|
+
logger$9.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
6754
6774
|
this._stopSendingStats(session);
|
|
6755
6775
|
this.stopNetworkMonitoring(session);
|
|
6756
6776
|
|
|
@@ -6773,11 +6793,11 @@ class WebRTCClient extends Emitter {
|
|
|
6773
6793
|
}
|
|
6774
6794
|
|
|
6775
6795
|
answer(session , enableVideo ) {
|
|
6776
|
-
logger$
|
|
6796
|
+
logger$9.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
6777
6797
|
|
|
6778
6798
|
if (!session || !session.accept) {
|
|
6779
6799
|
const error = 'No session to answer, or not an invitation';
|
|
6780
|
-
logger$
|
|
6800
|
+
logger$9.warn(error);
|
|
6781
6801
|
return Promise.reject(new Error(error));
|
|
6782
6802
|
}
|
|
6783
6803
|
const options = {
|
|
@@ -6787,15 +6807,15 @@ class WebRTCClient extends Emitter {
|
|
|
6787
6807
|
return session.accept(options).then(() => {
|
|
6788
6808
|
if (session.isCanceled) {
|
|
6789
6809
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
6790
|
-
logger$
|
|
6810
|
+
logger$9.error(message, { id: session.id });
|
|
6791
6811
|
this.onCallEnded(session);
|
|
6792
6812
|
|
|
6793
6813
|
throw new CanceledCallError(message);
|
|
6794
6814
|
}
|
|
6795
|
-
logger$
|
|
6815
|
+
logger$9.info('sdk webrtc answer, accepted.');
|
|
6796
6816
|
this._onAccepted(session);
|
|
6797
6817
|
}).catch(e => {
|
|
6798
|
-
logger$
|
|
6818
|
+
logger$9.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
6799
6819
|
|
|
6800
6820
|
throw e;
|
|
6801
6821
|
});
|
|
@@ -6803,7 +6823,7 @@ class WebRTCClient extends Emitter {
|
|
|
6803
6823
|
|
|
6804
6824
|
hangup(session ) {
|
|
6805
6825
|
const { state, id } = session;
|
|
6806
|
-
logger$
|
|
6826
|
+
logger$9.info('sdk webrtc hangup call', { id, state });
|
|
6807
6827
|
|
|
6808
6828
|
try {
|
|
6809
6829
|
this._stopSendingStats(session);
|
|
@@ -6832,7 +6852,7 @@ class WebRTCClient extends Emitter {
|
|
|
6832
6852
|
|
|
6833
6853
|
return bye();
|
|
6834
6854
|
} catch (error) {
|
|
6835
|
-
logger$
|
|
6855
|
+
logger$9.warn('sdk webrtc hangup, error', error);
|
|
6836
6856
|
}
|
|
6837
6857
|
|
|
6838
6858
|
return null;
|
|
@@ -6850,7 +6870,7 @@ class WebRTCClient extends Emitter {
|
|
|
6850
6870
|
// Fetch and emit an event at `interval` with session network stats
|
|
6851
6871
|
startNetworkMonitoring(session , interval = 1000) {
|
|
6852
6872
|
const sessionId = this.getSipSessionId(session);
|
|
6853
|
-
logger$
|
|
6873
|
+
logger$9.info('starting network inspection', { id: sessionId });
|
|
6854
6874
|
|
|
6855
6875
|
this.sessionNetworkStats[sessionId] = [];
|
|
6856
6876
|
|
|
@@ -6860,7 +6880,7 @@ class WebRTCClient extends Emitter {
|
|
|
6860
6880
|
stopNetworkMonitoring(session ) {
|
|
6861
6881
|
const sessionId = this.getSipSessionId(session);
|
|
6862
6882
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
6863
|
-
logger$
|
|
6883
|
+
logger$9.info('stopping network inspection', { id: sessionId, exists });
|
|
6864
6884
|
|
|
6865
6885
|
if (exists) {
|
|
6866
6886
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -6870,17 +6890,17 @@ class WebRTCClient extends Emitter {
|
|
|
6870
6890
|
}
|
|
6871
6891
|
|
|
6872
6892
|
reject(session ) {
|
|
6873
|
-
logger$
|
|
6893
|
+
logger$9.info('sdk webrtc reject call', { id: session.id });
|
|
6874
6894
|
|
|
6875
6895
|
try {
|
|
6876
6896
|
return session.reject ? session.reject() : session.cancel();
|
|
6877
6897
|
} catch (e) {
|
|
6878
|
-
logger$
|
|
6898
|
+
logger$9.warn('Error when rejecting call', e.message, e.stack);
|
|
6879
6899
|
}
|
|
6880
6900
|
}
|
|
6881
6901
|
|
|
6882
6902
|
async close() {
|
|
6883
|
-
logger$
|
|
6903
|
+
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6884
6904
|
this._cleanupMedia();
|
|
6885
6905
|
this.connectionPromise = null;
|
|
6886
6906
|
|
|
@@ -6911,7 +6931,7 @@ class WebRTCClient extends Emitter {
|
|
|
6911
6931
|
// eg: "INVITE not rejectable in state Completed"
|
|
6912
6932
|
}
|
|
6913
6933
|
this.userAgent = null;
|
|
6914
|
-
logger$
|
|
6934
|
+
logger$9.info('sdk webrtc client closed');
|
|
6915
6935
|
}
|
|
6916
6936
|
|
|
6917
6937
|
getNumber(session ) {
|
|
@@ -6924,13 +6944,13 @@ class WebRTCClient extends Emitter {
|
|
|
6924
6944
|
}
|
|
6925
6945
|
|
|
6926
6946
|
mute(session ) {
|
|
6927
|
-
logger$
|
|
6947
|
+
logger$9.info('sdk webrtc mute', { id: session.id });
|
|
6928
6948
|
|
|
6929
6949
|
this._toggleAudio(session, true);
|
|
6930
6950
|
}
|
|
6931
6951
|
|
|
6932
6952
|
unmute(session ) {
|
|
6933
|
-
logger$
|
|
6953
|
+
logger$9.info('sdk webrtc unmute', { id: session.id });
|
|
6934
6954
|
|
|
6935
6955
|
this._toggleAudio(session, false);
|
|
6936
6956
|
}
|
|
@@ -6970,13 +6990,13 @@ class WebRTCClient extends Emitter {
|
|
|
6970
6990
|
}
|
|
6971
6991
|
|
|
6972
6992
|
toggleCameraOn(session ) {
|
|
6973
|
-
logger$
|
|
6993
|
+
logger$9.info('sdk webrtc toggle camera on', { id: session.id });
|
|
6974
6994
|
|
|
6975
6995
|
this._toggleVideo(session, false);
|
|
6976
6996
|
}
|
|
6977
6997
|
|
|
6978
6998
|
toggleCameraOff(session ) {
|
|
6979
|
-
logger$
|
|
6999
|
+
logger$9.info('sdk webrtc toggle camera off', { id: session.id });
|
|
6980
7000
|
|
|
6981
7001
|
this._toggleVideo(session, true);
|
|
6982
7002
|
}
|
|
@@ -6985,7 +7005,7 @@ class WebRTCClient extends Emitter {
|
|
|
6985
7005
|
const sessionId = this.getSipSessionId(session);
|
|
6986
7006
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
6987
7007
|
|
|
6988
|
-
logger$
|
|
7008
|
+
logger$9.info('sdk webrtc hold', {
|
|
6989
7009
|
sessionId,
|
|
6990
7010
|
keys: Object.keys(this.heldSessions),
|
|
6991
7011
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7034,7 +7054,7 @@ class WebRTCClient extends Emitter {
|
|
|
7034
7054
|
const sessionId = this.getSipSessionId(session);
|
|
7035
7055
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7036
7056
|
|
|
7037
|
-
logger$
|
|
7057
|
+
logger$9.info('sdk webrtc unhold', {
|
|
7038
7058
|
sessionId,
|
|
7039
7059
|
keys: Object.keys(this.heldSessions),
|
|
7040
7060
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7182,7 +7202,7 @@ class WebRTCClient extends Emitter {
|
|
|
7182
7202
|
if (!session.sessionDescriptionHandler) {
|
|
7183
7203
|
return;
|
|
7184
7204
|
}
|
|
7185
|
-
logger$
|
|
7205
|
+
logger$9.info('Sending DTMF', {
|
|
7186
7206
|
id: this.getSipSessionId(session),
|
|
7187
7207
|
tone,
|
|
7188
7208
|
});
|
|
@@ -7198,7 +7218,7 @@ class WebRTCClient extends Emitter {
|
|
|
7198
7218
|
transfer(session , target ) {
|
|
7199
7219
|
this.hold(session);
|
|
7200
7220
|
|
|
7201
|
-
logger$
|
|
7221
|
+
logger$9.info('Transfering a session', {
|
|
7202
7222
|
id: this.getSipSessionId(session),
|
|
7203
7223
|
target,
|
|
7204
7224
|
});
|
|
@@ -7220,17 +7240,17 @@ class WebRTCClient extends Emitter {
|
|
|
7220
7240
|
atxfer(session ) {
|
|
7221
7241
|
this.hold(session);
|
|
7222
7242
|
|
|
7223
|
-
logger$
|
|
7243
|
+
logger$9.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7224
7244
|
|
|
7225
7245
|
const result = {
|
|
7226
7246
|
newSession: null,
|
|
7227
7247
|
init: async (target ) => {
|
|
7228
|
-
logger$
|
|
7248
|
+
logger$9.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7229
7249
|
|
|
7230
7250
|
result.newSession = await this.call(target);
|
|
7231
7251
|
},
|
|
7232
7252
|
complete: () => {
|
|
7233
|
-
logger$
|
|
7253
|
+
logger$9.info('webrtc transfer completed', {
|
|
7234
7254
|
id: this.getSipSessionId(session),
|
|
7235
7255
|
referId: this.getSipSessionId(result.newSession),
|
|
7236
7256
|
});
|
|
@@ -7251,7 +7271,7 @@ class WebRTCClient extends Emitter {
|
|
|
7251
7271
|
return;
|
|
7252
7272
|
}
|
|
7253
7273
|
|
|
7254
|
-
logger$
|
|
7274
|
+
logger$9.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7255
7275
|
|
|
7256
7276
|
try {
|
|
7257
7277
|
sipSession.message({
|
|
@@ -7293,7 +7313,7 @@ class WebRTCClient extends Emitter {
|
|
|
7293
7313
|
}
|
|
7294
7314
|
|
|
7295
7315
|
changeAudioOutputVolume(volume ) {
|
|
7296
|
-
logger$
|
|
7316
|
+
logger$9.info('Changing audio output volume', { volume });
|
|
7297
7317
|
|
|
7298
7318
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7299
7319
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7305,7 +7325,7 @@ class WebRTCClient extends Emitter {
|
|
|
7305
7325
|
}
|
|
7306
7326
|
|
|
7307
7327
|
changeAudioOutputDevice(id ) {
|
|
7308
|
-
logger$
|
|
7328
|
+
logger$9.info('Changing audio output device', { id });
|
|
7309
7329
|
|
|
7310
7330
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7311
7331
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7322,7 +7342,7 @@ class WebRTCClient extends Emitter {
|
|
|
7322
7342
|
|
|
7323
7343
|
changeAudioInputDevice(id , session ) {
|
|
7324
7344
|
const currentId = this.getAudioDeviceId();
|
|
7325
|
-
logger$
|
|
7345
|
+
logger$9.info('setting audio input device', { id, currentId, session: !!session });
|
|
7326
7346
|
|
|
7327
7347
|
if (id === currentId) {
|
|
7328
7348
|
return null;
|
|
@@ -7368,7 +7388,7 @@ class WebRTCClient extends Emitter {
|
|
|
7368
7388
|
|
|
7369
7389
|
setVideoInputDevice(id ) {
|
|
7370
7390
|
const currentId = this.getVideoDeviceId();
|
|
7371
|
-
logger$
|
|
7391
|
+
logger$9.info('setting video input device', { id, currentId });
|
|
7372
7392
|
|
|
7373
7393
|
if (id === currentId) {
|
|
7374
7394
|
return null;
|
|
@@ -7393,7 +7413,7 @@ class WebRTCClient extends Emitter {
|
|
|
7393
7413
|
const sessionId = this.getSipSessionId(session);
|
|
7394
7414
|
const localStream = this.getLocalStream(sessionId);
|
|
7395
7415
|
|
|
7396
|
-
logger$
|
|
7416
|
+
logger$9.info('changing video input device', { id, sessionId });
|
|
7397
7417
|
|
|
7398
7418
|
// Release old video stream
|
|
7399
7419
|
if (localStream) {
|
|
@@ -7461,7 +7481,7 @@ class WebRTCClient extends Emitter {
|
|
|
7461
7481
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7462
7482
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7463
7483
|
|
|
7464
|
-
logger$
|
|
7484
|
+
logger$9.info('Sending reinvite', {
|
|
7465
7485
|
id: this.getSipSessionId(sipSession),
|
|
7466
7486
|
newConstraints,
|
|
7467
7487
|
conference,
|
|
@@ -7499,7 +7519,7 @@ class WebRTCClient extends Emitter {
|
|
|
7499
7519
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7500
7520
|
}
|
|
7501
7521
|
|
|
7502
|
-
logger$
|
|
7522
|
+
logger$9.info('on re-INVITE accepted', {
|
|
7503
7523
|
id: this.getSipSessionId(sipSession),
|
|
7504
7524
|
wasMuted,
|
|
7505
7525
|
shouldDoScreenSharing,
|
|
@@ -7517,7 +7537,7 @@ class WebRTCClient extends Emitter {
|
|
|
7517
7537
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7518
7538
|
}
|
|
7519
7539
|
|
|
7520
|
-
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7540
|
+
return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
|
|
7521
7541
|
},
|
|
7522
7542
|
},
|
|
7523
7543
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7674,7 +7694,7 @@ class WebRTCClient extends Emitter {
|
|
|
7674
7694
|
}
|
|
7675
7695
|
|
|
7676
7696
|
startHeartbeat() {
|
|
7677
|
-
logger$
|
|
7697
|
+
logger$9.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7678
7698
|
if (!this.userAgent) {
|
|
7679
7699
|
this.heartbeat.stop();
|
|
7680
7700
|
return;
|
|
@@ -7687,7 +7707,7 @@ class WebRTCClient extends Emitter {
|
|
|
7687
7707
|
}
|
|
7688
7708
|
|
|
7689
7709
|
stopHeartbeat() {
|
|
7690
|
-
logger$
|
|
7710
|
+
logger$9.info('sdk webrtc stop heartbeat');
|
|
7691
7711
|
this.heartbeat.stop();
|
|
7692
7712
|
}
|
|
7693
7713
|
|
|
@@ -7708,7 +7728,7 @@ class WebRTCClient extends Emitter {
|
|
|
7708
7728
|
}
|
|
7709
7729
|
|
|
7710
7730
|
attemptReconnection() {
|
|
7711
|
-
logger$
|
|
7731
|
+
logger$9.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7712
7732
|
if (!this.userAgent) {
|
|
7713
7733
|
return;
|
|
7714
7734
|
}
|
|
@@ -7733,7 +7753,7 @@ class WebRTCClient extends Emitter {
|
|
|
7733
7753
|
return;
|
|
7734
7754
|
}
|
|
7735
7755
|
|
|
7736
|
-
logger$
|
|
7756
|
+
logger$9.info('setting local media stream', {
|
|
7737
7757
|
sipSessionId,
|
|
7738
7758
|
tracks: newStream ? newStream.getTracks() : null,
|
|
7739
7759
|
});
|
|
@@ -7750,7 +7770,7 @@ class WebRTCClient extends Emitter {
|
|
|
7750
7770
|
|
|
7751
7771
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
7752
7772
|
|
|
7753
|
-
logger$
|
|
7773
|
+
logger$9.info('updating local stream', {
|
|
7754
7774
|
sipSessionId,
|
|
7755
7775
|
oldStream: !!oldStream,
|
|
7756
7776
|
tracks: newStream.getTracks(),
|
|
@@ -7770,7 +7790,7 @@ class WebRTCClient extends Emitter {
|
|
|
7770
7790
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
7771
7791
|
const pc = this.getPeerConnection(sessionId);
|
|
7772
7792
|
|
|
7773
|
-
logger$
|
|
7793
|
+
logger$9.info('Updating remote stream', {
|
|
7774
7794
|
sessionId,
|
|
7775
7795
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
7776
7796
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -7795,14 +7815,16 @@ class WebRTCClient extends Emitter {
|
|
|
7795
7815
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
7796
7816
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
7797
7817
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
7818
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
7798
7819
|
|
|
7799
|
-
logger$
|
|
7820
|
+
logger$9.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
7800
7821
|
|
|
7801
7822
|
return {
|
|
7802
7823
|
constraints: {
|
|
7803
7824
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
7804
7825
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
7805
|
-
video: screenSharing ? (isDesktop
|
|
7826
|
+
video: screenSharing ? (isDesktop
|
|
7827
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
7806
7828
|
: this._getVideoConstraints(enableVideo),
|
|
7807
7829
|
screen: screenSharing,
|
|
7808
7830
|
desktop: isDesktop,
|
|
@@ -7845,7 +7867,7 @@ class WebRTCClient extends Emitter {
|
|
|
7845
7867
|
}
|
|
7846
7868
|
|
|
7847
7869
|
_onTransportError() {
|
|
7848
|
-
logger$
|
|
7870
|
+
logger$9.error('on transport error');
|
|
7849
7871
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
7850
7872
|
this.attemptReconnection();
|
|
7851
7873
|
}
|
|
@@ -7854,7 +7876,7 @@ class WebRTCClient extends Emitter {
|
|
|
7854
7876
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
7855
7877
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
7856
7878
|
if (this.hasHeartbeat()) {
|
|
7857
|
-
logger$
|
|
7879
|
+
logger$9.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
7858
7880
|
|
|
7859
7881
|
this.heartbeat.onHeartbeat();
|
|
7860
7882
|
if (this.heartbeatCb) {
|
|
@@ -7865,7 +7887,7 @@ class WebRTCClient extends Emitter {
|
|
|
7865
7887
|
}
|
|
7866
7888
|
|
|
7867
7889
|
async _onHeartbeatTimeout() {
|
|
7868
|
-
logger$
|
|
7890
|
+
logger$9.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7869
7891
|
|
|
7870
7892
|
if (this.heartbeatTimeoutCb) {
|
|
7871
7893
|
this.heartbeatTimeoutCb();
|
|
@@ -7877,7 +7899,7 @@ class WebRTCClient extends Emitter {
|
|
|
7877
7899
|
try {
|
|
7878
7900
|
await this.userAgent.transport.disconnect();
|
|
7879
7901
|
} catch (e) {
|
|
7880
|
-
logger$
|
|
7902
|
+
logger$9.error('Transport disconnection after heartbeat timeout, error', e);
|
|
7881
7903
|
}
|
|
7882
7904
|
}
|
|
7883
7905
|
|
|
@@ -7910,31 +7932,31 @@ class WebRTCClient extends Emitter {
|
|
|
7910
7932
|
}
|
|
7911
7933
|
|
|
7912
7934
|
_connectIfNeeded() {
|
|
7913
|
-
logger$
|
|
7935
|
+
logger$9.info('connect if needed, checking', { connected: this.isConnected() });
|
|
7914
7936
|
if (!this.userAgent) {
|
|
7915
|
-
logger$
|
|
7937
|
+
logger$9.info('need to recreate User Agent');
|
|
7916
7938
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
7917
7939
|
}
|
|
7918
7940
|
|
|
7919
7941
|
if (this.isConnected()) {
|
|
7920
|
-
logger$
|
|
7942
|
+
logger$9.info('webrtc sdk, already connected');
|
|
7921
7943
|
return Promise.resolve();
|
|
7922
7944
|
}
|
|
7923
7945
|
|
|
7924
7946
|
if (this.isConnecting()) {
|
|
7925
|
-
logger$
|
|
7947
|
+
logger$9.info('webrtc sdk, already connecting...');
|
|
7926
7948
|
|
|
7927
7949
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
7928
7950
|
return this.connectionPromise;
|
|
7929
7951
|
}
|
|
7930
7952
|
|
|
7931
7953
|
if (this.connectionPromise) {
|
|
7932
|
-
logger$
|
|
7954
|
+
logger$9.info('webrtc sdk, connection promise connecting...');
|
|
7933
7955
|
// $FlowFixMe
|
|
7934
7956
|
return this.connectionPromise;
|
|
7935
7957
|
}
|
|
7936
7958
|
|
|
7937
|
-
logger$
|
|
7959
|
+
logger$9.info('WebRTC UA needs to connect');
|
|
7938
7960
|
|
|
7939
7961
|
// Force UA to reconnect
|
|
7940
7962
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -8059,7 +8081,7 @@ class WebRTCClient extends Emitter {
|
|
|
8059
8081
|
|
|
8060
8082
|
sdh.peerConnectionDelegate = {
|
|
8061
8083
|
onicecandidateerror: (error ) => {
|
|
8062
|
-
logger$
|
|
8084
|
+
logger$9.error('on icecandidate error', {
|
|
8063
8085
|
address: error.address,
|
|
8064
8086
|
port: error.port,
|
|
8065
8087
|
errorCode: error.errorCode,
|
|
@@ -8088,7 +8110,7 @@ class WebRTCClient extends Emitter {
|
|
|
8088
8110
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8089
8111
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8090
8112
|
}
|
|
8091
|
-
logger$
|
|
8113
|
+
logger$9.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8092
8114
|
|
|
8093
8115
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8094
8116
|
|
|
@@ -8104,12 +8126,12 @@ class WebRTCClient extends Emitter {
|
|
|
8104
8126
|
|
|
8105
8127
|
this._setupMedias(session);
|
|
8106
8128
|
|
|
8107
|
-
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8129
|
+
return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8108
8130
|
};
|
|
8109
8131
|
}
|
|
8110
8132
|
|
|
8111
8133
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8112
|
-
logger$
|
|
8134
|
+
logger$9.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8113
8135
|
|
|
8114
8136
|
this.storeSipSession(session);
|
|
8115
8137
|
|
|
@@ -8121,14 +8143,14 @@ class WebRTCClient extends Emitter {
|
|
|
8121
8143
|
const onTrack = (event ) => {
|
|
8122
8144
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8123
8145
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8124
|
-
logger$
|
|
8146
|
+
logger$9.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8125
8147
|
|
|
8126
8148
|
// Stop video track in audio only mode
|
|
8127
8149
|
if (isAudioOnly && kind === 'video') {
|
|
8128
8150
|
event.track.stop();
|
|
8129
8151
|
}
|
|
8130
8152
|
|
|
8131
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8153
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
8132
8154
|
};
|
|
8133
8155
|
|
|
8134
8156
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8137,12 +8159,14 @@ class WebRTCClient extends Emitter {
|
|
|
8137
8159
|
|
|
8138
8160
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8139
8161
|
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
|
|
8162
|
+
if (pc) {
|
|
8163
|
+
pc.oniceconnectionstatechange = () => {
|
|
8164
|
+
logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8165
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8166
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8167
|
+
}
|
|
8168
|
+
};
|
|
8169
|
+
}
|
|
8146
8170
|
|
|
8147
8171
|
if (withEvent) {
|
|
8148
8172
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8311,10 +8335,10 @@ class WebRTCClient extends Emitter {
|
|
|
8311
8335
|
|
|
8312
8336
|
_stopSendingStats(session ) {
|
|
8313
8337
|
const sessionId = this.getSipSessionId(session);
|
|
8314
|
-
logger$
|
|
8338
|
+
logger$9.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8315
8339
|
|
|
8316
8340
|
if (sessionId in this.statsIntervals) {
|
|
8317
|
-
logger$
|
|
8341
|
+
logger$9.trace('Stop sending stats for call', { sessionId });
|
|
8318
8342
|
this.statsIntervals[sessionId]();
|
|
8319
8343
|
delete this.statsIntervals[sessionId];
|
|
8320
8344
|
}
|
|
@@ -8330,7 +8354,7 @@ class WebRTCClient extends Emitter {
|
|
|
8330
8354
|
try {
|
|
8331
8355
|
await this.userAgent.transport.disconnect();
|
|
8332
8356
|
} catch (e) {
|
|
8333
|
-
logger$
|
|
8357
|
+
logger$9.error('WebRTC transport disconnect, error', e);
|
|
8334
8358
|
}
|
|
8335
8359
|
}
|
|
8336
8360
|
}
|
|
@@ -8352,13 +8376,17 @@ class WebRTCClient extends Emitter {
|
|
|
8352
8376
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8353
8377
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8354
8378
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8379
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8355
8380
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8356
8381
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8382
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8357
8383
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8358
8384
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8359
8385
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8360
|
-
let audioBytesSent = 0;
|
|
8361
|
-
let audioBytesReceived = 0;
|
|
8386
|
+
let audioBytesSent = 0; // content + header
|
|
8387
|
+
let audioBytesReceived = 0; // content + header
|
|
8388
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8389
|
+
let audioContentReceived = 0;
|
|
8362
8390
|
let videoBytesSent = 0;
|
|
8363
8391
|
let videoBytesReceived = 0;
|
|
8364
8392
|
let transportSent = 0;
|
|
@@ -8368,6 +8396,7 @@ class WebRTCClient extends Emitter {
|
|
|
8368
8396
|
stats.forEach(report => {
|
|
8369
8397
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8370
8398
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8399
|
+
audioContentSent += Number(report.bytesSent);
|
|
8371
8400
|
}
|
|
8372
8401
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8373
8402
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -8379,6 +8408,7 @@ class WebRTCClient extends Emitter {
|
|
|
8379
8408
|
packetsLost += Number(report.packetsLost);
|
|
8380
8409
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8381
8410
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8411
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8382
8412
|
}
|
|
8383
8413
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8384
8414
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -8407,10 +8437,17 @@ class WebRTCClient extends Emitter {
|
|
|
8407
8437
|
});
|
|
8408
8438
|
|
|
8409
8439
|
networkStats.packetsLost = packetsLost;
|
|
8440
|
+
|
|
8410
8441
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8411
8442
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8412
8443
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8413
8444
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8445
|
+
|
|
8446
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8447
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8448
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8449
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8450
|
+
|
|
8414
8451
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8415
8452
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8416
8453
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8424,7 +8461,7 @@ class WebRTCClient extends Emitter {
|
|
|
8424
8461
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8425
8462
|
+ networkStats.transportSent;
|
|
8426
8463
|
|
|
8427
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8464
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8428
8465
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8429
8466
|
}
|
|
8430
8467
|
|
|
@@ -8449,11 +8486,12 @@ const ON_CAMERA_DISABLED = 'onCameraDisabled';
|
|
|
8449
8486
|
const ON_CAMERA_RESUMED = 'onCameraResumed';
|
|
8450
8487
|
const ON_CALL_CANCELED = 'onCallCanceled';
|
|
8451
8488
|
const ON_CALL_FAILED = 'onCallFailed';
|
|
8489
|
+
const ON_CALL_REJECTED = 'onCallRejected';
|
|
8452
8490
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8453
8491
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8454
8492
|
const ON_MESSAGE = 'onMessage';
|
|
8455
|
-
const ON_REINVITE
|
|
8456
|
-
const ON_TRACK
|
|
8493
|
+
const ON_REINVITE = 'reinvite';
|
|
8494
|
+
const ON_TRACK = 'onTrack';
|
|
8457
8495
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8458
8496
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8459
8497
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8468,15 +8506,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8468
8506
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8469
8507
|
const ON_CALL_ERROR = 'onCallError';
|
|
8470
8508
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8471
|
-
const ON_NETWORK_STATS
|
|
8509
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8472
8510
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8473
8511
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8474
|
-
const ON_DISCONNECTED
|
|
8512
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
8475
8513
|
|
|
8476
8514
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8477
8515
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8478
8516
|
|
|
8479
|
-
const events
|
|
8517
|
+
const events = [
|
|
8480
8518
|
ON_USER_AGENT,
|
|
8481
8519
|
ON_REGISTERED,
|
|
8482
8520
|
ON_UNREGISTERED,
|
|
@@ -8493,9 +8531,10 @@ const events$1 = [
|
|
|
8493
8531
|
ON_CAMERA_DISABLED,
|
|
8494
8532
|
ON_CALL_FAILED,
|
|
8495
8533
|
ON_CALL_ENDED,
|
|
8534
|
+
ON_CALL_REJECTED,
|
|
8496
8535
|
ON_MESSAGE,
|
|
8497
|
-
ON_REINVITE
|
|
8498
|
-
ON_TRACK
|
|
8536
|
+
ON_REINVITE,
|
|
8537
|
+
ON_TRACK,
|
|
8499
8538
|
ON_AUDIO_STREAM,
|
|
8500
8539
|
ON_VIDEO_STREAM,
|
|
8501
8540
|
ON_REMOVE_STREAM,
|
|
@@ -8510,11 +8549,11 @@ const events$1 = [
|
|
|
8510
8549
|
ON_CALL_ERROR,
|
|
8511
8550
|
ON_CHAT,
|
|
8512
8551
|
ON_SIGNAL,
|
|
8513
|
-
ON_NETWORK_STATS
|
|
8514
|
-
ON_DISCONNECTED
|
|
8552
|
+
ON_NETWORK_STATS,
|
|
8553
|
+
ON_DISCONNECTED,
|
|
8515
8554
|
];
|
|
8516
8555
|
|
|
8517
|
-
const logger$
|
|
8556
|
+
const logger$8 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8518
8557
|
|
|
8519
8558
|
class WebRTCPhone extends Emitter {
|
|
8520
8559
|
|
|
@@ -8587,7 +8626,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8587
8626
|
}).catch(error => {
|
|
8588
8627
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8589
8628
|
console.error('register error', error, error.message, error.stack);
|
|
8590
|
-
logger$
|
|
8629
|
+
logger$8.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8591
8630
|
});
|
|
8592
8631
|
}
|
|
8593
8632
|
|
|
@@ -8602,7 +8641,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8602
8641
|
if (!this.client) {
|
|
8603
8642
|
return;
|
|
8604
8643
|
}
|
|
8605
|
-
logger$
|
|
8644
|
+
logger$8.info('WebRTC phone stop');
|
|
8606
8645
|
this.client.stop();
|
|
8607
8646
|
}
|
|
8608
8647
|
|
|
@@ -8617,11 +8656,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8617
8656
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8618
8657
|
audioOnly = false, iceRestart = false) {
|
|
8619
8658
|
const sipSession = this.findSipSession(callSession);
|
|
8620
|
-
logger$
|
|
8659
|
+
logger$8.info('WebRTC phone - send reinvite', {
|
|
8621
8660
|
sessionId: sipSession ? sipSession.id : null,
|
|
8622
8661
|
constraints,
|
|
8623
8662
|
audioOnly,
|
|
8624
8663
|
conference,
|
|
8664
|
+
iceRestart,
|
|
8625
8665
|
});
|
|
8626
8666
|
|
|
8627
8667
|
if (!sipSession) {
|
|
@@ -8654,7 +8694,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8654
8694
|
}
|
|
8655
8695
|
|
|
8656
8696
|
startHeartbeat() {
|
|
8657
|
-
logger$
|
|
8697
|
+
logger$8.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8658
8698
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8659
8699
|
return;
|
|
8660
8700
|
}
|
|
@@ -8663,7 +8703,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8663
8703
|
}
|
|
8664
8704
|
|
|
8665
8705
|
stopHeartbeat() {
|
|
8666
|
-
logger$
|
|
8706
|
+
logger$8.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8667
8707
|
if (!this.client) {
|
|
8668
8708
|
return;
|
|
8669
8709
|
}
|
|
@@ -8680,7 +8720,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8680
8720
|
}
|
|
8681
8721
|
|
|
8682
8722
|
reconnect() {
|
|
8683
|
-
logger$
|
|
8723
|
+
logger$8.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8684
8724
|
if (!this.client) {
|
|
8685
8725
|
return;
|
|
8686
8726
|
}
|
|
@@ -8721,7 +8761,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8721
8761
|
return false;
|
|
8722
8762
|
}
|
|
8723
8763
|
|
|
8724
|
-
logger$
|
|
8764
|
+
logger$8.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8725
8765
|
|
|
8726
8766
|
this.client.downgradeToAudio(sipSession);
|
|
8727
8767
|
|
|
@@ -8744,7 +8784,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8744
8784
|
return Promise.resolve(false);
|
|
8745
8785
|
}
|
|
8746
8786
|
|
|
8747
|
-
logger$
|
|
8787
|
+
logger$8.info('Upgrade to video', {
|
|
8748
8788
|
id: callSession ? callSession.getId() : null,
|
|
8749
8789
|
constraints,
|
|
8750
8790
|
isConference,
|
|
@@ -8784,7 +8824,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8784
8824
|
|
|
8785
8825
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
8786
8826
|
const sipSession = this.findSipSession(callSession);
|
|
8787
|
-
logger$
|
|
8827
|
+
logger$8.info('Sending reinvite message', {
|
|
8788
8828
|
id: callSession ? callSession.getId() : null,
|
|
8789
8829
|
isUpgrade,
|
|
8790
8830
|
});
|
|
@@ -8810,7 +8850,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8810
8850
|
// Monkey patch to know when canceled with the CANCEL message
|
|
8811
8851
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
8812
8852
|
sipSession._onCancel = (message ) => {
|
|
8813
|
-
logger$
|
|
8853
|
+
logger$8.trace('on sip session canceled', { callId: message.callId });
|
|
8814
8854
|
|
|
8815
8855
|
onCancel(message);
|
|
8816
8856
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -8838,16 +8878,17 @@ class WebRTCPhone extends Emitter {
|
|
|
8838
8878
|
this.audioOutputVolume,
|
|
8839
8879
|
);
|
|
8840
8880
|
case sessionState.SessionState.Terminating:
|
|
8841
|
-
logger$
|
|
8881
|
+
logger$8.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
8842
8882
|
|
|
8843
8883
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
8844
8884
|
|
|
8845
8885
|
break;
|
|
8846
8886
|
case sessionState.SessionState.Terminated: {
|
|
8847
|
-
logger$
|
|
8887
|
+
logger$8.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
8848
8888
|
|
|
8849
8889
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8850
8890
|
const callSession = this._createCallSession(sipSession);
|
|
8891
|
+
callSession.endTime = new Date();
|
|
8851
8892
|
const wasCurrentSession = this._onCallTerminated(sipSession);
|
|
8852
8893
|
|
|
8853
8894
|
return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
|
|
@@ -8866,7 +8907,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8866
8907
|
const [stream] = event.streams;
|
|
8867
8908
|
const kind = event && event.track && event.track.kind;
|
|
8868
8909
|
|
|
8869
|
-
logger$
|
|
8910
|
+
logger$8.info('on track stream called on the peer connection', {
|
|
8870
8911
|
callId: this.getSipSessionId(sipSession),
|
|
8871
8912
|
streamId: stream ? stream.id : null,
|
|
8872
8913
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -8886,7 +8927,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8886
8927
|
};
|
|
8887
8928
|
|
|
8888
8929
|
peerConnection.onremovestream = event => {
|
|
8889
|
-
logger$
|
|
8930
|
+
logger$8.info('on remove stream called on the peer connection', {
|
|
8890
8931
|
id: event.stream.id,
|
|
8891
8932
|
tracks: event.stream.getTracks(),
|
|
8892
8933
|
});
|
|
@@ -8896,7 +8937,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8896
8937
|
}
|
|
8897
8938
|
|
|
8898
8939
|
async startScreenSharing(constraints , callSession ) {
|
|
8899
|
-
logger$
|
|
8940
|
+
logger$8.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
8900
8941
|
|
|
8901
8942
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
8902
8943
|
if (!screenShareStream) {
|
|
@@ -8936,7 +8977,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8936
8977
|
return;
|
|
8937
8978
|
}
|
|
8938
8979
|
|
|
8939
|
-
logger$
|
|
8980
|
+
logger$8.info('WebRTC phone - stop screen sharing', {
|
|
8940
8981
|
restoreLocalStream,
|
|
8941
8982
|
});
|
|
8942
8983
|
|
|
@@ -8992,7 +9033,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8992
9033
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
8993
9034
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
8994
9035
|
|
|
8995
|
-
logger$
|
|
9036
|
+
logger$8.info('WebRTC phone - on screensharing', {
|
|
8996
9037
|
hadVideo,
|
|
8997
9038
|
id: this.getSipSessionId(sipSession),
|
|
8998
9039
|
screenTrack,
|
|
@@ -9000,7 +9041,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9000
9041
|
|
|
9001
9042
|
if (screenTrack) {
|
|
9002
9043
|
screenTrack.onended = () => {
|
|
9003
|
-
logger$
|
|
9044
|
+
logger$8.info('WebRTC phone - on screenshare ended', {
|
|
9004
9045
|
hadVideo,
|
|
9005
9046
|
id: this.getSipSessionId(sipSession),
|
|
9006
9047
|
screenTrack,
|
|
@@ -9031,7 +9072,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9031
9072
|
}
|
|
9032
9073
|
|
|
9033
9074
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9034
|
-
logger$
|
|
9075
|
+
logger$8.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9035
9076
|
|
|
9036
9077
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9037
9078
|
this.currentSipSession = sipSession;
|
|
@@ -9049,7 +9090,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9049
9090
|
}
|
|
9050
9091
|
|
|
9051
9092
|
changeAudioDevice(id ) {
|
|
9052
|
-
logger$
|
|
9093
|
+
logger$8.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9053
9094
|
this.audioOutputDeviceId = id;
|
|
9054
9095
|
this.client.changeAudioOutputDevice(id);
|
|
9055
9096
|
}
|
|
@@ -9059,14 +9100,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9059
9100
|
}
|
|
9060
9101
|
|
|
9061
9102
|
changeRingDevice(id ) {
|
|
9062
|
-
logger$
|
|
9103
|
+
logger$8.info('WebRTC phone - changing ring device', { id });
|
|
9063
9104
|
|
|
9064
9105
|
this.audioRingDeviceId = id;
|
|
9065
9106
|
}
|
|
9066
9107
|
|
|
9067
9108
|
// volume is a value between 0 and 1
|
|
9068
9109
|
changeAudioVolume(volume ) {
|
|
9069
|
-
logger$
|
|
9110
|
+
logger$8.info('WebRTC phone - changing audio volume', { volume });
|
|
9070
9111
|
|
|
9071
9112
|
this.audioOutputVolume = volume;
|
|
9072
9113
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9074,32 +9115,33 @@ class WebRTCPhone extends Emitter {
|
|
|
9074
9115
|
|
|
9075
9116
|
// volume is a value between 0 and 1
|
|
9076
9117
|
changeRingVolume(volume ) {
|
|
9077
|
-
logger$
|
|
9118
|
+
logger$8.info('WebRTC phone - changing ring volume', { volume });
|
|
9078
9119
|
|
|
9079
9120
|
this.audioRingVolume = volume;
|
|
9080
9121
|
}
|
|
9081
9122
|
|
|
9082
9123
|
changeAudioInputDevice(id ) {
|
|
9083
|
-
logger$
|
|
9124
|
+
logger$8.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9084
9125
|
|
|
9085
9126
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9086
9127
|
}
|
|
9087
9128
|
|
|
9088
9129
|
changeVideoInputDevice(id ) {
|
|
9089
|
-
logger$
|
|
9130
|
+
logger$8.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9090
9131
|
|
|
9091
9132
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9092
9133
|
}
|
|
9093
9134
|
|
|
9094
9135
|
changeSessionVideoInputDevice(id ) {
|
|
9095
|
-
logger$
|
|
9136
|
+
logger$8.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9096
9137
|
|
|
9097
9138
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9098
9139
|
}
|
|
9099
9140
|
|
|
9100
9141
|
_onCallTerminated(sipSession ) {
|
|
9101
|
-
logger$
|
|
9142
|
+
logger$8.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9102
9143
|
|
|
9144
|
+
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9103
9145
|
const callSession = this._createCallSession(sipSession);
|
|
9104
9146
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
9105
9147
|
const isCurrentIncomingCall = callSession.is(this.getIncomingCallSession());
|
|
@@ -9117,7 +9159,6 @@ class WebRTCPhone extends Emitter {
|
|
|
9117
9159
|
}, 5);
|
|
9118
9160
|
}
|
|
9119
9161
|
|
|
9120
|
-
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9121
9162
|
if (sipSessionId) {
|
|
9122
9163
|
this.removeIncomingSessions(sipSessionId);
|
|
9123
9164
|
}
|
|
@@ -9132,7 +9173,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9132
9173
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9133
9174
|
|
|
9134
9175
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9135
|
-
logger$
|
|
9176
|
+
logger$8.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9136
9177
|
sipId: sipSession.id,
|
|
9137
9178
|
shouldRetrigger,
|
|
9138
9179
|
hasIncomingCallSession,
|
|
@@ -9223,37 +9264,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9223
9264
|
|
|
9224
9265
|
// Deprecated
|
|
9225
9266
|
getLocalStreamForCall(callSession ) {
|
|
9226
|
-
logger$
|
|
9267
|
+
logger$8.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9227
9268
|
|
|
9228
9269
|
return this.getLocalStream(callSession);
|
|
9229
9270
|
}
|
|
9230
9271
|
|
|
9231
9272
|
// Deprecated
|
|
9232
9273
|
getRemoteStreamForCall(callSession ) {
|
|
9233
|
-
logger$
|
|
9274
|
+
logger$8.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9234
9275
|
|
|
9235
9276
|
return this.getRemoteVideoStream(callSession);
|
|
9236
9277
|
}
|
|
9237
9278
|
|
|
9238
9279
|
getRemoteStreamsForCall(callSession ) {
|
|
9239
|
-
logger$
|
|
9280
|
+
logger$8.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9240
9281
|
|
|
9241
9282
|
return this.getRemoteStream(callSession);
|
|
9242
9283
|
}
|
|
9243
9284
|
|
|
9244
9285
|
accept(callSession , cameraEnabled ) {
|
|
9245
|
-
logger$
|
|
9286
|
+
logger$8.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9246
9287
|
if (this.currentSipSession) {
|
|
9247
9288
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9248
9289
|
}
|
|
9249
9290
|
|
|
9250
9291
|
if (!callSession) {
|
|
9251
|
-
logger$
|
|
9292
|
+
logger$8.warn('no CallSession to accept.');
|
|
9252
9293
|
return Promise.resolve(null);
|
|
9253
9294
|
}
|
|
9254
9295
|
|
|
9255
9296
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9256
|
-
logger$
|
|
9297
|
+
logger$8.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9257
9298
|
return Promise.resolve(callSession.sipCallId);
|
|
9258
9299
|
}
|
|
9259
9300
|
|
|
@@ -9265,24 +9306,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9265
9306
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9266
9307
|
if (sipSession) {
|
|
9267
9308
|
if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
|
|
9268
|
-
logger$
|
|
9309
|
+
logger$8.warn('Trying to answer a terminated sipSession.');
|
|
9269
9310
|
|
|
9270
9311
|
return Promise.resolve(null);
|
|
9271
9312
|
}
|
|
9272
9313
|
|
|
9273
|
-
logger$
|
|
9314
|
+
logger$8.info('accept call, session found', { sipId: sipSession.id });
|
|
9274
9315
|
|
|
9275
9316
|
// $FlowFixMe
|
|
9276
9317
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9277
9318
|
return callSession.sipCallId;
|
|
9278
9319
|
}).catch(e => {
|
|
9279
|
-
logger$
|
|
9320
|
+
logger$8.error(e);
|
|
9280
9321
|
this.endCurrentCall(callSession);
|
|
9281
9322
|
throw e;
|
|
9282
9323
|
});
|
|
9283
9324
|
}
|
|
9284
9325
|
|
|
9285
|
-
logger$
|
|
9326
|
+
logger$8.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9286
9327
|
|
|
9287
9328
|
return Promise.resolve(null);
|
|
9288
9329
|
}
|
|
@@ -9292,7 +9333,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9292
9333
|
}
|
|
9293
9334
|
|
|
9294
9335
|
async reject(callSession ) {
|
|
9295
|
-
logger$
|
|
9336
|
+
logger$8.info('reject WebRTC called', { id: callSession.getId() });
|
|
9296
9337
|
|
|
9297
9338
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9298
9339
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9304,14 +9345,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9304
9345
|
|
|
9305
9346
|
const sipSession = this.findSipSession(callSession);
|
|
9306
9347
|
if (sipSession) {
|
|
9307
|
-
logger$
|
|
9348
|
+
logger$8.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9308
9349
|
|
|
9309
9350
|
this.client.hangup(sipSession);
|
|
9310
9351
|
}
|
|
9311
9352
|
}
|
|
9312
9353
|
|
|
9313
9354
|
async ignore(callSession ) {
|
|
9314
|
-
logger$
|
|
9355
|
+
logger$8.info('WebRTC ignore', { id: callSession.getId() });
|
|
9315
9356
|
|
|
9316
9357
|
// kill the ring
|
|
9317
9358
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9323,14 +9364,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9323
9364
|
const sipSession = this.findSipSession(callSession);
|
|
9324
9365
|
|
|
9325
9366
|
if (sipSession) {
|
|
9326
|
-
logger$
|
|
9367
|
+
logger$8.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9327
9368
|
|
|
9328
9369
|
return this.client.atxfer(sipSession);
|
|
9329
9370
|
}
|
|
9330
9371
|
}
|
|
9331
9372
|
|
|
9332
9373
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9333
|
-
logger$
|
|
9374
|
+
logger$8.info('WebRTC hold', { id: callSession.getId() });
|
|
9334
9375
|
|
|
9335
9376
|
const sipSession = this.findSipSession(callSession);
|
|
9336
9377
|
|
|
@@ -9345,18 +9386,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9345
9386
|
}
|
|
9346
9387
|
|
|
9347
9388
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9348
|
-
logger$
|
|
9389
|
+
logger$8.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9349
9390
|
|
|
9350
9391
|
const sipSession = this.findSipSession(callSession);
|
|
9351
9392
|
if (!sipSession) {
|
|
9352
9393
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9353
9394
|
}
|
|
9354
9395
|
|
|
9355
|
-
logger$
|
|
9396
|
+
logger$8.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9356
9397
|
|
|
9357
9398
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9358
9399
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9359
|
-
logger$
|
|
9400
|
+
logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9360
9401
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9361
9402
|
}
|
|
9362
9403
|
|
|
@@ -9381,7 +9422,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9381
9422
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9382
9423
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9383
9424
|
|
|
9384
|
-
logger$
|
|
9425
|
+
logger$8.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9385
9426
|
|
|
9386
9427
|
// Stop screenshre if needed
|
|
9387
9428
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9412,7 +9453,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9412
9453
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9413
9454
|
}
|
|
9414
9455
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9415
|
-
logger$
|
|
9456
|
+
logger$8.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9416
9457
|
|
|
9417
9458
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9418
9459
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9456,14 +9497,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9456
9497
|
}
|
|
9457
9498
|
|
|
9458
9499
|
mute(callSession , withEvent = true) {
|
|
9459
|
-
logger$
|
|
9500
|
+
logger$8.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9460
9501
|
|
|
9461
9502
|
const sipSession = this.findSipSession(callSession);
|
|
9462
9503
|
if (!sipSession) {
|
|
9463
9504
|
return;
|
|
9464
9505
|
}
|
|
9465
9506
|
|
|
9466
|
-
logger$
|
|
9507
|
+
logger$8.info('WebRTC muting', { sipId: sipSession.id });
|
|
9467
9508
|
this.client.mute(sipSession);
|
|
9468
9509
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9469
9510
|
|
|
@@ -9477,14 +9518,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9477
9518
|
}
|
|
9478
9519
|
|
|
9479
9520
|
unmute(callSession , withEvent = true) {
|
|
9480
|
-
logger$
|
|
9521
|
+
logger$8.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9481
9522
|
|
|
9482
9523
|
const sipSession = this.findSipSession(callSession);
|
|
9483
9524
|
if (!sipSession) {
|
|
9484
9525
|
return;
|
|
9485
9526
|
}
|
|
9486
9527
|
|
|
9487
|
-
logger$
|
|
9528
|
+
logger$8.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9488
9529
|
this.client.unmute(sipSession);
|
|
9489
9530
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9490
9531
|
|
|
@@ -9511,7 +9552,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9511
9552
|
if (!sipSession) {
|
|
9512
9553
|
return;
|
|
9513
9554
|
}
|
|
9514
|
-
logger$
|
|
9555
|
+
logger$8.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9515
9556
|
|
|
9516
9557
|
this.client.toggleCameraOn(sipSession);
|
|
9517
9558
|
|
|
@@ -9523,7 +9564,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9523
9564
|
if (!sipSession) {
|
|
9524
9565
|
return;
|
|
9525
9566
|
}
|
|
9526
|
-
logger$
|
|
9567
|
+
logger$8.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9527
9568
|
|
|
9528
9569
|
this.client.toggleCameraOff(sipSession);
|
|
9529
9570
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9535,7 +9576,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9535
9576
|
return;
|
|
9536
9577
|
}
|
|
9537
9578
|
|
|
9538
|
-
logger$
|
|
9579
|
+
logger$8.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9539
9580
|
this.client.sendDTMF(sipSession, tone);
|
|
9540
9581
|
}
|
|
9541
9582
|
|
|
@@ -9543,7 +9584,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9543
9584
|
// @TODO: line is not used here
|
|
9544
9585
|
async makeCall(number , line , cameraEnabled ,
|
|
9545
9586
|
audioOnly = false, conference = false) {
|
|
9546
|
-
logger$
|
|
9587
|
+
logger$8.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
9547
9588
|
if (!number) {
|
|
9548
9589
|
return Promise.resolve(null);
|
|
9549
9590
|
}
|
|
@@ -9553,7 +9594,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9553
9594
|
}
|
|
9554
9595
|
if (this.currentSipSession) {
|
|
9555
9596
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9556
|
-
logger$
|
|
9597
|
+
logger$8.warn('Unable to hold current session when making another call', e);
|
|
9557
9598
|
});
|
|
9558
9599
|
}
|
|
9559
9600
|
|
|
@@ -9563,10 +9604,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9563
9604
|
this._bindEvents(sipSession);
|
|
9564
9605
|
} catch (error) {
|
|
9565
9606
|
console.warn(error);
|
|
9566
|
-
logger$
|
|
9607
|
+
logger$8.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9567
9608
|
return Promise.resolve(null);
|
|
9568
9609
|
}
|
|
9569
9610
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
9611
|
+
callSession.creationTime = new Date();
|
|
9570
9612
|
|
|
9571
9613
|
this.eventEmitter.emit(ON_PLAY_PROGRESS_SOUND, this.audioOutputDeviceId, this.audioOutputVolume);
|
|
9572
9614
|
|
|
@@ -9591,7 +9633,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9591
9633
|
return;
|
|
9592
9634
|
}
|
|
9593
9635
|
|
|
9594
|
-
logger$
|
|
9636
|
+
logger$8.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9595
9637
|
|
|
9596
9638
|
this.client.transfer(sipSession, target);
|
|
9597
9639
|
}
|
|
@@ -9600,7 +9642,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9600
9642
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9601
9643
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9602
9644
|
|
|
9603
|
-
logger$
|
|
9645
|
+
logger$8.info('WebRTC indirect transfer', {
|
|
9604
9646
|
sipId: sipSession ? sipSession.id : null,
|
|
9605
9647
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9606
9648
|
});
|
|
@@ -9639,7 +9681,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9639
9681
|
return false;
|
|
9640
9682
|
}
|
|
9641
9683
|
|
|
9642
|
-
logger$
|
|
9684
|
+
logger$8.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9643
9685
|
|
|
9644
9686
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9645
9687
|
|
|
@@ -9685,7 +9727,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9685
9727
|
endCurrentCall(callSession ) {
|
|
9686
9728
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9687
9729
|
|
|
9688
|
-
logger$
|
|
9730
|
+
logger$8.info('Ending current call', {
|
|
9689
9731
|
id: callSession ? callSession.getId() : null,
|
|
9690
9732
|
isCurrent,
|
|
9691
9733
|
});
|
|
@@ -9709,7 +9751,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9709
9751
|
}
|
|
9710
9752
|
|
|
9711
9753
|
async close() {
|
|
9712
|
-
logger$
|
|
9754
|
+
logger$8.info('WebRTC close');
|
|
9713
9755
|
|
|
9714
9756
|
try {
|
|
9715
9757
|
await Promise.race([
|
|
@@ -9717,7 +9759,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9717
9759
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9718
9760
|
]);
|
|
9719
9761
|
} catch (e) {
|
|
9720
|
-
logger$
|
|
9762
|
+
logger$8.error('WebRTC close, unregister error', e);
|
|
9721
9763
|
}
|
|
9722
9764
|
|
|
9723
9765
|
this.client.close();
|
|
@@ -9735,12 +9777,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9735
9777
|
}
|
|
9736
9778
|
|
|
9737
9779
|
enableRinging() {
|
|
9738
|
-
logger$
|
|
9780
|
+
logger$8.info('WebRTC enable ringing');
|
|
9739
9781
|
this.ringingEnabled = true;
|
|
9740
9782
|
}
|
|
9741
9783
|
|
|
9742
9784
|
disableRinging() {
|
|
9743
|
-
logger$
|
|
9785
|
+
logger$8.info('WebRTC disable ringing');
|
|
9744
9786
|
this.ringingEnabled = false;
|
|
9745
9787
|
}
|
|
9746
9788
|
|
|
@@ -9762,8 +9804,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9762
9804
|
}
|
|
9763
9805
|
|
|
9764
9806
|
const sessionId = this.incomingSessions[0];
|
|
9807
|
+
const sipSession = this.client.getSipSession(sessionId);
|
|
9808
|
+
if (!sipSession) {
|
|
9809
|
+
return null;
|
|
9810
|
+
}
|
|
9765
9811
|
|
|
9766
|
-
return this._createCallSession(
|
|
9812
|
+
return this._createCallSession(sipSession);
|
|
9767
9813
|
}
|
|
9768
9814
|
|
|
9769
9815
|
sendMessage(sipSession = null, body , contentType = 'text/plain') {
|
|
@@ -9780,7 +9826,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9780
9826
|
|
|
9781
9827
|
// Deprecated
|
|
9782
9828
|
getLocalMediaStream(callSession ) {
|
|
9783
|
-
logger$
|
|
9829
|
+
logger$8.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9784
9830
|
return this.getLocalStream(callSession);
|
|
9785
9831
|
}
|
|
9786
9832
|
|
|
@@ -9822,7 +9868,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9822
9868
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
9823
9869
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
9824
9870
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
9825
|
-
logger$
|
|
9871
|
+
logger$8.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
9826
9872
|
|
|
9827
9873
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
9828
9874
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -9841,11 +9887,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9841
9887
|
callSession);
|
|
9842
9888
|
}
|
|
9843
9889
|
|
|
9890
|
+
callSession.creationTime = new Date();
|
|
9844
9891
|
this.eventEmitter.emit(ON_CALL_INCOMING, callSession, wantsToDoVideo);
|
|
9845
9892
|
});
|
|
9846
9893
|
|
|
9847
9894
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
9848
|
-
logger$
|
|
9895
|
+
logger$8.info('WebRTC on reinvite', {
|
|
9849
9896
|
sessionId: args[0].id,
|
|
9850
9897
|
inviteId: args[1].id,
|
|
9851
9898
|
updatedCalleeName: args[2],
|
|
@@ -9865,7 +9912,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9865
9912
|
});
|
|
9866
9913
|
|
|
9867
9914
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
9868
|
-
logger$
|
|
9915
|
+
logger$8.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
9869
9916
|
|
|
9870
9917
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
9871
9918
|
|
|
@@ -9876,22 +9923,29 @@ class WebRTCPhone extends Emitter {
|
|
|
9876
9923
|
this.client.on('ended', () => {});
|
|
9877
9924
|
|
|
9878
9925
|
this.client.on(this.client.ON_ERROR, e => {
|
|
9879
|
-
logger$
|
|
9926
|
+
logger$8.error('WebRTC error', e);
|
|
9880
9927
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
9881
9928
|
});
|
|
9882
9929
|
|
|
9930
|
+
this.client.on(this.client.REJECTED, session => {
|
|
9931
|
+
logger$8.info('WebRTC call rejected', session.id);
|
|
9932
|
+
const callSession = this._createCallSession(session);
|
|
9933
|
+
callSession.endTime = new Date();
|
|
9934
|
+
this.eventEmitter.emit(ON_CALL_REJECTED, callSession);
|
|
9935
|
+
});
|
|
9936
|
+
|
|
9883
9937
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
9884
|
-
logger$
|
|
9938
|
+
logger$8.info('WebRTC unregistered');
|
|
9885
9939
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
9886
9940
|
});
|
|
9887
9941
|
|
|
9888
9942
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
9889
|
-
logger$
|
|
9890
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
9943
|
+
logger$8.info('WebRTC disconnected');
|
|
9944
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
9891
9945
|
});
|
|
9892
9946
|
|
|
9893
9947
|
this.client.on(this.client.REGISTERED, () => {
|
|
9894
|
-
logger$
|
|
9948
|
+
logger$8.info('WebRTC registered', {
|
|
9895
9949
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
9896
9950
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
9897
9951
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -9912,19 +9966,19 @@ class WebRTCPhone extends Emitter {
|
|
|
9912
9966
|
// Send reinvite with iceRestart
|
|
9913
9967
|
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
9914
9968
|
} catch (e) {
|
|
9915
|
-
logger$
|
|
9969
|
+
logger$8.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
9916
9970
|
}
|
|
9917
9971
|
}
|
|
9918
9972
|
});
|
|
9919
9973
|
|
|
9920
9974
|
this.client.on(this.client.CONNECTED, () => {
|
|
9921
|
-
logger$
|
|
9975
|
+
logger$8.info('WebRTC client connected');
|
|
9922
9976
|
|
|
9923
9977
|
this.stopHeartbeat();
|
|
9924
9978
|
});
|
|
9925
9979
|
|
|
9926
9980
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
9927
|
-
logger$
|
|
9981
|
+
logger$8.info('WebRTC client disconnected');
|
|
9928
9982
|
|
|
9929
9983
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
9930
9984
|
|
|
@@ -9938,7 +9992,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9938
9992
|
});
|
|
9939
9993
|
|
|
9940
9994
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
9941
|
-
this.eventEmitter.emit(ON_TRACK
|
|
9995
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
9942
9996
|
});
|
|
9943
9997
|
|
|
9944
9998
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -9953,7 +10007,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9953
10007
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
9954
10008
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
9955
10009
|
|
|
9956
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
10010
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
9957
10011
|
});
|
|
9958
10012
|
|
|
9959
10013
|
// Used when upgrading directly in screenshare mode
|
|
@@ -9962,7 +10016,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9962
10016
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
9963
10017
|
const callSession = this.callSessions[sipSessionId];
|
|
9964
10018
|
|
|
9965
|
-
logger$
|
|
10019
|
+
logger$8.info('Updrading directly in screensharing mode', {
|
|
9966
10020
|
sipSessionId,
|
|
9967
10021
|
tracks: localStream ? localStream.getTracks() : null,
|
|
9968
10022
|
});
|
|
@@ -10092,6 +10146,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10092
10146
|
const number = identity ? identity.uri._normal.user : null;
|
|
10093
10147
|
const { state } = sipSession || {};
|
|
10094
10148
|
const sessionId = this.getSipSessionId(sipSession);
|
|
10149
|
+
fromSession = fromSession || this.callSessions[sessionId];
|
|
10095
10150
|
|
|
10096
10151
|
const callSession = new CallSession({
|
|
10097
10152
|
callId: fromSession && fromSession.callId,
|
|
@@ -10099,6 +10154,8 @@ class WebRTCPhone extends Emitter {
|
|
|
10099
10154
|
sipStatus: state,
|
|
10100
10155
|
displayName: identity ? identity.displayName || number : number,
|
|
10101
10156
|
startTime: fromSession ? fromSession.startTime : new Date(),
|
|
10157
|
+
creationTime: fromSession ? fromSession.creationTime : null,
|
|
10158
|
+
endTime: fromSession ? fromSession.endTime : null,
|
|
10102
10159
|
answered: state === sessionState.SessionState.Established,
|
|
10103
10160
|
paused: this.client.isCallHeld(sipSession),
|
|
10104
10161
|
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
@@ -10109,6 +10166,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10109
10166
|
videoMuted: fromSession ? fromSession.isVideoMuted() : false,
|
|
10110
10167
|
recording: fromSession ? fromSession.isRecording() : false,
|
|
10111
10168
|
recordingPaused: false, // @TODO
|
|
10169
|
+
sipSession,
|
|
10112
10170
|
...extra,
|
|
10113
10171
|
});
|
|
10114
10172
|
|
|
@@ -10137,11 +10195,12 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10137
10195
|
ON_CAMERA_RESUMED: ON_CAMERA_RESUMED,
|
|
10138
10196
|
ON_CALL_CANCELED: ON_CALL_CANCELED,
|
|
10139
10197
|
ON_CALL_FAILED: ON_CALL_FAILED,
|
|
10198
|
+
ON_CALL_REJECTED: ON_CALL_REJECTED,
|
|
10140
10199
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10141
10200
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10142
10201
|
ON_MESSAGE: ON_MESSAGE,
|
|
10143
|
-
ON_REINVITE: ON_REINVITE
|
|
10144
|
-
ON_TRACK: ON_TRACK
|
|
10202
|
+
ON_REINVITE: ON_REINVITE,
|
|
10203
|
+
ON_TRACK: ON_TRACK,
|
|
10145
10204
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10146
10205
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10147
10206
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10156,19 +10215,27 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10156
10215
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10157
10216
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10158
10217
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10159
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS
|
|
10218
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10160
10219
|
ON_CHAT: ON_CHAT,
|
|
10161
10220
|
ON_SIGNAL: ON_SIGNAL,
|
|
10162
|
-
ON_DISCONNECTED: ON_DISCONNECTED
|
|
10221
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10163
10222
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10164
10223
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10165
|
-
events: events
|
|
10224
|
+
events: events,
|
|
10166
10225
|
'default': WebRTCPhone
|
|
10167
10226
|
});
|
|
10168
10227
|
|
|
10228
|
+
/* */
|
|
10229
|
+
class SFUNotAvailableError extends Error {
|
|
10230
|
+
constructor(message = 'Sorry your user is not configured to support video conference') {
|
|
10231
|
+
super(message);
|
|
10232
|
+
this.name = 'SFUNotAvailableError';
|
|
10233
|
+
}
|
|
10234
|
+
}
|
|
10235
|
+
|
|
10169
10236
|
//
|
|
10170
10237
|
|
|
10171
|
-
const logger$
|
|
10238
|
+
const logger$7 = IssueReporter$1.loggerFor('simple-phone');
|
|
10172
10239
|
const sipLogger = IssueReporter$1.loggerFor('sip.js');
|
|
10173
10240
|
const protocolLogger = IssueReporter$1.loggerFor('sip');
|
|
10174
10241
|
|
|
@@ -10275,7 +10342,7 @@ class Phone extends Emitter {
|
|
|
10275
10342
|
async disconnect() {
|
|
10276
10343
|
if (this.phone) {
|
|
10277
10344
|
if (this.phone.hasAnActiveCall()) {
|
|
10278
|
-
logger$
|
|
10345
|
+
logger$7.info('hangup call on disconnect');
|
|
10279
10346
|
// $FlowFixMe
|
|
10280
10347
|
await this.phone.hangup();
|
|
10281
10348
|
}
|
|
@@ -10298,13 +10365,13 @@ class Phone extends Emitter {
|
|
|
10298
10365
|
}
|
|
10299
10366
|
|
|
10300
10367
|
async hangup(callSession ) {
|
|
10301
|
-
logger$
|
|
10368
|
+
logger$7.info('hangup via simple phone', { callId: callSession.getId() });
|
|
10302
10369
|
|
|
10303
10370
|
return this.phone && this.phone.hangup(callSession);
|
|
10304
10371
|
}
|
|
10305
10372
|
|
|
10306
10373
|
async accept(callSession , cameraEnabled ) {
|
|
10307
|
-
logger$
|
|
10374
|
+
logger$7.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
|
|
10308
10375
|
|
|
10309
10376
|
return this.phone && this.phone.accept(callSession, cameraEnabled);
|
|
10310
10377
|
}
|
|
@@ -10343,7 +10410,7 @@ class Phone extends Emitter {
|
|
|
10343
10410
|
muteViaAPI(callSession ) {
|
|
10344
10411
|
if (callSession && callSession.callId) {
|
|
10345
10412
|
Wazo.getApiClient().calld.mute(callSession.callId).catch(e => {
|
|
10346
|
-
logger$
|
|
10413
|
+
logger$7.error('Mute via API, error', e);
|
|
10347
10414
|
});
|
|
10348
10415
|
}
|
|
10349
10416
|
}
|
|
@@ -10351,7 +10418,7 @@ class Phone extends Emitter {
|
|
|
10351
10418
|
unmuteViaAPI(callSession ) {
|
|
10352
10419
|
if (callSession && callSession.callId) {
|
|
10353
10420
|
Wazo.getApiClient().calld.unmute(callSession.callId).catch(e => {
|
|
10354
|
-
logger$
|
|
10421
|
+
logger$7.error('Unmute via API, error', e);
|
|
10355
10422
|
});
|
|
10356
10423
|
}
|
|
10357
10424
|
}
|
|
@@ -10459,7 +10526,7 @@ class Phone extends Emitter {
|
|
|
10459
10526
|
|
|
10460
10527
|
// @Deprecated
|
|
10461
10528
|
getLocalMediaStream(callSession ) {
|
|
10462
|
-
logger$
|
|
10529
|
+
logger$7.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
|
|
10463
10530
|
|
|
10464
10531
|
return this.phone && this.phone.getLocalStream(callSession);
|
|
10465
10532
|
}
|
|
@@ -10482,20 +10549,20 @@ class Phone extends Emitter {
|
|
|
10482
10549
|
|
|
10483
10550
|
// @Deprecated
|
|
10484
10551
|
getRemoteStreamForCall(callSession ) {
|
|
10485
|
-
logger$
|
|
10552
|
+
logger$7.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
|
|
10486
10553
|
return this.getRemoteStream(callSession);
|
|
10487
10554
|
}
|
|
10488
10555
|
|
|
10489
10556
|
// Returns remote streams directly from the peerConnection
|
|
10490
10557
|
// @Deprecated
|
|
10491
10558
|
getRemoteStreamsForCall(callSession ) {
|
|
10492
|
-
logger$
|
|
10559
|
+
logger$7.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
|
|
10493
10560
|
return this.getLocalStream(callSession);
|
|
10494
10561
|
}
|
|
10495
10562
|
|
|
10496
10563
|
// @Deprecated
|
|
10497
10564
|
getRemoteVideoStreamForCall(callSession ) {
|
|
10498
|
-
logger$
|
|
10565
|
+
logger$7.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
|
|
10499
10566
|
|
|
10500
10567
|
return this.getRemoteVideoStream(callSession);
|
|
10501
10568
|
}
|
|
@@ -10550,13 +10617,13 @@ class Phone extends Emitter {
|
|
|
10550
10617
|
|
|
10551
10618
|
checkSfu() {
|
|
10552
10619
|
if (!this.hasSfu()) {
|
|
10553
|
-
throw new
|
|
10620
|
+
throw new SFUNotAvailableError();
|
|
10554
10621
|
}
|
|
10555
10622
|
}
|
|
10556
10623
|
|
|
10557
10624
|
_transferEvents() {
|
|
10558
10625
|
this.unbind();
|
|
10559
|
-
[...events, ...transportEvents].forEach(event => {
|
|
10626
|
+
[...events$1, ...transportEvents].forEach(event => {
|
|
10560
10627
|
this.client.on(event, (...args) =>
|
|
10561
10628
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
10562
10629
|
});
|
|
@@ -10578,7 +10645,7 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
10578
10645
|
|
|
10579
10646
|
//
|
|
10580
10647
|
|
|
10581
|
-
const SOCKET_EVENTS = {
|
|
10648
|
+
const SOCKET_EVENTS$1 = {
|
|
10582
10649
|
ON_OPEN: 'onopen',
|
|
10583
10650
|
ON_MESSAGE: 'onmessage',
|
|
10584
10651
|
ON_ERROR: 'onerror',
|
|
@@ -10731,16 +10798,16 @@ class WebSocketClient extends Emitter {
|
|
|
10731
10798
|
|
|
10732
10799
|
this.socket.onopen = () => {
|
|
10733
10800
|
logger$6.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
10734
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
10801
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
|
|
10735
10802
|
};
|
|
10736
10803
|
|
|
10737
10804
|
this.socket.onerror = event => {
|
|
10738
10805
|
logger$6.error('on Wazo WS error', event.target);
|
|
10739
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
10806
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
|
|
10740
10807
|
};
|
|
10741
10808
|
|
|
10742
10809
|
this.socket.onmessage = (event ) => {
|
|
10743
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
10810
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
|
|
10744
10811
|
|
|
10745
10812
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
10746
10813
|
let { name } = message;
|
|
@@ -10773,11 +10840,11 @@ class WebSocketClient extends Emitter {
|
|
|
10773
10840
|
token: this.token,
|
|
10774
10841
|
});
|
|
10775
10842
|
this.initialized = false;
|
|
10776
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
10843
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
|
|
10777
10844
|
|
|
10778
10845
|
switch (event.code) {
|
|
10779
10846
|
case 4002:
|
|
10780
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
10847
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
|
|
10781
10848
|
break;
|
|
10782
10849
|
}
|
|
10783
10850
|
};
|
|
@@ -10893,7 +10960,7 @@ class WebSocketClient extends Emitter {
|
|
|
10893
10960
|
break;
|
|
10894
10961
|
case 'start':
|
|
10895
10962
|
this.initialized = true;
|
|
10896
|
-
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
10963
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
|
|
10897
10964
|
break;
|
|
10898
10965
|
default:
|
|
10899
10966
|
this.eventEmitter.emit('message', message);
|
|
@@ -10940,7 +11007,7 @@ class WebSocketClient extends Emitter {
|
|
|
10940
11007
|
logger$6.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
10941
11008
|
|
|
10942
11009
|
this.close();
|
|
10943
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11010
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
10944
11011
|
|
|
10945
11012
|
if (this.onHeartBeatTimeout) {
|
|
10946
11013
|
this.onHeartBeatTimeout();
|
|
@@ -11020,7 +11087,7 @@ WebSocketClient.eventLists = [
|
|
|
11020
11087
|
|
|
11021
11088
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
11022
11089
|
__proto__: null,
|
|
11023
|
-
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
11090
|
+
SOCKET_EVENTS: SOCKET_EVENTS$1,
|
|
11024
11091
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
11025
11092
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
11026
11093
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -11093,10 +11160,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11093
11160
|
|
|
11094
11161
|
//
|
|
11095
11162
|
|
|
11096
|
-
const { SOCKET_EVENTS
|
|
11097
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS
|
|
11163
|
+
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11164
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
11098
11165
|
|
|
11099
|
-
const logger$
|
|
11166
|
+
const logger$5 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
11100
11167
|
|
|
11101
11168
|
class Websocket extends Emitter {
|
|
11102
11169
|
|
|
@@ -11110,9 +11177,9 @@ class Websocket extends Emitter {
|
|
|
11110
11177
|
// $FlowFixMe
|
|
11111
11178
|
this[key] = OTHER_EVENTS[key];
|
|
11112
11179
|
});
|
|
11113
|
-
Object.keys(SOCKET_EVENTS
|
|
11180
|
+
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
11114
11181
|
// $FlowFixMe
|
|
11115
|
-
this[key] = SOCKET_EVENTS
|
|
11182
|
+
this[key] = SOCKET_EVENTS[key];
|
|
11116
11183
|
});
|
|
11117
11184
|
this.eventLists = WebSocketClient.eventLists;
|
|
11118
11185
|
|
|
@@ -11120,7 +11187,7 @@ class Websocket extends Emitter {
|
|
|
11120
11187
|
}
|
|
11121
11188
|
|
|
11122
11189
|
open(host , session ) {
|
|
11123
|
-
logger$
|
|
11190
|
+
logger$5.info('open simple WebSocket', { host, token: session.token });
|
|
11124
11191
|
this.ws = new WebSocketClient(
|
|
11125
11192
|
{
|
|
11126
11193
|
host,
|
|
@@ -11148,7 +11215,7 @@ class Websocket extends Emitter {
|
|
|
11148
11215
|
}
|
|
11149
11216
|
|
|
11150
11217
|
updateToken(token ) {
|
|
11151
|
-
logger$
|
|
11218
|
+
logger$5.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
11152
11219
|
|
|
11153
11220
|
if (!this.ws) {
|
|
11154
11221
|
return;
|
|
@@ -11176,7 +11243,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11176
11243
|
|
|
11177
11244
|
//
|
|
11178
11245
|
|
|
11179
|
-
const logger$
|
|
11246
|
+
const logger$4 = IssueReporter$1.loggerFor('room');
|
|
11180
11247
|
|
|
11181
11248
|
class Participant extends Emitter {
|
|
11182
11249
|
|
|
@@ -11298,7 +11365,7 @@ class Participant extends Emitter {
|
|
|
11298
11365
|
}
|
|
11299
11366
|
|
|
11300
11367
|
onTalking(isTalking ) {
|
|
11301
|
-
logger$
|
|
11368
|
+
logger$4.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
11302
11369
|
this.isTalking = isTalking;
|
|
11303
11370
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
11304
11371
|
// directly from asterisk, there's no need to do so
|
|
@@ -11401,7 +11468,7 @@ class Participant extends Emitter {
|
|
|
11401
11468
|
}
|
|
11402
11469
|
|
|
11403
11470
|
updateStatus(status , broadcast = true) {
|
|
11404
|
-
logger$
|
|
11471
|
+
logger$4.info('updating participant status', { name: this.name, status });
|
|
11405
11472
|
|
|
11406
11473
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
11407
11474
|
if (status.audioMuted) {
|
|
@@ -11449,7 +11516,7 @@ class Participant extends Emitter {
|
|
|
11449
11516
|
|
|
11450
11517
|
broadcastStatus(inboundStatus = null) {
|
|
11451
11518
|
const status = inboundStatus || this.getStatus();
|
|
11452
|
-
logger$
|
|
11519
|
+
logger$4.info('broadcasting participant status', { callId: this.callId, status });
|
|
11453
11520
|
|
|
11454
11521
|
this.room.sendSignal({
|
|
11455
11522
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|
|
@@ -11485,9 +11552,9 @@ class LocalParticipant extends Participant {
|
|
|
11485
11552
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
11486
11553
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
11487
11554
|
|
|
11488
|
-
const logger$
|
|
11555
|
+
const logger$3 = IssueReporter$1.loggerFor('sdk-room');
|
|
11489
11556
|
|
|
11490
|
-
class Room extends Emitter {
|
|
11557
|
+
class Room$1 extends Emitter {
|
|
11491
11558
|
|
|
11492
11559
|
|
|
11493
11560
|
|
|
@@ -11545,7 +11612,7 @@ class Room extends Emitter {
|
|
|
11545
11612
|
extra = {},
|
|
11546
11613
|
) {
|
|
11547
11614
|
super();
|
|
11548
|
-
logger$
|
|
11615
|
+
logger$3.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
11549
11616
|
|
|
11550
11617
|
// Represents the room callSession
|
|
11551
11618
|
this.callSession = callSession;
|
|
@@ -11611,7 +11678,7 @@ class Room extends Emitter {
|
|
|
11611
11678
|
* @returns {Promise<Room>}
|
|
11612
11679
|
*/
|
|
11613
11680
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
11614
|
-
logger$
|
|
11681
|
+
logger$3.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
11615
11682
|
|
|
11616
11683
|
if (!room) {
|
|
11617
11684
|
await Wazo.Phone.connect();
|
|
@@ -11624,7 +11691,7 @@ class Room extends Emitter {
|
|
|
11624
11691
|
|
|
11625
11692
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
11626
11693
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
11627
|
-
logger$
|
|
11694
|
+
logger$3.info('room call received via WS', { callId: data.call_id });
|
|
11628
11695
|
if (room) {
|
|
11629
11696
|
room.setCallId(data.call_id);
|
|
11630
11697
|
}
|
|
@@ -11632,7 +11699,7 @@ class Room extends Emitter {
|
|
|
11632
11699
|
|
|
11633
11700
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
11634
11701
|
// eslint-disable-next-line no-param-reassign
|
|
11635
|
-
room = new Room(callSession, extension, null, null, extra);
|
|
11702
|
+
room = new Room$1(callSession, extension, null, null, extra);
|
|
11636
11703
|
|
|
11637
11704
|
// Wait for the call to be accepted
|
|
11638
11705
|
await new Promise((resolve, reject) => {
|
|
@@ -11653,7 +11720,7 @@ class Room extends Emitter {
|
|
|
11653
11720
|
// Retrieve conference
|
|
11654
11721
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
11655
11722
|
|
|
11656
|
-
logger$
|
|
11723
|
+
logger$3.info('connected to room', {
|
|
11657
11724
|
sourceId: conference ? conference.sourceId : null,
|
|
11658
11725
|
name: conference ? conference.name : null,
|
|
11659
11726
|
});
|
|
@@ -11663,7 +11730,7 @@ class Room extends Emitter {
|
|
|
11663
11730
|
room.setName(conference.name);
|
|
11664
11731
|
}
|
|
11665
11732
|
} else if (meeting) {
|
|
11666
|
-
logger$
|
|
11733
|
+
logger$3.info('Already connected to meeting', {
|
|
11667
11734
|
uuid: meeting.uuid,
|
|
11668
11735
|
name: meeting.name,
|
|
11669
11736
|
});
|
|
@@ -11676,13 +11743,13 @@ class Room extends Emitter {
|
|
|
11676
11743
|
}
|
|
11677
11744
|
|
|
11678
11745
|
static disconnect() {
|
|
11679
|
-
logger$
|
|
11746
|
+
logger$3.info('static disconnection to room');
|
|
11680
11747
|
|
|
11681
11748
|
Wazo.Phone.disconnect();
|
|
11682
11749
|
}
|
|
11683
11750
|
|
|
11684
11751
|
async disconnect() {
|
|
11685
|
-
logger$
|
|
11752
|
+
logger$3.info('disconnection to room called');
|
|
11686
11753
|
|
|
11687
11754
|
await Wazo.Phone.hangup(this.callSession);
|
|
11688
11755
|
this.callSession = null;
|
|
@@ -11702,19 +11769,19 @@ class Room extends Emitter {
|
|
|
11702
11769
|
}
|
|
11703
11770
|
|
|
11704
11771
|
setSourceId(sourceId ) {
|
|
11705
|
-
logger$
|
|
11772
|
+
logger$3.info('set room source id', { sourceId });
|
|
11706
11773
|
|
|
11707
11774
|
this.sourceId = sourceId;
|
|
11708
11775
|
}
|
|
11709
11776
|
|
|
11710
11777
|
setMeetingUuid(meetingUuid ) {
|
|
11711
|
-
logger$
|
|
11778
|
+
logger$3.info('set meeting uuid', { meetingUuid });
|
|
11712
11779
|
|
|
11713
11780
|
this.meetingUuid = meetingUuid;
|
|
11714
11781
|
}
|
|
11715
11782
|
|
|
11716
11783
|
setCallId(callId ) {
|
|
11717
|
-
logger$
|
|
11784
|
+
logger$3.info('set room call id', { callId });
|
|
11718
11785
|
|
|
11719
11786
|
if (callId) {
|
|
11720
11787
|
this.callId = callId;
|
|
@@ -11722,7 +11789,7 @@ class Room extends Emitter {
|
|
|
11722
11789
|
}
|
|
11723
11790
|
|
|
11724
11791
|
setName(name ) {
|
|
11725
|
-
logger$
|
|
11792
|
+
logger$3.info('set room name', { name });
|
|
11726
11793
|
|
|
11727
11794
|
this.name = name;
|
|
11728
11795
|
}
|
|
@@ -11741,7 +11808,7 @@ class Room extends Emitter {
|
|
|
11741
11808
|
}
|
|
11742
11809
|
|
|
11743
11810
|
async startScreenSharing(constraints ) {
|
|
11744
|
-
logger$
|
|
11811
|
+
logger$3.info('start room screen sharing', { constraints });
|
|
11745
11812
|
|
|
11746
11813
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
11747
11814
|
if (!screensharingStream) {
|
|
@@ -11755,7 +11822,7 @@ class Room extends Emitter {
|
|
|
11755
11822
|
}
|
|
11756
11823
|
|
|
11757
11824
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
11758
|
-
logger$
|
|
11825
|
+
logger$3.info('stop room screen sharing');
|
|
11759
11826
|
|
|
11760
11827
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
11761
11828
|
|
|
@@ -11767,7 +11834,7 @@ class Room extends Emitter {
|
|
|
11767
11834
|
}
|
|
11768
11835
|
|
|
11769
11836
|
turnCameraOff() {
|
|
11770
|
-
logger$
|
|
11837
|
+
logger$3.info('turn room camera off');
|
|
11771
11838
|
|
|
11772
11839
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
11773
11840
|
|
|
@@ -11777,7 +11844,7 @@ class Room extends Emitter {
|
|
|
11777
11844
|
}
|
|
11778
11845
|
|
|
11779
11846
|
turnCameraOn() {
|
|
11780
|
-
logger$
|
|
11847
|
+
logger$3.info('turn room camera on');
|
|
11781
11848
|
|
|
11782
11849
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
11783
11850
|
|
|
@@ -11787,7 +11854,7 @@ class Room extends Emitter {
|
|
|
11787
11854
|
}
|
|
11788
11855
|
|
|
11789
11856
|
mute() {
|
|
11790
|
-
logger$
|
|
11857
|
+
logger$3.info('mute room');
|
|
11791
11858
|
|
|
11792
11859
|
Wazo.Phone.mute(this.callSession);
|
|
11793
11860
|
|
|
@@ -11795,7 +11862,7 @@ class Room extends Emitter {
|
|
|
11795
11862
|
}
|
|
11796
11863
|
|
|
11797
11864
|
unmute() {
|
|
11798
|
-
logger$
|
|
11865
|
+
logger$3.info('unmute room');
|
|
11799
11866
|
|
|
11800
11867
|
Wazo.Phone.unmute(this.callSession);
|
|
11801
11868
|
|
|
@@ -11815,7 +11882,7 @@ class Room extends Emitter {
|
|
|
11815
11882
|
}
|
|
11816
11883
|
|
|
11817
11884
|
hold() {
|
|
11818
|
-
logger$
|
|
11885
|
+
logger$3.info('hold room');
|
|
11819
11886
|
|
|
11820
11887
|
Wazo.Phone.hold(this.callSession, true);
|
|
11821
11888
|
|
|
@@ -11825,7 +11892,7 @@ class Room extends Emitter {
|
|
|
11825
11892
|
}
|
|
11826
11893
|
|
|
11827
11894
|
async resume() {
|
|
11828
|
-
logger$
|
|
11895
|
+
logger$3.info('resume room');
|
|
11829
11896
|
|
|
11830
11897
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
11831
11898
|
|
|
@@ -11853,13 +11920,13 @@ class Room extends Emitter {
|
|
|
11853
11920
|
}
|
|
11854
11921
|
|
|
11855
11922
|
sendDTMF(tone ) {
|
|
11856
|
-
logger$
|
|
11923
|
+
logger$3.info('send room DTMF', { tone });
|
|
11857
11924
|
|
|
11858
11925
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
11859
11926
|
}
|
|
11860
11927
|
|
|
11861
11928
|
async sendReinvite(newConstraints = null) {
|
|
11862
|
-
logger$
|
|
11929
|
+
logger$3.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
11863
11930
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
11864
11931
|
|
|
11865
11932
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -11918,7 +11985,7 @@ class Room extends Emitter {
|
|
|
11918
11985
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
11919
11986
|
|
|
11920
11987
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
11921
|
-
logger$
|
|
11988
|
+
logger$3.info('on room audio stream');
|
|
11922
11989
|
|
|
11923
11990
|
this.audioStream = stream;
|
|
11924
11991
|
if (!this.roomAudioElement) {
|
|
@@ -11931,7 +11998,7 @@ class Room extends Emitter {
|
|
|
11931
11998
|
});
|
|
11932
11999
|
|
|
11933
12000
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
11934
|
-
logger$
|
|
12001
|
+
logger$3.info('on room video stream', { streamId });
|
|
11935
12002
|
|
|
11936
12003
|
this._mapMsid(sipSession.body.body);
|
|
11937
12004
|
|
|
@@ -11946,7 +12013,7 @@ class Room extends Emitter {
|
|
|
11946
12013
|
});
|
|
11947
12014
|
|
|
11948
12015
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
11949
|
-
logger$
|
|
12016
|
+
logger$3.info('on room remove stream');
|
|
11950
12017
|
|
|
11951
12018
|
const participant = this.participants.find(someParticipant =>
|
|
11952
12019
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -12078,7 +12145,7 @@ class Room extends Emitter {
|
|
|
12078
12145
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
12079
12146
|
if (requester) {
|
|
12080
12147
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
12081
|
-
logger$
|
|
12148
|
+
logger$3.info('trigger room requester status', { origin });
|
|
12082
12149
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
12083
12150
|
}
|
|
12084
12151
|
break;
|
|
@@ -12109,24 +12176,24 @@ class Room extends Emitter {
|
|
|
12109
12176
|
|
|
12110
12177
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
12111
12178
|
if (participant.user_uuid === session.uuid) {
|
|
12112
|
-
logger$
|
|
12179
|
+
logger$3.info('room current user joined');
|
|
12113
12180
|
|
|
12114
12181
|
// Retrieve participants via an API calls
|
|
12115
12182
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
12116
12183
|
let response;
|
|
12117
12184
|
try {
|
|
12118
12185
|
if (this.meetingUuid) {
|
|
12119
|
-
logger$
|
|
12186
|
+
logger$3.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
12120
12187
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
12121
12188
|
} else {
|
|
12122
|
-
logger$
|
|
12189
|
+
logger$3.info('fetching conference participants', { conferenceId });
|
|
12123
12190
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
12124
12191
|
}
|
|
12125
12192
|
} catch (e) {
|
|
12126
|
-
logger$
|
|
12193
|
+
logger$3.error('room participants fetching, error', e);
|
|
12127
12194
|
}
|
|
12128
12195
|
if (response) {
|
|
12129
|
-
logger$
|
|
12196
|
+
logger$3.info('conference participants fetched', { nb: response.items.length });
|
|
12130
12197
|
participants = response.items.map(item => {
|
|
12131
12198
|
const isMe = item.call_id === this.callId;
|
|
12132
12199
|
|
|
@@ -12153,7 +12220,7 @@ class Room extends Emitter {
|
|
|
12153
12220
|
? new Wazo.RemoteParticipant(this, participant)
|
|
12154
12221
|
: null;
|
|
12155
12222
|
|
|
12156
|
-
logger$
|
|
12223
|
+
logger$3.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
12157
12224
|
|
|
12158
12225
|
if (remoteParticipant) {
|
|
12159
12226
|
this.participants.push(remoteParticipant);
|
|
@@ -12318,12 +12385,12 @@ class Room extends Emitter {
|
|
|
12318
12385
|
|
|
12319
12386
|
//
|
|
12320
12387
|
|
|
12321
|
-
const logger$
|
|
12388
|
+
const logger$2 = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
12322
12389
|
|
|
12323
|
-
class SipRoom extends Room {
|
|
12390
|
+
class SipRoom extends Room$1 {
|
|
12324
12391
|
|
|
12325
12392
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
12326
|
-
logger$
|
|
12393
|
+
logger$2.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
12327
12394
|
|
|
12328
12395
|
if (!room) {
|
|
12329
12396
|
await Wazo.Phone.connect();
|
|
@@ -12339,7 +12406,7 @@ class SipRoom extends Room {
|
|
|
12339
12406
|
room.setCallId(room.callSession.call.id);
|
|
12340
12407
|
}
|
|
12341
12408
|
|
|
12342
|
-
logger$
|
|
12409
|
+
logger$2.info('connected to room', {
|
|
12343
12410
|
extension: room.extension,
|
|
12344
12411
|
});
|
|
12345
12412
|
|
|
@@ -12347,7 +12414,7 @@ class SipRoom extends Room {
|
|
|
12347
12414
|
}
|
|
12348
12415
|
|
|
12349
12416
|
mute() {
|
|
12350
|
-
logger$
|
|
12417
|
+
logger$2.info('mute sip room');
|
|
12351
12418
|
|
|
12352
12419
|
Wazo.Phone.mute(this.callSession, false);
|
|
12353
12420
|
|
|
@@ -12355,7 +12422,7 @@ class SipRoom extends Room {
|
|
|
12355
12422
|
}
|
|
12356
12423
|
|
|
12357
12424
|
unmute() {
|
|
12358
|
-
logger$
|
|
12425
|
+
logger$2.info('unmute sip room');
|
|
12359
12426
|
|
|
12360
12427
|
Wazo.Phone.unmute(this.callSession, false);
|
|
12361
12428
|
|
|
@@ -12639,7 +12706,7 @@ class NotificationOptions {
|
|
|
12639
12706
|
|
|
12640
12707
|
|
|
12641
12708
|
// Represents a conference room, like `9000`.
|
|
12642
|
-
class Room
|
|
12709
|
+
class Room {
|
|
12643
12710
|
|
|
12644
12711
|
|
|
12645
12712
|
|
|
@@ -12660,7 +12727,7 @@ class Room$1 {
|
|
|
12660
12727
|
}
|
|
12661
12728
|
|
|
12662
12729
|
connect(callSession ) {
|
|
12663
|
-
return new Room
|
|
12730
|
+
return new Room({ ...this, connectedCallSession: callSession });
|
|
12664
12731
|
}
|
|
12665
12732
|
|
|
12666
12733
|
has(callSession ) {
|
|
@@ -12669,7 +12736,7 @@ class Room$1 {
|
|
|
12669
12736
|
|
|
12670
12737
|
addParticipant(uuid , extension , talking = null) {
|
|
12671
12738
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
12672
|
-
return new Room
|
|
12739
|
+
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12673
12740
|
}
|
|
12674
12741
|
|
|
12675
12742
|
return this;
|
|
@@ -12688,7 +12755,7 @@ class Room$1 {
|
|
|
12688
12755
|
updatedParticipants.push(participant);
|
|
12689
12756
|
}
|
|
12690
12757
|
|
|
12691
|
-
return new Room
|
|
12758
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12692
12759
|
}
|
|
12693
12760
|
|
|
12694
12761
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -12704,7 +12771,7 @@ class Room$1 {
|
|
|
12704
12771
|
updatedParticipants.push(participant);
|
|
12705
12772
|
}
|
|
12706
12773
|
|
|
12707
|
-
return new Room
|
|
12774
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12708
12775
|
}
|
|
12709
12776
|
|
|
12710
12777
|
hasCallWithId(id ) {
|
|
@@ -12712,18 +12779,18 @@ class Room$1 {
|
|
|
12712
12779
|
}
|
|
12713
12780
|
|
|
12714
12781
|
disconnect() {
|
|
12715
|
-
return new Room
|
|
12782
|
+
return new Room({ ...this, connectedCallSession: null });
|
|
12716
12783
|
}
|
|
12717
12784
|
|
|
12718
12785
|
removeParticipantWithUUID(uuid ) {
|
|
12719
|
-
return new Room
|
|
12786
|
+
return new Room({
|
|
12720
12787
|
...this,
|
|
12721
12788
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
12722
12789
|
});
|
|
12723
12790
|
}
|
|
12724
12791
|
|
|
12725
12792
|
removeParticipantWithExtension(extension ) {
|
|
12726
|
-
return new Room
|
|
12793
|
+
return new Room({
|
|
12727
12794
|
...this,
|
|
12728
12795
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
12729
12796
|
});
|
|
@@ -12734,7 +12801,7 @@ class Room$1 {
|
|
|
12734
12801
|
}
|
|
12735
12802
|
|
|
12736
12803
|
static newFrom(room ) {
|
|
12737
|
-
return newFrom(room, Room
|
|
12804
|
+
return newFrom(room, Room);
|
|
12738
12805
|
}
|
|
12739
12806
|
}
|
|
12740
12807
|
|
|
@@ -13041,11 +13108,11 @@ var wazoWebsocket = {
|
|
|
13041
13108
|
resolve();
|
|
13042
13109
|
};
|
|
13043
13110
|
|
|
13044
|
-
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
13111
|
+
client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
|
|
13045
13112
|
handleError(`Connection error : ${error}`);
|
|
13046
13113
|
});
|
|
13047
13114
|
|
|
13048
|
-
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
13115
|
+
client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
|
|
13049
13116
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
13050
13117
|
client.setOnHeartbeatTimeout(() => {
|
|
13051
13118
|
handleError('No response to heartbeat');
|
|
@@ -13146,7 +13213,7 @@ var webrtc = {
|
|
|
13146
13213
|
}),
|
|
13147
13214
|
};
|
|
13148
13215
|
|
|
13149
|
-
const parseCandidate
|
|
13216
|
+
const parseCandidate = line => {
|
|
13150
13217
|
let parts;
|
|
13151
13218
|
// Parse both variants.
|
|
13152
13219
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -13237,7 +13304,7 @@ var SymmetricNat = {
|
|
|
13237
13304
|
}
|
|
13238
13305
|
|
|
13239
13306
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
13240
|
-
const cand = parseCandidate
|
|
13307
|
+
const cand = parseCandidate(e.candidate.candidate);
|
|
13241
13308
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
13242
13309
|
candidates[cand.relatedPort].push(cand.port);
|
|
13243
13310
|
} else if (!e.candidate) {
|
|
@@ -13305,7 +13372,7 @@ var iceIpv4 = {
|
|
|
13305
13372
|
const rawCandidate = e.candidate.candidate;
|
|
13306
13373
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
13307
13374
|
hasSrflxOrRelay = true;
|
|
13308
|
-
const candidate = parseCandidate
|
|
13375
|
+
const candidate = parseCandidate(e.candidate.candidate);
|
|
13309
13376
|
ips.push(candidate.ip);
|
|
13310
13377
|
}
|
|
13311
13378
|
} else if (!e.candidate) {
|
|
@@ -13342,7 +13409,7 @@ var checks = [
|
|
|
13342
13409
|
|
|
13343
13410
|
//
|
|
13344
13411
|
|
|
13345
|
-
const logger$
|
|
13412
|
+
const logger$1 = IssueReporter$1.loggerFor('engine-check');
|
|
13346
13413
|
|
|
13347
13414
|
class Checker {
|
|
13348
13415
|
|
|
@@ -13360,28 +13427,28 @@ class Checker {
|
|
|
13360
13427
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
13361
13428
|
await this._addEngineVersion();
|
|
13362
13429
|
|
|
13363
|
-
logger$
|
|
13430
|
+
logger$1.info('Engine check starting');
|
|
13364
13431
|
|
|
13365
13432
|
for (let i = 0; i < this.checks.length; i++) {
|
|
13366
13433
|
const { name, check } = this.checks[i];
|
|
13367
13434
|
|
|
13368
|
-
logger$
|
|
13435
|
+
logger$1.info(`Checking ${name} ...`);
|
|
13369
13436
|
|
|
13370
13437
|
onCheckBegin(name);
|
|
13371
13438
|
try {
|
|
13372
13439
|
// eslint-disable-next-line no-await-in-loop
|
|
13373
13440
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
13374
|
-
logger$
|
|
13441
|
+
logger$1.info(`Checking ${name} success.`, { result });
|
|
13375
13442
|
|
|
13376
13443
|
onCheckResult(name, result);
|
|
13377
13444
|
} catch (e) {
|
|
13378
|
-
logger$
|
|
13445
|
+
logger$1.info(`Checking ${name} failure`, { message: e.message });
|
|
13379
13446
|
|
|
13380
13447
|
onCheckResult(name, e);
|
|
13381
13448
|
}
|
|
13382
13449
|
}
|
|
13383
13450
|
|
|
13384
|
-
logger$
|
|
13451
|
+
logger$1.info('Engine check done.');
|
|
13385
13452
|
}
|
|
13386
13453
|
|
|
13387
13454
|
addCheck(check ) {
|
|
@@ -13405,7 +13472,7 @@ const Wazo = {
|
|
|
13405
13472
|
Auth: Auth$1,
|
|
13406
13473
|
Phone: Phone$1,
|
|
13407
13474
|
Websocket: Websocket$1,
|
|
13408
|
-
Room,
|
|
13475
|
+
Room: Room$1,
|
|
13409
13476
|
SipRoom,
|
|
13410
13477
|
RemoteParticipant,
|
|
13411
13478
|
LocalParticipant,
|
|
@@ -13438,7 +13505,7 @@ const Wazo = {
|
|
|
13438
13505
|
Session,
|
|
13439
13506
|
Voicemail,
|
|
13440
13507
|
Relocation,
|
|
13441
|
-
ConferenceRoom: Room
|
|
13508
|
+
ConferenceRoom: Room,
|
|
13442
13509
|
CallSession,
|
|
13443
13510
|
IndirectTransfer,
|
|
13444
13511
|
SwitchboardCall,
|
|
@@ -13463,6 +13530,7 @@ const Wazo = {
|
|
|
13463
13530
|
InvalidSubscription,
|
|
13464
13531
|
InvalidAuthorization,
|
|
13465
13532
|
CanceledCallError,
|
|
13533
|
+
SFUNotAvailableError,
|
|
13466
13534
|
};
|
|
13467
13535
|
|
|
13468
13536
|
if (window) {
|
|
@@ -13477,7 +13545,7 @@ if (global) {
|
|
|
13477
13545
|
class InvalidSubscription extends Error {}
|
|
13478
13546
|
class InvalidAuthorization extends Error {}
|
|
13479
13547
|
|
|
13480
|
-
const logger
|
|
13548
|
+
const logger = IssueReporter$1.loggerFor('simple-auth');
|
|
13481
13549
|
|
|
13482
13550
|
class Auth {
|
|
13483
13551
|
|
|
@@ -13512,7 +13580,7 @@ class Auth {
|
|
|
13512
13580
|
setApiClientId(this.clientId);
|
|
13513
13581
|
setRefreshExpiration(this.expiration);
|
|
13514
13582
|
setOnRefreshToken((token , session ) => {
|
|
13515
|
-
logger
|
|
13583
|
+
logger.info('on refresh token done', { token });
|
|
13516
13584
|
setApiToken(token);
|
|
13517
13585
|
Wazo.Websocket.updateToken(token);
|
|
13518
13586
|
|
|
@@ -13557,7 +13625,7 @@ class Auth {
|
|
|
13557
13625
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
13558
13626
|
return this._onAuthenticated(rawSession);
|
|
13559
13627
|
} catch (e) {
|
|
13560
|
-
logger
|
|
13628
|
+
logger.error('on validate token error', e);
|
|
13561
13629
|
console.warn(e);
|
|
13562
13630
|
return false;
|
|
13563
13631
|
}
|