@wazo/sdk 0.37.23 → 0.37.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wazo-sdk.js +6 -6
- package/esm/__tests__/api-client.test.js +22 -17
- package/esm/__tests__/web-rtc-client.test.js +105 -100
- package/esm/api/amid.js +1 -1
- package/esm/api/call-logd.js +2 -2
- package/esm/api/confd.js +10 -5
- package/esm/api/ctid-ng.js +3 -3
- package/esm/api/dird.js +1 -1
- package/esm/api/webhookd.js +1 -1
- package/esm/api-client.js +22 -17
- package/esm/checker/Checker.js +130 -125
- package/esm/checker/checks/aor.js +22 -17
- package/esm/checker/checks/api.js +22 -17
- package/esm/checker/checks/index.js +120 -115
- package/esm/checker/checks/wazo-websocket.js +15 -15
- package/esm/checker/checks/webrtc-transport.js +105 -100
- package/esm/checker/checks/webrtc.js +105 -100
- package/esm/domain/AdHocAPIConference.js +22 -17
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/Contact.js +1 -1
- package/esm/domain/Features.js +22 -17
- package/esm/domain/Meeting.js +12 -5
- package/esm/domain/Phone/CTIPhone.js +36 -31
- package/esm/domain/Phone/WebRTCPhone.js +110 -87
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/Contact.test.js +1 -1
- package/esm/domain/__tests__/Meeting.test.js +144 -0
- package/esm/index.js +365 -337
- package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
- package/esm/service/CallApi.js +22 -17
- package/esm/service/IssueReporter.js +1 -1
- package/esm/service/__tests__/IssueReporter.test.js +1 -1
- package/esm/service/getApiClient.js +22 -17
- package/esm/simple/Auth.js +355 -327
- package/esm/simple/Configuration.js +355 -327
- package/esm/simple/Directory.js +22 -17
- package/esm/simple/Phone.js +355 -327
- package/esm/simple/Websocket.js +17 -17
- package/esm/simple/index.js +359 -331
- package/esm/simple/room/LocalParticipant.js +359 -331
- package/esm/simple/room/Participant.js +359 -331
- package/esm/simple/room/RemoteParticipant.js +359 -331
- package/esm/simple/room/Room.js +360 -332
- package/esm/simple/room/SipRoom.js +359 -331
- package/esm/simple/room/Stream.js +359 -331
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/esm/simple/utils.js +359 -331
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/web-rtc-client.js +105 -100
- package/esm/websocket-client.js +15 -15
- package/lib/__tests__/api-client.test.js +22 -17
- package/lib/__tests__/web-rtc-client.test.js +105 -100
- package/lib/api/amid.js +1 -1
- package/lib/api/call-logd.js +2 -2
- package/lib/api/confd.js +10 -5
- package/lib/api/ctid-ng.js +3 -3
- package/lib/api/dird.js +1 -1
- package/lib/api/webhookd.js +1 -1
- package/lib/api-client.js +22 -17
- package/lib/checker/Checker.js +130 -125
- package/lib/checker/checks/aor.js +22 -17
- package/lib/checker/checks/api.js +22 -17
- package/lib/checker/checks/index.js +120 -115
- package/lib/checker/checks/wazo-websocket.js +15 -15
- package/lib/checker/checks/webrtc-transport.js +105 -100
- package/lib/checker/checks/webrtc.js +105 -100
- package/lib/domain/AdHocAPIConference.js +22 -17
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +22 -17
- package/lib/domain/Meeting.js +16 -5
- package/lib/domain/Phone/CTIPhone.js +36 -31
- package/lib/domain/Phone/WebRTCPhone.js +110 -87
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/Contact.test.js +1 -1
- package/lib/domain/__tests__/Meeting.test.js +150 -0
- package/lib/index.js +365 -337
- package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
- package/lib/service/CallApi.js +22 -17
- package/lib/service/IssueReporter.js +1 -1
- package/lib/service/__tests__/IssueReporter.test.js +1 -1
- package/lib/service/getApiClient.js +22 -17
- package/lib/simple/Auth.js +355 -327
- package/lib/simple/Configuration.js +355 -327
- package/lib/simple/Directory.js +22 -17
- package/lib/simple/Phone.js +355 -327
- package/lib/simple/Websocket.js +17 -17
- package/lib/simple/index.js +359 -331
- package/lib/simple/room/LocalParticipant.js +359 -331
- package/lib/simple/room/Participant.js +359 -331
- package/lib/simple/room/RemoteParticipant.js +359 -331
- package/lib/simple/room/Room.js +360 -332
- package/lib/simple/room/SipRoom.js +359 -331
- package/lib/simple/room/Stream.js +359 -331
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/lib/simple/utils.js +359 -331
- package/lib/types/WebSocketMessage.js +2 -0
- package/lib/web-rtc-client.js +105 -100
- package/lib/websocket-client.js +15 -15
- package/package.json +1 -1
- package/src/domain/Meeting.js +12 -5
- package/src/domain/Phone/WebRTCPhone.js +24 -1
- package/src/domain/__tests__/Meeting.test.js +50 -0
package/lib/simple/Phone.js
CHANGED
|
@@ -1034,7 +1034,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
1034
1034
|
|
|
1035
1035
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
1036
1036
|
|
|
1037
|
-
const logger
|
|
1037
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1038
1038
|
|
|
1039
1039
|
// Use a function here to be able to mock it in tests
|
|
1040
1040
|
const realFetch = () => {
|
|
@@ -1173,7 +1173,7 @@ class ApiRequester {
|
|
|
1173
1173
|
};
|
|
1174
1174
|
|
|
1175
1175
|
if (this.refreshTokenPromise) {
|
|
1176
|
-
logger
|
|
1176
|
+
logger.info('A token is already refreshing, waiting ...', { url });
|
|
1177
1177
|
await this.refreshTokenPromise;
|
|
1178
1178
|
}
|
|
1179
1179
|
|
|
@@ -1193,7 +1193,7 @@ class ApiRequester {
|
|
|
1193
1193
|
return promise.then(async (err ) => {
|
|
1194
1194
|
// Check if the token is still valid
|
|
1195
1195
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
1196
|
-
logger
|
|
1196
|
+
logger.warn('token expired', { error: err.reason });
|
|
1197
1197
|
// Replay the call after refreshing the token
|
|
1198
1198
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
1199
1199
|
}
|
|
@@ -1203,7 +1203,7 @@ class ApiRequester {
|
|
|
1203
1203
|
: exceptionClass.fromResponse(err, response.status);
|
|
1204
1204
|
|
|
1205
1205
|
if (this.shouldLogErrors) {
|
|
1206
|
-
logger
|
|
1206
|
+
logger.error('API error', error);
|
|
1207
1207
|
}
|
|
1208
1208
|
|
|
1209
1209
|
throw error;
|
|
@@ -1213,7 +1213,7 @@ class ApiRequester {
|
|
|
1213
1213
|
return newParse(response, isJson);
|
|
1214
1214
|
}).catch(error => {
|
|
1215
1215
|
if (this.shouldLogErrors) {
|
|
1216
|
-
logger
|
|
1216
|
+
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
1217
1217
|
}
|
|
1218
1218
|
|
|
1219
1219
|
throw error;
|
|
@@ -1241,13 +1241,13 @@ class ApiRequester {
|
|
|
1241
1241
|
) {
|
|
1242
1242
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
1243
1243
|
let newPath = path;
|
|
1244
|
-
logger
|
|
1244
|
+
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
1245
1245
|
|
|
1246
1246
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
1247
1247
|
|
|
1248
1248
|
return this.refreshTokenPromise.then(() => {
|
|
1249
1249
|
this.refreshTokenPromise = null;
|
|
1250
|
-
logger
|
|
1250
|
+
logger.info('token refreshed', { isTokenNotFound });
|
|
1251
1251
|
if (isTokenNotFound) {
|
|
1252
1252
|
const pathParts = path.split('/');
|
|
1253
1253
|
pathParts.pop();
|
|
@@ -3194,8 +3194,9 @@ class ExternalApp {
|
|
|
3194
3194
|
|
|
3195
3195
|
|
|
3196
3196
|
|
|
3197
|
-
|
|
3197
|
+
|
|
3198
3198
|
|
|
3199
|
+
|
|
3199
3200
|
|
|
3200
3201
|
|
|
3201
3202
|
class Meeting {
|
|
@@ -3206,9 +3207,10 @@ class Meeting {
|
|
|
3206
3207
|
|
|
3207
3208
|
|
|
3208
3209
|
|
|
3209
|
-
|
|
3210
|
+
|
|
3210
3211
|
|
|
3211
3212
|
|
|
3213
|
+
|
|
3212
3214
|
|
|
3213
3215
|
static parse(plain ) {
|
|
3214
3216
|
return new Meeting({
|
|
@@ -3218,8 +3220,9 @@ class Meeting {
|
|
|
3218
3220
|
ownerUuids: plain.owner_uuids,
|
|
3219
3221
|
port: plain.port,
|
|
3220
3222
|
uuid: plain.uuid,
|
|
3221
|
-
|
|
3223
|
+
extension: plain.exten,
|
|
3222
3224
|
persistent: plain.persistent,
|
|
3225
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
3223
3226
|
});
|
|
3224
3227
|
}
|
|
3225
3228
|
|
|
@@ -3241,8 +3244,9 @@ class Meeting {
|
|
|
3241
3244
|
ownerUuids,
|
|
3242
3245
|
port,
|
|
3243
3246
|
uri,
|
|
3244
|
-
|
|
3247
|
+
extension,
|
|
3245
3248
|
persistent,
|
|
3249
|
+
creationTime,
|
|
3246
3250
|
} = {}) {
|
|
3247
3251
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
3248
3252
|
this.uri = uri;
|
|
@@ -3250,8 +3254,9 @@ class Meeting {
|
|
|
3250
3254
|
this.ownerUuids = ownerUuids;
|
|
3251
3255
|
this.port = port;
|
|
3252
3256
|
this.uuid = uuid;
|
|
3253
|
-
this.
|
|
3257
|
+
this.extension = extension;
|
|
3254
3258
|
this.persistent = persistent;
|
|
3259
|
+
this.creationTime = creationTime;
|
|
3255
3260
|
|
|
3256
3261
|
// Useful to compare instead of instanceof with minified code
|
|
3257
3262
|
this.type = 'Meeting';
|
|
@@ -4058,7 +4063,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4058
4063
|
|
|
4059
4064
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4060
4065
|
|
|
4061
|
-
const logger$
|
|
4066
|
+
const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4062
4067
|
|
|
4063
4068
|
class CTIPhone extends Emitter {
|
|
4064
4069
|
|
|
@@ -4071,7 +4076,7 @@ class CTIPhone extends Emitter {
|
|
|
4071
4076
|
|
|
4072
4077
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4073
4078
|
super();
|
|
4074
|
-
logger$
|
|
4079
|
+
logger$1.info('CTI Phone created');
|
|
4075
4080
|
this.session = session;
|
|
4076
4081
|
this.isMobile = isMobile;
|
|
4077
4082
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4132,7 +4137,7 @@ class CTIPhone extends Emitter {
|
|
|
4132
4137
|
}
|
|
4133
4138
|
|
|
4134
4139
|
async makeCall(number , line ) {
|
|
4135
|
-
logger$
|
|
4140
|
+
logger$1.info('make CTI call', { number });
|
|
4136
4141
|
|
|
4137
4142
|
if (!number) {
|
|
4138
4143
|
return null;
|
|
@@ -4155,7 +4160,7 @@ class CTIPhone extends Emitter {
|
|
|
4155
4160
|
if (!callSession) {
|
|
4156
4161
|
return Promise.resolve(null);
|
|
4157
4162
|
}
|
|
4158
|
-
logger$
|
|
4163
|
+
logger$1.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4159
4164
|
|
|
4160
4165
|
if (!this.currentCall) {
|
|
4161
4166
|
this.currentCall = callSession.call;
|
|
@@ -4168,7 +4173,7 @@ class CTIPhone extends Emitter {
|
|
|
4168
4173
|
if (!callSession) {
|
|
4169
4174
|
return;
|
|
4170
4175
|
}
|
|
4171
|
-
logger$
|
|
4176
|
+
logger$1.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4172
4177
|
|
|
4173
4178
|
this.currentCall = undefined;
|
|
4174
4179
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4178,7 +4183,7 @@ class CTIPhone extends Emitter {
|
|
|
4178
4183
|
if (!callSession) {
|
|
4179
4184
|
return Promise.resolve(false);
|
|
4180
4185
|
}
|
|
4181
|
-
logger$
|
|
4186
|
+
logger$1.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4182
4187
|
|
|
4183
4188
|
try {
|
|
4184
4189
|
await CallApi.cancelCall(callSession);
|
|
@@ -4189,7 +4194,7 @@ class CTIPhone extends Emitter {
|
|
|
4189
4194
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4190
4195
|
return true;
|
|
4191
4196
|
} catch (e) {
|
|
4192
|
-
logger$
|
|
4197
|
+
logger$1.error('hangup CTI call, error', e);
|
|
4193
4198
|
|
|
4194
4199
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4195
4200
|
return false;
|
|
@@ -4202,7 +4207,7 @@ class CTIPhone extends Emitter {
|
|
|
4202
4207
|
if (!callSession) {
|
|
4203
4208
|
return;
|
|
4204
4209
|
}
|
|
4205
|
-
logger$
|
|
4210
|
+
logger$1.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4206
4211
|
|
|
4207
4212
|
await CallApi.cancelCall(callSession);
|
|
4208
4213
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4212,7 +4217,7 @@ class CTIPhone extends Emitter {
|
|
|
4212
4217
|
if (!callSession) {
|
|
4213
4218
|
return;
|
|
4214
4219
|
}
|
|
4215
|
-
logger$
|
|
4220
|
+
logger$1.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4216
4221
|
|
|
4217
4222
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4218
4223
|
}
|
|
@@ -4225,19 +4230,19 @@ class CTIPhone extends Emitter {
|
|
|
4225
4230
|
if (!callSession) {
|
|
4226
4231
|
return;
|
|
4227
4232
|
}
|
|
4228
|
-
logger$
|
|
4233
|
+
logger$1.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4229
4234
|
|
|
4230
4235
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4231
4236
|
}
|
|
4232
4237
|
|
|
4233
4238
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4234
|
-
logger$
|
|
4239
|
+
logger$1.info('cancel CTI transfer', { transferId });
|
|
4235
4240
|
|
|
4236
4241
|
return CallApi.cancelCallTransfer(transferId);
|
|
4237
4242
|
}
|
|
4238
4243
|
|
|
4239
4244
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4240
|
-
logger$
|
|
4245
|
+
logger$1.info('confirm CTI transfer', { transferId });
|
|
4241
4246
|
|
|
4242
4247
|
return CallApi.confirmCallTransfer(transferId);
|
|
4243
4248
|
}
|
|
@@ -4246,19 +4251,19 @@ class CTIPhone extends Emitter {
|
|
|
4246
4251
|
if (!callSession) {
|
|
4247
4252
|
return;
|
|
4248
4253
|
}
|
|
4249
|
-
logger$
|
|
4254
|
+
logger$1.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4250
4255
|
|
|
4251
4256
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4252
4257
|
}
|
|
4253
4258
|
|
|
4254
4259
|
onConnectionMade() {
|
|
4255
|
-
logger$
|
|
4260
|
+
logger$1.info('on CTI connection made');
|
|
4256
4261
|
|
|
4257
4262
|
this.eventEmitter.emit('onCallAccepted');
|
|
4258
4263
|
}
|
|
4259
4264
|
|
|
4260
4265
|
async close() {
|
|
4261
|
-
logger$
|
|
4266
|
+
logger$1.info('CTI close');
|
|
4262
4267
|
|
|
4263
4268
|
return Promise.resolve();
|
|
4264
4269
|
}
|
|
@@ -4267,7 +4272,7 @@ class CTIPhone extends Emitter {
|
|
|
4267
4272
|
if (!callSession) {
|
|
4268
4273
|
return;
|
|
4269
4274
|
}
|
|
4270
|
-
logger$
|
|
4275
|
+
logger$1.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4271
4276
|
|
|
4272
4277
|
return CallApi.hold(callSession.callId);
|
|
4273
4278
|
}
|
|
@@ -4276,7 +4281,7 @@ class CTIPhone extends Emitter {
|
|
|
4276
4281
|
if (!callSession) {
|
|
4277
4282
|
return;
|
|
4278
4283
|
}
|
|
4279
|
-
logger$
|
|
4284
|
+
logger$1.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4280
4285
|
|
|
4281
4286
|
return CallApi.resume(callSession.callId);
|
|
4282
4287
|
}
|
|
@@ -4285,7 +4290,7 @@ class CTIPhone extends Emitter {
|
|
|
4285
4290
|
if (!callSession) {
|
|
4286
4291
|
return;
|
|
4287
4292
|
}
|
|
4288
|
-
logger$
|
|
4293
|
+
logger$1.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4289
4294
|
|
|
4290
4295
|
return CallApi.mute(callSession.callId);
|
|
4291
4296
|
}
|
|
@@ -4294,7 +4299,7 @@ class CTIPhone extends Emitter {
|
|
|
4294
4299
|
if (!callSession) {
|
|
4295
4300
|
return;
|
|
4296
4301
|
}
|
|
4297
|
-
logger$
|
|
4302
|
+
logger$1.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4298
4303
|
|
|
4299
4304
|
return CallApi.unmute(callSession.callId);
|
|
4300
4305
|
}
|
|
@@ -5303,7 +5308,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5303
5308
|
const WEBHOOKD_VERSION = '1.0';
|
|
5304
5309
|
const AMID_VERSION = '1.0';
|
|
5305
5310
|
|
|
5306
|
-
const logger$
|
|
5311
|
+
const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5307
5312
|
|
|
5308
5313
|
class ApiClient {
|
|
5309
5314
|
|
|
@@ -5355,12 +5360,12 @@ class ApiClient {
|
|
|
5355
5360
|
}
|
|
5356
5361
|
|
|
5357
5362
|
async forceRefreshToken() {
|
|
5358
|
-
logger$
|
|
5363
|
+
logger$2.info('forcing refresh token, calling callback');
|
|
5359
5364
|
return this.refreshTokenCallback();
|
|
5360
5365
|
}
|
|
5361
5366
|
|
|
5362
5367
|
async refreshTokenCallback() {
|
|
5363
|
-
logger$
|
|
5368
|
+
logger$2.info('refresh token callback called', {
|
|
5364
5369
|
refreshToken: this.refreshToken,
|
|
5365
5370
|
refreshBackend: this.refreshBackend,
|
|
5366
5371
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5378,7 +5383,7 @@ class ApiClient {
|
|
|
5378
5383
|
this.isMobile,
|
|
5379
5384
|
);
|
|
5380
5385
|
|
|
5381
|
-
logger$
|
|
5386
|
+
logger$2.info('token refreshed', { token: session.token });
|
|
5382
5387
|
|
|
5383
5388
|
if (this.onRefreshToken) {
|
|
5384
5389
|
this.onRefreshToken(session.token, session);
|
|
@@ -5691,7 +5696,7 @@ class AdHocAPIConference {
|
|
|
5691
5696
|
|
|
5692
5697
|
/* */
|
|
5693
5698
|
|
|
5694
|
-
const parseCandidate
|
|
5699
|
+
const parseCandidate = (candidate ) => {
|
|
5695
5700
|
if (!candidate) {
|
|
5696
5701
|
return null;
|
|
5697
5702
|
}
|
|
@@ -5845,7 +5850,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5845
5850
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
5846
5851
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
5847
5852
|
if (event.candidate) {
|
|
5848
|
-
this.gatheredCandidates.push(parseCandidate
|
|
5853
|
+
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
5849
5854
|
}
|
|
5850
5855
|
};
|
|
5851
5856
|
|
|
@@ -6309,7 +6314,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6309
6314
|
const SEND_STATS_DELAY = 5000;
|
|
6310
6315
|
|
|
6311
6316
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6312
|
-
const logger$
|
|
6317
|
+
const logger$3 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6313
6318
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6314
6319
|
|
|
6315
6320
|
// events
|
|
@@ -6323,14 +6328,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6323
6328
|
const MESSAGE = 'message';
|
|
6324
6329
|
const ACCEPTED = 'accepted';
|
|
6325
6330
|
const REJECTED = 'rejected';
|
|
6326
|
-
const ON_TRACK
|
|
6327
|
-
const ON_REINVITE
|
|
6331
|
+
const ON_TRACK = 'onTrack';
|
|
6332
|
+
const ON_REINVITE = 'reinvite';
|
|
6328
6333
|
const ON_ERROR = 'onError';
|
|
6329
6334
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6330
|
-
const ON_NETWORK_STATS
|
|
6331
|
-
const ON_DISCONNECTED
|
|
6335
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6336
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
6332
6337
|
|
|
6333
|
-
const events
|
|
6338
|
+
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6334
6339
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6335
6340
|
class CanceledCallError extends Error {}
|
|
6336
6341
|
|
|
@@ -6466,12 +6471,12 @@ class WebRTCClient extends Emitter {
|
|
|
6466
6471
|
this.MESSAGE = MESSAGE;
|
|
6467
6472
|
this.ACCEPTED = ACCEPTED;
|
|
6468
6473
|
this.REJECTED = REJECTED;
|
|
6469
|
-
this.ON_TRACK = ON_TRACK
|
|
6470
|
-
this.ON_REINVITE = ON_REINVITE
|
|
6474
|
+
this.ON_TRACK = ON_TRACK;
|
|
6475
|
+
this.ON_REINVITE = ON_REINVITE;
|
|
6471
6476
|
this.ON_ERROR = ON_ERROR;
|
|
6472
6477
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6473
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS
|
|
6474
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED
|
|
6478
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6479
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6475
6480
|
}
|
|
6476
6481
|
|
|
6477
6482
|
configureMedia(media ) {
|
|
@@ -6488,13 +6493,13 @@ class WebRTCClient extends Emitter {
|
|
|
6488
6493
|
|
|
6489
6494
|
createUserAgent(configOverrides ) {
|
|
6490
6495
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6491
|
-
logger$
|
|
6496
|
+
logger$3.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6492
6497
|
|
|
6493
6498
|
webRTCConfiguration.delegate = {
|
|
6494
6499
|
onConnect: this.onConnect.bind(this),
|
|
6495
6500
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6496
6501
|
onInvite: (invitation ) => {
|
|
6497
|
-
logger$
|
|
6502
|
+
logger$3.info('sdk webrtc on invite', {
|
|
6498
6503
|
method: 'delegate.onInvite',
|
|
6499
6504
|
id: invitation.id,
|
|
6500
6505
|
remoteURI: invitation.remoteURI,
|
|
@@ -6537,7 +6542,7 @@ class WebRTCClient extends Emitter {
|
|
|
6537
6542
|
}
|
|
6538
6543
|
|
|
6539
6544
|
onConnect() {
|
|
6540
|
-
logger$
|
|
6545
|
+
logger$3.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6541
6546
|
this.eventEmitter.emit(CONNECTED);
|
|
6542
6547
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6543
6548
|
this.registerer.waitingToggle(false);
|
|
@@ -6546,7 +6551,7 @@ class WebRTCClient extends Emitter {
|
|
|
6546
6551
|
}
|
|
6547
6552
|
|
|
6548
6553
|
async onDisconnect(error ) {
|
|
6549
|
-
logger$
|
|
6554
|
+
logger$3.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6550
6555
|
this.connectionPromise = null;
|
|
6551
6556
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6552
6557
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6571,37 +6576,37 @@ class WebRTCClient extends Emitter {
|
|
|
6571
6576
|
};
|
|
6572
6577
|
|
|
6573
6578
|
if (this.skipRegister) {
|
|
6574
|
-
logger$
|
|
6579
|
+
logger$3.info('sdk webrtc skip register...', logInfo);
|
|
6575
6580
|
return Promise.resolve();
|
|
6576
6581
|
}
|
|
6577
6582
|
|
|
6578
|
-
logger$
|
|
6583
|
+
logger$3.info('sdk webrtc registering...', logInfo);
|
|
6579
6584
|
|
|
6580
6585
|
if (!this.userAgent) {
|
|
6581
|
-
logger$
|
|
6586
|
+
logger$3.info('sdk webrtc recreating User Agent');
|
|
6582
6587
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6583
6588
|
}
|
|
6584
6589
|
if (!this.userAgent || this.isRegistered()) {
|
|
6585
|
-
logger$
|
|
6590
|
+
logger$3.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6586
6591
|
return Promise.resolve();
|
|
6587
6592
|
}
|
|
6588
6593
|
|
|
6589
6594
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6590
|
-
logger$
|
|
6595
|
+
logger$3.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6591
6596
|
return Promise.resolve();
|
|
6592
6597
|
}
|
|
6593
6598
|
|
|
6594
6599
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6595
6600
|
|
|
6596
6601
|
const onRegisterFailed = () => {
|
|
6597
|
-
logger$
|
|
6602
|
+
logger$3.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6598
6603
|
this.connectionPromise = null;
|
|
6599
6604
|
if (this.registerer && this.registerer.waiting) {
|
|
6600
6605
|
this.registerer.waitingToggle(false);
|
|
6601
6606
|
}
|
|
6602
6607
|
|
|
6603
6608
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6604
|
-
logger$
|
|
6609
|
+
logger$3.info('sdk webrtc registering, retrying...', { tries });
|
|
6605
6610
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6606
6611
|
}
|
|
6607
6612
|
};
|
|
@@ -6610,18 +6615,18 @@ class WebRTCClient extends Emitter {
|
|
|
6610
6615
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6611
6616
|
// during the resolution of the primise.
|
|
6612
6617
|
if (!this.userAgent) {
|
|
6613
|
-
logger$
|
|
6618
|
+
logger$3.info('sdk webrtc recreating User Agent after connection');
|
|
6614
6619
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6615
6620
|
}
|
|
6616
6621
|
|
|
6617
|
-
logger$
|
|
6622
|
+
logger$3.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6618
6623
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
6619
6624
|
this.connectionPromise = null;
|
|
6620
6625
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6621
6626
|
|
|
6622
6627
|
// Bind registerer events
|
|
6623
6628
|
this.registerer.stateChange.addListener(newState => {
|
|
6624
|
-
logger$
|
|
6629
|
+
logger$3.info('sdk webrtc registering, state changed', { newState });
|
|
6625
6630
|
|
|
6626
6631
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
6627
6632
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -6634,7 +6639,7 @@ class WebRTCClient extends Emitter {
|
|
|
6634
6639
|
const options = {
|
|
6635
6640
|
requestDelegate: {
|
|
6636
6641
|
onReject: response => {
|
|
6637
|
-
logger$
|
|
6642
|
+
logger$3.error('sdk webrtc registering, rejected', { response });
|
|
6638
6643
|
|
|
6639
6644
|
onRegisterFailed();
|
|
6640
6645
|
},
|
|
@@ -6642,13 +6647,13 @@ class WebRTCClient extends Emitter {
|
|
|
6642
6647
|
};
|
|
6643
6648
|
|
|
6644
6649
|
return this.registerer.register(options).catch((e) => {
|
|
6645
|
-
logger$
|
|
6650
|
+
logger$3.error('sdk webrtc registering, error', e);
|
|
6646
6651
|
|
|
6647
6652
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6648
6653
|
return e;
|
|
6649
6654
|
});
|
|
6650
6655
|
}).catch(error => {
|
|
6651
|
-
logger$
|
|
6656
|
+
logger$3.error('sdk webrtc registering, transport error', error);
|
|
6652
6657
|
onRegisterFailed();
|
|
6653
6658
|
});
|
|
6654
6659
|
}
|
|
@@ -6677,21 +6682,21 @@ class WebRTCClient extends Emitter {
|
|
|
6677
6682
|
}
|
|
6678
6683
|
|
|
6679
6684
|
unregister() {
|
|
6680
|
-
logger$
|
|
6685
|
+
logger$3.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6681
6686
|
if (!this.registerer) {
|
|
6682
6687
|
return Promise.resolve();
|
|
6683
6688
|
}
|
|
6684
6689
|
|
|
6685
6690
|
try {
|
|
6686
6691
|
return this.registerer.unregister().then(() => {
|
|
6687
|
-
logger$
|
|
6692
|
+
logger$3.info('sdk webrtc unregistered');
|
|
6688
6693
|
this._cleanupRegister();
|
|
6689
6694
|
}).catch(e => {
|
|
6690
|
-
logger$
|
|
6695
|
+
logger$3.error('sdk webrtc unregistering, promise error', e);
|
|
6691
6696
|
this._cleanupRegister();
|
|
6692
6697
|
});
|
|
6693
6698
|
} catch (e) {
|
|
6694
|
-
logger$
|
|
6699
|
+
logger$3.error('sdk webrtc unregistering, error', e);
|
|
6695
6700
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6696
6701
|
// error when the registerer is in a bad state
|
|
6697
6702
|
this._cleanupRegister();
|
|
@@ -6699,7 +6704,7 @@ class WebRTCClient extends Emitter {
|
|
|
6699
6704
|
}
|
|
6700
6705
|
|
|
6701
6706
|
stop() {
|
|
6702
|
-
logger$
|
|
6707
|
+
logger$3.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6703
6708
|
if (!this.userAgent) {
|
|
6704
6709
|
return Promise.resolve();
|
|
6705
6710
|
}
|
|
@@ -6707,12 +6712,12 @@ class WebRTCClient extends Emitter {
|
|
|
6707
6712
|
return this.userAgent.stop().then(() => {
|
|
6708
6713
|
return this._cleanupRegister();
|
|
6709
6714
|
}).catch(e => {
|
|
6710
|
-
logger$
|
|
6715
|
+
logger$3.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6711
6716
|
});
|
|
6712
6717
|
}
|
|
6713
6718
|
|
|
6714
6719
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6715
|
-
logger$
|
|
6720
|
+
logger$3.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
6716
6721
|
const inviterOptions = {
|
|
6717
6722
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6718
6723
|
conference,
|
|
@@ -6743,7 +6748,7 @@ class WebRTCClient extends Emitter {
|
|
|
6743
6748
|
this._onAccepted(session, response.session, true);
|
|
6744
6749
|
},
|
|
6745
6750
|
onReject: (response ) => {
|
|
6746
|
-
logger$
|
|
6751
|
+
logger$3.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
6747
6752
|
this._stopSendingStats(session);
|
|
6748
6753
|
this.stopNetworkMonitoring(session);
|
|
6749
6754
|
|
|
@@ -6766,11 +6771,11 @@ class WebRTCClient extends Emitter {
|
|
|
6766
6771
|
}
|
|
6767
6772
|
|
|
6768
6773
|
answer(session , enableVideo ) {
|
|
6769
|
-
logger$
|
|
6774
|
+
logger$3.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
6770
6775
|
|
|
6771
6776
|
if (!session || !session.accept) {
|
|
6772
6777
|
const error = 'No session to answer, or not an invitation';
|
|
6773
|
-
logger$
|
|
6778
|
+
logger$3.warn(error);
|
|
6774
6779
|
return Promise.reject(new Error(error));
|
|
6775
6780
|
}
|
|
6776
6781
|
const options = {
|
|
@@ -6780,15 +6785,15 @@ class WebRTCClient extends Emitter {
|
|
|
6780
6785
|
return session.accept(options).then(() => {
|
|
6781
6786
|
if (session.isCanceled) {
|
|
6782
6787
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
6783
|
-
logger$
|
|
6788
|
+
logger$3.error(message, { id: session.id });
|
|
6784
6789
|
this.onCallEnded(session);
|
|
6785
6790
|
|
|
6786
6791
|
throw new CanceledCallError(message);
|
|
6787
6792
|
}
|
|
6788
|
-
logger$
|
|
6793
|
+
logger$3.info('sdk webrtc answer, accepted.');
|
|
6789
6794
|
this._onAccepted(session);
|
|
6790
6795
|
}).catch(e => {
|
|
6791
|
-
logger$
|
|
6796
|
+
logger$3.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
6792
6797
|
|
|
6793
6798
|
throw e;
|
|
6794
6799
|
});
|
|
@@ -6796,7 +6801,7 @@ class WebRTCClient extends Emitter {
|
|
|
6796
6801
|
|
|
6797
6802
|
hangup(session ) {
|
|
6798
6803
|
const { state, id } = session;
|
|
6799
|
-
logger$
|
|
6804
|
+
logger$3.info('sdk webrtc hangup call', { id, state });
|
|
6800
6805
|
|
|
6801
6806
|
try {
|
|
6802
6807
|
this._stopSendingStats(session);
|
|
@@ -6825,7 +6830,7 @@ class WebRTCClient extends Emitter {
|
|
|
6825
6830
|
|
|
6826
6831
|
return bye();
|
|
6827
6832
|
} catch (error) {
|
|
6828
|
-
logger$
|
|
6833
|
+
logger$3.warn('sdk webrtc hangup, error', error);
|
|
6829
6834
|
}
|
|
6830
6835
|
|
|
6831
6836
|
return null;
|
|
@@ -6843,7 +6848,7 @@ class WebRTCClient extends Emitter {
|
|
|
6843
6848
|
// Fetch and emit an event at `interval` with session network stats
|
|
6844
6849
|
startNetworkMonitoring(session , interval = 1000) {
|
|
6845
6850
|
const sessionId = this.getSipSessionId(session);
|
|
6846
|
-
logger$
|
|
6851
|
+
logger$3.info('starting network inspection', { id: sessionId });
|
|
6847
6852
|
|
|
6848
6853
|
this.sessionNetworkStats[sessionId] = [];
|
|
6849
6854
|
|
|
@@ -6853,7 +6858,7 @@ class WebRTCClient extends Emitter {
|
|
|
6853
6858
|
stopNetworkMonitoring(session ) {
|
|
6854
6859
|
const sessionId = this.getSipSessionId(session);
|
|
6855
6860
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
6856
|
-
logger$
|
|
6861
|
+
logger$3.info('stopping network inspection', { id: sessionId, exists });
|
|
6857
6862
|
|
|
6858
6863
|
if (exists) {
|
|
6859
6864
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -6863,17 +6868,17 @@ class WebRTCClient extends Emitter {
|
|
|
6863
6868
|
}
|
|
6864
6869
|
|
|
6865
6870
|
reject(session ) {
|
|
6866
|
-
logger$
|
|
6871
|
+
logger$3.info('sdk webrtc reject call', { id: session.id });
|
|
6867
6872
|
|
|
6868
6873
|
try {
|
|
6869
6874
|
return session.reject ? session.reject() : session.cancel();
|
|
6870
6875
|
} catch (e) {
|
|
6871
|
-
logger$
|
|
6876
|
+
logger$3.warn('Error when rejecting call', e.message, e.stack);
|
|
6872
6877
|
}
|
|
6873
6878
|
}
|
|
6874
6879
|
|
|
6875
6880
|
async close() {
|
|
6876
|
-
logger$
|
|
6881
|
+
logger$3.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6877
6882
|
this._cleanupMedia();
|
|
6878
6883
|
this.connectionPromise = null;
|
|
6879
6884
|
|
|
@@ -6904,7 +6909,7 @@ class WebRTCClient extends Emitter {
|
|
|
6904
6909
|
// eg: "INVITE not rejectable in state Completed"
|
|
6905
6910
|
}
|
|
6906
6911
|
this.userAgent = null;
|
|
6907
|
-
logger$
|
|
6912
|
+
logger$3.info('sdk webrtc client closed');
|
|
6908
6913
|
}
|
|
6909
6914
|
|
|
6910
6915
|
getNumber(session ) {
|
|
@@ -6917,13 +6922,13 @@ class WebRTCClient extends Emitter {
|
|
|
6917
6922
|
}
|
|
6918
6923
|
|
|
6919
6924
|
mute(session ) {
|
|
6920
|
-
logger$
|
|
6925
|
+
logger$3.info('sdk webrtc mute', { id: session.id });
|
|
6921
6926
|
|
|
6922
6927
|
this._toggleAudio(session, true);
|
|
6923
6928
|
}
|
|
6924
6929
|
|
|
6925
6930
|
unmute(session ) {
|
|
6926
|
-
logger$
|
|
6931
|
+
logger$3.info('sdk webrtc unmute', { id: session.id });
|
|
6927
6932
|
|
|
6928
6933
|
this._toggleAudio(session, false);
|
|
6929
6934
|
}
|
|
@@ -6963,13 +6968,13 @@ class WebRTCClient extends Emitter {
|
|
|
6963
6968
|
}
|
|
6964
6969
|
|
|
6965
6970
|
toggleCameraOn(session ) {
|
|
6966
|
-
logger$
|
|
6971
|
+
logger$3.info('sdk webrtc toggle camera on', { id: session.id });
|
|
6967
6972
|
|
|
6968
6973
|
this._toggleVideo(session, false);
|
|
6969
6974
|
}
|
|
6970
6975
|
|
|
6971
6976
|
toggleCameraOff(session ) {
|
|
6972
|
-
logger$
|
|
6977
|
+
logger$3.info('sdk webrtc toggle camera off', { id: session.id });
|
|
6973
6978
|
|
|
6974
6979
|
this._toggleVideo(session, true);
|
|
6975
6980
|
}
|
|
@@ -6978,7 +6983,7 @@ class WebRTCClient extends Emitter {
|
|
|
6978
6983
|
const sessionId = this.getSipSessionId(session);
|
|
6979
6984
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
6980
6985
|
|
|
6981
|
-
logger$
|
|
6986
|
+
logger$3.info('sdk webrtc hold', {
|
|
6982
6987
|
sessionId,
|
|
6983
6988
|
keys: Object.keys(this.heldSessions),
|
|
6984
6989
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7027,7 +7032,7 @@ class WebRTCClient extends Emitter {
|
|
|
7027
7032
|
const sessionId = this.getSipSessionId(session);
|
|
7028
7033
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7029
7034
|
|
|
7030
|
-
logger$
|
|
7035
|
+
logger$3.info('sdk webrtc unhold', {
|
|
7031
7036
|
sessionId,
|
|
7032
7037
|
keys: Object.keys(this.heldSessions),
|
|
7033
7038
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7175,7 +7180,7 @@ class WebRTCClient extends Emitter {
|
|
|
7175
7180
|
if (!session.sessionDescriptionHandler) {
|
|
7176
7181
|
return;
|
|
7177
7182
|
}
|
|
7178
|
-
logger$
|
|
7183
|
+
logger$3.info('Sending DTMF', {
|
|
7179
7184
|
id: this.getSipSessionId(session),
|
|
7180
7185
|
tone,
|
|
7181
7186
|
});
|
|
@@ -7191,7 +7196,7 @@ class WebRTCClient extends Emitter {
|
|
|
7191
7196
|
transfer(session , target ) {
|
|
7192
7197
|
this.hold(session);
|
|
7193
7198
|
|
|
7194
|
-
logger$
|
|
7199
|
+
logger$3.info('Transfering a session', {
|
|
7195
7200
|
id: this.getSipSessionId(session),
|
|
7196
7201
|
target,
|
|
7197
7202
|
});
|
|
@@ -7213,17 +7218,17 @@ class WebRTCClient extends Emitter {
|
|
|
7213
7218
|
atxfer(session ) {
|
|
7214
7219
|
this.hold(session);
|
|
7215
7220
|
|
|
7216
|
-
logger$
|
|
7221
|
+
logger$3.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7217
7222
|
|
|
7218
7223
|
const result = {
|
|
7219
7224
|
newSession: null,
|
|
7220
7225
|
init: async (target ) => {
|
|
7221
|
-
logger$
|
|
7226
|
+
logger$3.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7222
7227
|
|
|
7223
7228
|
result.newSession = await this.call(target);
|
|
7224
7229
|
},
|
|
7225
7230
|
complete: () => {
|
|
7226
|
-
logger$
|
|
7231
|
+
logger$3.info('webrtc transfer completed', {
|
|
7227
7232
|
id: this.getSipSessionId(session),
|
|
7228
7233
|
referId: this.getSipSessionId(result.newSession),
|
|
7229
7234
|
});
|
|
@@ -7244,7 +7249,7 @@ class WebRTCClient extends Emitter {
|
|
|
7244
7249
|
return;
|
|
7245
7250
|
}
|
|
7246
7251
|
|
|
7247
|
-
logger$
|
|
7252
|
+
logger$3.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7248
7253
|
|
|
7249
7254
|
try {
|
|
7250
7255
|
sipSession.message({
|
|
@@ -7286,7 +7291,7 @@ class WebRTCClient extends Emitter {
|
|
|
7286
7291
|
}
|
|
7287
7292
|
|
|
7288
7293
|
changeAudioOutputVolume(volume ) {
|
|
7289
|
-
logger$
|
|
7294
|
+
logger$3.info('Changing audio output volume', { volume });
|
|
7290
7295
|
|
|
7291
7296
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7292
7297
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7298,7 +7303,7 @@ class WebRTCClient extends Emitter {
|
|
|
7298
7303
|
}
|
|
7299
7304
|
|
|
7300
7305
|
changeAudioOutputDevice(id ) {
|
|
7301
|
-
logger$
|
|
7306
|
+
logger$3.info('Changing audio output device', { id });
|
|
7302
7307
|
|
|
7303
7308
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7304
7309
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7315,7 +7320,7 @@ class WebRTCClient extends Emitter {
|
|
|
7315
7320
|
|
|
7316
7321
|
changeAudioInputDevice(id , session ) {
|
|
7317
7322
|
const currentId = this.getAudioDeviceId();
|
|
7318
|
-
logger$
|
|
7323
|
+
logger$3.info('setting audio input device', { id, currentId, session: !!session });
|
|
7319
7324
|
|
|
7320
7325
|
if (id === currentId) {
|
|
7321
7326
|
return null;
|
|
@@ -7361,7 +7366,7 @@ class WebRTCClient extends Emitter {
|
|
|
7361
7366
|
|
|
7362
7367
|
setVideoInputDevice(id ) {
|
|
7363
7368
|
const currentId = this.getVideoDeviceId();
|
|
7364
|
-
logger$
|
|
7369
|
+
logger$3.info('setting video input device', { id, currentId });
|
|
7365
7370
|
|
|
7366
7371
|
if (id === currentId) {
|
|
7367
7372
|
return null;
|
|
@@ -7386,7 +7391,7 @@ class WebRTCClient extends Emitter {
|
|
|
7386
7391
|
const sessionId = this.getSipSessionId(session);
|
|
7387
7392
|
const localStream = this.getLocalStream(sessionId);
|
|
7388
7393
|
|
|
7389
|
-
logger$
|
|
7394
|
+
logger$3.info('changing video input device', { id, sessionId });
|
|
7390
7395
|
|
|
7391
7396
|
// Release old video stream
|
|
7392
7397
|
if (localStream) {
|
|
@@ -7454,7 +7459,7 @@ class WebRTCClient extends Emitter {
|
|
|
7454
7459
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7455
7460
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7456
7461
|
|
|
7457
|
-
logger$
|
|
7462
|
+
logger$3.info('Sending reinvite', {
|
|
7458
7463
|
id: this.getSipSessionId(sipSession),
|
|
7459
7464
|
newConstraints,
|
|
7460
7465
|
conference,
|
|
@@ -7492,7 +7497,7 @@ class WebRTCClient extends Emitter {
|
|
|
7492
7497
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7493
7498
|
}
|
|
7494
7499
|
|
|
7495
|
-
logger$
|
|
7500
|
+
logger$3.info('on re-INVITE accepted', {
|
|
7496
7501
|
id: this.getSipSessionId(sipSession),
|
|
7497
7502
|
wasMuted,
|
|
7498
7503
|
shouldDoScreenSharing,
|
|
@@ -7510,7 +7515,7 @@ class WebRTCClient extends Emitter {
|
|
|
7510
7515
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7511
7516
|
}
|
|
7512
7517
|
|
|
7513
|
-
return this.eventEmitter.emit(ON_REINVITE
|
|
7518
|
+
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7514
7519
|
},
|
|
7515
7520
|
},
|
|
7516
7521
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7667,7 +7672,7 @@ class WebRTCClient extends Emitter {
|
|
|
7667
7672
|
}
|
|
7668
7673
|
|
|
7669
7674
|
startHeartbeat() {
|
|
7670
|
-
logger$
|
|
7675
|
+
logger$3.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7671
7676
|
if (!this.userAgent) {
|
|
7672
7677
|
this.heartbeat.stop();
|
|
7673
7678
|
return;
|
|
@@ -7680,7 +7685,7 @@ class WebRTCClient extends Emitter {
|
|
|
7680
7685
|
}
|
|
7681
7686
|
|
|
7682
7687
|
stopHeartbeat() {
|
|
7683
|
-
logger$
|
|
7688
|
+
logger$3.info('sdk webrtc stop heartbeat');
|
|
7684
7689
|
this.heartbeat.stop();
|
|
7685
7690
|
}
|
|
7686
7691
|
|
|
@@ -7701,7 +7706,7 @@ class WebRTCClient extends Emitter {
|
|
|
7701
7706
|
}
|
|
7702
7707
|
|
|
7703
7708
|
attemptReconnection() {
|
|
7704
|
-
logger$
|
|
7709
|
+
logger$3.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7705
7710
|
if (!this.userAgent) {
|
|
7706
7711
|
return;
|
|
7707
7712
|
}
|
|
@@ -7726,7 +7731,7 @@ class WebRTCClient extends Emitter {
|
|
|
7726
7731
|
return;
|
|
7727
7732
|
}
|
|
7728
7733
|
|
|
7729
|
-
logger$
|
|
7734
|
+
logger$3.info('setting local media stream', {
|
|
7730
7735
|
sipSessionId,
|
|
7731
7736
|
tracks: newStream ? newStream.getTracks() : null,
|
|
7732
7737
|
});
|
|
@@ -7743,7 +7748,7 @@ class WebRTCClient extends Emitter {
|
|
|
7743
7748
|
|
|
7744
7749
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
7745
7750
|
|
|
7746
|
-
logger$
|
|
7751
|
+
logger$3.info('updating local stream', {
|
|
7747
7752
|
sipSessionId,
|
|
7748
7753
|
oldStream: !!oldStream,
|
|
7749
7754
|
tracks: newStream.getTracks(),
|
|
@@ -7763,7 +7768,7 @@ class WebRTCClient extends Emitter {
|
|
|
7763
7768
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
7764
7769
|
const pc = this.getPeerConnection(sessionId);
|
|
7765
7770
|
|
|
7766
|
-
logger$
|
|
7771
|
+
logger$3.info('Updating remote stream', {
|
|
7767
7772
|
sessionId,
|
|
7768
7773
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
7769
7774
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -7789,7 +7794,7 @@ class WebRTCClient extends Emitter {
|
|
|
7789
7794
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
7790
7795
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
7791
7796
|
|
|
7792
|
-
logger$
|
|
7797
|
+
logger$3.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
7793
7798
|
|
|
7794
7799
|
return {
|
|
7795
7800
|
constraints: {
|
|
@@ -7838,7 +7843,7 @@ class WebRTCClient extends Emitter {
|
|
|
7838
7843
|
}
|
|
7839
7844
|
|
|
7840
7845
|
_onTransportError() {
|
|
7841
|
-
logger$
|
|
7846
|
+
logger$3.error('on transport error');
|
|
7842
7847
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
7843
7848
|
this.attemptReconnection();
|
|
7844
7849
|
}
|
|
@@ -7847,7 +7852,7 @@ class WebRTCClient extends Emitter {
|
|
|
7847
7852
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
7848
7853
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
7849
7854
|
if (this.hasHeartbeat()) {
|
|
7850
|
-
logger$
|
|
7855
|
+
logger$3.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
7851
7856
|
|
|
7852
7857
|
this.heartbeat.onHeartbeat();
|
|
7853
7858
|
if (this.heartbeatCb) {
|
|
@@ -7858,7 +7863,7 @@ class WebRTCClient extends Emitter {
|
|
|
7858
7863
|
}
|
|
7859
7864
|
|
|
7860
7865
|
async _onHeartbeatTimeout() {
|
|
7861
|
-
logger$
|
|
7866
|
+
logger$3.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7862
7867
|
|
|
7863
7868
|
if (this.heartbeatTimeoutCb) {
|
|
7864
7869
|
this.heartbeatTimeoutCb();
|
|
@@ -7870,7 +7875,7 @@ class WebRTCClient extends Emitter {
|
|
|
7870
7875
|
try {
|
|
7871
7876
|
await this.userAgent.transport.disconnect();
|
|
7872
7877
|
} catch (e) {
|
|
7873
|
-
logger$
|
|
7878
|
+
logger$3.error('Transport disconnection after heartbeat timeout, error', e);
|
|
7874
7879
|
}
|
|
7875
7880
|
}
|
|
7876
7881
|
|
|
@@ -7903,31 +7908,31 @@ class WebRTCClient extends Emitter {
|
|
|
7903
7908
|
}
|
|
7904
7909
|
|
|
7905
7910
|
_connectIfNeeded() {
|
|
7906
|
-
logger$
|
|
7911
|
+
logger$3.info('connect if needed, checking', { connected: this.isConnected() });
|
|
7907
7912
|
if (!this.userAgent) {
|
|
7908
|
-
logger$
|
|
7913
|
+
logger$3.info('need to recreate User Agent');
|
|
7909
7914
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
7910
7915
|
}
|
|
7911
7916
|
|
|
7912
7917
|
if (this.isConnected()) {
|
|
7913
|
-
logger$
|
|
7918
|
+
logger$3.info('webrtc sdk, already connected');
|
|
7914
7919
|
return Promise.resolve();
|
|
7915
7920
|
}
|
|
7916
7921
|
|
|
7917
7922
|
if (this.isConnecting()) {
|
|
7918
|
-
logger$
|
|
7923
|
+
logger$3.info('webrtc sdk, already connecting...');
|
|
7919
7924
|
|
|
7920
7925
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
7921
7926
|
return this.connectionPromise;
|
|
7922
7927
|
}
|
|
7923
7928
|
|
|
7924
7929
|
if (this.connectionPromise) {
|
|
7925
|
-
logger$
|
|
7930
|
+
logger$3.info('webrtc sdk, connection promise connecting...');
|
|
7926
7931
|
// $FlowFixMe
|
|
7927
7932
|
return this.connectionPromise;
|
|
7928
7933
|
}
|
|
7929
7934
|
|
|
7930
|
-
logger$
|
|
7935
|
+
logger$3.info('WebRTC UA needs to connect');
|
|
7931
7936
|
|
|
7932
7937
|
// Force UA to reconnect
|
|
7933
7938
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -8052,7 +8057,7 @@ class WebRTCClient extends Emitter {
|
|
|
8052
8057
|
|
|
8053
8058
|
sdh.peerConnectionDelegate = {
|
|
8054
8059
|
onicecandidateerror: (error ) => {
|
|
8055
|
-
logger$
|
|
8060
|
+
logger$3.error('on icecandidate error', {
|
|
8056
8061
|
address: error.address,
|
|
8057
8062
|
port: error.port,
|
|
8058
8063
|
errorCode: error.errorCode,
|
|
@@ -8081,7 +8086,7 @@ class WebRTCClient extends Emitter {
|
|
|
8081
8086
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8082
8087
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8083
8088
|
}
|
|
8084
|
-
logger$
|
|
8089
|
+
logger$3.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8085
8090
|
|
|
8086
8091
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8087
8092
|
|
|
@@ -8097,12 +8102,12 @@ class WebRTCClient extends Emitter {
|
|
|
8097
8102
|
|
|
8098
8103
|
this._setupMedias(session);
|
|
8099
8104
|
|
|
8100
|
-
return this.eventEmitter.emit(ON_REINVITE
|
|
8105
|
+
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8101
8106
|
};
|
|
8102
8107
|
}
|
|
8103
8108
|
|
|
8104
8109
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8105
|
-
logger$
|
|
8110
|
+
logger$3.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8106
8111
|
|
|
8107
8112
|
this.storeSipSession(session);
|
|
8108
8113
|
|
|
@@ -8114,14 +8119,14 @@ class WebRTCClient extends Emitter {
|
|
|
8114
8119
|
const onTrack = (event ) => {
|
|
8115
8120
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8116
8121
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8117
|
-
logger$
|
|
8122
|
+
logger$3.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8118
8123
|
|
|
8119
8124
|
// Stop video track in audio only mode
|
|
8120
8125
|
if (isAudioOnly && kind === 'video') {
|
|
8121
8126
|
event.track.stop();
|
|
8122
8127
|
}
|
|
8123
8128
|
|
|
8124
|
-
this.eventEmitter.emit(ON_TRACK
|
|
8129
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8125
8130
|
};
|
|
8126
8131
|
|
|
8127
8132
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8131,9 +8136,9 @@ class WebRTCClient extends Emitter {
|
|
|
8131
8136
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8132
8137
|
|
|
8133
8138
|
pc.oniceconnectionstatechange = () => {
|
|
8134
|
-
logger$
|
|
8139
|
+
logger$3.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8135
8140
|
if (pc.iceConnectionState === 'disconnected') {
|
|
8136
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
8141
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
8137
8142
|
}
|
|
8138
8143
|
};
|
|
8139
8144
|
|
|
@@ -8304,10 +8309,10 @@ class WebRTCClient extends Emitter {
|
|
|
8304
8309
|
|
|
8305
8310
|
_stopSendingStats(session ) {
|
|
8306
8311
|
const sessionId = this.getSipSessionId(session);
|
|
8307
|
-
logger$
|
|
8312
|
+
logger$3.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8308
8313
|
|
|
8309
8314
|
if (sessionId in this.statsIntervals) {
|
|
8310
|
-
logger$
|
|
8315
|
+
logger$3.trace('Stop sending stats for call', { sessionId });
|
|
8311
8316
|
this.statsIntervals[sessionId]();
|
|
8312
8317
|
delete this.statsIntervals[sessionId];
|
|
8313
8318
|
}
|
|
@@ -8323,7 +8328,7 @@ class WebRTCClient extends Emitter {
|
|
|
8323
8328
|
try {
|
|
8324
8329
|
await this.userAgent.transport.disconnect();
|
|
8325
8330
|
} catch (e) {
|
|
8326
|
-
logger$
|
|
8331
|
+
logger$3.error('WebRTC transport disconnect, error', e);
|
|
8327
8332
|
}
|
|
8328
8333
|
}
|
|
8329
8334
|
}
|
|
@@ -8417,7 +8422,7 @@ class WebRTCClient extends Emitter {
|
|
|
8417
8422
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8418
8423
|
+ networkStats.transportSent;
|
|
8419
8424
|
|
|
8420
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
8425
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8421
8426
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8422
8427
|
}
|
|
8423
8428
|
|
|
@@ -8445,8 +8450,8 @@ const ON_CALL_FAILED = 'onCallFailed';
|
|
|
8445
8450
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8446
8451
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8447
8452
|
const ON_MESSAGE = 'onMessage';
|
|
8448
|
-
const ON_REINVITE = 'reinvite';
|
|
8449
|
-
const ON_TRACK = 'onTrack';
|
|
8453
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
8454
|
+
const ON_TRACK$1 = 'onTrack';
|
|
8450
8455
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8451
8456
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8452
8457
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8461,15 +8466,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8461
8466
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8462
8467
|
const ON_CALL_ERROR = 'onCallError';
|
|
8463
8468
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8464
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8469
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
8465
8470
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8466
8471
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8467
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
8472
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
8468
8473
|
|
|
8469
8474
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8470
8475
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8471
8476
|
|
|
8472
|
-
const events = [
|
|
8477
|
+
const events$1 = [
|
|
8473
8478
|
ON_USER_AGENT,
|
|
8474
8479
|
ON_REGISTERED,
|
|
8475
8480
|
ON_UNREGISTERED,
|
|
@@ -8487,8 +8492,8 @@ const events = [
|
|
|
8487
8492
|
ON_CALL_FAILED,
|
|
8488
8493
|
ON_CALL_ENDED,
|
|
8489
8494
|
ON_MESSAGE,
|
|
8490
|
-
ON_REINVITE,
|
|
8491
|
-
ON_TRACK,
|
|
8495
|
+
ON_REINVITE$1,
|
|
8496
|
+
ON_TRACK$1,
|
|
8492
8497
|
ON_AUDIO_STREAM,
|
|
8493
8498
|
ON_VIDEO_STREAM,
|
|
8494
8499
|
ON_REMOVE_STREAM,
|
|
@@ -8503,11 +8508,11 @@ const events = [
|
|
|
8503
8508
|
ON_CALL_ERROR,
|
|
8504
8509
|
ON_CHAT,
|
|
8505
8510
|
ON_SIGNAL,
|
|
8506
|
-
ON_NETWORK_STATS,
|
|
8507
|
-
ON_DISCONNECTED,
|
|
8511
|
+
ON_NETWORK_STATS$1,
|
|
8512
|
+
ON_DISCONNECTED$1,
|
|
8508
8513
|
];
|
|
8509
8514
|
|
|
8510
|
-
const logger$
|
|
8515
|
+
const logger$4 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8511
8516
|
|
|
8512
8517
|
class WebRTCPhone extends Emitter {
|
|
8513
8518
|
|
|
@@ -8580,7 +8585,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8580
8585
|
}).catch(error => {
|
|
8581
8586
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8582
8587
|
console.error('register error', error, error.message, error.stack);
|
|
8583
|
-
logger$
|
|
8588
|
+
logger$4.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8584
8589
|
});
|
|
8585
8590
|
}
|
|
8586
8591
|
|
|
@@ -8595,7 +8600,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8595
8600
|
if (!this.client) {
|
|
8596
8601
|
return;
|
|
8597
8602
|
}
|
|
8598
|
-
logger$
|
|
8603
|
+
logger$4.info('WebRTC phone stop');
|
|
8599
8604
|
this.client.stop();
|
|
8600
8605
|
}
|
|
8601
8606
|
|
|
@@ -8610,7 +8615,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8610
8615
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8611
8616
|
audioOnly = false, iceRestart = false) {
|
|
8612
8617
|
const sipSession = this.findSipSession(callSession);
|
|
8613
|
-
logger$
|
|
8618
|
+
logger$4.info('WebRTC phone - send reinvite', {
|
|
8614
8619
|
sessionId: sipSession ? sipSession.id : null,
|
|
8615
8620
|
constraints,
|
|
8616
8621
|
audioOnly,
|
|
@@ -8647,7 +8652,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8647
8652
|
}
|
|
8648
8653
|
|
|
8649
8654
|
startHeartbeat() {
|
|
8650
|
-
logger$
|
|
8655
|
+
logger$4.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8651
8656
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8652
8657
|
return;
|
|
8653
8658
|
}
|
|
@@ -8656,7 +8661,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8656
8661
|
}
|
|
8657
8662
|
|
|
8658
8663
|
stopHeartbeat() {
|
|
8659
|
-
logger$
|
|
8664
|
+
logger$4.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8660
8665
|
if (!this.client) {
|
|
8661
8666
|
return;
|
|
8662
8667
|
}
|
|
@@ -8673,7 +8678,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8673
8678
|
}
|
|
8674
8679
|
|
|
8675
8680
|
reconnect() {
|
|
8676
|
-
logger$
|
|
8681
|
+
logger$4.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8677
8682
|
if (!this.client) {
|
|
8678
8683
|
return;
|
|
8679
8684
|
}
|
|
@@ -8714,10 +8719,15 @@ class WebRTCPhone extends Emitter {
|
|
|
8714
8719
|
return false;
|
|
8715
8720
|
}
|
|
8716
8721
|
|
|
8717
|
-
logger$
|
|
8722
|
+
logger$4.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8718
8723
|
|
|
8719
8724
|
this.client.downgradeToAudio(sipSession);
|
|
8720
8725
|
|
|
8726
|
+
if (callSession) {
|
|
8727
|
+
callSession.cameraEnabled = false;
|
|
8728
|
+
this._updateCallSession(callSession);
|
|
8729
|
+
}
|
|
8730
|
+
|
|
8721
8731
|
if (withMessage) {
|
|
8722
8732
|
this._sendReinviteMessage(callSession, false);
|
|
8723
8733
|
}
|
|
@@ -8732,7 +8742,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8732
8742
|
return Promise.resolve(false);
|
|
8733
8743
|
}
|
|
8734
8744
|
|
|
8735
|
-
logger$
|
|
8745
|
+
logger$4.info('Upgrade to video', {
|
|
8736
8746
|
id: callSession ? callSession.getId() : null,
|
|
8737
8747
|
constraints,
|
|
8738
8748
|
isConference,
|
|
@@ -8745,6 +8755,11 @@ class WebRTCPhone extends Emitter {
|
|
|
8745
8755
|
|
|
8746
8756
|
const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
|
|
8747
8757
|
|
|
8758
|
+
if (callSession) {
|
|
8759
|
+
callSession.cameraEnabled = true;
|
|
8760
|
+
this._updateCallSession(callSession);
|
|
8761
|
+
}
|
|
8762
|
+
|
|
8748
8763
|
// If no stream is returned, it means we have to reinvite
|
|
8749
8764
|
if (!newStream) {
|
|
8750
8765
|
return true;
|
|
@@ -8767,7 +8782,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8767
8782
|
|
|
8768
8783
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
8769
8784
|
const sipSession = this.findSipSession(callSession);
|
|
8770
|
-
logger$
|
|
8785
|
+
logger$4.info('Sending reinvite message', {
|
|
8771
8786
|
id: callSession ? callSession.getId() : null,
|
|
8772
8787
|
isUpgrade,
|
|
8773
8788
|
});
|
|
@@ -8793,7 +8808,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8793
8808
|
// Monkey patch to know when canceled with the CANCEL message
|
|
8794
8809
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
8795
8810
|
sipSession._onCancel = (message ) => {
|
|
8796
|
-
logger$
|
|
8811
|
+
logger$4.trace('on sip session canceled', { callId: message.callId });
|
|
8797
8812
|
|
|
8798
8813
|
onCancel(message);
|
|
8799
8814
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -8821,13 +8836,13 @@ class WebRTCPhone extends Emitter {
|
|
|
8821
8836
|
this.audioOutputVolume,
|
|
8822
8837
|
);
|
|
8823
8838
|
case sessionState.SessionState.Terminating:
|
|
8824
|
-
logger$
|
|
8839
|
+
logger$4.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
8825
8840
|
|
|
8826
8841
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
8827
8842
|
|
|
8828
8843
|
break;
|
|
8829
8844
|
case sessionState.SessionState.Terminated: {
|
|
8830
|
-
logger$
|
|
8845
|
+
logger$4.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
8831
8846
|
|
|
8832
8847
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8833
8848
|
const callSession = this._createCallSession(sipSession);
|
|
@@ -8849,7 +8864,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8849
8864
|
const [stream] = event.streams;
|
|
8850
8865
|
const kind = event && event.track && event.track.kind;
|
|
8851
8866
|
|
|
8852
|
-
logger$
|
|
8867
|
+
logger$4.info('on track stream called on the peer connection', {
|
|
8853
8868
|
callId: this.getSipSessionId(sipSession),
|
|
8854
8869
|
streamId: stream ? stream.id : null,
|
|
8855
8870
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -8869,7 +8884,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8869
8884
|
};
|
|
8870
8885
|
|
|
8871
8886
|
peerConnection.onremovestream = event => {
|
|
8872
|
-
logger$
|
|
8887
|
+
logger$4.info('on remove stream called on the peer connection', {
|
|
8873
8888
|
id: event.stream.id,
|
|
8874
8889
|
tracks: event.stream.getTracks(),
|
|
8875
8890
|
});
|
|
@@ -8879,7 +8894,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8879
8894
|
}
|
|
8880
8895
|
|
|
8881
8896
|
async startScreenSharing(constraints , callSession ) {
|
|
8882
|
-
logger$
|
|
8897
|
+
logger$4.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
8883
8898
|
|
|
8884
8899
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
8885
8900
|
if (!screenShareStream) {
|
|
@@ -8919,7 +8934,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8919
8934
|
return;
|
|
8920
8935
|
}
|
|
8921
8936
|
|
|
8922
|
-
logger$
|
|
8937
|
+
logger$4.info('WebRTC phone - stop screen sharing', {
|
|
8923
8938
|
restoreLocalStream,
|
|
8924
8939
|
});
|
|
8925
8940
|
|
|
@@ -8975,7 +8990,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8975
8990
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
8976
8991
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
8977
8992
|
|
|
8978
|
-
logger$
|
|
8993
|
+
logger$4.info('WebRTC phone - on screensharing', {
|
|
8979
8994
|
hadVideo,
|
|
8980
8995
|
id: this.getSipSessionId(sipSession),
|
|
8981
8996
|
screenTrack,
|
|
@@ -8983,7 +8998,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8983
8998
|
|
|
8984
8999
|
if (screenTrack) {
|
|
8985
9000
|
screenTrack.onended = () => {
|
|
8986
|
-
logger$
|
|
9001
|
+
logger$4.info('WebRTC phone - on screenshare ended', {
|
|
8987
9002
|
hadVideo,
|
|
8988
9003
|
id: this.getSipSessionId(sipSession),
|
|
8989
9004
|
screenTrack,
|
|
@@ -9014,7 +9029,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9014
9029
|
}
|
|
9015
9030
|
|
|
9016
9031
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9017
|
-
logger$
|
|
9032
|
+
logger$4.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9018
9033
|
|
|
9019
9034
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9020
9035
|
this.currentSipSession = sipSession;
|
|
@@ -9032,7 +9047,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9032
9047
|
}
|
|
9033
9048
|
|
|
9034
9049
|
changeAudioDevice(id ) {
|
|
9035
|
-
logger$
|
|
9050
|
+
logger$4.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9036
9051
|
this.audioOutputDeviceId = id;
|
|
9037
9052
|
this.client.changeAudioOutputDevice(id);
|
|
9038
9053
|
}
|
|
@@ -9042,14 +9057,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9042
9057
|
}
|
|
9043
9058
|
|
|
9044
9059
|
changeRingDevice(id ) {
|
|
9045
|
-
logger$
|
|
9060
|
+
logger$4.info('WebRTC phone - changing ring device', { id });
|
|
9046
9061
|
|
|
9047
9062
|
this.audioRingDeviceId = id;
|
|
9048
9063
|
}
|
|
9049
9064
|
|
|
9050
9065
|
// volume is a value between 0 and 1
|
|
9051
9066
|
changeAudioVolume(volume ) {
|
|
9052
|
-
logger$
|
|
9067
|
+
logger$4.info('WebRTC phone - changing audio volume', { volume });
|
|
9053
9068
|
|
|
9054
9069
|
this.audioOutputVolume = volume;
|
|
9055
9070
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9057,31 +9072,31 @@ class WebRTCPhone extends Emitter {
|
|
|
9057
9072
|
|
|
9058
9073
|
// volume is a value between 0 and 1
|
|
9059
9074
|
changeRingVolume(volume ) {
|
|
9060
|
-
logger$
|
|
9075
|
+
logger$4.info('WebRTC phone - changing ring volume', { volume });
|
|
9061
9076
|
|
|
9062
9077
|
this.audioRingVolume = volume;
|
|
9063
9078
|
}
|
|
9064
9079
|
|
|
9065
9080
|
changeAudioInputDevice(id ) {
|
|
9066
|
-
logger$
|
|
9081
|
+
logger$4.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9067
9082
|
|
|
9068
9083
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9069
9084
|
}
|
|
9070
9085
|
|
|
9071
9086
|
changeVideoInputDevice(id ) {
|
|
9072
|
-
logger$
|
|
9087
|
+
logger$4.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9073
9088
|
|
|
9074
9089
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9075
9090
|
}
|
|
9076
9091
|
|
|
9077
9092
|
changeSessionVideoInputDevice(id ) {
|
|
9078
|
-
logger$
|
|
9093
|
+
logger$4.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9079
9094
|
|
|
9080
9095
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9081
9096
|
}
|
|
9082
9097
|
|
|
9083
9098
|
_onCallTerminated(sipSession ) {
|
|
9084
|
-
logger$
|
|
9099
|
+
logger$4.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9085
9100
|
|
|
9086
9101
|
const callSession = this._createCallSession(sipSession);
|
|
9087
9102
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
@@ -9115,7 +9130,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9115
9130
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9116
9131
|
|
|
9117
9132
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9118
|
-
logger$
|
|
9133
|
+
logger$4.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9119
9134
|
sipId: sipSession.id,
|
|
9120
9135
|
shouldRetrigger,
|
|
9121
9136
|
hasIncomingCallSession,
|
|
@@ -9206,37 +9221,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9206
9221
|
|
|
9207
9222
|
// Deprecated
|
|
9208
9223
|
getLocalStreamForCall(callSession ) {
|
|
9209
|
-
logger$
|
|
9224
|
+
logger$4.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9210
9225
|
|
|
9211
9226
|
return this.getLocalStream(callSession);
|
|
9212
9227
|
}
|
|
9213
9228
|
|
|
9214
9229
|
// Deprecated
|
|
9215
9230
|
getRemoteStreamForCall(callSession ) {
|
|
9216
|
-
logger$
|
|
9231
|
+
logger$4.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9217
9232
|
|
|
9218
9233
|
return this.getRemoteVideoStream(callSession);
|
|
9219
9234
|
}
|
|
9220
9235
|
|
|
9221
9236
|
getRemoteStreamsForCall(callSession ) {
|
|
9222
|
-
logger$
|
|
9237
|
+
logger$4.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9223
9238
|
|
|
9224
9239
|
return this.getRemoteStream(callSession);
|
|
9225
9240
|
}
|
|
9226
9241
|
|
|
9227
9242
|
accept(callSession , cameraEnabled ) {
|
|
9228
|
-
logger$
|
|
9243
|
+
logger$4.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9229
9244
|
if (this.currentSipSession) {
|
|
9230
9245
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9231
9246
|
}
|
|
9232
9247
|
|
|
9233
9248
|
if (!callSession) {
|
|
9234
|
-
logger$
|
|
9249
|
+
logger$4.warn('no CallSession to accept.');
|
|
9235
9250
|
return Promise.resolve(null);
|
|
9236
9251
|
}
|
|
9237
9252
|
|
|
9238
9253
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9239
|
-
logger$
|
|
9254
|
+
logger$4.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9240
9255
|
return Promise.resolve(callSession.sipCallId);
|
|
9241
9256
|
}
|
|
9242
9257
|
|
|
@@ -9248,24 +9263,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9248
9263
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9249
9264
|
if (sipSession) {
|
|
9250
9265
|
if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
|
|
9251
|
-
logger$
|
|
9266
|
+
logger$4.warn('Trying to answer a terminated sipSession.');
|
|
9252
9267
|
|
|
9253
9268
|
return Promise.resolve(null);
|
|
9254
9269
|
}
|
|
9255
9270
|
|
|
9256
|
-
logger$
|
|
9271
|
+
logger$4.info('accept call, session found', { sipId: sipSession.id });
|
|
9257
9272
|
|
|
9258
9273
|
// $FlowFixMe
|
|
9259
9274
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9260
9275
|
return callSession.sipCallId;
|
|
9261
9276
|
}).catch(e => {
|
|
9262
|
-
logger$
|
|
9277
|
+
logger$4.error(e);
|
|
9263
9278
|
this.endCurrentCall(callSession);
|
|
9264
9279
|
throw e;
|
|
9265
9280
|
});
|
|
9266
9281
|
}
|
|
9267
9282
|
|
|
9268
|
-
logger$
|
|
9283
|
+
logger$4.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9269
9284
|
|
|
9270
9285
|
return Promise.resolve(null);
|
|
9271
9286
|
}
|
|
@@ -9275,7 +9290,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9275
9290
|
}
|
|
9276
9291
|
|
|
9277
9292
|
async reject(callSession ) {
|
|
9278
|
-
logger$
|
|
9293
|
+
logger$4.info('reject WebRTC called', { id: callSession.getId() });
|
|
9279
9294
|
|
|
9280
9295
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9281
9296
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9287,14 +9302,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9287
9302
|
|
|
9288
9303
|
const sipSession = this.findSipSession(callSession);
|
|
9289
9304
|
if (sipSession) {
|
|
9290
|
-
logger$
|
|
9305
|
+
logger$4.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9291
9306
|
|
|
9292
9307
|
this.client.hangup(sipSession);
|
|
9293
9308
|
}
|
|
9294
9309
|
}
|
|
9295
9310
|
|
|
9296
9311
|
async ignore(callSession ) {
|
|
9297
|
-
logger$
|
|
9312
|
+
logger$4.info('WebRTC ignore', { id: callSession.getId() });
|
|
9298
9313
|
|
|
9299
9314
|
// kill the ring
|
|
9300
9315
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9306,14 +9321,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9306
9321
|
const sipSession = this.findSipSession(callSession);
|
|
9307
9322
|
|
|
9308
9323
|
if (sipSession) {
|
|
9309
|
-
logger$
|
|
9324
|
+
logger$4.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9310
9325
|
|
|
9311
9326
|
return this.client.atxfer(sipSession);
|
|
9312
9327
|
}
|
|
9313
9328
|
}
|
|
9314
9329
|
|
|
9315
9330
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9316
|
-
logger$
|
|
9331
|
+
logger$4.info('WebRTC hold', { id: callSession.getId() });
|
|
9317
9332
|
|
|
9318
9333
|
const sipSession = this.findSipSession(callSession);
|
|
9319
9334
|
|
|
@@ -9328,18 +9343,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9328
9343
|
}
|
|
9329
9344
|
|
|
9330
9345
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9331
|
-
logger$
|
|
9346
|
+
logger$4.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9332
9347
|
|
|
9333
9348
|
const sipSession = this.findSipSession(callSession);
|
|
9334
9349
|
if (!sipSession) {
|
|
9335
9350
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9336
9351
|
}
|
|
9337
9352
|
|
|
9338
|
-
logger$
|
|
9353
|
+
logger$4.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9339
9354
|
|
|
9340
9355
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9341
9356
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9342
|
-
logger$
|
|
9357
|
+
logger$4.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9343
9358
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9344
9359
|
}
|
|
9345
9360
|
|
|
@@ -9364,7 +9379,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9364
9379
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9365
9380
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9366
9381
|
|
|
9367
|
-
logger$
|
|
9382
|
+
logger$4.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9368
9383
|
|
|
9369
9384
|
// Stop screenshre if needed
|
|
9370
9385
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9395,7 +9410,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9395
9410
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9396
9411
|
}
|
|
9397
9412
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9398
|
-
logger$
|
|
9413
|
+
logger$4.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9399
9414
|
|
|
9400
9415
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9401
9416
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9439,14 +9454,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9439
9454
|
}
|
|
9440
9455
|
|
|
9441
9456
|
mute(callSession , withEvent = true) {
|
|
9442
|
-
logger$
|
|
9457
|
+
logger$4.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9443
9458
|
|
|
9444
9459
|
const sipSession = this.findSipSession(callSession);
|
|
9445
9460
|
if (!sipSession) {
|
|
9446
9461
|
return;
|
|
9447
9462
|
}
|
|
9448
9463
|
|
|
9449
|
-
logger$
|
|
9464
|
+
logger$4.info('WebRTC muting', { sipId: sipSession.id });
|
|
9450
9465
|
this.client.mute(sipSession);
|
|
9451
9466
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9452
9467
|
|
|
@@ -9460,14 +9475,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9460
9475
|
}
|
|
9461
9476
|
|
|
9462
9477
|
unmute(callSession , withEvent = true) {
|
|
9463
|
-
logger$
|
|
9478
|
+
logger$4.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9464
9479
|
|
|
9465
9480
|
const sipSession = this.findSipSession(callSession);
|
|
9466
9481
|
if (!sipSession) {
|
|
9467
9482
|
return;
|
|
9468
9483
|
}
|
|
9469
9484
|
|
|
9470
|
-
logger$
|
|
9485
|
+
logger$4.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9471
9486
|
this.client.unmute(sipSession);
|
|
9472
9487
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9473
9488
|
|
|
@@ -9494,7 +9509,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9494
9509
|
if (!sipSession) {
|
|
9495
9510
|
return;
|
|
9496
9511
|
}
|
|
9497
|
-
logger$
|
|
9512
|
+
logger$4.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9498
9513
|
|
|
9499
9514
|
this.client.toggleCameraOn(sipSession);
|
|
9500
9515
|
|
|
@@ -9506,7 +9521,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9506
9521
|
if (!sipSession) {
|
|
9507
9522
|
return;
|
|
9508
9523
|
}
|
|
9509
|
-
logger$
|
|
9524
|
+
logger$4.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9510
9525
|
|
|
9511
9526
|
this.client.toggleCameraOff(sipSession);
|
|
9512
9527
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9518,7 +9533,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9518
9533
|
return;
|
|
9519
9534
|
}
|
|
9520
9535
|
|
|
9521
|
-
logger$
|
|
9536
|
+
logger$4.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9522
9537
|
this.client.sendDTMF(sipSession, tone);
|
|
9523
9538
|
}
|
|
9524
9539
|
|
|
@@ -9526,7 +9541,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9526
9541
|
// @TODO: line is not used here
|
|
9527
9542
|
async makeCall(number , line , cameraEnabled ,
|
|
9528
9543
|
audioOnly = false, conference = false) {
|
|
9529
|
-
logger$
|
|
9544
|
+
logger$4.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
|
|
9530
9545
|
if (!number) {
|
|
9531
9546
|
return Promise.resolve(null);
|
|
9532
9547
|
}
|
|
@@ -9536,7 +9551,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9536
9551
|
}
|
|
9537
9552
|
if (this.currentSipSession) {
|
|
9538
9553
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9539
|
-
logger$
|
|
9554
|
+
logger$4.warn('Unable to hold current session when making another call', e);
|
|
9540
9555
|
});
|
|
9541
9556
|
}
|
|
9542
9557
|
|
|
@@ -9546,7 +9561,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9546
9561
|
this._bindEvents(sipSession);
|
|
9547
9562
|
} catch (error) {
|
|
9548
9563
|
console.warn(error);
|
|
9549
|
-
logger$
|
|
9564
|
+
logger$4.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9550
9565
|
return Promise.resolve(null);
|
|
9551
9566
|
}
|
|
9552
9567
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
@@ -9574,7 +9589,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9574
9589
|
return;
|
|
9575
9590
|
}
|
|
9576
9591
|
|
|
9577
|
-
logger$
|
|
9592
|
+
logger$4.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9578
9593
|
|
|
9579
9594
|
this.client.transfer(sipSession, target);
|
|
9580
9595
|
}
|
|
@@ -9583,7 +9598,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9583
9598
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9584
9599
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9585
9600
|
|
|
9586
|
-
logger$
|
|
9601
|
+
logger$4.info('WebRTC indirect transfer', {
|
|
9587
9602
|
sipId: sipSession ? sipSession.id : null,
|
|
9588
9603
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9589
9604
|
});
|
|
@@ -9622,7 +9637,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9622
9637
|
return false;
|
|
9623
9638
|
}
|
|
9624
9639
|
|
|
9625
|
-
logger$
|
|
9640
|
+
logger$4.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9626
9641
|
|
|
9627
9642
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9628
9643
|
|
|
@@ -9668,7 +9683,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9668
9683
|
endCurrentCall(callSession ) {
|
|
9669
9684
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9670
9685
|
|
|
9671
|
-
logger$
|
|
9686
|
+
logger$4.info('Ending current call', {
|
|
9672
9687
|
id: callSession ? callSession.getId() : null,
|
|
9673
9688
|
isCurrent,
|
|
9674
9689
|
});
|
|
@@ -9692,7 +9707,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9692
9707
|
}
|
|
9693
9708
|
|
|
9694
9709
|
async close() {
|
|
9695
|
-
logger$
|
|
9710
|
+
logger$4.info('WebRTC close');
|
|
9696
9711
|
|
|
9697
9712
|
try {
|
|
9698
9713
|
await Promise.race([
|
|
@@ -9700,7 +9715,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9700
9715
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9701
9716
|
]);
|
|
9702
9717
|
} catch (e) {
|
|
9703
|
-
logger$
|
|
9718
|
+
logger$4.error('WebRTC close, unregister error', e);
|
|
9704
9719
|
}
|
|
9705
9720
|
|
|
9706
9721
|
this.client.close();
|
|
@@ -9718,12 +9733,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9718
9733
|
}
|
|
9719
9734
|
|
|
9720
9735
|
enableRinging() {
|
|
9721
|
-
logger$
|
|
9736
|
+
logger$4.info('WebRTC enable ringing');
|
|
9722
9737
|
this.ringingEnabled = true;
|
|
9723
9738
|
}
|
|
9724
9739
|
|
|
9725
9740
|
disableRinging() {
|
|
9726
|
-
logger$
|
|
9741
|
+
logger$4.info('WebRTC disable ringing');
|
|
9727
9742
|
this.ringingEnabled = false;
|
|
9728
9743
|
}
|
|
9729
9744
|
|
|
@@ -9763,7 +9778,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9763
9778
|
|
|
9764
9779
|
// Deprecated
|
|
9765
9780
|
getLocalMediaStream(callSession ) {
|
|
9766
|
-
logger$
|
|
9781
|
+
logger$4.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9767
9782
|
return this.getLocalStream(callSession);
|
|
9768
9783
|
}
|
|
9769
9784
|
|
|
@@ -9805,7 +9820,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9805
9820
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
9806
9821
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
9807
9822
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
9808
|
-
logger$
|
|
9823
|
+
logger$4.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
9809
9824
|
|
|
9810
9825
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
9811
9826
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -9828,7 +9843,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9828
9843
|
});
|
|
9829
9844
|
|
|
9830
9845
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
9831
|
-
logger$
|
|
9846
|
+
logger$4.info('WebRTC on reinvite', {
|
|
9832
9847
|
sessionId: args[0].id,
|
|
9833
9848
|
inviteId: args[1].id,
|
|
9834
9849
|
updatedCalleeName: args[2],
|
|
@@ -9848,7 +9863,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9848
9863
|
});
|
|
9849
9864
|
|
|
9850
9865
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
9851
|
-
logger$
|
|
9866
|
+
logger$4.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
9852
9867
|
|
|
9853
9868
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
9854
9869
|
|
|
@@ -9859,22 +9874,22 @@ class WebRTCPhone extends Emitter {
|
|
|
9859
9874
|
this.client.on('ended', () => {});
|
|
9860
9875
|
|
|
9861
9876
|
this.client.on(this.client.ON_ERROR, e => {
|
|
9862
|
-
logger$
|
|
9877
|
+
logger$4.error('WebRTC error', e);
|
|
9863
9878
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
9864
9879
|
});
|
|
9865
9880
|
|
|
9866
9881
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
9867
|
-
logger$
|
|
9882
|
+
logger$4.info('WebRTC unregistered');
|
|
9868
9883
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
9869
9884
|
});
|
|
9870
9885
|
|
|
9871
9886
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
9872
|
-
logger$
|
|
9873
|
-
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
9887
|
+
logger$4.info('WebRTC disconnected');
|
|
9888
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
9874
9889
|
});
|
|
9875
9890
|
|
|
9876
9891
|
this.client.on(this.client.REGISTERED, () => {
|
|
9877
|
-
logger$
|
|
9892
|
+
logger$4.info('WebRTC registered', {
|
|
9878
9893
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
9879
9894
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
9880
9895
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -9887,23 +9902,27 @@ class WebRTCPhone extends Emitter {
|
|
|
9887
9902
|
if (this.shouldSendReinvite && this.currentSipSession
|
|
9888
9903
|
&& this.currentSipSession.state === sessionState.SessionState.Established) {
|
|
9889
9904
|
this.shouldSendReinvite = false;
|
|
9905
|
+
const pc = this.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
9906
|
+
const isConference = pc ? pc.sfu : false;
|
|
9907
|
+
const hasVideo = this.currentCallSession && this.currentCallSession.cameraEnabled;
|
|
9908
|
+
|
|
9890
9909
|
try {
|
|
9891
9910
|
// Send reinvite with iceRestart
|
|
9892
|
-
this.sendReinvite(this.currentCallSession, null,
|
|
9911
|
+
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
9893
9912
|
} catch (e) {
|
|
9894
|
-
logger$
|
|
9913
|
+
logger$4.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
9895
9914
|
}
|
|
9896
9915
|
}
|
|
9897
9916
|
});
|
|
9898
9917
|
|
|
9899
9918
|
this.client.on(this.client.CONNECTED, () => {
|
|
9900
|
-
logger$
|
|
9919
|
+
logger$4.info('WebRTC client connected');
|
|
9901
9920
|
|
|
9902
9921
|
this.stopHeartbeat();
|
|
9903
9922
|
});
|
|
9904
9923
|
|
|
9905
9924
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
9906
|
-
logger$
|
|
9925
|
+
logger$4.info('WebRTC client disconnected');
|
|
9907
9926
|
|
|
9908
9927
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
9909
9928
|
|
|
@@ -9917,7 +9936,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9917
9936
|
});
|
|
9918
9937
|
|
|
9919
9938
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
9920
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
9939
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
9921
9940
|
});
|
|
9922
9941
|
|
|
9923
9942
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -9932,7 +9951,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9932
9951
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
9933
9952
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
9934
9953
|
|
|
9935
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
9954
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, callSession, stats, previousStats);
|
|
9936
9955
|
});
|
|
9937
9956
|
|
|
9938
9957
|
// Used when upgrading directly in screenshare mode
|
|
@@ -9941,7 +9960,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9941
9960
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
9942
9961
|
const callSession = this.callSessions[sipSessionId];
|
|
9943
9962
|
|
|
9944
|
-
logger$
|
|
9963
|
+
logger$4.info('Updrading directly in screensharing mode', {
|
|
9945
9964
|
sipSessionId,
|
|
9946
9965
|
tracks: localStream ? localStream.getTracks() : null,
|
|
9947
9966
|
});
|
|
@@ -9973,6 +9992,15 @@ class WebRTCPhone extends Emitter {
|
|
|
9973
9992
|
return this.client.getSipSessionId(sipSession);
|
|
9974
9993
|
}
|
|
9975
9994
|
|
|
9995
|
+
_updateCallSession(callSession ) {
|
|
9996
|
+
const sipSession = this.findSipSession(callSession);
|
|
9997
|
+
const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
|
|
9998
|
+
|
|
9999
|
+
if (sipSessionId) {
|
|
10000
|
+
this.callSessions[sipSessionId] = callSession;
|
|
10001
|
+
}
|
|
10002
|
+
}
|
|
10003
|
+
|
|
9976
10004
|
_onMessage(message ) {
|
|
9977
10005
|
if (!message || message.method !== 'MESSAGE') {
|
|
9978
10006
|
return;
|
|
@@ -10110,8 +10138,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10110
10138
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10111
10139
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10112
10140
|
ON_MESSAGE: ON_MESSAGE,
|
|
10113
|
-
ON_REINVITE: ON_REINVITE,
|
|
10114
|
-
ON_TRACK: ON_TRACK,
|
|
10141
|
+
ON_REINVITE: ON_REINVITE$1,
|
|
10142
|
+
ON_TRACK: ON_TRACK$1,
|
|
10115
10143
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10116
10144
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10117
10145
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10126,13 +10154,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10126
10154
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10127
10155
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10128
10156
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10129
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10157
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS$1,
|
|
10130
10158
|
ON_CHAT: ON_CHAT,
|
|
10131
10159
|
ON_SIGNAL: ON_SIGNAL,
|
|
10132
|
-
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10160
|
+
ON_DISCONNECTED: ON_DISCONNECTED$1,
|
|
10133
10161
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10134
10162
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10135
|
-
events: events,
|
|
10163
|
+
events: events$1,
|
|
10136
10164
|
'default': WebRTCPhone
|
|
10137
10165
|
});
|
|
10138
10166
|
|
|
@@ -10141,7 +10169,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10141
10169
|
class InvalidSubscription extends Error {}
|
|
10142
10170
|
class InvalidAuthorization extends Error {}
|
|
10143
10171
|
|
|
10144
|
-
const logger$
|
|
10172
|
+
const logger$5 = IssueReporter$1.loggerFor('simple-auth');
|
|
10145
10173
|
|
|
10146
10174
|
class Auth {
|
|
10147
10175
|
|
|
@@ -10176,7 +10204,7 @@ class Auth {
|
|
|
10176
10204
|
setApiClientId(this.clientId);
|
|
10177
10205
|
setRefreshExpiration(this.expiration);
|
|
10178
10206
|
setOnRefreshToken((token , session ) => {
|
|
10179
|
-
logger$
|
|
10207
|
+
logger$5.info('on refresh token done', { token });
|
|
10180
10208
|
setApiToken(token);
|
|
10181
10209
|
Wazo.Websocket.updateToken(token);
|
|
10182
10210
|
|
|
@@ -10221,7 +10249,7 @@ class Auth {
|
|
|
10221
10249
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
10222
10250
|
return this._onAuthenticated(rawSession);
|
|
10223
10251
|
} catch (e) {
|
|
10224
|
-
logger$
|
|
10252
|
+
logger$5.error('on validate token error', e);
|
|
10225
10253
|
console.warn(e);
|
|
10226
10254
|
return false;
|
|
10227
10255
|
}
|
|
@@ -10402,7 +10430,7 @@ var Auth$1 = global.wazoAuthInstance;
|
|
|
10402
10430
|
|
|
10403
10431
|
//
|
|
10404
10432
|
|
|
10405
|
-
const SOCKET_EVENTS
|
|
10433
|
+
const SOCKET_EVENTS = {
|
|
10406
10434
|
ON_OPEN: 'onopen',
|
|
10407
10435
|
ON_MESSAGE: 'onmessage',
|
|
10408
10436
|
ON_ERROR: 'onerror',
|
|
@@ -10555,16 +10583,16 @@ class WebSocketClient extends Emitter {
|
|
|
10555
10583
|
|
|
10556
10584
|
this.socket.onopen = () => {
|
|
10557
10585
|
logger$6.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
10558
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
10586
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
10559
10587
|
};
|
|
10560
10588
|
|
|
10561
10589
|
this.socket.onerror = event => {
|
|
10562
10590
|
logger$6.error('on Wazo WS error', event.target);
|
|
10563
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
10591
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
10564
10592
|
};
|
|
10565
10593
|
|
|
10566
10594
|
this.socket.onmessage = (event ) => {
|
|
10567
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
10595
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
10568
10596
|
|
|
10569
10597
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
10570
10598
|
let { name } = message;
|
|
@@ -10597,11 +10625,11 @@ class WebSocketClient extends Emitter {
|
|
|
10597
10625
|
token: this.token,
|
|
10598
10626
|
});
|
|
10599
10627
|
this.initialized = false;
|
|
10600
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
10628
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
10601
10629
|
|
|
10602
10630
|
switch (event.code) {
|
|
10603
10631
|
case 4002:
|
|
10604
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
10632
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
10605
10633
|
break;
|
|
10606
10634
|
}
|
|
10607
10635
|
};
|
|
@@ -10717,7 +10745,7 @@ class WebSocketClient extends Emitter {
|
|
|
10717
10745
|
break;
|
|
10718
10746
|
case 'start':
|
|
10719
10747
|
this.initialized = true;
|
|
10720
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
10748
|
+
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
10721
10749
|
break;
|
|
10722
10750
|
default:
|
|
10723
10751
|
this.eventEmitter.emit('message', message);
|
|
@@ -10764,7 +10792,7 @@ class WebSocketClient extends Emitter {
|
|
|
10764
10792
|
logger$6.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
10765
10793
|
|
|
10766
10794
|
this.close();
|
|
10767
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
10795
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
10768
10796
|
|
|
10769
10797
|
if (this.onHeartBeatTimeout) {
|
|
10770
10798
|
this.onHeartBeatTimeout();
|
|
@@ -10844,7 +10872,7 @@ WebSocketClient.eventLists = [
|
|
|
10844
10872
|
|
|
10845
10873
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
10846
10874
|
__proto__: null,
|
|
10847
|
-
SOCKET_EVENTS: SOCKET_EVENTS
|
|
10875
|
+
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
10848
10876
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
10849
10877
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
10850
10878
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -10917,10 +10945,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
10917
10945
|
|
|
10918
10946
|
//
|
|
10919
10947
|
|
|
10920
|
-
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
10921
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
10948
|
+
const { SOCKET_EVENTS: SOCKET_EVENTS$1, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
10949
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS$1), ...Object.values(OTHER_EVENTS)];
|
|
10922
10950
|
|
|
10923
|
-
const logger$
|
|
10951
|
+
const logger$7 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
10924
10952
|
|
|
10925
10953
|
class Websocket extends Emitter {
|
|
10926
10954
|
|
|
@@ -10934,9 +10962,9 @@ class Websocket extends Emitter {
|
|
|
10934
10962
|
// $FlowFixMe
|
|
10935
10963
|
this[key] = OTHER_EVENTS[key];
|
|
10936
10964
|
});
|
|
10937
|
-
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
10965
|
+
Object.keys(SOCKET_EVENTS$1).forEach(key => {
|
|
10938
10966
|
// $FlowFixMe
|
|
10939
|
-
this[key] = SOCKET_EVENTS[key];
|
|
10967
|
+
this[key] = SOCKET_EVENTS$1[key];
|
|
10940
10968
|
});
|
|
10941
10969
|
this.eventLists = WebSocketClient.eventLists;
|
|
10942
10970
|
|
|
@@ -10944,7 +10972,7 @@ class Websocket extends Emitter {
|
|
|
10944
10972
|
}
|
|
10945
10973
|
|
|
10946
10974
|
open(host , session ) {
|
|
10947
|
-
logger$
|
|
10975
|
+
logger$7.info('open simple WebSocket', { host, token: session.token });
|
|
10948
10976
|
this.ws = new WebSocketClient(
|
|
10949
10977
|
{
|
|
10950
10978
|
host,
|
|
@@ -10972,7 +11000,7 @@ class Websocket extends Emitter {
|
|
|
10972
11000
|
}
|
|
10973
11001
|
|
|
10974
11002
|
updateToken(token ) {
|
|
10975
|
-
logger$
|
|
11003
|
+
logger$7.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
10976
11004
|
|
|
10977
11005
|
if (!this.ws) {
|
|
10978
11006
|
return;
|
|
@@ -11000,7 +11028,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11000
11028
|
|
|
11001
11029
|
//
|
|
11002
11030
|
|
|
11003
|
-
const logger$
|
|
11031
|
+
const logger$8 = IssueReporter$1.loggerFor('room');
|
|
11004
11032
|
|
|
11005
11033
|
class Participant extends Emitter {
|
|
11006
11034
|
|
|
@@ -11122,7 +11150,7 @@ class Participant extends Emitter {
|
|
|
11122
11150
|
}
|
|
11123
11151
|
|
|
11124
11152
|
onTalking(isTalking ) {
|
|
11125
|
-
logger$
|
|
11153
|
+
logger$8.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
11126
11154
|
this.isTalking = isTalking;
|
|
11127
11155
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
11128
11156
|
// directly from asterisk, there's no need to do so
|
|
@@ -11225,7 +11253,7 @@ class Participant extends Emitter {
|
|
|
11225
11253
|
}
|
|
11226
11254
|
|
|
11227
11255
|
updateStatus(status , broadcast = true) {
|
|
11228
|
-
logger$
|
|
11256
|
+
logger$8.info('updating participant status', { name: this.name, status });
|
|
11229
11257
|
|
|
11230
11258
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
11231
11259
|
if (status.audioMuted) {
|
|
@@ -11273,7 +11301,7 @@ class Participant extends Emitter {
|
|
|
11273
11301
|
|
|
11274
11302
|
broadcastStatus(inboundStatus = null) {
|
|
11275
11303
|
const status = inboundStatus || this.getStatus();
|
|
11276
|
-
logger$
|
|
11304
|
+
logger$8.info('broadcasting participant status', { callId: this.callId, status });
|
|
11277
11305
|
|
|
11278
11306
|
this.room.sendSignal({
|
|
11279
11307
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|
|
@@ -11309,9 +11337,9 @@ class LocalParticipant extends Participant {
|
|
|
11309
11337
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
11310
11338
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
11311
11339
|
|
|
11312
|
-
const logger$
|
|
11340
|
+
const logger$9 = IssueReporter$1.loggerFor('sdk-room');
|
|
11313
11341
|
|
|
11314
|
-
class Room
|
|
11342
|
+
class Room extends Emitter {
|
|
11315
11343
|
|
|
11316
11344
|
|
|
11317
11345
|
|
|
@@ -11369,7 +11397,7 @@ class Room$1 extends Emitter {
|
|
|
11369
11397
|
extra = {},
|
|
11370
11398
|
) {
|
|
11371
11399
|
super();
|
|
11372
|
-
logger$
|
|
11400
|
+
logger$9.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
11373
11401
|
|
|
11374
11402
|
// Represents the room callSession
|
|
11375
11403
|
this.callSession = callSession;
|
|
@@ -11435,7 +11463,7 @@ class Room$1 extends Emitter {
|
|
|
11435
11463
|
* @returns {Promise<Room>}
|
|
11436
11464
|
*/
|
|
11437
11465
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
11438
|
-
logger$
|
|
11466
|
+
logger$9.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
11439
11467
|
|
|
11440
11468
|
if (!room) {
|
|
11441
11469
|
await Wazo.Phone.connect();
|
|
@@ -11448,7 +11476,7 @@ class Room$1 extends Emitter {
|
|
|
11448
11476
|
|
|
11449
11477
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
11450
11478
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
11451
|
-
logger$
|
|
11479
|
+
logger$9.info('room call received via WS', { callId: data.call_id });
|
|
11452
11480
|
if (room) {
|
|
11453
11481
|
room.setCallId(data.call_id);
|
|
11454
11482
|
}
|
|
@@ -11456,7 +11484,7 @@ class Room$1 extends Emitter {
|
|
|
11456
11484
|
|
|
11457
11485
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
11458
11486
|
// eslint-disable-next-line no-param-reassign
|
|
11459
|
-
room = new Room
|
|
11487
|
+
room = new Room(callSession, extension, null, null, extra);
|
|
11460
11488
|
|
|
11461
11489
|
// Wait for the call to be accepted
|
|
11462
11490
|
await new Promise((resolve, reject) => {
|
|
@@ -11477,7 +11505,7 @@ class Room$1 extends Emitter {
|
|
|
11477
11505
|
// Retrieve conference
|
|
11478
11506
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
11479
11507
|
|
|
11480
|
-
logger$
|
|
11508
|
+
logger$9.info('connected to room', {
|
|
11481
11509
|
sourceId: conference ? conference.sourceId : null,
|
|
11482
11510
|
name: conference ? conference.name : null,
|
|
11483
11511
|
});
|
|
@@ -11487,7 +11515,7 @@ class Room$1 extends Emitter {
|
|
|
11487
11515
|
room.setName(conference.name);
|
|
11488
11516
|
}
|
|
11489
11517
|
} else if (meeting) {
|
|
11490
|
-
logger$
|
|
11518
|
+
logger$9.info('Already connected to meeting', {
|
|
11491
11519
|
uuid: meeting.uuid,
|
|
11492
11520
|
name: meeting.name,
|
|
11493
11521
|
});
|
|
@@ -11500,13 +11528,13 @@ class Room$1 extends Emitter {
|
|
|
11500
11528
|
}
|
|
11501
11529
|
|
|
11502
11530
|
static disconnect() {
|
|
11503
|
-
logger$
|
|
11531
|
+
logger$9.info('static disconnection to room');
|
|
11504
11532
|
|
|
11505
11533
|
Wazo.Phone.disconnect();
|
|
11506
11534
|
}
|
|
11507
11535
|
|
|
11508
11536
|
async disconnect() {
|
|
11509
|
-
logger$
|
|
11537
|
+
logger$9.info('disconnection to room called');
|
|
11510
11538
|
|
|
11511
11539
|
await Wazo.Phone.hangup(this.callSession);
|
|
11512
11540
|
this.callSession = null;
|
|
@@ -11526,19 +11554,19 @@ class Room$1 extends Emitter {
|
|
|
11526
11554
|
}
|
|
11527
11555
|
|
|
11528
11556
|
setSourceId(sourceId ) {
|
|
11529
|
-
logger$
|
|
11557
|
+
logger$9.info('set room source id', { sourceId });
|
|
11530
11558
|
|
|
11531
11559
|
this.sourceId = sourceId;
|
|
11532
11560
|
}
|
|
11533
11561
|
|
|
11534
11562
|
setMeetingUuid(meetingUuid ) {
|
|
11535
|
-
logger$
|
|
11563
|
+
logger$9.info('set meeting uuid', { meetingUuid });
|
|
11536
11564
|
|
|
11537
11565
|
this.meetingUuid = meetingUuid;
|
|
11538
11566
|
}
|
|
11539
11567
|
|
|
11540
11568
|
setCallId(callId ) {
|
|
11541
|
-
logger$
|
|
11569
|
+
logger$9.info('set room call id', { callId });
|
|
11542
11570
|
|
|
11543
11571
|
if (callId) {
|
|
11544
11572
|
this.callId = callId;
|
|
@@ -11546,7 +11574,7 @@ class Room$1 extends Emitter {
|
|
|
11546
11574
|
}
|
|
11547
11575
|
|
|
11548
11576
|
setName(name ) {
|
|
11549
|
-
logger$
|
|
11577
|
+
logger$9.info('set room name', { name });
|
|
11550
11578
|
|
|
11551
11579
|
this.name = name;
|
|
11552
11580
|
}
|
|
@@ -11565,7 +11593,7 @@ class Room$1 extends Emitter {
|
|
|
11565
11593
|
}
|
|
11566
11594
|
|
|
11567
11595
|
async startScreenSharing(constraints ) {
|
|
11568
|
-
logger$
|
|
11596
|
+
logger$9.info('start room screen sharing', { constraints });
|
|
11569
11597
|
|
|
11570
11598
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
11571
11599
|
if (!screensharingStream) {
|
|
@@ -11579,7 +11607,7 @@ class Room$1 extends Emitter {
|
|
|
11579
11607
|
}
|
|
11580
11608
|
|
|
11581
11609
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
11582
|
-
logger$
|
|
11610
|
+
logger$9.info('stop room screen sharing');
|
|
11583
11611
|
|
|
11584
11612
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
11585
11613
|
|
|
@@ -11591,7 +11619,7 @@ class Room$1 extends Emitter {
|
|
|
11591
11619
|
}
|
|
11592
11620
|
|
|
11593
11621
|
turnCameraOff() {
|
|
11594
|
-
logger$
|
|
11622
|
+
logger$9.info('turn room camera off');
|
|
11595
11623
|
|
|
11596
11624
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
11597
11625
|
|
|
@@ -11601,7 +11629,7 @@ class Room$1 extends Emitter {
|
|
|
11601
11629
|
}
|
|
11602
11630
|
|
|
11603
11631
|
turnCameraOn() {
|
|
11604
|
-
logger$
|
|
11632
|
+
logger$9.info('turn room camera on');
|
|
11605
11633
|
|
|
11606
11634
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
11607
11635
|
|
|
@@ -11611,7 +11639,7 @@ class Room$1 extends Emitter {
|
|
|
11611
11639
|
}
|
|
11612
11640
|
|
|
11613
11641
|
mute() {
|
|
11614
|
-
logger$
|
|
11642
|
+
logger$9.info('mute room');
|
|
11615
11643
|
|
|
11616
11644
|
Wazo.Phone.mute(this.callSession);
|
|
11617
11645
|
|
|
@@ -11619,7 +11647,7 @@ class Room$1 extends Emitter {
|
|
|
11619
11647
|
}
|
|
11620
11648
|
|
|
11621
11649
|
unmute() {
|
|
11622
|
-
logger$
|
|
11650
|
+
logger$9.info('unmute room');
|
|
11623
11651
|
|
|
11624
11652
|
Wazo.Phone.unmute(this.callSession);
|
|
11625
11653
|
|
|
@@ -11639,7 +11667,7 @@ class Room$1 extends Emitter {
|
|
|
11639
11667
|
}
|
|
11640
11668
|
|
|
11641
11669
|
hold() {
|
|
11642
|
-
logger$
|
|
11670
|
+
logger$9.info('hold room');
|
|
11643
11671
|
|
|
11644
11672
|
Wazo.Phone.hold(this.callSession, true);
|
|
11645
11673
|
|
|
@@ -11649,7 +11677,7 @@ class Room$1 extends Emitter {
|
|
|
11649
11677
|
}
|
|
11650
11678
|
|
|
11651
11679
|
async resume() {
|
|
11652
|
-
logger$
|
|
11680
|
+
logger$9.info('resume room');
|
|
11653
11681
|
|
|
11654
11682
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
11655
11683
|
|
|
@@ -11677,13 +11705,13 @@ class Room$1 extends Emitter {
|
|
|
11677
11705
|
}
|
|
11678
11706
|
|
|
11679
11707
|
sendDTMF(tone ) {
|
|
11680
|
-
logger$
|
|
11708
|
+
logger$9.info('send room DTMF', { tone });
|
|
11681
11709
|
|
|
11682
11710
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
11683
11711
|
}
|
|
11684
11712
|
|
|
11685
11713
|
async sendReinvite(newConstraints = null) {
|
|
11686
|
-
logger$
|
|
11714
|
+
logger$9.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
11687
11715
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
11688
11716
|
|
|
11689
11717
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -11742,7 +11770,7 @@ class Room$1 extends Emitter {
|
|
|
11742
11770
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
11743
11771
|
|
|
11744
11772
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
11745
|
-
logger$
|
|
11773
|
+
logger$9.info('on room audio stream');
|
|
11746
11774
|
|
|
11747
11775
|
this.audioStream = stream;
|
|
11748
11776
|
if (!this.roomAudioElement) {
|
|
@@ -11755,7 +11783,7 @@ class Room$1 extends Emitter {
|
|
|
11755
11783
|
});
|
|
11756
11784
|
|
|
11757
11785
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
11758
|
-
logger$
|
|
11786
|
+
logger$9.info('on room video stream', { streamId });
|
|
11759
11787
|
|
|
11760
11788
|
this._mapMsid(sipSession.body.body);
|
|
11761
11789
|
|
|
@@ -11770,7 +11798,7 @@ class Room$1 extends Emitter {
|
|
|
11770
11798
|
});
|
|
11771
11799
|
|
|
11772
11800
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
11773
|
-
logger$
|
|
11801
|
+
logger$9.info('on room remove stream');
|
|
11774
11802
|
|
|
11775
11803
|
const participant = this.participants.find(someParticipant =>
|
|
11776
11804
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -11902,7 +11930,7 @@ class Room$1 extends Emitter {
|
|
|
11902
11930
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
11903
11931
|
if (requester) {
|
|
11904
11932
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
11905
|
-
logger$
|
|
11933
|
+
logger$9.info('trigger room requester status', { origin });
|
|
11906
11934
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
11907
11935
|
}
|
|
11908
11936
|
break;
|
|
@@ -11933,24 +11961,24 @@ class Room$1 extends Emitter {
|
|
|
11933
11961
|
|
|
11934
11962
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
11935
11963
|
if (participant.user_uuid === session.uuid) {
|
|
11936
|
-
logger$
|
|
11964
|
+
logger$9.info('room current user joined');
|
|
11937
11965
|
|
|
11938
11966
|
// Retrieve participants via an API calls
|
|
11939
11967
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
11940
11968
|
let response;
|
|
11941
11969
|
try {
|
|
11942
11970
|
if (this.meetingUuid) {
|
|
11943
|
-
logger$
|
|
11971
|
+
logger$9.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
11944
11972
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
11945
11973
|
} else {
|
|
11946
|
-
logger$
|
|
11974
|
+
logger$9.info('fetching conference participants', { conferenceId });
|
|
11947
11975
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
11948
11976
|
}
|
|
11949
11977
|
} catch (e) {
|
|
11950
|
-
logger$
|
|
11978
|
+
logger$9.error('room participants fetching, error', e);
|
|
11951
11979
|
}
|
|
11952
11980
|
if (response) {
|
|
11953
|
-
logger$
|
|
11981
|
+
logger$9.info('conference participants fetched', { nb: response.items.length });
|
|
11954
11982
|
participants = response.items.map(item => {
|
|
11955
11983
|
const isMe = item.call_id === this.callId;
|
|
11956
11984
|
|
|
@@ -11977,7 +12005,7 @@ class Room$1 extends Emitter {
|
|
|
11977
12005
|
? new Wazo.RemoteParticipant(this, participant)
|
|
11978
12006
|
: null;
|
|
11979
12007
|
|
|
11980
|
-
logger$
|
|
12008
|
+
logger$9.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
11981
12009
|
|
|
11982
12010
|
if (remoteParticipant) {
|
|
11983
12011
|
this.participants.push(remoteParticipant);
|
|
@@ -12142,12 +12170,12 @@ class Room$1 extends Emitter {
|
|
|
12142
12170
|
|
|
12143
12171
|
//
|
|
12144
12172
|
|
|
12145
|
-
const logger$
|
|
12173
|
+
const logger$a = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
12146
12174
|
|
|
12147
|
-
class SipRoom extends Room
|
|
12175
|
+
class SipRoom extends Room {
|
|
12148
12176
|
|
|
12149
12177
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
12150
|
-
logger$
|
|
12178
|
+
logger$a.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
12151
12179
|
|
|
12152
12180
|
if (!room) {
|
|
12153
12181
|
await Wazo.Phone.connect();
|
|
@@ -12163,7 +12191,7 @@ class SipRoom extends Room$1 {
|
|
|
12163
12191
|
room.setCallId(room.callSession.call.id);
|
|
12164
12192
|
}
|
|
12165
12193
|
|
|
12166
|
-
logger$
|
|
12194
|
+
logger$a.info('connected to room', {
|
|
12167
12195
|
extension: room.extension,
|
|
12168
12196
|
});
|
|
12169
12197
|
|
|
@@ -12171,7 +12199,7 @@ class SipRoom extends Room$1 {
|
|
|
12171
12199
|
}
|
|
12172
12200
|
|
|
12173
12201
|
mute() {
|
|
12174
|
-
logger$
|
|
12202
|
+
logger$a.info('mute sip room');
|
|
12175
12203
|
|
|
12176
12204
|
Wazo.Phone.mute(this.callSession, false);
|
|
12177
12205
|
|
|
@@ -12179,7 +12207,7 @@ class SipRoom extends Room$1 {
|
|
|
12179
12207
|
}
|
|
12180
12208
|
|
|
12181
12209
|
unmute() {
|
|
12182
|
-
logger$
|
|
12210
|
+
logger$a.info('unmute sip room');
|
|
12183
12211
|
|
|
12184
12212
|
Wazo.Phone.unmute(this.callSession, false);
|
|
12185
12213
|
|
|
@@ -12463,7 +12491,7 @@ class NotificationOptions {
|
|
|
12463
12491
|
|
|
12464
12492
|
|
|
12465
12493
|
// Represents a conference room, like `9000`.
|
|
12466
|
-
class Room {
|
|
12494
|
+
class Room$1 {
|
|
12467
12495
|
|
|
12468
12496
|
|
|
12469
12497
|
|
|
@@ -12484,7 +12512,7 @@ class Room {
|
|
|
12484
12512
|
}
|
|
12485
12513
|
|
|
12486
12514
|
connect(callSession ) {
|
|
12487
|
-
return new Room({ ...this, connectedCallSession: callSession });
|
|
12515
|
+
return new Room$1({ ...this, connectedCallSession: callSession });
|
|
12488
12516
|
}
|
|
12489
12517
|
|
|
12490
12518
|
has(callSession ) {
|
|
@@ -12493,7 +12521,7 @@ class Room {
|
|
|
12493
12521
|
|
|
12494
12522
|
addParticipant(uuid , extension , talking = null) {
|
|
12495
12523
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
12496
|
-
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12524
|
+
return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12497
12525
|
}
|
|
12498
12526
|
|
|
12499
12527
|
return this;
|
|
@@ -12512,7 +12540,7 @@ class Room {
|
|
|
12512
12540
|
updatedParticipants.push(participant);
|
|
12513
12541
|
}
|
|
12514
12542
|
|
|
12515
|
-
return new Room({ ...this, participants: updatedParticipants });
|
|
12543
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
12516
12544
|
}
|
|
12517
12545
|
|
|
12518
12546
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -12528,7 +12556,7 @@ class Room {
|
|
|
12528
12556
|
updatedParticipants.push(participant);
|
|
12529
12557
|
}
|
|
12530
12558
|
|
|
12531
|
-
return new Room({ ...this, participants: updatedParticipants });
|
|
12559
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
12532
12560
|
}
|
|
12533
12561
|
|
|
12534
12562
|
hasCallWithId(id ) {
|
|
@@ -12536,18 +12564,18 @@ class Room {
|
|
|
12536
12564
|
}
|
|
12537
12565
|
|
|
12538
12566
|
disconnect() {
|
|
12539
|
-
return new Room({ ...this, connectedCallSession: null });
|
|
12567
|
+
return new Room$1({ ...this, connectedCallSession: null });
|
|
12540
12568
|
}
|
|
12541
12569
|
|
|
12542
12570
|
removeParticipantWithUUID(uuid ) {
|
|
12543
|
-
return new Room({
|
|
12571
|
+
return new Room$1({
|
|
12544
12572
|
...this,
|
|
12545
12573
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
12546
12574
|
});
|
|
12547
12575
|
}
|
|
12548
12576
|
|
|
12549
12577
|
removeParticipantWithExtension(extension ) {
|
|
12550
|
-
return new Room({
|
|
12578
|
+
return new Room$1({
|
|
12551
12579
|
...this,
|
|
12552
12580
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
12553
12581
|
});
|
|
@@ -12558,7 +12586,7 @@ class Room {
|
|
|
12558
12586
|
}
|
|
12559
12587
|
|
|
12560
12588
|
static newFrom(room ) {
|
|
12561
|
-
return newFrom(room, Room);
|
|
12589
|
+
return newFrom(room, Room$1);
|
|
12562
12590
|
}
|
|
12563
12591
|
}
|
|
12564
12592
|
|
|
@@ -12865,11 +12893,11 @@ var wazoWebsocket = {
|
|
|
12865
12893
|
resolve();
|
|
12866
12894
|
};
|
|
12867
12895
|
|
|
12868
|
-
client.on(SOCKET_EVENTS
|
|
12896
|
+
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
12869
12897
|
handleError(`Connection error : ${error}`);
|
|
12870
12898
|
});
|
|
12871
12899
|
|
|
12872
|
-
client.on(SOCKET_EVENTS
|
|
12900
|
+
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
12873
12901
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
12874
12902
|
client.setOnHeartbeatTimeout(() => {
|
|
12875
12903
|
handleError('No response to heartbeat');
|
|
@@ -12970,7 +12998,7 @@ var webrtc = {
|
|
|
12970
12998
|
}),
|
|
12971
12999
|
};
|
|
12972
13000
|
|
|
12973
|
-
const parseCandidate = line => {
|
|
13001
|
+
const parseCandidate$1 = line => {
|
|
12974
13002
|
let parts;
|
|
12975
13003
|
// Parse both variants.
|
|
12976
13004
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -13061,7 +13089,7 @@ var SymmetricNat = {
|
|
|
13061
13089
|
}
|
|
13062
13090
|
|
|
13063
13091
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
13064
|
-
const cand = parseCandidate(e.candidate.candidate);
|
|
13092
|
+
const cand = parseCandidate$1(e.candidate.candidate);
|
|
13065
13093
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
13066
13094
|
candidates[cand.relatedPort].push(cand.port);
|
|
13067
13095
|
} else if (!e.candidate) {
|
|
@@ -13129,7 +13157,7 @@ var iceIpv4 = {
|
|
|
13129
13157
|
const rawCandidate = e.candidate.candidate;
|
|
13130
13158
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
13131
13159
|
hasSrflxOrRelay = true;
|
|
13132
|
-
const candidate = parseCandidate(e.candidate.candidate);
|
|
13160
|
+
const candidate = parseCandidate$1(e.candidate.candidate);
|
|
13133
13161
|
ips.push(candidate.ip);
|
|
13134
13162
|
}
|
|
13135
13163
|
} else if (!e.candidate) {
|
|
@@ -13166,7 +13194,7 @@ var checks = [
|
|
|
13166
13194
|
|
|
13167
13195
|
//
|
|
13168
13196
|
|
|
13169
|
-
const logger$
|
|
13197
|
+
const logger$b = IssueReporter$1.loggerFor('engine-check');
|
|
13170
13198
|
|
|
13171
13199
|
class Checker {
|
|
13172
13200
|
|
|
@@ -13184,28 +13212,28 @@ class Checker {
|
|
|
13184
13212
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
13185
13213
|
await this._addEngineVersion();
|
|
13186
13214
|
|
|
13187
|
-
logger$
|
|
13215
|
+
logger$b.info('Engine check starting');
|
|
13188
13216
|
|
|
13189
13217
|
for (let i = 0; i < this.checks.length; i++) {
|
|
13190
13218
|
const { name, check } = this.checks[i];
|
|
13191
13219
|
|
|
13192
|
-
logger$
|
|
13220
|
+
logger$b.info(`Checking ${name} ...`);
|
|
13193
13221
|
|
|
13194
13222
|
onCheckBegin(name);
|
|
13195
13223
|
try {
|
|
13196
13224
|
// eslint-disable-next-line no-await-in-loop
|
|
13197
13225
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
13198
|
-
logger$
|
|
13226
|
+
logger$b.info(`Checking ${name} success.`, { result });
|
|
13199
13227
|
|
|
13200
13228
|
onCheckResult(name, result);
|
|
13201
13229
|
} catch (e) {
|
|
13202
|
-
logger$
|
|
13230
|
+
logger$b.info(`Checking ${name} failure`, { message: e.message });
|
|
13203
13231
|
|
|
13204
13232
|
onCheckResult(name, e);
|
|
13205
13233
|
}
|
|
13206
13234
|
}
|
|
13207
13235
|
|
|
13208
|
-
logger$
|
|
13236
|
+
logger$b.info('Engine check done.');
|
|
13209
13237
|
}
|
|
13210
13238
|
|
|
13211
13239
|
addCheck(check ) {
|
|
@@ -13229,7 +13257,7 @@ const Wazo = {
|
|
|
13229
13257
|
Auth: Auth$1,
|
|
13230
13258
|
Phone: Phone$1,
|
|
13231
13259
|
Websocket: Websocket$1,
|
|
13232
|
-
Room
|
|
13260
|
+
Room,
|
|
13233
13261
|
SipRoom,
|
|
13234
13262
|
RemoteParticipant,
|
|
13235
13263
|
LocalParticipant,
|
|
@@ -13262,7 +13290,7 @@ const Wazo = {
|
|
|
13262
13290
|
Session,
|
|
13263
13291
|
Voicemail,
|
|
13264
13292
|
Relocation,
|
|
13265
|
-
ConferenceRoom: Room,
|
|
13293
|
+
ConferenceRoom: Room$1,
|
|
13266
13294
|
CallSession,
|
|
13267
13295
|
IndirectTransfer,
|
|
13268
13296
|
SwitchboardCall,
|
|
@@ -13298,7 +13326,7 @@ if (global) {
|
|
|
13298
13326
|
|
|
13299
13327
|
//
|
|
13300
13328
|
|
|
13301
|
-
const logger = IssueReporter$1.loggerFor('simple-phone');
|
|
13329
|
+
const logger$c = IssueReporter$1.loggerFor('simple-phone');
|
|
13302
13330
|
const sipLogger = IssueReporter$1.loggerFor('sip.js');
|
|
13303
13331
|
const protocolLogger = IssueReporter$1.loggerFor('sip');
|
|
13304
13332
|
|
|
@@ -13405,7 +13433,7 @@ class Phone extends Emitter {
|
|
|
13405
13433
|
async disconnect() {
|
|
13406
13434
|
if (this.phone) {
|
|
13407
13435
|
if (this.phone.hasAnActiveCall()) {
|
|
13408
|
-
logger.info('hangup call on disconnect');
|
|
13436
|
+
logger$c.info('hangup call on disconnect');
|
|
13409
13437
|
// $FlowFixMe
|
|
13410
13438
|
await this.phone.hangup();
|
|
13411
13439
|
}
|
|
@@ -13428,13 +13456,13 @@ class Phone extends Emitter {
|
|
|
13428
13456
|
}
|
|
13429
13457
|
|
|
13430
13458
|
async hangup(callSession ) {
|
|
13431
|
-
logger.info('hangup via simple phone', { callId: callSession.getId() });
|
|
13459
|
+
logger$c.info('hangup via simple phone', { callId: callSession.getId() });
|
|
13432
13460
|
|
|
13433
13461
|
return this.phone && this.phone.hangup(callSession);
|
|
13434
13462
|
}
|
|
13435
13463
|
|
|
13436
13464
|
async accept(callSession , cameraEnabled ) {
|
|
13437
|
-
logger.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
|
|
13465
|
+
logger$c.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
|
|
13438
13466
|
|
|
13439
13467
|
return this.phone && this.phone.accept(callSession, cameraEnabled);
|
|
13440
13468
|
}
|
|
@@ -13473,7 +13501,7 @@ class Phone extends Emitter {
|
|
|
13473
13501
|
muteViaAPI(callSession ) {
|
|
13474
13502
|
if (callSession && callSession.callId) {
|
|
13475
13503
|
Wazo.getApiClient().calld.mute(callSession.callId).catch(e => {
|
|
13476
|
-
logger.error('Mute via API, error', e);
|
|
13504
|
+
logger$c.error('Mute via API, error', e);
|
|
13477
13505
|
});
|
|
13478
13506
|
}
|
|
13479
13507
|
}
|
|
@@ -13481,7 +13509,7 @@ class Phone extends Emitter {
|
|
|
13481
13509
|
unmuteViaAPI(callSession ) {
|
|
13482
13510
|
if (callSession && callSession.callId) {
|
|
13483
13511
|
Wazo.getApiClient().calld.unmute(callSession.callId).catch(e => {
|
|
13484
|
-
logger.error('Unmute via API, error', e);
|
|
13512
|
+
logger$c.error('Unmute via API, error', e);
|
|
13485
13513
|
});
|
|
13486
13514
|
}
|
|
13487
13515
|
}
|
|
@@ -13589,7 +13617,7 @@ class Phone extends Emitter {
|
|
|
13589
13617
|
|
|
13590
13618
|
// @Deprecated
|
|
13591
13619
|
getLocalMediaStream(callSession ) {
|
|
13592
|
-
logger.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
|
|
13620
|
+
logger$c.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
|
|
13593
13621
|
|
|
13594
13622
|
return this.phone && this.phone.getLocalStream(callSession);
|
|
13595
13623
|
}
|
|
@@ -13612,20 +13640,20 @@ class Phone extends Emitter {
|
|
|
13612
13640
|
|
|
13613
13641
|
// @Deprecated
|
|
13614
13642
|
getRemoteStreamForCall(callSession ) {
|
|
13615
|
-
logger.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
|
|
13643
|
+
logger$c.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
|
|
13616
13644
|
return this.getRemoteStream(callSession);
|
|
13617
13645
|
}
|
|
13618
13646
|
|
|
13619
13647
|
// Returns remote streams directly from the peerConnection
|
|
13620
13648
|
// @Deprecated
|
|
13621
13649
|
getRemoteStreamsForCall(callSession ) {
|
|
13622
|
-
logger.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
|
|
13650
|
+
logger$c.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
|
|
13623
13651
|
return this.getLocalStream(callSession);
|
|
13624
13652
|
}
|
|
13625
13653
|
|
|
13626
13654
|
// @Deprecated
|
|
13627
13655
|
getRemoteVideoStreamForCall(callSession ) {
|
|
13628
|
-
logger.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
|
|
13656
|
+
logger$c.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
|
|
13629
13657
|
|
|
13630
13658
|
return this.getRemoteVideoStream(callSession);
|
|
13631
13659
|
}
|
|
@@ -13686,7 +13714,7 @@ class Phone extends Emitter {
|
|
|
13686
13714
|
|
|
13687
13715
|
_transferEvents() {
|
|
13688
13716
|
this.unbind();
|
|
13689
|
-
[...events
|
|
13717
|
+
[...events, ...transportEvents].forEach(event => {
|
|
13690
13718
|
this.client.on(event, (...args) =>
|
|
13691
13719
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
13692
13720
|
});
|