@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
|
@@ -1957,7 +1957,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
1957
1957
|
|
|
1958
1958
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
1959
1959
|
|
|
1960
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1960
|
+
const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1961
1961
|
|
|
1962
1962
|
// Use a function here to be able to mock it in tests
|
|
1963
1963
|
const realFetch = () => {
|
|
@@ -2096,7 +2096,7 @@ class ApiRequester {
|
|
|
2096
2096
|
};
|
|
2097
2097
|
|
|
2098
2098
|
if (this.refreshTokenPromise) {
|
|
2099
|
-
logger.info('A token is already refreshing, waiting ...', { url });
|
|
2099
|
+
logger$c.info('A token is already refreshing, waiting ...', { url });
|
|
2100
2100
|
await this.refreshTokenPromise;
|
|
2101
2101
|
}
|
|
2102
2102
|
|
|
@@ -2116,7 +2116,7 @@ class ApiRequester {
|
|
|
2116
2116
|
return promise.then(async (err ) => {
|
|
2117
2117
|
// Check if the token is still valid
|
|
2118
2118
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
2119
|
-
logger.warn('token expired', { error: err.reason });
|
|
2119
|
+
logger$c.warn('token expired', { error: err.reason });
|
|
2120
2120
|
// Replay the call after refreshing the token
|
|
2121
2121
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
2122
2122
|
}
|
|
@@ -2126,7 +2126,7 @@ class ApiRequester {
|
|
|
2126
2126
|
: exceptionClass.fromResponse(err, response.status);
|
|
2127
2127
|
|
|
2128
2128
|
if (this.shouldLogErrors) {
|
|
2129
|
-
logger.error('API error', error);
|
|
2129
|
+
logger$c.error('API error', error);
|
|
2130
2130
|
}
|
|
2131
2131
|
|
|
2132
2132
|
throw error;
|
|
@@ -2136,7 +2136,7 @@ class ApiRequester {
|
|
|
2136
2136
|
return newParse(response, isJson);
|
|
2137
2137
|
}).catch(error => {
|
|
2138
2138
|
if (this.shouldLogErrors) {
|
|
2139
|
-
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2139
|
+
logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
2140
2140
|
}
|
|
2141
2141
|
|
|
2142
2142
|
throw error;
|
|
@@ -2164,13 +2164,13 @@ class ApiRequester {
|
|
|
2164
2164
|
) {
|
|
2165
2165
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
2166
2166
|
let newPath = path;
|
|
2167
|
-
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2167
|
+
logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
2168
2168
|
|
|
2169
2169
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
2170
2170
|
|
|
2171
2171
|
return this.refreshTokenPromise.then(() => {
|
|
2172
2172
|
this.refreshTokenPromise = null;
|
|
2173
|
-
logger.info('token refreshed', { isTokenNotFound });
|
|
2173
|
+
logger$c.info('token refreshed', { isTokenNotFound });
|
|
2174
2174
|
if (isTokenNotFound) {
|
|
2175
2175
|
const pathParts = path.split('/');
|
|
2176
2176
|
pathParts.pop();
|
|
@@ -4063,7 +4063,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
4063
4063
|
|
|
4064
4064
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
4065
4065
|
|
|
4066
|
-
const logger$
|
|
4066
|
+
const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
4067
4067
|
|
|
4068
4068
|
class CTIPhone extends Emitter {
|
|
4069
4069
|
|
|
@@ -4076,7 +4076,7 @@ class CTIPhone extends Emitter {
|
|
|
4076
4076
|
|
|
4077
4077
|
constructor(session , isMobile = false, callbackAllLines = false) {
|
|
4078
4078
|
super();
|
|
4079
|
-
logger$
|
|
4079
|
+
logger$b.info('CTI Phone created');
|
|
4080
4080
|
this.session = session;
|
|
4081
4081
|
this.isMobile = isMobile;
|
|
4082
4082
|
this.callbackAllLines = callbackAllLines;
|
|
@@ -4137,7 +4137,7 @@ class CTIPhone extends Emitter {
|
|
|
4137
4137
|
}
|
|
4138
4138
|
|
|
4139
4139
|
async makeCall(number , line ) {
|
|
4140
|
-
logger$
|
|
4140
|
+
logger$b.info('make CTI call', { number });
|
|
4141
4141
|
|
|
4142
4142
|
if (!number) {
|
|
4143
4143
|
return null;
|
|
@@ -4160,7 +4160,7 @@ class CTIPhone extends Emitter {
|
|
|
4160
4160
|
if (!callSession) {
|
|
4161
4161
|
return Promise.resolve(null);
|
|
4162
4162
|
}
|
|
4163
|
-
logger$
|
|
4163
|
+
logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4164
4164
|
|
|
4165
4165
|
if (!this.currentCall) {
|
|
4166
4166
|
this.currentCall = callSession.call;
|
|
@@ -4173,7 +4173,7 @@ class CTIPhone extends Emitter {
|
|
|
4173
4173
|
if (!callSession) {
|
|
4174
4174
|
return;
|
|
4175
4175
|
}
|
|
4176
|
-
logger$
|
|
4176
|
+
logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4177
4177
|
|
|
4178
4178
|
this.currentCall = undefined;
|
|
4179
4179
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4183,7 +4183,7 @@ class CTIPhone extends Emitter {
|
|
|
4183
4183
|
if (!callSession) {
|
|
4184
4184
|
return Promise.resolve(false);
|
|
4185
4185
|
}
|
|
4186
|
-
logger$
|
|
4186
|
+
logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4187
4187
|
|
|
4188
4188
|
try {
|
|
4189
4189
|
await CallApi.cancelCall(callSession);
|
|
@@ -4194,7 +4194,7 @@ class CTIPhone extends Emitter {
|
|
|
4194
4194
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
4195
4195
|
return true;
|
|
4196
4196
|
} catch (e) {
|
|
4197
|
-
logger$
|
|
4197
|
+
logger$b.error('hangup CTI call, error', e);
|
|
4198
4198
|
|
|
4199
4199
|
this.eventEmitter.emit('onCallFailed', callSession);
|
|
4200
4200
|
return false;
|
|
@@ -4207,7 +4207,7 @@ class CTIPhone extends Emitter {
|
|
|
4207
4207
|
if (!callSession) {
|
|
4208
4208
|
return;
|
|
4209
4209
|
}
|
|
4210
|
-
logger$
|
|
4210
|
+
logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
|
|
4211
4211
|
|
|
4212
4212
|
await CallApi.cancelCall(callSession);
|
|
4213
4213
|
this.eventEmitter.emit('onCallEnded', callSession);
|
|
@@ -4217,7 +4217,7 @@ class CTIPhone extends Emitter {
|
|
|
4217
4217
|
if (!callSession) {
|
|
4218
4218
|
return;
|
|
4219
4219
|
}
|
|
4220
|
-
logger$
|
|
4220
|
+
logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4221
4221
|
|
|
4222
4222
|
await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
|
|
4223
4223
|
}
|
|
@@ -4230,19 +4230,19 @@ class CTIPhone extends Emitter {
|
|
|
4230
4230
|
if (!callSession) {
|
|
4231
4231
|
return;
|
|
4232
4232
|
}
|
|
4233
|
-
logger$
|
|
4233
|
+
logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
|
|
4234
4234
|
|
|
4235
4235
|
return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
|
|
4236
4236
|
}
|
|
4237
4237
|
|
|
4238
4238
|
async cancelCTIIndirectTransfer(transferId ) {
|
|
4239
|
-
logger$
|
|
4239
|
+
logger$b.info('cancel CTI transfer', { transferId });
|
|
4240
4240
|
|
|
4241
4241
|
return CallApi.cancelCallTransfer(transferId);
|
|
4242
4242
|
}
|
|
4243
4243
|
|
|
4244
4244
|
async confirmCTIIndirectTransfer(transferId ) {
|
|
4245
|
-
logger$
|
|
4245
|
+
logger$b.info('confirm CTI transfer', { transferId });
|
|
4246
4246
|
|
|
4247
4247
|
return CallApi.confirmCallTransfer(transferId);
|
|
4248
4248
|
}
|
|
@@ -4251,19 +4251,19 @@ class CTIPhone extends Emitter {
|
|
|
4251
4251
|
if (!callSession) {
|
|
4252
4252
|
return;
|
|
4253
4253
|
}
|
|
4254
|
-
logger$
|
|
4254
|
+
logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
|
|
4255
4255
|
|
|
4256
4256
|
return CallApi.sendDTMF(callSession.callId, digits);
|
|
4257
4257
|
}
|
|
4258
4258
|
|
|
4259
4259
|
onConnectionMade() {
|
|
4260
|
-
logger$
|
|
4260
|
+
logger$b.info('on CTI connection made');
|
|
4261
4261
|
|
|
4262
4262
|
this.eventEmitter.emit('onCallAccepted');
|
|
4263
4263
|
}
|
|
4264
4264
|
|
|
4265
4265
|
async close() {
|
|
4266
|
-
logger$
|
|
4266
|
+
logger$b.info('CTI close');
|
|
4267
4267
|
|
|
4268
4268
|
return Promise.resolve();
|
|
4269
4269
|
}
|
|
@@ -4272,7 +4272,7 @@ class CTIPhone extends Emitter {
|
|
|
4272
4272
|
if (!callSession) {
|
|
4273
4273
|
return;
|
|
4274
4274
|
}
|
|
4275
|
-
logger$
|
|
4275
|
+
logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
|
|
4276
4276
|
|
|
4277
4277
|
return CallApi.hold(callSession.callId);
|
|
4278
4278
|
}
|
|
@@ -4281,7 +4281,7 @@ class CTIPhone extends Emitter {
|
|
|
4281
4281
|
if (!callSession) {
|
|
4282
4282
|
return;
|
|
4283
4283
|
}
|
|
4284
|
-
logger$
|
|
4284
|
+
logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
|
|
4285
4285
|
|
|
4286
4286
|
return CallApi.resume(callSession.callId);
|
|
4287
4287
|
}
|
|
@@ -4290,7 +4290,7 @@ class CTIPhone extends Emitter {
|
|
|
4290
4290
|
if (!callSession) {
|
|
4291
4291
|
return;
|
|
4292
4292
|
}
|
|
4293
|
-
logger$
|
|
4293
|
+
logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
|
|
4294
4294
|
|
|
4295
4295
|
return CallApi.mute(callSession.callId);
|
|
4296
4296
|
}
|
|
@@ -4299,7 +4299,7 @@ class CTIPhone extends Emitter {
|
|
|
4299
4299
|
if (!callSession) {
|
|
4300
4300
|
return;
|
|
4301
4301
|
}
|
|
4302
|
-
logger$
|
|
4302
|
+
logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
|
|
4303
4303
|
|
|
4304
4304
|
return CallApi.unmute(callSession.callId);
|
|
4305
4305
|
}
|
|
@@ -5308,7 +5308,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
5308
5308
|
const WEBHOOKD_VERSION = '1.0';
|
|
5309
5309
|
const AMID_VERSION = '1.0';
|
|
5310
5310
|
|
|
5311
|
-
const logger$
|
|
5311
|
+
const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
5312
5312
|
|
|
5313
5313
|
class ApiClient {
|
|
5314
5314
|
|
|
@@ -5360,12 +5360,12 @@ class ApiClient {
|
|
|
5360
5360
|
}
|
|
5361
5361
|
|
|
5362
5362
|
async forceRefreshToken() {
|
|
5363
|
-
logger$
|
|
5363
|
+
logger$a.info('forcing refresh token, calling callback');
|
|
5364
5364
|
return this.refreshTokenCallback();
|
|
5365
5365
|
}
|
|
5366
5366
|
|
|
5367
5367
|
async refreshTokenCallback() {
|
|
5368
|
-
logger$
|
|
5368
|
+
logger$a.info('refresh token callback called', {
|
|
5369
5369
|
refreshToken: this.refreshToken,
|
|
5370
5370
|
refreshBackend: this.refreshBackend,
|
|
5371
5371
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -5383,7 +5383,7 @@ class ApiClient {
|
|
|
5383
5383
|
this.isMobile,
|
|
5384
5384
|
);
|
|
5385
5385
|
|
|
5386
|
-
logger$
|
|
5386
|
+
logger$a.info('token refreshed', { token: session.token });
|
|
5387
5387
|
|
|
5388
5388
|
if (this.onRefreshToken) {
|
|
5389
5389
|
this.onRefreshToken(session.token, session);
|
|
@@ -5696,7 +5696,7 @@ class AdHocAPIConference {
|
|
|
5696
5696
|
|
|
5697
5697
|
/* */
|
|
5698
5698
|
|
|
5699
|
-
const parseCandidate = (candidate ) => {
|
|
5699
|
+
const parseCandidate$1 = (candidate ) => {
|
|
5700
5700
|
if (!candidate) {
|
|
5701
5701
|
return null;
|
|
5702
5702
|
}
|
|
@@ -5850,7 +5850,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
5850
5850
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
5851
5851
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
5852
5852
|
if (event.candidate) {
|
|
5853
|
-
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
5853
|
+
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
5854
5854
|
}
|
|
5855
5855
|
};
|
|
5856
5856
|
|
|
@@ -6314,7 +6314,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
6314
6314
|
const SEND_STATS_DELAY = 5000;
|
|
6315
6315
|
|
|
6316
6316
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
6317
|
-
const logger$
|
|
6317
|
+
const logger$9 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
6318
6318
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
6319
6319
|
|
|
6320
6320
|
// events
|
|
@@ -6328,14 +6328,14 @@ const TRANSPORT_ERROR = 'transportError';
|
|
|
6328
6328
|
const MESSAGE = 'message';
|
|
6329
6329
|
const ACCEPTED = 'accepted';
|
|
6330
6330
|
const REJECTED = 'rejected';
|
|
6331
|
-
const ON_TRACK = 'onTrack';
|
|
6332
|
-
const ON_REINVITE = 'reinvite';
|
|
6331
|
+
const ON_TRACK$1 = 'onTrack';
|
|
6332
|
+
const ON_REINVITE$1 = 'reinvite';
|
|
6333
6333
|
const ON_ERROR = 'onError';
|
|
6334
6334
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
6335
|
-
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
6336
|
-
const ON_DISCONNECTED = 'onDisconnected';
|
|
6335
|
+
const ON_NETWORK_STATS$1 = 'onNetworkStats';
|
|
6336
|
+
const ON_DISCONNECTED$1 = 'onDisconnected';
|
|
6337
6337
|
|
|
6338
|
-
const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6338
|
+
const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
|
|
6339
6339
|
const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
|
|
6340
6340
|
class CanceledCallError extends Error {}
|
|
6341
6341
|
|
|
@@ -6471,12 +6471,12 @@ class WebRTCClient extends Emitter {
|
|
|
6471
6471
|
this.MESSAGE = MESSAGE;
|
|
6472
6472
|
this.ACCEPTED = ACCEPTED;
|
|
6473
6473
|
this.REJECTED = REJECTED;
|
|
6474
|
-
this.ON_TRACK = ON_TRACK;
|
|
6475
|
-
this.ON_REINVITE = ON_REINVITE;
|
|
6474
|
+
this.ON_TRACK = ON_TRACK$1;
|
|
6475
|
+
this.ON_REINVITE = ON_REINVITE$1;
|
|
6476
6476
|
this.ON_ERROR = ON_ERROR;
|
|
6477
6477
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
6478
|
-
this.ON_NETWORK_STATS = ON_NETWORK_STATS;
|
|
6479
|
-
this.ON_DISCONNECTED = ON_DISCONNECTED;
|
|
6478
|
+
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
6479
|
+
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
6480
6480
|
}
|
|
6481
6481
|
|
|
6482
6482
|
configureMedia(media ) {
|
|
@@ -6493,13 +6493,13 @@ class WebRTCClient extends Emitter {
|
|
|
6493
6493
|
|
|
6494
6494
|
createUserAgent(configOverrides ) {
|
|
6495
6495
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6496
|
-
logger$
|
|
6496
|
+
logger$9.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6497
6497
|
|
|
6498
6498
|
webRTCConfiguration.delegate = {
|
|
6499
6499
|
onConnect: this.onConnect.bind(this),
|
|
6500
6500
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6501
6501
|
onInvite: (invitation ) => {
|
|
6502
|
-
logger$
|
|
6502
|
+
logger$9.info('sdk webrtc on invite', {
|
|
6503
6503
|
method: 'delegate.onInvite',
|
|
6504
6504
|
id: invitation.id,
|
|
6505
6505
|
remoteURI: invitation.remoteURI,
|
|
@@ -6542,7 +6542,7 @@ class WebRTCClient extends Emitter {
|
|
|
6542
6542
|
}
|
|
6543
6543
|
|
|
6544
6544
|
onConnect() {
|
|
6545
|
-
logger$
|
|
6545
|
+
logger$9.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6546
6546
|
this.eventEmitter.emit(CONNECTED);
|
|
6547
6547
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6548
6548
|
this.registerer.waitingToggle(false);
|
|
@@ -6551,7 +6551,7 @@ class WebRTCClient extends Emitter {
|
|
|
6551
6551
|
}
|
|
6552
6552
|
|
|
6553
6553
|
async onDisconnect(error ) {
|
|
6554
|
-
logger$
|
|
6554
|
+
logger$9.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6555
6555
|
this.connectionPromise = null;
|
|
6556
6556
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6557
6557
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6576,37 +6576,37 @@ class WebRTCClient extends Emitter {
|
|
|
6576
6576
|
};
|
|
6577
6577
|
|
|
6578
6578
|
if (this.skipRegister) {
|
|
6579
|
-
logger$
|
|
6579
|
+
logger$9.info('sdk webrtc skip register...', logInfo);
|
|
6580
6580
|
return Promise.resolve();
|
|
6581
6581
|
}
|
|
6582
6582
|
|
|
6583
|
-
logger$
|
|
6583
|
+
logger$9.info('sdk webrtc registering...', logInfo);
|
|
6584
6584
|
|
|
6585
6585
|
if (!this.userAgent) {
|
|
6586
|
-
logger$
|
|
6586
|
+
logger$9.info('sdk webrtc recreating User Agent');
|
|
6587
6587
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6588
6588
|
}
|
|
6589
6589
|
if (!this.userAgent || this.isRegistered()) {
|
|
6590
|
-
logger$
|
|
6590
|
+
logger$9.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6591
6591
|
return Promise.resolve();
|
|
6592
6592
|
}
|
|
6593
6593
|
|
|
6594
6594
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6595
|
-
logger$
|
|
6595
|
+
logger$9.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6596
6596
|
return Promise.resolve();
|
|
6597
6597
|
}
|
|
6598
6598
|
|
|
6599
6599
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6600
6600
|
|
|
6601
6601
|
const onRegisterFailed = () => {
|
|
6602
|
-
logger$
|
|
6602
|
+
logger$9.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6603
6603
|
this.connectionPromise = null;
|
|
6604
6604
|
if (this.registerer && this.registerer.waiting) {
|
|
6605
6605
|
this.registerer.waitingToggle(false);
|
|
6606
6606
|
}
|
|
6607
6607
|
|
|
6608
6608
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6609
|
-
logger$
|
|
6609
|
+
logger$9.info('sdk webrtc registering, retrying...', { tries });
|
|
6610
6610
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6611
6611
|
}
|
|
6612
6612
|
};
|
|
@@ -6615,18 +6615,18 @@ class WebRTCClient extends Emitter {
|
|
|
6615
6615
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6616
6616
|
// during the resolution of the primise.
|
|
6617
6617
|
if (!this.userAgent) {
|
|
6618
|
-
logger$
|
|
6618
|
+
logger$9.info('sdk webrtc recreating User Agent after connection');
|
|
6619
6619
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6620
6620
|
}
|
|
6621
6621
|
|
|
6622
|
-
logger$
|
|
6622
|
+
logger$9.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6623
6623
|
this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
|
|
6624
6624
|
this.connectionPromise = null;
|
|
6625
6625
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6626
6626
|
|
|
6627
6627
|
// Bind registerer events
|
|
6628
6628
|
this.registerer.stateChange.addListener(newState => {
|
|
6629
|
-
logger$
|
|
6629
|
+
logger$9.info('sdk webrtc registering, state changed', { newState });
|
|
6630
6630
|
|
|
6631
6631
|
if (newState === registererState.RegistererState.Registered && this.registerer
|
|
6632
6632
|
&& this.registerer.state === registererState.RegistererState.Registered) {
|
|
@@ -6639,7 +6639,7 @@ class WebRTCClient extends Emitter {
|
|
|
6639
6639
|
const options = {
|
|
6640
6640
|
requestDelegate: {
|
|
6641
6641
|
onReject: response => {
|
|
6642
|
-
logger$
|
|
6642
|
+
logger$9.error('sdk webrtc registering, rejected', { response });
|
|
6643
6643
|
|
|
6644
6644
|
onRegisterFailed();
|
|
6645
6645
|
},
|
|
@@ -6647,13 +6647,13 @@ class WebRTCClient extends Emitter {
|
|
|
6647
6647
|
};
|
|
6648
6648
|
|
|
6649
6649
|
return this.registerer.register(options).catch((e) => {
|
|
6650
|
-
logger$
|
|
6650
|
+
logger$9.error('sdk webrtc registering, error', e);
|
|
6651
6651
|
|
|
6652
6652
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6653
6653
|
return e;
|
|
6654
6654
|
});
|
|
6655
6655
|
}).catch(error => {
|
|
6656
|
-
logger$
|
|
6656
|
+
logger$9.error('sdk webrtc registering, transport error', error);
|
|
6657
6657
|
onRegisterFailed();
|
|
6658
6658
|
});
|
|
6659
6659
|
}
|
|
@@ -6682,21 +6682,21 @@ class WebRTCClient extends Emitter {
|
|
|
6682
6682
|
}
|
|
6683
6683
|
|
|
6684
6684
|
unregister() {
|
|
6685
|
-
logger$
|
|
6685
|
+
logger$9.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6686
6686
|
if (!this.registerer) {
|
|
6687
6687
|
return Promise.resolve();
|
|
6688
6688
|
}
|
|
6689
6689
|
|
|
6690
6690
|
try {
|
|
6691
6691
|
return this.registerer.unregister().then(() => {
|
|
6692
|
-
logger$
|
|
6692
|
+
logger$9.info('sdk webrtc unregistered');
|
|
6693
6693
|
this._cleanupRegister();
|
|
6694
6694
|
}).catch(e => {
|
|
6695
|
-
logger$
|
|
6695
|
+
logger$9.error('sdk webrtc unregistering, promise error', e);
|
|
6696
6696
|
this._cleanupRegister();
|
|
6697
6697
|
});
|
|
6698
6698
|
} catch (e) {
|
|
6699
|
-
logger$
|
|
6699
|
+
logger$9.error('sdk webrtc unregistering, error', e);
|
|
6700
6700
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6701
6701
|
// error when the registerer is in a bad state
|
|
6702
6702
|
this._cleanupRegister();
|
|
@@ -6704,7 +6704,7 @@ class WebRTCClient extends Emitter {
|
|
|
6704
6704
|
}
|
|
6705
6705
|
|
|
6706
6706
|
stop() {
|
|
6707
|
-
logger$
|
|
6707
|
+
logger$9.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6708
6708
|
if (!this.userAgent) {
|
|
6709
6709
|
return Promise.resolve();
|
|
6710
6710
|
}
|
|
@@ -6712,12 +6712,12 @@ class WebRTCClient extends Emitter {
|
|
|
6712
6712
|
return this.userAgent.stop().then(() => {
|
|
6713
6713
|
return this._cleanupRegister();
|
|
6714
6714
|
}).catch(e => {
|
|
6715
|
-
logger$
|
|
6715
|
+
logger$9.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6716
6716
|
});
|
|
6717
6717
|
}
|
|
6718
6718
|
|
|
6719
6719
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6720
|
-
logger$
|
|
6720
|
+
logger$9.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
|
|
6721
6721
|
const inviterOptions = {
|
|
6722
6722
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6723
6723
|
conference,
|
|
@@ -6748,7 +6748,7 @@ class WebRTCClient extends Emitter {
|
|
|
6748
6748
|
this._onAccepted(session, response.session, true);
|
|
6749
6749
|
},
|
|
6750
6750
|
onReject: (response ) => {
|
|
6751
|
-
logger$
|
|
6751
|
+
logger$9.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
6752
6752
|
this._stopSendingStats(session);
|
|
6753
6753
|
this.stopNetworkMonitoring(session);
|
|
6754
6754
|
|
|
@@ -6771,11 +6771,11 @@ class WebRTCClient extends Emitter {
|
|
|
6771
6771
|
}
|
|
6772
6772
|
|
|
6773
6773
|
answer(session , enableVideo ) {
|
|
6774
|
-
logger$
|
|
6774
|
+
logger$9.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
6775
6775
|
|
|
6776
6776
|
if (!session || !session.accept) {
|
|
6777
6777
|
const error = 'No session to answer, or not an invitation';
|
|
6778
|
-
logger$
|
|
6778
|
+
logger$9.warn(error);
|
|
6779
6779
|
return Promise.reject(new Error(error));
|
|
6780
6780
|
}
|
|
6781
6781
|
const options = {
|
|
@@ -6785,15 +6785,15 @@ class WebRTCClient extends Emitter {
|
|
|
6785
6785
|
return session.accept(options).then(() => {
|
|
6786
6786
|
if (session.isCanceled) {
|
|
6787
6787
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
6788
|
-
logger$
|
|
6788
|
+
logger$9.error(message, { id: session.id });
|
|
6789
6789
|
this.onCallEnded(session);
|
|
6790
6790
|
|
|
6791
6791
|
throw new CanceledCallError(message);
|
|
6792
6792
|
}
|
|
6793
|
-
logger$
|
|
6793
|
+
logger$9.info('sdk webrtc answer, accepted.');
|
|
6794
6794
|
this._onAccepted(session);
|
|
6795
6795
|
}).catch(e => {
|
|
6796
|
-
logger$
|
|
6796
|
+
logger$9.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
6797
6797
|
|
|
6798
6798
|
throw e;
|
|
6799
6799
|
});
|
|
@@ -6801,7 +6801,7 @@ class WebRTCClient extends Emitter {
|
|
|
6801
6801
|
|
|
6802
6802
|
hangup(session ) {
|
|
6803
6803
|
const { state, id } = session;
|
|
6804
|
-
logger$
|
|
6804
|
+
logger$9.info('sdk webrtc hangup call', { id, state });
|
|
6805
6805
|
|
|
6806
6806
|
try {
|
|
6807
6807
|
this._stopSendingStats(session);
|
|
@@ -6830,7 +6830,7 @@ class WebRTCClient extends Emitter {
|
|
|
6830
6830
|
|
|
6831
6831
|
return bye();
|
|
6832
6832
|
} catch (error) {
|
|
6833
|
-
logger$
|
|
6833
|
+
logger$9.warn('sdk webrtc hangup, error', error);
|
|
6834
6834
|
}
|
|
6835
6835
|
|
|
6836
6836
|
return null;
|
|
@@ -6848,7 +6848,7 @@ class WebRTCClient extends Emitter {
|
|
|
6848
6848
|
// Fetch and emit an event at `interval` with session network stats
|
|
6849
6849
|
startNetworkMonitoring(session , interval = 1000) {
|
|
6850
6850
|
const sessionId = this.getSipSessionId(session);
|
|
6851
|
-
logger$
|
|
6851
|
+
logger$9.info('starting network inspection', { id: sessionId });
|
|
6852
6852
|
|
|
6853
6853
|
this.sessionNetworkStats[sessionId] = [];
|
|
6854
6854
|
|
|
@@ -6858,7 +6858,7 @@ class WebRTCClient extends Emitter {
|
|
|
6858
6858
|
stopNetworkMonitoring(session ) {
|
|
6859
6859
|
const sessionId = this.getSipSessionId(session);
|
|
6860
6860
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
6861
|
-
logger$
|
|
6861
|
+
logger$9.info('stopping network inspection', { id: sessionId, exists });
|
|
6862
6862
|
|
|
6863
6863
|
if (exists) {
|
|
6864
6864
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -6868,17 +6868,17 @@ class WebRTCClient extends Emitter {
|
|
|
6868
6868
|
}
|
|
6869
6869
|
|
|
6870
6870
|
reject(session ) {
|
|
6871
|
-
logger$
|
|
6871
|
+
logger$9.info('sdk webrtc reject call', { id: session.id });
|
|
6872
6872
|
|
|
6873
6873
|
try {
|
|
6874
6874
|
return session.reject ? session.reject() : session.cancel();
|
|
6875
6875
|
} catch (e) {
|
|
6876
|
-
logger$
|
|
6876
|
+
logger$9.warn('Error when rejecting call', e.message, e.stack);
|
|
6877
6877
|
}
|
|
6878
6878
|
}
|
|
6879
6879
|
|
|
6880
6880
|
async close() {
|
|
6881
|
-
logger$
|
|
6881
|
+
logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6882
6882
|
this._cleanupMedia();
|
|
6883
6883
|
this.connectionPromise = null;
|
|
6884
6884
|
|
|
@@ -6909,7 +6909,7 @@ class WebRTCClient extends Emitter {
|
|
|
6909
6909
|
// eg: "INVITE not rejectable in state Completed"
|
|
6910
6910
|
}
|
|
6911
6911
|
this.userAgent = null;
|
|
6912
|
-
logger$
|
|
6912
|
+
logger$9.info('sdk webrtc client closed');
|
|
6913
6913
|
}
|
|
6914
6914
|
|
|
6915
6915
|
getNumber(session ) {
|
|
@@ -6922,13 +6922,13 @@ class WebRTCClient extends Emitter {
|
|
|
6922
6922
|
}
|
|
6923
6923
|
|
|
6924
6924
|
mute(session ) {
|
|
6925
|
-
logger$
|
|
6925
|
+
logger$9.info('sdk webrtc mute', { id: session.id });
|
|
6926
6926
|
|
|
6927
6927
|
this._toggleAudio(session, true);
|
|
6928
6928
|
}
|
|
6929
6929
|
|
|
6930
6930
|
unmute(session ) {
|
|
6931
|
-
logger$
|
|
6931
|
+
logger$9.info('sdk webrtc unmute', { id: session.id });
|
|
6932
6932
|
|
|
6933
6933
|
this._toggleAudio(session, false);
|
|
6934
6934
|
}
|
|
@@ -6968,13 +6968,13 @@ class WebRTCClient extends Emitter {
|
|
|
6968
6968
|
}
|
|
6969
6969
|
|
|
6970
6970
|
toggleCameraOn(session ) {
|
|
6971
|
-
logger$
|
|
6971
|
+
logger$9.info('sdk webrtc toggle camera on', { id: session.id });
|
|
6972
6972
|
|
|
6973
6973
|
this._toggleVideo(session, false);
|
|
6974
6974
|
}
|
|
6975
6975
|
|
|
6976
6976
|
toggleCameraOff(session ) {
|
|
6977
|
-
logger$
|
|
6977
|
+
logger$9.info('sdk webrtc toggle camera off', { id: session.id });
|
|
6978
6978
|
|
|
6979
6979
|
this._toggleVideo(session, true);
|
|
6980
6980
|
}
|
|
@@ -6983,7 +6983,7 @@ class WebRTCClient extends Emitter {
|
|
|
6983
6983
|
const sessionId = this.getSipSessionId(session);
|
|
6984
6984
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
6985
6985
|
|
|
6986
|
-
logger$
|
|
6986
|
+
logger$9.info('sdk webrtc hold', {
|
|
6987
6987
|
sessionId,
|
|
6988
6988
|
keys: Object.keys(this.heldSessions),
|
|
6989
6989
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7032,7 +7032,7 @@ class WebRTCClient extends Emitter {
|
|
|
7032
7032
|
const sessionId = this.getSipSessionId(session);
|
|
7033
7033
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
7034
7034
|
|
|
7035
|
-
logger$
|
|
7035
|
+
logger$9.info('sdk webrtc unhold', {
|
|
7036
7036
|
sessionId,
|
|
7037
7037
|
keys: Object.keys(this.heldSessions),
|
|
7038
7038
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -7180,7 +7180,7 @@ class WebRTCClient extends Emitter {
|
|
|
7180
7180
|
if (!session.sessionDescriptionHandler) {
|
|
7181
7181
|
return;
|
|
7182
7182
|
}
|
|
7183
|
-
logger$
|
|
7183
|
+
logger$9.info('Sending DTMF', {
|
|
7184
7184
|
id: this.getSipSessionId(session),
|
|
7185
7185
|
tone,
|
|
7186
7186
|
});
|
|
@@ -7196,7 +7196,7 @@ class WebRTCClient extends Emitter {
|
|
|
7196
7196
|
transfer(session , target ) {
|
|
7197
7197
|
this.hold(session);
|
|
7198
7198
|
|
|
7199
|
-
logger$
|
|
7199
|
+
logger$9.info('Transfering a session', {
|
|
7200
7200
|
id: this.getSipSessionId(session),
|
|
7201
7201
|
target,
|
|
7202
7202
|
});
|
|
@@ -7218,17 +7218,17 @@ class WebRTCClient extends Emitter {
|
|
|
7218
7218
|
atxfer(session ) {
|
|
7219
7219
|
this.hold(session);
|
|
7220
7220
|
|
|
7221
|
-
logger$
|
|
7221
|
+
logger$9.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
7222
7222
|
|
|
7223
7223
|
const result = {
|
|
7224
7224
|
newSession: null,
|
|
7225
7225
|
init: async (target ) => {
|
|
7226
|
-
logger$
|
|
7226
|
+
logger$9.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
7227
7227
|
|
|
7228
7228
|
result.newSession = await this.call(target);
|
|
7229
7229
|
},
|
|
7230
7230
|
complete: () => {
|
|
7231
|
-
logger$
|
|
7231
|
+
logger$9.info('webrtc transfer completed', {
|
|
7232
7232
|
id: this.getSipSessionId(session),
|
|
7233
7233
|
referId: this.getSipSessionId(result.newSession),
|
|
7234
7234
|
});
|
|
@@ -7249,7 +7249,7 @@ class WebRTCClient extends Emitter {
|
|
|
7249
7249
|
return;
|
|
7250
7250
|
}
|
|
7251
7251
|
|
|
7252
|
-
logger$
|
|
7252
|
+
logger$9.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
7253
7253
|
|
|
7254
7254
|
try {
|
|
7255
7255
|
sipSession.message({
|
|
@@ -7291,7 +7291,7 @@ class WebRTCClient extends Emitter {
|
|
|
7291
7291
|
}
|
|
7292
7292
|
|
|
7293
7293
|
changeAudioOutputVolume(volume ) {
|
|
7294
|
-
logger$
|
|
7294
|
+
logger$9.info('Changing audio output volume', { volume });
|
|
7295
7295
|
|
|
7296
7296
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7297
7297
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -7303,7 +7303,7 @@ class WebRTCClient extends Emitter {
|
|
|
7303
7303
|
}
|
|
7304
7304
|
|
|
7305
7305
|
changeAudioOutputDevice(id ) {
|
|
7306
|
-
logger$
|
|
7306
|
+
logger$9.info('Changing audio output device', { id });
|
|
7307
7307
|
|
|
7308
7308
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
7309
7309
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -7320,7 +7320,7 @@ class WebRTCClient extends Emitter {
|
|
|
7320
7320
|
|
|
7321
7321
|
changeAudioInputDevice(id , session ) {
|
|
7322
7322
|
const currentId = this.getAudioDeviceId();
|
|
7323
|
-
logger$
|
|
7323
|
+
logger$9.info('setting audio input device', { id, currentId, session: !!session });
|
|
7324
7324
|
|
|
7325
7325
|
if (id === currentId) {
|
|
7326
7326
|
return null;
|
|
@@ -7366,7 +7366,7 @@ class WebRTCClient extends Emitter {
|
|
|
7366
7366
|
|
|
7367
7367
|
setVideoInputDevice(id ) {
|
|
7368
7368
|
const currentId = this.getVideoDeviceId();
|
|
7369
|
-
logger$
|
|
7369
|
+
logger$9.info('setting video input device', { id, currentId });
|
|
7370
7370
|
|
|
7371
7371
|
if (id === currentId) {
|
|
7372
7372
|
return null;
|
|
@@ -7391,7 +7391,7 @@ class WebRTCClient extends Emitter {
|
|
|
7391
7391
|
const sessionId = this.getSipSessionId(session);
|
|
7392
7392
|
const localStream = this.getLocalStream(sessionId);
|
|
7393
7393
|
|
|
7394
|
-
logger$
|
|
7394
|
+
logger$9.info('changing video input device', { id, sessionId });
|
|
7395
7395
|
|
|
7396
7396
|
// Release old video stream
|
|
7397
7397
|
if (localStream) {
|
|
@@ -7459,7 +7459,7 @@ class WebRTCClient extends Emitter {
|
|
|
7459
7459
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7460
7460
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7461
7461
|
|
|
7462
|
-
logger$
|
|
7462
|
+
logger$9.info('Sending reinvite', {
|
|
7463
7463
|
id: this.getSipSessionId(sipSession),
|
|
7464
7464
|
newConstraints,
|
|
7465
7465
|
conference,
|
|
@@ -7497,7 +7497,7 @@ class WebRTCClient extends Emitter {
|
|
|
7497
7497
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7498
7498
|
}
|
|
7499
7499
|
|
|
7500
|
-
logger$
|
|
7500
|
+
logger$9.info('on re-INVITE accepted', {
|
|
7501
7501
|
id: this.getSipSessionId(sipSession),
|
|
7502
7502
|
wasMuted,
|
|
7503
7503
|
shouldDoScreenSharing,
|
|
@@ -7515,7 +7515,7 @@ class WebRTCClient extends Emitter {
|
|
|
7515
7515
|
this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
|
|
7516
7516
|
}
|
|
7517
7517
|
|
|
7518
|
-
return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
|
|
7518
|
+
return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
|
|
7519
7519
|
},
|
|
7520
7520
|
},
|
|
7521
7521
|
sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
|
|
@@ -7672,7 +7672,7 @@ class WebRTCClient extends Emitter {
|
|
|
7672
7672
|
}
|
|
7673
7673
|
|
|
7674
7674
|
startHeartbeat() {
|
|
7675
|
-
logger$
|
|
7675
|
+
logger$9.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7676
7676
|
if (!this.userAgent) {
|
|
7677
7677
|
this.heartbeat.stop();
|
|
7678
7678
|
return;
|
|
@@ -7685,7 +7685,7 @@ class WebRTCClient extends Emitter {
|
|
|
7685
7685
|
}
|
|
7686
7686
|
|
|
7687
7687
|
stopHeartbeat() {
|
|
7688
|
-
logger$
|
|
7688
|
+
logger$9.info('sdk webrtc stop heartbeat');
|
|
7689
7689
|
this.heartbeat.stop();
|
|
7690
7690
|
}
|
|
7691
7691
|
|
|
@@ -7706,7 +7706,7 @@ class WebRTCClient extends Emitter {
|
|
|
7706
7706
|
}
|
|
7707
7707
|
|
|
7708
7708
|
attemptReconnection() {
|
|
7709
|
-
logger$
|
|
7709
|
+
logger$9.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7710
7710
|
if (!this.userAgent) {
|
|
7711
7711
|
return;
|
|
7712
7712
|
}
|
|
@@ -7731,7 +7731,7 @@ class WebRTCClient extends Emitter {
|
|
|
7731
7731
|
return;
|
|
7732
7732
|
}
|
|
7733
7733
|
|
|
7734
|
-
logger$
|
|
7734
|
+
logger$9.info('setting local media stream', {
|
|
7735
7735
|
sipSessionId,
|
|
7736
7736
|
tracks: newStream ? newStream.getTracks() : null,
|
|
7737
7737
|
});
|
|
@@ -7748,7 +7748,7 @@ class WebRTCClient extends Emitter {
|
|
|
7748
7748
|
|
|
7749
7749
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
7750
7750
|
|
|
7751
|
-
logger$
|
|
7751
|
+
logger$9.info('updating local stream', {
|
|
7752
7752
|
sipSessionId,
|
|
7753
7753
|
oldStream: !!oldStream,
|
|
7754
7754
|
tracks: newStream.getTracks(),
|
|
@@ -7768,7 +7768,7 @@ class WebRTCClient extends Emitter {
|
|
|
7768
7768
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
7769
7769
|
const pc = this.getPeerConnection(sessionId);
|
|
7770
7770
|
|
|
7771
|
-
logger$
|
|
7771
|
+
logger$9.info('Updating remote stream', {
|
|
7772
7772
|
sessionId,
|
|
7773
7773
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
7774
7774
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -7793,14 +7793,16 @@ class WebRTCClient extends Emitter {
|
|
|
7793
7793
|
const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
|
|
7794
7794
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
7795
7795
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
7796
|
+
const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
|
|
7796
7797
|
|
|
7797
|
-
logger$
|
|
7798
|
+
logger$9.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
7798
7799
|
|
|
7799
7800
|
return {
|
|
7800
7801
|
constraints: {
|
|
7801
7802
|
// Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
|
|
7802
7803
|
audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
|
|
7803
|
-
video: screenSharing ? (isDesktop
|
|
7804
|
+
video: screenSharing ? (isDesktop
|
|
7805
|
+
? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
|
|
7804
7806
|
: this._getVideoConstraints(enableVideo),
|
|
7805
7807
|
screen: screenSharing,
|
|
7806
7808
|
desktop: isDesktop,
|
|
@@ -7843,7 +7845,7 @@ class WebRTCClient extends Emitter {
|
|
|
7843
7845
|
}
|
|
7844
7846
|
|
|
7845
7847
|
_onTransportError() {
|
|
7846
|
-
logger$
|
|
7848
|
+
logger$9.error('on transport error');
|
|
7847
7849
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
7848
7850
|
this.attemptReconnection();
|
|
7849
7851
|
}
|
|
@@ -7852,7 +7854,7 @@ class WebRTCClient extends Emitter {
|
|
|
7852
7854
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
7853
7855
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
7854
7856
|
if (this.hasHeartbeat()) {
|
|
7855
|
-
logger$
|
|
7857
|
+
logger$9.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
7856
7858
|
|
|
7857
7859
|
this.heartbeat.onHeartbeat();
|
|
7858
7860
|
if (this.heartbeatCb) {
|
|
@@ -7863,7 +7865,7 @@ class WebRTCClient extends Emitter {
|
|
|
7863
7865
|
}
|
|
7864
7866
|
|
|
7865
7867
|
async _onHeartbeatTimeout() {
|
|
7866
|
-
logger$
|
|
7868
|
+
logger$9.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7867
7869
|
|
|
7868
7870
|
if (this.heartbeatTimeoutCb) {
|
|
7869
7871
|
this.heartbeatTimeoutCb();
|
|
@@ -7875,7 +7877,7 @@ class WebRTCClient extends Emitter {
|
|
|
7875
7877
|
try {
|
|
7876
7878
|
await this.userAgent.transport.disconnect();
|
|
7877
7879
|
} catch (e) {
|
|
7878
|
-
logger$
|
|
7880
|
+
logger$9.error('Transport disconnection after heartbeat timeout, error', e);
|
|
7879
7881
|
}
|
|
7880
7882
|
}
|
|
7881
7883
|
|
|
@@ -7908,31 +7910,31 @@ class WebRTCClient extends Emitter {
|
|
|
7908
7910
|
}
|
|
7909
7911
|
|
|
7910
7912
|
_connectIfNeeded() {
|
|
7911
|
-
logger$
|
|
7913
|
+
logger$9.info('connect if needed, checking', { connected: this.isConnected() });
|
|
7912
7914
|
if (!this.userAgent) {
|
|
7913
|
-
logger$
|
|
7915
|
+
logger$9.info('need to recreate User Agent');
|
|
7914
7916
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
7915
7917
|
}
|
|
7916
7918
|
|
|
7917
7919
|
if (this.isConnected()) {
|
|
7918
|
-
logger$
|
|
7920
|
+
logger$9.info('webrtc sdk, already connected');
|
|
7919
7921
|
return Promise.resolve();
|
|
7920
7922
|
}
|
|
7921
7923
|
|
|
7922
7924
|
if (this.isConnecting()) {
|
|
7923
|
-
logger$
|
|
7925
|
+
logger$9.info('webrtc sdk, already connecting...');
|
|
7924
7926
|
|
|
7925
7927
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
7926
7928
|
return this.connectionPromise;
|
|
7927
7929
|
}
|
|
7928
7930
|
|
|
7929
7931
|
if (this.connectionPromise) {
|
|
7930
|
-
logger$
|
|
7932
|
+
logger$9.info('webrtc sdk, connection promise connecting...');
|
|
7931
7933
|
// $FlowFixMe
|
|
7932
7934
|
return this.connectionPromise;
|
|
7933
7935
|
}
|
|
7934
7936
|
|
|
7935
|
-
logger$
|
|
7937
|
+
logger$9.info('WebRTC UA needs to connect');
|
|
7936
7938
|
|
|
7937
7939
|
// Force UA to reconnect
|
|
7938
7940
|
if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
|
|
@@ -8057,7 +8059,7 @@ class WebRTCClient extends Emitter {
|
|
|
8057
8059
|
|
|
8058
8060
|
sdh.peerConnectionDelegate = {
|
|
8059
8061
|
onicecandidateerror: (error ) => {
|
|
8060
|
-
logger$
|
|
8062
|
+
logger$9.error('on icecandidate error', {
|
|
8061
8063
|
address: error.address,
|
|
8062
8064
|
port: error.port,
|
|
8063
8065
|
errorCode: error.errorCode,
|
|
@@ -8086,7 +8088,7 @@ class WebRTCClient extends Emitter {
|
|
|
8086
8088
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
8087
8089
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
8088
8090
|
}
|
|
8089
|
-
logger$
|
|
8091
|
+
logger$9.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
8090
8092
|
|
|
8091
8093
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
8092
8094
|
|
|
@@ -8102,12 +8104,12 @@ class WebRTCClient extends Emitter {
|
|
|
8102
8104
|
|
|
8103
8105
|
this._setupMedias(session);
|
|
8104
8106
|
|
|
8105
|
-
return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8107
|
+
return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
|
|
8106
8108
|
};
|
|
8107
8109
|
}
|
|
8108
8110
|
|
|
8109
8111
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8110
|
-
logger$
|
|
8112
|
+
logger$9.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8111
8113
|
|
|
8112
8114
|
this.storeSipSession(session);
|
|
8113
8115
|
|
|
@@ -8119,14 +8121,14 @@ class WebRTCClient extends Emitter {
|
|
|
8119
8121
|
const onTrack = (event ) => {
|
|
8120
8122
|
const isAudioOnly = this._isAudioOnly(session);
|
|
8121
8123
|
const { kind, label, readyState, id, muted } = event.track;
|
|
8122
|
-
logger$
|
|
8124
|
+
logger$9.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
8123
8125
|
|
|
8124
8126
|
// Stop video track in audio only mode
|
|
8125
8127
|
if (isAudioOnly && kind === 'video') {
|
|
8126
8128
|
event.track.stop();
|
|
8127
8129
|
}
|
|
8128
8130
|
|
|
8129
|
-
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
8131
|
+
this.eventEmitter.emit(ON_TRACK$1, session, event);
|
|
8130
8132
|
};
|
|
8131
8133
|
|
|
8132
8134
|
if (session.sessionDescriptionHandler.peerConnection) {
|
|
@@ -8135,12 +8137,14 @@ class WebRTCClient extends Emitter {
|
|
|
8135
8137
|
|
|
8136
8138
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
8137
8139
|
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8140
|
+
if (pc) {
|
|
8141
|
+
pc.oniceconnectionstatechange = () => {
|
|
8142
|
+
logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
8143
|
+
if (pc.iceConnectionState === 'disconnected') {
|
|
8144
|
+
this.eventEmitter.emit(ON_DISCONNECTED$1);
|
|
8145
|
+
}
|
|
8146
|
+
};
|
|
8147
|
+
}
|
|
8144
8148
|
|
|
8145
8149
|
if (withEvent) {
|
|
8146
8150
|
this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
|
|
@@ -8309,10 +8313,10 @@ class WebRTCClient extends Emitter {
|
|
|
8309
8313
|
|
|
8310
8314
|
_stopSendingStats(session ) {
|
|
8311
8315
|
const sessionId = this.getSipSessionId(session);
|
|
8312
|
-
logger$
|
|
8316
|
+
logger$9.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
8313
8317
|
|
|
8314
8318
|
if (sessionId in this.statsIntervals) {
|
|
8315
|
-
logger$
|
|
8319
|
+
logger$9.trace('Stop sending stats for call', { sessionId });
|
|
8316
8320
|
this.statsIntervals[sessionId]();
|
|
8317
8321
|
delete this.statsIntervals[sessionId];
|
|
8318
8322
|
}
|
|
@@ -8328,7 +8332,7 @@ class WebRTCClient extends Emitter {
|
|
|
8328
8332
|
try {
|
|
8329
8333
|
await this.userAgent.transport.disconnect();
|
|
8330
8334
|
} catch (e) {
|
|
8331
|
-
logger$
|
|
8335
|
+
logger$9.error('WebRTC transport disconnect, error', e);
|
|
8332
8336
|
}
|
|
8333
8337
|
}
|
|
8334
8338
|
}
|
|
@@ -8350,13 +8354,17 @@ class WebRTCClient extends Emitter {
|
|
|
8350
8354
|
const nbStats = this.sessionNetworkStats[sessionId].length;
|
|
8351
8355
|
const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
|
|
8352
8356
|
const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
|
|
8357
|
+
const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
|
|
8353
8358
|
const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
|
|
8354
8359
|
const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
|
|
8360
|
+
const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
|
|
8355
8361
|
const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
|
|
8356
8362
|
const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
|
|
8357
8363
|
const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
|
|
8358
|
-
let audioBytesSent = 0;
|
|
8359
|
-
let audioBytesReceived = 0;
|
|
8364
|
+
let audioBytesSent = 0; // content + header
|
|
8365
|
+
let audioBytesReceived = 0; // content + header
|
|
8366
|
+
let audioContentSent = 0; // useful to detect blank call
|
|
8367
|
+
let audioContentReceived = 0;
|
|
8360
8368
|
let videoBytesSent = 0;
|
|
8361
8369
|
let videoBytesReceived = 0;
|
|
8362
8370
|
let transportSent = 0;
|
|
@@ -8366,6 +8374,7 @@ class WebRTCClient extends Emitter {
|
|
|
8366
8374
|
stats.forEach(report => {
|
|
8367
8375
|
if (report.type === 'outbound-rtp' && report.kind === 'audio') {
|
|
8368
8376
|
audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
|
|
8377
|
+
audioContentSent += Number(report.bytesSent);
|
|
8369
8378
|
}
|
|
8370
8379
|
if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
|
|
8371
8380
|
audioBytesSent += Number(report.bytesSent);
|
|
@@ -8377,6 +8386,7 @@ class WebRTCClient extends Emitter {
|
|
|
8377
8386
|
packetsLost += Number(report.packetsLost);
|
|
8378
8387
|
networkStats.packetsReceived = Number(report.packetsReceived);
|
|
8379
8388
|
audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
8389
|
+
audioContentReceived += Number(report.bytesReceived);
|
|
8380
8390
|
}
|
|
8381
8391
|
if (report.type === 'inbound-rtp' && report.kind === 'video') {
|
|
8382
8392
|
videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
|
|
@@ -8405,10 +8415,17 @@ class WebRTCClient extends Emitter {
|
|
|
8405
8415
|
});
|
|
8406
8416
|
|
|
8407
8417
|
networkStats.packetsLost = packetsLost;
|
|
8418
|
+
|
|
8408
8419
|
networkStats.totalAudioBytesSent = audioBytesSent;
|
|
8409
8420
|
networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
|
|
8410
8421
|
networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
|
|
8411
8422
|
networkStats.audioBytesReceived = audioBytesReceived;
|
|
8423
|
+
|
|
8424
|
+
networkStats.totalAudioContentSent = audioContentSent;
|
|
8425
|
+
networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
|
|
8426
|
+
networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
|
|
8427
|
+
networkStats.audioContentReceived = audioContentReceived;
|
|
8428
|
+
|
|
8412
8429
|
networkStats.totalVideoBytesSent = videoBytesSent;
|
|
8413
8430
|
networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
|
|
8414
8431
|
networkStats.totalVideoBytesReceived = videoBytesReceived;
|
|
@@ -8422,7 +8439,7 @@ class WebRTCClient extends Emitter {
|
|
|
8422
8439
|
+ networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
|
|
8423
8440
|
+ networkStats.transportSent;
|
|
8424
8441
|
|
|
8425
|
-
this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8442
|
+
this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
|
|
8426
8443
|
this.sessionNetworkStats[sessionId].push(networkStats);
|
|
8427
8444
|
}
|
|
8428
8445
|
|
|
@@ -8450,8 +8467,8 @@ const ON_CALL_FAILED = 'onCallFailed';
|
|
|
8450
8467
|
const ON_CALL_ENDED = 'onCallEnded';
|
|
8451
8468
|
const ON_CALL_ENDING = 'onCallEnding';
|
|
8452
8469
|
const ON_MESSAGE = 'onMessage';
|
|
8453
|
-
const ON_REINVITE
|
|
8454
|
-
const ON_TRACK
|
|
8470
|
+
const ON_REINVITE = 'reinvite';
|
|
8471
|
+
const ON_TRACK = 'onTrack';
|
|
8455
8472
|
const ON_AUDIO_STREAM = 'onAudioStream';
|
|
8456
8473
|
const ON_VIDEO_STREAM = 'onVideoStream';
|
|
8457
8474
|
const ON_REMOVE_STREAM = 'onRemoveStream';
|
|
@@ -8466,15 +8483,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
|
|
|
8466
8483
|
const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
|
|
8467
8484
|
const ON_CALL_ERROR = 'onCallError';
|
|
8468
8485
|
const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
|
|
8469
|
-
const ON_NETWORK_STATS
|
|
8486
|
+
const ON_NETWORK_STATS = 'onNetworkStats';
|
|
8470
8487
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
8471
8488
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
8472
|
-
const ON_DISCONNECTED
|
|
8489
|
+
const ON_DISCONNECTED = 'onDisconnected';
|
|
8473
8490
|
|
|
8474
8491
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
8475
8492
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
8476
8493
|
|
|
8477
|
-
const events
|
|
8494
|
+
const events = [
|
|
8478
8495
|
ON_USER_AGENT,
|
|
8479
8496
|
ON_REGISTERED,
|
|
8480
8497
|
ON_UNREGISTERED,
|
|
@@ -8492,8 +8509,8 @@ const events$1 = [
|
|
|
8492
8509
|
ON_CALL_FAILED,
|
|
8493
8510
|
ON_CALL_ENDED,
|
|
8494
8511
|
ON_MESSAGE,
|
|
8495
|
-
ON_REINVITE
|
|
8496
|
-
ON_TRACK
|
|
8512
|
+
ON_REINVITE,
|
|
8513
|
+
ON_TRACK,
|
|
8497
8514
|
ON_AUDIO_STREAM,
|
|
8498
8515
|
ON_VIDEO_STREAM,
|
|
8499
8516
|
ON_REMOVE_STREAM,
|
|
@@ -8508,11 +8525,11 @@ const events$1 = [
|
|
|
8508
8525
|
ON_CALL_ERROR,
|
|
8509
8526
|
ON_CHAT,
|
|
8510
8527
|
ON_SIGNAL,
|
|
8511
|
-
ON_NETWORK_STATS
|
|
8512
|
-
ON_DISCONNECTED
|
|
8528
|
+
ON_NETWORK_STATS,
|
|
8529
|
+
ON_DISCONNECTED,
|
|
8513
8530
|
];
|
|
8514
8531
|
|
|
8515
|
-
const logger$
|
|
8532
|
+
const logger$8 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
8516
8533
|
|
|
8517
8534
|
class WebRTCPhone extends Emitter {
|
|
8518
8535
|
|
|
@@ -8585,7 +8602,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8585
8602
|
}).catch(error => {
|
|
8586
8603
|
// Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
|
|
8587
8604
|
console.error('register error', error, error.message, error.stack);
|
|
8588
|
-
logger$
|
|
8605
|
+
logger$8.error('WebRTC register error', { message: error.message, stack: error.stack });
|
|
8589
8606
|
});
|
|
8590
8607
|
}
|
|
8591
8608
|
|
|
@@ -8600,7 +8617,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8600
8617
|
if (!this.client) {
|
|
8601
8618
|
return;
|
|
8602
8619
|
}
|
|
8603
|
-
logger$
|
|
8620
|
+
logger$8.info('WebRTC phone stop');
|
|
8604
8621
|
this.client.stop();
|
|
8605
8622
|
}
|
|
8606
8623
|
|
|
@@ -8615,11 +8632,12 @@ class WebRTCPhone extends Emitter {
|
|
|
8615
8632
|
async sendReinvite(callSession , constraints = null, conference = false,
|
|
8616
8633
|
audioOnly = false, iceRestart = false) {
|
|
8617
8634
|
const sipSession = this.findSipSession(callSession);
|
|
8618
|
-
logger$
|
|
8635
|
+
logger$8.info('WebRTC phone - send reinvite', {
|
|
8619
8636
|
sessionId: sipSession ? sipSession.id : null,
|
|
8620
8637
|
constraints,
|
|
8621
8638
|
audioOnly,
|
|
8622
8639
|
conference,
|
|
8640
|
+
iceRestart,
|
|
8623
8641
|
});
|
|
8624
8642
|
|
|
8625
8643
|
if (!sipSession) {
|
|
@@ -8652,7 +8670,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8652
8670
|
}
|
|
8653
8671
|
|
|
8654
8672
|
startHeartbeat() {
|
|
8655
|
-
logger$
|
|
8673
|
+
logger$8.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
|
|
8656
8674
|
if (!this.client || this.client.hasHeartbeat()) {
|
|
8657
8675
|
return;
|
|
8658
8676
|
}
|
|
@@ -8661,7 +8679,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8661
8679
|
}
|
|
8662
8680
|
|
|
8663
8681
|
stopHeartbeat() {
|
|
8664
|
-
logger$
|
|
8682
|
+
logger$8.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
|
|
8665
8683
|
if (!this.client) {
|
|
8666
8684
|
return;
|
|
8667
8685
|
}
|
|
@@ -8678,7 +8696,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8678
8696
|
}
|
|
8679
8697
|
|
|
8680
8698
|
reconnect() {
|
|
8681
|
-
logger$
|
|
8699
|
+
logger$8.info('WebRTC phone - reconnect', { client: !!this.client });
|
|
8682
8700
|
if (!this.client) {
|
|
8683
8701
|
return;
|
|
8684
8702
|
}
|
|
@@ -8719,7 +8737,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8719
8737
|
return false;
|
|
8720
8738
|
}
|
|
8721
8739
|
|
|
8722
|
-
logger$
|
|
8740
|
+
logger$8.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
|
|
8723
8741
|
|
|
8724
8742
|
this.client.downgradeToAudio(sipSession);
|
|
8725
8743
|
|
|
@@ -8742,7 +8760,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8742
8760
|
return Promise.resolve(false);
|
|
8743
8761
|
}
|
|
8744
8762
|
|
|
8745
|
-
logger$
|
|
8763
|
+
logger$8.info('Upgrade to video', {
|
|
8746
8764
|
id: callSession ? callSession.getId() : null,
|
|
8747
8765
|
constraints,
|
|
8748
8766
|
isConference,
|
|
@@ -8782,7 +8800,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8782
8800
|
|
|
8783
8801
|
_sendReinviteMessage(callSession , isUpgrade ) {
|
|
8784
8802
|
const sipSession = this.findSipSession(callSession);
|
|
8785
|
-
logger$
|
|
8803
|
+
logger$8.info('Sending reinvite message', {
|
|
8786
8804
|
id: callSession ? callSession.getId() : null,
|
|
8787
8805
|
isUpgrade,
|
|
8788
8806
|
});
|
|
@@ -8808,7 +8826,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8808
8826
|
// Monkey patch to know when canceled with the CANCEL message
|
|
8809
8827
|
const onCancel = sipSession._onCancel.bind(sipSession);
|
|
8810
8828
|
sipSession._onCancel = (message ) => {
|
|
8811
|
-
logger$
|
|
8829
|
+
logger$8.trace('on sip session canceled', { callId: message.callId });
|
|
8812
8830
|
|
|
8813
8831
|
onCancel(message);
|
|
8814
8832
|
const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
|
|
@@ -8836,13 +8854,13 @@ class WebRTCPhone extends Emitter {
|
|
|
8836
8854
|
this.audioOutputVolume,
|
|
8837
8855
|
);
|
|
8838
8856
|
case sessionState.SessionState.Terminating:
|
|
8839
|
-
logger$
|
|
8857
|
+
logger$8.info('WebRTC phone - call terminating', { sipId: sipSession.id });
|
|
8840
8858
|
|
|
8841
8859
|
this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
|
|
8842
8860
|
|
|
8843
8861
|
break;
|
|
8844
8862
|
case sessionState.SessionState.Terminated: {
|
|
8845
|
-
logger$
|
|
8863
|
+
logger$8.info('WebRTC phone - call terminated', { sipId: sipSession.id });
|
|
8846
8864
|
|
|
8847
8865
|
// Should be called before `_onCallTerminated` or the callCount will not decrement...
|
|
8848
8866
|
const callSession = this._createCallSession(sipSession);
|
|
@@ -8864,7 +8882,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8864
8882
|
const [stream] = event.streams;
|
|
8865
8883
|
const kind = event && event.track && event.track.kind;
|
|
8866
8884
|
|
|
8867
|
-
logger$
|
|
8885
|
+
logger$8.info('on track stream called on the peer connection', {
|
|
8868
8886
|
callId: this.getSipSessionId(sipSession),
|
|
8869
8887
|
streamId: stream ? stream.id : null,
|
|
8870
8888
|
tracks: stream ? stream.getTracks() : null,
|
|
@@ -8884,7 +8902,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8884
8902
|
};
|
|
8885
8903
|
|
|
8886
8904
|
peerConnection.onremovestream = event => {
|
|
8887
|
-
logger$
|
|
8905
|
+
logger$8.info('on remove stream called on the peer connection', {
|
|
8888
8906
|
id: event.stream.id,
|
|
8889
8907
|
tracks: event.stream.getTracks(),
|
|
8890
8908
|
});
|
|
@@ -8894,7 +8912,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8894
8912
|
}
|
|
8895
8913
|
|
|
8896
8914
|
async startScreenSharing(constraints , callSession ) {
|
|
8897
|
-
logger$
|
|
8915
|
+
logger$8.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
|
|
8898
8916
|
|
|
8899
8917
|
const screenShareStream = await this.client.getStreamFromConstraints(constraints);
|
|
8900
8918
|
if (!screenShareStream) {
|
|
@@ -8934,7 +8952,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8934
8952
|
return;
|
|
8935
8953
|
}
|
|
8936
8954
|
|
|
8937
|
-
logger$
|
|
8955
|
+
logger$8.info('WebRTC phone - stop screen sharing', {
|
|
8938
8956
|
restoreLocalStream,
|
|
8939
8957
|
});
|
|
8940
8958
|
|
|
@@ -8990,7 +9008,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8990
9008
|
const pc = this.client.getPeerConnection(sipSessionId);
|
|
8991
9009
|
const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
|
|
8992
9010
|
|
|
8993
|
-
logger$
|
|
9011
|
+
logger$8.info('WebRTC phone - on screensharing', {
|
|
8994
9012
|
hadVideo,
|
|
8995
9013
|
id: this.getSipSessionId(sipSession),
|
|
8996
9014
|
screenTrack,
|
|
@@ -8998,7 +9016,7 @@ class WebRTCPhone extends Emitter {
|
|
|
8998
9016
|
|
|
8999
9017
|
if (screenTrack) {
|
|
9000
9018
|
screenTrack.onended = () => {
|
|
9001
|
-
logger$
|
|
9019
|
+
logger$8.info('WebRTC phone - on screenshare ended', {
|
|
9002
9020
|
hadVideo,
|
|
9003
9021
|
id: this.getSipSessionId(sipSession),
|
|
9004
9022
|
screenTrack,
|
|
@@ -9029,7 +9047,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9029
9047
|
}
|
|
9030
9048
|
|
|
9031
9049
|
_onCallAccepted(sipSession , cameraEnabled ) {
|
|
9032
|
-
logger$
|
|
9050
|
+
logger$8.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
|
|
9033
9051
|
|
|
9034
9052
|
const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
|
|
9035
9053
|
this.currentSipSession = sipSession;
|
|
@@ -9047,7 +9065,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9047
9065
|
}
|
|
9048
9066
|
|
|
9049
9067
|
changeAudioDevice(id ) {
|
|
9050
|
-
logger$
|
|
9068
|
+
logger$8.info('WebRTC phone - change audio device', { deviceId: id });
|
|
9051
9069
|
this.audioOutputDeviceId = id;
|
|
9052
9070
|
this.client.changeAudioOutputDevice(id);
|
|
9053
9071
|
}
|
|
@@ -9057,14 +9075,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9057
9075
|
}
|
|
9058
9076
|
|
|
9059
9077
|
changeRingDevice(id ) {
|
|
9060
|
-
logger$
|
|
9078
|
+
logger$8.info('WebRTC phone - changing ring device', { id });
|
|
9061
9079
|
|
|
9062
9080
|
this.audioRingDeviceId = id;
|
|
9063
9081
|
}
|
|
9064
9082
|
|
|
9065
9083
|
// volume is a value between 0 and 1
|
|
9066
9084
|
changeAudioVolume(volume ) {
|
|
9067
|
-
logger$
|
|
9085
|
+
logger$8.info('WebRTC phone - changing audio volume', { volume });
|
|
9068
9086
|
|
|
9069
9087
|
this.audioOutputVolume = volume;
|
|
9070
9088
|
this.client.changeAudioOutputVolume(volume);
|
|
@@ -9072,31 +9090,31 @@ class WebRTCPhone extends Emitter {
|
|
|
9072
9090
|
|
|
9073
9091
|
// volume is a value between 0 and 1
|
|
9074
9092
|
changeRingVolume(volume ) {
|
|
9075
|
-
logger$
|
|
9093
|
+
logger$8.info('WebRTC phone - changing ring volume', { volume });
|
|
9076
9094
|
|
|
9077
9095
|
this.audioRingVolume = volume;
|
|
9078
9096
|
}
|
|
9079
9097
|
|
|
9080
9098
|
changeAudioInputDevice(id ) {
|
|
9081
|
-
logger$
|
|
9099
|
+
logger$8.info('WebRTC phone - changeAudio input device', { deviceId: id });
|
|
9082
9100
|
|
|
9083
9101
|
return this.client.changeAudioInputDevice(id, this.currentSipSession);
|
|
9084
9102
|
}
|
|
9085
9103
|
|
|
9086
9104
|
changeVideoInputDevice(id ) {
|
|
9087
|
-
logger$
|
|
9105
|
+
logger$8.info('WebRTC phone - change video input device', { deviceId: id });
|
|
9088
9106
|
|
|
9089
9107
|
return this.client.changeVideoInputDevice(id, this.currentSipSession);
|
|
9090
9108
|
}
|
|
9091
9109
|
|
|
9092
9110
|
changeSessionVideoInputDevice(id ) {
|
|
9093
|
-
logger$
|
|
9111
|
+
logger$8.info('WebRTC phone - change session video input device', { deviceId: id });
|
|
9094
9112
|
|
|
9095
9113
|
return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
|
|
9096
9114
|
}
|
|
9097
9115
|
|
|
9098
9116
|
_onCallTerminated(sipSession ) {
|
|
9099
|
-
logger$
|
|
9117
|
+
logger$8.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
|
|
9100
9118
|
|
|
9101
9119
|
const callSession = this._createCallSession(sipSession);
|
|
9102
9120
|
const isCurrentSession = this.isCurrentCallSipSession(callSession);
|
|
@@ -9130,7 +9148,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9130
9148
|
const hasIncomingCallSession = this.hasIncomingCallSession();
|
|
9131
9149
|
|
|
9132
9150
|
// Re-trigger incoming call event for remaining incoming calls
|
|
9133
|
-
logger$
|
|
9151
|
+
logger$8.info('WebRTC phone - check to re-trigger incoming call', {
|
|
9134
9152
|
sipId: sipSession.id,
|
|
9135
9153
|
shouldRetrigger,
|
|
9136
9154
|
hasIncomingCallSession,
|
|
@@ -9221,37 +9239,37 @@ class WebRTCPhone extends Emitter {
|
|
|
9221
9239
|
|
|
9222
9240
|
// Deprecated
|
|
9223
9241
|
getLocalStreamForCall(callSession ) {
|
|
9224
|
-
logger$
|
|
9242
|
+
logger$8.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9225
9243
|
|
|
9226
9244
|
return this.getLocalStream(callSession);
|
|
9227
9245
|
}
|
|
9228
9246
|
|
|
9229
9247
|
// Deprecated
|
|
9230
9248
|
getRemoteStreamForCall(callSession ) {
|
|
9231
|
-
logger$
|
|
9249
|
+
logger$8.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
|
|
9232
9250
|
|
|
9233
9251
|
return this.getRemoteVideoStream(callSession);
|
|
9234
9252
|
}
|
|
9235
9253
|
|
|
9236
9254
|
getRemoteStreamsForCall(callSession ) {
|
|
9237
|
-
logger$
|
|
9255
|
+
logger$8.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
|
|
9238
9256
|
|
|
9239
9257
|
return this.getRemoteStream(callSession);
|
|
9240
9258
|
}
|
|
9241
9259
|
|
|
9242
9260
|
accept(callSession , cameraEnabled ) {
|
|
9243
|
-
logger$
|
|
9261
|
+
logger$8.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
|
|
9244
9262
|
if (this.currentSipSession) {
|
|
9245
9263
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
|
|
9246
9264
|
}
|
|
9247
9265
|
|
|
9248
9266
|
if (!callSession) {
|
|
9249
|
-
logger$
|
|
9267
|
+
logger$8.warn('no CallSession to accept.');
|
|
9250
9268
|
return Promise.resolve(null);
|
|
9251
9269
|
}
|
|
9252
9270
|
|
|
9253
9271
|
if (callSession.getId() in this.acceptedSessions) {
|
|
9254
|
-
logger$
|
|
9272
|
+
logger$8.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9255
9273
|
return Promise.resolve(callSession.sipCallId);
|
|
9256
9274
|
}
|
|
9257
9275
|
|
|
@@ -9263,24 +9281,24 @@ class WebRTCPhone extends Emitter {
|
|
|
9263
9281
|
const sipSession = this.client.getSipSession(callSession.getId());
|
|
9264
9282
|
if (sipSession) {
|
|
9265
9283
|
if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
|
|
9266
|
-
logger$
|
|
9284
|
+
logger$8.warn('Trying to answer a terminated sipSession.');
|
|
9267
9285
|
|
|
9268
9286
|
return Promise.resolve(null);
|
|
9269
9287
|
}
|
|
9270
9288
|
|
|
9271
|
-
logger$
|
|
9289
|
+
logger$8.info('accept call, session found', { sipId: sipSession.id });
|
|
9272
9290
|
|
|
9273
9291
|
// $FlowFixMe
|
|
9274
9292
|
return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
|
|
9275
9293
|
return callSession.sipCallId;
|
|
9276
9294
|
}).catch(e => {
|
|
9277
|
-
logger$
|
|
9295
|
+
logger$8.error(e);
|
|
9278
9296
|
this.endCurrentCall(callSession);
|
|
9279
9297
|
throw e;
|
|
9280
9298
|
});
|
|
9281
9299
|
}
|
|
9282
9300
|
|
|
9283
|
-
logger$
|
|
9301
|
+
logger$8.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
|
|
9284
9302
|
|
|
9285
9303
|
return Promise.resolve(null);
|
|
9286
9304
|
}
|
|
@@ -9290,7 +9308,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9290
9308
|
}
|
|
9291
9309
|
|
|
9292
9310
|
async reject(callSession ) {
|
|
9293
|
-
logger$
|
|
9311
|
+
logger$8.info('reject WebRTC called', { id: callSession.getId() });
|
|
9294
9312
|
|
|
9295
9313
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
|
|
9296
9314
|
if (!callSession || callSession.getId() in this.rejectedSessions) {
|
|
@@ -9302,14 +9320,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9302
9320
|
|
|
9303
9321
|
const sipSession = this.findSipSession(callSession);
|
|
9304
9322
|
if (sipSession) {
|
|
9305
|
-
logger$
|
|
9323
|
+
logger$8.info('WebRTC rejecting', { sipId: sipSession.id });
|
|
9306
9324
|
|
|
9307
9325
|
this.client.hangup(sipSession);
|
|
9308
9326
|
}
|
|
9309
9327
|
}
|
|
9310
9328
|
|
|
9311
9329
|
async ignore(callSession ) {
|
|
9312
|
-
logger$
|
|
9330
|
+
logger$8.info('WebRTC ignore', { id: callSession.getId() });
|
|
9313
9331
|
|
|
9314
9332
|
// kill the ring
|
|
9315
9333
|
this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
|
|
@@ -9321,14 +9339,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9321
9339
|
const sipSession = this.findSipSession(callSession);
|
|
9322
9340
|
|
|
9323
9341
|
if (sipSession) {
|
|
9324
|
-
logger$
|
|
9342
|
+
logger$8.info('WebRTC atxfer', { sipId: sipSession.id });
|
|
9325
9343
|
|
|
9326
9344
|
return this.client.atxfer(sipSession);
|
|
9327
9345
|
}
|
|
9328
9346
|
}
|
|
9329
9347
|
|
|
9330
9348
|
hold(callSession , withEvent = true, isConference = false) {
|
|
9331
|
-
logger$
|
|
9349
|
+
logger$8.info('WebRTC hold', { id: callSession.getId() });
|
|
9332
9350
|
|
|
9333
9351
|
const sipSession = this.findSipSession(callSession);
|
|
9334
9352
|
|
|
@@ -9343,18 +9361,18 @@ class WebRTCPhone extends Emitter {
|
|
|
9343
9361
|
}
|
|
9344
9362
|
|
|
9345
9363
|
resume(callSession , isConference = false, withEvent = true) {
|
|
9346
|
-
logger$
|
|
9364
|
+
logger$8.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
|
|
9347
9365
|
|
|
9348
9366
|
const sipSession = this.findSipSession(callSession);
|
|
9349
9367
|
if (!sipSession) {
|
|
9350
9368
|
return new Promise((resolve, reject) => reject(new Error('No session to resume')));
|
|
9351
9369
|
}
|
|
9352
9370
|
|
|
9353
|
-
logger$
|
|
9371
|
+
logger$8.info('WebRTC resuming', { sipId: sipSession.id });
|
|
9354
9372
|
|
|
9355
9373
|
// Hold current session if different from the current one (we don't want 2 sessions active at the same time).
|
|
9356
9374
|
if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
|
|
9357
|
-
logger$
|
|
9375
|
+
logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
|
|
9358
9376
|
this.holdSipSession(this.currentSipSession, callSession);
|
|
9359
9377
|
}
|
|
9360
9378
|
|
|
@@ -9379,7 +9397,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9379
9397
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9380
9398
|
const hasVideo = this.client.hasLocalVideo(sessionId);
|
|
9381
9399
|
|
|
9382
|
-
logger$
|
|
9400
|
+
logger$8.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9383
9401
|
|
|
9384
9402
|
// Stop screenshre if needed
|
|
9385
9403
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
@@ -9410,7 +9428,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9410
9428
|
return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
|
|
9411
9429
|
}
|
|
9412
9430
|
const sessionId = this.getSipSessionId(sipSession);
|
|
9413
|
-
logger$
|
|
9431
|
+
logger$8.info('WebRTC unhold sip session', { sessionId, isConference });
|
|
9414
9432
|
|
|
9415
9433
|
const { hasVideo } = this.client.getHeldSession(sessionId) || {};
|
|
9416
9434
|
const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
|
|
@@ -9454,14 +9472,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9454
9472
|
}
|
|
9455
9473
|
|
|
9456
9474
|
mute(callSession , withEvent = true) {
|
|
9457
|
-
logger$
|
|
9475
|
+
logger$8.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
|
|
9458
9476
|
|
|
9459
9477
|
const sipSession = this.findSipSession(callSession);
|
|
9460
9478
|
if (!sipSession) {
|
|
9461
9479
|
return;
|
|
9462
9480
|
}
|
|
9463
9481
|
|
|
9464
|
-
logger$
|
|
9482
|
+
logger$8.info('WebRTC muting', { sipId: sipSession.id });
|
|
9465
9483
|
this.client.mute(sipSession);
|
|
9466
9484
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
|
|
9467
9485
|
|
|
@@ -9475,14 +9493,14 @@ class WebRTCPhone extends Emitter {
|
|
|
9475
9493
|
}
|
|
9476
9494
|
|
|
9477
9495
|
unmute(callSession , withEvent = true) {
|
|
9478
|
-
logger$
|
|
9496
|
+
logger$8.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
|
|
9479
9497
|
|
|
9480
9498
|
const sipSession = this.findSipSession(callSession);
|
|
9481
9499
|
if (!sipSession) {
|
|
9482
9500
|
return;
|
|
9483
9501
|
}
|
|
9484
9502
|
|
|
9485
|
-
logger$
|
|
9503
|
+
logger$8.info('WebRTC unmuting', { sipId: sipSession.id });
|
|
9486
9504
|
this.client.unmute(sipSession);
|
|
9487
9505
|
const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
|
|
9488
9506
|
|
|
@@ -9509,7 +9527,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9509
9527
|
if (!sipSession) {
|
|
9510
9528
|
return;
|
|
9511
9529
|
}
|
|
9512
|
-
logger$
|
|
9530
|
+
logger$8.info('WebRTC turn camera on', { sipId: sipSession.id });
|
|
9513
9531
|
|
|
9514
9532
|
this.client.toggleCameraOn(sipSession);
|
|
9515
9533
|
|
|
@@ -9521,7 +9539,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9521
9539
|
if (!sipSession) {
|
|
9522
9540
|
return;
|
|
9523
9541
|
}
|
|
9524
|
-
logger$
|
|
9542
|
+
logger$8.info('WebRTC turn camera off', { sipId: sipSession.id });
|
|
9525
9543
|
|
|
9526
9544
|
this.client.toggleCameraOff(sipSession);
|
|
9527
9545
|
this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
|
|
@@ -9533,7 +9551,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9533
9551
|
return;
|
|
9534
9552
|
}
|
|
9535
9553
|
|
|
9536
|
-
logger$
|
|
9554
|
+
logger$8.info('WebRTC send key', { sipId: sipSession.id, tone });
|
|
9537
9555
|
this.client.sendDTMF(sipSession, tone);
|
|
9538
9556
|
}
|
|
9539
9557
|
|
|
@@ -9541,7 +9559,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9541
9559
|
// @TODO: line is not used here
|
|
9542
9560
|
async makeCall(number , line , cameraEnabled ,
|
|
9543
9561
|
audioOnly = false, conference = false) {
|
|
9544
|
-
logger$
|
|
9562
|
+
logger$8.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
|
|
9545
9563
|
if (!number) {
|
|
9546
9564
|
return Promise.resolve(null);
|
|
9547
9565
|
}
|
|
@@ -9551,7 +9569,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9551
9569
|
}
|
|
9552
9570
|
if (this.currentSipSession) {
|
|
9553
9571
|
this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
|
|
9554
|
-
logger$
|
|
9572
|
+
logger$8.warn('Unable to hold current session when making another call', e);
|
|
9555
9573
|
});
|
|
9556
9574
|
}
|
|
9557
9575
|
|
|
@@ -9561,7 +9579,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9561
9579
|
this._bindEvents(sipSession);
|
|
9562
9580
|
} catch (error) {
|
|
9563
9581
|
console.warn(error);
|
|
9564
|
-
logger$
|
|
9582
|
+
logger$8.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
|
|
9565
9583
|
return Promise.resolve(null);
|
|
9566
9584
|
}
|
|
9567
9585
|
const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
|
|
@@ -9589,7 +9607,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9589
9607
|
return;
|
|
9590
9608
|
}
|
|
9591
9609
|
|
|
9592
|
-
logger$
|
|
9610
|
+
logger$8.info('WebRTC transfer', { sipId: sipSession.id, target });
|
|
9593
9611
|
|
|
9594
9612
|
this.client.transfer(sipSession, target);
|
|
9595
9613
|
}
|
|
@@ -9598,7 +9616,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9598
9616
|
const sipSession = this.client.getSipSession(source.sipCallId);
|
|
9599
9617
|
const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
|
|
9600
9618
|
|
|
9601
|
-
logger$
|
|
9619
|
+
logger$8.info('WebRTC indirect transfer', {
|
|
9602
9620
|
sipId: sipSession ? sipSession.id : null,
|
|
9603
9621
|
target: sipSessionTarget ? sipSessionTarget.id : null,
|
|
9604
9622
|
});
|
|
@@ -9637,7 +9655,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9637
9655
|
return false;
|
|
9638
9656
|
}
|
|
9639
9657
|
|
|
9640
|
-
logger$
|
|
9658
|
+
logger$8.info('WebRTC hangup', { sipId: sipSession.id });
|
|
9641
9659
|
|
|
9642
9660
|
const sipSessionId = this.getSipSessionId(sipSession);
|
|
9643
9661
|
|
|
@@ -9683,7 +9701,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9683
9701
|
endCurrentCall(callSession ) {
|
|
9684
9702
|
const isCurrent = this.isCurrentCallSipSession(callSession);
|
|
9685
9703
|
|
|
9686
|
-
logger$
|
|
9704
|
+
logger$8.info('Ending current call', {
|
|
9687
9705
|
id: callSession ? callSession.getId() : null,
|
|
9688
9706
|
isCurrent,
|
|
9689
9707
|
});
|
|
@@ -9707,7 +9725,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9707
9725
|
}
|
|
9708
9726
|
|
|
9709
9727
|
async close() {
|
|
9710
|
-
logger$
|
|
9728
|
+
logger$8.info('WebRTC close');
|
|
9711
9729
|
|
|
9712
9730
|
try {
|
|
9713
9731
|
await Promise.race([
|
|
@@ -9715,7 +9733,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9715
9733
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
|
|
9716
9734
|
]);
|
|
9717
9735
|
} catch (e) {
|
|
9718
|
-
logger$
|
|
9736
|
+
logger$8.error('WebRTC close, unregister error', e);
|
|
9719
9737
|
}
|
|
9720
9738
|
|
|
9721
9739
|
this.client.close();
|
|
@@ -9733,12 +9751,12 @@ class WebRTCPhone extends Emitter {
|
|
|
9733
9751
|
}
|
|
9734
9752
|
|
|
9735
9753
|
enableRinging() {
|
|
9736
|
-
logger$
|
|
9754
|
+
logger$8.info('WebRTC enable ringing');
|
|
9737
9755
|
this.ringingEnabled = true;
|
|
9738
9756
|
}
|
|
9739
9757
|
|
|
9740
9758
|
disableRinging() {
|
|
9741
|
-
logger$
|
|
9759
|
+
logger$8.info('WebRTC disable ringing');
|
|
9742
9760
|
this.ringingEnabled = false;
|
|
9743
9761
|
}
|
|
9744
9762
|
|
|
@@ -9778,7 +9796,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9778
9796
|
|
|
9779
9797
|
// Deprecated
|
|
9780
9798
|
getLocalMediaStream(callSession ) {
|
|
9781
|
-
logger$
|
|
9799
|
+
logger$8.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
|
|
9782
9800
|
return this.getLocalStream(callSession);
|
|
9783
9801
|
}
|
|
9784
9802
|
|
|
@@ -9820,7 +9838,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9820
9838
|
this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
|
|
9821
9839
|
const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
|
|
9822
9840
|
const withVideo = this.allowVideo ? wantsToDoVideo : false;
|
|
9823
|
-
logger$
|
|
9841
|
+
logger$8.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
|
|
9824
9842
|
|
|
9825
9843
|
const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
|
|
9826
9844
|
this.incomingSessions.push(callSession.getId());
|
|
@@ -9843,7 +9861,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9843
9861
|
});
|
|
9844
9862
|
|
|
9845
9863
|
this.client.on(this.client.ON_REINVITE, (...args) => {
|
|
9846
|
-
logger$
|
|
9864
|
+
logger$8.info('WebRTC on reinvite', {
|
|
9847
9865
|
sessionId: args[0].id,
|
|
9848
9866
|
inviteId: args[1].id,
|
|
9849
9867
|
updatedCalleeName: args[2],
|
|
@@ -9863,7 +9881,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9863
9881
|
});
|
|
9864
9882
|
|
|
9865
9883
|
this.client.on(this.client.ACCEPTED, (sipSession ) => {
|
|
9866
|
-
logger$
|
|
9884
|
+
logger$8.info('WebRTC call accepted', { sipId: sipSession.id });
|
|
9867
9885
|
|
|
9868
9886
|
this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
|
|
9869
9887
|
|
|
@@ -9874,22 +9892,22 @@ class WebRTCPhone extends Emitter {
|
|
|
9874
9892
|
this.client.on('ended', () => {});
|
|
9875
9893
|
|
|
9876
9894
|
this.client.on(this.client.ON_ERROR, e => {
|
|
9877
|
-
logger$
|
|
9895
|
+
logger$8.error('WebRTC error', e);
|
|
9878
9896
|
this.eventEmitter.emit(ON_CALL_ERROR, e);
|
|
9879
9897
|
});
|
|
9880
9898
|
|
|
9881
9899
|
this.client.on(this.client.UNREGISTERED, () => {
|
|
9882
|
-
logger$
|
|
9900
|
+
logger$8.info('WebRTC unregistered');
|
|
9883
9901
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
9884
9902
|
});
|
|
9885
9903
|
|
|
9886
9904
|
this.client.on(this.client.ON_DISCONNECTED, () => {
|
|
9887
|
-
logger$
|
|
9888
|
-
this.eventEmitter.emit(ON_DISCONNECTED
|
|
9905
|
+
logger$8.info('WebRTC disconnected');
|
|
9906
|
+
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
9889
9907
|
});
|
|
9890
9908
|
|
|
9891
9909
|
this.client.on(this.client.REGISTERED, () => {
|
|
9892
|
-
logger$
|
|
9910
|
+
logger$8.info('WebRTC registered', {
|
|
9893
9911
|
shouldSendReinvite: this.shouldSendReinvite,
|
|
9894
9912
|
state: this.currentSipSession ? this.currentSipSession.state : null,
|
|
9895
9913
|
currentSipSession: !!this.currentSipSession,
|
|
@@ -9910,19 +9928,19 @@ class WebRTCPhone extends Emitter {
|
|
|
9910
9928
|
// Send reinvite with iceRestart
|
|
9911
9929
|
this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
|
|
9912
9930
|
} catch (e) {
|
|
9913
|
-
logger$
|
|
9931
|
+
logger$8.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
|
|
9914
9932
|
}
|
|
9915
9933
|
}
|
|
9916
9934
|
});
|
|
9917
9935
|
|
|
9918
9936
|
this.client.on(this.client.CONNECTED, () => {
|
|
9919
|
-
logger$
|
|
9937
|
+
logger$8.info('WebRTC client connected');
|
|
9920
9938
|
|
|
9921
9939
|
this.stopHeartbeat();
|
|
9922
9940
|
});
|
|
9923
9941
|
|
|
9924
9942
|
this.client.on(this.client.DISCONNECTED, () => {
|
|
9925
|
-
logger$
|
|
9943
|
+
logger$8.info('WebRTC client disconnected');
|
|
9926
9944
|
|
|
9927
9945
|
this.eventEmitter.emit(ON_UNREGISTERED);
|
|
9928
9946
|
|
|
@@ -9936,7 +9954,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9936
9954
|
});
|
|
9937
9955
|
|
|
9938
9956
|
this.client.on(this.client.ON_TRACK, (session, event) => {
|
|
9939
|
-
this.eventEmitter.emit(ON_TRACK
|
|
9957
|
+
this.eventEmitter.emit(ON_TRACK, session, event);
|
|
9940
9958
|
});
|
|
9941
9959
|
|
|
9942
9960
|
this.client.on('onVideoInputChange', stream => {
|
|
@@ -9951,7 +9969,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9951
9969
|
this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
|
|
9952
9970
|
const callSession = this.getCallSession(this.getSipSessionId(session));
|
|
9953
9971
|
|
|
9954
|
-
this.eventEmitter.emit(ON_NETWORK_STATS
|
|
9972
|
+
this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
|
|
9955
9973
|
});
|
|
9956
9974
|
|
|
9957
9975
|
// Used when upgrading directly in screenshare mode
|
|
@@ -9960,7 +9978,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9960
9978
|
const localStream = this.client.getLocalStream(sipSessionId);
|
|
9961
9979
|
const callSession = this.callSessions[sipSessionId];
|
|
9962
9980
|
|
|
9963
|
-
logger$
|
|
9981
|
+
logger$8.info('Updrading directly in screensharing mode', {
|
|
9964
9982
|
sipSessionId,
|
|
9965
9983
|
tracks: localStream ? localStream.getTracks() : null,
|
|
9966
9984
|
});
|
|
@@ -10138,8 +10156,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10138
10156
|
ON_CALL_ENDED: ON_CALL_ENDED,
|
|
10139
10157
|
ON_CALL_ENDING: ON_CALL_ENDING,
|
|
10140
10158
|
ON_MESSAGE: ON_MESSAGE,
|
|
10141
|
-
ON_REINVITE: ON_REINVITE
|
|
10142
|
-
ON_TRACK: ON_TRACK
|
|
10159
|
+
ON_REINVITE: ON_REINVITE,
|
|
10160
|
+
ON_TRACK: ON_TRACK,
|
|
10143
10161
|
ON_AUDIO_STREAM: ON_AUDIO_STREAM,
|
|
10144
10162
|
ON_VIDEO_STREAM: ON_VIDEO_STREAM,
|
|
10145
10163
|
ON_REMOVE_STREAM: ON_REMOVE_STREAM,
|
|
@@ -10154,19 +10172,19 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
10154
10172
|
ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
|
|
10155
10173
|
ON_CALL_ERROR: ON_CALL_ERROR,
|
|
10156
10174
|
ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
|
|
10157
|
-
ON_NETWORK_STATS: ON_NETWORK_STATS
|
|
10175
|
+
ON_NETWORK_STATS: ON_NETWORK_STATS,
|
|
10158
10176
|
ON_CHAT: ON_CHAT,
|
|
10159
10177
|
ON_SIGNAL: ON_SIGNAL,
|
|
10160
|
-
ON_DISCONNECTED: ON_DISCONNECTED
|
|
10178
|
+
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
10161
10179
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
10162
10180
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
10163
|
-
events: events
|
|
10181
|
+
events: events,
|
|
10164
10182
|
'default': WebRTCPhone
|
|
10165
10183
|
});
|
|
10166
10184
|
|
|
10167
10185
|
//
|
|
10168
10186
|
|
|
10169
|
-
const logger$
|
|
10187
|
+
const logger$7 = IssueReporter$1.loggerFor('simple-phone');
|
|
10170
10188
|
const sipLogger = IssueReporter$1.loggerFor('sip.js');
|
|
10171
10189
|
const protocolLogger = IssueReporter$1.loggerFor('sip');
|
|
10172
10190
|
|
|
@@ -10273,7 +10291,7 @@ class Phone extends Emitter {
|
|
|
10273
10291
|
async disconnect() {
|
|
10274
10292
|
if (this.phone) {
|
|
10275
10293
|
if (this.phone.hasAnActiveCall()) {
|
|
10276
|
-
logger$
|
|
10294
|
+
logger$7.info('hangup call on disconnect');
|
|
10277
10295
|
// $FlowFixMe
|
|
10278
10296
|
await this.phone.hangup();
|
|
10279
10297
|
}
|
|
@@ -10296,13 +10314,13 @@ class Phone extends Emitter {
|
|
|
10296
10314
|
}
|
|
10297
10315
|
|
|
10298
10316
|
async hangup(callSession ) {
|
|
10299
|
-
logger$
|
|
10317
|
+
logger$7.info('hangup via simple phone', { callId: callSession.getId() });
|
|
10300
10318
|
|
|
10301
10319
|
return this.phone && this.phone.hangup(callSession);
|
|
10302
10320
|
}
|
|
10303
10321
|
|
|
10304
10322
|
async accept(callSession , cameraEnabled ) {
|
|
10305
|
-
logger$
|
|
10323
|
+
logger$7.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
|
|
10306
10324
|
|
|
10307
10325
|
return this.phone && this.phone.accept(callSession, cameraEnabled);
|
|
10308
10326
|
}
|
|
@@ -10341,7 +10359,7 @@ class Phone extends Emitter {
|
|
|
10341
10359
|
muteViaAPI(callSession ) {
|
|
10342
10360
|
if (callSession && callSession.callId) {
|
|
10343
10361
|
Wazo.getApiClient().calld.mute(callSession.callId).catch(e => {
|
|
10344
|
-
logger$
|
|
10362
|
+
logger$7.error('Mute via API, error', e);
|
|
10345
10363
|
});
|
|
10346
10364
|
}
|
|
10347
10365
|
}
|
|
@@ -10349,7 +10367,7 @@ class Phone extends Emitter {
|
|
|
10349
10367
|
unmuteViaAPI(callSession ) {
|
|
10350
10368
|
if (callSession && callSession.callId) {
|
|
10351
10369
|
Wazo.getApiClient().calld.unmute(callSession.callId).catch(e => {
|
|
10352
|
-
logger$
|
|
10370
|
+
logger$7.error('Unmute via API, error', e);
|
|
10353
10371
|
});
|
|
10354
10372
|
}
|
|
10355
10373
|
}
|
|
@@ -10457,7 +10475,7 @@ class Phone extends Emitter {
|
|
|
10457
10475
|
|
|
10458
10476
|
// @Deprecated
|
|
10459
10477
|
getLocalMediaStream(callSession ) {
|
|
10460
|
-
logger$
|
|
10478
|
+
logger$7.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
|
|
10461
10479
|
|
|
10462
10480
|
return this.phone && this.phone.getLocalStream(callSession);
|
|
10463
10481
|
}
|
|
@@ -10480,20 +10498,20 @@ class Phone extends Emitter {
|
|
|
10480
10498
|
|
|
10481
10499
|
// @Deprecated
|
|
10482
10500
|
getRemoteStreamForCall(callSession ) {
|
|
10483
|
-
logger$
|
|
10501
|
+
logger$7.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
|
|
10484
10502
|
return this.getRemoteStream(callSession);
|
|
10485
10503
|
}
|
|
10486
10504
|
|
|
10487
10505
|
// Returns remote streams directly from the peerConnection
|
|
10488
10506
|
// @Deprecated
|
|
10489
10507
|
getRemoteStreamsForCall(callSession ) {
|
|
10490
|
-
logger$
|
|
10508
|
+
logger$7.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
|
|
10491
10509
|
return this.getLocalStream(callSession);
|
|
10492
10510
|
}
|
|
10493
10511
|
|
|
10494
10512
|
// @Deprecated
|
|
10495
10513
|
getRemoteVideoStreamForCall(callSession ) {
|
|
10496
|
-
logger$
|
|
10514
|
+
logger$7.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
|
|
10497
10515
|
|
|
10498
10516
|
return this.getRemoteVideoStream(callSession);
|
|
10499
10517
|
}
|
|
@@ -10554,7 +10572,7 @@ class Phone extends Emitter {
|
|
|
10554
10572
|
|
|
10555
10573
|
_transferEvents() {
|
|
10556
10574
|
this.unbind();
|
|
10557
|
-
[...events, ...transportEvents].forEach(event => {
|
|
10575
|
+
[...events$1, ...transportEvents].forEach(event => {
|
|
10558
10576
|
this.client.on(event, (...args) =>
|
|
10559
10577
|
this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
|
|
10560
10578
|
});
|
|
@@ -10576,7 +10594,7 @@ var Phone$1 = global.wazoTelephonyInstance;
|
|
|
10576
10594
|
|
|
10577
10595
|
//
|
|
10578
10596
|
|
|
10579
|
-
const SOCKET_EVENTS = {
|
|
10597
|
+
const SOCKET_EVENTS$1 = {
|
|
10580
10598
|
ON_OPEN: 'onopen',
|
|
10581
10599
|
ON_MESSAGE: 'onmessage',
|
|
10582
10600
|
ON_ERROR: 'onerror',
|
|
@@ -10729,16 +10747,16 @@ class WebSocketClient extends Emitter {
|
|
|
10729
10747
|
|
|
10730
10748
|
this.socket.onopen = () => {
|
|
10731
10749
|
logger$6.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
10732
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
10750
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
|
|
10733
10751
|
};
|
|
10734
10752
|
|
|
10735
10753
|
this.socket.onerror = event => {
|
|
10736
10754
|
logger$6.error('on Wazo WS error', event.target);
|
|
10737
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
10755
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
|
|
10738
10756
|
};
|
|
10739
10757
|
|
|
10740
10758
|
this.socket.onmessage = (event ) => {
|
|
10741
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
|
|
10759
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
|
|
10742
10760
|
|
|
10743
10761
|
const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
|
|
10744
10762
|
let { name } = message;
|
|
@@ -10771,11 +10789,11 @@ class WebSocketClient extends Emitter {
|
|
|
10771
10789
|
token: this.token,
|
|
10772
10790
|
});
|
|
10773
10791
|
this.initialized = false;
|
|
10774
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
|
|
10792
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
|
|
10775
10793
|
|
|
10776
10794
|
switch (event.code) {
|
|
10777
10795
|
case 4002:
|
|
10778
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
|
|
10796
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
|
|
10779
10797
|
break;
|
|
10780
10798
|
}
|
|
10781
10799
|
};
|
|
@@ -10891,7 +10909,7 @@ class WebSocketClient extends Emitter {
|
|
|
10891
10909
|
break;
|
|
10892
10910
|
case 'start':
|
|
10893
10911
|
this.initialized = true;
|
|
10894
|
-
this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
|
|
10912
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
|
|
10895
10913
|
break;
|
|
10896
10914
|
default:
|
|
10897
10915
|
this.eventEmitter.emit('message', message);
|
|
@@ -10938,7 +10956,7 @@ class WebSocketClient extends Emitter {
|
|
|
10938
10956
|
logger$6.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
10939
10957
|
|
|
10940
10958
|
this.close();
|
|
10941
|
-
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
10959
|
+
this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
10942
10960
|
|
|
10943
10961
|
if (this.onHeartBeatTimeout) {
|
|
10944
10962
|
this.onHeartBeatTimeout();
|
|
@@ -11018,7 +11036,7 @@ WebSocketClient.eventLists = [
|
|
|
11018
11036
|
|
|
11019
11037
|
var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
11020
11038
|
__proto__: null,
|
|
11021
|
-
SOCKET_EVENTS: SOCKET_EVENTS,
|
|
11039
|
+
SOCKET_EVENTS: SOCKET_EVENTS$1,
|
|
11022
11040
|
AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
|
|
11023
11041
|
FAVORITE_ADDED: FAVORITE_ADDED,
|
|
11024
11042
|
FAVORITE_DELETED: FAVORITE_DELETED,
|
|
@@ -11091,10 +11109,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
|
|
|
11091
11109
|
|
|
11092
11110
|
//
|
|
11093
11111
|
|
|
11094
|
-
const { SOCKET_EVENTS
|
|
11095
|
-
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS
|
|
11112
|
+
const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
|
|
11113
|
+
const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
|
|
11096
11114
|
|
|
11097
|
-
const logger$
|
|
11115
|
+
const logger$5 = IssueReporter$1.loggerFor('simple-ws-client');
|
|
11098
11116
|
|
|
11099
11117
|
class Websocket extends Emitter {
|
|
11100
11118
|
|
|
@@ -11108,9 +11126,9 @@ class Websocket extends Emitter {
|
|
|
11108
11126
|
// $FlowFixMe
|
|
11109
11127
|
this[key] = OTHER_EVENTS[key];
|
|
11110
11128
|
});
|
|
11111
|
-
Object.keys(SOCKET_EVENTS
|
|
11129
|
+
Object.keys(SOCKET_EVENTS).forEach(key => {
|
|
11112
11130
|
// $FlowFixMe
|
|
11113
|
-
this[key] = SOCKET_EVENTS
|
|
11131
|
+
this[key] = SOCKET_EVENTS[key];
|
|
11114
11132
|
});
|
|
11115
11133
|
this.eventLists = WebSocketClient.eventLists;
|
|
11116
11134
|
|
|
@@ -11118,7 +11136,7 @@ class Websocket extends Emitter {
|
|
|
11118
11136
|
}
|
|
11119
11137
|
|
|
11120
11138
|
open(host , session ) {
|
|
11121
|
-
logger$
|
|
11139
|
+
logger$5.info('open simple WebSocket', { host, token: session.token });
|
|
11122
11140
|
this.ws = new WebSocketClient(
|
|
11123
11141
|
{
|
|
11124
11142
|
host,
|
|
@@ -11146,7 +11164,7 @@ class Websocket extends Emitter {
|
|
|
11146
11164
|
}
|
|
11147
11165
|
|
|
11148
11166
|
updateToken(token ) {
|
|
11149
|
-
logger$
|
|
11167
|
+
logger$5.info('update token via simple Websocket', { token, ws: !!this.ws });
|
|
11150
11168
|
|
|
11151
11169
|
if (!this.ws) {
|
|
11152
11170
|
return;
|
|
@@ -11174,7 +11192,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
|
|
|
11174
11192
|
|
|
11175
11193
|
//
|
|
11176
11194
|
|
|
11177
|
-
const logger$
|
|
11195
|
+
const logger$4 = IssueReporter$1.loggerFor('room');
|
|
11178
11196
|
|
|
11179
11197
|
class Participant extends Emitter {
|
|
11180
11198
|
|
|
@@ -11296,7 +11314,7 @@ class Participant extends Emitter {
|
|
|
11296
11314
|
}
|
|
11297
11315
|
|
|
11298
11316
|
onTalking(isTalking ) {
|
|
11299
|
-
logger$
|
|
11317
|
+
logger$4.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
|
|
11300
11318
|
this.isTalking = isTalking;
|
|
11301
11319
|
// you may notice we're not broadcasting: since all participants are getting this info
|
|
11302
11320
|
// directly from asterisk, there's no need to do so
|
|
@@ -11399,7 +11417,7 @@ class Participant extends Emitter {
|
|
|
11399
11417
|
}
|
|
11400
11418
|
|
|
11401
11419
|
updateStatus(status , broadcast = true) {
|
|
11402
|
-
logger$
|
|
11420
|
+
logger$4.info('updating participant status', { name: this.name, status });
|
|
11403
11421
|
|
|
11404
11422
|
if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
|
|
11405
11423
|
if (status.audioMuted) {
|
|
@@ -11447,7 +11465,7 @@ class Participant extends Emitter {
|
|
|
11447
11465
|
|
|
11448
11466
|
broadcastStatus(inboundStatus = null) {
|
|
11449
11467
|
const status = inboundStatus || this.getStatus();
|
|
11450
|
-
logger$
|
|
11468
|
+
logger$4.info('broadcasting participant status', { callId: this.callId, status });
|
|
11451
11469
|
|
|
11452
11470
|
this.room.sendSignal({
|
|
11453
11471
|
type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
|
|
@@ -11483,9 +11501,9 @@ class LocalParticipant extends Participant {
|
|
|
11483
11501
|
const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
|
|
11484
11502
|
const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
|
|
11485
11503
|
|
|
11486
|
-
const logger$
|
|
11504
|
+
const logger$3 = IssueReporter$1.loggerFor('sdk-room');
|
|
11487
11505
|
|
|
11488
|
-
class Room extends Emitter {
|
|
11506
|
+
class Room$1 extends Emitter {
|
|
11489
11507
|
|
|
11490
11508
|
|
|
11491
11509
|
|
|
@@ -11543,7 +11561,7 @@ class Room extends Emitter {
|
|
|
11543
11561
|
extra = {},
|
|
11544
11562
|
) {
|
|
11545
11563
|
super();
|
|
11546
|
-
logger$
|
|
11564
|
+
logger$3.info('room initialized', { callId, extension, sourceId, meetingUuid });
|
|
11547
11565
|
|
|
11548
11566
|
// Represents the room callSession
|
|
11549
11567
|
this.callSession = callSession;
|
|
@@ -11609,7 +11627,7 @@ class Room extends Emitter {
|
|
|
11609
11627
|
* @returns {Promise<Room>}
|
|
11610
11628
|
*/
|
|
11611
11629
|
static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
|
|
11612
|
-
logger$
|
|
11630
|
+
logger$3.info('connecting to room', { extension, audioOnly, room: !!room });
|
|
11613
11631
|
|
|
11614
11632
|
if (!room) {
|
|
11615
11633
|
await Wazo.Phone.connect();
|
|
@@ -11622,7 +11640,7 @@ class Room extends Emitter {
|
|
|
11622
11640
|
|
|
11623
11641
|
// Call_created is triggered before call_accepted, so we have to listen for it here.
|
|
11624
11642
|
Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
|
|
11625
|
-
logger$
|
|
11643
|
+
logger$3.info('room call received via WS', { callId: data.call_id });
|
|
11626
11644
|
if (room) {
|
|
11627
11645
|
room.setCallId(data.call_id);
|
|
11628
11646
|
}
|
|
@@ -11630,7 +11648,7 @@ class Room extends Emitter {
|
|
|
11630
11648
|
|
|
11631
11649
|
const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
|
|
11632
11650
|
// eslint-disable-next-line no-param-reassign
|
|
11633
|
-
room = new Room(callSession, extension, null, null, extra);
|
|
11651
|
+
room = new Room$1(callSession, extension, null, null, extra);
|
|
11634
11652
|
|
|
11635
11653
|
// Wait for the call to be accepted
|
|
11636
11654
|
await new Promise((resolve, reject) => {
|
|
@@ -11651,7 +11669,7 @@ class Room extends Emitter {
|
|
|
11651
11669
|
// Retrieve conference
|
|
11652
11670
|
const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
|
|
11653
11671
|
|
|
11654
|
-
logger$
|
|
11672
|
+
logger$3.info('connected to room', {
|
|
11655
11673
|
sourceId: conference ? conference.sourceId : null,
|
|
11656
11674
|
name: conference ? conference.name : null,
|
|
11657
11675
|
});
|
|
@@ -11661,7 +11679,7 @@ class Room extends Emitter {
|
|
|
11661
11679
|
room.setName(conference.name);
|
|
11662
11680
|
}
|
|
11663
11681
|
} else if (meeting) {
|
|
11664
|
-
logger$
|
|
11682
|
+
logger$3.info('Already connected to meeting', {
|
|
11665
11683
|
uuid: meeting.uuid,
|
|
11666
11684
|
name: meeting.name,
|
|
11667
11685
|
});
|
|
@@ -11674,13 +11692,13 @@ class Room extends Emitter {
|
|
|
11674
11692
|
}
|
|
11675
11693
|
|
|
11676
11694
|
static disconnect() {
|
|
11677
|
-
logger$
|
|
11695
|
+
logger$3.info('static disconnection to room');
|
|
11678
11696
|
|
|
11679
11697
|
Wazo.Phone.disconnect();
|
|
11680
11698
|
}
|
|
11681
11699
|
|
|
11682
11700
|
async disconnect() {
|
|
11683
|
-
logger$
|
|
11701
|
+
logger$3.info('disconnection to room called');
|
|
11684
11702
|
|
|
11685
11703
|
await Wazo.Phone.hangup(this.callSession);
|
|
11686
11704
|
this.callSession = null;
|
|
@@ -11700,19 +11718,19 @@ class Room extends Emitter {
|
|
|
11700
11718
|
}
|
|
11701
11719
|
|
|
11702
11720
|
setSourceId(sourceId ) {
|
|
11703
|
-
logger$
|
|
11721
|
+
logger$3.info('set room source id', { sourceId });
|
|
11704
11722
|
|
|
11705
11723
|
this.sourceId = sourceId;
|
|
11706
11724
|
}
|
|
11707
11725
|
|
|
11708
11726
|
setMeetingUuid(meetingUuid ) {
|
|
11709
|
-
logger$
|
|
11727
|
+
logger$3.info('set meeting uuid', { meetingUuid });
|
|
11710
11728
|
|
|
11711
11729
|
this.meetingUuid = meetingUuid;
|
|
11712
11730
|
}
|
|
11713
11731
|
|
|
11714
11732
|
setCallId(callId ) {
|
|
11715
|
-
logger$
|
|
11733
|
+
logger$3.info('set room call id', { callId });
|
|
11716
11734
|
|
|
11717
11735
|
if (callId) {
|
|
11718
11736
|
this.callId = callId;
|
|
@@ -11720,7 +11738,7 @@ class Room extends Emitter {
|
|
|
11720
11738
|
}
|
|
11721
11739
|
|
|
11722
11740
|
setName(name ) {
|
|
11723
|
-
logger$
|
|
11741
|
+
logger$3.info('set room name', { name });
|
|
11724
11742
|
|
|
11725
11743
|
this.name = name;
|
|
11726
11744
|
}
|
|
@@ -11739,7 +11757,7 @@ class Room extends Emitter {
|
|
|
11739
11757
|
}
|
|
11740
11758
|
|
|
11741
11759
|
async startScreenSharing(constraints ) {
|
|
11742
|
-
logger$
|
|
11760
|
+
logger$3.info('start room screen sharing', { constraints });
|
|
11743
11761
|
|
|
11744
11762
|
const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
|
|
11745
11763
|
if (!screensharingStream) {
|
|
@@ -11753,7 +11771,7 @@ class Room extends Emitter {
|
|
|
11753
11771
|
}
|
|
11754
11772
|
|
|
11755
11773
|
async stopScreenSharing(restoreLocalStream = true) {
|
|
11756
|
-
logger$
|
|
11774
|
+
logger$3.info('stop room screen sharing');
|
|
11757
11775
|
|
|
11758
11776
|
await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
|
|
11759
11777
|
|
|
@@ -11765,7 +11783,7 @@ class Room extends Emitter {
|
|
|
11765
11783
|
}
|
|
11766
11784
|
|
|
11767
11785
|
turnCameraOff() {
|
|
11768
|
-
logger$
|
|
11786
|
+
logger$3.info('turn room camera off');
|
|
11769
11787
|
|
|
11770
11788
|
Wazo.Phone.turnCameraOff(this.callSession);
|
|
11771
11789
|
|
|
@@ -11775,7 +11793,7 @@ class Room extends Emitter {
|
|
|
11775
11793
|
}
|
|
11776
11794
|
|
|
11777
11795
|
turnCameraOn() {
|
|
11778
|
-
logger$
|
|
11796
|
+
logger$3.info('turn room camera on');
|
|
11779
11797
|
|
|
11780
11798
|
Wazo.Phone.turnCameraOn(this.callSession);
|
|
11781
11799
|
|
|
@@ -11785,7 +11803,7 @@ class Room extends Emitter {
|
|
|
11785
11803
|
}
|
|
11786
11804
|
|
|
11787
11805
|
mute() {
|
|
11788
|
-
logger$
|
|
11806
|
+
logger$3.info('mute room');
|
|
11789
11807
|
|
|
11790
11808
|
Wazo.Phone.mute(this.callSession);
|
|
11791
11809
|
|
|
@@ -11793,7 +11811,7 @@ class Room extends Emitter {
|
|
|
11793
11811
|
}
|
|
11794
11812
|
|
|
11795
11813
|
unmute() {
|
|
11796
|
-
logger$
|
|
11814
|
+
logger$3.info('unmute room');
|
|
11797
11815
|
|
|
11798
11816
|
Wazo.Phone.unmute(this.callSession);
|
|
11799
11817
|
|
|
@@ -11813,7 +11831,7 @@ class Room extends Emitter {
|
|
|
11813
11831
|
}
|
|
11814
11832
|
|
|
11815
11833
|
hold() {
|
|
11816
|
-
logger$
|
|
11834
|
+
logger$3.info('hold room');
|
|
11817
11835
|
|
|
11818
11836
|
Wazo.Phone.hold(this.callSession, true);
|
|
11819
11837
|
|
|
@@ -11823,7 +11841,7 @@ class Room extends Emitter {
|
|
|
11823
11841
|
}
|
|
11824
11842
|
|
|
11825
11843
|
async resume() {
|
|
11826
|
-
logger$
|
|
11844
|
+
logger$3.info('resume room');
|
|
11827
11845
|
|
|
11828
11846
|
const newStream = await Wazo.Phone.resume(this.callSession, true);
|
|
11829
11847
|
|
|
@@ -11851,13 +11869,13 @@ class Room extends Emitter {
|
|
|
11851
11869
|
}
|
|
11852
11870
|
|
|
11853
11871
|
sendDTMF(tone ) {
|
|
11854
|
-
logger$
|
|
11872
|
+
logger$3.info('send room DTMF', { tone });
|
|
11855
11873
|
|
|
11856
11874
|
Wazo.Phone.sendDTMF(tone, this.callSession);
|
|
11857
11875
|
}
|
|
11858
11876
|
|
|
11859
11877
|
async sendReinvite(newConstraints = null) {
|
|
11860
|
-
logger$
|
|
11878
|
+
logger$3.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
|
|
11861
11879
|
const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
|
|
11862
11880
|
|
|
11863
11881
|
Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
|
|
@@ -11916,7 +11934,7 @@ class Room extends Emitter {
|
|
|
11916
11934
|
Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
|
|
11917
11935
|
|
|
11918
11936
|
this.on(this.ON_AUDIO_STREAM, stream => {
|
|
11919
|
-
logger$
|
|
11937
|
+
logger$3.info('on room audio stream');
|
|
11920
11938
|
|
|
11921
11939
|
this.audioStream = stream;
|
|
11922
11940
|
if (!this.roomAudioElement) {
|
|
@@ -11929,7 +11947,7 @@ class Room extends Emitter {
|
|
|
11929
11947
|
});
|
|
11930
11948
|
|
|
11931
11949
|
this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
|
|
11932
|
-
logger$
|
|
11950
|
+
logger$3.info('on room video stream', { streamId });
|
|
11933
11951
|
|
|
11934
11952
|
this._mapMsid(sipSession.body.body);
|
|
11935
11953
|
|
|
@@ -11944,7 +11962,7 @@ class Room extends Emitter {
|
|
|
11944
11962
|
});
|
|
11945
11963
|
|
|
11946
11964
|
this.on(this.ON_REMOVE_STREAM, stream => {
|
|
11947
|
-
logger$
|
|
11965
|
+
logger$3.info('on room remove stream');
|
|
11948
11966
|
|
|
11949
11967
|
const participant = this.participants.find(someParticipant =>
|
|
11950
11968
|
someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
|
|
@@ -12076,7 +12094,7 @@ class Room extends Emitter {
|
|
|
12076
12094
|
const requester = this._getParticipantFromCallId(origin.callId);
|
|
12077
12095
|
if (requester) {
|
|
12078
12096
|
// @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
|
|
12079
|
-
logger$
|
|
12097
|
+
logger$3.info('trigger room requester status', { origin });
|
|
12080
12098
|
requester.triggerUpdate('REQUESTER_UPDATE');
|
|
12081
12099
|
}
|
|
12082
12100
|
break;
|
|
@@ -12107,24 +12125,24 @@ class Room extends Emitter {
|
|
|
12107
12125
|
|
|
12108
12126
|
// When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
|
|
12109
12127
|
if (participant.user_uuid === session.uuid) {
|
|
12110
|
-
logger$
|
|
12128
|
+
logger$3.info('room current user joined');
|
|
12111
12129
|
|
|
12112
12130
|
// Retrieve participants via an API calls
|
|
12113
12131
|
const conferenceId = this.sourceId || payload.data.conference_id;
|
|
12114
12132
|
let response;
|
|
12115
12133
|
try {
|
|
12116
12134
|
if (this.meetingUuid) {
|
|
12117
|
-
logger$
|
|
12135
|
+
logger$3.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
|
|
12118
12136
|
response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
|
|
12119
12137
|
} else {
|
|
12120
|
-
logger$
|
|
12138
|
+
logger$3.info('fetching conference participants', { conferenceId });
|
|
12121
12139
|
response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
|
|
12122
12140
|
}
|
|
12123
12141
|
} catch (e) {
|
|
12124
|
-
logger$
|
|
12142
|
+
logger$3.error('room participants fetching, error', e);
|
|
12125
12143
|
}
|
|
12126
12144
|
if (response) {
|
|
12127
|
-
logger$
|
|
12145
|
+
logger$3.info('conference participants fetched', { nb: response.items.length });
|
|
12128
12146
|
participants = response.items.map(item => {
|
|
12129
12147
|
const isMe = item.call_id === this.callId;
|
|
12130
12148
|
|
|
@@ -12151,7 +12169,7 @@ class Room extends Emitter {
|
|
|
12151
12169
|
? new Wazo.RemoteParticipant(this, participant)
|
|
12152
12170
|
: null;
|
|
12153
12171
|
|
|
12154
|
-
logger$
|
|
12172
|
+
logger$3.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
|
|
12155
12173
|
|
|
12156
12174
|
if (remoteParticipant) {
|
|
12157
12175
|
this.participants.push(remoteParticipant);
|
|
@@ -12316,12 +12334,12 @@ class Room extends Emitter {
|
|
|
12316
12334
|
|
|
12317
12335
|
//
|
|
12318
12336
|
|
|
12319
|
-
const logger$
|
|
12337
|
+
const logger$2 = IssueReporter$1.loggerFor('sdk-sip-room');
|
|
12320
12338
|
|
|
12321
|
-
class SipRoom extends Room {
|
|
12339
|
+
class SipRoom extends Room$1 {
|
|
12322
12340
|
|
|
12323
12341
|
static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
|
|
12324
|
-
logger$
|
|
12342
|
+
logger$2.info('connecting to sip room', { extension, audioOnly, room: !!room });
|
|
12325
12343
|
|
|
12326
12344
|
if (!room) {
|
|
12327
12345
|
await Wazo.Phone.connect();
|
|
@@ -12337,7 +12355,7 @@ class SipRoom extends Room {
|
|
|
12337
12355
|
room.setCallId(room.callSession.call.id);
|
|
12338
12356
|
}
|
|
12339
12357
|
|
|
12340
|
-
logger$
|
|
12358
|
+
logger$2.info('connected to room', {
|
|
12341
12359
|
extension: room.extension,
|
|
12342
12360
|
});
|
|
12343
12361
|
|
|
@@ -12345,7 +12363,7 @@ class SipRoom extends Room {
|
|
|
12345
12363
|
}
|
|
12346
12364
|
|
|
12347
12365
|
mute() {
|
|
12348
|
-
logger$
|
|
12366
|
+
logger$2.info('mute sip room');
|
|
12349
12367
|
|
|
12350
12368
|
Wazo.Phone.mute(this.callSession, false);
|
|
12351
12369
|
|
|
@@ -12353,7 +12371,7 @@ class SipRoom extends Room {
|
|
|
12353
12371
|
}
|
|
12354
12372
|
|
|
12355
12373
|
unmute() {
|
|
12356
|
-
logger$
|
|
12374
|
+
logger$2.info('unmute sip room');
|
|
12357
12375
|
|
|
12358
12376
|
Wazo.Phone.unmute(this.callSession, false);
|
|
12359
12377
|
|
|
@@ -12620,7 +12638,7 @@ class NotificationOptions {
|
|
|
12620
12638
|
|
|
12621
12639
|
|
|
12622
12640
|
// Represents a conference room, like `9000`.
|
|
12623
|
-
class Room
|
|
12641
|
+
class Room {
|
|
12624
12642
|
|
|
12625
12643
|
|
|
12626
12644
|
|
|
@@ -12641,7 +12659,7 @@ class Room$1 {
|
|
|
12641
12659
|
}
|
|
12642
12660
|
|
|
12643
12661
|
connect(callSession ) {
|
|
12644
|
-
return new Room
|
|
12662
|
+
return new Room({ ...this, connectedCallSession: callSession });
|
|
12645
12663
|
}
|
|
12646
12664
|
|
|
12647
12665
|
has(callSession ) {
|
|
@@ -12650,7 +12668,7 @@ class Room$1 {
|
|
|
12650
12668
|
|
|
12651
12669
|
addParticipant(uuid , extension , talking = null) {
|
|
12652
12670
|
if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
|
|
12653
|
-
return new Room
|
|
12671
|
+
return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
|
|
12654
12672
|
}
|
|
12655
12673
|
|
|
12656
12674
|
return this;
|
|
@@ -12669,7 +12687,7 @@ class Room$1 {
|
|
|
12669
12687
|
updatedParticipants.push(participant);
|
|
12670
12688
|
}
|
|
12671
12689
|
|
|
12672
|
-
return new Room
|
|
12690
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12673
12691
|
}
|
|
12674
12692
|
|
|
12675
12693
|
updateParticipantByExtension(extension , participant , shouldAdd = false) {
|
|
@@ -12685,7 +12703,7 @@ class Room$1 {
|
|
|
12685
12703
|
updatedParticipants.push(participant);
|
|
12686
12704
|
}
|
|
12687
12705
|
|
|
12688
|
-
return new Room
|
|
12706
|
+
return new Room({ ...this, participants: updatedParticipants });
|
|
12689
12707
|
}
|
|
12690
12708
|
|
|
12691
12709
|
hasCallWithId(id ) {
|
|
@@ -12693,18 +12711,18 @@ class Room$1 {
|
|
|
12693
12711
|
}
|
|
12694
12712
|
|
|
12695
12713
|
disconnect() {
|
|
12696
|
-
return new Room
|
|
12714
|
+
return new Room({ ...this, connectedCallSession: null });
|
|
12697
12715
|
}
|
|
12698
12716
|
|
|
12699
12717
|
removeParticipantWithUUID(uuid ) {
|
|
12700
|
-
return new Room
|
|
12718
|
+
return new Room({
|
|
12701
12719
|
...this,
|
|
12702
12720
|
participants: this.participants.filter(participant => participant.uuid !== uuid),
|
|
12703
12721
|
});
|
|
12704
12722
|
}
|
|
12705
12723
|
|
|
12706
12724
|
removeParticipantWithExtension(extension ) {
|
|
12707
|
-
return new Room
|
|
12725
|
+
return new Room({
|
|
12708
12726
|
...this,
|
|
12709
12727
|
participants: this.participants.filter(participant => participant.extension !== extension),
|
|
12710
12728
|
});
|
|
@@ -12715,7 +12733,7 @@ class Room$1 {
|
|
|
12715
12733
|
}
|
|
12716
12734
|
|
|
12717
12735
|
static newFrom(room ) {
|
|
12718
|
-
return newFrom(room, Room
|
|
12736
|
+
return newFrom(room, Room);
|
|
12719
12737
|
}
|
|
12720
12738
|
}
|
|
12721
12739
|
|
|
@@ -13022,11 +13040,11 @@ var wazoWebsocket = {
|
|
|
13022
13040
|
resolve();
|
|
13023
13041
|
};
|
|
13024
13042
|
|
|
13025
|
-
client.on(SOCKET_EVENTS.ON_ERROR, error => {
|
|
13043
|
+
client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
|
|
13026
13044
|
handleError(`Connection error : ${error}`);
|
|
13027
13045
|
});
|
|
13028
13046
|
|
|
13029
|
-
client.on(SOCKET_EVENTS.ON_OPEN, () => {
|
|
13047
|
+
client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
|
|
13030
13048
|
if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
|
|
13031
13049
|
client.setOnHeartbeatTimeout(() => {
|
|
13032
13050
|
handleError('No response to heartbeat');
|
|
@@ -13127,7 +13145,7 @@ var webrtc = {
|
|
|
13127
13145
|
}),
|
|
13128
13146
|
};
|
|
13129
13147
|
|
|
13130
|
-
const parseCandidate
|
|
13148
|
+
const parseCandidate = line => {
|
|
13131
13149
|
let parts;
|
|
13132
13150
|
// Parse both variants.
|
|
13133
13151
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -13218,7 +13236,7 @@ var SymmetricNat = {
|
|
|
13218
13236
|
}
|
|
13219
13237
|
|
|
13220
13238
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
13221
|
-
const cand = parseCandidate
|
|
13239
|
+
const cand = parseCandidate(e.candidate.candidate);
|
|
13222
13240
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
13223
13241
|
candidates[cand.relatedPort].push(cand.port);
|
|
13224
13242
|
} else if (!e.candidate) {
|
|
@@ -13286,7 +13304,7 @@ var iceIpv4 = {
|
|
|
13286
13304
|
const rawCandidate = e.candidate.candidate;
|
|
13287
13305
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
13288
13306
|
hasSrflxOrRelay = true;
|
|
13289
|
-
const candidate = parseCandidate
|
|
13307
|
+
const candidate = parseCandidate(e.candidate.candidate);
|
|
13290
13308
|
ips.push(candidate.ip);
|
|
13291
13309
|
}
|
|
13292
13310
|
} else if (!e.candidate) {
|
|
@@ -13323,7 +13341,7 @@ var checks = [
|
|
|
13323
13341
|
|
|
13324
13342
|
//
|
|
13325
13343
|
|
|
13326
|
-
const logger$
|
|
13344
|
+
const logger$1 = IssueReporter$1.loggerFor('engine-check');
|
|
13327
13345
|
|
|
13328
13346
|
class Checker {
|
|
13329
13347
|
|
|
@@ -13341,28 +13359,28 @@ class Checker {
|
|
|
13341
13359
|
async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
|
|
13342
13360
|
await this._addEngineVersion();
|
|
13343
13361
|
|
|
13344
|
-
logger$
|
|
13362
|
+
logger$1.info('Engine check starting');
|
|
13345
13363
|
|
|
13346
13364
|
for (let i = 0; i < this.checks.length; i++) {
|
|
13347
13365
|
const { name, check } = this.checks[i];
|
|
13348
13366
|
|
|
13349
|
-
logger$
|
|
13367
|
+
logger$1.info(`Checking ${name} ...`);
|
|
13350
13368
|
|
|
13351
13369
|
onCheckBegin(name);
|
|
13352
13370
|
try {
|
|
13353
13371
|
// eslint-disable-next-line no-await-in-loop
|
|
13354
13372
|
const result = await check(this.server, this.session, this.externalAppConfig);
|
|
13355
|
-
logger$
|
|
13373
|
+
logger$1.info(`Checking ${name} success.`, { result });
|
|
13356
13374
|
|
|
13357
13375
|
onCheckResult(name, result);
|
|
13358
13376
|
} catch (e) {
|
|
13359
|
-
logger$
|
|
13377
|
+
logger$1.info(`Checking ${name} failure`, { message: e.message });
|
|
13360
13378
|
|
|
13361
13379
|
onCheckResult(name, e);
|
|
13362
13380
|
}
|
|
13363
13381
|
}
|
|
13364
13382
|
|
|
13365
|
-
logger$
|
|
13383
|
+
logger$1.info('Engine check done.');
|
|
13366
13384
|
}
|
|
13367
13385
|
|
|
13368
13386
|
addCheck(check ) {
|
|
@@ -13386,7 +13404,7 @@ const Wazo = {
|
|
|
13386
13404
|
Auth: Auth$1,
|
|
13387
13405
|
Phone: Phone$1,
|
|
13388
13406
|
Websocket: Websocket$1,
|
|
13389
|
-
Room,
|
|
13407
|
+
Room: Room$1,
|
|
13390
13408
|
SipRoom,
|
|
13391
13409
|
RemoteParticipant,
|
|
13392
13410
|
LocalParticipant,
|
|
@@ -13419,7 +13437,7 @@ const Wazo = {
|
|
|
13419
13437
|
Session,
|
|
13420
13438
|
Voicemail,
|
|
13421
13439
|
Relocation,
|
|
13422
|
-
ConferenceRoom: Room
|
|
13440
|
+
ConferenceRoom: Room,
|
|
13423
13441
|
CallSession,
|
|
13424
13442
|
IndirectTransfer,
|
|
13425
13443
|
SwitchboardCall,
|
|
@@ -13458,7 +13476,7 @@ if (global) {
|
|
|
13458
13476
|
class InvalidSubscription extends Error {}
|
|
13459
13477
|
class InvalidAuthorization extends Error {}
|
|
13460
13478
|
|
|
13461
|
-
const logger
|
|
13479
|
+
const logger = IssueReporter$1.loggerFor('simple-auth');
|
|
13462
13480
|
|
|
13463
13481
|
class Auth {
|
|
13464
13482
|
|
|
@@ -13493,7 +13511,7 @@ class Auth {
|
|
|
13493
13511
|
setApiClientId(this.clientId);
|
|
13494
13512
|
setRefreshExpiration(this.expiration);
|
|
13495
13513
|
setOnRefreshToken((token , session ) => {
|
|
13496
|
-
logger
|
|
13514
|
+
logger.info('on refresh token done', { token });
|
|
13497
13515
|
setApiToken(token);
|
|
13498
13516
|
Wazo.Websocket.updateToken(token);
|
|
13499
13517
|
|
|
@@ -13538,7 +13556,7 @@ class Auth {
|
|
|
13538
13556
|
const rawSession = await getApiClient().auth.authenticate(token);
|
|
13539
13557
|
return this._onAuthenticated(rawSession);
|
|
13540
13558
|
} catch (e) {
|
|
13541
|
-
logger
|
|
13559
|
+
logger.error('on validate token error', e);
|
|
13542
13560
|
console.warn(e);
|
|
13543
13561
|
return false;
|
|
13544
13562
|
}
|