@wazo/sdk 0.37.23 → 0.37.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wazo-sdk.js +6 -6
- package/esm/__tests__/api-client.test.js +22 -17
- package/esm/__tests__/web-rtc-client.test.js +105 -100
- package/esm/api/amid.js +1 -1
- package/esm/api/call-logd.js +2 -2
- package/esm/api/confd.js +10 -5
- package/esm/api/ctid-ng.js +3 -3
- package/esm/api/dird.js +1 -1
- package/esm/api/webhookd.js +1 -1
- package/esm/api-client.js +22 -17
- package/esm/checker/Checker.js +130 -125
- package/esm/checker/checks/aor.js +22 -17
- package/esm/checker/checks/api.js +22 -17
- package/esm/checker/checks/index.js +120 -115
- package/esm/checker/checks/wazo-websocket.js +15 -15
- package/esm/checker/checks/webrtc-transport.js +105 -100
- package/esm/checker/checks/webrtc.js +105 -100
- package/esm/domain/AdHocAPIConference.js +22 -17
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/Contact.js +1 -1
- package/esm/domain/Features.js +22 -17
- package/esm/domain/Meeting.js +12 -5
- package/esm/domain/Phone/CTIPhone.js +36 -31
- package/esm/domain/Phone/WebRTCPhone.js +110 -87
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/Contact.test.js +1 -1
- package/esm/domain/__tests__/Meeting.test.js +144 -0
- package/esm/index.js +365 -337
- package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
- package/esm/service/CallApi.js +22 -17
- package/esm/service/IssueReporter.js +1 -1
- package/esm/service/__tests__/IssueReporter.test.js +1 -1
- package/esm/service/getApiClient.js +22 -17
- package/esm/simple/Auth.js +355 -327
- package/esm/simple/Configuration.js +355 -327
- package/esm/simple/Directory.js +22 -17
- package/esm/simple/Phone.js +355 -327
- package/esm/simple/Websocket.js +17 -17
- package/esm/simple/index.js +359 -331
- package/esm/simple/room/LocalParticipant.js +359 -331
- package/esm/simple/room/Participant.js +359 -331
- package/esm/simple/room/RemoteParticipant.js +359 -331
- package/esm/simple/room/Room.js +360 -332
- package/esm/simple/room/SipRoom.js +359 -331
- package/esm/simple/room/Stream.js +359 -331
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/esm/simple/utils.js +359 -331
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/web-rtc-client.js +105 -100
- package/esm/websocket-client.js +15 -15
- package/lib/__tests__/api-client.test.js +22 -17
- package/lib/__tests__/web-rtc-client.test.js +105 -100
- package/lib/api/amid.js +1 -1
- package/lib/api/call-logd.js +2 -2
- package/lib/api/confd.js +10 -5
- package/lib/api/ctid-ng.js +3 -3
- package/lib/api/dird.js +1 -1
- package/lib/api/webhookd.js +1 -1
- package/lib/api-client.js +22 -17
- package/lib/checker/Checker.js +130 -125
- package/lib/checker/checks/aor.js +22 -17
- package/lib/checker/checks/api.js +22 -17
- package/lib/checker/checks/index.js +120 -115
- package/lib/checker/checks/wazo-websocket.js +15 -15
- package/lib/checker/checks/webrtc-transport.js +105 -100
- package/lib/checker/checks/webrtc.js +105 -100
- package/lib/domain/AdHocAPIConference.js +22 -17
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +22 -17
- package/lib/domain/Meeting.js +16 -5
- package/lib/domain/Phone/CTIPhone.js +36 -31
- package/lib/domain/Phone/WebRTCPhone.js +110 -87
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/Contact.test.js +1 -1
- package/lib/domain/__tests__/Meeting.test.js +150 -0
- package/lib/index.js +365 -337
- package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
- package/lib/service/CallApi.js +22 -17
- package/lib/service/IssueReporter.js +1 -1
- package/lib/service/__tests__/IssueReporter.test.js +1 -1
- package/lib/service/getApiClient.js +22 -17
- package/lib/simple/Auth.js +355 -327
- package/lib/simple/Configuration.js +355 -327
- package/lib/simple/Directory.js +22 -17
- package/lib/simple/Phone.js +355 -327
- package/lib/simple/Websocket.js +17 -17
- package/lib/simple/index.js +359 -331
- package/lib/simple/room/LocalParticipant.js +359 -331
- package/lib/simple/room/Participant.js +359 -331
- package/lib/simple/room/RemoteParticipant.js +359 -331
- package/lib/simple/room/Room.js +360 -332
- package/lib/simple/room/SipRoom.js +359 -331
- package/lib/simple/room/Stream.js +359 -331
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/lib/simple/utils.js +359 -331
- package/lib/types/WebSocketMessage.js +2 -0
- package/lib/web-rtc-client.js +105 -100
- package/lib/websocket-client.js +15 -15
- package/package.json +1 -1
- package/src/domain/Meeting.js +12 -5
- package/src/domain/Phone/WebRTCPhone.js +24 -1
- package/src/domain/__tests__/Meeting.test.js +50 -0
|
@@ -458,7 +458,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
458
458
|
|
|
459
459
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
460
460
|
|
|
461
|
-
const logger
|
|
461
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
462
462
|
|
|
463
463
|
// Use a function here to be able to mock it in tests
|
|
464
464
|
const realFetch = () => {
|
|
@@ -597,7 +597,7 @@ class ApiRequester {
|
|
|
597
597
|
};
|
|
598
598
|
|
|
599
599
|
if (this.refreshTokenPromise) {
|
|
600
|
-
logger
|
|
600
|
+
logger.info('A token is already refreshing, waiting ...', { url });
|
|
601
601
|
await this.refreshTokenPromise;
|
|
602
602
|
}
|
|
603
603
|
|
|
@@ -617,7 +617,7 @@ class ApiRequester {
|
|
|
617
617
|
return promise.then(async (err ) => {
|
|
618
618
|
// Check if the token is still valid
|
|
619
619
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
620
|
-
logger
|
|
620
|
+
logger.warn('token expired', { error: err.reason });
|
|
621
621
|
// Replay the call after refreshing the token
|
|
622
622
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
623
623
|
}
|
|
@@ -627,7 +627,7 @@ class ApiRequester {
|
|
|
627
627
|
: exceptionClass.fromResponse(err, response.status);
|
|
628
628
|
|
|
629
629
|
if (this.shouldLogErrors) {
|
|
630
|
-
logger
|
|
630
|
+
logger.error('API error', error);
|
|
631
631
|
}
|
|
632
632
|
|
|
633
633
|
throw error;
|
|
@@ -637,7 +637,7 @@ class ApiRequester {
|
|
|
637
637
|
return newParse(response, isJson);
|
|
638
638
|
}).catch(error => {
|
|
639
639
|
if (this.shouldLogErrors) {
|
|
640
|
-
logger
|
|
640
|
+
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
641
641
|
}
|
|
642
642
|
|
|
643
643
|
throw error;
|
|
@@ -665,13 +665,13 @@ class ApiRequester {
|
|
|
665
665
|
) {
|
|
666
666
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
667
667
|
let newPath = path;
|
|
668
|
-
logger
|
|
668
|
+
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
669
669
|
|
|
670
670
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
671
671
|
|
|
672
672
|
return this.refreshTokenPromise.then(() => {
|
|
673
673
|
this.refreshTokenPromise = null;
|
|
674
|
-
logger
|
|
674
|
+
logger.info('token refreshed', { isTokenNotFound });
|
|
675
675
|
if (isTokenNotFound) {
|
|
676
676
|
const pathParts = path.split('/');
|
|
677
677
|
pathParts.pop();
|
|
@@ -2629,8 +2629,9 @@ class ExternalApp {
|
|
|
2629
2629
|
|
|
2630
2630
|
|
|
2631
2631
|
|
|
2632
|
-
|
|
2632
|
+
|
|
2633
2633
|
|
|
2634
|
+
|
|
2634
2635
|
|
|
2635
2636
|
|
|
2636
2637
|
class Meeting {
|
|
@@ -2641,9 +2642,10 @@ class Meeting {
|
|
|
2641
2642
|
|
|
2642
2643
|
|
|
2643
2644
|
|
|
2644
|
-
|
|
2645
|
+
|
|
2645
2646
|
|
|
2646
2647
|
|
|
2648
|
+
|
|
2647
2649
|
|
|
2648
2650
|
static parse(plain ) {
|
|
2649
2651
|
return new Meeting({
|
|
@@ -2653,8 +2655,9 @@ class Meeting {
|
|
|
2653
2655
|
ownerUuids: plain.owner_uuids,
|
|
2654
2656
|
port: plain.port,
|
|
2655
2657
|
uuid: plain.uuid,
|
|
2656
|
-
|
|
2658
|
+
extension: plain.exten,
|
|
2657
2659
|
persistent: plain.persistent,
|
|
2660
|
+
creationTime: moment(plain.creation_time).toDate(),
|
|
2658
2661
|
});
|
|
2659
2662
|
}
|
|
2660
2663
|
|
|
@@ -2676,8 +2679,9 @@ class Meeting {
|
|
|
2676
2679
|
ownerUuids,
|
|
2677
2680
|
port,
|
|
2678
2681
|
uri,
|
|
2679
|
-
|
|
2682
|
+
extension,
|
|
2680
2683
|
persistent,
|
|
2684
|
+
creationTime,
|
|
2681
2685
|
} = {}) {
|
|
2682
2686
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2683
2687
|
this.uri = uri;
|
|
@@ -2685,8 +2689,9 @@ class Meeting {
|
|
|
2685
2689
|
this.ownerUuids = ownerUuids;
|
|
2686
2690
|
this.port = port;
|
|
2687
2691
|
this.uuid = uuid;
|
|
2688
|
-
this.
|
|
2692
|
+
this.extension = extension;
|
|
2689
2693
|
this.persistent = persistent;
|
|
2694
|
+
this.creationTime = creationTime;
|
|
2690
2695
|
|
|
2691
2696
|
// Useful to compare instead of instanceof with minified code
|
|
2692
2697
|
this.type = 'Meeting';
|
|
@@ -3634,7 +3639,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
3634
3639
|
|
|
3635
3640
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
3636
3641
|
|
|
3637
|
-
IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
3642
|
+
const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
3638
3643
|
|
|
3639
3644
|
/* */
|
|
3640
3645
|
|
|
@@ -4978,7 +4983,7 @@ const BLACKLIST_EVENTS = [
|
|
|
4978
4983
|
];
|
|
4979
4984
|
|
|
4980
4985
|
const HEARTBEAT_ENGINE_VERSION = '20.09';
|
|
4981
|
-
const logger$
|
|
4986
|
+
const logger$3 = IssueReporter$1.loggerFor('wazo-ws');
|
|
4982
4987
|
const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
|
|
4983
4988
|
|
|
4984
4989
|
class WebSocketClient extends Emitter {
|
|
@@ -5027,19 +5032,19 @@ class WebSocketClient extends Emitter {
|
|
|
5027
5032
|
}
|
|
5028
5033
|
|
|
5029
5034
|
connect() {
|
|
5030
|
-
logger$
|
|
5035
|
+
logger$3.info('connect method started', { host: this.host, token: this.token });
|
|
5031
5036
|
this.socket = new ReconnectingWebSocket(this._getUrl.bind(this), [], this.options);
|
|
5032
5037
|
if (this.options.binaryType) {
|
|
5033
5038
|
this.socket.binaryType = this.options.binaryType;
|
|
5034
5039
|
}
|
|
5035
5040
|
|
|
5036
5041
|
this.socket.onopen = () => {
|
|
5037
|
-
logger$
|
|
5042
|
+
logger$3.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
5038
5043
|
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
5039
5044
|
};
|
|
5040
5045
|
|
|
5041
5046
|
this.socket.onerror = event => {
|
|
5042
|
-
logger$
|
|
5047
|
+
logger$3.error('on Wazo WS error', event.target);
|
|
5043
5048
|
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
5044
5049
|
};
|
|
5045
5050
|
|
|
@@ -5069,7 +5074,7 @@ class WebSocketClient extends Emitter {
|
|
|
5069
5074
|
|
|
5070
5075
|
this.socket.onclose = event => {
|
|
5071
5076
|
// Can't be converted to JSON (circular structure)
|
|
5072
|
-
logger$
|
|
5077
|
+
logger$3.info('on Wazo WS close', {
|
|
5073
5078
|
reason: event.reason,
|
|
5074
5079
|
code: event.code,
|
|
5075
5080
|
readyState: event.target.readyState,
|
|
@@ -5087,12 +5092,12 @@ class WebSocketClient extends Emitter {
|
|
|
5087
5092
|
};
|
|
5088
5093
|
|
|
5089
5094
|
this.socket.onerror = event => {
|
|
5090
|
-
logger$
|
|
5095
|
+
logger$3.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
|
|
5091
5096
|
};
|
|
5092
5097
|
}
|
|
5093
5098
|
|
|
5094
5099
|
close(force = false) {
|
|
5095
|
-
logger$
|
|
5100
|
+
logger$3.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
|
|
5096
5101
|
|
|
5097
5102
|
if (!this.socket) {
|
|
5098
5103
|
return;
|
|
@@ -5110,7 +5115,7 @@ class WebSocketClient extends Emitter {
|
|
|
5110
5115
|
|
|
5111
5116
|
updateToken(token ) {
|
|
5112
5117
|
this.token = token;
|
|
5113
|
-
logger$
|
|
5118
|
+
logger$3.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
|
|
5114
5119
|
|
|
5115
5120
|
if (this.socket) {
|
|
5116
5121
|
// If still connected, send the token to the WS
|
|
@@ -5128,7 +5133,7 @@ class WebSocketClient extends Emitter {
|
|
|
5128
5133
|
}
|
|
5129
5134
|
|
|
5130
5135
|
startHeartbeat() {
|
|
5131
|
-
logger$
|
|
5136
|
+
logger$3.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
|
|
5132
5137
|
|
|
5133
5138
|
if (!this.socket) {
|
|
5134
5139
|
this.heartbeat.stop();
|
|
@@ -5142,7 +5147,7 @@ class WebSocketClient extends Emitter {
|
|
|
5142
5147
|
}
|
|
5143
5148
|
|
|
5144
5149
|
stopHeartbeat() {
|
|
5145
|
-
logger$
|
|
5150
|
+
logger$3.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
|
|
5146
5151
|
|
|
5147
5152
|
this.heartbeat.stop();
|
|
5148
5153
|
}
|
|
@@ -5172,7 +5177,7 @@ class WebSocketClient extends Emitter {
|
|
|
5172
5177
|
}
|
|
5173
5178
|
|
|
5174
5179
|
reconnect(reason ) {
|
|
5175
|
-
logger$
|
|
5180
|
+
logger$3.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
|
|
5176
5181
|
if (!this.socket) {
|
|
5177
5182
|
return;
|
|
5178
5183
|
}
|
|
@@ -5228,7 +5233,7 @@ class WebSocketClient extends Emitter {
|
|
|
5228
5233
|
this.close();
|
|
5229
5234
|
}
|
|
5230
5235
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
5231
|
-
logger$
|
|
5236
|
+
logger$3.log('Wazo WS url computed to reconnect', { url });
|
|
5232
5237
|
|
|
5233
5238
|
return url;
|
|
5234
5239
|
}
|
|
@@ -5236,12 +5241,12 @@ class WebSocketClient extends Emitter {
|
|
|
5236
5241
|
_onHeartbeat(message ) {
|
|
5237
5242
|
if (message.payload === 'pong') {
|
|
5238
5243
|
this.heartbeat.onHeartbeat();
|
|
5239
|
-
logger$
|
|
5244
|
+
logger$3.log('on heartbeat received from Wazo WS');
|
|
5240
5245
|
}
|
|
5241
5246
|
}
|
|
5242
5247
|
|
|
5243
5248
|
async _onHeartbeatTimeout() {
|
|
5244
|
-
logger$
|
|
5249
|
+
logger$3.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
5245
5250
|
|
|
5246
5251
|
this.close();
|
|
5247
5252
|
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|
|
@@ -5362,7 +5367,7 @@ var wazoWebsocket = {
|
|
|
5362
5367
|
|
|
5363
5368
|
/* */
|
|
5364
5369
|
|
|
5365
|
-
const parseCandidate
|
|
5370
|
+
const parseCandidate = (candidate ) => {
|
|
5366
5371
|
if (!candidate) {
|
|
5367
5372
|
return null;
|
|
5368
5373
|
}
|
|
@@ -5516,7 +5521,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
5516
5521
|
this.peerConnectionDelegate.onicecandidate = event => {
|
|
5517
5522
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
5518
5523
|
if (event.candidate) {
|
|
5519
|
-
this.gatheredCandidates.push(parseCandidate
|
|
5524
|
+
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
5520
5525
|
}
|
|
5521
5526
|
};
|
|
5522
5527
|
|
|
@@ -5885,7 +5890,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
|
|
|
5885
5890
|
const SEND_STATS_DELAY = 5000;
|
|
5886
5891
|
|
|
5887
5892
|
const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
|
|
5888
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
5893
|
+
const logger$4 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
|
|
5889
5894
|
const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
|
|
5890
5895
|
|
|
5891
5896
|
// events
|
|
@@ -6061,13 +6066,13 @@ class WebRTCClient extends Emitter {
|
|
|
6061
6066
|
|
|
6062
6067
|
createUserAgent(configOverrides ) {
|
|
6063
6068
|
const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
|
|
6064
|
-
logger.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6069
|
+
logger$4.info('sdk webrtc, creating UA', { webRTCConfiguration });
|
|
6065
6070
|
|
|
6066
6071
|
webRTCConfiguration.delegate = {
|
|
6067
6072
|
onConnect: this.onConnect.bind(this),
|
|
6068
6073
|
onDisconnect: this.onDisconnect.bind(this),
|
|
6069
6074
|
onInvite: (invitation ) => {
|
|
6070
|
-
logger.info('sdk webrtc on invite', {
|
|
6075
|
+
logger$4.info('sdk webrtc on invite', {
|
|
6071
6076
|
method: 'delegate.onInvite',
|
|
6072
6077
|
id: invitation.id,
|
|
6073
6078
|
remoteURI: invitation.remoteURI,
|
|
@@ -6110,7 +6115,7 @@ class WebRTCClient extends Emitter {
|
|
|
6110
6115
|
}
|
|
6111
6116
|
|
|
6112
6117
|
onConnect() {
|
|
6113
|
-
logger.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6118
|
+
logger$4.info('sdk webrtc connected', { method: 'delegate.onConnect' });
|
|
6114
6119
|
this.eventEmitter.emit(CONNECTED);
|
|
6115
6120
|
if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
|
|
6116
6121
|
this.registerer.waitingToggle(false);
|
|
@@ -6119,7 +6124,7 @@ class WebRTCClient extends Emitter {
|
|
|
6119
6124
|
}
|
|
6120
6125
|
|
|
6121
6126
|
async onDisconnect(error ) {
|
|
6122
|
-
logger.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6127
|
+
logger$4.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
|
|
6123
6128
|
this.connectionPromise = null;
|
|
6124
6129
|
// The UA will attempt to reconnect automatically when an error occurred
|
|
6125
6130
|
this.eventEmitter.emit(DISCONNECTED, error);
|
|
@@ -6144,37 +6149,37 @@ class WebRTCClient extends Emitter {
|
|
|
6144
6149
|
};
|
|
6145
6150
|
|
|
6146
6151
|
if (this.skipRegister) {
|
|
6147
|
-
logger.info('sdk webrtc skip register...', logInfo);
|
|
6152
|
+
logger$4.info('sdk webrtc skip register...', logInfo);
|
|
6148
6153
|
return Promise.resolve();
|
|
6149
6154
|
}
|
|
6150
6155
|
|
|
6151
|
-
logger.info('sdk webrtc registering...', logInfo);
|
|
6156
|
+
logger$4.info('sdk webrtc registering...', logInfo);
|
|
6152
6157
|
|
|
6153
6158
|
if (!this.userAgent) {
|
|
6154
|
-
logger.info('sdk webrtc recreating User Agent');
|
|
6159
|
+
logger$4.info('sdk webrtc recreating User Agent');
|
|
6155
6160
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6156
6161
|
}
|
|
6157
6162
|
if (!this.userAgent || this.isRegistered()) {
|
|
6158
|
-
logger.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6163
|
+
logger$4.info('sdk webrtc registering aborted, already registered or no UA can be created');
|
|
6159
6164
|
return Promise.resolve();
|
|
6160
6165
|
}
|
|
6161
6166
|
|
|
6162
6167
|
if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
|
|
6163
|
-
logger.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6168
|
+
logger$4.info('sdk webrtc registering aborted due to a registration in progress.');
|
|
6164
6169
|
return Promise.resolve();
|
|
6165
6170
|
}
|
|
6166
6171
|
|
|
6167
6172
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
6168
6173
|
|
|
6169
6174
|
const onRegisterFailed = () => {
|
|
6170
|
-
logger.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6175
|
+
logger$4.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
|
|
6171
6176
|
this.connectionPromise = null;
|
|
6172
6177
|
if (this.registerer && this.registerer.waiting) {
|
|
6173
6178
|
this.registerer.waitingToggle(false);
|
|
6174
6179
|
}
|
|
6175
6180
|
|
|
6176
6181
|
if (tries <= MAX_REGISTER_TRIES) {
|
|
6177
|
-
logger.info('sdk webrtc registering, retrying...', { tries });
|
|
6182
|
+
logger$4.info('sdk webrtc registering, retrying...', { tries });
|
|
6178
6183
|
setTimeout(() => this.register(tries + 1), 300);
|
|
6179
6184
|
}
|
|
6180
6185
|
};
|
|
@@ -6183,18 +6188,18 @@ class WebRTCClient extends Emitter {
|
|
|
6183
6188
|
// Avoid race condition with the close method called just before register and setting userAgent to null
|
|
6184
6189
|
// during the resolution of the primise.
|
|
6185
6190
|
if (!this.userAgent) {
|
|
6186
|
-
logger.info('sdk webrtc recreating User Agent after connection');
|
|
6191
|
+
logger$4.info('sdk webrtc recreating User Agent after connection');
|
|
6187
6192
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
6188
6193
|
}
|
|
6189
6194
|
|
|
6190
|
-
logger.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6195
|
+
logger$4.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
|
|
6191
6196
|
this.registerer = new Registerer(this.userAgent, registerOptions);
|
|
6192
6197
|
this.connectionPromise = null;
|
|
6193
6198
|
this._monkeyPatchRegisterer(this.registerer);
|
|
6194
6199
|
|
|
6195
6200
|
// Bind registerer events
|
|
6196
6201
|
this.registerer.stateChange.addListener(newState => {
|
|
6197
|
-
logger.info('sdk webrtc registering, state changed', { newState });
|
|
6202
|
+
logger$4.info('sdk webrtc registering, state changed', { newState });
|
|
6198
6203
|
|
|
6199
6204
|
if (newState === RegistererState.Registered && this.registerer
|
|
6200
6205
|
&& this.registerer.state === RegistererState.Registered) {
|
|
@@ -6207,7 +6212,7 @@ class WebRTCClient extends Emitter {
|
|
|
6207
6212
|
const options = {
|
|
6208
6213
|
requestDelegate: {
|
|
6209
6214
|
onReject: response => {
|
|
6210
|
-
logger.error('sdk webrtc registering, rejected', { response });
|
|
6215
|
+
logger$4.error('sdk webrtc registering, rejected', { response });
|
|
6211
6216
|
|
|
6212
6217
|
onRegisterFailed();
|
|
6213
6218
|
},
|
|
@@ -6215,13 +6220,13 @@ class WebRTCClient extends Emitter {
|
|
|
6215
6220
|
};
|
|
6216
6221
|
|
|
6217
6222
|
return this.registerer.register(options).catch((e) => {
|
|
6218
|
-
logger.error('sdk webrtc registering, error', e);
|
|
6223
|
+
logger$4.error('sdk webrtc registering, error', e);
|
|
6219
6224
|
|
|
6220
6225
|
this.eventEmitter.emit(REGISTRATION_FAILED);
|
|
6221
6226
|
return e;
|
|
6222
6227
|
});
|
|
6223
6228
|
}).catch(error => {
|
|
6224
|
-
logger.error('sdk webrtc registering, transport error', error);
|
|
6229
|
+
logger$4.error('sdk webrtc registering, transport error', error);
|
|
6225
6230
|
onRegisterFailed();
|
|
6226
6231
|
});
|
|
6227
6232
|
}
|
|
@@ -6250,21 +6255,21 @@ class WebRTCClient extends Emitter {
|
|
|
6250
6255
|
}
|
|
6251
6256
|
|
|
6252
6257
|
unregister() {
|
|
6253
|
-
logger.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6258
|
+
logger$4.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
|
|
6254
6259
|
if (!this.registerer) {
|
|
6255
6260
|
return Promise.resolve();
|
|
6256
6261
|
}
|
|
6257
6262
|
|
|
6258
6263
|
try {
|
|
6259
6264
|
return this.registerer.unregister().then(() => {
|
|
6260
|
-
logger.info('sdk webrtc unregistered');
|
|
6265
|
+
logger$4.info('sdk webrtc unregistered');
|
|
6261
6266
|
this._cleanupRegister();
|
|
6262
6267
|
}).catch(e => {
|
|
6263
|
-
logger.error('sdk webrtc unregistering, promise error', e);
|
|
6268
|
+
logger$4.error('sdk webrtc unregistering, promise error', e);
|
|
6264
6269
|
this._cleanupRegister();
|
|
6265
6270
|
});
|
|
6266
6271
|
} catch (e) {
|
|
6267
|
-
logger.error('sdk webrtc unregistering, error', e);
|
|
6272
|
+
logger$4.error('sdk webrtc unregistering, error', e);
|
|
6268
6273
|
// Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
|
|
6269
6274
|
// error when the registerer is in a bad state
|
|
6270
6275
|
this._cleanupRegister();
|
|
@@ -6272,7 +6277,7 @@ class WebRTCClient extends Emitter {
|
|
|
6272
6277
|
}
|
|
6273
6278
|
|
|
6274
6279
|
stop() {
|
|
6275
|
-
logger.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6280
|
+
logger$4.info('sdk webrtc stop', { userAgent: !!this.userAgent });
|
|
6276
6281
|
if (!this.userAgent) {
|
|
6277
6282
|
return Promise.resolve();
|
|
6278
6283
|
}
|
|
@@ -6280,12 +6285,12 @@ class WebRTCClient extends Emitter {
|
|
|
6280
6285
|
return this.userAgent.stop().then(() => {
|
|
6281
6286
|
return this._cleanupRegister();
|
|
6282
6287
|
}).catch(e => {
|
|
6283
|
-
logger.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6288
|
+
logger$4.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
|
|
6284
6289
|
});
|
|
6285
6290
|
}
|
|
6286
6291
|
|
|
6287
6292
|
call(number , enableVideo , audioOnly = false, conference = false) {
|
|
6288
|
-
logger.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
6293
|
+
logger$4.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
|
|
6289
6294
|
const inviterOptions = {
|
|
6290
6295
|
sessionDescriptionHandlerOptionsReInvite: {
|
|
6291
6296
|
conference,
|
|
@@ -6316,7 +6321,7 @@ class WebRTCClient extends Emitter {
|
|
|
6316
6321
|
this._onAccepted(session, response.session, true);
|
|
6317
6322
|
},
|
|
6318
6323
|
onReject: (response ) => {
|
|
6319
|
-
logger.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
6324
|
+
logger$4.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
6320
6325
|
this._stopSendingStats(session);
|
|
6321
6326
|
this.stopNetworkMonitoring(session);
|
|
6322
6327
|
|
|
@@ -6339,11 +6344,11 @@ class WebRTCClient extends Emitter {
|
|
|
6339
6344
|
}
|
|
6340
6345
|
|
|
6341
6346
|
answer(session , enableVideo ) {
|
|
6342
|
-
logger.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
6347
|
+
logger$4.info('sdk webrtc answer call', { id: session.id, enableVideo });
|
|
6343
6348
|
|
|
6344
6349
|
if (!session || !session.accept) {
|
|
6345
6350
|
const error = 'No session to answer, or not an invitation';
|
|
6346
|
-
logger.warn(error);
|
|
6351
|
+
logger$4.warn(error);
|
|
6347
6352
|
return Promise.reject(new Error(error));
|
|
6348
6353
|
}
|
|
6349
6354
|
const options = {
|
|
@@ -6353,15 +6358,15 @@ class WebRTCClient extends Emitter {
|
|
|
6353
6358
|
return session.accept(options).then(() => {
|
|
6354
6359
|
if (session.isCanceled) {
|
|
6355
6360
|
const message = 'accepted a canceled session (or was canceled during the accept phase).';
|
|
6356
|
-
logger.error(message, { id: session.id });
|
|
6361
|
+
logger$4.error(message, { id: session.id });
|
|
6357
6362
|
this.onCallEnded(session);
|
|
6358
6363
|
|
|
6359
6364
|
throw new CanceledCallError(message);
|
|
6360
6365
|
}
|
|
6361
|
-
logger.info('sdk webrtc answer, accepted.');
|
|
6366
|
+
logger$4.info('sdk webrtc answer, accepted.');
|
|
6362
6367
|
this._onAccepted(session);
|
|
6363
6368
|
}).catch(e => {
|
|
6364
|
-
logger.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
6369
|
+
logger$4.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
|
|
6365
6370
|
|
|
6366
6371
|
throw e;
|
|
6367
6372
|
});
|
|
@@ -6369,7 +6374,7 @@ class WebRTCClient extends Emitter {
|
|
|
6369
6374
|
|
|
6370
6375
|
hangup(session ) {
|
|
6371
6376
|
const { state, id } = session;
|
|
6372
|
-
logger.info('sdk webrtc hangup call', { id, state });
|
|
6377
|
+
logger$4.info('sdk webrtc hangup call', { id, state });
|
|
6373
6378
|
|
|
6374
6379
|
try {
|
|
6375
6380
|
this._stopSendingStats(session);
|
|
@@ -6398,7 +6403,7 @@ class WebRTCClient extends Emitter {
|
|
|
6398
6403
|
|
|
6399
6404
|
return bye();
|
|
6400
6405
|
} catch (error) {
|
|
6401
|
-
logger.warn('sdk webrtc hangup, error', error);
|
|
6406
|
+
logger$4.warn('sdk webrtc hangup, error', error);
|
|
6402
6407
|
}
|
|
6403
6408
|
|
|
6404
6409
|
return null;
|
|
@@ -6416,7 +6421,7 @@ class WebRTCClient extends Emitter {
|
|
|
6416
6421
|
// Fetch and emit an event at `interval` with session network stats
|
|
6417
6422
|
startNetworkMonitoring(session , interval = 1000) {
|
|
6418
6423
|
const sessionId = this.getSipSessionId(session);
|
|
6419
|
-
logger.info('starting network inspection', { id: sessionId });
|
|
6424
|
+
logger$4.info('starting network inspection', { id: sessionId });
|
|
6420
6425
|
|
|
6421
6426
|
this.sessionNetworkStats[sessionId] = [];
|
|
6422
6427
|
|
|
@@ -6426,7 +6431,7 @@ class WebRTCClient extends Emitter {
|
|
|
6426
6431
|
stopNetworkMonitoring(session ) {
|
|
6427
6432
|
const sessionId = this.getSipSessionId(session);
|
|
6428
6433
|
const exists = sessionId in this.networkMonitoringInterval;
|
|
6429
|
-
logger.info('stopping network inspection', { id: sessionId, exists });
|
|
6434
|
+
logger$4.info('stopping network inspection', { id: sessionId, exists });
|
|
6430
6435
|
|
|
6431
6436
|
if (exists) {
|
|
6432
6437
|
clearInterval(this.networkMonitoringInterval[sessionId]);
|
|
@@ -6436,17 +6441,17 @@ class WebRTCClient extends Emitter {
|
|
|
6436
6441
|
}
|
|
6437
6442
|
|
|
6438
6443
|
reject(session ) {
|
|
6439
|
-
logger.info('sdk webrtc reject call', { id: session.id });
|
|
6444
|
+
logger$4.info('sdk webrtc reject call', { id: session.id });
|
|
6440
6445
|
|
|
6441
6446
|
try {
|
|
6442
6447
|
return session.reject ? session.reject() : session.cancel();
|
|
6443
6448
|
} catch (e) {
|
|
6444
|
-
logger.warn('Error when rejecting call', e.message, e.stack);
|
|
6449
|
+
logger$4.warn('Error when rejecting call', e.message, e.stack);
|
|
6445
6450
|
}
|
|
6446
6451
|
}
|
|
6447
6452
|
|
|
6448
6453
|
async close() {
|
|
6449
|
-
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6454
|
+
logger$4.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
6450
6455
|
this._cleanupMedia();
|
|
6451
6456
|
this.connectionPromise = null;
|
|
6452
6457
|
|
|
@@ -6477,7 +6482,7 @@ class WebRTCClient extends Emitter {
|
|
|
6477
6482
|
// eg: "INVITE not rejectable in state Completed"
|
|
6478
6483
|
}
|
|
6479
6484
|
this.userAgent = null;
|
|
6480
|
-
logger.info('sdk webrtc client closed');
|
|
6485
|
+
logger$4.info('sdk webrtc client closed');
|
|
6481
6486
|
}
|
|
6482
6487
|
|
|
6483
6488
|
getNumber(session ) {
|
|
@@ -6490,13 +6495,13 @@ class WebRTCClient extends Emitter {
|
|
|
6490
6495
|
}
|
|
6491
6496
|
|
|
6492
6497
|
mute(session ) {
|
|
6493
|
-
logger.info('sdk webrtc mute', { id: session.id });
|
|
6498
|
+
logger$4.info('sdk webrtc mute', { id: session.id });
|
|
6494
6499
|
|
|
6495
6500
|
this._toggleAudio(session, true);
|
|
6496
6501
|
}
|
|
6497
6502
|
|
|
6498
6503
|
unmute(session ) {
|
|
6499
|
-
logger.info('sdk webrtc unmute', { id: session.id });
|
|
6504
|
+
logger$4.info('sdk webrtc unmute', { id: session.id });
|
|
6500
6505
|
|
|
6501
6506
|
this._toggleAudio(session, false);
|
|
6502
6507
|
}
|
|
@@ -6536,13 +6541,13 @@ class WebRTCClient extends Emitter {
|
|
|
6536
6541
|
}
|
|
6537
6542
|
|
|
6538
6543
|
toggleCameraOn(session ) {
|
|
6539
|
-
logger.info('sdk webrtc toggle camera on', { id: session.id });
|
|
6544
|
+
logger$4.info('sdk webrtc toggle camera on', { id: session.id });
|
|
6540
6545
|
|
|
6541
6546
|
this._toggleVideo(session, false);
|
|
6542
6547
|
}
|
|
6543
6548
|
|
|
6544
6549
|
toggleCameraOff(session ) {
|
|
6545
|
-
logger.info('sdk webrtc toggle camera off', { id: session.id });
|
|
6550
|
+
logger$4.info('sdk webrtc toggle camera off', { id: session.id });
|
|
6546
6551
|
|
|
6547
6552
|
this._toggleVideo(session, true);
|
|
6548
6553
|
}
|
|
@@ -6551,7 +6556,7 @@ class WebRTCClient extends Emitter {
|
|
|
6551
6556
|
const sessionId = this.getSipSessionId(session);
|
|
6552
6557
|
const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
|
|
6553
6558
|
|
|
6554
|
-
logger.info('sdk webrtc hold', {
|
|
6559
|
+
logger$4.info('sdk webrtc hold', {
|
|
6555
6560
|
sessionId,
|
|
6556
6561
|
keys: Object.keys(this.heldSessions),
|
|
6557
6562
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -6600,7 +6605,7 @@ class WebRTCClient extends Emitter {
|
|
|
6600
6605
|
const sessionId = this.getSipSessionId(session);
|
|
6601
6606
|
const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
|
|
6602
6607
|
|
|
6603
|
-
logger.info('sdk webrtc unhold', {
|
|
6608
|
+
logger$4.info('sdk webrtc unhold', {
|
|
6604
6609
|
sessionId,
|
|
6605
6610
|
keys: Object.keys(this.heldSessions),
|
|
6606
6611
|
pendingReinvite: !!session.pendingReinvite,
|
|
@@ -6748,7 +6753,7 @@ class WebRTCClient extends Emitter {
|
|
|
6748
6753
|
if (!session.sessionDescriptionHandler) {
|
|
6749
6754
|
return;
|
|
6750
6755
|
}
|
|
6751
|
-
logger.info('Sending DTMF', {
|
|
6756
|
+
logger$4.info('Sending DTMF', {
|
|
6752
6757
|
id: this.getSipSessionId(session),
|
|
6753
6758
|
tone,
|
|
6754
6759
|
});
|
|
@@ -6764,7 +6769,7 @@ class WebRTCClient extends Emitter {
|
|
|
6764
6769
|
transfer(session , target ) {
|
|
6765
6770
|
this.hold(session);
|
|
6766
6771
|
|
|
6767
|
-
logger.info('Transfering a session', {
|
|
6772
|
+
logger$4.info('Transfering a session', {
|
|
6768
6773
|
id: this.getSipSessionId(session),
|
|
6769
6774
|
target,
|
|
6770
6775
|
});
|
|
@@ -6786,17 +6791,17 @@ class WebRTCClient extends Emitter {
|
|
|
6786
6791
|
atxfer(session ) {
|
|
6787
6792
|
this.hold(session);
|
|
6788
6793
|
|
|
6789
|
-
logger.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
6794
|
+
logger$4.info('webrtc transfer started', { id: this.getSipSessionId(session) });
|
|
6790
6795
|
|
|
6791
6796
|
const result = {
|
|
6792
6797
|
newSession: null,
|
|
6793
6798
|
init: async (target ) => {
|
|
6794
|
-
logger.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
6799
|
+
logger$4.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
|
|
6795
6800
|
|
|
6796
6801
|
result.newSession = await this.call(target);
|
|
6797
6802
|
},
|
|
6798
6803
|
complete: () => {
|
|
6799
|
-
logger.info('webrtc transfer completed', {
|
|
6804
|
+
logger$4.info('webrtc transfer completed', {
|
|
6800
6805
|
id: this.getSipSessionId(session),
|
|
6801
6806
|
referId: this.getSipSessionId(result.newSession),
|
|
6802
6807
|
});
|
|
@@ -6817,7 +6822,7 @@ class WebRTCClient extends Emitter {
|
|
|
6817
6822
|
return;
|
|
6818
6823
|
}
|
|
6819
6824
|
|
|
6820
|
-
logger.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
6825
|
+
logger$4.info('send WebRTC message', { sipId: sipSession.id, contentType });
|
|
6821
6826
|
|
|
6822
6827
|
try {
|
|
6823
6828
|
sipSession.message({
|
|
@@ -6859,7 +6864,7 @@ class WebRTCClient extends Emitter {
|
|
|
6859
6864
|
}
|
|
6860
6865
|
|
|
6861
6866
|
changeAudioOutputVolume(volume ) {
|
|
6862
|
-
logger.info('Changing audio output volume', { volume });
|
|
6867
|
+
logger$4.info('Changing audio output volume', { volume });
|
|
6863
6868
|
|
|
6864
6869
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
6865
6870
|
if (audioElement instanceof HTMLAudioElement) {
|
|
@@ -6871,7 +6876,7 @@ class WebRTCClient extends Emitter {
|
|
|
6871
6876
|
}
|
|
6872
6877
|
|
|
6873
6878
|
changeAudioOutputDevice(id ) {
|
|
6874
|
-
logger.info('Changing audio output device', { id });
|
|
6879
|
+
logger$4.info('Changing audio output device', { id });
|
|
6875
6880
|
|
|
6876
6881
|
Object.values(this.audioElements).forEach(audioElement => {
|
|
6877
6882
|
// `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
|
|
@@ -6888,7 +6893,7 @@ class WebRTCClient extends Emitter {
|
|
|
6888
6893
|
|
|
6889
6894
|
changeAudioInputDevice(id , session ) {
|
|
6890
6895
|
const currentId = this.getAudioDeviceId();
|
|
6891
|
-
logger.info('setting audio input device', { id, currentId, session: !!session });
|
|
6896
|
+
logger$4.info('setting audio input device', { id, currentId, session: !!session });
|
|
6892
6897
|
|
|
6893
6898
|
if (id === currentId) {
|
|
6894
6899
|
return null;
|
|
@@ -6934,7 +6939,7 @@ class WebRTCClient extends Emitter {
|
|
|
6934
6939
|
|
|
6935
6940
|
setVideoInputDevice(id ) {
|
|
6936
6941
|
const currentId = this.getVideoDeviceId();
|
|
6937
|
-
logger.info('setting video input device', { id, currentId });
|
|
6942
|
+
logger$4.info('setting video input device', { id, currentId });
|
|
6938
6943
|
|
|
6939
6944
|
if (id === currentId) {
|
|
6940
6945
|
return null;
|
|
@@ -6959,7 +6964,7 @@ class WebRTCClient extends Emitter {
|
|
|
6959
6964
|
const sessionId = this.getSipSessionId(session);
|
|
6960
6965
|
const localStream = this.getLocalStream(sessionId);
|
|
6961
6966
|
|
|
6962
|
-
logger.info('changing video input device', { id, sessionId });
|
|
6967
|
+
logger$4.info('changing video input device', { id, sessionId });
|
|
6963
6968
|
|
|
6964
6969
|
// Release old video stream
|
|
6965
6970
|
if (localStream) {
|
|
@@ -7027,7 +7032,7 @@ class WebRTCClient extends Emitter {
|
|
|
7027
7032
|
const shouldDoScreenSharing = newConstraints && newConstraints.screen;
|
|
7028
7033
|
const desktop = newConstraints && newConstraints.desktop;
|
|
7029
7034
|
|
|
7030
|
-
logger.info('Sending reinvite', {
|
|
7035
|
+
logger$4.info('Sending reinvite', {
|
|
7031
7036
|
id: this.getSipSessionId(sipSession),
|
|
7032
7037
|
newConstraints,
|
|
7033
7038
|
conference,
|
|
@@ -7065,7 +7070,7 @@ class WebRTCClient extends Emitter {
|
|
|
7065
7070
|
sipSession.incomingInviteRequest.message.body = response.message.body;
|
|
7066
7071
|
}
|
|
7067
7072
|
|
|
7068
|
-
logger.info('on re-INVITE accepted', {
|
|
7073
|
+
logger$4.info('on re-INVITE accepted', {
|
|
7069
7074
|
id: this.getSipSessionId(sipSession),
|
|
7070
7075
|
wasMuted,
|
|
7071
7076
|
shouldDoScreenSharing,
|
|
@@ -7240,7 +7245,7 @@ class WebRTCClient extends Emitter {
|
|
|
7240
7245
|
}
|
|
7241
7246
|
|
|
7242
7247
|
startHeartbeat() {
|
|
7243
|
-
logger.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7248
|
+
logger$4.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
|
|
7244
7249
|
if (!this.userAgent) {
|
|
7245
7250
|
this.heartbeat.stop();
|
|
7246
7251
|
return;
|
|
@@ -7253,7 +7258,7 @@ class WebRTCClient extends Emitter {
|
|
|
7253
7258
|
}
|
|
7254
7259
|
|
|
7255
7260
|
stopHeartbeat() {
|
|
7256
|
-
logger.info('sdk webrtc stop heartbeat');
|
|
7261
|
+
logger$4.info('sdk webrtc stop heartbeat');
|
|
7257
7262
|
this.heartbeat.stop();
|
|
7258
7263
|
}
|
|
7259
7264
|
|
|
@@ -7274,7 +7279,7 @@ class WebRTCClient extends Emitter {
|
|
|
7274
7279
|
}
|
|
7275
7280
|
|
|
7276
7281
|
attemptReconnection() {
|
|
7277
|
-
logger.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7282
|
+
logger$4.info('attempt reconnection', { userAgent: !!this.userAgent });
|
|
7278
7283
|
if (!this.userAgent) {
|
|
7279
7284
|
return;
|
|
7280
7285
|
}
|
|
@@ -7299,7 +7304,7 @@ class WebRTCClient extends Emitter {
|
|
|
7299
7304
|
return;
|
|
7300
7305
|
}
|
|
7301
7306
|
|
|
7302
|
-
logger.info('setting local media stream', {
|
|
7307
|
+
logger$4.info('setting local media stream', {
|
|
7303
7308
|
sipSessionId,
|
|
7304
7309
|
tracks: newStream ? newStream.getTracks() : null,
|
|
7305
7310
|
});
|
|
@@ -7316,7 +7321,7 @@ class WebRTCClient extends Emitter {
|
|
|
7316
7321
|
|
|
7317
7322
|
const oldStream = this.getLocalStream(sipSessionId);
|
|
7318
7323
|
|
|
7319
|
-
logger.info('updating local stream', {
|
|
7324
|
+
logger$4.info('updating local stream', {
|
|
7320
7325
|
sipSessionId,
|
|
7321
7326
|
oldStream: !!oldStream,
|
|
7322
7327
|
tracks: newStream.getTracks(),
|
|
@@ -7336,7 +7341,7 @@ class WebRTCClient extends Emitter {
|
|
|
7336
7341
|
const remoteStream = this.getRemoteStream(sessionId);
|
|
7337
7342
|
const pc = this.getPeerConnection(sessionId);
|
|
7338
7343
|
|
|
7339
|
-
logger.info('Updating remote stream', {
|
|
7344
|
+
logger$4.info('Updating remote stream', {
|
|
7340
7345
|
sessionId,
|
|
7341
7346
|
tracks: remoteStream ? remoteStream.getTracks() : null,
|
|
7342
7347
|
receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
|
|
@@ -7362,7 +7367,7 @@ class WebRTCClient extends Emitter {
|
|
|
7362
7367
|
const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
|
|
7363
7368
|
const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
|
|
7364
7369
|
|
|
7365
|
-
logger.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
7370
|
+
logger$4.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
|
|
7366
7371
|
|
|
7367
7372
|
return {
|
|
7368
7373
|
constraints: {
|
|
@@ -7411,7 +7416,7 @@ class WebRTCClient extends Emitter {
|
|
|
7411
7416
|
}
|
|
7412
7417
|
|
|
7413
7418
|
_onTransportError() {
|
|
7414
|
-
logger.error('on transport error');
|
|
7419
|
+
logger$4.error('on transport error');
|
|
7415
7420
|
this.eventEmitter.emit(TRANSPORT_ERROR);
|
|
7416
7421
|
this.attemptReconnection();
|
|
7417
7422
|
}
|
|
@@ -7420,7 +7425,7 @@ class WebRTCClient extends Emitter {
|
|
|
7420
7425
|
const body = message && typeof message === 'object' ? message.data : message;
|
|
7421
7426
|
if (body && body.indexOf('200 OK') !== -1) {
|
|
7422
7427
|
if (this.hasHeartbeat()) {
|
|
7423
|
-
logger.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
7428
|
+
logger$4.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
|
|
7424
7429
|
|
|
7425
7430
|
this.heartbeat.onHeartbeat();
|
|
7426
7431
|
if (this.heartbeatCb) {
|
|
@@ -7431,7 +7436,7 @@ class WebRTCClient extends Emitter {
|
|
|
7431
7436
|
}
|
|
7432
7437
|
|
|
7433
7438
|
async _onHeartbeatTimeout() {
|
|
7434
|
-
logger.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7439
|
+
logger$4.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7435
7440
|
|
|
7436
7441
|
if (this.heartbeatTimeoutCb) {
|
|
7437
7442
|
this.heartbeatTimeoutCb();
|
|
@@ -7443,7 +7448,7 @@ class WebRTCClient extends Emitter {
|
|
|
7443
7448
|
try {
|
|
7444
7449
|
await this.userAgent.transport.disconnect();
|
|
7445
7450
|
} catch (e) {
|
|
7446
|
-
logger.error('Transport disconnection after heartbeat timeout, error', e);
|
|
7451
|
+
logger$4.error('Transport disconnection after heartbeat timeout, error', e);
|
|
7447
7452
|
}
|
|
7448
7453
|
}
|
|
7449
7454
|
|
|
@@ -7476,31 +7481,31 @@ class WebRTCClient extends Emitter {
|
|
|
7476
7481
|
}
|
|
7477
7482
|
|
|
7478
7483
|
_connectIfNeeded() {
|
|
7479
|
-
logger.info('connect if needed, checking', { connected: this.isConnected() });
|
|
7484
|
+
logger$4.info('connect if needed, checking', { connected: this.isConnected() });
|
|
7480
7485
|
if (!this.userAgent) {
|
|
7481
|
-
logger.info('need to recreate User Agent');
|
|
7486
|
+
logger$4.info('need to recreate User Agent');
|
|
7482
7487
|
this.userAgent = this.createUserAgent(this.uaConfigOverrides);
|
|
7483
7488
|
}
|
|
7484
7489
|
|
|
7485
7490
|
if (this.isConnected()) {
|
|
7486
|
-
logger.info('webrtc sdk, already connected');
|
|
7491
|
+
logger$4.info('webrtc sdk, already connected');
|
|
7487
7492
|
return Promise.resolve();
|
|
7488
7493
|
}
|
|
7489
7494
|
|
|
7490
7495
|
if (this.isConnecting()) {
|
|
7491
|
-
logger.info('webrtc sdk, already connecting...');
|
|
7496
|
+
logger$4.info('webrtc sdk, already connecting...');
|
|
7492
7497
|
|
|
7493
7498
|
this.connectionPromise = this.userAgent.transport.connectPromise;
|
|
7494
7499
|
return this.connectionPromise;
|
|
7495
7500
|
}
|
|
7496
7501
|
|
|
7497
7502
|
if (this.connectionPromise) {
|
|
7498
|
-
logger.info('webrtc sdk, connection promise connecting...');
|
|
7503
|
+
logger$4.info('webrtc sdk, connection promise connecting...');
|
|
7499
7504
|
// $FlowFixMe
|
|
7500
7505
|
return this.connectionPromise;
|
|
7501
7506
|
}
|
|
7502
7507
|
|
|
7503
|
-
logger.info('WebRTC UA needs to connect');
|
|
7508
|
+
logger$4.info('WebRTC UA needs to connect');
|
|
7504
7509
|
|
|
7505
7510
|
// Force UA to reconnect
|
|
7506
7511
|
if (this.userAgent && this.userAgent.state !== UserAgentState.Stopped) {
|
|
@@ -7625,7 +7630,7 @@ class WebRTCClient extends Emitter {
|
|
|
7625
7630
|
|
|
7626
7631
|
sdh.peerConnectionDelegate = {
|
|
7627
7632
|
onicecandidateerror: (error ) => {
|
|
7628
|
-
logger.error('on icecandidate error', {
|
|
7633
|
+
logger$4.error('on icecandidate error', {
|
|
7629
7634
|
address: error.address,
|
|
7630
7635
|
port: error.port,
|
|
7631
7636
|
errorCode: error.errorCode,
|
|
@@ -7654,7 +7659,7 @@ class WebRTCClient extends Emitter {
|
|
|
7654
7659
|
updatedNumber = session.assertedIdentity.uri.normal.user;
|
|
7655
7660
|
updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
|
|
7656
7661
|
}
|
|
7657
|
-
logger.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
7662
|
+
logger$4.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
|
|
7658
7663
|
|
|
7659
7664
|
// Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
|
|
7660
7665
|
|
|
@@ -7675,7 +7680,7 @@ class WebRTCClient extends Emitter {
|
|
|
7675
7680
|
}
|
|
7676
7681
|
|
|
7677
7682
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
7678
|
-
logger.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
7683
|
+
logger$4.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
7679
7684
|
|
|
7680
7685
|
this.storeSipSession(session);
|
|
7681
7686
|
|
|
@@ -7687,7 +7692,7 @@ class WebRTCClient extends Emitter {
|
|
|
7687
7692
|
const onTrack = (event ) => {
|
|
7688
7693
|
const isAudioOnly = this._isAudioOnly(session);
|
|
7689
7694
|
const { kind, label, readyState, id, muted } = event.track;
|
|
7690
|
-
logger.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
7695
|
+
logger$4.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
|
|
7691
7696
|
|
|
7692
7697
|
// Stop video track in audio only mode
|
|
7693
7698
|
if (isAudioOnly && kind === 'video') {
|
|
@@ -7704,7 +7709,7 @@ class WebRTCClient extends Emitter {
|
|
|
7704
7709
|
session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
|
|
7705
7710
|
|
|
7706
7711
|
pc.oniceconnectionstatechange = () => {
|
|
7707
|
-
logger.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7712
|
+
logger$4.info('on ice connection state changed', { state: pc.iceConnectionState });
|
|
7708
7713
|
if (pc.iceConnectionState === 'disconnected') {
|
|
7709
7714
|
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
7710
7715
|
}
|
|
@@ -7877,10 +7882,10 @@ class WebRTCClient extends Emitter {
|
|
|
7877
7882
|
|
|
7878
7883
|
_stopSendingStats(session ) {
|
|
7879
7884
|
const sessionId = this.getSipSessionId(session);
|
|
7880
|
-
logger.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
7885
|
+
logger$4.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
|
|
7881
7886
|
|
|
7882
7887
|
if (sessionId in this.statsIntervals) {
|
|
7883
|
-
logger.trace('Stop sending stats for call', { sessionId });
|
|
7888
|
+
logger$4.trace('Stop sending stats for call', { sessionId });
|
|
7884
7889
|
this.statsIntervals[sessionId]();
|
|
7885
7890
|
delete this.statsIntervals[sessionId];
|
|
7886
7891
|
}
|
|
@@ -7896,7 +7901,7 @@ class WebRTCClient extends Emitter {
|
|
|
7896
7901
|
try {
|
|
7897
7902
|
await this.userAgent.transport.disconnect();
|
|
7898
7903
|
} catch (e) {
|
|
7899
|
-
logger.error('WebRTC transport disconnect, error', e);
|
|
7904
|
+
logger$4.error('WebRTC transport disconnect, error', e);
|
|
7900
7905
|
}
|
|
7901
7906
|
}
|
|
7902
7907
|
}
|
|
@@ -8079,7 +8084,7 @@ var webrtc = {
|
|
|
8079
8084
|
}),
|
|
8080
8085
|
};
|
|
8081
8086
|
|
|
8082
|
-
const parseCandidate = line => {
|
|
8087
|
+
const parseCandidate$1 = line => {
|
|
8083
8088
|
let parts;
|
|
8084
8089
|
// Parse both variants.
|
|
8085
8090
|
if (line.indexOf('a=candidate:') === 0) {
|
|
@@ -8170,7 +8175,7 @@ var SymmetricNat = {
|
|
|
8170
8175
|
}
|
|
8171
8176
|
|
|
8172
8177
|
if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
|
|
8173
|
-
const cand = parseCandidate(e.candidate.candidate);
|
|
8178
|
+
const cand = parseCandidate$1(e.candidate.candidate);
|
|
8174
8179
|
if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
|
|
8175
8180
|
candidates[cand.relatedPort].push(cand.port);
|
|
8176
8181
|
} else if (!e.candidate) {
|
|
@@ -8238,7 +8243,7 @@ var iceIpv4 = {
|
|
|
8238
8243
|
const rawCandidate = e.candidate.candidate;
|
|
8239
8244
|
if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
|
|
8240
8245
|
hasSrflxOrRelay = true;
|
|
8241
|
-
const candidate = parseCandidate(e.candidate.candidate);
|
|
8246
|
+
const candidate = parseCandidate$1(e.candidate.candidate);
|
|
8242
8247
|
ips.push(candidate.ip);
|
|
8243
8248
|
}
|
|
8244
8249
|
} else if (!e.candidate) {
|