@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
|
@@ -1957,7 +1957,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
1957
1957
|
|
|
1958
1958
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
1959
1959
|
|
|
1960
|
-
const logger
|
|
1960
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1961
1961
|
|
|
1962
1962
|
// Use a function here to be able to mock it in tests
|
|
1963
1963
|
const realFetch = () => {
|
|
@@ -2096,7 +2096,7 @@ class ApiRequester {
|
|
|
2096
2096
|
};
|
|
2097
2097
|
|
|
2098
2098
|
if (this.refreshTokenPromise) {
|
|
2099
|
-
logger
|
|
2099
|
+
logger.info('A token is already refreshing, waiting ...', { url });
|
|
2100
2100
|
await this.refreshTokenPromise;
|
|
2101
2101
|
}
|
|
2102
2102
|
|
|
@@ -2116,7 +2116,7 @@ class ApiRequester {
|
|
|
2116
2116
|
return promise.then(async (err ) => {
|
|
2117
2117
|
// Check if the token is still valid
|
|
2118
2118
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
2119
|
-
logger
|
|
2119
|
+
logger.warn('token expired', { error: err.reason });
|
|
2120
2120
|
// Replay the call after refreshing the token
|
|
2121
2121
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
2122
2122
|
}
|
|
@@ -2126,7 +2126,7 @@ class ApiRequester {
|
|
|
2126
2126
|
: exceptionClass.fromResponse(err, response.status);
|
|
2127
2127
|
|
|
2128
2128
|
if (this.shouldLogErrors) {
|
|
2129
|
-
logger
|
|
2129
|
+
logger.error('API error', error);
|
|
2130
2130
|
}
|
|
2131
2131
|
|
|
2132
2132
|
throw error;
|
|
@@ -2136,7 +2136,7 @@ class ApiRequester {
|
|
|
2136
2136
|
return newParse(response, isJson);
|
|
2137
2137
|
}).catch(error => {
|
|
2138
2138
|
if (this.shouldLogErrors) {
|
|
2139
|
-
logger
|
|
2139
|
+
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2140
2140
|
}
|
|
2141
2141
|
|
|
2142
2142
|
throw error;
|
|
@@ -2164,13 +2164,13 @@ class ApiRequester {
|
|
|
2164
2164
|
) {
|
|
2165
2165
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
2166
2166
|
let newPath = path;
|
|
2167
|
-
logger
|
|
2167
|
+
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2168
2168
|
|
|
2169
2169
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
2170
2170
|
|
|
2171
2171
|
return this.refreshTokenPromise.then(() => {
|
|
2172
2172
|
this.refreshTokenPromise = null;
|
|
2173
|
-
logger
|
|
2173
|
+
logger.info('token refreshed', { isTokenNotFound });
|
|
2174
2174
|
if (isTokenNotFound) {
|
|
2175
2175
|
const pathParts = path.split('/');
|
|
2176
2176
|
pathParts.pop();
|
|
@@ -2640,8 +2640,9 @@ class ExternalApp {
|
|
|
2640
2640
|
|
|
2641
2641
|
|
|
2642
2642
|
|
|
2643
|
-
|
|
2643
|
+
|
|
2644
2644
|
|
|
2645
|
+
|
|
2645
2646
|
|
|
2646
2647
|
|
|
2647
2648
|
class Meeting {
|
|
@@ -2652,9 +2653,10 @@ class Meeting {
|
|
|
2652
2653
|
|
|
2653
2654
|
|
|
2654
2655
|
|
|
2655
|
-
|
|
2656
|
+
|
|
2656
2657
|
|
|
2657
2658
|
|
|
2659
|
+
|
|
2658
2660
|
|
|
2659
2661
|
static parse(plain ) {
|
|
2660
2662
|
return new Meeting({
|
|
@@ -2664,8 +2666,9 @@ class Meeting {
|
|
|
2664
2666
|
ownerUuids: plain.owner_uuids,
|
|
2665
2667
|
port: plain.port,
|
|
2666
2668
|
uuid: plain.uuid,
|
|
2667
|
-
|
|
2669
|
+
extension: plain.exten,
|
|
2668
2670
|
persistent: plain.persistent,
|
|
2671
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2669
2672
|
});
|
|
2670
2673
|
}
|
|
2671
2674
|
|
|
@@ -2687,8 +2690,9 @@ class Meeting {
|
|
|
2687
2690
|
ownerUuids,
|
|
2688
2691
|
port,
|
|
2689
2692
|
uri,
|
|
2690
|
-
|
|
2693
|
+
extension,
|
|
2691
2694
|
persistent,
|
|
2695
|
+
creationTime,
|
|
2692
2696
|
} = {}) {
|
|
2693
2697
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2694
2698
|
this.uri = uri;
|
|
@@ -2696,8 +2700,9 @@ class Meeting {
|
|
|
2696
2700
|
this.ownerUuids = ownerUuids;
|
|
2697
2701
|
this.port = port;
|
|
2698
2702
|
this.uuid = uuid;
|
|
2699
|
-
this.
|
|
2703
|
+
this.extension = extension;
|
|
2700
2704
|
this.persistent = persistent;
|
|
2705
|
+
this.creationTime = creationTime;
|
|
2701
2706
|
|
|
2702
2707
|
// Useful to compare instead of instanceof with minified code
|
|
2703
2708
|
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);
|
|
@@ -5519,7 +5524,7 @@ var getApiClient = (forServer ) => {
|
|
|
5519
5524
|
class InvalidSubscription extends Error {}
|
|
5520
5525
|
class InvalidAuthorization extends Error {}
|
|
5521
5526
|
|
|
5522
|
-
const logger$
|
|
5527
|
+
const logger$3 = IssueReporter$1.loggerFor('simple-auth');
|
|
5523
5528
|
|
|
5524
5529
|
class Auth {
|
|
5525
5530
|
|
|
@@ -5554,7 +5559,7 @@ class Auth {
|
|
|
5554
5559
|
setApiClientId(this.clientId);
|
|
5555
5560
|
setRefreshExpiration(this.expiration);
|
|
5556
5561
|
setOnRefreshToken((token , session ) => {
|
|
5557
|
-
logger$
|
|
5562
|
+
logger$3.info('on refresh token done', { token });
|
|
5558
5563
|
setApiToken(token);
|
|
5559
5564
|
Wazo.Websocket.updateToken(token);
|
|
5560
5565
|
|
|
@@ -5599,7 +5604,7 @@ class Auth {
|
|
|
5599
5604
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
5600
5605
|
return this._onAuthenticated(rawSession);
|
|
5601
5606
|
} catch (e) {
|
|
5602
|
-
logger$
|
|
5607
|
+
logger$3.error('on validate token error', e);
|
|
5603
5608
|
console.warn(e);
|
|
5604
5609
|
return false;
|
|
5605
5610
|
}
|
|
@@ -5955,7 +5960,7 @@ class AdHocAPIConference {
|
|
|
5955
5960
|
|
|
5956
5961
|
/* */
|
|
5957
5962
|
|
|
5958
|
-
const parseCandidate
|
|
5963
|
+
const parseCandidate = (candidate ) => {
|
|
5959
5964
|
if (!candidate) {
|
|
5960
5965
|
return null;
|
|
5961
5966
|
}
|
|
@@ -6109,7 +6114,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6109
6114
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
6110
6115
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6111
6116
|
if (event.candidate) {
|
|
6112
|
-
this.gatheredCandidates.push(parseCandidate
|
|
6117
|
+
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
6113
6118
|
}
|
|
6114
6119
|
};
|
|
6115
6120
|
|
|
@@ -6573,7 +6578,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6573
6578
|
const SEND_STATS_DELAY = 5000;
|
|
6574
6579
|
|
|
6575
6580
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6576
|
-
const logger$
|
|
6581
|
+
const logger$4 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6577
6582
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6578
6583
|
|
|
6579
6584
|
// events
|
|
@@ -6587,14 +6592,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6587
6592
|
const MESSAGE = 'message';
|
|
6588
6593
|
const ACCEPTED = 'accepted';
|
|
6589
6594
|
const REJECTED = 'rejected';
|
|
6590
|
-
const ON_TRACK
|
|
6591
|
-
const ON_REINVITE
|
|
6595
|
+
const ON_TRACK = 'onTrack';
|
|
6596
|
+
const ON_REINVITE = 'reinvite';
|
|
6592
6597
|
const ON_ERROR = 'onError';
|
|
6593
6598
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6594
|
-
const ON_NETWORK_STATS
|
|
6595
|
-
const ON_DISCONNECTED
|
|
6599
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6600
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
6596
6601
|
|
|
6597
|
-
const events
|
|
6602
|
+
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6598
6603
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6599
6604
|
class CanceledCallError extends Error {}
|
|
6600
6605
|
|
|
@@ -6730,12 +6735,12 @@ class WebRTCClient extends Emitter {
|
|
|
6730
6735
|
this.MESSAGE = MESSAGE;
|
|
6731
6736
|
this.ACCEPTED = ACCEPTED;
|
|
6732
6737
|
this.REJECTED = REJECTED;
|
|
6733
|
-
this.ON_TRACK = ON_TRACK
|
|
6734
|
-
this.ON_REINVITE = ON_REINVITE
|
|
6738
|
+
this.ON_TRACK = ON_TRACK;
|
|
6739
|
+
this.ON_REINVITE = ON_REINVITE;
|
|
6735
6740
|
this.ON_ERROR = ON_ERROR;
|
|
6736
6741
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6737
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS
|
|
6738
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED
|
|
6742
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6743
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6739
6744
|
}
|
|
6740
6745
|
|
|
6741
6746
|
configureMedia(media ) {
|
|
@@ -6752,13 +6757,13 @@ class WebRTCClient extends Emitter {
|
|
|
6752
6757
|
|
|
6753
6758
|
createUserAgent(configOverrides ) {
|
|
6754
6759
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6755
|
-
logger$
|
|
6760
|
+
logger$4.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6756
6761
|
|
|
6757
6762
|
webRTCConfiguration.delegate = {
|
|
6758
6763
|
onConnect: this.onConnect.bind(this),
|
|
6759
6764
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6760
6765
|
onInvite: (invitation ) => {
|
|
6761
|
-
logger$
|
|
6766
|
+
logger$4.info('sdk webrtc on invite', {
|
|
6762
6767
|
method: 'delegate.onInvite',
|
|
6763
6768
|
id: invitation.id,
|
|
6764
6769
|
remoteURI: invitation.remoteURI,
|
|
@@ -6801,7 +6806,7 @@ class WebRTCClient extends Emitter {
|
|
|
6801
6806
|
}
|
|
6802
6807
|
|
|
6803
6808
|
onConnect() {
|
|
6804
|
-
logger$
|
|
6809
|
+
logger$4.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6805
6810
|
this.eventEmitter.emit(CONNECTED);
|
|
6806
6811
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6807
6812
|
this.registerer.waitingToggle(false);
|
|
@@ -6810,7 +6815,7 @@ class WebRTCClient extends Emitter {
|
|
|
6810
6815
|
}
|
|
6811
6816
|
|
|
6812
6817
|
async onDisconnect(error ) {
|
|
6813
|
-
logger$
|
|
6818
|
+
logger$4.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6814
6819
|
this.connectionPromise = null;
|
|
6815
6820
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6816
6821
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6835,37 +6840,37 @@ class WebRTCClient extends Emitter {
|
|
|
6835
6840
|
};
|
|
6836
6841
|
|
|
6837
6842
|
if (this.skipRegister) {
|
|
6838
|
-
logger$
|
|
6843
|
+
logger$4.info('sdk webrtc skip register...', logInfo);
|
|
6839
6844
|
return Promise.resolve();
|
|
6840
6845
|
}
|
|
6841
6846
|
|
|
6842
|
-
logger$
|
|
6847
|
+
logger$4.info('sdk webrtc registering...', logInfo);
|
|
6843
6848
|
|
|
6844
6849
|
if (!this.userAgent) {
|
|
6845
|
-
logger$
|
|
6850
|
+
logger$4.info('sdk webrtc recreating User Agent');
|
|
6846
6851
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6847
6852
|
}
|
|
6848
6853
|
if (!this.userAgent || this.isRegistered()) {
|
|
6849
|
-
logger$
|
|
6854
|
+
logger$4.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6850
6855
|
return Promise.resolve();
|
|
6851
6856
|
}
|
|
6852
6857
|
|
|
6853
6858
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6854
|
-
logger$
|
|
6859
|
+
logger$4.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6855
6860
|
return Promise.resolve();
|
|
6856
6861
|
}
|
|
6857
6862
|
|
|
6858
6863
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6859
6864
|
|
|
6860
6865
|
const onRegisterFailed = () => {
|
|
6861
|
-
logger$
|
|
6866
|
+
logger$4.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6862
6867
|
this.connectionPromise = null;
|
|
6863
6868
|
if (this.registerer && this.registerer.waiting) {
|
|
6864
6869
|
this.registerer.waitingToggle(false);
|
|
6865
6870
|
}
|
|
6866
6871
|
|
|
6867
6872
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6868
|
-
logger$
|
|
6873
|
+
logger$4.info('sdk webrtc registering, retrying...', { tries });
|
|
6869
6874
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6870
6875
|
}
|
|
6871
6876
|
};
|
|
@@ -6874,18 +6879,18 @@ class WebRTCClient extends Emitter {
|
|
|
6874
6879
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6875
6880
|
// during the resolution of the primise.
|
|
6876
6881
|
if (!this.userAgent) {
|
|
6877
|
-
logger$
|
|
6882
|
+
logger$4.info('sdk webrtc recreating User Agent after connection');
|
|
6878
6883
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6879
6884
|
}
|
|
6880
6885
|
|
|
6881
|
-
logger$
|
|
6886
|
+
logger$4.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6882
6887
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
6883
6888
|
this.connectionPromise = null;
|
|
6884
6889
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6885
6890
|
|
|
6886
6891
|
// Bind registerer events
|
|
6887
6892
|
this.registerer.stateChange.addListener(newState => {
|
|
6888
|
-
logger$
|
|
6893
|
+
logger$4.info('sdk webrtc registering, state changed', { newState });
|
|
6889
6894
|
|
|
6890
6895
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
6891
6896
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -6898,7 +6903,7 @@ class WebRTCClient extends Emitter {
|
|
|
6898
6903
|
const options = {
|
|
6899
6904
|
requestDelegate: {
|
|
6900
6905
|
onReject: response => {
|
|
6901
|
-
logger$
|
|
6906
|
+
logger$4.error('sdk webrtc registering, rejected', { response });
|
|
6902
6907
|
|
|
6903
6908
|
onRegisterFailed();
|
|
6904
6909
|
},
|
|
@@ -6906,13 +6911,13 @@ class WebRTCClient extends Emitter {
|
|
|
6906
6911
|
};
|
|
6907
6912
|
|
|
6908
6913
|
return this.registerer.register(options).catch((e) => {
|
|
6909
|
-
logger$
|
|
6914
|
+
logger$4.error('sdk webrtc registering, error', e);
|
|
6910
6915
|
|
|
6911
6916
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6912
6917
|
return e;
|
|
6913
6918
|
});
|
|
6914
6919
|
}).catch(error => {
|
|
6915
|
-
logger$
|
|
6920
|
+
logger$4.error('sdk webrtc registering, transport error', error);
|
|
6916
6921
|
onRegisterFailed();
|
|
6917
6922
|
});
|
|
6918
6923
|
}
|
|
@@ -6941,21 +6946,21 @@ class WebRTCClient extends Emitter {
|
|
|
6941
6946
|
}
|
|
6942
6947
|
|
|
6943
6948
|
unregister() {
|
|
6944
|
-
logger$
|
|
6949
|
+
logger$4.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6945
6950
|
if (!this.registerer) {
|
|
6946
6951
|
return Promise.resolve();
|
|
6947
6952
|
}
|
|
6948
6953
|
|
|
6949
6954
|
try {
|
|
6950
6955
|
return this.registerer.unregister().then(() => {
|
|
6951
|
-
logger$
|
|
6956
|
+
logger$4.info('sdk webrtc unregistered');
|
|
6952
6957
|
this._cleanupRegister();
|
|
6953
6958
|
}).catch(e => {
|
|
6954
|
-
logger$
|
|
6959
|
+
logger$4.error('sdk webrtc unregistering, promise error', e);
|
|
6955
6960
|
this._cleanupRegister();
|
|
6956
6961
|
});
|
|
6957
6962
|
} catch (e) {
|
|
6958
|
-
logger$
|
|
6963
|
+
logger$4.error('sdk webrtc unregistering, error', e);
|
|
6959
6964
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6960
6965
|
// error when the registerer is in a bad state
|
|
6961
6966
|
this._cleanupRegister();
|
|
@@ -6963,7 +6968,7 @@ class WebRTCClient extends Emitter {
|
|
|
6963
6968
|
}
|
|
6964
6969
|
|
|
6965
6970
|
stop() {
|
|
6966
|
-
logger$
|
|
6971
|
+
logger$4.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6967
6972
|
if (!this.userAgent) {
|
|
6968
6973
|
return Promise.resolve();
|
|
6969
6974
|
}
|
|
@@ -6971,12 +6976,12 @@ class WebRTCClient extends Emitter {
|
|
|
6971
6976
|
return this.userAgent.stop().then(() => {
|
|
6972
6977
|
return this._cleanupRegister();
|
|
6973
6978
|
}).catch(e => {
|
|
6974
|
-
logger$
|
|
6979
|
+
logger$4.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6975
6980
|
});
|
|
6976
6981
|
}
|
|
6977
6982
|
|
|
6978
6983
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6979
|
-
logger$
|
|
6984
|
+
logger$4.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
6980
6985
|
const inviterOptions = {
|
|
6981
6986
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6982
6987
|
conference,
|
|
@@ -7007,7 +7012,7 @@ class WebRTCClient extends Emitter {
|
|
|
7007
7012
|
this._onAccepted(session, response.session, true);
|
|
7008
7013
|
},
|
|
7009
7014
|
onReject: (response ) => {
|
|
7010
|
-
logger$
|
|
7015
|
+
logger$4.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
7011
7016
|
this._stopSendingStats(session);
|
|
7012
7017
|
this.stopNetworkMonitoring(session);
|
|
7013
7018
|
|
|
@@ -7030,11 +7035,11 @@ class WebRTCClient extends Emitter {
|
|
|
7030
7035
|
}
|
|
7031
7036
|
|
|
7032
7037
|
answer(session , enableVideo ) {
|
|
7033
|
-
logger$
|
|
7038
|
+
logger$4.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
7034
7039
|
|
|
7035
7040
|
if (!session || !session.accept) {
|
|
7036
7041
|
const error = 'No session to answer, or not an invitation';
|
|
7037
|
-
logger$
|
|
7042
|
+
logger$4.warn(error);
|
|
7038
7043
|
return Promise.reject(new Error(error));
|
|
7039
7044
|
}
|
|
7040
7045
|
const options = {
|
|
@@ -7044,15 +7049,15 @@ class WebRTCClient extends Emitter {
|
|
|
7044
7049
|
return session.accept(options).then(() => {
|
|
7045
7050
|
if (session.isCanceled) {
|
|
7046
7051
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
7047
|
-
logger$
|
|
7052
|
+
logger$4.error(message, { id: session.id });
|
|
7048
7053
|
this.onCallEnded(session);
|
|
7049
7054
|
|
|
7050
7055
|
throw new CanceledCallError(message);
|
|
7051
7056
|
}
|
|
7052
|
-
logger$
|
|
7057
|
+
logger$4.info('sdk webrtc answer, accepted.');
|
|
7053
7058
|
this._onAccepted(session);
|
|
7054
7059
|
}).catch(e => {
|
|
7055
|
-
logger$
|
|
7060
|
+
logger$4.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
7056
7061
|
|
|
7057
7062
|
throw e;
|
|
7058
7063
|
});
|
|
@@ -7060,7 +7065,7 @@ class WebRTCClient extends Emitter {
|
|
|
7060
7065
|
|
|
7061
7066
|
hangup(session ) {
|
|
7062
7067
|
const { state, id } = session;
|
|
7063
|
-
logger$
|
|
7068
|
+
logger$4.info('sdk webrtc hangup call', { id, state });
|
|
7064
7069
|
|
|
7065
7070
|
try {
|
|
7066
7071
|
this._stopSendingStats(session);
|
|
@@ -7089,7 +7094,7 @@ class WebRTCClient extends Emitter {
|
|
|
7089
7094
|
|
|
7090
7095
|
return bye();
|
|
7091
7096
|
} catch (error) {
|
|
7092
|
-
logger$
|
|
7097
|
+
logger$4.warn('sdk webrtc hangup, error', error);
|
|
7093
7098
|
}
|
|
7094
7099
|
|
|
7095
7100
|
return null;
|
|
@@ -7107,7 +7112,7 @@ class WebRTCClient extends Emitter {
|
|
|
7107
7112
|
// Fetch and emit an event at `interval` with session network stats
|
|
7108
7113
|
startNetworkMonitoring(session , interval = 1000) {
|
|
7109
7114
|
const sessionId = this.getSipSessionId(session);
|
|
7110
|
-
logger$
|
|
7115
|
+
logger$4.info('starting network inspection', { id: sessionId });
|
|
7111
7116
|
|
|
7112
7117
|
this.sessionNetworkStats[sessionId] = [];
|
|
7113
7118
|
|
|
@@ -7117,7 +7122,7 @@ class WebRTCClient extends Emitter {
|
|
|
7117
7122
|
stopNetworkMonitoring(session ) {
|
|
7118
7123
|
const sessionId = this.getSipSessionId(session);
|
|
7119
7124
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
7120
|
-
logger$
|
|
7125
|
+
logger$4.info('stopping network inspection', { id: sessionId, exists });
|
|
7121
7126
|
|
|
7122
7127
|
if (exists) {
|
|
7123
7128
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -7127,17 +7132,17 @@ class WebRTCClient extends Emitter {
|
|
|
7127
7132
|
}
|
|
7128
7133
|
|
|
7129
7134
|
reject(session ) {
|
|
7130
|
-
logger$
|
|
7135
|
+
logger$4.info('sdk webrtc reject call', { id: session.id });
|
|
7131
7136
|
|
|
7132
7137
|
try {
|
|
7133
7138
|
return session.reject ? session.reject() : session.cancel();
|
|
7134
7139
|
} catch (e) {
|
|
7135
|
-
logger$
|
|
7140
|
+
logger$4.warn('Error when rejecting call', e.message, e.stack);
|
|
7136
7141
|
}
|
|
7137
7142
|
}
|
|
7138
7143
|
|
|
7139
7144
|
async close() {
|
|
7140
|
-
logger$
|
|
7145
|
+
logger$4.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
7141
7146
|
this._cleanupMedia();
|
|
7142
7147
|
this.connectionPromise = null;
|
|
7143
7148
|
|
|
@@ -7168,7 +7173,7 @@ class WebRTCClient extends Emitter {
|
|
|
7168
7173
|
// eg: "INVITE not rejectable in state Completed"
|
|
7169
7174
|
}
|
|
7170
7175
|
this.userAgent = null;
|
|
7171
|
-
logger$
|
|
7176
|
+
logger$4.info('sdk webrtc client closed');
|
|
7172
7177
|
}
|
|
7173
7178
|
|
|
7174
7179
|
getNumber(session ) {
|
|
@@ -7181,13 +7186,13 @@ class WebRTCClient extends Emitter {
|
|
|
7181
7186
|
}
|
|
7182
7187
|
|
|
7183
7188
|
mute(session ) {
|
|
7184
|
-
logger$
|
|
7189
|
+
logger$4.info('sdk webrtc mute', { id: session.id });
|
|
7185
7190
|
|
|
7186
7191
|
this._toggleAudio(session, true);
|
|
7187
7192
|
}
|
|
7188
7193
|
|
|
7189
7194
|
unmute(session ) {
|
|
7190
|
-
logger$
|
|
7195
|
+
logger$4.info('sdk webrtc unmute', { id: session.id });
|
|
7191
7196
|
|
|
7192
7197
|
this._toggleAudio(session, false);
|
|
7193
7198
|
}
|
|
@@ -7227,13 +7232,13 @@ class WebRTCClient extends Emitter {
|
|
|
7227
7232
|
}
|
|
7228
7233
|
|
|
7229
7234
|
toggleCameraOn(session ) {
|
|
7230
|
-
logger$
|
|
7235
|
+
logger$4.info('sdk webrtc toggle camera on', { id: session.id });
|
|
7231
7236
|
|
|
7232
7237
|
this._toggleVideo(session, false);
|
|
7233
7238
|
}
|
|
7234
7239
|
|
|
7235
7240
|
toggleCameraOff(session ) {
|
|
7236
|
-
logger$
|
|
7241
|
+
logger$4.info('sdk webrtc toggle camera off', { id: session.id });
|
|
7237
7242
|
|
|
7238
7243
|
this._toggleVideo(session, true);
|
|
7239
7244
|
}
|
|
@@ -7242,7 +7247,7 @@ class WebRTCClient extends Emitter {
|
|
|
7242
7247
|
const sessionId = this.getSipSessionId(session);
|
|
7243
7248
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
7244
7249
|
|
|
7245
|
-
logger$
|
|
7250
|
+
logger$4.info('sdk webrtc hold', {
|
|
7246
7251
|
sessionId,
|
|
7247
7252
|
keys: Object.keys(this.heldSessions),
|
|
7248
7253
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7291,7 +7296,7 @@ class WebRTCClient extends Emitter {
|
|
|
7291
7296
|
const sessionId = this.getSipSessionId(session);
|
|
7292
7297
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7293
7298
|
|
|
7294
|
-
logger$
|
|
7299
|
+
logger$4.info('sdk webrtc unhold', {
|
|
7295
7300
|
sessionId,
|
|
7296
7301
|
keys: Object.keys(this.heldSessions),
|
|
7297
7302
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7439,7 +7444,7 @@ class WebRTCClient extends Emitter {
|
|
|
7439
7444
|
if (!session.sessionDescriptionHandler) {
|
|
7440
7445
|
return;
|
|
7441
7446
|
}
|
|
7442
|
-
logger$
|
|
7447
|
+
logger$4.info('Sending DTMF', {
|
|
7443
7448
|
id: this.getSipSessionId(session),
|
|
7444
7449
|
tone,
|
|
7445
7450
|
});
|
|
@@ -7455,7 +7460,7 @@ class WebRTCClient extends Emitter {
|
|
|
7455
7460
|
transfer(session , target ) {
|
|
7456
7461
|
this.hold(session);
|
|
7457
7462
|
|
|
7458
|
-
logger$
|
|
7463
|
+
logger$4.info('Transfering a session', {
|
|
7459
7464
|
id: this.getSipSessionId(session),
|
|
7460
7465
|
target,
|
|
7461
7466
|
});
|
|
@@ -7477,17 +7482,17 @@ class WebRTCClient extends Emitter {
|
|
|
7477
7482
|
atxfer(session ) {
|
|
7478
7483
|
this.hold(session);
|
|
7479
7484
|
|
|
7480
|
-
logger$
|
|
7485
|
+
logger$4.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7481
7486
|
|
|
7482
7487
|
const result = {
|
|
7483
7488
|
newSession: null,
|
|
7484
7489
|
init: async (target ) => {
|
|
7485
|
-
logger$
|
|
7490
|
+
logger$4.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7486
7491
|
|
|
7487
7492
|
result.newSession = await this.call(target);
|
|
7488
7493
|
},
|
|
7489
7494
|
complete: () => {
|
|
7490
|
-
logger$
|
|
7495
|
+
logger$4.info('webrtc transfer completed', {
|
|
7491
7496
|
id: this.getSipSessionId(session),
|
|
7492
7497
|
referId: this.getSipSessionId(result.newSession),
|
|
7493
7498
|
});
|
|
@@ -7508,7 +7513,7 @@ class WebRTCClient extends Emitter {
|
|
|
7508
7513
|
return;
|
|
7509
7514
|
}
|
|
7510
7515
|
|
|
7511
|
-
logger$
|
|
7516
|
+
logger$4.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7512
7517
|
|
|
7513
7518
|
try {
|
|
7514
7519
|
sipSession.message({
|
|
@@ -7550,7 +7555,7 @@ class WebRTCClient extends Emitter {
|
|
|
7550
7555
|
}
|
|
7551
7556
|
|
|
7552
7557
|
changeAudioOutputVolume(volume ) {
|
|
7553
|
-
logger$
|
|
7558
|
+
logger$4.info('Changing audio output volume', { volume });
|
|
7554
7559
|
|
|
7555
7560
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7556
7561
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7562,7 +7567,7 @@ class WebRTCClient extends Emitter {
|
|
|
7562
7567
|
}
|
|
7563
7568
|
|
|
7564
7569
|
changeAudioOutputDevice(id ) {
|
|
7565
|
-
logger$
|
|
7570
|
+
logger$4.info('Changing audio output device', { id });
|
|
7566
7571
|
|
|
7567
7572
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7568
7573
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7579,7 +7584,7 @@ class WebRTCClient extends Emitter {
|
|
|
7579
7584
|
|
|
7580
7585
|
changeAudioInputDevice(id , session ) {
|
|
7581
7586
|
const currentId = this.getAudioDeviceId();
|
|
7582
|
-
logger$
|
|
7587
|
+
logger$4.info('setting audio input device', { id, currentId, session: !!session });
|
|
7583
7588
|
|
|
7584
7589
|
if (id === currentId) {
|
|
7585
7590
|
return null;
|
|
@@ -7625,7 +7630,7 @@ class WebRTCClient extends Emitter {
|
|
|
7625
7630
|
|
|
7626
7631
|
setVideoInputDevice(id ) {
|
|
7627
7632
|
const currentId = this.getVideoDeviceId();
|
|
7628
|
-
logger$
|
|
7633
|
+
logger$4.info('setting video input device', { id, currentId });
|
|
7629
7634
|
|
|
7630
7635
|
if (id === currentId) {
|
|
7631
7636
|
return null;
|
|
@@ -7650,7 +7655,7 @@ class WebRTCClient extends Emitter {
|
|
|
7650
7655
|
const sessionId = this.getSipSessionId(session);
|
|
7651
7656
|
const localStream = this.getLocalStream(sessionId);
|
|
7652
7657
|
|
|
7653
|
-
logger$
|
|
7658
|
+
logger$4.info('changing video input device', { id, sessionId });
|
|
7654
7659
|
|
|
7655
7660
|
// Release old video stream
|
|
7656
7661
|
if (localStream) {
|
|
@@ -7718,7 +7723,7 @@ class WebRTCClient extends Emitter {
|
|
|
7718
7723
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7719
7724
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7720
7725
|
|
|
7721
|
-
logger$
|
|
7726
|
+
logger$4.info('Sending reinvite', {
|
|
7722
7727
|
id: this.getSipSessionId(sipSession),
|
|
7723
7728
|
newConstraints,
|
|
7724
7729
|
conference,
|
|
@@ -7756,7 +7761,7 @@ class WebRTCClient extends Emitter {
|
|
|
7756
7761
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7757
7762
|
}
|
|
7758
7763
|
|
|
7759
|
-
logger$
|
|
7764
|
+
logger$4.info('on re-INVITE accepted', {
|
|
7760
7765
|
id: this.getSipSessionId(sipSession),
|
|
7761
7766
|
wasMuted,
|
|
7762
7767
|
shouldDoScreenSharing,
|
|
@@ -7774,7 +7779,7 @@ class WebRTCClient extends Emitter {
|
|
|
7774
7779
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7775
7780
|
}
|
|
7776
7781
|
|
|
7777
|
-
return this.eventEmitter.emit(ON_REINVITE
|
|
7782
|
+
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7778
7783
|
},
|
|
7779
7784
|
},
|
|
7780
7785
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7931,7 +7936,7 @@ class WebRTCClient extends Emitter {
|
|
|
7931
7936
|
}
|
|
7932
7937
|
|
|
7933
7938
|
startHeartbeat() {
|
|
7934
|
-
logger$
|
|
7939
|
+
logger$4.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7935
7940
|
if (!this.userAgent) {
|
|
7936
7941
|
this.heartbeat.stop();
|
|
7937
7942
|
return;
|
|
@@ -7944,7 +7949,7 @@ class WebRTCClient extends Emitter {
|
|
|
7944
7949
|
}
|
|
7945
7950
|
|
|
7946
7951
|
stopHeartbeat() {
|
|
7947
|
-
logger$
|
|
7952
|
+
logger$4.info('sdk webrtc stop heartbeat');
|
|
7948
7953
|
this.heartbeat.stop();
|
|
7949
7954
|
}
|
|
7950
7955
|
|
|
@@ -7965,7 +7970,7 @@ class WebRTCClient extends Emitter {
|
|
|
7965
7970
|
}
|
|
7966
7971
|
|
|
7967
7972
|
attemptReconnection() {
|
|
7968
|
-
logger$
|
|
7973
|
+
logger$4.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7969
7974
|
if (!this.userAgent) {
|
|
7970
7975
|
return;
|
|
7971
7976
|
}
|
|
@@ -7990,7 +7995,7 @@ class WebRTCClient extends Emitter {
|
|
|
7990
7995
|
return;
|
|
7991
7996
|
}
|
|
7992
7997
|
|
|
7993
|
-
logger$
|
|
7998
|
+
logger$4.info('setting local media stream', {
|
|
7994
7999
|
sipSessionId,
|
|
7995
8000
|
tracks: newStream ? newStream.getTracks() : null,
|
|
7996
8001
|
});
|
|
@@ -8007,7 +8012,7 @@ class WebRTCClient extends Emitter {
|
|
|
8007
8012
|
|
|
8008
8013
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
8009
8014
|
|
|
8010
|
-
logger$
|
|
8015
|
+
logger$4.info('updating local stream', {
|
|
8011
8016
|
sipSessionId,
|
|
8012
8017
|
oldStream: !!oldStream,
|
|
8013
8018
|
tracks: newStream.getTracks(),
|
|
@@ -8027,7 +8032,7 @@ class WebRTCClient extends Emitter {
|
|
|
8027
8032
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
8028
8033
|
const pc = this.getPeerConnection(sessionId);
|
|
8029
8034
|
|
|
8030
|
-
logger$
|
|
8035
|
+
logger$4.info('Updating remote stream', {
|
|
8031
8036
|
sessionId,
|
|
8032
8037
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
8033
8038
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -8053,7 +8058,7 @@ class WebRTCClient extends Emitter {
|
|
|
8053
8058
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
8054
8059
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
8055
8060
|
|
|
8056
|
-
logger$
|
|
8061
|
+
logger$4.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
8057
8062
|
|
|
8058
8063
|
return {
|
|
8059
8064
|
constraints: {
|
|
@@ -8102,7 +8107,7 @@ class WebRTCClient extends Emitter {
|
|
|
8102
8107
|
}
|
|
8103
8108
|
|
|
8104
8109
|
_onTransportError() {
|
|
8105
|
-
logger$
|
|
8110
|
+
logger$4.error('on transport error');
|
|
8106
8111
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
8107
8112
|
this.attemptReconnection();
|
|
8108
8113
|
}
|
|
@@ -8111,7 +8116,7 @@ class WebRTCClient extends Emitter {
|
|
|
8111
8116
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
8112
8117
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
8113
8118
|
if (this.hasHeartbeat()) {
|
|
8114
|
-
logger$
|
|
8119
|
+
logger$4.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
8115
8120
|
|
|
8116
8121
|
this.heartbeat.onHeartbeat();
|
|
8117
8122
|
if (this.heartbeatCb) {
|
|
@@ -8122,7 +8127,7 @@ class WebRTCClient extends Emitter {
|
|
|
8122
8127
|
}
|
|
8123
8128
|
|
|
8124
8129
|
async _onHeartbeatTimeout() {
|
|
8125
|
-
logger$
|
|
8130
|
+
logger$4.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
8126
8131
|
|
|
8127
8132
|
if (this.heartbeatTimeoutCb) {
|
|
8128
8133
|
this.heartbeatTimeoutCb();
|
|
@@ -8134,7 +8139,7 @@ class WebRTCClient extends Emitter {
|
|
|
8134
8139
|
try {
|
|
8135
8140
|
await this.userAgent.transport.disconnect();
|
|
8136
8141
|
} catch (e) {
|
|
8137
|
-
logger$
|
|
8142
|
+
logger$4.error('Transport disconnection after heartbeat timeout, error', e);
|
|
8138
8143
|
}
|
|
8139
8144
|
}
|
|
8140
8145
|
|
|
@@ -8167,31 +8172,31 @@ class WebRTCClient extends Emitter {
|
|
|
8167
8172
|
}
|
|
8168
8173
|
|
|
8169
8174
|
_connectIfNeeded() {
|
|
8170
|
-
logger$
|
|
8175
|
+
logger$4.info('connect if needed, checking', { connected: this.isConnected() });
|
|
8171
8176
|
if (!this.userAgent) {
|
|
8172
|
-
logger$
|
|
8177
|
+
logger$4.info('need to recreate User Agent');
|
|
8173
8178
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
8174
8179
|
}
|
|
8175
8180
|
|
|
8176
8181
|
if (this.isConnected()) {
|
|
8177
|
-
logger$
|
|
8182
|
+
logger$4.info('webrtc sdk, already connected');
|
|
8178
8183
|
return Promise.resolve();
|
|
8179
8184
|
}
|
|
8180
8185
|
|
|
8181
8186
|
if (this.isConnecting()) {
|
|
8182
|
-
logger$
|
|
8187
|
+
logger$4.info('webrtc sdk, already connecting...');
|
|
8183
8188
|
|
|
8184
8189
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
8185
8190
|
return this.connectionPromise;
|
|
8186
8191
|
}
|
|
8187
8192
|
|
|
8188
8193
|
if (this.connectionPromise) {
|
|
8189
|
-
logger$
|
|
8194
|
+
logger$4.info('webrtc sdk, connection promise connecting...');
|
|
8190
8195
|
// $FlowFixMe
|
|
8191
8196
|
return this.connectionPromise;
|
|
8192
8197
|
}
|
|
8193
8198
|
|
|
8194
|
-
logger$
|
|
8199
|
+
logger$4.info('WebRTC UA needs to connect');
|
|
8195
8200
|
|
|
8196
8201
|
// Force UA to reconnect
|
|
8197
8202
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -8316,7 +8321,7 @@ class WebRTCClient extends Emitter {
|
|
|
8316
8321
|
|
|
8317
8322
|
sdh.peerConnectionDelegate = {
|
|
8318
8323
|
onicecandidateerror: (error ) => {
|
|
8319
|
-
logger$
|
|
8324
|
+
logger$4.error('on icecandidate error', {
|
|
8320
8325
|
address: error.address,
|
|
8321
8326
|
port: error.port,
|
|
8322
8327
|
errorCode: error.errorCode,
|
|
@@ -8345,7 +8350,7 @@ class WebRTCClient extends Emitter {
|
|
|
8345
8350
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8346
8351
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8347
8352
|
}
|
|
8348
|
-
logger$
|
|
8353
|
+
logger$4.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8349
8354
|
|
|
8350
8355
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8351
8356
|
|
|
@@ -8361,12 +8366,12 @@ class WebRTCClient extends Emitter {
|
|
|
8361
8366
|
|
|
8362
8367
|
this._setupMedias(session);
|
|
8363
8368
|
|
|
8364
|
-
return this.eventEmitter.emit(ON_REINVITE
|
|
8369
|
+
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8365
8370
|
};
|
|
8366
8371
|
}
|
|
8367
8372
|
|
|
8368
8373
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8369
|
-
logger$
|
|
8374
|
+
logger$4.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8370
8375
|
|
|
8371
8376
|
this.storeSipSession(session);
|
|
8372
8377
|
|
|
@@ -8378,14 +8383,14 @@ class WebRTCClient extends Emitter {
|
|
|
8378
8383
|
const onTrack = (event ) => {
|
|
8379
8384
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8380
8385
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8381
|
-
logger$
|
|
8386
|
+
logger$4.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8382
8387
|
|
|
8383
8388
|
// Stop video track in audio only mode
|
|
8384
8389
|
if (isAudioOnly && kind === 'video') {
|
|
8385
8390
|
event.track.stop();
|
|
8386
8391
|
}
|
|
8387
8392
|
|
|
8388
|
-
this.eventEmitter.emit(ON_TRACK
|
|
8393
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8389
8394
|
};
|
|
8390
8395
|
|
|
8391
8396
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8395,9 +8400,9 @@ class WebRTCClient extends Emitter {
|
|
|
8395
8400
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8396
8401
|
|
|
8397
8402
|
pc.oniceconnectionstatechange = () => {
|
|
8398
|
-
logger$
|
|
8403
|
+
logger$4.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8399
8404
|
if (pc.iceConnectionState === 'disconnected') {
|
|
8400
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
8405
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
8401
8406
|
}
|
|
8402
8407
|
};
|
|
8403
8408
|
|
|
@@ -8568,10 +8573,10 @@ class WebRTCClient extends Emitter {
|
|
|
8568
8573
|
|
|
8569
8574
|
_stopSendingStats(session ) {
|
|
8570
8575
|
const sessionId = this.getSipSessionId(session);
|
|
8571
|
-
logger$
|
|
8576
|
+
logger$4.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8572
8577
|
|
|
8573
8578
|
if (sessionId in this.statsIntervals) {
|
|
8574
|
-
logger$
|
|
8579
|
+
logger$4.trace('Stop sending stats for call', { sessionId });
|
|
8575
8580
|
this.statsIntervals[sessionId]();
|
|
8576
8581
|
delete this.statsIntervals[sessionId];
|
|
8577
8582
|
}
|
|
@@ -8587,7 +8592,7 @@ class WebRTCClient extends Emitter {
|
|
|
8587
8592
|
try {
|
|
8588
8593
|
await this.userAgent.transport.disconnect();
|
|
8589
8594
|
} catch (e) {
|
|
8590
|
-
logger$
|
|
8595
|
+
logger$4.error('WebRTC transport disconnect, error', e);
|
|
8591
8596
|
}
|
|
8592
8597
|
}
|
|
8593
8598
|
}
|
|
@@ -8681,7 +8686,7 @@ class WebRTCClient extends Emitter {
|
|
|
8681
8686
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8682
8687
|
+ networkStats.transportSent;
|
|
8683
8688
|
|
|
8684
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
8689
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8685
8690
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8686
8691
|
}
|
|
8687
8692
|
|
|
@@ -8709,8 +8714,8 @@ const ON_CALL_FAILED = 'onCallFailed';
|
|
|
8709
8714
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8710
8715
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8711
8716
|
const ON_MESSAGE = 'onMessage';
|
|
8712
|
-
const ON_REINVITE = 'reinvite';
|
|
8713
|
-
const ON_TRACK = 'onTrack';
|
|
8717
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
8718
|
+
const ON_TRACK$1 = 'onTrack';
|
|
8714
8719
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8715
8720
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8716
8721
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8725,15 +8730,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8725
8730
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8726
8731
|
const ON_CALL_ERROR = 'onCallError';
|
|
8727
8732
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8728
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8733
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
8729
8734
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8730
8735
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8731
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
8736
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
8732
8737
|
|
|
8733
8738
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8734
8739
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8735
8740
|
|
|
8736
|
-
const events = [
|
|
8741
|
+
const events$1 = [
|
|
8737
8742
|
ON_USER_AGENT,
|
|
8738
8743
|
ON_REGISTERED,
|
|
8739
8744
|
ON_UNREGISTERED,
|
|
@@ -8751,8 +8756,8 @@ const events = [
|
|
|
8751
8756
|
ON_CALL_FAILED,
|
|
8752
8757
|
ON_CALL_ENDED,
|
|
8753
8758
|
ON_MESSAGE,
|
|
8754
|
-
ON_REINVITE,
|
|
8755
|
-
ON_TRACK,
|
|
8759
|
+
ON_REINVITE$1,
|
|
8760
|
+
ON_TRACK$1,
|
|
8756
8761
|
ON_AUDIO_STREAM,
|
|
8757
8762
|
ON_VIDEO_STREAM,
|
|
8758
8763
|
ON_REMOVE_STREAM,
|
|
@@ -8767,11 +8772,11 @@ const events = [
|
|
|
8767
8772
|
ON_CALL_ERROR,
|
|
8768
8773
|
ON_CHAT,
|
|
8769
8774
|
ON_SIGNAL,
|
|
8770
|
-
ON_NETWORK_STATS,
|
|
8771
|
-
ON_DISCONNECTED,
|
|
8775
|
+
ON_NETWORK_STATS$1,
|
|
8776
|
+
ON_DISCONNECTED$1,
|
|
8772
8777
|
];
|
|
8773
8778
|
|
|
8774
|
-
const logger$
|
|
8779
|
+
const logger$5 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8775
8780
|
|
|
8776
8781
|
class WebRTCPhone extends Emitter {
|
|
8777
8782
|
|
|
@@ -8844,7 +8849,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8844
8849
|
}).catch(error => {
|
|
8845
8850
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8846
8851
|
console.error('register error', error, error.message, error.stack);
|
|
8847
|
-
logger$
|
|
8852
|
+
logger$5.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8848
8853
|
});
|
|
8849
8854
|
}
|
|
8850
8855
|
|
|
@@ -8859,7 +8864,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8859
8864
|
if (!this.client) {
|
|
8860
8865
|
return;
|
|
8861
8866
|
}
|
|
8862
|
-
logger$
|
|
8867
|
+
logger$5.info('WebRTC phone stop');
|
|
8863
8868
|
this.client.stop();
|
|
8864
8869
|
}
|
|
8865
8870
|
|
|
@@ -8874,7 +8879,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8874
8879
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8875
8880
|
audioOnly = false, iceRestart = false) {
|
|
8876
8881
|
const sipSession = this.findSipSession(callSession);
|
|
8877
|
-
logger$
|
|
8882
|
+
logger$5.info('WebRTC phone - send reinvite', {
|
|
8878
8883
|
sessionId: sipSession ? sipSession.id : null,
|
|
8879
8884
|
constraints,
|
|
8880
8885
|
audioOnly,
|
|
@@ -8911,7 +8916,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8911
8916
|
}
|
|
8912
8917
|
|
|
8913
8918
|
startHeartbeat() {
|
|
8914
|
-
logger$
|
|
8919
|
+
logger$5.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8915
8920
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8916
8921
|
return;
|
|
8917
8922
|
}
|
|
@@ -8920,7 +8925,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8920
8925
|
}
|
|
8921
8926
|
|
|
8922
8927
|
stopHeartbeat() {
|
|
8923
|
-
logger$
|
|
8928
|
+
logger$5.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8924
8929
|
if (!this.client) {
|
|
8925
8930
|
return;
|
|
8926
8931
|
}
|
|
@@ -8937,7 +8942,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8937
8942
|
}
|
|
8938
8943
|
|
|
8939
8944
|
reconnect() {
|
|
8940
|
-
logger$
|
|
8945
|
+
logger$5.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8941
8946
|
if (!this.client) {
|
|
8942
8947
|
return;
|
|
8943
8948
|
}
|
|
@@ -8978,10 +8983,15 @@ class WebRTCPhone extends Emitter {
|
|
|
8978
8983
|
return false;
|
|
8979
8984
|
}
|
|
8980
8985
|
|
|
8981
|
-
logger$
|
|
8986
|
+
logger$5.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8982
8987
|
|
|
8983
8988
|
this.client.downgradeToAudio(sipSession);
|
|
8984
8989
|
|
|
8990
|
+
if (callSession) {
|
|
8991
|
+
callSession.cameraEnabled = false;
|
|
8992
|
+
this._updateCallSession(callSession);
|
|
8993
|
+
}
|
|
8994
|
+
|
|
8985
8995
|
if (withMessage) {
|
|
8986
8996
|
this._sendReinviteMessage(callSession, false);
|
|
8987
8997
|
}
|
|
@@ -8996,7 +9006,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8996
9006
|
return Promise.resolve(false);
|
|
8997
9007
|
}
|
|
8998
9008
|
|
|
8999
|
-
logger$
|
|
9009
|
+
logger$5.info('Upgrade to video', {
|
|
9000
9010
|
id: callSession ? callSession.getId() : null,
|
|
9001
9011
|
constraints,
|
|
9002
9012
|
isConference,
|
|
@@ -9009,6 +9019,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9009
9019
|
|
|
9010
9020
|
const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
|
|
9011
9021
|
|
|
9022
|
+
if (callSession) {
|
|
9023
|
+
callSession.cameraEnabled = true;
|
|
9024
|
+
this._updateCallSession(callSession);
|
|
9025
|
+
}
|
|
9026
|
+
|
|
9012
9027
|
// If no stream is returned, it means we have to reinvite
|
|
9013
9028
|
if (!newStream) {
|
|
9014
9029
|
return true;
|
|
@@ -9031,7 +9046,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9031
9046
|
|
|
9032
9047
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
9033
9048
|
const sipSession = this.findSipSession(callSession);
|
|
9034
|
-
logger$
|
|
9049
|
+
logger$5.info('Sending reinvite message', {
|
|
9035
9050
|
id: callSession ? callSession.getId() : null,
|
|
9036
9051
|
isUpgrade,
|
|
9037
9052
|
});
|
|
@@ -9057,7 +9072,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9057
9072
|
// Monkey patch to know when canceled with the CANCEL message
|
|
9058
9073
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
9059
9074
|
sipSession._onCancel = (message ) => {
|
|
9060
|
-
logger$
|
|
9075
|
+
logger$5.trace('on sip session canceled', { callId: message.callId });
|
|
9061
9076
|
|
|
9062
9077
|
onCancel(message);
|
|
9063
9078
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -9085,13 +9100,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9085
9100
|
this.audioOutputVolume,
|
|
9086
9101
|
);
|
|
9087
9102
|
case sessionState.SessionState.Terminating:
|
|
9088
|
-
logger$
|
|
9103
|
+
logger$5.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
9089
9104
|
|
|
9090
9105
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
9091
9106
|
|
|
9092
9107
|
break;
|
|
9093
9108
|
case sessionState.SessionState.Terminated: {
|
|
9094
|
-
logger$
|
|
9109
|
+
logger$5.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9095
9110
|
|
|
9096
9111
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9097
9112
|
const callSession = this._createCallSession(sipSession);
|
|
@@ -9113,7 +9128,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9113
9128
|
const [stream] = event.streams;
|
|
9114
9129
|
const kind = event && event.track && event.track.kind;
|
|
9115
9130
|
|
|
9116
|
-
logger$
|
|
9131
|
+
logger$5.info('on track stream called on the peer connection', {
|
|
9117
9132
|
callId: this.getSipSessionId(sipSession),
|
|
9118
9133
|
streamId: stream ? stream.id : null,
|
|
9119
9134
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -9133,7 +9148,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9133
9148
|
};
|
|
9134
9149
|
|
|
9135
9150
|
peerConnection.onremovestream = event => {
|
|
9136
|
-
logger$
|
|
9151
|
+
logger$5.info('on remove stream called on the peer connection', {
|
|
9137
9152
|
id: event.stream.id,
|
|
9138
9153
|
tracks: event.stream.getTracks(),
|
|
9139
9154
|
});
|
|
@@ -9143,7 +9158,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9143
9158
|
}
|
|
9144
9159
|
|
|
9145
9160
|
async startScreenSharing(constraints , callSession ) {
|
|
9146
|
-
logger$
|
|
9161
|
+
logger$5.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
9147
9162
|
|
|
9148
9163
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
9149
9164
|
if (!screenShareStream) {
|
|
@@ -9183,7 +9198,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9183
9198
|
return;
|
|
9184
9199
|
}
|
|
9185
9200
|
|
|
9186
|
-
logger$
|
|
9201
|
+
logger$5.info('WebRTC phone - stop screen sharing', {
|
|
9187
9202
|
restoreLocalStream,
|
|
9188
9203
|
});
|
|
9189
9204
|
|
|
@@ -9239,7 +9254,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9239
9254
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
9240
9255
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9241
9256
|
|
|
9242
|
-
logger$
|
|
9257
|
+
logger$5.info('WebRTC phone - on screensharing', {
|
|
9243
9258
|
hadVideo,
|
|
9244
9259
|
id: this.getSipSessionId(sipSession),
|
|
9245
9260
|
screenTrack,
|
|
@@ -9247,7 +9262,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9247
9262
|
|
|
9248
9263
|
if (screenTrack) {
|
|
9249
9264
|
screenTrack.onended = () => {
|
|
9250
|
-
logger$
|
|
9265
|
+
logger$5.info('WebRTC phone - on screenshare ended', {
|
|
9251
9266
|
hadVideo,
|
|
9252
9267
|
id: this.getSipSessionId(sipSession),
|
|
9253
9268
|
screenTrack,
|
|
@@ -9278,7 +9293,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9278
9293
|
}
|
|
9279
9294
|
|
|
9280
9295
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9281
|
-
logger$
|
|
9296
|
+
logger$5.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9282
9297
|
|
|
9283
9298
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9284
9299
|
this.currentSipSession = sipSession;
|
|
@@ -9296,7 +9311,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9296
9311
|
}
|
|
9297
9312
|
|
|
9298
9313
|
changeAudioDevice(id ) {
|
|
9299
|
-
logger$
|
|
9314
|
+
logger$5.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9300
9315
|
this.audioOutputDeviceId = id;
|
|
9301
9316
|
this.client.changeAudioOutputDevice(id);
|
|
9302
9317
|
}
|
|
@@ -9306,14 +9321,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9306
9321
|
}
|
|
9307
9322
|
|
|
9308
9323
|
changeRingDevice(id ) {
|
|
9309
|
-
logger$
|
|
9324
|
+
logger$5.info('WebRTC phone - changing ring device', { id });
|
|
9310
9325
|
|
|
9311
9326
|
this.audioRingDeviceId = id;
|
|
9312
9327
|
}
|
|
9313
9328
|
|
|
9314
9329
|
// volume is a value between 0 and 1
|
|
9315
9330
|
changeAudioVolume(volume ) {
|
|
9316
|
-
logger$
|
|
9331
|
+
logger$5.info('WebRTC phone - changing audio volume', { volume });
|
|
9317
9332
|
|
|
9318
9333
|
this.audioOutputVolume = volume;
|
|
9319
9334
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9321,31 +9336,31 @@ class WebRTCPhone extends Emitter {
|
|
|
9321
9336
|
|
|
9322
9337
|
// volume is a value between 0 and 1
|
|
9323
9338
|
changeRingVolume(volume ) {
|
|
9324
|
-
logger$
|
|
9339
|
+
logger$5.info('WebRTC phone - changing ring volume', { volume });
|
|
9325
9340
|
|
|
9326
9341
|
this.audioRingVolume = volume;
|
|
9327
9342
|
}
|
|
9328
9343
|
|
|
9329
9344
|
changeAudioInputDevice(id ) {
|
|
9330
|
-
logger$
|
|
9345
|
+
logger$5.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9331
9346
|
|
|
9332
9347
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9333
9348
|
}
|
|
9334
9349
|
|
|
9335
9350
|
changeVideoInputDevice(id ) {
|
|
9336
|
-
logger$
|
|
9351
|
+
logger$5.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9337
9352
|
|
|
9338
9353
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9339
9354
|
}
|
|
9340
9355
|
|
|
9341
9356
|
changeSessionVideoInputDevice(id ) {
|
|
9342
|
-
logger$
|
|
9357
|
+
logger$5.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9343
9358
|
|
|
9344
9359
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9345
9360
|
}
|
|
9346
9361
|
|
|
9347
9362
|
_onCallTerminated(sipSession ) {
|
|
9348
|
-
logger$
|
|
9363
|
+
logger$5.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9349
9364
|
|
|
9350
9365
|
const callSession = this._createCallSession(sipSession);
|
|
9351
9366
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
@@ -9379,7 +9394,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9379
9394
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9380
9395
|
|
|
9381
9396
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9382
|
-
logger$
|
|
9397
|
+
logger$5.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9383
9398
|
sipId: sipSession.id,
|
|
9384
9399
|
shouldRetrigger,
|
|
9385
9400
|
hasIncomingCallSession,
|
|
@@ -9470,37 +9485,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9470
9485
|
|
|
9471
9486
|
// Deprecated
|
|
9472
9487
|
getLocalStreamForCall(callSession ) {
|
|
9473
|
-
logger$
|
|
9488
|
+
logger$5.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9474
9489
|
|
|
9475
9490
|
return this.getLocalStream(callSession);
|
|
9476
9491
|
}
|
|
9477
9492
|
|
|
9478
9493
|
// Deprecated
|
|
9479
9494
|
getRemoteStreamForCall(callSession ) {
|
|
9480
|
-
logger$
|
|
9495
|
+
logger$5.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9481
9496
|
|
|
9482
9497
|
return this.getRemoteVideoStream(callSession);
|
|
9483
9498
|
}
|
|
9484
9499
|
|
|
9485
9500
|
getRemoteStreamsForCall(callSession ) {
|
|
9486
|
-
logger$
|
|
9501
|
+
logger$5.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9487
9502
|
|
|
9488
9503
|
return this.getRemoteStream(callSession);
|
|
9489
9504
|
}
|
|
9490
9505
|
|
|
9491
9506
|
accept(callSession , cameraEnabled ) {
|
|
9492
|
-
logger$
|
|
9507
|
+
logger$5.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9493
9508
|
if (this.currentSipSession) {
|
|
9494
9509
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9495
9510
|
}
|
|
9496
9511
|
|
|
9497
9512
|
if (!callSession) {
|
|
9498
|
-
logger$
|
|
9513
|
+
logger$5.warn('no CallSession to accept.');
|
|
9499
9514
|
return Promise.resolve(null);
|
|
9500
9515
|
}
|
|
9501
9516
|
|
|
9502
9517
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9503
|
-
logger$
|
|
9518
|
+
logger$5.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9504
9519
|
return Promise.resolve(callSession.sipCallId);
|
|
9505
9520
|
}
|
|
9506
9521
|
|
|
@@ -9512,24 +9527,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9512
9527
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9513
9528
|
if (sipSession) {
|
|
9514
9529
|
if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
|
|
9515
|
-
logger$
|
|
9530
|
+
logger$5.warn('Trying to answer a terminated sipSession.');
|
|
9516
9531
|
|
|
9517
9532
|
return Promise.resolve(null);
|
|
9518
9533
|
}
|
|
9519
9534
|
|
|
9520
|
-
logger$
|
|
9535
|
+
logger$5.info('accept call, session found', { sipId: sipSession.id });
|
|
9521
9536
|
|
|
9522
9537
|
// $FlowFixMe
|
|
9523
9538
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9524
9539
|
return callSession.sipCallId;
|
|
9525
9540
|
}).catch(e => {
|
|
9526
|
-
logger$
|
|
9541
|
+
logger$5.error(e);
|
|
9527
9542
|
this.endCurrentCall(callSession);
|
|
9528
9543
|
throw e;
|
|
9529
9544
|
});
|
|
9530
9545
|
}
|
|
9531
9546
|
|
|
9532
|
-
logger$
|
|
9547
|
+
logger$5.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9533
9548
|
|
|
9534
9549
|
return Promise.resolve(null);
|
|
9535
9550
|
}
|
|
@@ -9539,7 +9554,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9539
9554
|
}
|
|
9540
9555
|
|
|
9541
9556
|
async reject(callSession ) {
|
|
9542
|
-
logger$
|
|
9557
|
+
logger$5.info('reject WebRTC called', { id: callSession.getId() });
|
|
9543
9558
|
|
|
9544
9559
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9545
9560
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9551,14 +9566,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9551
9566
|
|
|
9552
9567
|
const sipSession = this.findSipSession(callSession);
|
|
9553
9568
|
if (sipSession) {
|
|
9554
|
-
logger$
|
|
9569
|
+
logger$5.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9555
9570
|
|
|
9556
9571
|
this.client.hangup(sipSession);
|
|
9557
9572
|
}
|
|
9558
9573
|
}
|
|
9559
9574
|
|
|
9560
9575
|
async ignore(callSession ) {
|
|
9561
|
-
logger$
|
|
9576
|
+
logger$5.info('WebRTC ignore', { id: callSession.getId() });
|
|
9562
9577
|
|
|
9563
9578
|
// kill the ring
|
|
9564
9579
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9570,14 +9585,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9570
9585
|
const sipSession = this.findSipSession(callSession);
|
|
9571
9586
|
|
|
9572
9587
|
if (sipSession) {
|
|
9573
|
-
logger$
|
|
9588
|
+
logger$5.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9574
9589
|
|
|
9575
9590
|
return this.client.atxfer(sipSession);
|
|
9576
9591
|
}
|
|
9577
9592
|
}
|
|
9578
9593
|
|
|
9579
9594
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9580
|
-
logger$
|
|
9595
|
+
logger$5.info('WebRTC hold', { id: callSession.getId() });
|
|
9581
9596
|
|
|
9582
9597
|
const sipSession = this.findSipSession(callSession);
|
|
9583
9598
|
|
|
@@ -9592,18 +9607,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9592
9607
|
}
|
|
9593
9608
|
|
|
9594
9609
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9595
|
-
logger$
|
|
9610
|
+
logger$5.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9596
9611
|
|
|
9597
9612
|
const sipSession = this.findSipSession(callSession);
|
|
9598
9613
|
if (!sipSession) {
|
|
9599
9614
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9600
9615
|
}
|
|
9601
9616
|
|
|
9602
|
-
logger$
|
|
9617
|
+
logger$5.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9603
9618
|
|
|
9604
9619
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9605
9620
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9606
|
-
logger$
|
|
9621
|
+
logger$5.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9607
9622
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9608
9623
|
}
|
|
9609
9624
|
|
|
@@ -9628,7 +9643,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9628
9643
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9629
9644
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9630
9645
|
|
|
9631
|
-
logger$
|
|
9646
|
+
logger$5.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9632
9647
|
|
|
9633
9648
|
// Stop screenshre if needed
|
|
9634
9649
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9659,7 +9674,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9659
9674
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9660
9675
|
}
|
|
9661
9676
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9662
|
-
logger$
|
|
9677
|
+
logger$5.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9663
9678
|
|
|
9664
9679
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9665
9680
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9703,14 +9718,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9703
9718
|
}
|
|
9704
9719
|
|
|
9705
9720
|
mute(callSession , withEvent = true) {
|
|
9706
|
-
logger$
|
|
9721
|
+
logger$5.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9707
9722
|
|
|
9708
9723
|
const sipSession = this.findSipSession(callSession);
|
|
9709
9724
|
if (!sipSession) {
|
|
9710
9725
|
return;
|
|
9711
9726
|
}
|
|
9712
9727
|
|
|
9713
|
-
logger$
|
|
9728
|
+
logger$5.info('WebRTC muting', { sipId: sipSession.id });
|
|
9714
9729
|
this.client.mute(sipSession);
|
|
9715
9730
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9716
9731
|
|
|
@@ -9724,14 +9739,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9724
9739
|
}
|
|
9725
9740
|
|
|
9726
9741
|
unmute(callSession , withEvent = true) {
|
|
9727
|
-
logger$
|
|
9742
|
+
logger$5.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9728
9743
|
|
|
9729
9744
|
const sipSession = this.findSipSession(callSession);
|
|
9730
9745
|
if (!sipSession) {
|
|
9731
9746
|
return;
|
|
9732
9747
|
}
|
|
9733
9748
|
|
|
9734
|
-
logger$
|
|
9749
|
+
logger$5.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9735
9750
|
this.client.unmute(sipSession);
|
|
9736
9751
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9737
9752
|
|
|
@@ -9758,7 +9773,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9758
9773
|
if (!sipSession) {
|
|
9759
9774
|
return;
|
|
9760
9775
|
}
|
|
9761
|
-
logger$
|
|
9776
|
+
logger$5.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9762
9777
|
|
|
9763
9778
|
this.client.toggleCameraOn(sipSession);
|
|
9764
9779
|
|
|
@@ -9770,7 +9785,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9770
9785
|
if (!sipSession) {
|
|
9771
9786
|
return;
|
|
9772
9787
|
}
|
|
9773
|
-
logger$
|
|
9788
|
+
logger$5.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9774
9789
|
|
|
9775
9790
|
this.client.toggleCameraOff(sipSession);
|
|
9776
9791
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9782,7 +9797,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9782
9797
|
return;
|
|
9783
9798
|
}
|
|
9784
9799
|
|
|
9785
|
-
logger$
|
|
9800
|
+
logger$5.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9786
9801
|
this.client.sendDTMF(sipSession, tone);
|
|
9787
9802
|
}
|
|
9788
9803
|
|
|
@@ -9790,7 +9805,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9790
9805
|
// @TODO: line is not used here
|
|
9791
9806
|
async makeCall(number , line , cameraEnabled ,
|
|
9792
9807
|
audioOnly = false, conference = false) {
|
|
9793
|
-
logger$
|
|
9808
|
+
logger$5.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
|
|
9794
9809
|
if (!number) {
|
|
9795
9810
|
return Promise.resolve(null);
|
|
9796
9811
|
}
|
|
@@ -9800,7 +9815,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9800
9815
|
}
|
|
9801
9816
|
if (this.currentSipSession) {
|
|
9802
9817
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9803
|
-
logger$
|
|
9818
|
+
logger$5.warn('Unable to hold current session when making another call', e);
|
|
9804
9819
|
});
|
|
9805
9820
|
}
|
|
9806
9821
|
|
|
@@ -9810,7 +9825,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9810
9825
|
this._bindEvents(sipSession);
|
|
9811
9826
|
} catch (error) {
|
|
9812
9827
|
console.warn(error);
|
|
9813
|
-
logger$
|
|
9828
|
+
logger$5.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9814
9829
|
return Promise.resolve(null);
|
|
9815
9830
|
}
|
|
9816
9831
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
@@ -9838,7 +9853,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9838
9853
|
return;
|
|
9839
9854
|
}
|
|
9840
9855
|
|
|
9841
|
-
logger$
|
|
9856
|
+
logger$5.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9842
9857
|
|
|
9843
9858
|
this.client.transfer(sipSession, target);
|
|
9844
9859
|
}
|
|
@@ -9847,7 +9862,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9847
9862
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9848
9863
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9849
9864
|
|
|
9850
|
-
logger$
|
|
9865
|
+
logger$5.info('WebRTC indirect transfer', {
|
|
9851
9866
|
sipId: sipSession ? sipSession.id : null,
|
|
9852
9867
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9853
9868
|
});
|
|
@@ -9886,7 +9901,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9886
9901
|
return false;
|
|
9887
9902
|
}
|
|
9888
9903
|
|
|
9889
|
-
logger$
|
|
9904
|
+
logger$5.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9890
9905
|
|
|
9891
9906
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9892
9907
|
|
|
@@ -9932,7 +9947,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9932
9947
|
endCurrentCall(callSession ) {
|
|
9933
9948
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9934
9949
|
|
|
9935
|
-
logger$
|
|
9950
|
+
logger$5.info('Ending current call', {
|
|
9936
9951
|
id: callSession ? callSession.getId() : null,
|
|
9937
9952
|
isCurrent,
|
|
9938
9953
|
});
|
|
@@ -9956,7 +9971,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9956
9971
|
}
|
|
9957
9972
|
|
|
9958
9973
|
async close() {
|
|
9959
|
-
logger$
|
|
9974
|
+
logger$5.info('WebRTC close');
|
|
9960
9975
|
|
|
9961
9976
|
try {
|
|
9962
9977
|
await Promise.race([
|
|
@@ -9964,7 +9979,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9964
9979
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9965
9980
|
]);
|
|
9966
9981
|
} catch (e) {
|
|
9967
|
-
logger$
|
|
9982
|
+
logger$5.error('WebRTC close, unregister error', e);
|
|
9968
9983
|
}
|
|
9969
9984
|
|
|
9970
9985
|
this.client.close();
|
|
@@ -9982,12 +9997,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9982
9997
|
}
|
|
9983
9998
|
|
|
9984
9999
|
enableRinging() {
|
|
9985
|
-
logger$
|
|
10000
|
+
logger$5.info('WebRTC enable ringing');
|
|
9986
10001
|
this.ringingEnabled = true;
|
|
9987
10002
|
}
|
|
9988
10003
|
|
|
9989
10004
|
disableRinging() {
|
|
9990
|
-
logger$
|
|
10005
|
+
logger$5.info('WebRTC disable ringing');
|
|
9991
10006
|
this.ringingEnabled = false;
|
|
9992
10007
|
}
|
|
9993
10008
|
|
|
@@ -10027,7 +10042,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10027
10042
|
|
|
10028
10043
|
// Deprecated
|
|
10029
10044
|
getLocalMediaStream(callSession ) {
|
|
10030
|
-
logger$
|
|
10045
|
+
logger$5.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
10031
10046
|
return this.getLocalStream(callSession);
|
|
10032
10047
|
}
|
|
10033
10048
|
|
|
@@ -10069,7 +10084,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10069
10084
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
10070
10085
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
10071
10086
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
10072
|
-
logger$
|
|
10087
|
+
logger$5.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
10073
10088
|
|
|
10074
10089
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
10075
10090
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -10092,7 +10107,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10092
10107
|
});
|
|
10093
10108
|
|
|
10094
10109
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
10095
|
-
logger$
|
|
10110
|
+
logger$5.info('WebRTC on reinvite', {
|
|
10096
10111
|
sessionId: args[0].id,
|
|
10097
10112
|
inviteId: args[1].id,
|
|
10098
10113
|
updatedCalleeName: args[2],
|
|
@@ -10112,7 +10127,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10112
10127
|
});
|
|
10113
10128
|
|
|
10114
10129
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
10115
|
-
logger$
|
|
10130
|
+
logger$5.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
10116
10131
|
|
|
10117
10132
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
10118
10133
|
|
|
@@ -10123,22 +10138,22 @@ class WebRTCPhone extends Emitter {
|
|
|
10123
10138
|
this.client.on('ended', () => {});
|
|
10124
10139
|
|
|
10125
10140
|
this.client.on(this.client.ON_ERROR, e => {
|
|
10126
|
-
logger$
|
|
10141
|
+
logger$5.error('WebRTC error', e);
|
|
10127
10142
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10128
10143
|
});
|
|
10129
10144
|
|
|
10130
10145
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10131
|
-
logger$
|
|
10146
|
+
logger$5.info('WebRTC unregistered');
|
|
10132
10147
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10133
10148
|
});
|
|
10134
10149
|
|
|
10135
10150
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
10136
|
-
logger$
|
|
10137
|
-
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10151
|
+
logger$5.info('WebRTC disconnected');
|
|
10152
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
10138
10153
|
});
|
|
10139
10154
|
|
|
10140
10155
|
this.client.on(this.client.REGISTERED, () => {
|
|
10141
|
-
logger$
|
|
10156
|
+
logger$5.info('WebRTC registered', {
|
|
10142
10157
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
10143
10158
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
10144
10159
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -10151,23 +10166,27 @@ class WebRTCPhone extends Emitter {
|
|
|
10151
10166
|
if (this.shouldSendReinvite && this.currentSipSession
|
|
10152
10167
|
&& this.currentSipSession.state === sessionState.SessionState.Established) {
|
|
10153
10168
|
this.shouldSendReinvite = false;
|
|
10169
|
+
const pc = this.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
10170
|
+
const isConference = pc ? pc.sfu : false;
|
|
10171
|
+
const hasVideo = this.currentCallSession && this.currentCallSession.cameraEnabled;
|
|
10172
|
+
|
|
10154
10173
|
try {
|
|
10155
10174
|
// Send reinvite with iceRestart
|
|
10156
|
-
this.sendReinvite(this.currentCallSession, null,
|
|
10175
|
+
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10157
10176
|
} catch (e) {
|
|
10158
|
-
logger$
|
|
10177
|
+
logger$5.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10159
10178
|
}
|
|
10160
10179
|
}
|
|
10161
10180
|
});
|
|
10162
10181
|
|
|
10163
10182
|
this.client.on(this.client.CONNECTED, () => {
|
|
10164
|
-
logger$
|
|
10183
|
+
logger$5.info('WebRTC client connected');
|
|
10165
10184
|
|
|
10166
10185
|
this.stopHeartbeat();
|
|
10167
10186
|
});
|
|
10168
10187
|
|
|
10169
10188
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
10170
|
-
logger$
|
|
10189
|
+
logger$5.info('WebRTC client disconnected');
|
|
10171
10190
|
|
|
10172
10191
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10173
10192
|
|
|
@@ -10181,7 +10200,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10181
10200
|
});
|
|
10182
10201
|
|
|
10183
10202
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
10184
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
10203
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
10185
10204
|
});
|
|
10186
10205
|
|
|
10187
10206
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -10196,7 +10215,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10196
10215
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
10197
10216
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
10198
10217
|
|
|
10199
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
10218
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, callSession, stats, previousStats);
|
|
10200
10219
|
});
|
|
10201
10220
|
|
|
10202
10221
|
// Used when upgrading directly in screenshare mode
|
|
@@ -10205,7 +10224,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10205
10224
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
10206
10225
|
const callSession = this.callSessions[sipSessionId];
|
|
10207
10226
|
|
|
10208
|
-
logger$
|
|
10227
|
+
logger$5.info('Updrading directly in screensharing mode', {
|
|
10209
10228
|
sipSessionId,
|
|
10210
10229
|
tracks: localStream ? localStream.getTracks() : null,
|
|
10211
10230
|
});
|
|
@@ -10237,6 +10256,15 @@ class WebRTCPhone extends Emitter {
|
|
|
10237
10256
|
return this.client.getSipSessionId(sipSession);
|
|
10238
10257
|
}
|
|
10239
10258
|
|
|
10259
|
+
_updateCallSession(callSession ) {
|
|
10260
|
+
const sipSession = this.findSipSession(callSession);
|
|
10261
|
+
const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
|
|
10262
|
+
|
|
10263
|
+
if (sipSessionId) {
|
|
10264
|
+
this.callSessions[sipSessionId] = callSession;
|
|
10265
|
+
}
|
|
10266
|
+
}
|
|
10267
|
+
|
|
10240
10268
|
_onMessage(message ) {
|
|
10241
10269
|
if (!message || message.method !== 'MESSAGE') {
|
|
10242
10270
|
return;
|
|
@@ -10374,8 +10402,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10374
10402
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10375
10403
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10376
10404
|
ON_MESSAGE: ON_MESSAGE,
|
|
10377
|
-
ON_REINVITE: ON_REINVITE,
|
|
10378
|
-
ON_TRACK: ON_TRACK,
|
|
10405
|
+
ON_REINVITE: ON_REINVITE$1,
|
|
10406
|
+
ON_TRACK: ON_TRACK$1,
|
|
10379
10407
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10380
10408
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10381
10409
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10390,13 +10418,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10390
10418
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10391
10419
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10392
10420
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10393
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10421
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS$1,
|
|
10394
10422
|
ON_CHAT: ON_CHAT,
|
|
10395
10423
|
ON_SIGNAL: ON_SIGNAL,
|
|
10396
|
-
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10424
|
+
ON_DISCONNECTED: ON_DISCONNECTED$1,
|
|
10397
10425
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10398
10426
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10399
|
-
events: events,
|
|
10427
|
+
events: events$1,
|
|
10400
10428
|
'default': WebRTCPhone
|
|
10401
10429
|
});
|
|
10402
10430
|
|
|
@@ -10790,7 +10818,7 @@ class Phone extends Emitter {
|
|
|
10790
10818
|
|
|
10791
10819
|
_transferEvents() {
|
|
10792
10820
|
this.unbind();
|
|
10793
|
-
[...events
|
|
10821
|
+
[...events, ...transportEvents].forEach(event => {
|
|
10794
10822
|
this.client.on(event, (...args) =>
|
|
10795
10823
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
10796
10824
|
});
|
|
@@ -10812,7 +10840,7 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
10812
10840
|
|
|
10813
10841
|
//
|
|
10814
10842
|
|
|
10815
|
-
const SOCKET_EVENTS
|
|
10843
|
+
const SOCKET_EVENTS = {
|
|
10816
10844
|
ON_OPEN: 'onopen',
|
|
10817
10845
|
ON_MESSAGE: 'onmessage',
|
|
10818
10846
|
ON_ERROR: 'onerror',
|
|
@@ -10908,7 +10936,7 @@ const BLACKLIST_EVENTS = [
|
|
|
10908
10936
|
];
|
|
10909
10937
|
|
|
10910
10938
|
const HEARTBEAT_ENGINE_VERSION = '20.09';
|
|
10911
|
-
const logger$
|
|
10939
|
+
const logger$7 = IssueReporter$1.loggerFor('wazo-ws');
|
|
10912
10940
|
const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
|
|
10913
10941
|
|
|
10914
10942
|
class WebSocketClient extends Emitter {
|
|
@@ -10957,24 +10985,24 @@ class WebSocketClient extends Emitter {
|
|
|
10957
10985
|
}
|
|
10958
10986
|
|
|
10959
10987
|
connect() {
|
|
10960
|
-
logger$
|
|
10988
|
+
logger$7.info('connect method started', { host: this.host, token: this.token });
|
|
10961
10989
|
this.socket = new ReconnectingWebSocket__default['default'](this._getUrl.bind(this), [], this.options);
|
|
10962
10990
|
if (this.options.binaryType) {
|
|
10963
10991
|
this.socket.binaryType = this.options.binaryType;
|
|
10964
10992
|
}
|
|
10965
10993
|
|
|
10966
10994
|
this.socket.onopen = () => {
|
|
10967
|
-
logger$
|
|
10968
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
10995
|
+
logger$7.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
10996
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
10969
10997
|
};
|
|
10970
10998
|
|
|
10971
10999
|
this.socket.onerror = event => {
|
|
10972
|
-
logger$
|
|
10973
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11000
|
+
logger$7.error('on Wazo WS error', event.target);
|
|
11001
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
10974
11002
|
};
|
|
10975
11003
|
|
|
10976
11004
|
this.socket.onmessage = (event ) => {
|
|
10977
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11005
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
10978
11006
|
|
|
10979
11007
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
10980
11008
|
let { name } = message;
|
|
@@ -10999,7 +11027,7 @@ class WebSocketClient extends Emitter {
|
|
|
10999
11027
|
|
|
11000
11028
|
this.socket.onclose = event => {
|
|
11001
11029
|
// Can't be converted to JSON (circular structure)
|
|
11002
|
-
logger$
|
|
11030
|
+
logger$7.info('on Wazo WS close', {
|
|
11003
11031
|
reason: event.reason,
|
|
11004
11032
|
code: event.code,
|
|
11005
11033
|
readyState: event.target.readyState,
|
|
@@ -11007,22 +11035,22 @@ class WebSocketClient extends Emitter {
|
|
|
11007
11035
|
token: this.token,
|
|
11008
11036
|
});
|
|
11009
11037
|
this.initialized = false;
|
|
11010
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11038
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
11011
11039
|
|
|
11012
11040
|
switch (event.code) {
|
|
11013
11041
|
case 4002:
|
|
11014
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11042
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
11015
11043
|
break;
|
|
11016
11044
|
}
|
|
11017
11045
|
};
|
|
11018
11046
|
|
|
11019
11047
|
this.socket.onerror = event => {
|
|
11020
|
-
logger$
|
|
11048
|
+
logger$7.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
|
|
11021
11049
|
};
|
|
11022
11050
|
}
|
|
11023
11051
|
|
|
11024
11052
|
close(force = false) {
|
|
11025
|
-
logger$
|
|
11053
|
+
logger$7.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
|
|
11026
11054
|
|
|
11027
11055
|
if (!this.socket) {
|
|
11028
11056
|
return;
|
|
@@ -11040,7 +11068,7 @@ class WebSocketClient extends Emitter {
|
|
|
11040
11068
|
|
|
11041
11069
|
updateToken(token ) {
|
|
11042
11070
|
this.token = token;
|
|
11043
|
-
logger$
|
|
11071
|
+
logger$7.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
|
|
11044
11072
|
|
|
11045
11073
|
if (this.socket) {
|
|
11046
11074
|
// If still connected, send the token to the WS
|
|
@@ -11058,7 +11086,7 @@ class WebSocketClient extends Emitter {
|
|
|
11058
11086
|
}
|
|
11059
11087
|
|
|
11060
11088
|
startHeartbeat() {
|
|
11061
|
-
logger$
|
|
11089
|
+
logger$7.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
|
|
11062
11090
|
|
|
11063
11091
|
if (!this.socket) {
|
|
11064
11092
|
this.heartbeat.stop();
|
|
@@ -11072,7 +11100,7 @@ class WebSocketClient extends Emitter {
|
|
|
11072
11100
|
}
|
|
11073
11101
|
|
|
11074
11102
|
stopHeartbeat() {
|
|
11075
|
-
logger$
|
|
11103
|
+
logger$7.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
|
|
11076
11104
|
|
|
11077
11105
|
this.heartbeat.stop();
|
|
11078
11106
|
}
|
|
@@ -11102,7 +11130,7 @@ class WebSocketClient extends Emitter {
|
|
|
11102
11130
|
}
|
|
11103
11131
|
|
|
11104
11132
|
reconnect(reason ) {
|
|
11105
|
-
logger$
|
|
11133
|
+
logger$7.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
|
|
11106
11134
|
if (!this.socket) {
|
|
11107
11135
|
return;
|
|
11108
11136
|
}
|
|
@@ -11127,7 +11155,7 @@ class WebSocketClient extends Emitter {
|
|
|
11127
11155
|
break;
|
|
11128
11156
|
case 'start':
|
|
11129
11157
|
this.initialized = true;
|
|
11130
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11158
|
+
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
11131
11159
|
break;
|
|
11132
11160
|
default:
|
|
11133
11161
|
this.eventEmitter.emit('message', message);
|
|
@@ -11158,7 +11186,7 @@ class WebSocketClient extends Emitter {
|
|
|
11158
11186
|
this.close();
|
|
11159
11187
|
}
|
|
11160
11188
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
11161
|
-
logger$
|
|
11189
|
+
logger$7.log('Wazo WS url computed to reconnect', { url });
|
|
11162
11190
|
|
|
11163
11191
|
return url;
|
|
11164
11192
|
}
|
|
@@ -11166,15 +11194,15 @@ class WebSocketClient extends Emitter {
|
|
|
11166
11194
|
_onHeartbeat(message ) {
|
|
11167
11195
|
if (message.payload === 'pong') {
|
|
11168
11196
|
this.heartbeat.onHeartbeat();
|
|
11169
|
-
logger$
|
|
11197
|
+
logger$7.log('on heartbeat received from Wazo WS');
|
|
11170
11198
|
}
|
|
11171
11199
|
}
|
|
11172
11200
|
|
|
11173
11201
|
async _onHeartbeatTimeout() {
|
|
11174
|
-
logger$
|
|
11202
|
+
logger$7.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
11175
11203
|
|
|
11176
11204
|
this.close();
|
|
11177
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11205
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11178
11206
|
|
|
11179
11207
|
if (this.onHeartBeatTimeout) {
|
|
11180
11208
|
this.onHeartBeatTimeout();
|
|
@@ -11254,7 +11282,7 @@ WebSocketClient.eventLists = [
|
|
|
11254
11282
|
|
|
11255
11283
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
11256
11284
|
__proto__: null,
|
|
11257
|
-
SOCKET_EVENTS: SOCKET_EVENTS
|
|
11285
|
+
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
11258
11286
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
11259
11287
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
11260
11288
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -11327,10 +11355,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11327
11355
|
|
|
11328
11356
|
//
|
|
11329
11357
|
|
|
11330
|
-
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11331
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
11358
|
+
const { SOCKET_EVENTS: SOCKET_EVENTS$1, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11359
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS$1), ...Object.values(OTHER_EVENTS)];
|
|
11332
11360
|
|
|
11333
|
-
const logger$
|
|
11361
|
+
const logger$8 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
11334
11362
|
|
|
11335
11363
|
class Websocket extends Emitter {
|
|
11336
11364
|
|
|
@@ -11344,9 +11372,9 @@ class Websocket extends Emitter {
|
|
|
11344
11372
|
// $FlowFixMe
|
|
11345
11373
|
this[key] = OTHER_EVENTS[key];
|
|
11346
11374
|
});
|
|
11347
|
-
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
11375
|
+
Object.keys(SOCKET_EVENTS$1).forEach(key => {
|
|
11348
11376
|
// $FlowFixMe
|
|
11349
|
-
this[key] = SOCKET_EVENTS[key];
|
|
11377
|
+
this[key] = SOCKET_EVENTS$1[key];
|
|
11350
11378
|
});
|
|
11351
11379
|
this.eventLists = WebSocketClient.eventLists;
|
|
11352
11380
|
|
|
@@ -11354,7 +11382,7 @@ class Websocket extends Emitter {
|
|
|
11354
11382
|
}
|
|
11355
11383
|
|
|
11356
11384
|
open(host , session ) {
|
|
11357
|
-
logger$
|
|
11385
|
+
logger$8.info('open simple WebSocket', { host, token: session.token });
|
|
11358
11386
|
this.ws = new WebSocketClient(
|
|
11359
11387
|
{
|
|
11360
11388
|
host,
|
|
@@ -11382,7 +11410,7 @@ class Websocket extends Emitter {
|
|
|
11382
11410
|
}
|
|
11383
11411
|
|
|
11384
11412
|
updateToken(token ) {
|
|
11385
|
-
logger$
|
|
11413
|
+
logger$8.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
11386
11414
|
|
|
11387
11415
|
if (!this.ws) {
|
|
11388
11416
|
return;
|
|
@@ -11410,7 +11438,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11410
11438
|
|
|
11411
11439
|
//
|
|
11412
11440
|
|
|
11413
|
-
const logger$
|
|
11441
|
+
const logger$9 = IssueReporter$1.loggerFor('room');
|
|
11414
11442
|
|
|
11415
11443
|
class Participant extends Emitter {
|
|
11416
11444
|
|
|
@@ -11532,7 +11560,7 @@ class Participant extends Emitter {
|
|
|
11532
11560
|
}
|
|
11533
11561
|
|
|
11534
11562
|
onTalking(isTalking ) {
|
|
11535
|
-
logger$
|
|
11563
|
+
logger$9.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
11536
11564
|
this.isTalking = isTalking;
|
|
11537
11565
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
11538
11566
|
// directly from asterisk, there's no need to do so
|
|
@@ -11635,7 +11663,7 @@ class Participant extends Emitter {
|
|
|
11635
11663
|
}
|
|
11636
11664
|
|
|
11637
11665
|
updateStatus(status , broadcast = true) {
|
|
11638
|
-
logger$
|
|
11666
|
+
logger$9.info('updating participant status', { name: this.name, status });
|
|
11639
11667
|
|
|
11640
11668
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
11641
11669
|
if (status.audioMuted) {
|
|
@@ -11683,7 +11711,7 @@ class Participant extends Emitter {
|
|
|
11683
11711
|
|
|
11684
11712
|
broadcastStatus(inboundStatus = null) {
|
|
11685
11713
|
const status = inboundStatus || this.getStatus();
|
|
11686
|
-
logger$
|
|
11714
|
+
logger$9.info('broadcasting participant status', { callId: this.callId, status });
|
|
11687
11715
|
|
|
11688
11716
|
this.room.sendSignal({
|
|
11689
11717
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|
|
@@ -11719,9 +11747,9 @@ class LocalParticipant extends Participant {
|
|
|
11719
11747
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
11720
11748
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
11721
11749
|
|
|
11722
|
-
const logger$
|
|
11750
|
+
const logger$a = IssueReporter$1.loggerFor('sdk-room');
|
|
11723
11751
|
|
|
11724
|
-
class Room
|
|
11752
|
+
class Room extends Emitter {
|
|
11725
11753
|
|
|
11726
11754
|
|
|
11727
11755
|
|
|
@@ -11779,7 +11807,7 @@ class Room$1 extends Emitter {
|
|
|
11779
11807
|
extra = {},
|
|
11780
11808
|
) {
|
|
11781
11809
|
super();
|
|
11782
|
-
logger$
|
|
11810
|
+
logger$a.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
11783
11811
|
|
|
11784
11812
|
// Represents the room callSession
|
|
11785
11813
|
this.callSession = callSession;
|
|
@@ -11845,7 +11873,7 @@ class Room$1 extends Emitter {
|
|
|
11845
11873
|
* @returns {Promise<Room>}
|
|
11846
11874
|
*/
|
|
11847
11875
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
11848
|
-
logger$
|
|
11876
|
+
logger$a.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
11849
11877
|
|
|
11850
11878
|
if (!room) {
|
|
11851
11879
|
await Wazo.Phone.connect();
|
|
@@ -11858,7 +11886,7 @@ class Room$1 extends Emitter {
|
|
|
11858
11886
|
|
|
11859
11887
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
11860
11888
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
11861
|
-
logger$
|
|
11889
|
+
logger$a.info('room call received via WS', { callId: data.call_id });
|
|
11862
11890
|
if (room) {
|
|
11863
11891
|
room.setCallId(data.call_id);
|
|
11864
11892
|
}
|
|
@@ -11866,7 +11894,7 @@ class Room$1 extends Emitter {
|
|
|
11866
11894
|
|
|
11867
11895
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
11868
11896
|
// eslint-disable-next-line no-param-reassign
|
|
11869
|
-
room = new Room
|
|
11897
|
+
room = new Room(callSession, extension, null, null, extra);
|
|
11870
11898
|
|
|
11871
11899
|
// Wait for the call to be accepted
|
|
11872
11900
|
await new Promise((resolve, reject) => {
|
|
@@ -11887,7 +11915,7 @@ class Room$1 extends Emitter {
|
|
|
11887
11915
|
// Retrieve conference
|
|
11888
11916
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
11889
11917
|
|
|
11890
|
-
logger$
|
|
11918
|
+
logger$a.info('connected to room', {
|
|
11891
11919
|
sourceId: conference ? conference.sourceId : null,
|
|
11892
11920
|
name: conference ? conference.name : null,
|
|
11893
11921
|
});
|
|
@@ -11897,7 +11925,7 @@ class Room$1 extends Emitter {
|
|
|
11897
11925
|
room.setName(conference.name);
|
|
11898
11926
|
}
|
|
11899
11927
|
} else if (meeting) {
|
|
11900
|
-
logger$
|
|
11928
|
+
logger$a.info('Already connected to meeting', {
|
|
11901
11929
|
uuid: meeting.uuid,
|
|
11902
11930
|
name: meeting.name,
|
|
11903
11931
|
});
|
|
@@ -11910,13 +11938,13 @@ class Room$1 extends Emitter {
|
|
|
11910
11938
|
}
|
|
11911
11939
|
|
|
11912
11940
|
static disconnect() {
|
|
11913
|
-
logger$
|
|
11941
|
+
logger$a.info('static disconnection to room');
|
|
11914
11942
|
|
|
11915
11943
|
Wazo.Phone.disconnect();
|
|
11916
11944
|
}
|
|
11917
11945
|
|
|
11918
11946
|
async disconnect() {
|
|
11919
|
-
logger$
|
|
11947
|
+
logger$a.info('disconnection to room called');
|
|
11920
11948
|
|
|
11921
11949
|
await Wazo.Phone.hangup(this.callSession);
|
|
11922
11950
|
this.callSession = null;
|
|
@@ -11936,19 +11964,19 @@ class Room$1 extends Emitter {
|
|
|
11936
11964
|
}
|
|
11937
11965
|
|
|
11938
11966
|
setSourceId(sourceId ) {
|
|
11939
|
-
logger$
|
|
11967
|
+
logger$a.info('set room source id', { sourceId });
|
|
11940
11968
|
|
|
11941
11969
|
this.sourceId = sourceId;
|
|
11942
11970
|
}
|
|
11943
11971
|
|
|
11944
11972
|
setMeetingUuid(meetingUuid ) {
|
|
11945
|
-
logger$
|
|
11973
|
+
logger$a.info('set meeting uuid', { meetingUuid });
|
|
11946
11974
|
|
|
11947
11975
|
this.meetingUuid = meetingUuid;
|
|
11948
11976
|
}
|
|
11949
11977
|
|
|
11950
11978
|
setCallId(callId ) {
|
|
11951
|
-
logger$
|
|
11979
|
+
logger$a.info('set room call id', { callId });
|
|
11952
11980
|
|
|
11953
11981
|
if (callId) {
|
|
11954
11982
|
this.callId = callId;
|
|
@@ -11956,7 +11984,7 @@ class Room$1 extends Emitter {
|
|
|
11956
11984
|
}
|
|
11957
11985
|
|
|
11958
11986
|
setName(name ) {
|
|
11959
|
-
logger$
|
|
11987
|
+
logger$a.info('set room name', { name });
|
|
11960
11988
|
|
|
11961
11989
|
this.name = name;
|
|
11962
11990
|
}
|
|
@@ -11975,7 +12003,7 @@ class Room$1 extends Emitter {
|
|
|
11975
12003
|
}
|
|
11976
12004
|
|
|
11977
12005
|
async startScreenSharing(constraints ) {
|
|
11978
|
-
logger$
|
|
12006
|
+
logger$a.info('start room screen sharing', { constraints });
|
|
11979
12007
|
|
|
11980
12008
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
11981
12009
|
if (!screensharingStream) {
|
|
@@ -11989,7 +12017,7 @@ class Room$1 extends Emitter {
|
|
|
11989
12017
|
}
|
|
11990
12018
|
|
|
11991
12019
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
11992
|
-
logger$
|
|
12020
|
+
logger$a.info('stop room screen sharing');
|
|
11993
12021
|
|
|
11994
12022
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
11995
12023
|
|
|
@@ -12001,7 +12029,7 @@ class Room$1 extends Emitter {
|
|
|
12001
12029
|
}
|
|
12002
12030
|
|
|
12003
12031
|
turnCameraOff() {
|
|
12004
|
-
logger$
|
|
12032
|
+
logger$a.info('turn room camera off');
|
|
12005
12033
|
|
|
12006
12034
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
12007
12035
|
|
|
@@ -12011,7 +12039,7 @@ class Room$1 extends Emitter {
|
|
|
12011
12039
|
}
|
|
12012
12040
|
|
|
12013
12041
|
turnCameraOn() {
|
|
12014
|
-
logger$
|
|
12042
|
+
logger$a.info('turn room camera on');
|
|
12015
12043
|
|
|
12016
12044
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
12017
12045
|
|
|
@@ -12021,7 +12049,7 @@ class Room$1 extends Emitter {
|
|
|
12021
12049
|
}
|
|
12022
12050
|
|
|
12023
12051
|
mute() {
|
|
12024
|
-
logger$
|
|
12052
|
+
logger$a.info('mute room');
|
|
12025
12053
|
|
|
12026
12054
|
Wazo.Phone.mute(this.callSession);
|
|
12027
12055
|
|
|
@@ -12029,7 +12057,7 @@ class Room$1 extends Emitter {
|
|
|
12029
12057
|
}
|
|
12030
12058
|
|
|
12031
12059
|
unmute() {
|
|
12032
|
-
logger$
|
|
12060
|
+
logger$a.info('unmute room');
|
|
12033
12061
|
|
|
12034
12062
|
Wazo.Phone.unmute(this.callSession);
|
|
12035
12063
|
|
|
@@ -12049,7 +12077,7 @@ class Room$1 extends Emitter {
|
|
|
12049
12077
|
}
|
|
12050
12078
|
|
|
12051
12079
|
hold() {
|
|
12052
|
-
logger$
|
|
12080
|
+
logger$a.info('hold room');
|
|
12053
12081
|
|
|
12054
12082
|
Wazo.Phone.hold(this.callSession, true);
|
|
12055
12083
|
|
|
@@ -12059,7 +12087,7 @@ class Room$1 extends Emitter {
|
|
|
12059
12087
|
}
|
|
12060
12088
|
|
|
12061
12089
|
async resume() {
|
|
12062
|
-
logger$
|
|
12090
|
+
logger$a.info('resume room');
|
|
12063
12091
|
|
|
12064
12092
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
12065
12093
|
|
|
@@ -12087,13 +12115,13 @@ class Room$1 extends Emitter {
|
|
|
12087
12115
|
}
|
|
12088
12116
|
|
|
12089
12117
|
sendDTMF(tone ) {
|
|
12090
|
-
logger$
|
|
12118
|
+
logger$a.info('send room DTMF', { tone });
|
|
12091
12119
|
|
|
12092
12120
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
12093
12121
|
}
|
|
12094
12122
|
|
|
12095
12123
|
async sendReinvite(newConstraints = null) {
|
|
12096
|
-
logger$
|
|
12124
|
+
logger$a.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
12097
12125
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
12098
12126
|
|
|
12099
12127
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -12152,7 +12180,7 @@ class Room$1 extends Emitter {
|
|
|
12152
12180
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
12153
12181
|
|
|
12154
12182
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
12155
|
-
logger$
|
|
12183
|
+
logger$a.info('on room audio stream');
|
|
12156
12184
|
|
|
12157
12185
|
this.audioStream = stream;
|
|
12158
12186
|
if (!this.roomAudioElement) {
|
|
@@ -12165,7 +12193,7 @@ class Room$1 extends Emitter {
|
|
|
12165
12193
|
});
|
|
12166
12194
|
|
|
12167
12195
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
12168
|
-
logger$
|
|
12196
|
+
logger$a.info('on room video stream', { streamId });
|
|
12169
12197
|
|
|
12170
12198
|
this._mapMsid(sipSession.body.body);
|
|
12171
12199
|
|
|
@@ -12180,7 +12208,7 @@ class Room$1 extends Emitter {
|
|
|
12180
12208
|
});
|
|
12181
12209
|
|
|
12182
12210
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
12183
|
-
logger$
|
|
12211
|
+
logger$a.info('on room remove stream');
|
|
12184
12212
|
|
|
12185
12213
|
const participant = this.participants.find(someParticipant =>
|
|
12186
12214
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -12312,7 +12340,7 @@ class Room$1 extends Emitter {
|
|
|
12312
12340
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
12313
12341
|
if (requester) {
|
|
12314
12342
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
12315
|
-
logger$
|
|
12343
|
+
logger$a.info('trigger room requester status', { origin });
|
|
12316
12344
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
12317
12345
|
}
|
|
12318
12346
|
break;
|
|
@@ -12343,24 +12371,24 @@ class Room$1 extends Emitter {
|
|
|
12343
12371
|
|
|
12344
12372
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
12345
12373
|
if (participant.user_uuid === session.uuid) {
|
|
12346
|
-
logger$
|
|
12374
|
+
logger$a.info('room current user joined');
|
|
12347
12375
|
|
|
12348
12376
|
// Retrieve participants via an API calls
|
|
12349
12377
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
12350
12378
|
let response;
|
|
12351
12379
|
try {
|
|
12352
12380
|
if (this.meetingUuid) {
|
|
12353
|
-
logger$
|
|
12381
|
+
logger$a.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
12354
12382
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
12355
12383
|
} else {
|
|
12356
|
-
logger$
|
|
12384
|
+
logger$a.info('fetching conference participants', { conferenceId });
|
|
12357
12385
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
12358
12386
|
}
|
|
12359
12387
|
} catch (e) {
|
|
12360
|
-
logger$
|
|
12388
|
+
logger$a.error('room participants fetching, error', e);
|
|
12361
12389
|
}
|
|
12362
12390
|
if (response) {
|
|
12363
|
-
logger$
|
|
12391
|
+
logger$a.info('conference participants fetched', { nb: response.items.length });
|
|
12364
12392
|
participants = response.items.map(item => {
|
|
12365
12393
|
const isMe = item.call_id === this.callId;
|
|
12366
12394
|
|
|
@@ -12387,7 +12415,7 @@ class Room$1 extends Emitter {
|
|
|
12387
12415
|
? new Wazo.RemoteParticipant(this, participant)
|
|
12388
12416
|
: null;
|
|
12389
12417
|
|
|
12390
|
-
logger$
|
|
12418
|
+
logger$a.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
12391
12419
|
|
|
12392
12420
|
if (remoteParticipant) {
|
|
12393
12421
|
this.participants.push(remoteParticipant);
|
|
@@ -12552,12 +12580,12 @@ class Room$1 extends Emitter {
|
|
|
12552
12580
|
|
|
12553
12581
|
//
|
|
12554
12582
|
|
|
12555
|
-
const logger$
|
|
12583
|
+
const logger$b = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
12556
12584
|
|
|
12557
|
-
class SipRoom extends Room
|
|
12585
|
+
class SipRoom extends Room {
|
|
12558
12586
|
|
|
12559
12587
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
12560
|
-
logger$
|
|
12588
|
+
logger$b.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
12561
12589
|
|
|
12562
12590
|
if (!room) {
|
|
12563
12591
|
await Wazo.Phone.connect();
|
|
@@ -12573,7 +12601,7 @@ class SipRoom extends Room$1 {
|
|
|
12573
12601
|
room.setCallId(room.callSession.call.id);
|
|
12574
12602
|
}
|
|
12575
12603
|
|
|
12576
|
-
logger$
|
|
12604
|
+
logger$b.info('connected to room', {
|
|
12577
12605
|
extension: room.extension,
|
|
12578
12606
|
});
|
|
12579
12607
|
|
|
@@ -12581,7 +12609,7 @@ class SipRoom extends Room$1 {
|
|
|
12581
12609
|
}
|
|
12582
12610
|
|
|
12583
12611
|
mute() {
|
|
12584
|
-
logger$
|
|
12612
|
+
logger$b.info('mute sip room');
|
|
12585
12613
|
|
|
12586
12614
|
Wazo.Phone.mute(this.callSession, false);
|
|
12587
12615
|
|
|
@@ -12589,7 +12617,7 @@ class SipRoom extends Room$1 {
|
|
|
12589
12617
|
}
|
|
12590
12618
|
|
|
12591
12619
|
unmute() {
|
|
12592
|
-
logger$
|
|
12620
|
+
logger$b.info('unmute sip room');
|
|
12593
12621
|
|
|
12594
12622
|
Wazo.Phone.unmute(this.callSession, false);
|
|
12595
12623
|
|
|
@@ -12873,7 +12901,7 @@ class NotificationOptions {
|
|
|
12873
12901
|
|
|
12874
12902
|
|
|
12875
12903
|
// Represents a conference room, like `9000`.
|
|
12876
|
-
class Room {
|
|
12904
|
+
class Room$1 {
|
|
12877
12905
|
|
|
12878
12906
|
|
|
12879
12907
|
|
|
@@ -12894,7 +12922,7 @@ class Room {
|
|
|
12894
12922
|
}
|
|
12895
12923
|
|
|
12896
12924
|
connect(callSession ) {
|
|
12897
|
-
return new Room({ ...this, connectedCallSession: callSession });
|
|
12925
|
+
return new Room$1({ ...this, connectedCallSession: callSession });
|
|
12898
12926
|
}
|
|
12899
12927
|
|
|
12900
12928
|
has(callSession ) {
|
|
@@ -12903,7 +12931,7 @@ class Room {
|
|
|
12903
12931
|
|
|
12904
12932
|
addParticipant(uuid , extension , talking = null) {
|
|
12905
12933
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
12906
|
-
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12934
|
+
return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12907
12935
|
}
|
|
12908
12936
|
|
|
12909
12937
|
return this;
|
|
@@ -12922,7 +12950,7 @@ class Room {
|
|
|
12922
12950
|
updatedParticipants.push(participant);
|
|
12923
12951
|
}
|
|
12924
12952
|
|
|
12925
|
-
return new Room({ ...this, participants: updatedParticipants });
|
|
12953
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
12926
12954
|
}
|
|
12927
12955
|
|
|
12928
12956
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -12938,7 +12966,7 @@ class Room {
|
|
|
12938
12966
|
updatedParticipants.push(participant);
|
|
12939
12967
|
}
|
|
12940
12968
|
|
|
12941
|
-
return new Room({ ...this, participants: updatedParticipants });
|
|
12969
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
12942
12970
|
}
|
|
12943
12971
|
|
|
12944
12972
|
hasCallWithId(id ) {
|
|
@@ -12946,18 +12974,18 @@ class Room {
|
|
|
12946
12974
|
}
|
|
12947
12975
|
|
|
12948
12976
|
disconnect() {
|
|
12949
|
-
return new Room({ ...this, connectedCallSession: null });
|
|
12977
|
+
return new Room$1({ ...this, connectedCallSession: null });
|
|
12950
12978
|
}
|
|
12951
12979
|
|
|
12952
12980
|
removeParticipantWithUUID(uuid ) {
|
|
12953
|
-
return new Room({
|
|
12981
|
+
return new Room$1({
|
|
12954
12982
|
...this,
|
|
12955
12983
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
12956
12984
|
});
|
|
12957
12985
|
}
|
|
12958
12986
|
|
|
12959
12987
|
removeParticipantWithExtension(extension ) {
|
|
12960
|
-
return new Room({
|
|
12988
|
+
return new Room$1({
|
|
12961
12989
|
...this,
|
|
12962
12990
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
12963
12991
|
});
|
|
@@ -12968,7 +12996,7 @@ class Room {
|
|
|
12968
12996
|
}
|
|
12969
12997
|
|
|
12970
12998
|
static newFrom(room ) {
|
|
12971
|
-
return newFrom(room, Room);
|
|
12999
|
+
return newFrom(room, Room$1);
|
|
12972
13000
|
}
|
|
12973
13001
|
}
|
|
12974
13002
|
|
|
@@ -13275,11 +13303,11 @@ var wazoWebsocket = {
|
|
|
13275
13303
|
resolve();
|
|
13276
13304
|
};
|
|
13277
13305
|
|
|
13278
|
-
client.on(SOCKET_EVENTS
|
|
13306
|
+
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
13279
13307
|
handleError(`Connection error : ${error}`);
|
|
13280
13308
|
});
|
|
13281
13309
|
|
|
13282
|
-
client.on(SOCKET_EVENTS
|
|
13310
|
+
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
13283
13311
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
13284
13312
|
client.setOnHeartbeatTimeout(() => {
|
|
13285
13313
|
handleError('No response to heartbeat');
|
|
@@ -13380,7 +13408,7 @@ var webrtc = {
|
|
|
13380
13408
|
}),
|
|
13381
13409
|
};
|
|
13382
13410
|
|
|
13383
|
-
const parseCandidate = line => {
|
|
13411
|
+
const parseCandidate$1 = line => {
|
|
13384
13412
|
let parts;
|
|
13385
13413
|
// Parse both variants.
|
|
13386
13414
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -13471,7 +13499,7 @@ var SymmetricNat = {
|
|
|
13471
13499
|
}
|
|
13472
13500
|
|
|
13473
13501
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
13474
|
-
const cand = parseCandidate(e.candidate.candidate);
|
|
13502
|
+
const cand = parseCandidate$1(e.candidate.candidate);
|
|
13475
13503
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
13476
13504
|
candidates[cand.relatedPort].push(cand.port);
|
|
13477
13505
|
} else if (!e.candidate) {
|
|
@@ -13539,7 +13567,7 @@ var iceIpv4 = {
|
|
|
13539
13567
|
const rawCandidate = e.candidate.candidate;
|
|
13540
13568
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
13541
13569
|
hasSrflxOrRelay = true;
|
|
13542
|
-
const candidate = parseCandidate(e.candidate.candidate);
|
|
13570
|
+
const candidate = parseCandidate$1(e.candidate.candidate);
|
|
13543
13571
|
ips.push(candidate.ip);
|
|
13544
13572
|
}
|
|
13545
13573
|
} else if (!e.candidate) {
|
|
@@ -13576,7 +13604,7 @@ var checks = [
|
|
|
13576
13604
|
|
|
13577
13605
|
//
|
|
13578
13606
|
|
|
13579
|
-
const logger = IssueReporter$1.loggerFor('engine-check');
|
|
13607
|
+
const logger$c = IssueReporter$1.loggerFor('engine-check');
|
|
13580
13608
|
|
|
13581
13609
|
class Checker {
|
|
13582
13610
|
|
|
@@ -13594,28 +13622,28 @@ class Checker {
|
|
|
13594
13622
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
13595
13623
|
await this._addEngineVersion();
|
|
13596
13624
|
|
|
13597
|
-
logger.info('Engine check starting');
|
|
13625
|
+
logger$c.info('Engine check starting');
|
|
13598
13626
|
|
|
13599
13627
|
for (let i = 0; i < this.checks.length; i++) {
|
|
13600
13628
|
const { name, check } = this.checks[i];
|
|
13601
13629
|
|
|
13602
|
-
logger.info(`Checking ${name} ...`);
|
|
13630
|
+
logger$c.info(`Checking ${name} ...`);
|
|
13603
13631
|
|
|
13604
13632
|
onCheckBegin(name);
|
|
13605
13633
|
try {
|
|
13606
13634
|
// eslint-disable-next-line no-await-in-loop
|
|
13607
13635
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
13608
|
-
logger.info(`Checking ${name} success.`, { result });
|
|
13636
|
+
logger$c.info(`Checking ${name} success.`, { result });
|
|
13609
13637
|
|
|
13610
13638
|
onCheckResult(name, result);
|
|
13611
13639
|
} catch (e) {
|
|
13612
|
-
logger.info(`Checking ${name} failure`, { message: e.message });
|
|
13640
|
+
logger$c.info(`Checking ${name} failure`, { message: e.message });
|
|
13613
13641
|
|
|
13614
13642
|
onCheckResult(name, e);
|
|
13615
13643
|
}
|
|
13616
13644
|
}
|
|
13617
13645
|
|
|
13618
|
-
logger.info('Engine check done.');
|
|
13646
|
+
logger$c.info('Engine check done.');
|
|
13619
13647
|
}
|
|
13620
13648
|
|
|
13621
13649
|
addCheck(check ) {
|
|
@@ -13639,7 +13667,7 @@ const Wazo = {
|
|
|
13639
13667
|
Auth: Auth$1,
|
|
13640
13668
|
Phone: Phone$1,
|
|
13641
13669
|
Websocket: Websocket$1,
|
|
13642
|
-
Room
|
|
13670
|
+
Room,
|
|
13643
13671
|
SipRoom,
|
|
13644
13672
|
RemoteParticipant,
|
|
13645
13673
|
LocalParticipant,
|
|
@@ -13672,7 +13700,7 @@ const Wazo = {
|
|
|
13672
13700
|
Session,
|
|
13673
13701
|
Voicemail,
|
|
13674
13702
|
Relocation,
|
|
13675
|
-
ConferenceRoom: Room,
|
|
13703
|
+
ConferenceRoom: Room$1,
|
|
13676
13704
|
CallSession,
|
|
13677
13705
|
IndirectTransfer,
|
|
13678
13706
|
SwitchboardCall,
|