@wazo/sdk 0.37.24 → 0.37.25
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 +12 -12
- package/esm/__tests__/web-rtc-client.test.js +120 -103
- package/esm/api/amid.js +1 -1
- package/esm/api/call-logd.js +2 -2
- 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 +12 -12
- package/esm/checker/Checker.js +145 -128
- package/esm/checker/checks/aor.js +12 -12
- package/esm/checker/checks/api.js +12 -12
- package/esm/checker/checks/index.js +135 -118
- package/esm/checker/checks/wazo-websocket.js +15 -15
- package/esm/checker/checks/webrtc-transport.js +120 -103
- package/esm/checker/checks/webrtc.js +120 -103
- package/esm/domain/AdHocAPIConference.js +12 -12
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/Contact.js +1 -1
- package/esm/domain/Features.js +12 -12
- package/esm/domain/Phone/CTIPhone.js +26 -26
- package/esm/domain/Phone/WebRTCPhone.js +87 -86
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/Contact.test.js +1 -1
- package/esm/index.js +356 -338
- package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
- package/esm/service/CallApi.js +12 -12
- package/esm/service/IssueReporter.js +1 -1
- package/esm/service/__tests__/IssueReporter.test.js +1 -1
- package/esm/service/getApiClient.js +12 -12
- package/esm/simple/Auth.js +346 -328
- package/esm/simple/Configuration.js +346 -328
- package/esm/simple/Directory.js +12 -12
- package/esm/simple/Phone.js +346 -328
- package/esm/simple/Websocket.js +17 -17
- package/esm/simple/index.js +350 -332
- package/esm/simple/room/LocalParticipant.js +350 -332
- package/esm/simple/room/Participant.js +350 -332
- package/esm/simple/room/RemoteParticipant.js +350 -332
- package/esm/simple/room/Room.js +351 -333
- package/esm/simple/room/SipRoom.js +350 -332
- package/esm/simple/room/Stream.js +350 -332
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +350 -332
- package/esm/simple/utils.js +350 -332
- package/esm/web-rtc-client.js +120 -103
- package/esm/websocket-client.js +15 -15
- package/lib/__tests__/api-client.test.js +12 -12
- package/lib/__tests__/web-rtc-client.test.js +120 -103
- package/lib/api/amid.js +1 -1
- package/lib/api/call-logd.js +2 -2
- 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 +12 -12
- package/lib/checker/Checker.js +145 -128
- package/lib/checker/checks/aor.js +12 -12
- package/lib/checker/checks/api.js +12 -12
- package/lib/checker/checks/index.js +135 -118
- package/lib/checker/checks/wazo-websocket.js +15 -15
- package/lib/checker/checks/webrtc-transport.js +120 -103
- package/lib/checker/checks/webrtc.js +120 -103
- package/lib/domain/AdHocAPIConference.js +12 -12
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +12 -12
- package/lib/domain/Phone/CTIPhone.js +26 -26
- package/lib/domain/Phone/WebRTCPhone.js +87 -86
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/Contact.test.js +1 -1
- package/lib/index.js +356 -338
- package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
- package/lib/service/CallApi.js +12 -12
- package/lib/service/IssueReporter.js +1 -1
- package/lib/service/__tests__/IssueReporter.test.js +1 -1
- package/lib/service/getApiClient.js +12 -12
- package/lib/simple/Auth.js +346 -328
- package/lib/simple/Configuration.js +346 -328
- package/lib/simple/Directory.js +12 -12
- package/lib/simple/Phone.js +346 -328
- package/lib/simple/Websocket.js +17 -17
- package/lib/simple/index.js +350 -332
- package/lib/simple/room/LocalParticipant.js +350 -332
- package/lib/simple/room/Participant.js +350 -332
- package/lib/simple/room/RemoteParticipant.js +350 -332
- package/lib/simple/room/Room.js +351 -333
- package/lib/simple/room/SipRoom.js +350 -332
- package/lib/simple/room/Stream.js +350 -332
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +350 -332
- package/lib/simple/utils.js +350 -332
- package/lib/web-rtc-client.js +120 -103
- package/lib/websocket-client.js +15 -15
- package/package.json +1 -1
- package/src/domain/Phone/WebRTCPhone.js +3 -2
- package/src/web-rtc-client.js +27 -10
package/lib/simple/Auth.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 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1962
|
+
const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1963
1963
|
|
|
1964
1964
|
// Use a function here to be able to mock it in tests
|
|
1965
1965
|
const realFetch = () => {
|
|
@@ -2098,7 +2098,7 @@ class ApiRequester {
|
|
|
2098
2098
|
};
|
|
2099
2099
|
|
|
2100
2100
|
if (this.refreshTokenPromise) {
|
|
2101
|
-
logger.info('A token is already refreshing, waiting ...', { url });
|
|
2101
|
+
logger$c.info('A token is already refreshing, waiting ...', { url });
|
|
2102
2102
|
await this.refreshTokenPromise;
|
|
2103
2103
|
}
|
|
2104
2104
|
|
|
@@ -2118,7 +2118,7 @@ class ApiRequester {
|
|
|
2118
2118
|
return promise.then(async (err ) => {
|
|
2119
2119
|
// Check if the token is still valid
|
|
2120
2120
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
2121
|
-
logger.warn('token expired', { error: err.reason });
|
|
2121
|
+
logger$c.warn('token expired', { error: err.reason });
|
|
2122
2122
|
// Replay the call after refreshing the token
|
|
2123
2123
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
2124
2124
|
}
|
|
@@ -2128,7 +2128,7 @@ class ApiRequester {
|
|
|
2128
2128
|
: exceptionClass.fromResponse(err, response.status);
|
|
2129
2129
|
|
|
2130
2130
|
if (this.shouldLogErrors) {
|
|
2131
|
-
logger.error('API error', error);
|
|
2131
|
+
logger$c.error('API error', error);
|
|
2132
2132
|
}
|
|
2133
2133
|
|
|
2134
2134
|
throw error;
|
|
@@ -2138,7 +2138,7 @@ class ApiRequester {
|
|
|
2138
2138
|
return newParse(response, isJson);
|
|
2139
2139
|
}).catch(error => {
|
|
2140
2140
|
if (this.shouldLogErrors) {
|
|
2141
|
-
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2141
|
+
logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2142
2142
|
}
|
|
2143
2143
|
|
|
2144
2144
|
throw error;
|
|
@@ -2166,13 +2166,13 @@ class ApiRequester {
|
|
|
2166
2166
|
) {
|
|
2167
2167
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
2168
2168
|
let newPath = path;
|
|
2169
|
-
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2169
|
+
logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2170
2170
|
|
|
2171
2171
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
2172
2172
|
|
|
2173
2173
|
return this.refreshTokenPromise.then(() => {
|
|
2174
2174
|
this.refreshTokenPromise = null;
|
|
2175
|
-
logger.info('token refreshed', { isTokenNotFound });
|
|
2175
|
+
logger$c.info('token refreshed', { isTokenNotFound });
|
|
2176
2176
|
if (isTokenNotFound) {
|
|
2177
2177
|
const pathParts = path.split('/');
|
|
2178
2178
|
pathParts.pop();
|
|
@@ -4065,7 +4065,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4065
4065
|
|
|
4066
4066
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4067
4067
|
|
|
4068
|
-
const logger$
|
|
4068
|
+
const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4069
4069
|
|
|
4070
4070
|
class CTIPhone extends Emitter {
|
|
4071
4071
|
|
|
@@ -4078,7 +4078,7 @@ class CTIPhone extends Emitter {
|
|
|
4078
4078
|
|
|
4079
4079
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4080
4080
|
super();
|
|
4081
|
-
logger$
|
|
4081
|
+
logger$b.info('CTI Phone created');
|
|
4082
4082
|
this.session = session;
|
|
4083
4083
|
this.isMobile = isMobile;
|
|
4084
4084
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4139,7 +4139,7 @@ class CTIPhone extends Emitter {
|
|
|
4139
4139
|
}
|
|
4140
4140
|
|
|
4141
4141
|
async makeCall(number , line ) {
|
|
4142
|
-
logger$
|
|
4142
|
+
logger$b.info('make CTI call', { number });
|
|
4143
4143
|
|
|
4144
4144
|
if (!number) {
|
|
4145
4145
|
return null;
|
|
@@ -4162,7 +4162,7 @@ class CTIPhone extends Emitter {
|
|
|
4162
4162
|
if (!callSession) {
|
|
4163
4163
|
return Promise.resolve(null);
|
|
4164
4164
|
}
|
|
4165
|
-
logger$
|
|
4165
|
+
logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4166
4166
|
|
|
4167
4167
|
if (!this.currentCall) {
|
|
4168
4168
|
this.currentCall = callSession.call;
|
|
@@ -4175,7 +4175,7 @@ class CTIPhone extends Emitter {
|
|
|
4175
4175
|
if (!callSession) {
|
|
4176
4176
|
return;
|
|
4177
4177
|
}
|
|
4178
|
-
logger$
|
|
4178
|
+
logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4179
4179
|
|
|
4180
4180
|
this.currentCall = undefined;
|
|
4181
4181
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4185,7 +4185,7 @@ class CTIPhone extends Emitter {
|
|
|
4185
4185
|
if (!callSession) {
|
|
4186
4186
|
return Promise.resolve(false);
|
|
4187
4187
|
}
|
|
4188
|
-
logger$
|
|
4188
|
+
logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4189
4189
|
|
|
4190
4190
|
try {
|
|
4191
4191
|
await CallApi.cancelCall(callSession);
|
|
@@ -4196,7 +4196,7 @@ class CTIPhone extends Emitter {
|
|
|
4196
4196
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4197
4197
|
return true;
|
|
4198
4198
|
} catch (e) {
|
|
4199
|
-
logger$
|
|
4199
|
+
logger$b.error('hangup CTI call, error', e);
|
|
4200
4200
|
|
|
4201
4201
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4202
4202
|
return false;
|
|
@@ -4209,7 +4209,7 @@ class CTIPhone extends Emitter {
|
|
|
4209
4209
|
if (!callSession) {
|
|
4210
4210
|
return;
|
|
4211
4211
|
}
|
|
4212
|
-
logger$
|
|
4212
|
+
logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4213
4213
|
|
|
4214
4214
|
await CallApi.cancelCall(callSession);
|
|
4215
4215
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4219,7 +4219,7 @@ class CTIPhone extends Emitter {
|
|
|
4219
4219
|
if (!callSession) {
|
|
4220
4220
|
return;
|
|
4221
4221
|
}
|
|
4222
|
-
logger$
|
|
4222
|
+
logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4223
4223
|
|
|
4224
4224
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4225
4225
|
}
|
|
@@ -4232,19 +4232,19 @@ class CTIPhone extends Emitter {
|
|
|
4232
4232
|
if (!callSession) {
|
|
4233
4233
|
return;
|
|
4234
4234
|
}
|
|
4235
|
-
logger$
|
|
4235
|
+
logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4236
4236
|
|
|
4237
4237
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4238
4238
|
}
|
|
4239
4239
|
|
|
4240
4240
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4241
|
-
logger$
|
|
4241
|
+
logger$b.info('cancel CTI transfer', { transferId });
|
|
4242
4242
|
|
|
4243
4243
|
return CallApi.cancelCallTransfer(transferId);
|
|
4244
4244
|
}
|
|
4245
4245
|
|
|
4246
4246
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4247
|
-
logger$
|
|
4247
|
+
logger$b.info('confirm CTI transfer', { transferId });
|
|
4248
4248
|
|
|
4249
4249
|
return CallApi.confirmCallTransfer(transferId);
|
|
4250
4250
|
}
|
|
@@ -4253,19 +4253,19 @@ class CTIPhone extends Emitter {
|
|
|
4253
4253
|
if (!callSession) {
|
|
4254
4254
|
return;
|
|
4255
4255
|
}
|
|
4256
|
-
logger$
|
|
4256
|
+
logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4257
4257
|
|
|
4258
4258
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4259
4259
|
}
|
|
4260
4260
|
|
|
4261
4261
|
onConnectionMade() {
|
|
4262
|
-
logger$
|
|
4262
|
+
logger$b.info('on CTI connection made');
|
|
4263
4263
|
|
|
4264
4264
|
this.eventEmitter.emit('onCallAccepted');
|
|
4265
4265
|
}
|
|
4266
4266
|
|
|
4267
4267
|
async close() {
|
|
4268
|
-
logger$
|
|
4268
|
+
logger$b.info('CTI close');
|
|
4269
4269
|
|
|
4270
4270
|
return Promise.resolve();
|
|
4271
4271
|
}
|
|
@@ -4274,7 +4274,7 @@ class CTIPhone extends Emitter {
|
|
|
4274
4274
|
if (!callSession) {
|
|
4275
4275
|
return;
|
|
4276
4276
|
}
|
|
4277
|
-
logger$
|
|
4277
|
+
logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4278
4278
|
|
|
4279
4279
|
return CallApi.hold(callSession.callId);
|
|
4280
4280
|
}
|
|
@@ -4283,7 +4283,7 @@ class CTIPhone extends Emitter {
|
|
|
4283
4283
|
if (!callSession) {
|
|
4284
4284
|
return;
|
|
4285
4285
|
}
|
|
4286
|
-
logger$
|
|
4286
|
+
logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4287
4287
|
|
|
4288
4288
|
return CallApi.resume(callSession.callId);
|
|
4289
4289
|
}
|
|
@@ -4292,7 +4292,7 @@ class CTIPhone extends Emitter {
|
|
|
4292
4292
|
if (!callSession) {
|
|
4293
4293
|
return;
|
|
4294
4294
|
}
|
|
4295
|
-
logger$
|
|
4295
|
+
logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4296
4296
|
|
|
4297
4297
|
return CallApi.mute(callSession.callId);
|
|
4298
4298
|
}
|
|
@@ -4301,7 +4301,7 @@ class CTIPhone extends Emitter {
|
|
|
4301
4301
|
if (!callSession) {
|
|
4302
4302
|
return;
|
|
4303
4303
|
}
|
|
4304
|
-
logger$
|
|
4304
|
+
logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4305
4305
|
|
|
4306
4306
|
return CallApi.unmute(callSession.callId);
|
|
4307
4307
|
}
|
|
@@ -5310,7 +5310,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5310
5310
|
const WEBHOOKD_VERSION = '1.0';
|
|
5311
5311
|
const AMID_VERSION = '1.0';
|
|
5312
5312
|
|
|
5313
|
-
const logger$
|
|
5313
|
+
const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5314
5314
|
|
|
5315
5315
|
class ApiClient {
|
|
5316
5316
|
|
|
@@ -5362,12 +5362,12 @@ class ApiClient {
|
|
|
5362
5362
|
}
|
|
5363
5363
|
|
|
5364
5364
|
async forceRefreshToken() {
|
|
5365
|
-
logger$
|
|
5365
|
+
logger$a.info('forcing refresh token, calling callback');
|
|
5366
5366
|
return this.refreshTokenCallback();
|
|
5367
5367
|
}
|
|
5368
5368
|
|
|
5369
5369
|
async refreshTokenCallback() {
|
|
5370
|
-
logger$
|
|
5370
|
+
logger$a.info('refresh token callback called', {
|
|
5371
5371
|
refreshToken: this.refreshToken,
|
|
5372
5372
|
refreshBackend: this.refreshBackend,
|
|
5373
5373
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5385,7 +5385,7 @@ class ApiClient {
|
|
|
5385
5385
|
this.isMobile,
|
|
5386
5386
|
);
|
|
5387
5387
|
|
|
5388
|
-
logger$
|
|
5388
|
+
logger$a.info('token refreshed', { token: session.token });
|
|
5389
5389
|
|
|
5390
5390
|
if (this.onRefreshToken) {
|
|
5391
5391
|
this.onRefreshToken(session.token, session);
|
|
@@ -5698,7 +5698,7 @@ class AdHocAPIConference {
|
|
|
5698
5698
|
|
|
5699
5699
|
/* */
|
|
5700
5700
|
|
|
5701
|
-
const parseCandidate = (candidate ) => {
|
|
5701
|
+
const parseCandidate$1 = (candidate ) => {
|
|
5702
5702
|
if (!candidate) {
|
|
5703
5703
|
return null;
|
|
5704
5704
|
}
|
|
@@ -5852,7 +5852,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5852
5852
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
5853
5853
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
5854
5854
|
if (event.candidate) {
|
|
5855
|
-
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
5855
|
+
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
5856
5856
|
}
|
|
5857
5857
|
};
|
|
5858
5858
|
|
|
@@ -6316,7 +6316,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6316
6316
|
const SEND_STATS_DELAY = 5000;
|
|
6317
6317
|
|
|
6318
6318
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6319
|
-
const logger$
|
|
6319
|
+
const logger$9 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6320
6320
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6321
6321
|
|
|
6322
6322
|
// events
|
|
@@ -6330,14 +6330,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6330
6330
|
const MESSAGE = 'message';
|
|
6331
6331
|
const ACCEPTED = 'accepted';
|
|
6332
6332
|
const REJECTED = 'rejected';
|
|
6333
|
-
const ON_TRACK = 'onTrack';
|
|
6334
|
-
const ON_REINVITE = 'reinvite';
|
|
6333
|
+
const ON_TRACK$1 = 'onTrack';
|
|
6334
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
6335
6335
|
const ON_ERROR = 'onError';
|
|
6336
6336
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6337
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6338
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
6337
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6338
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6339
6339
|
|
|
6340
|
-
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6340
|
+
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6341
6341
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6342
6342
|
class CanceledCallError extends Error {}
|
|
6343
6343
|
|
|
@@ -6473,12 +6473,12 @@ class WebRTCClient extends Emitter {
|
|
|
6473
6473
|
this.MESSAGE = MESSAGE;
|
|
6474
6474
|
this.ACCEPTED = ACCEPTED;
|
|
6475
6475
|
this.REJECTED = REJECTED;
|
|
6476
|
-
this.ON_TRACK = ON_TRACK;
|
|
6477
|
-
this.ON_REINVITE = ON_REINVITE;
|
|
6476
|
+
this.ON_TRACK = ON_TRACK$1;
|
|
6477
|
+
this.ON_REINVITE = ON_REINVITE$1;
|
|
6478
6478
|
this.ON_ERROR = ON_ERROR;
|
|
6479
6479
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6480
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6481
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6480
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6481
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6482
6482
|
}
|
|
6483
6483
|
|
|
6484
6484
|
configureMedia(media ) {
|
|
@@ -6495,13 +6495,13 @@ class WebRTCClient extends Emitter {
|
|
|
6495
6495
|
|
|
6496
6496
|
createUserAgent(configOverrides ) {
|
|
6497
6497
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6498
|
-
logger$
|
|
6498
|
+
logger$9.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6499
6499
|
|
|
6500
6500
|
webRTCConfiguration.delegate = {
|
|
6501
6501
|
onConnect: this.onConnect.bind(this),
|
|
6502
6502
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6503
6503
|
onInvite: (invitation ) => {
|
|
6504
|
-
logger$
|
|
6504
|
+
logger$9.info('sdk webrtc on invite', {
|
|
6505
6505
|
method: 'delegate.onInvite',
|
|
6506
6506
|
id: invitation.id,
|
|
6507
6507
|
remoteURI: invitation.remoteURI,
|
|
@@ -6544,7 +6544,7 @@ class WebRTCClient extends Emitter {
|
|
|
6544
6544
|
}
|
|
6545
6545
|
|
|
6546
6546
|
onConnect() {
|
|
6547
|
-
logger$
|
|
6547
|
+
logger$9.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6548
6548
|
this.eventEmitter.emit(CONNECTED);
|
|
6549
6549
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6550
6550
|
this.registerer.waitingToggle(false);
|
|
@@ -6553,7 +6553,7 @@ class WebRTCClient extends Emitter {
|
|
|
6553
6553
|
}
|
|
6554
6554
|
|
|
6555
6555
|
async onDisconnect(error ) {
|
|
6556
|
-
logger$
|
|
6556
|
+
logger$9.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6557
6557
|
this.connectionPromise = null;
|
|
6558
6558
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6559
6559
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6578,37 +6578,37 @@ class WebRTCClient extends Emitter {
|
|
|
6578
6578
|
};
|
|
6579
6579
|
|
|
6580
6580
|
if (this.skipRegister) {
|
|
6581
|
-
logger$
|
|
6581
|
+
logger$9.info('sdk webrtc skip register...', logInfo);
|
|
6582
6582
|
return Promise.resolve();
|
|
6583
6583
|
}
|
|
6584
6584
|
|
|
6585
|
-
logger$
|
|
6585
|
+
logger$9.info('sdk webrtc registering...', logInfo);
|
|
6586
6586
|
|
|
6587
6587
|
if (!this.userAgent) {
|
|
6588
|
-
logger$
|
|
6588
|
+
logger$9.info('sdk webrtc recreating User Agent');
|
|
6589
6589
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6590
6590
|
}
|
|
6591
6591
|
if (!this.userAgent || this.isRegistered()) {
|
|
6592
|
-
logger$
|
|
6592
|
+
logger$9.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6593
6593
|
return Promise.resolve();
|
|
6594
6594
|
}
|
|
6595
6595
|
|
|
6596
6596
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6597
|
-
logger$
|
|
6597
|
+
logger$9.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6598
6598
|
return Promise.resolve();
|
|
6599
6599
|
}
|
|
6600
6600
|
|
|
6601
6601
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6602
6602
|
|
|
6603
6603
|
const onRegisterFailed = () => {
|
|
6604
|
-
logger$
|
|
6604
|
+
logger$9.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6605
6605
|
this.connectionPromise = null;
|
|
6606
6606
|
if (this.registerer && this.registerer.waiting) {
|
|
6607
6607
|
this.registerer.waitingToggle(false);
|
|
6608
6608
|
}
|
|
6609
6609
|
|
|
6610
6610
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6611
|
-
logger$
|
|
6611
|
+
logger$9.info('sdk webrtc registering, retrying...', { tries });
|
|
6612
6612
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6613
6613
|
}
|
|
6614
6614
|
};
|
|
@@ -6617,18 +6617,18 @@ class WebRTCClient extends Emitter {
|
|
|
6617
6617
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6618
6618
|
// during the resolution of the primise.
|
|
6619
6619
|
if (!this.userAgent) {
|
|
6620
|
-
logger$
|
|
6620
|
+
logger$9.info('sdk webrtc recreating User Agent after connection');
|
|
6621
6621
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6622
6622
|
}
|
|
6623
6623
|
|
|
6624
|
-
logger$
|
|
6624
|
+
logger$9.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6625
6625
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
6626
6626
|
this.connectionPromise = null;
|
|
6627
6627
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6628
6628
|
|
|
6629
6629
|
// Bind registerer events
|
|
6630
6630
|
this.registerer.stateChange.addListener(newState => {
|
|
6631
|
-
logger$
|
|
6631
|
+
logger$9.info('sdk webrtc registering, state changed', { newState });
|
|
6632
6632
|
|
|
6633
6633
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
6634
6634
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -6641,7 +6641,7 @@ class WebRTCClient extends Emitter {
|
|
|
6641
6641
|
const options = {
|
|
6642
6642
|
requestDelegate: {
|
|
6643
6643
|
onReject: response => {
|
|
6644
|
-
logger$
|
|
6644
|
+
logger$9.error('sdk webrtc registering, rejected', { response });
|
|
6645
6645
|
|
|
6646
6646
|
onRegisterFailed();
|
|
6647
6647
|
},
|
|
@@ -6649,13 +6649,13 @@ class WebRTCClient extends Emitter {
|
|
|
6649
6649
|
};
|
|
6650
6650
|
|
|
6651
6651
|
return this.registerer.register(options).catch((e) => {
|
|
6652
|
-
logger$
|
|
6652
|
+
logger$9.error('sdk webrtc registering, error', e);
|
|
6653
6653
|
|
|
6654
6654
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6655
6655
|
return e;
|
|
6656
6656
|
});
|
|
6657
6657
|
}).catch(error => {
|
|
6658
|
-
logger$
|
|
6658
|
+
logger$9.error('sdk webrtc registering, transport error', error);
|
|
6659
6659
|
onRegisterFailed();
|
|
6660
6660
|
});
|
|
6661
6661
|
}
|
|
@@ -6684,21 +6684,21 @@ class WebRTCClient extends Emitter {
|
|
|
6684
6684
|
}
|
|
6685
6685
|
|
|
6686
6686
|
unregister() {
|
|
6687
|
-
logger$
|
|
6687
|
+
logger$9.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6688
6688
|
if (!this.registerer) {
|
|
6689
6689
|
return Promise.resolve();
|
|
6690
6690
|
}
|
|
6691
6691
|
|
|
6692
6692
|
try {
|
|
6693
6693
|
return this.registerer.unregister().then(() => {
|
|
6694
|
-
logger$
|
|
6694
|
+
logger$9.info('sdk webrtc unregistered');
|
|
6695
6695
|
this._cleanupRegister();
|
|
6696
6696
|
}).catch(e => {
|
|
6697
|
-
logger$
|
|
6697
|
+
logger$9.error('sdk webrtc unregistering, promise error', e);
|
|
6698
6698
|
this._cleanupRegister();
|
|
6699
6699
|
});
|
|
6700
6700
|
} catch (e) {
|
|
6701
|
-
logger$
|
|
6701
|
+
logger$9.error('sdk webrtc unregistering, error', e);
|
|
6702
6702
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6703
6703
|
// error when the registerer is in a bad state
|
|
6704
6704
|
this._cleanupRegister();
|
|
@@ -6706,7 +6706,7 @@ class WebRTCClient extends Emitter {
|
|
|
6706
6706
|
}
|
|
6707
6707
|
|
|
6708
6708
|
stop() {
|
|
6709
|
-
logger$
|
|
6709
|
+
logger$9.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6710
6710
|
if (!this.userAgent) {
|
|
6711
6711
|
return Promise.resolve();
|
|
6712
6712
|
}
|
|
@@ -6714,12 +6714,12 @@ class WebRTCClient extends Emitter {
|
|
|
6714
6714
|
return this.userAgent.stop().then(() => {
|
|
6715
6715
|
return this._cleanupRegister();
|
|
6716
6716
|
}).catch(e => {
|
|
6717
|
-
logger$
|
|
6717
|
+
logger$9.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6718
6718
|
});
|
|
6719
6719
|
}
|
|
6720
6720
|
|
|
6721
6721
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6722
|
-
logger$
|
|
6722
|
+
logger$9.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6723
6723
|
const inviterOptions = {
|
|
6724
6724
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6725
6725
|
conference,
|
|
@@ -6750,7 +6750,7 @@ class WebRTCClient extends Emitter {
|
|
|
6750
6750
|
this._onAccepted(session, response.session, true);
|
|
6751
6751
|
},
|
|
6752
6752
|
onReject: (response ) => {
|
|
6753
|
-
logger$
|
|
6753
|
+
logger$9.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
6754
6754
|
this._stopSendingStats(session);
|
|
6755
6755
|
this.stopNetworkMonitoring(session);
|
|
6756
6756
|
|
|
@@ -6773,11 +6773,11 @@ class WebRTCClient extends Emitter {
|
|
|
6773
6773
|
}
|
|
6774
6774
|
|
|
6775
6775
|
answer(session , enableVideo ) {
|
|
6776
|
-
logger$
|
|
6776
|
+
logger$9.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
6777
6777
|
|
|
6778
6778
|
if (!session || !session.accept) {
|
|
6779
6779
|
const error = 'No session to answer, or not an invitation';
|
|
6780
|
-
logger$
|
|
6780
|
+
logger$9.warn(error);
|
|
6781
6781
|
return Promise.reject(new Error(error));
|
|
6782
6782
|
}
|
|
6783
6783
|
const options = {
|
|
@@ -6787,15 +6787,15 @@ class WebRTCClient extends Emitter {
|
|
|
6787
6787
|
return session.accept(options).then(() => {
|
|
6788
6788
|
if (session.isCanceled) {
|
|
6789
6789
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
6790
|
-
logger$
|
|
6790
|
+
logger$9.error(message, { id: session.id });
|
|
6791
6791
|
this.onCallEnded(session);
|
|
6792
6792
|
|
|
6793
6793
|
throw new CanceledCallError(message);
|
|
6794
6794
|
}
|
|
6795
|
-
logger$
|
|
6795
|
+
logger$9.info('sdk webrtc answer, accepted.');
|
|
6796
6796
|
this._onAccepted(session);
|
|
6797
6797
|
}).catch(e => {
|
|
6798
|
-
logger$
|
|
6798
|
+
logger$9.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
6799
6799
|
|
|
6800
6800
|
throw e;
|
|
6801
6801
|
});
|
|
@@ -6803,7 +6803,7 @@ class WebRTCClient extends Emitter {
|
|
|
6803
6803
|
|
|
6804
6804
|
hangup(session ) {
|
|
6805
6805
|
const { state, id } = session;
|
|
6806
|
-
logger$
|
|
6806
|
+
logger$9.info('sdk webrtc hangup call', { id, state });
|
|
6807
6807
|
|
|
6808
6808
|
try {
|
|
6809
6809
|
this._stopSendingStats(session);
|
|
@@ -6832,7 +6832,7 @@ class WebRTCClient extends Emitter {
|
|
|
6832
6832
|
|
|
6833
6833
|
return bye();
|
|
6834
6834
|
} catch (error) {
|
|
6835
|
-
logger$
|
|
6835
|
+
logger$9.warn('sdk webrtc hangup, error', error);
|
|
6836
6836
|
}
|
|
6837
6837
|
|
|
6838
6838
|
return null;
|
|
@@ -6850,7 +6850,7 @@ class WebRTCClient extends Emitter {
|
|
|
6850
6850
|
// Fetch and emit an event at `interval` with session network stats
|
|
6851
6851
|
startNetworkMonitoring(session , interval = 1000) {
|
|
6852
6852
|
const sessionId = this.getSipSessionId(session);
|
|
6853
|
-
logger$
|
|
6853
|
+
logger$9.info('starting network inspection', { id: sessionId });
|
|
6854
6854
|
|
|
6855
6855
|
this.sessionNetworkStats[sessionId] = [];
|
|
6856
6856
|
|
|
@@ -6860,7 +6860,7 @@ class WebRTCClient extends Emitter {
|
|
|
6860
6860
|
stopNetworkMonitoring(session ) {
|
|
6861
6861
|
const sessionId = this.getSipSessionId(session);
|
|
6862
6862
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
6863
|
-
logger$
|
|
6863
|
+
logger$9.info('stopping network inspection', { id: sessionId, exists });
|
|
6864
6864
|
|
|
6865
6865
|
if (exists) {
|
|
6866
6866
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -6870,17 +6870,17 @@ class WebRTCClient extends Emitter {
|
|
|
6870
6870
|
}
|
|
6871
6871
|
|
|
6872
6872
|
reject(session ) {
|
|
6873
|
-
logger$
|
|
6873
|
+
logger$9.info('sdk webrtc reject call', { id: session.id });
|
|
6874
6874
|
|
|
6875
6875
|
try {
|
|
6876
6876
|
return session.reject ? session.reject() : session.cancel();
|
|
6877
6877
|
} catch (e) {
|
|
6878
|
-
logger$
|
|
6878
|
+
logger$9.warn('Error when rejecting call', e.message, e.stack);
|
|
6879
6879
|
}
|
|
6880
6880
|
}
|
|
6881
6881
|
|
|
6882
6882
|
async close() {
|
|
6883
|
-
logger$
|
|
6883
|
+
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6884
6884
|
this._cleanupMedia();
|
|
6885
6885
|
this.connectionPromise = null;
|
|
6886
6886
|
|
|
@@ -6911,7 +6911,7 @@ class WebRTCClient extends Emitter {
|
|
|
6911
6911
|
// eg: "INVITE not rejectable in state Completed"
|
|
6912
6912
|
}
|
|
6913
6913
|
this.userAgent = null;
|
|
6914
|
-
logger$
|
|
6914
|
+
logger$9.info('sdk webrtc client closed');
|
|
6915
6915
|
}
|
|
6916
6916
|
|
|
6917
6917
|
getNumber(session ) {
|
|
@@ -6924,13 +6924,13 @@ class WebRTCClient extends Emitter {
|
|
|
6924
6924
|
}
|
|
6925
6925
|
|
|
6926
6926
|
mute(session ) {
|
|
6927
|
-
logger$
|
|
6927
|
+
logger$9.info('sdk webrtc mute', { id: session.id });
|
|
6928
6928
|
|
|
6929
6929
|
this._toggleAudio(session, true);
|
|
6930
6930
|
}
|
|
6931
6931
|
|
|
6932
6932
|
unmute(session ) {
|
|
6933
|
-
logger$
|
|
6933
|
+
logger$9.info('sdk webrtc unmute', { id: session.id });
|
|
6934
6934
|
|
|
6935
6935
|
this._toggleAudio(session, false);
|
|
6936
6936
|
}
|
|
@@ -6970,13 +6970,13 @@ class WebRTCClient extends Emitter {
|
|
|
6970
6970
|
}
|
|
6971
6971
|
|
|
6972
6972
|
toggleCameraOn(session ) {
|
|
6973
|
-
logger$
|
|
6973
|
+
logger$9.info('sdk webrtc toggle camera on', { id: session.id });
|
|
6974
6974
|
|
|
6975
6975
|
this._toggleVideo(session, false);
|
|
6976
6976
|
}
|
|
6977
6977
|
|
|
6978
6978
|
toggleCameraOff(session ) {
|
|
6979
|
-
logger$
|
|
6979
|
+
logger$9.info('sdk webrtc toggle camera off', { id: session.id });
|
|
6980
6980
|
|
|
6981
6981
|
this._toggleVideo(session, true);
|
|
6982
6982
|
}
|
|
@@ -6985,7 +6985,7 @@ class WebRTCClient extends Emitter {
|
|
|
6985
6985
|
const sessionId = this.getSipSessionId(session);
|
|
6986
6986
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
6987
6987
|
|
|
6988
|
-
logger$
|
|
6988
|
+
logger$9.info('sdk webrtc hold', {
|
|
6989
6989
|
sessionId,
|
|
6990
6990
|
keys: Object.keys(this.heldSessions),
|
|
6991
6991
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7034,7 +7034,7 @@ class WebRTCClient extends Emitter {
|
|
|
7034
7034
|
const sessionId = this.getSipSessionId(session);
|
|
7035
7035
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7036
7036
|
|
|
7037
|
-
logger$
|
|
7037
|
+
logger$9.info('sdk webrtc unhold', {
|
|
7038
7038
|
sessionId,
|
|
7039
7039
|
keys: Object.keys(this.heldSessions),
|
|
7040
7040
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7182,7 +7182,7 @@ class WebRTCClient extends Emitter {
|
|
|
7182
7182
|
if (!session.sessionDescriptionHandler) {
|
|
7183
7183
|
return;
|
|
7184
7184
|
}
|
|
7185
|
-
logger$
|
|
7185
|
+
logger$9.info('Sending DTMF', {
|
|
7186
7186
|
id: this.getSipSessionId(session),
|
|
7187
7187
|
tone,
|
|
7188
7188
|
});
|
|
@@ -7198,7 +7198,7 @@ class WebRTCClient extends Emitter {
|
|
|
7198
7198
|
transfer(session , target ) {
|
|
7199
7199
|
this.hold(session);
|
|
7200
7200
|
|
|
7201
|
-
logger$
|
|
7201
|
+
logger$9.info('Transfering a session', {
|
|
7202
7202
|
id: this.getSipSessionId(session),
|
|
7203
7203
|
target,
|
|
7204
7204
|
});
|
|
@@ -7220,17 +7220,17 @@ class WebRTCClient extends Emitter {
|
|
|
7220
7220
|
atxfer(session ) {
|
|
7221
7221
|
this.hold(session);
|
|
7222
7222
|
|
|
7223
|
-
logger$
|
|
7223
|
+
logger$9.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7224
7224
|
|
|
7225
7225
|
const result = {
|
|
7226
7226
|
newSession: null,
|
|
7227
7227
|
init: async (target ) => {
|
|
7228
|
-
logger$
|
|
7228
|
+
logger$9.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7229
7229
|
|
|
7230
7230
|
result.newSession = await this.call(target);
|
|
7231
7231
|
},
|
|
7232
7232
|
complete: () => {
|
|
7233
|
-
logger$
|
|
7233
|
+
logger$9.info('webrtc transfer completed', {
|
|
7234
7234
|
id: this.getSipSessionId(session),
|
|
7235
7235
|
referId: this.getSipSessionId(result.newSession),
|
|
7236
7236
|
});
|
|
@@ -7251,7 +7251,7 @@ class WebRTCClient extends Emitter {
|
|
|
7251
7251
|
return;
|
|
7252
7252
|
}
|
|
7253
7253
|
|
|
7254
|
-
logger$
|
|
7254
|
+
logger$9.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7255
7255
|
|
|
7256
7256
|
try {
|
|
7257
7257
|
sipSession.message({
|
|
@@ -7293,7 +7293,7 @@ class WebRTCClient extends Emitter {
|
|
|
7293
7293
|
}
|
|
7294
7294
|
|
|
7295
7295
|
changeAudioOutputVolume(volume ) {
|
|
7296
|
-
logger$
|
|
7296
|
+
logger$9.info('Changing audio output volume', { volume });
|
|
7297
7297
|
|
|
7298
7298
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7299
7299
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7305,7 +7305,7 @@ class WebRTCClient extends Emitter {
|
|
|
7305
7305
|
}
|
|
7306
7306
|
|
|
7307
7307
|
changeAudioOutputDevice(id ) {
|
|
7308
|
-
logger$
|
|
7308
|
+
logger$9.info('Changing audio output device', { id });
|
|
7309
7309
|
|
|
7310
7310
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7311
7311
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7322,7 +7322,7 @@ class WebRTCClient extends Emitter {
|
|
|
7322
7322
|
|
|
7323
7323
|
changeAudioInputDevice(id , session ) {
|
|
7324
7324
|
const currentId = this.getAudioDeviceId();
|
|
7325
|
-
logger$
|
|
7325
|
+
logger$9.info('setting audio input device', { id, currentId, session: !!session });
|
|
7326
7326
|
|
|
7327
7327
|
if (id === currentId) {
|
|
7328
7328
|
return null;
|
|
@@ -7368,7 +7368,7 @@ class WebRTCClient extends Emitter {
|
|
|
7368
7368
|
|
|
7369
7369
|
setVideoInputDevice(id ) {
|
|
7370
7370
|
const currentId = this.getVideoDeviceId();
|
|
7371
|
-
logger$
|
|
7371
|
+
logger$9.info('setting video input device', { id, currentId });
|
|
7372
7372
|
|
|
7373
7373
|
if (id === currentId) {
|
|
7374
7374
|
return null;
|
|
@@ -7393,7 +7393,7 @@ class WebRTCClient extends Emitter {
|
|
|
7393
7393
|
const sessionId = this.getSipSessionId(session);
|
|
7394
7394
|
const localStream = this.getLocalStream(sessionId);
|
|
7395
7395
|
|
|
7396
|
-
logger$
|
|
7396
|
+
logger$9.info('changing video input device', { id, sessionId });
|
|
7397
7397
|
|
|
7398
7398
|
// Release old video stream
|
|
7399
7399
|
if (localStream) {
|
|
@@ -7461,7 +7461,7 @@ class WebRTCClient extends Emitter {
|
|
|
7461
7461
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7462
7462
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7463
7463
|
|
|
7464
|
-
logger$
|
|
7464
|
+
logger$9.info('Sending reinvite', {
|
|
7465
7465
|
id: this.getSipSessionId(sipSession),
|
|
7466
7466
|
newConstraints,
|
|
7467
7467
|
conference,
|
|
@@ -7499,7 +7499,7 @@ class WebRTCClient extends Emitter {
|
|
|
7499
7499
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7500
7500
|
}
|
|
7501
7501
|
|
|
7502
|
-
logger$
|
|
7502
|
+
logger$9.info('on re-INVITE accepted', {
|
|
7503
7503
|
id: this.getSipSessionId(sipSession),
|
|
7504
7504
|
wasMuted,
|
|
7505
7505
|
shouldDoScreenSharing,
|
|
@@ -7517,7 +7517,7 @@ class WebRTCClient extends Emitter {
|
|
|
7517
7517
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7518
7518
|
}
|
|
7519
7519
|
|
|
7520
|
-
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7520
|
+
return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
|
|
7521
7521
|
},
|
|
7522
7522
|
},
|
|
7523
7523
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7674,7 +7674,7 @@ class WebRTCClient extends Emitter {
|
|
|
7674
7674
|
}
|
|
7675
7675
|
|
|
7676
7676
|
startHeartbeat() {
|
|
7677
|
-
logger$
|
|
7677
|
+
logger$9.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7678
7678
|
if (!this.userAgent) {
|
|
7679
7679
|
this.heartbeat.stop();
|
|
7680
7680
|
return;
|
|
@@ -7687,7 +7687,7 @@ class WebRTCClient extends Emitter {
|
|
|
7687
7687
|
}
|
|
7688
7688
|
|
|
7689
7689
|
stopHeartbeat() {
|
|
7690
|
-
logger$
|
|
7690
|
+
logger$9.info('sdk webrtc stop heartbeat');
|
|
7691
7691
|
this.heartbeat.stop();
|
|
7692
7692
|
}
|
|
7693
7693
|
|
|
@@ -7708,7 +7708,7 @@ class WebRTCClient extends Emitter {
|
|
|
7708
7708
|
}
|
|
7709
7709
|
|
|
7710
7710
|
attemptReconnection() {
|
|
7711
|
-
logger$
|
|
7711
|
+
logger$9.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7712
7712
|
if (!this.userAgent) {
|
|
7713
7713
|
return;
|
|
7714
7714
|
}
|
|
@@ -7733,7 +7733,7 @@ class WebRTCClient extends Emitter {
|
|
|
7733
7733
|
return;
|
|
7734
7734
|
}
|
|
7735
7735
|
|
|
7736
|
-
logger$
|
|
7736
|
+
logger$9.info('setting local media stream', {
|
|
7737
7737
|
sipSessionId,
|
|
7738
7738
|
tracks: newStream ? newStream.getTracks() : null,
|
|
7739
7739
|
});
|
|
@@ -7750,7 +7750,7 @@ class WebRTCClient extends Emitter {
|
|
|
7750
7750
|
|
|
7751
7751
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
7752
7752
|
|
|
7753
|
-
logger$
|
|
7753
|
+
logger$9.info('updating local stream', {
|
|
7754
7754
|
sipSessionId,
|
|
7755
7755
|
oldStream: !!oldStream,
|
|
7756
7756
|
tracks: newStream.getTracks(),
|
|
@@ -7770,7 +7770,7 @@ class WebRTCClient extends Emitter {
|
|
|
7770
7770
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
7771
7771
|
const pc = this.getPeerConnection(sessionId);
|
|
7772
7772
|
|
|
7773
|
-
logger$
|
|
7773
|
+
logger$9.info('Updating remote stream', {
|
|
7774
7774
|
sessionId,
|
|
7775
7775
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
7776
7776
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -7795,14 +7795,16 @@ class WebRTCClient extends Emitter {
|
|
|
7795
7795
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
7796
7796
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
7797
7797
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
7798
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
7798
7799
|
|
|
7799
|
-
logger$
|
|
7800
|
+
logger$9.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
7800
7801
|
|
|
7801
7802
|
return {
|
|
7802
7803
|
constraints: {
|
|
7803
7804
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
7804
7805
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
7805
|
-
video: screenSharing ? (isDesktop
|
|
7806
|
+
video: screenSharing ? (isDesktop
|
|
7807
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
7806
7808
|
: this._getVideoConstraints(enableVideo),
|
|
7807
7809
|
screen: screenSharing,
|
|
7808
7810
|
desktop: isDesktop,
|
|
@@ -7845,7 +7847,7 @@ class WebRTCClient extends Emitter {
|
|
|
7845
7847
|
}
|
|
7846
7848
|
|
|
7847
7849
|
_onTransportError() {
|
|
7848
|
-
logger$
|
|
7850
|
+
logger$9.error('on transport error');
|
|
7849
7851
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
7850
7852
|
this.attemptReconnection();
|
|
7851
7853
|
}
|
|
@@ -7854,7 +7856,7 @@ class WebRTCClient extends Emitter {
|
|
|
7854
7856
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
7855
7857
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
7856
7858
|
if (this.hasHeartbeat()) {
|
|
7857
|
-
logger$
|
|
7859
|
+
logger$9.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
7858
7860
|
|
|
7859
7861
|
this.heartbeat.onHeartbeat();
|
|
7860
7862
|
if (this.heartbeatCb) {
|
|
@@ -7865,7 +7867,7 @@ class WebRTCClient extends Emitter {
|
|
|
7865
7867
|
}
|
|
7866
7868
|
|
|
7867
7869
|
async _onHeartbeatTimeout() {
|
|
7868
|
-
logger$
|
|
7870
|
+
logger$9.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7869
7871
|
|
|
7870
7872
|
if (this.heartbeatTimeoutCb) {
|
|
7871
7873
|
this.heartbeatTimeoutCb();
|
|
@@ -7877,7 +7879,7 @@ class WebRTCClient extends Emitter {
|
|
|
7877
7879
|
try {
|
|
7878
7880
|
await this.userAgent.transport.disconnect();
|
|
7879
7881
|
} catch (e) {
|
|
7880
|
-
logger$
|
|
7882
|
+
logger$9.error('Transport disconnection after heartbeat timeout, error', e);
|
|
7881
7883
|
}
|
|
7882
7884
|
}
|
|
7883
7885
|
|
|
@@ -7910,31 +7912,31 @@ class WebRTCClient extends Emitter {
|
|
|
7910
7912
|
}
|
|
7911
7913
|
|
|
7912
7914
|
_connectIfNeeded() {
|
|
7913
|
-
logger$
|
|
7915
|
+
logger$9.info('connect if needed, checking', { connected: this.isConnected() });
|
|
7914
7916
|
if (!this.userAgent) {
|
|
7915
|
-
logger$
|
|
7917
|
+
logger$9.info('need to recreate User Agent');
|
|
7916
7918
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
7917
7919
|
}
|
|
7918
7920
|
|
|
7919
7921
|
if (this.isConnected()) {
|
|
7920
|
-
logger$
|
|
7922
|
+
logger$9.info('webrtc sdk, already connected');
|
|
7921
7923
|
return Promise.resolve();
|
|
7922
7924
|
}
|
|
7923
7925
|
|
|
7924
7926
|
if (this.isConnecting()) {
|
|
7925
|
-
logger$
|
|
7927
|
+
logger$9.info('webrtc sdk, already connecting...');
|
|
7926
7928
|
|
|
7927
7929
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
7928
7930
|
return this.connectionPromise;
|
|
7929
7931
|
}
|
|
7930
7932
|
|
|
7931
7933
|
if (this.connectionPromise) {
|
|
7932
|
-
logger$
|
|
7934
|
+
logger$9.info('webrtc sdk, connection promise connecting...');
|
|
7933
7935
|
// $FlowFixMe
|
|
7934
7936
|
return this.connectionPromise;
|
|
7935
7937
|
}
|
|
7936
7938
|
|
|
7937
|
-
logger$
|
|
7939
|
+
logger$9.info('WebRTC UA needs to connect');
|
|
7938
7940
|
|
|
7939
7941
|
// Force UA to reconnect
|
|
7940
7942
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -8059,7 +8061,7 @@ class WebRTCClient extends Emitter {
|
|
|
8059
8061
|
|
|
8060
8062
|
sdh.peerConnectionDelegate = {
|
|
8061
8063
|
onicecandidateerror: (error ) => {
|
|
8062
|
-
logger$
|
|
8064
|
+
logger$9.error('on icecandidate error', {
|
|
8063
8065
|
address: error.address,
|
|
8064
8066
|
port: error.port,
|
|
8065
8067
|
errorCode: error.errorCode,
|
|
@@ -8088,7 +8090,7 @@ class WebRTCClient extends Emitter {
|
|
|
8088
8090
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8089
8091
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8090
8092
|
}
|
|
8091
|
-
logger$
|
|
8093
|
+
logger$9.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8092
8094
|
|
|
8093
8095
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8094
8096
|
|
|
@@ -8104,12 +8106,12 @@ class WebRTCClient extends Emitter {
|
|
|
8104
8106
|
|
|
8105
8107
|
this._setupMedias(session);
|
|
8106
8108
|
|
|
8107
|
-
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8109
|
+
return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8108
8110
|
};
|
|
8109
8111
|
}
|
|
8110
8112
|
|
|
8111
8113
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8112
|
-
logger$
|
|
8114
|
+
logger$9.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8113
8115
|
|
|
8114
8116
|
this.storeSipSession(session);
|
|
8115
8117
|
|
|
@@ -8121,14 +8123,14 @@ class WebRTCClient extends Emitter {
|
|
|
8121
8123
|
const onTrack = (event ) => {
|
|
8122
8124
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8123
8125
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8124
|
-
logger$
|
|
8126
|
+
logger$9.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8125
8127
|
|
|
8126
8128
|
// Stop video track in audio only mode
|
|
8127
8129
|
if (isAudioOnly && kind === 'video') {
|
|
8128
8130
|
event.track.stop();
|
|
8129
8131
|
}
|
|
8130
8132
|
|
|
8131
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8133
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
8132
8134
|
};
|
|
8133
8135
|
|
|
8134
8136
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8137,12 +8139,14 @@ class WebRTCClient extends Emitter {
|
|
|
8137
8139
|
|
|
8138
8140
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8139
8141
|
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8145
|
-
|
|
8142
|
+
if (pc) {
|
|
8143
|
+
pc.oniceconnectionstatechange = () => {
|
|
8144
|
+
logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8145
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8146
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8147
|
+
}
|
|
8148
|
+
};
|
|
8149
|
+
}
|
|
8146
8150
|
|
|
8147
8151
|
if (withEvent) {
|
|
8148
8152
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8311,10 +8315,10 @@ class WebRTCClient extends Emitter {
|
|
|
8311
8315
|
|
|
8312
8316
|
_stopSendingStats(session ) {
|
|
8313
8317
|
const sessionId = this.getSipSessionId(session);
|
|
8314
|
-
logger$
|
|
8318
|
+
logger$9.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8315
8319
|
|
|
8316
8320
|
if (sessionId in this.statsIntervals) {
|
|
8317
|
-
logger$
|
|
8321
|
+
logger$9.trace('Stop sending stats for call', { sessionId });
|
|
8318
8322
|
this.statsIntervals[sessionId]();
|
|
8319
8323
|
delete this.statsIntervals[sessionId];
|
|
8320
8324
|
}
|
|
@@ -8330,7 +8334,7 @@ class WebRTCClient extends Emitter {
|
|
|
8330
8334
|
try {
|
|
8331
8335
|
await this.userAgent.transport.disconnect();
|
|
8332
8336
|
} catch (e) {
|
|
8333
|
-
logger$
|
|
8337
|
+
logger$9.error('WebRTC transport disconnect, error', e);
|
|
8334
8338
|
}
|
|
8335
8339
|
}
|
|
8336
8340
|
}
|
|
@@ -8352,13 +8356,17 @@ class WebRTCClient extends Emitter {
|
|
|
8352
8356
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8353
8357
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8354
8358
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8359
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8355
8360
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8356
8361
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8362
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8357
8363
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8358
8364
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8359
8365
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8360
|
-
let audioBytesSent = 0;
|
|
8361
|
-
let audioBytesReceived = 0;
|
|
8366
|
+
let audioBytesSent = 0; // content + header
|
|
8367
|
+
let audioBytesReceived = 0; // content + header
|
|
8368
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8369
|
+
let audioContentReceived = 0;
|
|
8362
8370
|
let videoBytesSent = 0;
|
|
8363
8371
|
let videoBytesReceived = 0;
|
|
8364
8372
|
let transportSent = 0;
|
|
@@ -8368,6 +8376,7 @@ class WebRTCClient extends Emitter {
|
|
|
8368
8376
|
stats.forEach(report => {
|
|
8369
8377
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8370
8378
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8379
|
+
audioContentSent += Number(report.bytesSent);
|
|
8371
8380
|
}
|
|
8372
8381
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8373
8382
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -8379,6 +8388,7 @@ class WebRTCClient extends Emitter {
|
|
|
8379
8388
|
packetsLost += Number(report.packetsLost);
|
|
8380
8389
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8381
8390
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8391
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8382
8392
|
}
|
|
8383
8393
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8384
8394
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -8407,10 +8417,17 @@ class WebRTCClient extends Emitter {
|
|
|
8407
8417
|
});
|
|
8408
8418
|
|
|
8409
8419
|
networkStats.packetsLost = packetsLost;
|
|
8420
|
+
|
|
8410
8421
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8411
8422
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8412
8423
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8413
8424
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8425
|
+
|
|
8426
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8427
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8428
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8429
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8430
|
+
|
|
8414
8431
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8415
8432
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8416
8433
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8424,7 +8441,7 @@ class WebRTCClient extends Emitter {
|
|
|
8424
8441
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8425
8442
|
+ networkStats.transportSent;
|
|
8426
8443
|
|
|
8427
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8444
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8428
8445
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8429
8446
|
}
|
|
8430
8447
|
|
|
@@ -8452,8 +8469,8 @@ const ON_CALL_FAILED = 'onCallFailed';
|
|
|
8452
8469
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8453
8470
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8454
8471
|
const ON_MESSAGE = 'onMessage';
|
|
8455
|
-
const ON_REINVITE
|
|
8456
|
-
const ON_TRACK
|
|
8472
|
+
const ON_REINVITE = 'reinvite';
|
|
8473
|
+
const ON_TRACK = 'onTrack';
|
|
8457
8474
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8458
8475
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8459
8476
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8468,15 +8485,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8468
8485
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8469
8486
|
const ON_CALL_ERROR = 'onCallError';
|
|
8470
8487
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8471
|
-
const ON_NETWORK_STATS
|
|
8488
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8472
8489
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8473
8490
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8474
|
-
const ON_DISCONNECTED
|
|
8491
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
8475
8492
|
|
|
8476
8493
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8477
8494
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8478
8495
|
|
|
8479
|
-
const events
|
|
8496
|
+
const events = [
|
|
8480
8497
|
ON_USER_AGENT,
|
|
8481
8498
|
ON_REGISTERED,
|
|
8482
8499
|
ON_UNREGISTERED,
|
|
@@ -8494,8 +8511,8 @@ const events$1 = [
|
|
|
8494
8511
|
ON_CALL_FAILED,
|
|
8495
8512
|
ON_CALL_ENDED,
|
|
8496
8513
|
ON_MESSAGE,
|
|
8497
|
-
ON_REINVITE
|
|
8498
|
-
ON_TRACK
|
|
8514
|
+
ON_REINVITE,
|
|
8515
|
+
ON_TRACK,
|
|
8499
8516
|
ON_AUDIO_STREAM,
|
|
8500
8517
|
ON_VIDEO_STREAM,
|
|
8501
8518
|
ON_REMOVE_STREAM,
|
|
@@ -8510,11 +8527,11 @@ const events$1 = [
|
|
|
8510
8527
|
ON_CALL_ERROR,
|
|
8511
8528
|
ON_CHAT,
|
|
8512
8529
|
ON_SIGNAL,
|
|
8513
|
-
ON_NETWORK_STATS
|
|
8514
|
-
ON_DISCONNECTED
|
|
8530
|
+
ON_NETWORK_STATS,
|
|
8531
|
+
ON_DISCONNECTED,
|
|
8515
8532
|
];
|
|
8516
8533
|
|
|
8517
|
-
const logger$
|
|
8534
|
+
const logger$8 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8518
8535
|
|
|
8519
8536
|
class WebRTCPhone extends Emitter {
|
|
8520
8537
|
|
|
@@ -8587,7 +8604,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8587
8604
|
}).catch(error => {
|
|
8588
8605
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8589
8606
|
console.error('register error', error, error.message, error.stack);
|
|
8590
|
-
logger$
|
|
8607
|
+
logger$8.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8591
8608
|
});
|
|
8592
8609
|
}
|
|
8593
8610
|
|
|
@@ -8602,7 +8619,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8602
8619
|
if (!this.client) {
|
|
8603
8620
|
return;
|
|
8604
8621
|
}
|
|
8605
|
-
logger$
|
|
8622
|
+
logger$8.info('WebRTC phone stop');
|
|
8606
8623
|
this.client.stop();
|
|
8607
8624
|
}
|
|
8608
8625
|
|
|
@@ -8617,11 +8634,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8617
8634
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8618
8635
|
audioOnly = false, iceRestart = false) {
|
|
8619
8636
|
const sipSession = this.findSipSession(callSession);
|
|
8620
|
-
logger$
|
|
8637
|
+
logger$8.info('WebRTC phone - send reinvite', {
|
|
8621
8638
|
sessionId: sipSession ? sipSession.id : null,
|
|
8622
8639
|
constraints,
|
|
8623
8640
|
audioOnly,
|
|
8624
8641
|
conference,
|
|
8642
|
+
iceRestart,
|
|
8625
8643
|
});
|
|
8626
8644
|
|
|
8627
8645
|
if (!sipSession) {
|
|
@@ -8654,7 +8672,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8654
8672
|
}
|
|
8655
8673
|
|
|
8656
8674
|
startHeartbeat() {
|
|
8657
|
-
logger$
|
|
8675
|
+
logger$8.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8658
8676
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8659
8677
|
return;
|
|
8660
8678
|
}
|
|
@@ -8663,7 +8681,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8663
8681
|
}
|
|
8664
8682
|
|
|
8665
8683
|
stopHeartbeat() {
|
|
8666
|
-
logger$
|
|
8684
|
+
logger$8.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8667
8685
|
if (!this.client) {
|
|
8668
8686
|
return;
|
|
8669
8687
|
}
|
|
@@ -8680,7 +8698,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8680
8698
|
}
|
|
8681
8699
|
|
|
8682
8700
|
reconnect() {
|
|
8683
|
-
logger$
|
|
8701
|
+
logger$8.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8684
8702
|
if (!this.client) {
|
|
8685
8703
|
return;
|
|
8686
8704
|
}
|
|
@@ -8721,7 +8739,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8721
8739
|
return false;
|
|
8722
8740
|
}
|
|
8723
8741
|
|
|
8724
|
-
logger$
|
|
8742
|
+
logger$8.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8725
8743
|
|
|
8726
8744
|
this.client.downgradeToAudio(sipSession);
|
|
8727
8745
|
|
|
@@ -8744,7 +8762,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8744
8762
|
return Promise.resolve(false);
|
|
8745
8763
|
}
|
|
8746
8764
|
|
|
8747
|
-
logger$
|
|
8765
|
+
logger$8.info('Upgrade to video', {
|
|
8748
8766
|
id: callSession ? callSession.getId() : null,
|
|
8749
8767
|
constraints,
|
|
8750
8768
|
isConference,
|
|
@@ -8784,7 +8802,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8784
8802
|
|
|
8785
8803
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
8786
8804
|
const sipSession = this.findSipSession(callSession);
|
|
8787
|
-
logger$
|
|
8805
|
+
logger$8.info('Sending reinvite message', {
|
|
8788
8806
|
id: callSession ? callSession.getId() : null,
|
|
8789
8807
|
isUpgrade,
|
|
8790
8808
|
});
|
|
@@ -8810,7 +8828,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8810
8828
|
// Monkey patch to know when canceled with the CANCEL message
|
|
8811
8829
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
8812
8830
|
sipSession._onCancel = (message ) => {
|
|
8813
|
-
logger$
|
|
8831
|
+
logger$8.trace('on sip session canceled', { callId: message.callId });
|
|
8814
8832
|
|
|
8815
8833
|
onCancel(message);
|
|
8816
8834
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -8838,13 +8856,13 @@ class WebRTCPhone extends Emitter {
|
|
|
8838
8856
|
this.audioOutputVolume,
|
|
8839
8857
|
);
|
|
8840
8858
|
case sessionState.SessionState.Terminating:
|
|
8841
|
-
logger$
|
|
8859
|
+
logger$8.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
8842
8860
|
|
|
8843
8861
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
8844
8862
|
|
|
8845
8863
|
break;
|
|
8846
8864
|
case sessionState.SessionState.Terminated: {
|
|
8847
|
-
logger$
|
|
8865
|
+
logger$8.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
8848
8866
|
|
|
8849
8867
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8850
8868
|
const callSession = this._createCallSession(sipSession);
|
|
@@ -8866,7 +8884,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8866
8884
|
const [stream] = event.streams;
|
|
8867
8885
|
const kind = event && event.track && event.track.kind;
|
|
8868
8886
|
|
|
8869
|
-
logger$
|
|
8887
|
+
logger$8.info('on track stream called on the peer connection', {
|
|
8870
8888
|
callId: this.getSipSessionId(sipSession),
|
|
8871
8889
|
streamId: stream ? stream.id : null,
|
|
8872
8890
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -8886,7 +8904,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8886
8904
|
};
|
|
8887
8905
|
|
|
8888
8906
|
peerConnection.onremovestream = event => {
|
|
8889
|
-
logger$
|
|
8907
|
+
logger$8.info('on remove stream called on the peer connection', {
|
|
8890
8908
|
id: event.stream.id,
|
|
8891
8909
|
tracks: event.stream.getTracks(),
|
|
8892
8910
|
});
|
|
@@ -8896,7 +8914,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8896
8914
|
}
|
|
8897
8915
|
|
|
8898
8916
|
async startScreenSharing(constraints , callSession ) {
|
|
8899
|
-
logger$
|
|
8917
|
+
logger$8.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
8900
8918
|
|
|
8901
8919
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
8902
8920
|
if (!screenShareStream) {
|
|
@@ -8936,7 +8954,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8936
8954
|
return;
|
|
8937
8955
|
}
|
|
8938
8956
|
|
|
8939
|
-
logger$
|
|
8957
|
+
logger$8.info('WebRTC phone - stop screen sharing', {
|
|
8940
8958
|
restoreLocalStream,
|
|
8941
8959
|
});
|
|
8942
8960
|
|
|
@@ -8992,7 +9010,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8992
9010
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
8993
9011
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
8994
9012
|
|
|
8995
|
-
logger$
|
|
9013
|
+
logger$8.info('WebRTC phone - on screensharing', {
|
|
8996
9014
|
hadVideo,
|
|
8997
9015
|
id: this.getSipSessionId(sipSession),
|
|
8998
9016
|
screenTrack,
|
|
@@ -9000,7 +9018,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9000
9018
|
|
|
9001
9019
|
if (screenTrack) {
|
|
9002
9020
|
screenTrack.onended = () => {
|
|
9003
|
-
logger$
|
|
9021
|
+
logger$8.info('WebRTC phone - on screenshare ended', {
|
|
9004
9022
|
hadVideo,
|
|
9005
9023
|
id: this.getSipSessionId(sipSession),
|
|
9006
9024
|
screenTrack,
|
|
@@ -9031,7 +9049,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9031
9049
|
}
|
|
9032
9050
|
|
|
9033
9051
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9034
|
-
logger$
|
|
9052
|
+
logger$8.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9035
9053
|
|
|
9036
9054
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9037
9055
|
this.currentSipSession = sipSession;
|
|
@@ -9049,7 +9067,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9049
9067
|
}
|
|
9050
9068
|
|
|
9051
9069
|
changeAudioDevice(id ) {
|
|
9052
|
-
logger$
|
|
9070
|
+
logger$8.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9053
9071
|
this.audioOutputDeviceId = id;
|
|
9054
9072
|
this.client.changeAudioOutputDevice(id);
|
|
9055
9073
|
}
|
|
@@ -9059,14 +9077,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9059
9077
|
}
|
|
9060
9078
|
|
|
9061
9079
|
changeRingDevice(id ) {
|
|
9062
|
-
logger$
|
|
9080
|
+
logger$8.info('WebRTC phone - changing ring device', { id });
|
|
9063
9081
|
|
|
9064
9082
|
this.audioRingDeviceId = id;
|
|
9065
9083
|
}
|
|
9066
9084
|
|
|
9067
9085
|
// volume is a value between 0 and 1
|
|
9068
9086
|
changeAudioVolume(volume ) {
|
|
9069
|
-
logger$
|
|
9087
|
+
logger$8.info('WebRTC phone - changing audio volume', { volume });
|
|
9070
9088
|
|
|
9071
9089
|
this.audioOutputVolume = volume;
|
|
9072
9090
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9074,31 +9092,31 @@ class WebRTCPhone extends Emitter {
|
|
|
9074
9092
|
|
|
9075
9093
|
// volume is a value between 0 and 1
|
|
9076
9094
|
changeRingVolume(volume ) {
|
|
9077
|
-
logger$
|
|
9095
|
+
logger$8.info('WebRTC phone - changing ring volume', { volume });
|
|
9078
9096
|
|
|
9079
9097
|
this.audioRingVolume = volume;
|
|
9080
9098
|
}
|
|
9081
9099
|
|
|
9082
9100
|
changeAudioInputDevice(id ) {
|
|
9083
|
-
logger$
|
|
9101
|
+
logger$8.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9084
9102
|
|
|
9085
9103
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9086
9104
|
}
|
|
9087
9105
|
|
|
9088
9106
|
changeVideoInputDevice(id ) {
|
|
9089
|
-
logger$
|
|
9107
|
+
logger$8.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9090
9108
|
|
|
9091
9109
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9092
9110
|
}
|
|
9093
9111
|
|
|
9094
9112
|
changeSessionVideoInputDevice(id ) {
|
|
9095
|
-
logger$
|
|
9113
|
+
logger$8.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9096
9114
|
|
|
9097
9115
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9098
9116
|
}
|
|
9099
9117
|
|
|
9100
9118
|
_onCallTerminated(sipSession ) {
|
|
9101
|
-
logger$
|
|
9119
|
+
logger$8.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9102
9120
|
|
|
9103
9121
|
const callSession = this._createCallSession(sipSession);
|
|
9104
9122
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
@@ -9132,7 +9150,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9132
9150
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9133
9151
|
|
|
9134
9152
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9135
|
-
logger$
|
|
9153
|
+
logger$8.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9136
9154
|
sipId: sipSession.id,
|
|
9137
9155
|
shouldRetrigger,
|
|
9138
9156
|
hasIncomingCallSession,
|
|
@@ -9223,37 +9241,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9223
9241
|
|
|
9224
9242
|
// Deprecated
|
|
9225
9243
|
getLocalStreamForCall(callSession ) {
|
|
9226
|
-
logger$
|
|
9244
|
+
logger$8.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9227
9245
|
|
|
9228
9246
|
return this.getLocalStream(callSession);
|
|
9229
9247
|
}
|
|
9230
9248
|
|
|
9231
9249
|
// Deprecated
|
|
9232
9250
|
getRemoteStreamForCall(callSession ) {
|
|
9233
|
-
logger$
|
|
9251
|
+
logger$8.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9234
9252
|
|
|
9235
9253
|
return this.getRemoteVideoStream(callSession);
|
|
9236
9254
|
}
|
|
9237
9255
|
|
|
9238
9256
|
getRemoteStreamsForCall(callSession ) {
|
|
9239
|
-
logger$
|
|
9257
|
+
logger$8.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9240
9258
|
|
|
9241
9259
|
return this.getRemoteStream(callSession);
|
|
9242
9260
|
}
|
|
9243
9261
|
|
|
9244
9262
|
accept(callSession , cameraEnabled ) {
|
|
9245
|
-
logger$
|
|
9263
|
+
logger$8.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9246
9264
|
if (this.currentSipSession) {
|
|
9247
9265
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9248
9266
|
}
|
|
9249
9267
|
|
|
9250
9268
|
if (!callSession) {
|
|
9251
|
-
logger$
|
|
9269
|
+
logger$8.warn('no CallSession to accept.');
|
|
9252
9270
|
return Promise.resolve(null);
|
|
9253
9271
|
}
|
|
9254
9272
|
|
|
9255
9273
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9256
|
-
logger$
|
|
9274
|
+
logger$8.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9257
9275
|
return Promise.resolve(callSession.sipCallId);
|
|
9258
9276
|
}
|
|
9259
9277
|
|
|
@@ -9265,24 +9283,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9265
9283
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9266
9284
|
if (sipSession) {
|
|
9267
9285
|
if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
|
|
9268
|
-
logger$
|
|
9286
|
+
logger$8.warn('Trying to answer a terminated sipSession.');
|
|
9269
9287
|
|
|
9270
9288
|
return Promise.resolve(null);
|
|
9271
9289
|
}
|
|
9272
9290
|
|
|
9273
|
-
logger$
|
|
9291
|
+
logger$8.info('accept call, session found', { sipId: sipSession.id });
|
|
9274
9292
|
|
|
9275
9293
|
// $FlowFixMe
|
|
9276
9294
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9277
9295
|
return callSession.sipCallId;
|
|
9278
9296
|
}).catch(e => {
|
|
9279
|
-
logger$
|
|
9297
|
+
logger$8.error(e);
|
|
9280
9298
|
this.endCurrentCall(callSession);
|
|
9281
9299
|
throw e;
|
|
9282
9300
|
});
|
|
9283
9301
|
}
|
|
9284
9302
|
|
|
9285
|
-
logger$
|
|
9303
|
+
logger$8.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9286
9304
|
|
|
9287
9305
|
return Promise.resolve(null);
|
|
9288
9306
|
}
|
|
@@ -9292,7 +9310,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9292
9310
|
}
|
|
9293
9311
|
|
|
9294
9312
|
async reject(callSession ) {
|
|
9295
|
-
logger$
|
|
9313
|
+
logger$8.info('reject WebRTC called', { id: callSession.getId() });
|
|
9296
9314
|
|
|
9297
9315
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9298
9316
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9304,14 +9322,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9304
9322
|
|
|
9305
9323
|
const sipSession = this.findSipSession(callSession);
|
|
9306
9324
|
if (sipSession) {
|
|
9307
|
-
logger$
|
|
9325
|
+
logger$8.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9308
9326
|
|
|
9309
9327
|
this.client.hangup(sipSession);
|
|
9310
9328
|
}
|
|
9311
9329
|
}
|
|
9312
9330
|
|
|
9313
9331
|
async ignore(callSession ) {
|
|
9314
|
-
logger$
|
|
9332
|
+
logger$8.info('WebRTC ignore', { id: callSession.getId() });
|
|
9315
9333
|
|
|
9316
9334
|
// kill the ring
|
|
9317
9335
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9323,14 +9341,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9323
9341
|
const sipSession = this.findSipSession(callSession);
|
|
9324
9342
|
|
|
9325
9343
|
if (sipSession) {
|
|
9326
|
-
logger$
|
|
9344
|
+
logger$8.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9327
9345
|
|
|
9328
9346
|
return this.client.atxfer(sipSession);
|
|
9329
9347
|
}
|
|
9330
9348
|
}
|
|
9331
9349
|
|
|
9332
9350
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9333
|
-
logger$
|
|
9351
|
+
logger$8.info('WebRTC hold', { id: callSession.getId() });
|
|
9334
9352
|
|
|
9335
9353
|
const sipSession = this.findSipSession(callSession);
|
|
9336
9354
|
|
|
@@ -9345,18 +9363,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9345
9363
|
}
|
|
9346
9364
|
|
|
9347
9365
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9348
|
-
logger$
|
|
9366
|
+
logger$8.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9349
9367
|
|
|
9350
9368
|
const sipSession = this.findSipSession(callSession);
|
|
9351
9369
|
if (!sipSession) {
|
|
9352
9370
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9353
9371
|
}
|
|
9354
9372
|
|
|
9355
|
-
logger$
|
|
9373
|
+
logger$8.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9356
9374
|
|
|
9357
9375
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9358
9376
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9359
|
-
logger$
|
|
9377
|
+
logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9360
9378
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9361
9379
|
}
|
|
9362
9380
|
|
|
@@ -9381,7 +9399,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9381
9399
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9382
9400
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9383
9401
|
|
|
9384
|
-
logger$
|
|
9402
|
+
logger$8.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9385
9403
|
|
|
9386
9404
|
// Stop screenshre if needed
|
|
9387
9405
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9412,7 +9430,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9412
9430
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9413
9431
|
}
|
|
9414
9432
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9415
|
-
logger$
|
|
9433
|
+
logger$8.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9416
9434
|
|
|
9417
9435
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9418
9436
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9456,14 +9474,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9456
9474
|
}
|
|
9457
9475
|
|
|
9458
9476
|
mute(callSession , withEvent = true) {
|
|
9459
|
-
logger$
|
|
9477
|
+
logger$8.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9460
9478
|
|
|
9461
9479
|
const sipSession = this.findSipSession(callSession);
|
|
9462
9480
|
if (!sipSession) {
|
|
9463
9481
|
return;
|
|
9464
9482
|
}
|
|
9465
9483
|
|
|
9466
|
-
logger$
|
|
9484
|
+
logger$8.info('WebRTC muting', { sipId: sipSession.id });
|
|
9467
9485
|
this.client.mute(sipSession);
|
|
9468
9486
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9469
9487
|
|
|
@@ -9477,14 +9495,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9477
9495
|
}
|
|
9478
9496
|
|
|
9479
9497
|
unmute(callSession , withEvent = true) {
|
|
9480
|
-
logger$
|
|
9498
|
+
logger$8.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9481
9499
|
|
|
9482
9500
|
const sipSession = this.findSipSession(callSession);
|
|
9483
9501
|
if (!sipSession) {
|
|
9484
9502
|
return;
|
|
9485
9503
|
}
|
|
9486
9504
|
|
|
9487
|
-
logger$
|
|
9505
|
+
logger$8.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9488
9506
|
this.client.unmute(sipSession);
|
|
9489
9507
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9490
9508
|
|
|
@@ -9511,7 +9529,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9511
9529
|
if (!sipSession) {
|
|
9512
9530
|
return;
|
|
9513
9531
|
}
|
|
9514
|
-
logger$
|
|
9532
|
+
logger$8.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9515
9533
|
|
|
9516
9534
|
this.client.toggleCameraOn(sipSession);
|
|
9517
9535
|
|
|
@@ -9523,7 +9541,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9523
9541
|
if (!sipSession) {
|
|
9524
9542
|
return;
|
|
9525
9543
|
}
|
|
9526
|
-
logger$
|
|
9544
|
+
logger$8.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9527
9545
|
|
|
9528
9546
|
this.client.toggleCameraOff(sipSession);
|
|
9529
9547
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9535,7 +9553,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9535
9553
|
return;
|
|
9536
9554
|
}
|
|
9537
9555
|
|
|
9538
|
-
logger$
|
|
9556
|
+
logger$8.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9539
9557
|
this.client.sendDTMF(sipSession, tone);
|
|
9540
9558
|
}
|
|
9541
9559
|
|
|
@@ -9543,7 +9561,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9543
9561
|
// @TODO: line is not used here
|
|
9544
9562
|
async makeCall(number , line , cameraEnabled ,
|
|
9545
9563
|
audioOnly = false, conference = false) {
|
|
9546
|
-
logger$
|
|
9564
|
+
logger$8.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
9547
9565
|
if (!number) {
|
|
9548
9566
|
return Promise.resolve(null);
|
|
9549
9567
|
}
|
|
@@ -9553,7 +9571,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9553
9571
|
}
|
|
9554
9572
|
if (this.currentSipSession) {
|
|
9555
9573
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9556
|
-
logger$
|
|
9574
|
+
logger$8.warn('Unable to hold current session when making another call', e);
|
|
9557
9575
|
});
|
|
9558
9576
|
}
|
|
9559
9577
|
|
|
@@ -9563,7 +9581,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9563
9581
|
this._bindEvents(sipSession);
|
|
9564
9582
|
} catch (error) {
|
|
9565
9583
|
console.warn(error);
|
|
9566
|
-
logger$
|
|
9584
|
+
logger$8.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9567
9585
|
return Promise.resolve(null);
|
|
9568
9586
|
}
|
|
9569
9587
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
@@ -9591,7 +9609,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9591
9609
|
return;
|
|
9592
9610
|
}
|
|
9593
9611
|
|
|
9594
|
-
logger$
|
|
9612
|
+
logger$8.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9595
9613
|
|
|
9596
9614
|
this.client.transfer(sipSession, target);
|
|
9597
9615
|
}
|
|
@@ -9600,7 +9618,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9600
9618
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9601
9619
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9602
9620
|
|
|
9603
|
-
logger$
|
|
9621
|
+
logger$8.info('WebRTC indirect transfer', {
|
|
9604
9622
|
sipId: sipSession ? sipSession.id : null,
|
|
9605
9623
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9606
9624
|
});
|
|
@@ -9639,7 +9657,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9639
9657
|
return false;
|
|
9640
9658
|
}
|
|
9641
9659
|
|
|
9642
|
-
logger$
|
|
9660
|
+
logger$8.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9643
9661
|
|
|
9644
9662
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9645
9663
|
|
|
@@ -9685,7 +9703,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9685
9703
|
endCurrentCall(callSession ) {
|
|
9686
9704
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9687
9705
|
|
|
9688
|
-
logger$
|
|
9706
|
+
logger$8.info('Ending current call', {
|
|
9689
9707
|
id: callSession ? callSession.getId() : null,
|
|
9690
9708
|
isCurrent,
|
|
9691
9709
|
});
|
|
@@ -9709,7 +9727,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9709
9727
|
}
|
|
9710
9728
|
|
|
9711
9729
|
async close() {
|
|
9712
|
-
logger$
|
|
9730
|
+
logger$8.info('WebRTC close');
|
|
9713
9731
|
|
|
9714
9732
|
try {
|
|
9715
9733
|
await Promise.race([
|
|
@@ -9717,7 +9735,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9717
9735
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9718
9736
|
]);
|
|
9719
9737
|
} catch (e) {
|
|
9720
|
-
logger$
|
|
9738
|
+
logger$8.error('WebRTC close, unregister error', e);
|
|
9721
9739
|
}
|
|
9722
9740
|
|
|
9723
9741
|
this.client.close();
|
|
@@ -9735,12 +9753,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9735
9753
|
}
|
|
9736
9754
|
|
|
9737
9755
|
enableRinging() {
|
|
9738
|
-
logger$
|
|
9756
|
+
logger$8.info('WebRTC enable ringing');
|
|
9739
9757
|
this.ringingEnabled = true;
|
|
9740
9758
|
}
|
|
9741
9759
|
|
|
9742
9760
|
disableRinging() {
|
|
9743
|
-
logger$
|
|
9761
|
+
logger$8.info('WebRTC disable ringing');
|
|
9744
9762
|
this.ringingEnabled = false;
|
|
9745
9763
|
}
|
|
9746
9764
|
|
|
@@ -9780,7 +9798,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9780
9798
|
|
|
9781
9799
|
// Deprecated
|
|
9782
9800
|
getLocalMediaStream(callSession ) {
|
|
9783
|
-
logger$
|
|
9801
|
+
logger$8.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9784
9802
|
return this.getLocalStream(callSession);
|
|
9785
9803
|
}
|
|
9786
9804
|
|
|
@@ -9822,7 +9840,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9822
9840
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
9823
9841
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
9824
9842
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
9825
|
-
logger$
|
|
9843
|
+
logger$8.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
9826
9844
|
|
|
9827
9845
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
9828
9846
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -9845,7 +9863,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9845
9863
|
});
|
|
9846
9864
|
|
|
9847
9865
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
9848
|
-
logger$
|
|
9866
|
+
logger$8.info('WebRTC on reinvite', {
|
|
9849
9867
|
sessionId: args[0].id,
|
|
9850
9868
|
inviteId: args[1].id,
|
|
9851
9869
|
updatedCalleeName: args[2],
|
|
@@ -9865,7 +9883,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9865
9883
|
});
|
|
9866
9884
|
|
|
9867
9885
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
9868
|
-
logger$
|
|
9886
|
+
logger$8.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
9869
9887
|
|
|
9870
9888
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
9871
9889
|
|
|
@@ -9876,22 +9894,22 @@ class WebRTCPhone extends Emitter {
|
|
|
9876
9894
|
this.client.on('ended', () => {});
|
|
9877
9895
|
|
|
9878
9896
|
this.client.on(this.client.ON_ERROR, e => {
|
|
9879
|
-
logger$
|
|
9897
|
+
logger$8.error('WebRTC error', e);
|
|
9880
9898
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
9881
9899
|
});
|
|
9882
9900
|
|
|
9883
9901
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
9884
|
-
logger$
|
|
9902
|
+
logger$8.info('WebRTC unregistered');
|
|
9885
9903
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
9886
9904
|
});
|
|
9887
9905
|
|
|
9888
9906
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
9889
|
-
logger$
|
|
9890
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
9907
|
+
logger$8.info('WebRTC disconnected');
|
|
9908
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
9891
9909
|
});
|
|
9892
9910
|
|
|
9893
9911
|
this.client.on(this.client.REGISTERED, () => {
|
|
9894
|
-
logger$
|
|
9912
|
+
logger$8.info('WebRTC registered', {
|
|
9895
9913
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
9896
9914
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
9897
9915
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -9912,19 +9930,19 @@ class WebRTCPhone extends Emitter {
|
|
|
9912
9930
|
// Send reinvite with iceRestart
|
|
9913
9931
|
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
9914
9932
|
} catch (e) {
|
|
9915
|
-
logger$
|
|
9933
|
+
logger$8.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
9916
9934
|
}
|
|
9917
9935
|
}
|
|
9918
9936
|
});
|
|
9919
9937
|
|
|
9920
9938
|
this.client.on(this.client.CONNECTED, () => {
|
|
9921
|
-
logger$
|
|
9939
|
+
logger$8.info('WebRTC client connected');
|
|
9922
9940
|
|
|
9923
9941
|
this.stopHeartbeat();
|
|
9924
9942
|
});
|
|
9925
9943
|
|
|
9926
9944
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
9927
|
-
logger$
|
|
9945
|
+
logger$8.info('WebRTC client disconnected');
|
|
9928
9946
|
|
|
9929
9947
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
9930
9948
|
|
|
@@ -9938,7 +9956,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9938
9956
|
});
|
|
9939
9957
|
|
|
9940
9958
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
9941
|
-
this.eventEmitter.emit(ON_TRACK
|
|
9959
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
9942
9960
|
});
|
|
9943
9961
|
|
|
9944
9962
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -9953,7 +9971,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9953
9971
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
9954
9972
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
9955
9973
|
|
|
9956
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
9974
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
9957
9975
|
});
|
|
9958
9976
|
|
|
9959
9977
|
// Used when upgrading directly in screenshare mode
|
|
@@ -9962,7 +9980,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9962
9980
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
9963
9981
|
const callSession = this.callSessions[sipSessionId];
|
|
9964
9982
|
|
|
9965
|
-
logger$
|
|
9983
|
+
logger$8.info('Updrading directly in screensharing mode', {
|
|
9966
9984
|
sipSessionId,
|
|
9967
9985
|
tracks: localStream ? localStream.getTracks() : null,
|
|
9968
9986
|
});
|
|
@@ -10140,8 +10158,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10140
10158
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10141
10159
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10142
10160
|
ON_MESSAGE: ON_MESSAGE,
|
|
10143
|
-
ON_REINVITE: ON_REINVITE
|
|
10144
|
-
ON_TRACK: ON_TRACK
|
|
10161
|
+
ON_REINVITE: ON_REINVITE,
|
|
10162
|
+
ON_TRACK: ON_TRACK,
|
|
10145
10163
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10146
10164
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10147
10165
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10156,19 +10174,19 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10156
10174
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10157
10175
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10158
10176
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10159
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS
|
|
10177
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10160
10178
|
ON_CHAT: ON_CHAT,
|
|
10161
10179
|
ON_SIGNAL: ON_SIGNAL,
|
|
10162
|
-
ON_DISCONNECTED: ON_DISCONNECTED
|
|
10180
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10163
10181
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10164
10182
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10165
|
-
events: events
|
|
10183
|
+
events: events,
|
|
10166
10184
|
'default': WebRTCPhone
|
|
10167
10185
|
});
|
|
10168
10186
|
|
|
10169
10187
|
//
|
|
10170
10188
|
|
|
10171
|
-
const logger$
|
|
10189
|
+
const logger$7 = IssueReporter$1.loggerFor('simple-phone');
|
|
10172
10190
|
const sipLogger = IssueReporter$1.loggerFor('sip.js');
|
|
10173
10191
|
const protocolLogger = IssueReporter$1.loggerFor('sip');
|
|
10174
10192
|
|
|
@@ -10275,7 +10293,7 @@ class Phone extends Emitter {
|
|
|
10275
10293
|
async disconnect() {
|
|
10276
10294
|
if (this.phone) {
|
|
10277
10295
|
if (this.phone.hasAnActiveCall()) {
|
|
10278
|
-
logger$
|
|
10296
|
+
logger$7.info('hangup call on disconnect');
|
|
10279
10297
|
// $FlowFixMe
|
|
10280
10298
|
await this.phone.hangup();
|
|
10281
10299
|
}
|
|
@@ -10298,13 +10316,13 @@ class Phone extends Emitter {
|
|
|
10298
10316
|
}
|
|
10299
10317
|
|
|
10300
10318
|
async hangup(callSession ) {
|
|
10301
|
-
logger$
|
|
10319
|
+
logger$7.info('hangup via simple phone', { callId: callSession.getId() });
|
|
10302
10320
|
|
|
10303
10321
|
return this.phone && this.phone.hangup(callSession);
|
|
10304
10322
|
}
|
|
10305
10323
|
|
|
10306
10324
|
async accept(callSession , cameraEnabled ) {
|
|
10307
|
-
logger$
|
|
10325
|
+
logger$7.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
|
|
10308
10326
|
|
|
10309
10327
|
return this.phone && this.phone.accept(callSession, cameraEnabled);
|
|
10310
10328
|
}
|
|
@@ -10343,7 +10361,7 @@ class Phone extends Emitter {
|
|
|
10343
10361
|
muteViaAPI(callSession ) {
|
|
10344
10362
|
if (callSession && callSession.callId) {
|
|
10345
10363
|
Wazo.getApiClient().calld.mute(callSession.callId).catch(e => {
|
|
10346
|
-
logger$
|
|
10364
|
+
logger$7.error('Mute via API, error', e);
|
|
10347
10365
|
});
|
|
10348
10366
|
}
|
|
10349
10367
|
}
|
|
@@ -10351,7 +10369,7 @@ class Phone extends Emitter {
|
|
|
10351
10369
|
unmuteViaAPI(callSession ) {
|
|
10352
10370
|
if (callSession && callSession.callId) {
|
|
10353
10371
|
Wazo.getApiClient().calld.unmute(callSession.callId).catch(e => {
|
|
10354
|
-
logger$
|
|
10372
|
+
logger$7.error('Unmute via API, error', e);
|
|
10355
10373
|
});
|
|
10356
10374
|
}
|
|
10357
10375
|
}
|
|
@@ -10459,7 +10477,7 @@ class Phone extends Emitter {
|
|
|
10459
10477
|
|
|
10460
10478
|
// @Deprecated
|
|
10461
10479
|
getLocalMediaStream(callSession ) {
|
|
10462
|
-
logger$
|
|
10480
|
+
logger$7.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
|
|
10463
10481
|
|
|
10464
10482
|
return this.phone && this.phone.getLocalStream(callSession);
|
|
10465
10483
|
}
|
|
@@ -10482,20 +10500,20 @@ class Phone extends Emitter {
|
|
|
10482
10500
|
|
|
10483
10501
|
// @Deprecated
|
|
10484
10502
|
getRemoteStreamForCall(callSession ) {
|
|
10485
|
-
logger$
|
|
10503
|
+
logger$7.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
|
|
10486
10504
|
return this.getRemoteStream(callSession);
|
|
10487
10505
|
}
|
|
10488
10506
|
|
|
10489
10507
|
// Returns remote streams directly from the peerConnection
|
|
10490
10508
|
// @Deprecated
|
|
10491
10509
|
getRemoteStreamsForCall(callSession ) {
|
|
10492
|
-
logger$
|
|
10510
|
+
logger$7.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
|
|
10493
10511
|
return this.getLocalStream(callSession);
|
|
10494
10512
|
}
|
|
10495
10513
|
|
|
10496
10514
|
// @Deprecated
|
|
10497
10515
|
getRemoteVideoStreamForCall(callSession ) {
|
|
10498
|
-
logger$
|
|
10516
|
+
logger$7.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
|
|
10499
10517
|
|
|
10500
10518
|
return this.getRemoteVideoStream(callSession);
|
|
10501
10519
|
}
|
|
@@ -10556,7 +10574,7 @@ class Phone extends Emitter {
|
|
|
10556
10574
|
|
|
10557
10575
|
_transferEvents() {
|
|
10558
10576
|
this.unbind();
|
|
10559
|
-
[...events, ...transportEvents].forEach(event => {
|
|
10577
|
+
[...events$1, ...transportEvents].forEach(event => {
|
|
10560
10578
|
this.client.on(event, (...args) =>
|
|
10561
10579
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
10562
10580
|
});
|
|
@@ -10578,7 +10596,7 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
10578
10596
|
|
|
10579
10597
|
//
|
|
10580
10598
|
|
|
10581
|
-
const SOCKET_EVENTS = {
|
|
10599
|
+
const SOCKET_EVENTS$1 = {
|
|
10582
10600
|
ON_OPEN: 'onopen',
|
|
10583
10601
|
ON_MESSAGE: 'onmessage',
|
|
10584
10602
|
ON_ERROR: 'onerror',
|
|
@@ -10731,16 +10749,16 @@ class WebSocketClient extends Emitter {
|
|
|
10731
10749
|
|
|
10732
10750
|
this.socket.onopen = () => {
|
|
10733
10751
|
logger$6.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
10734
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
10752
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
|
|
10735
10753
|
};
|
|
10736
10754
|
|
|
10737
10755
|
this.socket.onerror = event => {
|
|
10738
10756
|
logger$6.error('on Wazo WS error', event.target);
|
|
10739
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
10757
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
|
|
10740
10758
|
};
|
|
10741
10759
|
|
|
10742
10760
|
this.socket.onmessage = (event ) => {
|
|
10743
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
10761
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
|
|
10744
10762
|
|
|
10745
10763
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
10746
10764
|
let { name } = message;
|
|
@@ -10773,11 +10791,11 @@ class WebSocketClient extends Emitter {
|
|
|
10773
10791
|
token: this.token,
|
|
10774
10792
|
});
|
|
10775
10793
|
this.initialized = false;
|
|
10776
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
10794
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
|
|
10777
10795
|
|
|
10778
10796
|
switch (event.code) {
|
|
10779
10797
|
case 4002:
|
|
10780
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
10798
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
|
|
10781
10799
|
break;
|
|
10782
10800
|
}
|
|
10783
10801
|
};
|
|
@@ -10893,7 +10911,7 @@ class WebSocketClient extends Emitter {
|
|
|
10893
10911
|
break;
|
|
10894
10912
|
case 'start':
|
|
10895
10913
|
this.initialized = true;
|
|
10896
|
-
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
10914
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
|
|
10897
10915
|
break;
|
|
10898
10916
|
default:
|
|
10899
10917
|
this.eventEmitter.emit('message', message);
|
|
@@ -10940,7 +10958,7 @@ class WebSocketClient extends Emitter {
|
|
|
10940
10958
|
logger$6.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
10941
10959
|
|
|
10942
10960
|
this.close();
|
|
10943
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
10961
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
10944
10962
|
|
|
10945
10963
|
if (this.onHeartBeatTimeout) {
|
|
10946
10964
|
this.onHeartBeatTimeout();
|
|
@@ -11020,7 +11038,7 @@ WebSocketClient.eventLists = [
|
|
|
11020
11038
|
|
|
11021
11039
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
11022
11040
|
__proto__: null,
|
|
11023
|
-
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
11041
|
+
SOCKET_EVENTS: SOCKET_EVENTS$1,
|
|
11024
11042
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
11025
11043
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
11026
11044
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -11093,10 +11111,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11093
11111
|
|
|
11094
11112
|
//
|
|
11095
11113
|
|
|
11096
|
-
const { SOCKET_EVENTS
|
|
11097
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS
|
|
11114
|
+
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11115
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
11098
11116
|
|
|
11099
|
-
const logger$
|
|
11117
|
+
const logger$5 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
11100
11118
|
|
|
11101
11119
|
class Websocket extends Emitter {
|
|
11102
11120
|
|
|
@@ -11110,9 +11128,9 @@ class Websocket extends Emitter {
|
|
|
11110
11128
|
// $FlowFixMe
|
|
11111
11129
|
this[key] = OTHER_EVENTS[key];
|
|
11112
11130
|
});
|
|
11113
|
-
Object.keys(SOCKET_EVENTS
|
|
11131
|
+
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
11114
11132
|
// $FlowFixMe
|
|
11115
|
-
this[key] = SOCKET_EVENTS
|
|
11133
|
+
this[key] = SOCKET_EVENTS[key];
|
|
11116
11134
|
});
|
|
11117
11135
|
this.eventLists = WebSocketClient.eventLists;
|
|
11118
11136
|
|
|
@@ -11120,7 +11138,7 @@ class Websocket extends Emitter {
|
|
|
11120
11138
|
}
|
|
11121
11139
|
|
|
11122
11140
|
open(host , session ) {
|
|
11123
|
-
logger$
|
|
11141
|
+
logger$5.info('open simple WebSocket', { host, token: session.token });
|
|
11124
11142
|
this.ws = new WebSocketClient(
|
|
11125
11143
|
{
|
|
11126
11144
|
host,
|
|
@@ -11148,7 +11166,7 @@ class Websocket extends Emitter {
|
|
|
11148
11166
|
}
|
|
11149
11167
|
|
|
11150
11168
|
updateToken(token ) {
|
|
11151
|
-
logger$
|
|
11169
|
+
logger$5.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
11152
11170
|
|
|
11153
11171
|
if (!this.ws) {
|
|
11154
11172
|
return;
|
|
@@ -11176,7 +11194,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11176
11194
|
|
|
11177
11195
|
//
|
|
11178
11196
|
|
|
11179
|
-
const logger$
|
|
11197
|
+
const logger$4 = IssueReporter$1.loggerFor('room');
|
|
11180
11198
|
|
|
11181
11199
|
class Participant extends Emitter {
|
|
11182
11200
|
|
|
@@ -11298,7 +11316,7 @@ class Participant extends Emitter {
|
|
|
11298
11316
|
}
|
|
11299
11317
|
|
|
11300
11318
|
onTalking(isTalking ) {
|
|
11301
|
-
logger$
|
|
11319
|
+
logger$4.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
11302
11320
|
this.isTalking = isTalking;
|
|
11303
11321
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
11304
11322
|
// directly from asterisk, there's no need to do so
|
|
@@ -11401,7 +11419,7 @@ class Participant extends Emitter {
|
|
|
11401
11419
|
}
|
|
11402
11420
|
|
|
11403
11421
|
updateStatus(status , broadcast = true) {
|
|
11404
|
-
logger$
|
|
11422
|
+
logger$4.info('updating participant status', { name: this.name, status });
|
|
11405
11423
|
|
|
11406
11424
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
11407
11425
|
if (status.audioMuted) {
|
|
@@ -11449,7 +11467,7 @@ class Participant extends Emitter {
|
|
|
11449
11467
|
|
|
11450
11468
|
broadcastStatus(inboundStatus = null) {
|
|
11451
11469
|
const status = inboundStatus || this.getStatus();
|
|
11452
|
-
logger$
|
|
11470
|
+
logger$4.info('broadcasting participant status', { callId: this.callId, status });
|
|
11453
11471
|
|
|
11454
11472
|
this.room.sendSignal({
|
|
11455
11473
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|
|
@@ -11485,9 +11503,9 @@ class LocalParticipant extends Participant {
|
|
|
11485
11503
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
11486
11504
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
11487
11505
|
|
|
11488
|
-
const logger$
|
|
11506
|
+
const logger$3 = IssueReporter$1.loggerFor('sdk-room');
|
|
11489
11507
|
|
|
11490
|
-
class Room extends Emitter {
|
|
11508
|
+
class Room$1 extends Emitter {
|
|
11491
11509
|
|
|
11492
11510
|
|
|
11493
11511
|
|
|
@@ -11545,7 +11563,7 @@ class Room extends Emitter {
|
|
|
11545
11563
|
extra = {},
|
|
11546
11564
|
) {
|
|
11547
11565
|
super();
|
|
11548
|
-
logger$
|
|
11566
|
+
logger$3.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
11549
11567
|
|
|
11550
11568
|
// Represents the room callSession
|
|
11551
11569
|
this.callSession = callSession;
|
|
@@ -11611,7 +11629,7 @@ class Room extends Emitter {
|
|
|
11611
11629
|
* @returns {Promise<Room>}
|
|
11612
11630
|
*/
|
|
11613
11631
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
11614
|
-
logger$
|
|
11632
|
+
logger$3.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
11615
11633
|
|
|
11616
11634
|
if (!room) {
|
|
11617
11635
|
await Wazo.Phone.connect();
|
|
@@ -11624,7 +11642,7 @@ class Room extends Emitter {
|
|
|
11624
11642
|
|
|
11625
11643
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
11626
11644
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
11627
|
-
logger$
|
|
11645
|
+
logger$3.info('room call received via WS', { callId: data.call_id });
|
|
11628
11646
|
if (room) {
|
|
11629
11647
|
room.setCallId(data.call_id);
|
|
11630
11648
|
}
|
|
@@ -11632,7 +11650,7 @@ class Room extends Emitter {
|
|
|
11632
11650
|
|
|
11633
11651
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
11634
11652
|
// eslint-disable-next-line no-param-reassign
|
|
11635
|
-
room = new Room(callSession, extension, null, null, extra);
|
|
11653
|
+
room = new Room$1(callSession, extension, null, null, extra);
|
|
11636
11654
|
|
|
11637
11655
|
// Wait for the call to be accepted
|
|
11638
11656
|
await new Promise((resolve, reject) => {
|
|
@@ -11653,7 +11671,7 @@ class Room extends Emitter {
|
|
|
11653
11671
|
// Retrieve conference
|
|
11654
11672
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
11655
11673
|
|
|
11656
|
-
logger$
|
|
11674
|
+
logger$3.info('connected to room', {
|
|
11657
11675
|
sourceId: conference ? conference.sourceId : null,
|
|
11658
11676
|
name: conference ? conference.name : null,
|
|
11659
11677
|
});
|
|
@@ -11663,7 +11681,7 @@ class Room extends Emitter {
|
|
|
11663
11681
|
room.setName(conference.name);
|
|
11664
11682
|
}
|
|
11665
11683
|
} else if (meeting) {
|
|
11666
|
-
logger$
|
|
11684
|
+
logger$3.info('Already connected to meeting', {
|
|
11667
11685
|
uuid: meeting.uuid,
|
|
11668
11686
|
name: meeting.name,
|
|
11669
11687
|
});
|
|
@@ -11676,13 +11694,13 @@ class Room extends Emitter {
|
|
|
11676
11694
|
}
|
|
11677
11695
|
|
|
11678
11696
|
static disconnect() {
|
|
11679
|
-
logger$
|
|
11697
|
+
logger$3.info('static disconnection to room');
|
|
11680
11698
|
|
|
11681
11699
|
Wazo.Phone.disconnect();
|
|
11682
11700
|
}
|
|
11683
11701
|
|
|
11684
11702
|
async disconnect() {
|
|
11685
|
-
logger$
|
|
11703
|
+
logger$3.info('disconnection to room called');
|
|
11686
11704
|
|
|
11687
11705
|
await Wazo.Phone.hangup(this.callSession);
|
|
11688
11706
|
this.callSession = null;
|
|
@@ -11702,19 +11720,19 @@ class Room extends Emitter {
|
|
|
11702
11720
|
}
|
|
11703
11721
|
|
|
11704
11722
|
setSourceId(sourceId ) {
|
|
11705
|
-
logger$
|
|
11723
|
+
logger$3.info('set room source id', { sourceId });
|
|
11706
11724
|
|
|
11707
11725
|
this.sourceId = sourceId;
|
|
11708
11726
|
}
|
|
11709
11727
|
|
|
11710
11728
|
setMeetingUuid(meetingUuid ) {
|
|
11711
|
-
logger$
|
|
11729
|
+
logger$3.info('set meeting uuid', { meetingUuid });
|
|
11712
11730
|
|
|
11713
11731
|
this.meetingUuid = meetingUuid;
|
|
11714
11732
|
}
|
|
11715
11733
|
|
|
11716
11734
|
setCallId(callId ) {
|
|
11717
|
-
logger$
|
|
11735
|
+
logger$3.info('set room call id', { callId });
|
|
11718
11736
|
|
|
11719
11737
|
if (callId) {
|
|
11720
11738
|
this.callId = callId;
|
|
@@ -11722,7 +11740,7 @@ class Room extends Emitter {
|
|
|
11722
11740
|
}
|
|
11723
11741
|
|
|
11724
11742
|
setName(name ) {
|
|
11725
|
-
logger$
|
|
11743
|
+
logger$3.info('set room name', { name });
|
|
11726
11744
|
|
|
11727
11745
|
this.name = name;
|
|
11728
11746
|
}
|
|
@@ -11741,7 +11759,7 @@ class Room extends Emitter {
|
|
|
11741
11759
|
}
|
|
11742
11760
|
|
|
11743
11761
|
async startScreenSharing(constraints ) {
|
|
11744
|
-
logger$
|
|
11762
|
+
logger$3.info('start room screen sharing', { constraints });
|
|
11745
11763
|
|
|
11746
11764
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
11747
11765
|
if (!screensharingStream) {
|
|
@@ -11755,7 +11773,7 @@ class Room extends Emitter {
|
|
|
11755
11773
|
}
|
|
11756
11774
|
|
|
11757
11775
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
11758
|
-
logger$
|
|
11776
|
+
logger$3.info('stop room screen sharing');
|
|
11759
11777
|
|
|
11760
11778
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
11761
11779
|
|
|
@@ -11767,7 +11785,7 @@ class Room extends Emitter {
|
|
|
11767
11785
|
}
|
|
11768
11786
|
|
|
11769
11787
|
turnCameraOff() {
|
|
11770
|
-
logger$
|
|
11788
|
+
logger$3.info('turn room camera off');
|
|
11771
11789
|
|
|
11772
11790
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
11773
11791
|
|
|
@@ -11777,7 +11795,7 @@ class Room extends Emitter {
|
|
|
11777
11795
|
}
|
|
11778
11796
|
|
|
11779
11797
|
turnCameraOn() {
|
|
11780
|
-
logger$
|
|
11798
|
+
logger$3.info('turn room camera on');
|
|
11781
11799
|
|
|
11782
11800
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
11783
11801
|
|
|
@@ -11787,7 +11805,7 @@ class Room extends Emitter {
|
|
|
11787
11805
|
}
|
|
11788
11806
|
|
|
11789
11807
|
mute() {
|
|
11790
|
-
logger$
|
|
11808
|
+
logger$3.info('mute room');
|
|
11791
11809
|
|
|
11792
11810
|
Wazo.Phone.mute(this.callSession);
|
|
11793
11811
|
|
|
@@ -11795,7 +11813,7 @@ class Room extends Emitter {
|
|
|
11795
11813
|
}
|
|
11796
11814
|
|
|
11797
11815
|
unmute() {
|
|
11798
|
-
logger$
|
|
11816
|
+
logger$3.info('unmute room');
|
|
11799
11817
|
|
|
11800
11818
|
Wazo.Phone.unmute(this.callSession);
|
|
11801
11819
|
|
|
@@ -11815,7 +11833,7 @@ class Room extends Emitter {
|
|
|
11815
11833
|
}
|
|
11816
11834
|
|
|
11817
11835
|
hold() {
|
|
11818
|
-
logger$
|
|
11836
|
+
logger$3.info('hold room');
|
|
11819
11837
|
|
|
11820
11838
|
Wazo.Phone.hold(this.callSession, true);
|
|
11821
11839
|
|
|
@@ -11825,7 +11843,7 @@ class Room extends Emitter {
|
|
|
11825
11843
|
}
|
|
11826
11844
|
|
|
11827
11845
|
async resume() {
|
|
11828
|
-
logger$
|
|
11846
|
+
logger$3.info('resume room');
|
|
11829
11847
|
|
|
11830
11848
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
11831
11849
|
|
|
@@ -11853,13 +11871,13 @@ class Room extends Emitter {
|
|
|
11853
11871
|
}
|
|
11854
11872
|
|
|
11855
11873
|
sendDTMF(tone ) {
|
|
11856
|
-
logger$
|
|
11874
|
+
logger$3.info('send room DTMF', { tone });
|
|
11857
11875
|
|
|
11858
11876
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
11859
11877
|
}
|
|
11860
11878
|
|
|
11861
11879
|
async sendReinvite(newConstraints = null) {
|
|
11862
|
-
logger$
|
|
11880
|
+
logger$3.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
11863
11881
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
11864
11882
|
|
|
11865
11883
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -11918,7 +11936,7 @@ class Room extends Emitter {
|
|
|
11918
11936
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
11919
11937
|
|
|
11920
11938
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
11921
|
-
logger$
|
|
11939
|
+
logger$3.info('on room audio stream');
|
|
11922
11940
|
|
|
11923
11941
|
this.audioStream = stream;
|
|
11924
11942
|
if (!this.roomAudioElement) {
|
|
@@ -11931,7 +11949,7 @@ class Room extends Emitter {
|
|
|
11931
11949
|
});
|
|
11932
11950
|
|
|
11933
11951
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
11934
|
-
logger$
|
|
11952
|
+
logger$3.info('on room video stream', { streamId });
|
|
11935
11953
|
|
|
11936
11954
|
this._mapMsid(sipSession.body.body);
|
|
11937
11955
|
|
|
@@ -11946,7 +11964,7 @@ class Room extends Emitter {
|
|
|
11946
11964
|
});
|
|
11947
11965
|
|
|
11948
11966
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
11949
|
-
logger$
|
|
11967
|
+
logger$3.info('on room remove stream');
|
|
11950
11968
|
|
|
11951
11969
|
const participant = this.participants.find(someParticipant =>
|
|
11952
11970
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -12078,7 +12096,7 @@ class Room extends Emitter {
|
|
|
12078
12096
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
12079
12097
|
if (requester) {
|
|
12080
12098
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
12081
|
-
logger$
|
|
12099
|
+
logger$3.info('trigger room requester status', { origin });
|
|
12082
12100
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
12083
12101
|
}
|
|
12084
12102
|
break;
|
|
@@ -12109,24 +12127,24 @@ class Room extends Emitter {
|
|
|
12109
12127
|
|
|
12110
12128
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
12111
12129
|
if (participant.user_uuid === session.uuid) {
|
|
12112
|
-
logger$
|
|
12130
|
+
logger$3.info('room current user joined');
|
|
12113
12131
|
|
|
12114
12132
|
// Retrieve participants via an API calls
|
|
12115
12133
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
12116
12134
|
let response;
|
|
12117
12135
|
try {
|
|
12118
12136
|
if (this.meetingUuid) {
|
|
12119
|
-
logger$
|
|
12137
|
+
logger$3.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
12120
12138
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
12121
12139
|
} else {
|
|
12122
|
-
logger$
|
|
12140
|
+
logger$3.info('fetching conference participants', { conferenceId });
|
|
12123
12141
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
12124
12142
|
}
|
|
12125
12143
|
} catch (e) {
|
|
12126
|
-
logger$
|
|
12144
|
+
logger$3.error('room participants fetching, error', e);
|
|
12127
12145
|
}
|
|
12128
12146
|
if (response) {
|
|
12129
|
-
logger$
|
|
12147
|
+
logger$3.info('conference participants fetched', { nb: response.items.length });
|
|
12130
12148
|
participants = response.items.map(item => {
|
|
12131
12149
|
const isMe = item.call_id === this.callId;
|
|
12132
12150
|
|
|
@@ -12153,7 +12171,7 @@ class Room extends Emitter {
|
|
|
12153
12171
|
? new Wazo.RemoteParticipant(this, participant)
|
|
12154
12172
|
: null;
|
|
12155
12173
|
|
|
12156
|
-
logger$
|
|
12174
|
+
logger$3.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
12157
12175
|
|
|
12158
12176
|
if (remoteParticipant) {
|
|
12159
12177
|
this.participants.push(remoteParticipant);
|
|
@@ -12318,12 +12336,12 @@ class Room extends Emitter {
|
|
|
12318
12336
|
|
|
12319
12337
|
//
|
|
12320
12338
|
|
|
12321
|
-
const logger$
|
|
12339
|
+
const logger$2 = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
12322
12340
|
|
|
12323
|
-
class SipRoom extends Room {
|
|
12341
|
+
class SipRoom extends Room$1 {
|
|
12324
12342
|
|
|
12325
12343
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
12326
|
-
logger$
|
|
12344
|
+
logger$2.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
12327
12345
|
|
|
12328
12346
|
if (!room) {
|
|
12329
12347
|
await Wazo.Phone.connect();
|
|
@@ -12339,7 +12357,7 @@ class SipRoom extends Room {
|
|
|
12339
12357
|
room.setCallId(room.callSession.call.id);
|
|
12340
12358
|
}
|
|
12341
12359
|
|
|
12342
|
-
logger$
|
|
12360
|
+
logger$2.info('connected to room', {
|
|
12343
12361
|
extension: room.extension,
|
|
12344
12362
|
});
|
|
12345
12363
|
|
|
@@ -12347,7 +12365,7 @@ class SipRoom extends Room {
|
|
|
12347
12365
|
}
|
|
12348
12366
|
|
|
12349
12367
|
mute() {
|
|
12350
|
-
logger$
|
|
12368
|
+
logger$2.info('mute sip room');
|
|
12351
12369
|
|
|
12352
12370
|
Wazo.Phone.mute(this.callSession, false);
|
|
12353
12371
|
|
|
@@ -12355,7 +12373,7 @@ class SipRoom extends Room {
|
|
|
12355
12373
|
}
|
|
12356
12374
|
|
|
12357
12375
|
unmute() {
|
|
12358
|
-
logger$
|
|
12376
|
+
logger$2.info('unmute sip room');
|
|
12359
12377
|
|
|
12360
12378
|
Wazo.Phone.unmute(this.callSession, false);
|
|
12361
12379
|
|
|
@@ -12639,7 +12657,7 @@ class NotificationOptions {
|
|
|
12639
12657
|
|
|
12640
12658
|
|
|
12641
12659
|
// Represents a conference room, like `9000`.
|
|
12642
|
-
class Room
|
|
12660
|
+
class Room {
|
|
12643
12661
|
|
|
12644
12662
|
|
|
12645
12663
|
|
|
@@ -12660,7 +12678,7 @@ class Room$1 {
|
|
|
12660
12678
|
}
|
|
12661
12679
|
|
|
12662
12680
|
connect(callSession ) {
|
|
12663
|
-
return new Room
|
|
12681
|
+
return new Room({ ...this, connectedCallSession: callSession });
|
|
12664
12682
|
}
|
|
12665
12683
|
|
|
12666
12684
|
has(callSession ) {
|
|
@@ -12669,7 +12687,7 @@ class Room$1 {
|
|
|
12669
12687
|
|
|
12670
12688
|
addParticipant(uuid , extension , talking = null) {
|
|
12671
12689
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
12672
|
-
return new Room
|
|
12690
|
+
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12673
12691
|
}
|
|
12674
12692
|
|
|
12675
12693
|
return this;
|
|
@@ -12688,7 +12706,7 @@ class Room$1 {
|
|
|
12688
12706
|
updatedParticipants.push(participant);
|
|
12689
12707
|
}
|
|
12690
12708
|
|
|
12691
|
-
return new Room
|
|
12709
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12692
12710
|
}
|
|
12693
12711
|
|
|
12694
12712
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -12704,7 +12722,7 @@ class Room$1 {
|
|
|
12704
12722
|
updatedParticipants.push(participant);
|
|
12705
12723
|
}
|
|
12706
12724
|
|
|
12707
|
-
return new Room
|
|
12725
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12708
12726
|
}
|
|
12709
12727
|
|
|
12710
12728
|
hasCallWithId(id ) {
|
|
@@ -12712,18 +12730,18 @@ class Room$1 {
|
|
|
12712
12730
|
}
|
|
12713
12731
|
|
|
12714
12732
|
disconnect() {
|
|
12715
|
-
return new Room
|
|
12733
|
+
return new Room({ ...this, connectedCallSession: null });
|
|
12716
12734
|
}
|
|
12717
12735
|
|
|
12718
12736
|
removeParticipantWithUUID(uuid ) {
|
|
12719
|
-
return new Room
|
|
12737
|
+
return new Room({
|
|
12720
12738
|
...this,
|
|
12721
12739
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
12722
12740
|
});
|
|
12723
12741
|
}
|
|
12724
12742
|
|
|
12725
12743
|
removeParticipantWithExtension(extension ) {
|
|
12726
|
-
return new Room
|
|
12744
|
+
return new Room({
|
|
12727
12745
|
...this,
|
|
12728
12746
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
12729
12747
|
});
|
|
@@ -12734,7 +12752,7 @@ class Room$1 {
|
|
|
12734
12752
|
}
|
|
12735
12753
|
|
|
12736
12754
|
static newFrom(room ) {
|
|
12737
|
-
return newFrom(room, Room
|
|
12755
|
+
return newFrom(room, Room);
|
|
12738
12756
|
}
|
|
12739
12757
|
}
|
|
12740
12758
|
|
|
@@ -13041,11 +13059,11 @@ var wazoWebsocket = {
|
|
|
13041
13059
|
resolve();
|
|
13042
13060
|
};
|
|
13043
13061
|
|
|
13044
|
-
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
13062
|
+
client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
|
|
13045
13063
|
handleError(`Connection error : ${error}`);
|
|
13046
13064
|
});
|
|
13047
13065
|
|
|
13048
|
-
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
13066
|
+
client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
|
|
13049
13067
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
13050
13068
|
client.setOnHeartbeatTimeout(() => {
|
|
13051
13069
|
handleError('No response to heartbeat');
|
|
@@ -13146,7 +13164,7 @@ var webrtc = {
|
|
|
13146
13164
|
}),
|
|
13147
13165
|
};
|
|
13148
13166
|
|
|
13149
|
-
const parseCandidate
|
|
13167
|
+
const parseCandidate = line => {
|
|
13150
13168
|
let parts;
|
|
13151
13169
|
// Parse both variants.
|
|
13152
13170
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -13237,7 +13255,7 @@ var SymmetricNat = {
|
|
|
13237
13255
|
}
|
|
13238
13256
|
|
|
13239
13257
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
13240
|
-
const cand = parseCandidate
|
|
13258
|
+
const cand = parseCandidate(e.candidate.candidate);
|
|
13241
13259
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
13242
13260
|
candidates[cand.relatedPort].push(cand.port);
|
|
13243
13261
|
} else if (!e.candidate) {
|
|
@@ -13305,7 +13323,7 @@ var iceIpv4 = {
|
|
|
13305
13323
|
const rawCandidate = e.candidate.candidate;
|
|
13306
13324
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
13307
13325
|
hasSrflxOrRelay = true;
|
|
13308
|
-
const candidate = parseCandidate
|
|
13326
|
+
const candidate = parseCandidate(e.candidate.candidate);
|
|
13309
13327
|
ips.push(candidate.ip);
|
|
13310
13328
|
}
|
|
13311
13329
|
} else if (!e.candidate) {
|
|
@@ -13342,7 +13360,7 @@ var checks = [
|
|
|
13342
13360
|
|
|
13343
13361
|
//
|
|
13344
13362
|
|
|
13345
|
-
const logger$
|
|
13363
|
+
const logger$1 = IssueReporter$1.loggerFor('engine-check');
|
|
13346
13364
|
|
|
13347
13365
|
class Checker {
|
|
13348
13366
|
|
|
@@ -13360,28 +13378,28 @@ class Checker {
|
|
|
13360
13378
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
13361
13379
|
await this._addEngineVersion();
|
|
13362
13380
|
|
|
13363
|
-
logger$
|
|
13381
|
+
logger$1.info('Engine check starting');
|
|
13364
13382
|
|
|
13365
13383
|
for (let i = 0; i < this.checks.length; i++) {
|
|
13366
13384
|
const { name, check } = this.checks[i];
|
|
13367
13385
|
|
|
13368
|
-
logger$
|
|
13386
|
+
logger$1.info(`Checking ${name} ...`);
|
|
13369
13387
|
|
|
13370
13388
|
onCheckBegin(name);
|
|
13371
13389
|
try {
|
|
13372
13390
|
// eslint-disable-next-line no-await-in-loop
|
|
13373
13391
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
13374
|
-
logger$
|
|
13392
|
+
logger$1.info(`Checking ${name} success.`, { result });
|
|
13375
13393
|
|
|
13376
13394
|
onCheckResult(name, result);
|
|
13377
13395
|
} catch (e) {
|
|
13378
|
-
logger$
|
|
13396
|
+
logger$1.info(`Checking ${name} failure`, { message: e.message });
|
|
13379
13397
|
|
|
13380
13398
|
onCheckResult(name, e);
|
|
13381
13399
|
}
|
|
13382
13400
|
}
|
|
13383
13401
|
|
|
13384
|
-
logger$
|
|
13402
|
+
logger$1.info('Engine check done.');
|
|
13385
13403
|
}
|
|
13386
13404
|
|
|
13387
13405
|
addCheck(check ) {
|
|
@@ -13405,7 +13423,7 @@ const Wazo = {
|
|
|
13405
13423
|
Auth: Auth$1,
|
|
13406
13424
|
Phone: Phone$1,
|
|
13407
13425
|
Websocket: Websocket$1,
|
|
13408
|
-
Room,
|
|
13426
|
+
Room: Room$1,
|
|
13409
13427
|
SipRoom,
|
|
13410
13428
|
RemoteParticipant,
|
|
13411
13429
|
LocalParticipant,
|
|
@@ -13438,7 +13456,7 @@ const Wazo = {
|
|
|
13438
13456
|
Session,
|
|
13439
13457
|
Voicemail,
|
|
13440
13458
|
Relocation,
|
|
13441
|
-
ConferenceRoom: Room
|
|
13459
|
+
ConferenceRoom: Room,
|
|
13442
13460
|
CallSession,
|
|
13443
13461
|
IndirectTransfer,
|
|
13444
13462
|
SwitchboardCall,
|
|
@@ -13477,7 +13495,7 @@ if (global) {
|
|
|
13477
13495
|
class InvalidSubscription extends Error {}
|
|
13478
13496
|
class InvalidAuthorization extends Error {}
|
|
13479
13497
|
|
|
13480
|
-
const logger
|
|
13498
|
+
const logger = IssueReporter$1.loggerFor('simple-auth');
|
|
13481
13499
|
|
|
13482
13500
|
class Auth {
|
|
13483
13501
|
|
|
@@ -13512,7 +13530,7 @@ class Auth {
|
|
|
13512
13530
|
setApiClientId(this.clientId);
|
|
13513
13531
|
setRefreshExpiration(this.expiration);
|
|
13514
13532
|
setOnRefreshToken((token , session ) => {
|
|
13515
|
-
logger
|
|
13533
|
+
logger.info('on refresh token done', { token });
|
|
13516
13534
|
setApiToken(token);
|
|
13517
13535
|
Wazo.Websocket.updateToken(token);
|
|
13518
13536
|
|
|
@@ -13557,7 +13575,7 @@ class Auth {
|
|
|
13557
13575
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
13558
13576
|
return this._onAuthenticated(rawSession);
|
|
13559
13577
|
} catch (e) {
|
|
13560
|
-
logger
|
|
13578
|
+
logger.error('on validate token error', e);
|
|
13561
13579
|
console.warn(e);
|
|
13562
13580
|
return false;
|
|
13563
13581
|
}
|