@wazo/sdk 0.37.23 → 0.37.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wazo-sdk.js +6 -6
- package/esm/__tests__/api-client.test.js +22 -17
- package/esm/__tests__/web-rtc-client.test.js +105 -100
- package/esm/api/amid.js +1 -1
- package/esm/api/call-logd.js +2 -2
- package/esm/api/confd.js +10 -5
- package/esm/api/ctid-ng.js +3 -3
- package/esm/api/dird.js +1 -1
- package/esm/api/webhookd.js +1 -1
- package/esm/api-client.js +22 -17
- package/esm/checker/Checker.js +130 -125
- package/esm/checker/checks/aor.js +22 -17
- package/esm/checker/checks/api.js +22 -17
- package/esm/checker/checks/index.js +120 -115
- package/esm/checker/checks/wazo-websocket.js +15 -15
- package/esm/checker/checks/webrtc-transport.js +105 -100
- package/esm/checker/checks/webrtc.js +105 -100
- package/esm/domain/AdHocAPIConference.js +22 -17
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/Contact.js +1 -1
- package/esm/domain/Features.js +22 -17
- package/esm/domain/Meeting.js +12 -5
- package/esm/domain/Phone/CTIPhone.js +36 -31
- package/esm/domain/Phone/WebRTCPhone.js +110 -87
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/Contact.test.js +1 -1
- package/esm/domain/__tests__/Meeting.test.js +144 -0
- package/esm/index.js +365 -337
- package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
- package/esm/service/CallApi.js +22 -17
- package/esm/service/IssueReporter.js +1 -1
- package/esm/service/__tests__/IssueReporter.test.js +1 -1
- package/esm/service/getApiClient.js +22 -17
- package/esm/simple/Auth.js +355 -327
- package/esm/simple/Configuration.js +355 -327
- package/esm/simple/Directory.js +22 -17
- package/esm/simple/Phone.js +355 -327
- package/esm/simple/Websocket.js +17 -17
- package/esm/simple/index.js +359 -331
- package/esm/simple/room/LocalParticipant.js +359 -331
- package/esm/simple/room/Participant.js +359 -331
- package/esm/simple/room/RemoteParticipant.js +359 -331
- package/esm/simple/room/Room.js +360 -332
- package/esm/simple/room/SipRoom.js +359 -331
- package/esm/simple/room/Stream.js +359 -331
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/esm/simple/utils.js +359 -331
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/web-rtc-client.js +105 -100
- package/esm/websocket-client.js +15 -15
- package/lib/__tests__/api-client.test.js +22 -17
- package/lib/__tests__/web-rtc-client.test.js +105 -100
- package/lib/api/amid.js +1 -1
- package/lib/api/call-logd.js +2 -2
- package/lib/api/confd.js +10 -5
- package/lib/api/ctid-ng.js +3 -3
- package/lib/api/dird.js +1 -1
- package/lib/api/webhookd.js +1 -1
- package/lib/api-client.js +22 -17
- package/lib/checker/Checker.js +130 -125
- package/lib/checker/checks/aor.js +22 -17
- package/lib/checker/checks/api.js +22 -17
- package/lib/checker/checks/index.js +120 -115
- package/lib/checker/checks/wazo-websocket.js +15 -15
- package/lib/checker/checks/webrtc-transport.js +105 -100
- package/lib/checker/checks/webrtc.js +105 -100
- package/lib/domain/AdHocAPIConference.js +22 -17
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +22 -17
- package/lib/domain/Meeting.js +16 -5
- package/lib/domain/Phone/CTIPhone.js +36 -31
- package/lib/domain/Phone/WebRTCPhone.js +110 -87
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/Contact.test.js +1 -1
- package/lib/domain/__tests__/Meeting.test.js +150 -0
- package/lib/index.js +365 -337
- package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
- package/lib/service/CallApi.js +22 -17
- package/lib/service/IssueReporter.js +1 -1
- package/lib/service/__tests__/IssueReporter.test.js +1 -1
- package/lib/service/getApiClient.js +22 -17
- package/lib/simple/Auth.js +355 -327
- package/lib/simple/Configuration.js +355 -327
- package/lib/simple/Directory.js +22 -17
- package/lib/simple/Phone.js +355 -327
- package/lib/simple/Websocket.js +17 -17
- package/lib/simple/index.js +359 -331
- package/lib/simple/room/LocalParticipant.js +359 -331
- package/lib/simple/room/Participant.js +359 -331
- package/lib/simple/room/RemoteParticipant.js +359 -331
- package/lib/simple/room/Room.js +360 -332
- package/lib/simple/room/SipRoom.js +359 -331
- package/lib/simple/room/Stream.js +359 -331
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/lib/simple/utils.js +359 -331
- package/lib/types/WebSocketMessage.js +2 -0
- package/lib/web-rtc-client.js +105 -100
- package/lib/websocket-client.js +15 -15
- package/package.json +1 -1
- package/src/domain/Meeting.js +12 -5
- package/src/domain/Phone/WebRTCPhone.js +24 -1
- package/src/domain/__tests__/Meeting.test.js +50 -0
package/lib/simple/utils.js
CHANGED
|
@@ -1959,7 +1959,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
1959
1959
|
|
|
1960
1960
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
1961
1961
|
|
|
1962
|
-
const logger
|
|
1962
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1963
1963
|
|
|
1964
1964
|
// Use a function here to be able to mock it in tests
|
|
1965
1965
|
const realFetch = () => {
|
|
@@ -2098,7 +2098,7 @@ class ApiRequester {
|
|
|
2098
2098
|
};
|
|
2099
2099
|
|
|
2100
2100
|
if (this.refreshTokenPromise) {
|
|
2101
|
-
logger
|
|
2101
|
+
logger.info('A token is already refreshing, waiting ...', { url });
|
|
2102
2102
|
await this.refreshTokenPromise;
|
|
2103
2103
|
}
|
|
2104
2104
|
|
|
@@ -2118,7 +2118,7 @@ class ApiRequester {
|
|
|
2118
2118
|
return promise.then(async (err ) => {
|
|
2119
2119
|
// Check if the token is still valid
|
|
2120
2120
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
2121
|
-
logger
|
|
2121
|
+
logger.warn('token expired', { error: err.reason });
|
|
2122
2122
|
// Replay the call after refreshing the token
|
|
2123
2123
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
2124
2124
|
}
|
|
@@ -2128,7 +2128,7 @@ class ApiRequester {
|
|
|
2128
2128
|
: exceptionClass.fromResponse(err, response.status);
|
|
2129
2129
|
|
|
2130
2130
|
if (this.shouldLogErrors) {
|
|
2131
|
-
logger
|
|
2131
|
+
logger.error('API error', error);
|
|
2132
2132
|
}
|
|
2133
2133
|
|
|
2134
2134
|
throw error;
|
|
@@ -2138,7 +2138,7 @@ class ApiRequester {
|
|
|
2138
2138
|
return newParse(response, isJson);
|
|
2139
2139
|
}).catch(error => {
|
|
2140
2140
|
if (this.shouldLogErrors) {
|
|
2141
|
-
logger
|
|
2141
|
+
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2142
2142
|
}
|
|
2143
2143
|
|
|
2144
2144
|
throw error;
|
|
@@ -2166,13 +2166,13 @@ class ApiRequester {
|
|
|
2166
2166
|
) {
|
|
2167
2167
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
2168
2168
|
let newPath = path;
|
|
2169
|
-
logger
|
|
2169
|
+
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2170
2170
|
|
|
2171
2171
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
2172
2172
|
|
|
2173
2173
|
return this.refreshTokenPromise.then(() => {
|
|
2174
2174
|
this.refreshTokenPromise = null;
|
|
2175
|
-
logger
|
|
2175
|
+
logger.info('token refreshed', { isTokenNotFound });
|
|
2176
2176
|
if (isTokenNotFound) {
|
|
2177
2177
|
const pathParts = path.split('/');
|
|
2178
2178
|
pathParts.pop();
|
|
@@ -2642,8 +2642,9 @@ class ExternalApp {
|
|
|
2642
2642
|
|
|
2643
2643
|
|
|
2644
2644
|
|
|
2645
|
-
|
|
2645
|
+
|
|
2646
2646
|
|
|
2647
|
+
|
|
2647
2648
|
|
|
2648
2649
|
|
|
2649
2650
|
class Meeting {
|
|
@@ -2654,9 +2655,10 @@ class Meeting {
|
|
|
2654
2655
|
|
|
2655
2656
|
|
|
2656
2657
|
|
|
2657
|
-
|
|
2658
|
+
|
|
2658
2659
|
|
|
2659
2660
|
|
|
2661
|
+
|
|
2660
2662
|
|
|
2661
2663
|
static parse(plain ) {
|
|
2662
2664
|
return new Meeting({
|
|
@@ -2666,8 +2668,9 @@ class Meeting {
|
|
|
2666
2668
|
ownerUuids: plain.owner_uuids,
|
|
2667
2669
|
port: plain.port,
|
|
2668
2670
|
uuid: plain.uuid,
|
|
2669
|
-
|
|
2671
|
+
extension: plain.exten,
|
|
2670
2672
|
persistent: plain.persistent,
|
|
2673
|
+
creationTime: moment__default['default'](plain.creation_time).toDate(),
|
|
2671
2674
|
});
|
|
2672
2675
|
}
|
|
2673
2676
|
|
|
@@ -2689,8 +2692,9 @@ class Meeting {
|
|
|
2689
2692
|
ownerUuids,
|
|
2690
2693
|
port,
|
|
2691
2694
|
uri,
|
|
2692
|
-
|
|
2695
|
+
extension,
|
|
2693
2696
|
persistent,
|
|
2697
|
+
creationTime,
|
|
2694
2698
|
} = {}) {
|
|
2695
2699
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2696
2700
|
this.uri = uri;
|
|
@@ -2698,8 +2702,9 @@ class Meeting {
|
|
|
2698
2702
|
this.ownerUuids = ownerUuids;
|
|
2699
2703
|
this.port = port;
|
|
2700
2704
|
this.uuid = uuid;
|
|
2701
|
-
this.
|
|
2705
|
+
this.extension = extension;
|
|
2702
2706
|
this.persistent = persistent;
|
|
2707
|
+
this.creationTime = creationTime;
|
|
2703
2708
|
|
|
2704
2709
|
// Useful to compare instead of instanceof with minified code
|
|
2705
2710
|
this.type = 'Meeting';
|
|
@@ -4060,7 +4065,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4060
4065
|
|
|
4061
4066
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4062
4067
|
|
|
4063
|
-
const logger$
|
|
4068
|
+
const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4064
4069
|
|
|
4065
4070
|
class CTIPhone extends Emitter {
|
|
4066
4071
|
|
|
@@ -4073,7 +4078,7 @@ class CTIPhone extends Emitter {
|
|
|
4073
4078
|
|
|
4074
4079
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4075
4080
|
super();
|
|
4076
|
-
logger$
|
|
4081
|
+
logger$1.info('CTI Phone created');
|
|
4077
4082
|
this.session = session;
|
|
4078
4083
|
this.isMobile = isMobile;
|
|
4079
4084
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4134,7 +4139,7 @@ class CTIPhone extends Emitter {
|
|
|
4134
4139
|
}
|
|
4135
4140
|
|
|
4136
4141
|
async makeCall(number , line ) {
|
|
4137
|
-
logger$
|
|
4142
|
+
logger$1.info('make CTI call', { number });
|
|
4138
4143
|
|
|
4139
4144
|
if (!number) {
|
|
4140
4145
|
return null;
|
|
@@ -4157,7 +4162,7 @@ class CTIPhone extends Emitter {
|
|
|
4157
4162
|
if (!callSession) {
|
|
4158
4163
|
return Promise.resolve(null);
|
|
4159
4164
|
}
|
|
4160
|
-
logger$
|
|
4165
|
+
logger$1.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4161
4166
|
|
|
4162
4167
|
if (!this.currentCall) {
|
|
4163
4168
|
this.currentCall = callSession.call;
|
|
@@ -4170,7 +4175,7 @@ class CTIPhone extends Emitter {
|
|
|
4170
4175
|
if (!callSession) {
|
|
4171
4176
|
return;
|
|
4172
4177
|
}
|
|
4173
|
-
logger$
|
|
4178
|
+
logger$1.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4174
4179
|
|
|
4175
4180
|
this.currentCall = undefined;
|
|
4176
4181
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4180,7 +4185,7 @@ class CTIPhone extends Emitter {
|
|
|
4180
4185
|
if (!callSession) {
|
|
4181
4186
|
return Promise.resolve(false);
|
|
4182
4187
|
}
|
|
4183
|
-
logger$
|
|
4188
|
+
logger$1.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4184
4189
|
|
|
4185
4190
|
try {
|
|
4186
4191
|
await CallApi.cancelCall(callSession);
|
|
@@ -4191,7 +4196,7 @@ class CTIPhone extends Emitter {
|
|
|
4191
4196
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4192
4197
|
return true;
|
|
4193
4198
|
} catch (e) {
|
|
4194
|
-
logger$
|
|
4199
|
+
logger$1.error('hangup CTI call, error', e);
|
|
4195
4200
|
|
|
4196
4201
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4197
4202
|
return false;
|
|
@@ -4204,7 +4209,7 @@ class CTIPhone extends Emitter {
|
|
|
4204
4209
|
if (!callSession) {
|
|
4205
4210
|
return;
|
|
4206
4211
|
}
|
|
4207
|
-
logger$
|
|
4212
|
+
logger$1.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4208
4213
|
|
|
4209
4214
|
await CallApi.cancelCall(callSession);
|
|
4210
4215
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4214,7 +4219,7 @@ class CTIPhone extends Emitter {
|
|
|
4214
4219
|
if (!callSession) {
|
|
4215
4220
|
return;
|
|
4216
4221
|
}
|
|
4217
|
-
logger$
|
|
4222
|
+
logger$1.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4218
4223
|
|
|
4219
4224
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4220
4225
|
}
|
|
@@ -4227,19 +4232,19 @@ class CTIPhone extends Emitter {
|
|
|
4227
4232
|
if (!callSession) {
|
|
4228
4233
|
return;
|
|
4229
4234
|
}
|
|
4230
|
-
logger$
|
|
4235
|
+
logger$1.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4231
4236
|
|
|
4232
4237
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4233
4238
|
}
|
|
4234
4239
|
|
|
4235
4240
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4236
|
-
logger$
|
|
4241
|
+
logger$1.info('cancel CTI transfer', { transferId });
|
|
4237
4242
|
|
|
4238
4243
|
return CallApi.cancelCallTransfer(transferId);
|
|
4239
4244
|
}
|
|
4240
4245
|
|
|
4241
4246
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4242
|
-
logger$
|
|
4247
|
+
logger$1.info('confirm CTI transfer', { transferId });
|
|
4243
4248
|
|
|
4244
4249
|
return CallApi.confirmCallTransfer(transferId);
|
|
4245
4250
|
}
|
|
@@ -4248,19 +4253,19 @@ class CTIPhone extends Emitter {
|
|
|
4248
4253
|
if (!callSession) {
|
|
4249
4254
|
return;
|
|
4250
4255
|
}
|
|
4251
|
-
logger$
|
|
4256
|
+
logger$1.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4252
4257
|
|
|
4253
4258
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4254
4259
|
}
|
|
4255
4260
|
|
|
4256
4261
|
onConnectionMade() {
|
|
4257
|
-
logger$
|
|
4262
|
+
logger$1.info('on CTI connection made');
|
|
4258
4263
|
|
|
4259
4264
|
this.eventEmitter.emit('onCallAccepted');
|
|
4260
4265
|
}
|
|
4261
4266
|
|
|
4262
4267
|
async close() {
|
|
4263
|
-
logger$
|
|
4268
|
+
logger$1.info('CTI close');
|
|
4264
4269
|
|
|
4265
4270
|
return Promise.resolve();
|
|
4266
4271
|
}
|
|
@@ -4269,7 +4274,7 @@ class CTIPhone extends Emitter {
|
|
|
4269
4274
|
if (!callSession) {
|
|
4270
4275
|
return;
|
|
4271
4276
|
}
|
|
4272
|
-
logger$
|
|
4277
|
+
logger$1.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4273
4278
|
|
|
4274
4279
|
return CallApi.hold(callSession.callId);
|
|
4275
4280
|
}
|
|
@@ -4278,7 +4283,7 @@ class CTIPhone extends Emitter {
|
|
|
4278
4283
|
if (!callSession) {
|
|
4279
4284
|
return;
|
|
4280
4285
|
}
|
|
4281
|
-
logger$
|
|
4286
|
+
logger$1.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4282
4287
|
|
|
4283
4288
|
return CallApi.resume(callSession.callId);
|
|
4284
4289
|
}
|
|
@@ -4287,7 +4292,7 @@ class CTIPhone extends Emitter {
|
|
|
4287
4292
|
if (!callSession) {
|
|
4288
4293
|
return;
|
|
4289
4294
|
}
|
|
4290
|
-
logger$
|
|
4295
|
+
logger$1.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4291
4296
|
|
|
4292
4297
|
return CallApi.mute(callSession.callId);
|
|
4293
4298
|
}
|
|
@@ -4296,7 +4301,7 @@ class CTIPhone extends Emitter {
|
|
|
4296
4301
|
if (!callSession) {
|
|
4297
4302
|
return;
|
|
4298
4303
|
}
|
|
4299
|
-
logger$
|
|
4304
|
+
logger$1.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4300
4305
|
|
|
4301
4306
|
return CallApi.unmute(callSession.callId);
|
|
4302
4307
|
}
|
|
@@ -5305,7 +5310,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5305
5310
|
const WEBHOOKD_VERSION = '1.0';
|
|
5306
5311
|
const AMID_VERSION = '1.0';
|
|
5307
5312
|
|
|
5308
|
-
const logger$
|
|
5313
|
+
const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5309
5314
|
|
|
5310
5315
|
class ApiClient {
|
|
5311
5316
|
|
|
@@ -5357,12 +5362,12 @@ class ApiClient {
|
|
|
5357
5362
|
}
|
|
5358
5363
|
|
|
5359
5364
|
async forceRefreshToken() {
|
|
5360
|
-
logger$
|
|
5365
|
+
logger$2.info('forcing refresh token, calling callback');
|
|
5361
5366
|
return this.refreshTokenCallback();
|
|
5362
5367
|
}
|
|
5363
5368
|
|
|
5364
5369
|
async refreshTokenCallback() {
|
|
5365
|
-
logger$
|
|
5370
|
+
logger$2.info('refresh token callback called', {
|
|
5366
5371
|
refreshToken: this.refreshToken,
|
|
5367
5372
|
refreshBackend: this.refreshBackend,
|
|
5368
5373
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5380,7 +5385,7 @@ class ApiClient {
|
|
|
5380
5385
|
this.isMobile,
|
|
5381
5386
|
);
|
|
5382
5387
|
|
|
5383
|
-
logger$
|
|
5388
|
+
logger$2.info('token refreshed', { token: session.token });
|
|
5384
5389
|
|
|
5385
5390
|
if (this.onRefreshToken) {
|
|
5386
5391
|
this.onRefreshToken(session.token, session);
|
|
@@ -5521,7 +5526,7 @@ var getApiClient = (forServer ) => {
|
|
|
5521
5526
|
class InvalidSubscription extends Error {}
|
|
5522
5527
|
class InvalidAuthorization extends Error {}
|
|
5523
5528
|
|
|
5524
|
-
const logger$
|
|
5529
|
+
const logger$3 = IssueReporter$1.loggerFor('simple-auth');
|
|
5525
5530
|
|
|
5526
5531
|
class Auth {
|
|
5527
5532
|
|
|
@@ -5556,7 +5561,7 @@ class Auth {
|
|
|
5556
5561
|
setApiClientId(this.clientId);
|
|
5557
5562
|
setRefreshExpiration(this.expiration);
|
|
5558
5563
|
setOnRefreshToken((token , session ) => {
|
|
5559
|
-
logger$
|
|
5564
|
+
logger$3.info('on refresh token done', { token });
|
|
5560
5565
|
setApiToken(token);
|
|
5561
5566
|
Wazo.Websocket.updateToken(token);
|
|
5562
5567
|
|
|
@@ -5601,7 +5606,7 @@ class Auth {
|
|
|
5601
5606
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
5602
5607
|
return this._onAuthenticated(rawSession);
|
|
5603
5608
|
} catch (e) {
|
|
5604
|
-
logger$
|
|
5609
|
+
logger$3.error('on validate token error', e);
|
|
5605
5610
|
console.warn(e);
|
|
5606
5611
|
return false;
|
|
5607
5612
|
}
|
|
@@ -5957,7 +5962,7 @@ class AdHocAPIConference {
|
|
|
5957
5962
|
|
|
5958
5963
|
/* */
|
|
5959
5964
|
|
|
5960
|
-
const parseCandidate
|
|
5965
|
+
const parseCandidate = (candidate ) => {
|
|
5961
5966
|
if (!candidate) {
|
|
5962
5967
|
return null;
|
|
5963
5968
|
}
|
|
@@ -6111,7 +6116,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6111
6116
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
6112
6117
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6113
6118
|
if (event.candidate) {
|
|
6114
|
-
this.gatheredCandidates.push(parseCandidate
|
|
6119
|
+
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
6115
6120
|
}
|
|
6116
6121
|
};
|
|
6117
6122
|
|
|
@@ -6575,7 +6580,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6575
6580
|
const SEND_STATS_DELAY = 5000;
|
|
6576
6581
|
|
|
6577
6582
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6578
|
-
const logger$
|
|
6583
|
+
const logger$4 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6579
6584
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6580
6585
|
|
|
6581
6586
|
// events
|
|
@@ -6589,14 +6594,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6589
6594
|
const MESSAGE = 'message';
|
|
6590
6595
|
const ACCEPTED = 'accepted';
|
|
6591
6596
|
const REJECTED = 'rejected';
|
|
6592
|
-
const ON_TRACK
|
|
6593
|
-
const ON_REINVITE
|
|
6597
|
+
const ON_TRACK = 'onTrack';
|
|
6598
|
+
const ON_REINVITE = 'reinvite';
|
|
6594
6599
|
const ON_ERROR = 'onError';
|
|
6595
6600
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6596
|
-
const ON_NETWORK_STATS
|
|
6597
|
-
const ON_DISCONNECTED
|
|
6601
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6602
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
6598
6603
|
|
|
6599
|
-
const events
|
|
6604
|
+
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6600
6605
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6601
6606
|
class CanceledCallError extends Error {}
|
|
6602
6607
|
|
|
@@ -6732,12 +6737,12 @@ class WebRTCClient extends Emitter {
|
|
|
6732
6737
|
this.MESSAGE = MESSAGE;
|
|
6733
6738
|
this.ACCEPTED = ACCEPTED;
|
|
6734
6739
|
this.REJECTED = REJECTED;
|
|
6735
|
-
this.ON_TRACK = ON_TRACK
|
|
6736
|
-
this.ON_REINVITE = ON_REINVITE
|
|
6740
|
+
this.ON_TRACK = ON_TRACK;
|
|
6741
|
+
this.ON_REINVITE = ON_REINVITE;
|
|
6737
6742
|
this.ON_ERROR = ON_ERROR;
|
|
6738
6743
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6739
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS
|
|
6740
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED
|
|
6744
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6745
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6741
6746
|
}
|
|
6742
6747
|
|
|
6743
6748
|
configureMedia(media ) {
|
|
@@ -6754,13 +6759,13 @@ class WebRTCClient extends Emitter {
|
|
|
6754
6759
|
|
|
6755
6760
|
createUserAgent(configOverrides ) {
|
|
6756
6761
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6757
|
-
logger$
|
|
6762
|
+
logger$4.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6758
6763
|
|
|
6759
6764
|
webRTCConfiguration.delegate = {
|
|
6760
6765
|
onConnect: this.onConnect.bind(this),
|
|
6761
6766
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6762
6767
|
onInvite: (invitation ) => {
|
|
6763
|
-
logger$
|
|
6768
|
+
logger$4.info('sdk webrtc on invite', {
|
|
6764
6769
|
method: 'delegate.onInvite',
|
|
6765
6770
|
id: invitation.id,
|
|
6766
6771
|
remoteURI: invitation.remoteURI,
|
|
@@ -6803,7 +6808,7 @@ class WebRTCClient extends Emitter {
|
|
|
6803
6808
|
}
|
|
6804
6809
|
|
|
6805
6810
|
onConnect() {
|
|
6806
|
-
logger$
|
|
6811
|
+
logger$4.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6807
6812
|
this.eventEmitter.emit(CONNECTED);
|
|
6808
6813
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6809
6814
|
this.registerer.waitingToggle(false);
|
|
@@ -6812,7 +6817,7 @@ class WebRTCClient extends Emitter {
|
|
|
6812
6817
|
}
|
|
6813
6818
|
|
|
6814
6819
|
async onDisconnect(error ) {
|
|
6815
|
-
logger$
|
|
6820
|
+
logger$4.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6816
6821
|
this.connectionPromise = null;
|
|
6817
6822
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6818
6823
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6837,37 +6842,37 @@ class WebRTCClient extends Emitter {
|
|
|
6837
6842
|
};
|
|
6838
6843
|
|
|
6839
6844
|
if (this.skipRegister) {
|
|
6840
|
-
logger$
|
|
6845
|
+
logger$4.info('sdk webrtc skip register...', logInfo);
|
|
6841
6846
|
return Promise.resolve();
|
|
6842
6847
|
}
|
|
6843
6848
|
|
|
6844
|
-
logger$
|
|
6849
|
+
logger$4.info('sdk webrtc registering...', logInfo);
|
|
6845
6850
|
|
|
6846
6851
|
if (!this.userAgent) {
|
|
6847
|
-
logger$
|
|
6852
|
+
logger$4.info('sdk webrtc recreating User Agent');
|
|
6848
6853
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6849
6854
|
}
|
|
6850
6855
|
if (!this.userAgent || this.isRegistered()) {
|
|
6851
|
-
logger$
|
|
6856
|
+
logger$4.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6852
6857
|
return Promise.resolve();
|
|
6853
6858
|
}
|
|
6854
6859
|
|
|
6855
6860
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6856
|
-
logger$
|
|
6861
|
+
logger$4.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6857
6862
|
return Promise.resolve();
|
|
6858
6863
|
}
|
|
6859
6864
|
|
|
6860
6865
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6861
6866
|
|
|
6862
6867
|
const onRegisterFailed = () => {
|
|
6863
|
-
logger$
|
|
6868
|
+
logger$4.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6864
6869
|
this.connectionPromise = null;
|
|
6865
6870
|
if (this.registerer && this.registerer.waiting) {
|
|
6866
6871
|
this.registerer.waitingToggle(false);
|
|
6867
6872
|
}
|
|
6868
6873
|
|
|
6869
6874
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6870
|
-
logger$
|
|
6875
|
+
logger$4.info('sdk webrtc registering, retrying...', { tries });
|
|
6871
6876
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6872
6877
|
}
|
|
6873
6878
|
};
|
|
@@ -6876,18 +6881,18 @@ class WebRTCClient extends Emitter {
|
|
|
6876
6881
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6877
6882
|
// during the resolution of the primise.
|
|
6878
6883
|
if (!this.userAgent) {
|
|
6879
|
-
logger$
|
|
6884
|
+
logger$4.info('sdk webrtc recreating User Agent after connection');
|
|
6880
6885
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6881
6886
|
}
|
|
6882
6887
|
|
|
6883
|
-
logger$
|
|
6888
|
+
logger$4.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6884
6889
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
6885
6890
|
this.connectionPromise = null;
|
|
6886
6891
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6887
6892
|
|
|
6888
6893
|
// Bind registerer events
|
|
6889
6894
|
this.registerer.stateChange.addListener(newState => {
|
|
6890
|
-
logger$
|
|
6895
|
+
logger$4.info('sdk webrtc registering, state changed', { newState });
|
|
6891
6896
|
|
|
6892
6897
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
6893
6898
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -6900,7 +6905,7 @@ class WebRTCClient extends Emitter {
|
|
|
6900
6905
|
const options = {
|
|
6901
6906
|
requestDelegate: {
|
|
6902
6907
|
onReject: response => {
|
|
6903
|
-
logger$
|
|
6908
|
+
logger$4.error('sdk webrtc registering, rejected', { response });
|
|
6904
6909
|
|
|
6905
6910
|
onRegisterFailed();
|
|
6906
6911
|
},
|
|
@@ -6908,13 +6913,13 @@ class WebRTCClient extends Emitter {
|
|
|
6908
6913
|
};
|
|
6909
6914
|
|
|
6910
6915
|
return this.registerer.register(options).catch((e) => {
|
|
6911
|
-
logger$
|
|
6916
|
+
logger$4.error('sdk webrtc registering, error', e);
|
|
6912
6917
|
|
|
6913
6918
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6914
6919
|
return e;
|
|
6915
6920
|
});
|
|
6916
6921
|
}).catch(error => {
|
|
6917
|
-
logger$
|
|
6922
|
+
logger$4.error('sdk webrtc registering, transport error', error);
|
|
6918
6923
|
onRegisterFailed();
|
|
6919
6924
|
});
|
|
6920
6925
|
}
|
|
@@ -6943,21 +6948,21 @@ class WebRTCClient extends Emitter {
|
|
|
6943
6948
|
}
|
|
6944
6949
|
|
|
6945
6950
|
unregister() {
|
|
6946
|
-
logger$
|
|
6951
|
+
logger$4.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6947
6952
|
if (!this.registerer) {
|
|
6948
6953
|
return Promise.resolve();
|
|
6949
6954
|
}
|
|
6950
6955
|
|
|
6951
6956
|
try {
|
|
6952
6957
|
return this.registerer.unregister().then(() => {
|
|
6953
|
-
logger$
|
|
6958
|
+
logger$4.info('sdk webrtc unregistered');
|
|
6954
6959
|
this._cleanupRegister();
|
|
6955
6960
|
}).catch(e => {
|
|
6956
|
-
logger$
|
|
6961
|
+
logger$4.error('sdk webrtc unregistering, promise error', e);
|
|
6957
6962
|
this._cleanupRegister();
|
|
6958
6963
|
});
|
|
6959
6964
|
} catch (e) {
|
|
6960
|
-
logger$
|
|
6965
|
+
logger$4.error('sdk webrtc unregistering, error', e);
|
|
6961
6966
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6962
6967
|
// error when the registerer is in a bad state
|
|
6963
6968
|
this._cleanupRegister();
|
|
@@ -6965,7 +6970,7 @@ class WebRTCClient extends Emitter {
|
|
|
6965
6970
|
}
|
|
6966
6971
|
|
|
6967
6972
|
stop() {
|
|
6968
|
-
logger$
|
|
6973
|
+
logger$4.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6969
6974
|
if (!this.userAgent) {
|
|
6970
6975
|
return Promise.resolve();
|
|
6971
6976
|
}
|
|
@@ -6973,12 +6978,12 @@ class WebRTCClient extends Emitter {
|
|
|
6973
6978
|
return this.userAgent.stop().then(() => {
|
|
6974
6979
|
return this._cleanupRegister();
|
|
6975
6980
|
}).catch(e => {
|
|
6976
|
-
logger$
|
|
6981
|
+
logger$4.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6977
6982
|
});
|
|
6978
6983
|
}
|
|
6979
6984
|
|
|
6980
6985
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6981
|
-
logger$
|
|
6986
|
+
logger$4.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
6982
6987
|
const inviterOptions = {
|
|
6983
6988
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6984
6989
|
conference,
|
|
@@ -7009,7 +7014,7 @@ class WebRTCClient extends Emitter {
|
|
|
7009
7014
|
this._onAccepted(session, response.session, true);
|
|
7010
7015
|
},
|
|
7011
7016
|
onReject: (response ) => {
|
|
7012
|
-
logger$
|
|
7017
|
+
logger$4.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
7013
7018
|
this._stopSendingStats(session);
|
|
7014
7019
|
this.stopNetworkMonitoring(session);
|
|
7015
7020
|
|
|
@@ -7032,11 +7037,11 @@ class WebRTCClient extends Emitter {
|
|
|
7032
7037
|
}
|
|
7033
7038
|
|
|
7034
7039
|
answer(session , enableVideo ) {
|
|
7035
|
-
logger$
|
|
7040
|
+
logger$4.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
7036
7041
|
|
|
7037
7042
|
if (!session || !session.accept) {
|
|
7038
7043
|
const error = 'No session to answer, or not an invitation';
|
|
7039
|
-
logger$
|
|
7044
|
+
logger$4.warn(error);
|
|
7040
7045
|
return Promise.reject(new Error(error));
|
|
7041
7046
|
}
|
|
7042
7047
|
const options = {
|
|
@@ -7046,15 +7051,15 @@ class WebRTCClient extends Emitter {
|
|
|
7046
7051
|
return session.accept(options).then(() => {
|
|
7047
7052
|
if (session.isCanceled) {
|
|
7048
7053
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
7049
|
-
logger$
|
|
7054
|
+
logger$4.error(message, { id: session.id });
|
|
7050
7055
|
this.onCallEnded(session);
|
|
7051
7056
|
|
|
7052
7057
|
throw new CanceledCallError(message);
|
|
7053
7058
|
}
|
|
7054
|
-
logger$
|
|
7059
|
+
logger$4.info('sdk webrtc answer, accepted.');
|
|
7055
7060
|
this._onAccepted(session);
|
|
7056
7061
|
}).catch(e => {
|
|
7057
|
-
logger$
|
|
7062
|
+
logger$4.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
7058
7063
|
|
|
7059
7064
|
throw e;
|
|
7060
7065
|
});
|
|
@@ -7062,7 +7067,7 @@ class WebRTCClient extends Emitter {
|
|
|
7062
7067
|
|
|
7063
7068
|
hangup(session ) {
|
|
7064
7069
|
const { state, id } = session;
|
|
7065
|
-
logger$
|
|
7070
|
+
logger$4.info('sdk webrtc hangup call', { id, state });
|
|
7066
7071
|
|
|
7067
7072
|
try {
|
|
7068
7073
|
this._stopSendingStats(session);
|
|
@@ -7091,7 +7096,7 @@ class WebRTCClient extends Emitter {
|
|
|
7091
7096
|
|
|
7092
7097
|
return bye();
|
|
7093
7098
|
} catch (error) {
|
|
7094
|
-
logger$
|
|
7099
|
+
logger$4.warn('sdk webrtc hangup, error', error);
|
|
7095
7100
|
}
|
|
7096
7101
|
|
|
7097
7102
|
return null;
|
|
@@ -7109,7 +7114,7 @@ class WebRTCClient extends Emitter {
|
|
|
7109
7114
|
// Fetch and emit an event at `interval` with session network stats
|
|
7110
7115
|
startNetworkMonitoring(session , interval = 1000) {
|
|
7111
7116
|
const sessionId = this.getSipSessionId(session);
|
|
7112
|
-
logger$
|
|
7117
|
+
logger$4.info('starting network inspection', { id: sessionId });
|
|
7113
7118
|
|
|
7114
7119
|
this.sessionNetworkStats[sessionId] = [];
|
|
7115
7120
|
|
|
@@ -7119,7 +7124,7 @@ class WebRTCClient extends Emitter {
|
|
|
7119
7124
|
stopNetworkMonitoring(session ) {
|
|
7120
7125
|
const sessionId = this.getSipSessionId(session);
|
|
7121
7126
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
7122
|
-
logger$
|
|
7127
|
+
logger$4.info('stopping network inspection', { id: sessionId, exists });
|
|
7123
7128
|
|
|
7124
7129
|
if (exists) {
|
|
7125
7130
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -7129,17 +7134,17 @@ class WebRTCClient extends Emitter {
|
|
|
7129
7134
|
}
|
|
7130
7135
|
|
|
7131
7136
|
reject(session ) {
|
|
7132
|
-
logger$
|
|
7137
|
+
logger$4.info('sdk webrtc reject call', { id: session.id });
|
|
7133
7138
|
|
|
7134
7139
|
try {
|
|
7135
7140
|
return session.reject ? session.reject() : session.cancel();
|
|
7136
7141
|
} catch (e) {
|
|
7137
|
-
logger$
|
|
7142
|
+
logger$4.warn('Error when rejecting call', e.message, e.stack);
|
|
7138
7143
|
}
|
|
7139
7144
|
}
|
|
7140
7145
|
|
|
7141
7146
|
async close() {
|
|
7142
|
-
logger$
|
|
7147
|
+
logger$4.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
7143
7148
|
this._cleanupMedia();
|
|
7144
7149
|
this.connectionPromise = null;
|
|
7145
7150
|
|
|
@@ -7170,7 +7175,7 @@ class WebRTCClient extends Emitter {
|
|
|
7170
7175
|
// eg: "INVITE not rejectable in state Completed"
|
|
7171
7176
|
}
|
|
7172
7177
|
this.userAgent = null;
|
|
7173
|
-
logger$
|
|
7178
|
+
logger$4.info('sdk webrtc client closed');
|
|
7174
7179
|
}
|
|
7175
7180
|
|
|
7176
7181
|
getNumber(session ) {
|
|
@@ -7183,13 +7188,13 @@ class WebRTCClient extends Emitter {
|
|
|
7183
7188
|
}
|
|
7184
7189
|
|
|
7185
7190
|
mute(session ) {
|
|
7186
|
-
logger$
|
|
7191
|
+
logger$4.info('sdk webrtc mute', { id: session.id });
|
|
7187
7192
|
|
|
7188
7193
|
this._toggleAudio(session, true);
|
|
7189
7194
|
}
|
|
7190
7195
|
|
|
7191
7196
|
unmute(session ) {
|
|
7192
|
-
logger$
|
|
7197
|
+
logger$4.info('sdk webrtc unmute', { id: session.id });
|
|
7193
7198
|
|
|
7194
7199
|
this._toggleAudio(session, false);
|
|
7195
7200
|
}
|
|
@@ -7229,13 +7234,13 @@ class WebRTCClient extends Emitter {
|
|
|
7229
7234
|
}
|
|
7230
7235
|
|
|
7231
7236
|
toggleCameraOn(session ) {
|
|
7232
|
-
logger$
|
|
7237
|
+
logger$4.info('sdk webrtc toggle camera on', { id: session.id });
|
|
7233
7238
|
|
|
7234
7239
|
this._toggleVideo(session, false);
|
|
7235
7240
|
}
|
|
7236
7241
|
|
|
7237
7242
|
toggleCameraOff(session ) {
|
|
7238
|
-
logger$
|
|
7243
|
+
logger$4.info('sdk webrtc toggle camera off', { id: session.id });
|
|
7239
7244
|
|
|
7240
7245
|
this._toggleVideo(session, true);
|
|
7241
7246
|
}
|
|
@@ -7244,7 +7249,7 @@ class WebRTCClient extends Emitter {
|
|
|
7244
7249
|
const sessionId = this.getSipSessionId(session);
|
|
7245
7250
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
7246
7251
|
|
|
7247
|
-
logger$
|
|
7252
|
+
logger$4.info('sdk webrtc hold', {
|
|
7248
7253
|
sessionId,
|
|
7249
7254
|
keys: Object.keys(this.heldSessions),
|
|
7250
7255
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7293,7 +7298,7 @@ class WebRTCClient extends Emitter {
|
|
|
7293
7298
|
const sessionId = this.getSipSessionId(session);
|
|
7294
7299
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7295
7300
|
|
|
7296
|
-
logger$
|
|
7301
|
+
logger$4.info('sdk webrtc unhold', {
|
|
7297
7302
|
sessionId,
|
|
7298
7303
|
keys: Object.keys(this.heldSessions),
|
|
7299
7304
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7441,7 +7446,7 @@ class WebRTCClient extends Emitter {
|
|
|
7441
7446
|
if (!session.sessionDescriptionHandler) {
|
|
7442
7447
|
return;
|
|
7443
7448
|
}
|
|
7444
|
-
logger$
|
|
7449
|
+
logger$4.info('Sending DTMF', {
|
|
7445
7450
|
id: this.getSipSessionId(session),
|
|
7446
7451
|
tone,
|
|
7447
7452
|
});
|
|
@@ -7457,7 +7462,7 @@ class WebRTCClient extends Emitter {
|
|
|
7457
7462
|
transfer(session , target ) {
|
|
7458
7463
|
this.hold(session);
|
|
7459
7464
|
|
|
7460
|
-
logger$
|
|
7465
|
+
logger$4.info('Transfering a session', {
|
|
7461
7466
|
id: this.getSipSessionId(session),
|
|
7462
7467
|
target,
|
|
7463
7468
|
});
|
|
@@ -7479,17 +7484,17 @@ class WebRTCClient extends Emitter {
|
|
|
7479
7484
|
atxfer(session ) {
|
|
7480
7485
|
this.hold(session);
|
|
7481
7486
|
|
|
7482
|
-
logger$
|
|
7487
|
+
logger$4.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7483
7488
|
|
|
7484
7489
|
const result = {
|
|
7485
7490
|
newSession: null,
|
|
7486
7491
|
init: async (target ) => {
|
|
7487
|
-
logger$
|
|
7492
|
+
logger$4.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7488
7493
|
|
|
7489
7494
|
result.newSession = await this.call(target);
|
|
7490
7495
|
},
|
|
7491
7496
|
complete: () => {
|
|
7492
|
-
logger$
|
|
7497
|
+
logger$4.info('webrtc transfer completed', {
|
|
7493
7498
|
id: this.getSipSessionId(session),
|
|
7494
7499
|
referId: this.getSipSessionId(result.newSession),
|
|
7495
7500
|
});
|
|
@@ -7510,7 +7515,7 @@ class WebRTCClient extends Emitter {
|
|
|
7510
7515
|
return;
|
|
7511
7516
|
}
|
|
7512
7517
|
|
|
7513
|
-
logger$
|
|
7518
|
+
logger$4.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7514
7519
|
|
|
7515
7520
|
try {
|
|
7516
7521
|
sipSession.message({
|
|
@@ -7552,7 +7557,7 @@ class WebRTCClient extends Emitter {
|
|
|
7552
7557
|
}
|
|
7553
7558
|
|
|
7554
7559
|
changeAudioOutputVolume(volume ) {
|
|
7555
|
-
logger$
|
|
7560
|
+
logger$4.info('Changing audio output volume', { volume });
|
|
7556
7561
|
|
|
7557
7562
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7558
7563
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7564,7 +7569,7 @@ class WebRTCClient extends Emitter {
|
|
|
7564
7569
|
}
|
|
7565
7570
|
|
|
7566
7571
|
changeAudioOutputDevice(id ) {
|
|
7567
|
-
logger$
|
|
7572
|
+
logger$4.info('Changing audio output device', { id });
|
|
7568
7573
|
|
|
7569
7574
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7570
7575
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7581,7 +7586,7 @@ class WebRTCClient extends Emitter {
|
|
|
7581
7586
|
|
|
7582
7587
|
changeAudioInputDevice(id , session ) {
|
|
7583
7588
|
const currentId = this.getAudioDeviceId();
|
|
7584
|
-
logger$
|
|
7589
|
+
logger$4.info('setting audio input device', { id, currentId, session: !!session });
|
|
7585
7590
|
|
|
7586
7591
|
if (id === currentId) {
|
|
7587
7592
|
return null;
|
|
@@ -7627,7 +7632,7 @@ class WebRTCClient extends Emitter {
|
|
|
7627
7632
|
|
|
7628
7633
|
setVideoInputDevice(id ) {
|
|
7629
7634
|
const currentId = this.getVideoDeviceId();
|
|
7630
|
-
logger$
|
|
7635
|
+
logger$4.info('setting video input device', { id, currentId });
|
|
7631
7636
|
|
|
7632
7637
|
if (id === currentId) {
|
|
7633
7638
|
return null;
|
|
@@ -7652,7 +7657,7 @@ class WebRTCClient extends Emitter {
|
|
|
7652
7657
|
const sessionId = this.getSipSessionId(session);
|
|
7653
7658
|
const localStream = this.getLocalStream(sessionId);
|
|
7654
7659
|
|
|
7655
|
-
logger$
|
|
7660
|
+
logger$4.info('changing video input device', { id, sessionId });
|
|
7656
7661
|
|
|
7657
7662
|
// Release old video stream
|
|
7658
7663
|
if (localStream) {
|
|
@@ -7720,7 +7725,7 @@ class WebRTCClient extends Emitter {
|
|
|
7720
7725
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7721
7726
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7722
7727
|
|
|
7723
|
-
logger$
|
|
7728
|
+
logger$4.info('Sending reinvite', {
|
|
7724
7729
|
id: this.getSipSessionId(sipSession),
|
|
7725
7730
|
newConstraints,
|
|
7726
7731
|
conference,
|
|
@@ -7758,7 +7763,7 @@ class WebRTCClient extends Emitter {
|
|
|
7758
7763
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7759
7764
|
}
|
|
7760
7765
|
|
|
7761
|
-
logger$
|
|
7766
|
+
logger$4.info('on re-INVITE accepted', {
|
|
7762
7767
|
id: this.getSipSessionId(sipSession),
|
|
7763
7768
|
wasMuted,
|
|
7764
7769
|
shouldDoScreenSharing,
|
|
@@ -7776,7 +7781,7 @@ class WebRTCClient extends Emitter {
|
|
|
7776
7781
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7777
7782
|
}
|
|
7778
7783
|
|
|
7779
|
-
return this.eventEmitter.emit(ON_REINVITE
|
|
7784
|
+
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7780
7785
|
},
|
|
7781
7786
|
},
|
|
7782
7787
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7933,7 +7938,7 @@ class WebRTCClient extends Emitter {
|
|
|
7933
7938
|
}
|
|
7934
7939
|
|
|
7935
7940
|
startHeartbeat() {
|
|
7936
|
-
logger$
|
|
7941
|
+
logger$4.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7937
7942
|
if (!this.userAgent) {
|
|
7938
7943
|
this.heartbeat.stop();
|
|
7939
7944
|
return;
|
|
@@ -7946,7 +7951,7 @@ class WebRTCClient extends Emitter {
|
|
|
7946
7951
|
}
|
|
7947
7952
|
|
|
7948
7953
|
stopHeartbeat() {
|
|
7949
|
-
logger$
|
|
7954
|
+
logger$4.info('sdk webrtc stop heartbeat');
|
|
7950
7955
|
this.heartbeat.stop();
|
|
7951
7956
|
}
|
|
7952
7957
|
|
|
@@ -7967,7 +7972,7 @@ class WebRTCClient extends Emitter {
|
|
|
7967
7972
|
}
|
|
7968
7973
|
|
|
7969
7974
|
attemptReconnection() {
|
|
7970
|
-
logger$
|
|
7975
|
+
logger$4.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7971
7976
|
if (!this.userAgent) {
|
|
7972
7977
|
return;
|
|
7973
7978
|
}
|
|
@@ -7992,7 +7997,7 @@ class WebRTCClient extends Emitter {
|
|
|
7992
7997
|
return;
|
|
7993
7998
|
}
|
|
7994
7999
|
|
|
7995
|
-
logger$
|
|
8000
|
+
logger$4.info('setting local media stream', {
|
|
7996
8001
|
sipSessionId,
|
|
7997
8002
|
tracks: newStream ? newStream.getTracks() : null,
|
|
7998
8003
|
});
|
|
@@ -8009,7 +8014,7 @@ class WebRTCClient extends Emitter {
|
|
|
8009
8014
|
|
|
8010
8015
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
8011
8016
|
|
|
8012
|
-
logger$
|
|
8017
|
+
logger$4.info('updating local stream', {
|
|
8013
8018
|
sipSessionId,
|
|
8014
8019
|
oldStream: !!oldStream,
|
|
8015
8020
|
tracks: newStream.getTracks(),
|
|
@@ -8029,7 +8034,7 @@ class WebRTCClient extends Emitter {
|
|
|
8029
8034
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
8030
8035
|
const pc = this.getPeerConnection(sessionId);
|
|
8031
8036
|
|
|
8032
|
-
logger$
|
|
8037
|
+
logger$4.info('Updating remote stream', {
|
|
8033
8038
|
sessionId,
|
|
8034
8039
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
8035
8040
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -8055,7 +8060,7 @@ class WebRTCClient extends Emitter {
|
|
|
8055
8060
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
8056
8061
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
8057
8062
|
|
|
8058
|
-
logger$
|
|
8063
|
+
logger$4.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
8059
8064
|
|
|
8060
8065
|
return {
|
|
8061
8066
|
constraints: {
|
|
@@ -8104,7 +8109,7 @@ class WebRTCClient extends Emitter {
|
|
|
8104
8109
|
}
|
|
8105
8110
|
|
|
8106
8111
|
_onTransportError() {
|
|
8107
|
-
logger$
|
|
8112
|
+
logger$4.error('on transport error');
|
|
8108
8113
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
8109
8114
|
this.attemptReconnection();
|
|
8110
8115
|
}
|
|
@@ -8113,7 +8118,7 @@ class WebRTCClient extends Emitter {
|
|
|
8113
8118
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
8114
8119
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
8115
8120
|
if (this.hasHeartbeat()) {
|
|
8116
|
-
logger$
|
|
8121
|
+
logger$4.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
8117
8122
|
|
|
8118
8123
|
this.heartbeat.onHeartbeat();
|
|
8119
8124
|
if (this.heartbeatCb) {
|
|
@@ -8124,7 +8129,7 @@ class WebRTCClient extends Emitter {
|
|
|
8124
8129
|
}
|
|
8125
8130
|
|
|
8126
8131
|
async _onHeartbeatTimeout() {
|
|
8127
|
-
logger$
|
|
8132
|
+
logger$4.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
8128
8133
|
|
|
8129
8134
|
if (this.heartbeatTimeoutCb) {
|
|
8130
8135
|
this.heartbeatTimeoutCb();
|
|
@@ -8136,7 +8141,7 @@ class WebRTCClient extends Emitter {
|
|
|
8136
8141
|
try {
|
|
8137
8142
|
await this.userAgent.transport.disconnect();
|
|
8138
8143
|
} catch (e) {
|
|
8139
|
-
logger$
|
|
8144
|
+
logger$4.error('Transport disconnection after heartbeat timeout, error', e);
|
|
8140
8145
|
}
|
|
8141
8146
|
}
|
|
8142
8147
|
|
|
@@ -8169,31 +8174,31 @@ class WebRTCClient extends Emitter {
|
|
|
8169
8174
|
}
|
|
8170
8175
|
|
|
8171
8176
|
_connectIfNeeded() {
|
|
8172
|
-
logger$
|
|
8177
|
+
logger$4.info('connect if needed, checking', { connected: this.isConnected() });
|
|
8173
8178
|
if (!this.userAgent) {
|
|
8174
|
-
logger$
|
|
8179
|
+
logger$4.info('need to recreate User Agent');
|
|
8175
8180
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
8176
8181
|
}
|
|
8177
8182
|
|
|
8178
8183
|
if (this.isConnected()) {
|
|
8179
|
-
logger$
|
|
8184
|
+
logger$4.info('webrtc sdk, already connected');
|
|
8180
8185
|
return Promise.resolve();
|
|
8181
8186
|
}
|
|
8182
8187
|
|
|
8183
8188
|
if (this.isConnecting()) {
|
|
8184
|
-
logger$
|
|
8189
|
+
logger$4.info('webrtc sdk, already connecting...');
|
|
8185
8190
|
|
|
8186
8191
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
8187
8192
|
return this.connectionPromise;
|
|
8188
8193
|
}
|
|
8189
8194
|
|
|
8190
8195
|
if (this.connectionPromise) {
|
|
8191
|
-
logger$
|
|
8196
|
+
logger$4.info('webrtc sdk, connection promise connecting...');
|
|
8192
8197
|
// $FlowFixMe
|
|
8193
8198
|
return this.connectionPromise;
|
|
8194
8199
|
}
|
|
8195
8200
|
|
|
8196
|
-
logger$
|
|
8201
|
+
logger$4.info('WebRTC UA needs to connect');
|
|
8197
8202
|
|
|
8198
8203
|
// Force UA to reconnect
|
|
8199
8204
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -8318,7 +8323,7 @@ class WebRTCClient extends Emitter {
|
|
|
8318
8323
|
|
|
8319
8324
|
sdh.peerConnectionDelegate = {
|
|
8320
8325
|
onicecandidateerror: (error ) => {
|
|
8321
|
-
logger$
|
|
8326
|
+
logger$4.error('on icecandidate error', {
|
|
8322
8327
|
address: error.address,
|
|
8323
8328
|
port: error.port,
|
|
8324
8329
|
errorCode: error.errorCode,
|
|
@@ -8347,7 +8352,7 @@ class WebRTCClient extends Emitter {
|
|
|
8347
8352
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8348
8353
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8349
8354
|
}
|
|
8350
|
-
logger$
|
|
8355
|
+
logger$4.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8351
8356
|
|
|
8352
8357
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8353
8358
|
|
|
@@ -8363,12 +8368,12 @@ class WebRTCClient extends Emitter {
|
|
|
8363
8368
|
|
|
8364
8369
|
this._setupMedias(session);
|
|
8365
8370
|
|
|
8366
|
-
return this.eventEmitter.emit(ON_REINVITE
|
|
8371
|
+
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8367
8372
|
};
|
|
8368
8373
|
}
|
|
8369
8374
|
|
|
8370
8375
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8371
|
-
logger$
|
|
8376
|
+
logger$4.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8372
8377
|
|
|
8373
8378
|
this.storeSipSession(session);
|
|
8374
8379
|
|
|
@@ -8380,14 +8385,14 @@ class WebRTCClient extends Emitter {
|
|
|
8380
8385
|
const onTrack = (event ) => {
|
|
8381
8386
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8382
8387
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8383
|
-
logger$
|
|
8388
|
+
logger$4.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8384
8389
|
|
|
8385
8390
|
// Stop video track in audio only mode
|
|
8386
8391
|
if (isAudioOnly && kind === 'video') {
|
|
8387
8392
|
event.track.stop();
|
|
8388
8393
|
}
|
|
8389
8394
|
|
|
8390
|
-
this.eventEmitter.emit(ON_TRACK
|
|
8395
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8391
8396
|
};
|
|
8392
8397
|
|
|
8393
8398
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8397,9 +8402,9 @@ class WebRTCClient extends Emitter {
|
|
|
8397
8402
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8398
8403
|
|
|
8399
8404
|
pc.oniceconnectionstatechange = () => {
|
|
8400
|
-
logger$
|
|
8405
|
+
logger$4.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8401
8406
|
if (pc.iceConnectionState === 'disconnected') {
|
|
8402
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
8407
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
8403
8408
|
}
|
|
8404
8409
|
};
|
|
8405
8410
|
|
|
@@ -8570,10 +8575,10 @@ class WebRTCClient extends Emitter {
|
|
|
8570
8575
|
|
|
8571
8576
|
_stopSendingStats(session ) {
|
|
8572
8577
|
const sessionId = this.getSipSessionId(session);
|
|
8573
|
-
logger$
|
|
8578
|
+
logger$4.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8574
8579
|
|
|
8575
8580
|
if (sessionId in this.statsIntervals) {
|
|
8576
|
-
logger$
|
|
8581
|
+
logger$4.trace('Stop sending stats for call', { sessionId });
|
|
8577
8582
|
this.statsIntervals[sessionId]();
|
|
8578
8583
|
delete this.statsIntervals[sessionId];
|
|
8579
8584
|
}
|
|
@@ -8589,7 +8594,7 @@ class WebRTCClient extends Emitter {
|
|
|
8589
8594
|
try {
|
|
8590
8595
|
await this.userAgent.transport.disconnect();
|
|
8591
8596
|
} catch (e) {
|
|
8592
|
-
logger$
|
|
8597
|
+
logger$4.error('WebRTC transport disconnect, error', e);
|
|
8593
8598
|
}
|
|
8594
8599
|
}
|
|
8595
8600
|
}
|
|
@@ -8683,7 +8688,7 @@ class WebRTCClient extends Emitter {
|
|
|
8683
8688
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8684
8689
|
+ networkStats.transportSent;
|
|
8685
8690
|
|
|
8686
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
8691
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8687
8692
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8688
8693
|
}
|
|
8689
8694
|
|
|
@@ -8711,8 +8716,8 @@ const ON_CALL_FAILED = 'onCallFailed';
|
|
|
8711
8716
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8712
8717
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8713
8718
|
const ON_MESSAGE = 'onMessage';
|
|
8714
|
-
const ON_REINVITE = 'reinvite';
|
|
8715
|
-
const ON_TRACK = 'onTrack';
|
|
8719
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
8720
|
+
const ON_TRACK$1 = 'onTrack';
|
|
8716
8721
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8717
8722
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8718
8723
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8727,15 +8732,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8727
8732
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8728
8733
|
const ON_CALL_ERROR = 'onCallError';
|
|
8729
8734
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8730
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8735
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
8731
8736
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8732
8737
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8733
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
8738
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
8734
8739
|
|
|
8735
8740
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8736
8741
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8737
8742
|
|
|
8738
|
-
const events = [
|
|
8743
|
+
const events$1 = [
|
|
8739
8744
|
ON_USER_AGENT,
|
|
8740
8745
|
ON_REGISTERED,
|
|
8741
8746
|
ON_UNREGISTERED,
|
|
@@ -8753,8 +8758,8 @@ const events = [
|
|
|
8753
8758
|
ON_CALL_FAILED,
|
|
8754
8759
|
ON_CALL_ENDED,
|
|
8755
8760
|
ON_MESSAGE,
|
|
8756
|
-
ON_REINVITE,
|
|
8757
|
-
ON_TRACK,
|
|
8761
|
+
ON_REINVITE$1,
|
|
8762
|
+
ON_TRACK$1,
|
|
8758
8763
|
ON_AUDIO_STREAM,
|
|
8759
8764
|
ON_VIDEO_STREAM,
|
|
8760
8765
|
ON_REMOVE_STREAM,
|
|
@@ -8769,11 +8774,11 @@ const events = [
|
|
|
8769
8774
|
ON_CALL_ERROR,
|
|
8770
8775
|
ON_CHAT,
|
|
8771
8776
|
ON_SIGNAL,
|
|
8772
|
-
ON_NETWORK_STATS,
|
|
8773
|
-
ON_DISCONNECTED,
|
|
8777
|
+
ON_NETWORK_STATS$1,
|
|
8778
|
+
ON_DISCONNECTED$1,
|
|
8774
8779
|
];
|
|
8775
8780
|
|
|
8776
|
-
const logger$
|
|
8781
|
+
const logger$5 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8777
8782
|
|
|
8778
8783
|
class WebRTCPhone extends Emitter {
|
|
8779
8784
|
|
|
@@ -8846,7 +8851,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8846
8851
|
}).catch(error => {
|
|
8847
8852
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8848
8853
|
console.error('register error', error, error.message, error.stack);
|
|
8849
|
-
logger$
|
|
8854
|
+
logger$5.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8850
8855
|
});
|
|
8851
8856
|
}
|
|
8852
8857
|
|
|
@@ -8861,7 +8866,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8861
8866
|
if (!this.client) {
|
|
8862
8867
|
return;
|
|
8863
8868
|
}
|
|
8864
|
-
logger$
|
|
8869
|
+
logger$5.info('WebRTC phone stop');
|
|
8865
8870
|
this.client.stop();
|
|
8866
8871
|
}
|
|
8867
8872
|
|
|
@@ -8876,7 +8881,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8876
8881
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8877
8882
|
audioOnly = false, iceRestart = false) {
|
|
8878
8883
|
const sipSession = this.findSipSession(callSession);
|
|
8879
|
-
logger$
|
|
8884
|
+
logger$5.info('WebRTC phone - send reinvite', {
|
|
8880
8885
|
sessionId: sipSession ? sipSession.id : null,
|
|
8881
8886
|
constraints,
|
|
8882
8887
|
audioOnly,
|
|
@@ -8913,7 +8918,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8913
8918
|
}
|
|
8914
8919
|
|
|
8915
8920
|
startHeartbeat() {
|
|
8916
|
-
logger$
|
|
8921
|
+
logger$5.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8917
8922
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8918
8923
|
return;
|
|
8919
8924
|
}
|
|
@@ -8922,7 +8927,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8922
8927
|
}
|
|
8923
8928
|
|
|
8924
8929
|
stopHeartbeat() {
|
|
8925
|
-
logger$
|
|
8930
|
+
logger$5.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8926
8931
|
if (!this.client) {
|
|
8927
8932
|
return;
|
|
8928
8933
|
}
|
|
@@ -8939,7 +8944,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8939
8944
|
}
|
|
8940
8945
|
|
|
8941
8946
|
reconnect() {
|
|
8942
|
-
logger$
|
|
8947
|
+
logger$5.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8943
8948
|
if (!this.client) {
|
|
8944
8949
|
return;
|
|
8945
8950
|
}
|
|
@@ -8980,10 +8985,15 @@ class WebRTCPhone extends Emitter {
|
|
|
8980
8985
|
return false;
|
|
8981
8986
|
}
|
|
8982
8987
|
|
|
8983
|
-
logger$
|
|
8988
|
+
logger$5.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8984
8989
|
|
|
8985
8990
|
this.client.downgradeToAudio(sipSession);
|
|
8986
8991
|
|
|
8992
|
+
if (callSession) {
|
|
8993
|
+
callSession.cameraEnabled = false;
|
|
8994
|
+
this._updateCallSession(callSession);
|
|
8995
|
+
}
|
|
8996
|
+
|
|
8987
8997
|
if (withMessage) {
|
|
8988
8998
|
this._sendReinviteMessage(callSession, false);
|
|
8989
8999
|
}
|
|
@@ -8998,7 +9008,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8998
9008
|
return Promise.resolve(false);
|
|
8999
9009
|
}
|
|
9000
9010
|
|
|
9001
|
-
logger$
|
|
9011
|
+
logger$5.info('Upgrade to video', {
|
|
9002
9012
|
id: callSession ? callSession.getId() : null,
|
|
9003
9013
|
constraints,
|
|
9004
9014
|
isConference,
|
|
@@ -9011,6 +9021,11 @@ class WebRTCPhone extends Emitter {
|
|
|
9011
9021
|
|
|
9012
9022
|
const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
|
|
9013
9023
|
|
|
9024
|
+
if (callSession) {
|
|
9025
|
+
callSession.cameraEnabled = true;
|
|
9026
|
+
this._updateCallSession(callSession);
|
|
9027
|
+
}
|
|
9028
|
+
|
|
9014
9029
|
// If no stream is returned, it means we have to reinvite
|
|
9015
9030
|
if (!newStream) {
|
|
9016
9031
|
return true;
|
|
@@ -9033,7 +9048,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9033
9048
|
|
|
9034
9049
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
9035
9050
|
const sipSession = this.findSipSession(callSession);
|
|
9036
|
-
logger$
|
|
9051
|
+
logger$5.info('Sending reinvite message', {
|
|
9037
9052
|
id: callSession ? callSession.getId() : null,
|
|
9038
9053
|
isUpgrade,
|
|
9039
9054
|
});
|
|
@@ -9059,7 +9074,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9059
9074
|
// Monkey patch to know when canceled with the CANCEL message
|
|
9060
9075
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
9061
9076
|
sipSession._onCancel = (message ) => {
|
|
9062
|
-
logger$
|
|
9077
|
+
logger$5.trace('on sip session canceled', { callId: message.callId });
|
|
9063
9078
|
|
|
9064
9079
|
onCancel(message);
|
|
9065
9080
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -9087,13 +9102,13 @@ class WebRTCPhone extends Emitter {
|
|
|
9087
9102
|
this.audioOutputVolume,
|
|
9088
9103
|
);
|
|
9089
9104
|
case sessionState.SessionState.Terminating:
|
|
9090
|
-
logger$
|
|
9105
|
+
logger$5.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
9091
9106
|
|
|
9092
9107
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
9093
9108
|
|
|
9094
9109
|
break;
|
|
9095
9110
|
case sessionState.SessionState.Terminated: {
|
|
9096
|
-
logger$
|
|
9111
|
+
logger$5.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
9097
9112
|
|
|
9098
9113
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
9099
9114
|
const callSession = this._createCallSession(sipSession);
|
|
@@ -9115,7 +9130,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9115
9130
|
const [stream] = event.streams;
|
|
9116
9131
|
const kind = event && event.track && event.track.kind;
|
|
9117
9132
|
|
|
9118
|
-
logger$
|
|
9133
|
+
logger$5.info('on track stream called on the peer connection', {
|
|
9119
9134
|
callId: this.getSipSessionId(sipSession),
|
|
9120
9135
|
streamId: stream ? stream.id : null,
|
|
9121
9136
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -9135,7 +9150,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9135
9150
|
};
|
|
9136
9151
|
|
|
9137
9152
|
peerConnection.onremovestream = event => {
|
|
9138
|
-
logger$
|
|
9153
|
+
logger$5.info('on remove stream called on the peer connection', {
|
|
9139
9154
|
id: event.stream.id,
|
|
9140
9155
|
tracks: event.stream.getTracks(),
|
|
9141
9156
|
});
|
|
@@ -9145,7 +9160,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9145
9160
|
}
|
|
9146
9161
|
|
|
9147
9162
|
async startScreenSharing(constraints , callSession ) {
|
|
9148
|
-
logger$
|
|
9163
|
+
logger$5.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
9149
9164
|
|
|
9150
9165
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
9151
9166
|
if (!screenShareStream) {
|
|
@@ -9185,7 +9200,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9185
9200
|
return;
|
|
9186
9201
|
}
|
|
9187
9202
|
|
|
9188
|
-
logger$
|
|
9203
|
+
logger$5.info('WebRTC phone - stop screen sharing', {
|
|
9189
9204
|
restoreLocalStream,
|
|
9190
9205
|
});
|
|
9191
9206
|
|
|
@@ -9241,7 +9256,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9241
9256
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
9242
9257
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
9243
9258
|
|
|
9244
|
-
logger$
|
|
9259
|
+
logger$5.info('WebRTC phone - on screensharing', {
|
|
9245
9260
|
hadVideo,
|
|
9246
9261
|
id: this.getSipSessionId(sipSession),
|
|
9247
9262
|
screenTrack,
|
|
@@ -9249,7 +9264,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9249
9264
|
|
|
9250
9265
|
if (screenTrack) {
|
|
9251
9266
|
screenTrack.onended = () => {
|
|
9252
|
-
logger$
|
|
9267
|
+
logger$5.info('WebRTC phone - on screenshare ended', {
|
|
9253
9268
|
hadVideo,
|
|
9254
9269
|
id: this.getSipSessionId(sipSession),
|
|
9255
9270
|
screenTrack,
|
|
@@ -9280,7 +9295,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9280
9295
|
}
|
|
9281
9296
|
|
|
9282
9297
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9283
|
-
logger$
|
|
9298
|
+
logger$5.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9284
9299
|
|
|
9285
9300
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9286
9301
|
this.currentSipSession = sipSession;
|
|
@@ -9298,7 +9313,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9298
9313
|
}
|
|
9299
9314
|
|
|
9300
9315
|
changeAudioDevice(id ) {
|
|
9301
|
-
logger$
|
|
9316
|
+
logger$5.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9302
9317
|
this.audioOutputDeviceId = id;
|
|
9303
9318
|
this.client.changeAudioOutputDevice(id);
|
|
9304
9319
|
}
|
|
@@ -9308,14 +9323,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9308
9323
|
}
|
|
9309
9324
|
|
|
9310
9325
|
changeRingDevice(id ) {
|
|
9311
|
-
logger$
|
|
9326
|
+
logger$5.info('WebRTC phone - changing ring device', { id });
|
|
9312
9327
|
|
|
9313
9328
|
this.audioRingDeviceId = id;
|
|
9314
9329
|
}
|
|
9315
9330
|
|
|
9316
9331
|
// volume is a value between 0 and 1
|
|
9317
9332
|
changeAudioVolume(volume ) {
|
|
9318
|
-
logger$
|
|
9333
|
+
logger$5.info('WebRTC phone - changing audio volume', { volume });
|
|
9319
9334
|
|
|
9320
9335
|
this.audioOutputVolume = volume;
|
|
9321
9336
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9323,31 +9338,31 @@ class WebRTCPhone extends Emitter {
|
|
|
9323
9338
|
|
|
9324
9339
|
// volume is a value between 0 and 1
|
|
9325
9340
|
changeRingVolume(volume ) {
|
|
9326
|
-
logger$
|
|
9341
|
+
logger$5.info('WebRTC phone - changing ring volume', { volume });
|
|
9327
9342
|
|
|
9328
9343
|
this.audioRingVolume = volume;
|
|
9329
9344
|
}
|
|
9330
9345
|
|
|
9331
9346
|
changeAudioInputDevice(id ) {
|
|
9332
|
-
logger$
|
|
9347
|
+
logger$5.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9333
9348
|
|
|
9334
9349
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9335
9350
|
}
|
|
9336
9351
|
|
|
9337
9352
|
changeVideoInputDevice(id ) {
|
|
9338
|
-
logger$
|
|
9353
|
+
logger$5.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9339
9354
|
|
|
9340
9355
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9341
9356
|
}
|
|
9342
9357
|
|
|
9343
9358
|
changeSessionVideoInputDevice(id ) {
|
|
9344
|
-
logger$
|
|
9359
|
+
logger$5.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9345
9360
|
|
|
9346
9361
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9347
9362
|
}
|
|
9348
9363
|
|
|
9349
9364
|
_onCallTerminated(sipSession ) {
|
|
9350
|
-
logger$
|
|
9365
|
+
logger$5.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9351
9366
|
|
|
9352
9367
|
const callSession = this._createCallSession(sipSession);
|
|
9353
9368
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
@@ -9381,7 +9396,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9381
9396
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9382
9397
|
|
|
9383
9398
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9384
|
-
logger$
|
|
9399
|
+
logger$5.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9385
9400
|
sipId: sipSession.id,
|
|
9386
9401
|
shouldRetrigger,
|
|
9387
9402
|
hasIncomingCallSession,
|
|
@@ -9472,37 +9487,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9472
9487
|
|
|
9473
9488
|
// Deprecated
|
|
9474
9489
|
getLocalStreamForCall(callSession ) {
|
|
9475
|
-
logger$
|
|
9490
|
+
logger$5.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9476
9491
|
|
|
9477
9492
|
return this.getLocalStream(callSession);
|
|
9478
9493
|
}
|
|
9479
9494
|
|
|
9480
9495
|
// Deprecated
|
|
9481
9496
|
getRemoteStreamForCall(callSession ) {
|
|
9482
|
-
logger$
|
|
9497
|
+
logger$5.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9483
9498
|
|
|
9484
9499
|
return this.getRemoteVideoStream(callSession);
|
|
9485
9500
|
}
|
|
9486
9501
|
|
|
9487
9502
|
getRemoteStreamsForCall(callSession ) {
|
|
9488
|
-
logger$
|
|
9503
|
+
logger$5.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9489
9504
|
|
|
9490
9505
|
return this.getRemoteStream(callSession);
|
|
9491
9506
|
}
|
|
9492
9507
|
|
|
9493
9508
|
accept(callSession , cameraEnabled ) {
|
|
9494
|
-
logger$
|
|
9509
|
+
logger$5.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9495
9510
|
if (this.currentSipSession) {
|
|
9496
9511
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9497
9512
|
}
|
|
9498
9513
|
|
|
9499
9514
|
if (!callSession) {
|
|
9500
|
-
logger$
|
|
9515
|
+
logger$5.warn('no CallSession to accept.');
|
|
9501
9516
|
return Promise.resolve(null);
|
|
9502
9517
|
}
|
|
9503
9518
|
|
|
9504
9519
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9505
|
-
logger$
|
|
9520
|
+
logger$5.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9506
9521
|
return Promise.resolve(callSession.sipCallId);
|
|
9507
9522
|
}
|
|
9508
9523
|
|
|
@@ -9514,24 +9529,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9514
9529
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9515
9530
|
if (sipSession) {
|
|
9516
9531
|
if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
|
|
9517
|
-
logger$
|
|
9532
|
+
logger$5.warn('Trying to answer a terminated sipSession.');
|
|
9518
9533
|
|
|
9519
9534
|
return Promise.resolve(null);
|
|
9520
9535
|
}
|
|
9521
9536
|
|
|
9522
|
-
logger$
|
|
9537
|
+
logger$5.info('accept call, session found', { sipId: sipSession.id });
|
|
9523
9538
|
|
|
9524
9539
|
// $FlowFixMe
|
|
9525
9540
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9526
9541
|
return callSession.sipCallId;
|
|
9527
9542
|
}).catch(e => {
|
|
9528
|
-
logger$
|
|
9543
|
+
logger$5.error(e);
|
|
9529
9544
|
this.endCurrentCall(callSession);
|
|
9530
9545
|
throw e;
|
|
9531
9546
|
});
|
|
9532
9547
|
}
|
|
9533
9548
|
|
|
9534
|
-
logger$
|
|
9549
|
+
logger$5.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9535
9550
|
|
|
9536
9551
|
return Promise.resolve(null);
|
|
9537
9552
|
}
|
|
@@ -9541,7 +9556,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9541
9556
|
}
|
|
9542
9557
|
|
|
9543
9558
|
async reject(callSession ) {
|
|
9544
|
-
logger$
|
|
9559
|
+
logger$5.info('reject WebRTC called', { id: callSession.getId() });
|
|
9545
9560
|
|
|
9546
9561
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9547
9562
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9553,14 +9568,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9553
9568
|
|
|
9554
9569
|
const sipSession = this.findSipSession(callSession);
|
|
9555
9570
|
if (sipSession) {
|
|
9556
|
-
logger$
|
|
9571
|
+
logger$5.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9557
9572
|
|
|
9558
9573
|
this.client.hangup(sipSession);
|
|
9559
9574
|
}
|
|
9560
9575
|
}
|
|
9561
9576
|
|
|
9562
9577
|
async ignore(callSession ) {
|
|
9563
|
-
logger$
|
|
9578
|
+
logger$5.info('WebRTC ignore', { id: callSession.getId() });
|
|
9564
9579
|
|
|
9565
9580
|
// kill the ring
|
|
9566
9581
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9572,14 +9587,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9572
9587
|
const sipSession = this.findSipSession(callSession);
|
|
9573
9588
|
|
|
9574
9589
|
if (sipSession) {
|
|
9575
|
-
logger$
|
|
9590
|
+
logger$5.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9576
9591
|
|
|
9577
9592
|
return this.client.atxfer(sipSession);
|
|
9578
9593
|
}
|
|
9579
9594
|
}
|
|
9580
9595
|
|
|
9581
9596
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9582
|
-
logger$
|
|
9597
|
+
logger$5.info('WebRTC hold', { id: callSession.getId() });
|
|
9583
9598
|
|
|
9584
9599
|
const sipSession = this.findSipSession(callSession);
|
|
9585
9600
|
|
|
@@ -9594,18 +9609,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9594
9609
|
}
|
|
9595
9610
|
|
|
9596
9611
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9597
|
-
logger$
|
|
9612
|
+
logger$5.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9598
9613
|
|
|
9599
9614
|
const sipSession = this.findSipSession(callSession);
|
|
9600
9615
|
if (!sipSession) {
|
|
9601
9616
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9602
9617
|
}
|
|
9603
9618
|
|
|
9604
|
-
logger$
|
|
9619
|
+
logger$5.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9605
9620
|
|
|
9606
9621
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9607
9622
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9608
|
-
logger$
|
|
9623
|
+
logger$5.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9609
9624
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9610
9625
|
}
|
|
9611
9626
|
|
|
@@ -9630,7 +9645,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9630
9645
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9631
9646
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9632
9647
|
|
|
9633
|
-
logger$
|
|
9648
|
+
logger$5.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9634
9649
|
|
|
9635
9650
|
// Stop screenshre if needed
|
|
9636
9651
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9661,7 +9676,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9661
9676
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9662
9677
|
}
|
|
9663
9678
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9664
|
-
logger$
|
|
9679
|
+
logger$5.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9665
9680
|
|
|
9666
9681
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9667
9682
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9705,14 +9720,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9705
9720
|
}
|
|
9706
9721
|
|
|
9707
9722
|
mute(callSession , withEvent = true) {
|
|
9708
|
-
logger$
|
|
9723
|
+
logger$5.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9709
9724
|
|
|
9710
9725
|
const sipSession = this.findSipSession(callSession);
|
|
9711
9726
|
if (!sipSession) {
|
|
9712
9727
|
return;
|
|
9713
9728
|
}
|
|
9714
9729
|
|
|
9715
|
-
logger$
|
|
9730
|
+
logger$5.info('WebRTC muting', { sipId: sipSession.id });
|
|
9716
9731
|
this.client.mute(sipSession);
|
|
9717
9732
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9718
9733
|
|
|
@@ -9726,14 +9741,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9726
9741
|
}
|
|
9727
9742
|
|
|
9728
9743
|
unmute(callSession , withEvent = true) {
|
|
9729
|
-
logger$
|
|
9744
|
+
logger$5.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9730
9745
|
|
|
9731
9746
|
const sipSession = this.findSipSession(callSession);
|
|
9732
9747
|
if (!sipSession) {
|
|
9733
9748
|
return;
|
|
9734
9749
|
}
|
|
9735
9750
|
|
|
9736
|
-
logger$
|
|
9751
|
+
logger$5.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9737
9752
|
this.client.unmute(sipSession);
|
|
9738
9753
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9739
9754
|
|
|
@@ -9760,7 +9775,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9760
9775
|
if (!sipSession) {
|
|
9761
9776
|
return;
|
|
9762
9777
|
}
|
|
9763
|
-
logger$
|
|
9778
|
+
logger$5.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9764
9779
|
|
|
9765
9780
|
this.client.toggleCameraOn(sipSession);
|
|
9766
9781
|
|
|
@@ -9772,7 +9787,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9772
9787
|
if (!sipSession) {
|
|
9773
9788
|
return;
|
|
9774
9789
|
}
|
|
9775
|
-
logger$
|
|
9790
|
+
logger$5.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9776
9791
|
|
|
9777
9792
|
this.client.toggleCameraOff(sipSession);
|
|
9778
9793
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9784,7 +9799,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9784
9799
|
return;
|
|
9785
9800
|
}
|
|
9786
9801
|
|
|
9787
|
-
logger$
|
|
9802
|
+
logger$5.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9788
9803
|
this.client.sendDTMF(sipSession, tone);
|
|
9789
9804
|
}
|
|
9790
9805
|
|
|
@@ -9792,7 +9807,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9792
9807
|
// @TODO: line is not used here
|
|
9793
9808
|
async makeCall(number , line , cameraEnabled ,
|
|
9794
9809
|
audioOnly = false, conference = false) {
|
|
9795
|
-
logger$
|
|
9810
|
+
logger$5.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
|
|
9796
9811
|
if (!number) {
|
|
9797
9812
|
return Promise.resolve(null);
|
|
9798
9813
|
}
|
|
@@ -9802,7 +9817,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9802
9817
|
}
|
|
9803
9818
|
if (this.currentSipSession) {
|
|
9804
9819
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9805
|
-
logger$
|
|
9820
|
+
logger$5.warn('Unable to hold current session when making another call', e);
|
|
9806
9821
|
});
|
|
9807
9822
|
}
|
|
9808
9823
|
|
|
@@ -9812,7 +9827,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9812
9827
|
this._bindEvents(sipSession);
|
|
9813
9828
|
} catch (error) {
|
|
9814
9829
|
console.warn(error);
|
|
9815
|
-
logger$
|
|
9830
|
+
logger$5.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9816
9831
|
return Promise.resolve(null);
|
|
9817
9832
|
}
|
|
9818
9833
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
@@ -9840,7 +9855,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9840
9855
|
return;
|
|
9841
9856
|
}
|
|
9842
9857
|
|
|
9843
|
-
logger$
|
|
9858
|
+
logger$5.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9844
9859
|
|
|
9845
9860
|
this.client.transfer(sipSession, target);
|
|
9846
9861
|
}
|
|
@@ -9849,7 +9864,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9849
9864
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9850
9865
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9851
9866
|
|
|
9852
|
-
logger$
|
|
9867
|
+
logger$5.info('WebRTC indirect transfer', {
|
|
9853
9868
|
sipId: sipSession ? sipSession.id : null,
|
|
9854
9869
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9855
9870
|
});
|
|
@@ -9888,7 +9903,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9888
9903
|
return false;
|
|
9889
9904
|
}
|
|
9890
9905
|
|
|
9891
|
-
logger$
|
|
9906
|
+
logger$5.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9892
9907
|
|
|
9893
9908
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9894
9909
|
|
|
@@ -9934,7 +9949,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9934
9949
|
endCurrentCall(callSession ) {
|
|
9935
9950
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9936
9951
|
|
|
9937
|
-
logger$
|
|
9952
|
+
logger$5.info('Ending current call', {
|
|
9938
9953
|
id: callSession ? callSession.getId() : null,
|
|
9939
9954
|
isCurrent,
|
|
9940
9955
|
});
|
|
@@ -9958,7 +9973,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9958
9973
|
}
|
|
9959
9974
|
|
|
9960
9975
|
async close() {
|
|
9961
|
-
logger$
|
|
9976
|
+
logger$5.info('WebRTC close');
|
|
9962
9977
|
|
|
9963
9978
|
try {
|
|
9964
9979
|
await Promise.race([
|
|
@@ -9966,7 +9981,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9966
9981
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9967
9982
|
]);
|
|
9968
9983
|
} catch (e) {
|
|
9969
|
-
logger$
|
|
9984
|
+
logger$5.error('WebRTC close, unregister error', e);
|
|
9970
9985
|
}
|
|
9971
9986
|
|
|
9972
9987
|
this.client.close();
|
|
@@ -9984,12 +9999,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9984
9999
|
}
|
|
9985
10000
|
|
|
9986
10001
|
enableRinging() {
|
|
9987
|
-
logger$
|
|
10002
|
+
logger$5.info('WebRTC enable ringing');
|
|
9988
10003
|
this.ringingEnabled = true;
|
|
9989
10004
|
}
|
|
9990
10005
|
|
|
9991
10006
|
disableRinging() {
|
|
9992
|
-
logger$
|
|
10007
|
+
logger$5.info('WebRTC disable ringing');
|
|
9993
10008
|
this.ringingEnabled = false;
|
|
9994
10009
|
}
|
|
9995
10010
|
|
|
@@ -10029,7 +10044,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10029
10044
|
|
|
10030
10045
|
// Deprecated
|
|
10031
10046
|
getLocalMediaStream(callSession ) {
|
|
10032
|
-
logger$
|
|
10047
|
+
logger$5.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
10033
10048
|
return this.getLocalStream(callSession);
|
|
10034
10049
|
}
|
|
10035
10050
|
|
|
@@ -10071,7 +10086,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10071
10086
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
10072
10087
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
10073
10088
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
10074
|
-
logger$
|
|
10089
|
+
logger$5.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
10075
10090
|
|
|
10076
10091
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
10077
10092
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -10094,7 +10109,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10094
10109
|
});
|
|
10095
10110
|
|
|
10096
10111
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
10097
|
-
logger$
|
|
10112
|
+
logger$5.info('WebRTC on reinvite', {
|
|
10098
10113
|
sessionId: args[0].id,
|
|
10099
10114
|
inviteId: args[1].id,
|
|
10100
10115
|
updatedCalleeName: args[2],
|
|
@@ -10114,7 +10129,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10114
10129
|
});
|
|
10115
10130
|
|
|
10116
10131
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
10117
|
-
logger$
|
|
10132
|
+
logger$5.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
10118
10133
|
|
|
10119
10134
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
10120
10135
|
|
|
@@ -10125,22 +10140,22 @@ class WebRTCPhone extends Emitter {
|
|
|
10125
10140
|
this.client.on('ended', () => {});
|
|
10126
10141
|
|
|
10127
10142
|
this.client.on(this.client.ON_ERROR, e => {
|
|
10128
|
-
logger$
|
|
10143
|
+
logger$5.error('WebRTC error', e);
|
|
10129
10144
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
10130
10145
|
});
|
|
10131
10146
|
|
|
10132
10147
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
10133
|
-
logger$
|
|
10148
|
+
logger$5.info('WebRTC unregistered');
|
|
10134
10149
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10135
10150
|
});
|
|
10136
10151
|
|
|
10137
10152
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
10138
|
-
logger$
|
|
10139
|
-
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10153
|
+
logger$5.info('WebRTC disconnected');
|
|
10154
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
10140
10155
|
});
|
|
10141
10156
|
|
|
10142
10157
|
this.client.on(this.client.REGISTERED, () => {
|
|
10143
|
-
logger$
|
|
10158
|
+
logger$5.info('WebRTC registered', {
|
|
10144
10159
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
10145
10160
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
10146
10161
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -10153,23 +10168,27 @@ class WebRTCPhone extends Emitter {
|
|
|
10153
10168
|
if (this.shouldSendReinvite && this.currentSipSession
|
|
10154
10169
|
&& this.currentSipSession.state === sessionState.SessionState.Established) {
|
|
10155
10170
|
this.shouldSendReinvite = false;
|
|
10171
|
+
const pc = this.currentSipSession.sessionDescriptionHandler.peerConnection;
|
|
10172
|
+
const isConference = pc ? pc.sfu : false;
|
|
10173
|
+
const hasVideo = this.currentCallSession && this.currentCallSession.cameraEnabled;
|
|
10174
|
+
|
|
10156
10175
|
try {
|
|
10157
10176
|
// Send reinvite with iceRestart
|
|
10158
|
-
this.sendReinvite(this.currentCallSession, null,
|
|
10177
|
+
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
10159
10178
|
} catch (e) {
|
|
10160
|
-
logger$
|
|
10179
|
+
logger$5.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
10161
10180
|
}
|
|
10162
10181
|
}
|
|
10163
10182
|
});
|
|
10164
10183
|
|
|
10165
10184
|
this.client.on(this.client.CONNECTED, () => {
|
|
10166
|
-
logger$
|
|
10185
|
+
logger$5.info('WebRTC client connected');
|
|
10167
10186
|
|
|
10168
10187
|
this.stopHeartbeat();
|
|
10169
10188
|
});
|
|
10170
10189
|
|
|
10171
10190
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
10172
|
-
logger$
|
|
10191
|
+
logger$5.info('WebRTC client disconnected');
|
|
10173
10192
|
|
|
10174
10193
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
10175
10194
|
|
|
@@ -10183,7 +10202,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10183
10202
|
});
|
|
10184
10203
|
|
|
10185
10204
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
10186
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
10205
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
10187
10206
|
});
|
|
10188
10207
|
|
|
10189
10208
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -10198,7 +10217,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10198
10217
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
10199
10218
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
10200
10219
|
|
|
10201
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
10220
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, callSession, stats, previousStats);
|
|
10202
10221
|
});
|
|
10203
10222
|
|
|
10204
10223
|
// Used when upgrading directly in screenshare mode
|
|
@@ -10207,7 +10226,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10207
10226
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
10208
10227
|
const callSession = this.callSessions[sipSessionId];
|
|
10209
10228
|
|
|
10210
|
-
logger$
|
|
10229
|
+
logger$5.info('Updrading directly in screensharing mode', {
|
|
10211
10230
|
sipSessionId,
|
|
10212
10231
|
tracks: localStream ? localStream.getTracks() : null,
|
|
10213
10232
|
});
|
|
@@ -10239,6 +10258,15 @@ class WebRTCPhone extends Emitter {
|
|
|
10239
10258
|
return this.client.getSipSessionId(sipSession);
|
|
10240
10259
|
}
|
|
10241
10260
|
|
|
10261
|
+
_updateCallSession(callSession ) {
|
|
10262
|
+
const sipSession = this.findSipSession(callSession);
|
|
10263
|
+
const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
|
|
10264
|
+
|
|
10265
|
+
if (sipSessionId) {
|
|
10266
|
+
this.callSessions[sipSessionId] = callSession;
|
|
10267
|
+
}
|
|
10268
|
+
}
|
|
10269
|
+
|
|
10242
10270
|
_onMessage(message ) {
|
|
10243
10271
|
if (!message || message.method !== 'MESSAGE') {
|
|
10244
10272
|
return;
|
|
@@ -10376,8 +10404,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10376
10404
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10377
10405
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10378
10406
|
ON_MESSAGE: ON_MESSAGE,
|
|
10379
|
-
ON_REINVITE: ON_REINVITE,
|
|
10380
|
-
ON_TRACK: ON_TRACK,
|
|
10407
|
+
ON_REINVITE: ON_REINVITE$1,
|
|
10408
|
+
ON_TRACK: ON_TRACK$1,
|
|
10381
10409
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10382
10410
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10383
10411
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10392,13 +10420,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10392
10420
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10393
10421
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10394
10422
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10395
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10423
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS$1,
|
|
10396
10424
|
ON_CHAT: ON_CHAT,
|
|
10397
10425
|
ON_SIGNAL: ON_SIGNAL,
|
|
10398
|
-
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10426
|
+
ON_DISCONNECTED: ON_DISCONNECTED$1,
|
|
10399
10427
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10400
10428
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10401
|
-
events: events,
|
|
10429
|
+
events: events$1,
|
|
10402
10430
|
'default': WebRTCPhone
|
|
10403
10431
|
});
|
|
10404
10432
|
|
|
@@ -10792,7 +10820,7 @@ class Phone extends Emitter {
|
|
|
10792
10820
|
|
|
10793
10821
|
_transferEvents() {
|
|
10794
10822
|
this.unbind();
|
|
10795
|
-
[...events
|
|
10823
|
+
[...events, ...transportEvents].forEach(event => {
|
|
10796
10824
|
this.client.on(event, (...args) =>
|
|
10797
10825
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
10798
10826
|
});
|
|
@@ -10814,7 +10842,7 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
10814
10842
|
|
|
10815
10843
|
//
|
|
10816
10844
|
|
|
10817
|
-
const SOCKET_EVENTS
|
|
10845
|
+
const SOCKET_EVENTS = {
|
|
10818
10846
|
ON_OPEN: 'onopen',
|
|
10819
10847
|
ON_MESSAGE: 'onmessage',
|
|
10820
10848
|
ON_ERROR: 'onerror',
|
|
@@ -10910,7 +10938,7 @@ const BLACKLIST_EVENTS = [
|
|
|
10910
10938
|
];
|
|
10911
10939
|
|
|
10912
10940
|
const HEARTBEAT_ENGINE_VERSION = '20.09';
|
|
10913
|
-
const logger$
|
|
10941
|
+
const logger$7 = IssueReporter$1.loggerFor('wazo-ws');
|
|
10914
10942
|
const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
|
|
10915
10943
|
|
|
10916
10944
|
class WebSocketClient extends Emitter {
|
|
@@ -10959,24 +10987,24 @@ class WebSocketClient extends Emitter {
|
|
|
10959
10987
|
}
|
|
10960
10988
|
|
|
10961
10989
|
connect() {
|
|
10962
|
-
logger$
|
|
10990
|
+
logger$7.info('connect method started', { host: this.host, token: this.token });
|
|
10963
10991
|
this.socket = new ReconnectingWebSocket__default['default'](this._getUrl.bind(this), [], this.options);
|
|
10964
10992
|
if (this.options.binaryType) {
|
|
10965
10993
|
this.socket.binaryType = this.options.binaryType;
|
|
10966
10994
|
}
|
|
10967
10995
|
|
|
10968
10996
|
this.socket.onopen = () => {
|
|
10969
|
-
logger$
|
|
10970
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
10997
|
+
logger$7.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
10998
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
10971
10999
|
};
|
|
10972
11000
|
|
|
10973
11001
|
this.socket.onerror = event => {
|
|
10974
|
-
logger$
|
|
10975
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11002
|
+
logger$7.error('on Wazo WS error', event.target);
|
|
11003
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
10976
11004
|
};
|
|
10977
11005
|
|
|
10978
11006
|
this.socket.onmessage = (event ) => {
|
|
10979
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11007
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
10980
11008
|
|
|
10981
11009
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
10982
11010
|
let { name } = message;
|
|
@@ -11001,7 +11029,7 @@ class WebSocketClient extends Emitter {
|
|
|
11001
11029
|
|
|
11002
11030
|
this.socket.onclose = event => {
|
|
11003
11031
|
// Can't be converted to JSON (circular structure)
|
|
11004
|
-
logger$
|
|
11032
|
+
logger$7.info('on Wazo WS close', {
|
|
11005
11033
|
reason: event.reason,
|
|
11006
11034
|
code: event.code,
|
|
11007
11035
|
readyState: event.target.readyState,
|
|
@@ -11009,22 +11037,22 @@ class WebSocketClient extends Emitter {
|
|
|
11009
11037
|
token: this.token,
|
|
11010
11038
|
});
|
|
11011
11039
|
this.initialized = false;
|
|
11012
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11040
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
11013
11041
|
|
|
11014
11042
|
switch (event.code) {
|
|
11015
11043
|
case 4002:
|
|
11016
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11044
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
11017
11045
|
break;
|
|
11018
11046
|
}
|
|
11019
11047
|
};
|
|
11020
11048
|
|
|
11021
11049
|
this.socket.onerror = event => {
|
|
11022
|
-
logger$
|
|
11050
|
+
logger$7.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
|
|
11023
11051
|
};
|
|
11024
11052
|
}
|
|
11025
11053
|
|
|
11026
11054
|
close(force = false) {
|
|
11027
|
-
logger$
|
|
11055
|
+
logger$7.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
|
|
11028
11056
|
|
|
11029
11057
|
if (!this.socket) {
|
|
11030
11058
|
return;
|
|
@@ -11042,7 +11070,7 @@ class WebSocketClient extends Emitter {
|
|
|
11042
11070
|
|
|
11043
11071
|
updateToken(token ) {
|
|
11044
11072
|
this.token = token;
|
|
11045
|
-
logger$
|
|
11073
|
+
logger$7.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
|
|
11046
11074
|
|
|
11047
11075
|
if (this.socket) {
|
|
11048
11076
|
// If still connected, send the token to the WS
|
|
@@ -11060,7 +11088,7 @@ class WebSocketClient extends Emitter {
|
|
|
11060
11088
|
}
|
|
11061
11089
|
|
|
11062
11090
|
startHeartbeat() {
|
|
11063
|
-
logger$
|
|
11091
|
+
logger$7.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
|
|
11064
11092
|
|
|
11065
11093
|
if (!this.socket) {
|
|
11066
11094
|
this.heartbeat.stop();
|
|
@@ -11074,7 +11102,7 @@ class WebSocketClient extends Emitter {
|
|
|
11074
11102
|
}
|
|
11075
11103
|
|
|
11076
11104
|
stopHeartbeat() {
|
|
11077
|
-
logger$
|
|
11105
|
+
logger$7.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
|
|
11078
11106
|
|
|
11079
11107
|
this.heartbeat.stop();
|
|
11080
11108
|
}
|
|
@@ -11104,7 +11132,7 @@ class WebSocketClient extends Emitter {
|
|
|
11104
11132
|
}
|
|
11105
11133
|
|
|
11106
11134
|
reconnect(reason ) {
|
|
11107
|
-
logger$
|
|
11135
|
+
logger$7.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
|
|
11108
11136
|
if (!this.socket) {
|
|
11109
11137
|
return;
|
|
11110
11138
|
}
|
|
@@ -11129,7 +11157,7 @@ class WebSocketClient extends Emitter {
|
|
|
11129
11157
|
break;
|
|
11130
11158
|
case 'start':
|
|
11131
11159
|
this.initialized = true;
|
|
11132
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11160
|
+
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
11133
11161
|
break;
|
|
11134
11162
|
default:
|
|
11135
11163
|
this.eventEmitter.emit('message', message);
|
|
@@ -11160,7 +11188,7 @@ class WebSocketClient extends Emitter {
|
|
|
11160
11188
|
this.close();
|
|
11161
11189
|
}
|
|
11162
11190
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
11163
|
-
logger$
|
|
11191
|
+
logger$7.log('Wazo WS url computed to reconnect', { url });
|
|
11164
11192
|
|
|
11165
11193
|
return url;
|
|
11166
11194
|
}
|
|
@@ -11168,15 +11196,15 @@ class WebSocketClient extends Emitter {
|
|
|
11168
11196
|
_onHeartbeat(message ) {
|
|
11169
11197
|
if (message.payload === 'pong') {
|
|
11170
11198
|
this.heartbeat.onHeartbeat();
|
|
11171
|
-
logger$
|
|
11199
|
+
logger$7.log('on heartbeat received from Wazo WS');
|
|
11172
11200
|
}
|
|
11173
11201
|
}
|
|
11174
11202
|
|
|
11175
11203
|
async _onHeartbeatTimeout() {
|
|
11176
|
-
logger$
|
|
11204
|
+
logger$7.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
11177
11205
|
|
|
11178
11206
|
this.close();
|
|
11179
|
-
this.eventEmitter.emit(SOCKET_EVENTS
|
|
11207
|
+
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
11180
11208
|
|
|
11181
11209
|
if (this.onHeartBeatTimeout) {
|
|
11182
11210
|
this.onHeartBeatTimeout();
|
|
@@ -11256,7 +11284,7 @@ WebSocketClient.eventLists = [
|
|
|
11256
11284
|
|
|
11257
11285
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
11258
11286
|
__proto__: null,
|
|
11259
|
-
SOCKET_EVENTS: SOCKET_EVENTS
|
|
11287
|
+
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
11260
11288
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
11261
11289
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
11262
11290
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -11329,10 +11357,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11329
11357
|
|
|
11330
11358
|
//
|
|
11331
11359
|
|
|
11332
|
-
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11333
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
11360
|
+
const { SOCKET_EVENTS: SOCKET_EVENTS$1, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11361
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS$1), ...Object.values(OTHER_EVENTS)];
|
|
11334
11362
|
|
|
11335
|
-
const logger$
|
|
11363
|
+
const logger$8 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
11336
11364
|
|
|
11337
11365
|
class Websocket extends Emitter {
|
|
11338
11366
|
|
|
@@ -11346,9 +11374,9 @@ class Websocket extends Emitter {
|
|
|
11346
11374
|
// $FlowFixMe
|
|
11347
11375
|
this[key] = OTHER_EVENTS[key];
|
|
11348
11376
|
});
|
|
11349
|
-
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
11377
|
+
Object.keys(SOCKET_EVENTS$1).forEach(key => {
|
|
11350
11378
|
// $FlowFixMe
|
|
11351
|
-
this[key] = SOCKET_EVENTS[key];
|
|
11379
|
+
this[key] = SOCKET_EVENTS$1[key];
|
|
11352
11380
|
});
|
|
11353
11381
|
this.eventLists = WebSocketClient.eventLists;
|
|
11354
11382
|
|
|
@@ -11356,7 +11384,7 @@ class Websocket extends Emitter {
|
|
|
11356
11384
|
}
|
|
11357
11385
|
|
|
11358
11386
|
open(host , session ) {
|
|
11359
|
-
logger$
|
|
11387
|
+
logger$8.info('open simple WebSocket', { host, token: session.token });
|
|
11360
11388
|
this.ws = new WebSocketClient(
|
|
11361
11389
|
{
|
|
11362
11390
|
host,
|
|
@@ -11384,7 +11412,7 @@ class Websocket extends Emitter {
|
|
|
11384
11412
|
}
|
|
11385
11413
|
|
|
11386
11414
|
updateToken(token ) {
|
|
11387
|
-
logger$
|
|
11415
|
+
logger$8.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
11388
11416
|
|
|
11389
11417
|
if (!this.ws) {
|
|
11390
11418
|
return;
|
|
@@ -11412,7 +11440,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11412
11440
|
|
|
11413
11441
|
//
|
|
11414
11442
|
|
|
11415
|
-
const logger$
|
|
11443
|
+
const logger$9 = IssueReporter$1.loggerFor('room');
|
|
11416
11444
|
|
|
11417
11445
|
class Participant extends Emitter {
|
|
11418
11446
|
|
|
@@ -11534,7 +11562,7 @@ class Participant extends Emitter {
|
|
|
11534
11562
|
}
|
|
11535
11563
|
|
|
11536
11564
|
onTalking(isTalking ) {
|
|
11537
|
-
logger$
|
|
11565
|
+
logger$9.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
11538
11566
|
this.isTalking = isTalking;
|
|
11539
11567
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
11540
11568
|
// directly from asterisk, there's no need to do so
|
|
@@ -11637,7 +11665,7 @@ class Participant extends Emitter {
|
|
|
11637
11665
|
}
|
|
11638
11666
|
|
|
11639
11667
|
updateStatus(status , broadcast = true) {
|
|
11640
|
-
logger$
|
|
11668
|
+
logger$9.info('updating participant status', { name: this.name, status });
|
|
11641
11669
|
|
|
11642
11670
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
11643
11671
|
if (status.audioMuted) {
|
|
@@ -11685,7 +11713,7 @@ class Participant extends Emitter {
|
|
|
11685
11713
|
|
|
11686
11714
|
broadcastStatus(inboundStatus = null) {
|
|
11687
11715
|
const status = inboundStatus || this.getStatus();
|
|
11688
|
-
logger$
|
|
11716
|
+
logger$9.info('broadcasting participant status', { callId: this.callId, status });
|
|
11689
11717
|
|
|
11690
11718
|
this.room.sendSignal({
|
|
11691
11719
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|
|
@@ -11721,9 +11749,9 @@ class LocalParticipant extends Participant {
|
|
|
11721
11749
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
11722
11750
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
11723
11751
|
|
|
11724
|
-
const logger$
|
|
11752
|
+
const logger$a = IssueReporter$1.loggerFor('sdk-room');
|
|
11725
11753
|
|
|
11726
|
-
class Room
|
|
11754
|
+
class Room extends Emitter {
|
|
11727
11755
|
|
|
11728
11756
|
|
|
11729
11757
|
|
|
@@ -11781,7 +11809,7 @@ class Room$1 extends Emitter {
|
|
|
11781
11809
|
extra = {},
|
|
11782
11810
|
) {
|
|
11783
11811
|
super();
|
|
11784
|
-
logger$
|
|
11812
|
+
logger$a.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
11785
11813
|
|
|
11786
11814
|
// Represents the room callSession
|
|
11787
11815
|
this.callSession = callSession;
|
|
@@ -11847,7 +11875,7 @@ class Room$1 extends Emitter {
|
|
|
11847
11875
|
* @returns {Promise<Room>}
|
|
11848
11876
|
*/
|
|
11849
11877
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
11850
|
-
logger$
|
|
11878
|
+
logger$a.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
11851
11879
|
|
|
11852
11880
|
if (!room) {
|
|
11853
11881
|
await Wazo.Phone.connect();
|
|
@@ -11860,7 +11888,7 @@ class Room$1 extends Emitter {
|
|
|
11860
11888
|
|
|
11861
11889
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
11862
11890
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
11863
|
-
logger$
|
|
11891
|
+
logger$a.info('room call received via WS', { callId: data.call_id });
|
|
11864
11892
|
if (room) {
|
|
11865
11893
|
room.setCallId(data.call_id);
|
|
11866
11894
|
}
|
|
@@ -11868,7 +11896,7 @@ class Room$1 extends Emitter {
|
|
|
11868
11896
|
|
|
11869
11897
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
11870
11898
|
// eslint-disable-next-line no-param-reassign
|
|
11871
|
-
room = new Room
|
|
11899
|
+
room = new Room(callSession, extension, null, null, extra);
|
|
11872
11900
|
|
|
11873
11901
|
// Wait for the call to be accepted
|
|
11874
11902
|
await new Promise((resolve, reject) => {
|
|
@@ -11889,7 +11917,7 @@ class Room$1 extends Emitter {
|
|
|
11889
11917
|
// Retrieve conference
|
|
11890
11918
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
11891
11919
|
|
|
11892
|
-
logger$
|
|
11920
|
+
logger$a.info('connected to room', {
|
|
11893
11921
|
sourceId: conference ? conference.sourceId : null,
|
|
11894
11922
|
name: conference ? conference.name : null,
|
|
11895
11923
|
});
|
|
@@ -11899,7 +11927,7 @@ class Room$1 extends Emitter {
|
|
|
11899
11927
|
room.setName(conference.name);
|
|
11900
11928
|
}
|
|
11901
11929
|
} else if (meeting) {
|
|
11902
|
-
logger$
|
|
11930
|
+
logger$a.info('Already connected to meeting', {
|
|
11903
11931
|
uuid: meeting.uuid,
|
|
11904
11932
|
name: meeting.name,
|
|
11905
11933
|
});
|
|
@@ -11912,13 +11940,13 @@ class Room$1 extends Emitter {
|
|
|
11912
11940
|
}
|
|
11913
11941
|
|
|
11914
11942
|
static disconnect() {
|
|
11915
|
-
logger$
|
|
11943
|
+
logger$a.info('static disconnection to room');
|
|
11916
11944
|
|
|
11917
11945
|
Wazo.Phone.disconnect();
|
|
11918
11946
|
}
|
|
11919
11947
|
|
|
11920
11948
|
async disconnect() {
|
|
11921
|
-
logger$
|
|
11949
|
+
logger$a.info('disconnection to room called');
|
|
11922
11950
|
|
|
11923
11951
|
await Wazo.Phone.hangup(this.callSession);
|
|
11924
11952
|
this.callSession = null;
|
|
@@ -11938,19 +11966,19 @@ class Room$1 extends Emitter {
|
|
|
11938
11966
|
}
|
|
11939
11967
|
|
|
11940
11968
|
setSourceId(sourceId ) {
|
|
11941
|
-
logger$
|
|
11969
|
+
logger$a.info('set room source id', { sourceId });
|
|
11942
11970
|
|
|
11943
11971
|
this.sourceId = sourceId;
|
|
11944
11972
|
}
|
|
11945
11973
|
|
|
11946
11974
|
setMeetingUuid(meetingUuid ) {
|
|
11947
|
-
logger$
|
|
11975
|
+
logger$a.info('set meeting uuid', { meetingUuid });
|
|
11948
11976
|
|
|
11949
11977
|
this.meetingUuid = meetingUuid;
|
|
11950
11978
|
}
|
|
11951
11979
|
|
|
11952
11980
|
setCallId(callId ) {
|
|
11953
|
-
logger$
|
|
11981
|
+
logger$a.info('set room call id', { callId });
|
|
11954
11982
|
|
|
11955
11983
|
if (callId) {
|
|
11956
11984
|
this.callId = callId;
|
|
@@ -11958,7 +11986,7 @@ class Room$1 extends Emitter {
|
|
|
11958
11986
|
}
|
|
11959
11987
|
|
|
11960
11988
|
setName(name ) {
|
|
11961
|
-
logger$
|
|
11989
|
+
logger$a.info('set room name', { name });
|
|
11962
11990
|
|
|
11963
11991
|
this.name = name;
|
|
11964
11992
|
}
|
|
@@ -11977,7 +12005,7 @@ class Room$1 extends Emitter {
|
|
|
11977
12005
|
}
|
|
11978
12006
|
|
|
11979
12007
|
async startScreenSharing(constraints ) {
|
|
11980
|
-
logger$
|
|
12008
|
+
logger$a.info('start room screen sharing', { constraints });
|
|
11981
12009
|
|
|
11982
12010
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
11983
12011
|
if (!screensharingStream) {
|
|
@@ -11991,7 +12019,7 @@ class Room$1 extends Emitter {
|
|
|
11991
12019
|
}
|
|
11992
12020
|
|
|
11993
12021
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
11994
|
-
logger$
|
|
12022
|
+
logger$a.info('stop room screen sharing');
|
|
11995
12023
|
|
|
11996
12024
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
11997
12025
|
|
|
@@ -12003,7 +12031,7 @@ class Room$1 extends Emitter {
|
|
|
12003
12031
|
}
|
|
12004
12032
|
|
|
12005
12033
|
turnCameraOff() {
|
|
12006
|
-
logger$
|
|
12034
|
+
logger$a.info('turn room camera off');
|
|
12007
12035
|
|
|
12008
12036
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
12009
12037
|
|
|
@@ -12013,7 +12041,7 @@ class Room$1 extends Emitter {
|
|
|
12013
12041
|
}
|
|
12014
12042
|
|
|
12015
12043
|
turnCameraOn() {
|
|
12016
|
-
logger$
|
|
12044
|
+
logger$a.info('turn room camera on');
|
|
12017
12045
|
|
|
12018
12046
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
12019
12047
|
|
|
@@ -12023,7 +12051,7 @@ class Room$1 extends Emitter {
|
|
|
12023
12051
|
}
|
|
12024
12052
|
|
|
12025
12053
|
mute() {
|
|
12026
|
-
logger$
|
|
12054
|
+
logger$a.info('mute room');
|
|
12027
12055
|
|
|
12028
12056
|
Wazo.Phone.mute(this.callSession);
|
|
12029
12057
|
|
|
@@ -12031,7 +12059,7 @@ class Room$1 extends Emitter {
|
|
|
12031
12059
|
}
|
|
12032
12060
|
|
|
12033
12061
|
unmute() {
|
|
12034
|
-
logger$
|
|
12062
|
+
logger$a.info('unmute room');
|
|
12035
12063
|
|
|
12036
12064
|
Wazo.Phone.unmute(this.callSession);
|
|
12037
12065
|
|
|
@@ -12051,7 +12079,7 @@ class Room$1 extends Emitter {
|
|
|
12051
12079
|
}
|
|
12052
12080
|
|
|
12053
12081
|
hold() {
|
|
12054
|
-
logger$
|
|
12082
|
+
logger$a.info('hold room');
|
|
12055
12083
|
|
|
12056
12084
|
Wazo.Phone.hold(this.callSession, true);
|
|
12057
12085
|
|
|
@@ -12061,7 +12089,7 @@ class Room$1 extends Emitter {
|
|
|
12061
12089
|
}
|
|
12062
12090
|
|
|
12063
12091
|
async resume() {
|
|
12064
|
-
logger$
|
|
12092
|
+
logger$a.info('resume room');
|
|
12065
12093
|
|
|
12066
12094
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
12067
12095
|
|
|
@@ -12089,13 +12117,13 @@ class Room$1 extends Emitter {
|
|
|
12089
12117
|
}
|
|
12090
12118
|
|
|
12091
12119
|
sendDTMF(tone ) {
|
|
12092
|
-
logger$
|
|
12120
|
+
logger$a.info('send room DTMF', { tone });
|
|
12093
12121
|
|
|
12094
12122
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
12095
12123
|
}
|
|
12096
12124
|
|
|
12097
12125
|
async sendReinvite(newConstraints = null) {
|
|
12098
|
-
logger$
|
|
12126
|
+
logger$a.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
12099
12127
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
12100
12128
|
|
|
12101
12129
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -12154,7 +12182,7 @@ class Room$1 extends Emitter {
|
|
|
12154
12182
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
12155
12183
|
|
|
12156
12184
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
12157
|
-
logger$
|
|
12185
|
+
logger$a.info('on room audio stream');
|
|
12158
12186
|
|
|
12159
12187
|
this.audioStream = stream;
|
|
12160
12188
|
if (!this.roomAudioElement) {
|
|
@@ -12167,7 +12195,7 @@ class Room$1 extends Emitter {
|
|
|
12167
12195
|
});
|
|
12168
12196
|
|
|
12169
12197
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
12170
|
-
logger$
|
|
12198
|
+
logger$a.info('on room video stream', { streamId });
|
|
12171
12199
|
|
|
12172
12200
|
this._mapMsid(sipSession.body.body);
|
|
12173
12201
|
|
|
@@ -12182,7 +12210,7 @@ class Room$1 extends Emitter {
|
|
|
12182
12210
|
});
|
|
12183
12211
|
|
|
12184
12212
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
12185
|
-
logger$
|
|
12213
|
+
logger$a.info('on room remove stream');
|
|
12186
12214
|
|
|
12187
12215
|
const participant = this.participants.find(someParticipant =>
|
|
12188
12216
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -12314,7 +12342,7 @@ class Room$1 extends Emitter {
|
|
|
12314
12342
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
12315
12343
|
if (requester) {
|
|
12316
12344
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
12317
|
-
logger$
|
|
12345
|
+
logger$a.info('trigger room requester status', { origin });
|
|
12318
12346
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
12319
12347
|
}
|
|
12320
12348
|
break;
|
|
@@ -12345,24 +12373,24 @@ class Room$1 extends Emitter {
|
|
|
12345
12373
|
|
|
12346
12374
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
12347
12375
|
if (participant.user_uuid === session.uuid) {
|
|
12348
|
-
logger$
|
|
12376
|
+
logger$a.info('room current user joined');
|
|
12349
12377
|
|
|
12350
12378
|
// Retrieve participants via an API calls
|
|
12351
12379
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
12352
12380
|
let response;
|
|
12353
12381
|
try {
|
|
12354
12382
|
if (this.meetingUuid) {
|
|
12355
|
-
logger$
|
|
12383
|
+
logger$a.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
12356
12384
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
12357
12385
|
} else {
|
|
12358
|
-
logger$
|
|
12386
|
+
logger$a.info('fetching conference participants', { conferenceId });
|
|
12359
12387
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
12360
12388
|
}
|
|
12361
12389
|
} catch (e) {
|
|
12362
|
-
logger$
|
|
12390
|
+
logger$a.error('room participants fetching, error', e);
|
|
12363
12391
|
}
|
|
12364
12392
|
if (response) {
|
|
12365
|
-
logger$
|
|
12393
|
+
logger$a.info('conference participants fetched', { nb: response.items.length });
|
|
12366
12394
|
participants = response.items.map(item => {
|
|
12367
12395
|
const isMe = item.call_id === this.callId;
|
|
12368
12396
|
|
|
@@ -12389,7 +12417,7 @@ class Room$1 extends Emitter {
|
|
|
12389
12417
|
? new Wazo.RemoteParticipant(this, participant)
|
|
12390
12418
|
: null;
|
|
12391
12419
|
|
|
12392
|
-
logger$
|
|
12420
|
+
logger$a.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
12393
12421
|
|
|
12394
12422
|
if (remoteParticipant) {
|
|
12395
12423
|
this.participants.push(remoteParticipant);
|
|
@@ -12554,12 +12582,12 @@ class Room$1 extends Emitter {
|
|
|
12554
12582
|
|
|
12555
12583
|
//
|
|
12556
12584
|
|
|
12557
|
-
const logger$
|
|
12585
|
+
const logger$b = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
12558
12586
|
|
|
12559
|
-
class SipRoom extends Room
|
|
12587
|
+
class SipRoom extends Room {
|
|
12560
12588
|
|
|
12561
12589
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
12562
|
-
logger$
|
|
12590
|
+
logger$b.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
12563
12591
|
|
|
12564
12592
|
if (!room) {
|
|
12565
12593
|
await Wazo.Phone.connect();
|
|
@@ -12575,7 +12603,7 @@ class SipRoom extends Room$1 {
|
|
|
12575
12603
|
room.setCallId(room.callSession.call.id);
|
|
12576
12604
|
}
|
|
12577
12605
|
|
|
12578
|
-
logger$
|
|
12606
|
+
logger$b.info('connected to room', {
|
|
12579
12607
|
extension: room.extension,
|
|
12580
12608
|
});
|
|
12581
12609
|
|
|
@@ -12583,7 +12611,7 @@ class SipRoom extends Room$1 {
|
|
|
12583
12611
|
}
|
|
12584
12612
|
|
|
12585
12613
|
mute() {
|
|
12586
|
-
logger$
|
|
12614
|
+
logger$b.info('mute sip room');
|
|
12587
12615
|
|
|
12588
12616
|
Wazo.Phone.mute(this.callSession, false);
|
|
12589
12617
|
|
|
@@ -12591,7 +12619,7 @@ class SipRoom extends Room$1 {
|
|
|
12591
12619
|
}
|
|
12592
12620
|
|
|
12593
12621
|
unmute() {
|
|
12594
|
-
logger$
|
|
12622
|
+
logger$b.info('unmute sip room');
|
|
12595
12623
|
|
|
12596
12624
|
Wazo.Phone.unmute(this.callSession, false);
|
|
12597
12625
|
|
|
@@ -12859,7 +12887,7 @@ class NotificationOptions {
|
|
|
12859
12887
|
|
|
12860
12888
|
|
|
12861
12889
|
// Represents a conference room, like `9000`.
|
|
12862
|
-
class Room {
|
|
12890
|
+
class Room$1 {
|
|
12863
12891
|
|
|
12864
12892
|
|
|
12865
12893
|
|
|
@@ -12880,7 +12908,7 @@ class Room {
|
|
|
12880
12908
|
}
|
|
12881
12909
|
|
|
12882
12910
|
connect(callSession ) {
|
|
12883
|
-
return new Room({ ...this, connectedCallSession: callSession });
|
|
12911
|
+
return new Room$1({ ...this, connectedCallSession: callSession });
|
|
12884
12912
|
}
|
|
12885
12913
|
|
|
12886
12914
|
has(callSession ) {
|
|
@@ -12889,7 +12917,7 @@ class Room {
|
|
|
12889
12917
|
|
|
12890
12918
|
addParticipant(uuid , extension , talking = null) {
|
|
12891
12919
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
12892
|
-
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12920
|
+
return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12893
12921
|
}
|
|
12894
12922
|
|
|
12895
12923
|
return this;
|
|
@@ -12908,7 +12936,7 @@ class Room {
|
|
|
12908
12936
|
updatedParticipants.push(participant);
|
|
12909
12937
|
}
|
|
12910
12938
|
|
|
12911
|
-
return new Room({ ...this, participants: updatedParticipants });
|
|
12939
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
12912
12940
|
}
|
|
12913
12941
|
|
|
12914
12942
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -12924,7 +12952,7 @@ class Room {
|
|
|
12924
12952
|
updatedParticipants.push(participant);
|
|
12925
12953
|
}
|
|
12926
12954
|
|
|
12927
|
-
return new Room({ ...this, participants: updatedParticipants });
|
|
12955
|
+
return new Room$1({ ...this, participants: updatedParticipants });
|
|
12928
12956
|
}
|
|
12929
12957
|
|
|
12930
12958
|
hasCallWithId(id ) {
|
|
@@ -12932,18 +12960,18 @@ class Room {
|
|
|
12932
12960
|
}
|
|
12933
12961
|
|
|
12934
12962
|
disconnect() {
|
|
12935
|
-
return new Room({ ...this, connectedCallSession: null });
|
|
12963
|
+
return new Room$1({ ...this, connectedCallSession: null });
|
|
12936
12964
|
}
|
|
12937
12965
|
|
|
12938
12966
|
removeParticipantWithUUID(uuid ) {
|
|
12939
|
-
return new Room({
|
|
12967
|
+
return new Room$1({
|
|
12940
12968
|
...this,
|
|
12941
12969
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
12942
12970
|
});
|
|
12943
12971
|
}
|
|
12944
12972
|
|
|
12945
12973
|
removeParticipantWithExtension(extension ) {
|
|
12946
|
-
return new Room({
|
|
12974
|
+
return new Room$1({
|
|
12947
12975
|
...this,
|
|
12948
12976
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
12949
12977
|
});
|
|
@@ -12954,7 +12982,7 @@ class Room {
|
|
|
12954
12982
|
}
|
|
12955
12983
|
|
|
12956
12984
|
static newFrom(room ) {
|
|
12957
|
-
return newFrom(room, Room);
|
|
12985
|
+
return newFrom(room, Room$1);
|
|
12958
12986
|
}
|
|
12959
12987
|
}
|
|
12960
12988
|
|
|
@@ -13261,11 +13289,11 @@ var wazoWebsocket = {
|
|
|
13261
13289
|
resolve();
|
|
13262
13290
|
};
|
|
13263
13291
|
|
|
13264
|
-
client.on(SOCKET_EVENTS
|
|
13292
|
+
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
13265
13293
|
handleError(`Connection error : ${error}`);
|
|
13266
13294
|
});
|
|
13267
13295
|
|
|
13268
|
-
client.on(SOCKET_EVENTS
|
|
13296
|
+
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
13269
13297
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
13270
13298
|
client.setOnHeartbeatTimeout(() => {
|
|
13271
13299
|
handleError('No response to heartbeat');
|
|
@@ -13366,7 +13394,7 @@ var webrtc = {
|
|
|
13366
13394
|
}),
|
|
13367
13395
|
};
|
|
13368
13396
|
|
|
13369
|
-
const parseCandidate = line => {
|
|
13397
|
+
const parseCandidate$1 = line => {
|
|
13370
13398
|
let parts;
|
|
13371
13399
|
// Parse both variants.
|
|
13372
13400
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -13457,7 +13485,7 @@ var SymmetricNat = {
|
|
|
13457
13485
|
}
|
|
13458
13486
|
|
|
13459
13487
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
13460
|
-
const cand = parseCandidate(e.candidate.candidate);
|
|
13488
|
+
const cand = parseCandidate$1(e.candidate.candidate);
|
|
13461
13489
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
13462
13490
|
candidates[cand.relatedPort].push(cand.port);
|
|
13463
13491
|
} else if (!e.candidate) {
|
|
@@ -13525,7 +13553,7 @@ var iceIpv4 = {
|
|
|
13525
13553
|
const rawCandidate = e.candidate.candidate;
|
|
13526
13554
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
13527
13555
|
hasSrflxOrRelay = true;
|
|
13528
|
-
const candidate = parseCandidate(e.candidate.candidate);
|
|
13556
|
+
const candidate = parseCandidate$1(e.candidate.candidate);
|
|
13529
13557
|
ips.push(candidate.ip);
|
|
13530
13558
|
}
|
|
13531
13559
|
} else if (!e.candidate) {
|
|
@@ -13562,7 +13590,7 @@ var checks = [
|
|
|
13562
13590
|
|
|
13563
13591
|
//
|
|
13564
13592
|
|
|
13565
|
-
const logger = IssueReporter$1.loggerFor('engine-check');
|
|
13593
|
+
const logger$c = IssueReporter$1.loggerFor('engine-check');
|
|
13566
13594
|
|
|
13567
13595
|
class Checker {
|
|
13568
13596
|
|
|
@@ -13580,28 +13608,28 @@ class Checker {
|
|
|
13580
13608
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
13581
13609
|
await this._addEngineVersion();
|
|
13582
13610
|
|
|
13583
|
-
logger.info('Engine check starting');
|
|
13611
|
+
logger$c.info('Engine check starting');
|
|
13584
13612
|
|
|
13585
13613
|
for (let i = 0; i < this.checks.length; i++) {
|
|
13586
13614
|
const { name, check } = this.checks[i];
|
|
13587
13615
|
|
|
13588
|
-
logger.info(`Checking ${name} ...`);
|
|
13616
|
+
logger$c.info(`Checking ${name} ...`);
|
|
13589
13617
|
|
|
13590
13618
|
onCheckBegin(name);
|
|
13591
13619
|
try {
|
|
13592
13620
|
// eslint-disable-next-line no-await-in-loop
|
|
13593
13621
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
13594
|
-
logger.info(`Checking ${name} success.`, { result });
|
|
13622
|
+
logger$c.info(`Checking ${name} success.`, { result });
|
|
13595
13623
|
|
|
13596
13624
|
onCheckResult(name, result);
|
|
13597
13625
|
} catch (e) {
|
|
13598
|
-
logger.info(`Checking ${name} failure`, { message: e.message });
|
|
13626
|
+
logger$c.info(`Checking ${name} failure`, { message: e.message });
|
|
13599
13627
|
|
|
13600
13628
|
onCheckResult(name, e);
|
|
13601
13629
|
}
|
|
13602
13630
|
}
|
|
13603
13631
|
|
|
13604
|
-
logger.info('Engine check done.');
|
|
13632
|
+
logger$c.info('Engine check done.');
|
|
13605
13633
|
}
|
|
13606
13634
|
|
|
13607
13635
|
addCheck(check ) {
|
|
@@ -13625,7 +13653,7 @@ const Wazo = {
|
|
|
13625
13653
|
Auth: Auth$1,
|
|
13626
13654
|
Phone: Phone$1,
|
|
13627
13655
|
Websocket: Websocket$1,
|
|
13628
|
-
Room
|
|
13656
|
+
Room,
|
|
13629
13657
|
SipRoom,
|
|
13630
13658
|
RemoteParticipant,
|
|
13631
13659
|
LocalParticipant,
|
|
@@ -13658,7 +13686,7 @@ const Wazo = {
|
|
|
13658
13686
|
Session,
|
|
13659
13687
|
Voicemail,
|
|
13660
13688
|
Relocation,
|
|
13661
|
-
ConferenceRoom: Room,
|
|
13689
|
+
ConferenceRoom: Room$1,
|
|
13662
13690
|
CallSession,
|
|
13663
13691
|
IndirectTransfer,
|
|
13664
13692
|
SwitchboardCall,
|