@wazo/sdk 0.38.16 → 0.38.18
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 +2 -2
- package/esm/__tests__/api-client.test.js +7 -4
- package/esm/__tests__/web-rtc-client.test.js +35 -6
- package/esm/api/chatd.js +7 -4
- package/esm/api-client.js +7 -4
- package/esm/checker/Checker.js +35 -6
- package/esm/checker/checks/aor.js +7 -4
- package/esm/checker/checks/api.js +7 -4
- package/esm/checker/checks/index.js +35 -6
- package/esm/checker/checks/webrtc-transport.js +35 -6
- package/esm/checker/checks/webrtc.js +35 -6
- package/esm/domain/AdHocAPIConference.js +7 -4
- package/esm/domain/Features.js +7 -4
- package/esm/domain/Phone/CTIPhone.js +7 -4
- package/esm/domain/Phone/WebRTCPhone.js +7 -1
- package/esm/index.js +42 -6
- package/esm/service/CallApi.js +7 -4
- package/esm/service/getApiClient.js +7 -4
- package/esm/simple/Auth.js +42 -6
- package/esm/simple/Configuration.js +42 -6
- package/esm/simple/Directory.js +7 -4
- package/esm/simple/Phone.js +42 -6
- package/esm/simple/index.js +42 -6
- package/esm/simple/room/LocalParticipant.js +42 -6
- package/esm/simple/room/Participant.js +42 -6
- package/esm/simple/room/RemoteParticipant.js +42 -6
- package/esm/simple/room/Room.js +42 -6
- package/esm/simple/room/SipRoom.js +42 -6
- package/esm/simple/room/Stream.js +42 -6
- package/esm/simple/room/__tests__/Participant.test.js +42 -6
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +42 -6
- package/esm/simple/utils.js +42 -6
- package/esm/web-rtc-client.js +35 -6
- package/lib/__tests__/api-client.test.js +7 -4
- package/lib/__tests__/web-rtc-client.test.js +35 -6
- package/lib/api/chatd.js +7 -4
- package/lib/api-client.js +7 -4
- package/lib/checker/Checker.js +35 -6
- package/lib/checker/checks/aor.js +7 -4
- package/lib/checker/checks/api.js +7 -4
- package/lib/checker/checks/index.js +35 -6
- package/lib/checker/checks/webrtc-transport.js +35 -6
- package/lib/checker/checks/webrtc.js +35 -6
- package/lib/domain/AdHocAPIConference.js +7 -4
- package/lib/domain/Features.js +7 -4
- package/lib/domain/Phone/CTIPhone.js +7 -4
- package/lib/domain/Phone/WebRTCPhone.js +7 -0
- package/lib/index.js +42 -6
- package/lib/service/CallApi.js +7 -4
- package/lib/service/getApiClient.js +7 -4
- package/lib/simple/Auth.js +42 -6
- package/lib/simple/Configuration.js +42 -6
- package/lib/simple/Directory.js +7 -4
- package/lib/simple/Phone.js +42 -6
- package/lib/simple/index.js +42 -6
- package/lib/simple/room/LocalParticipant.js +42 -6
- package/lib/simple/room/Participant.js +42 -6
- package/lib/simple/room/RemoteParticipant.js +42 -6
- package/lib/simple/room/Room.js +42 -6
- package/lib/simple/room/SipRoom.js +42 -6
- package/lib/simple/room/Stream.js +42 -6
- package/lib/simple/room/__tests__/Participant.test.js +42 -6
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +42 -6
- package/lib/simple/utils.js +42 -6
- package/lib/web-rtc-client.js +35 -6
- package/package.json +1 -1
- package/src/api/chatd.js +7 -4
- package/src/domain/Phone/WebRTCPhone.js +6 -0
- package/src/web-rtc-client.js +28 -2
|
@@ -5047,10 +5047,13 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
5047
5047
|
createRoom: async (name , users ) =>
|
|
5048
5048
|
client.post(`${baseUrl}/users/me/rooms`, { name, users }).then(ChatRoom.parse),
|
|
5049
5049
|
|
|
5050
|
-
getRoomMessages: async (roomUuid ) =>
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5050
|
+
getRoomMessages: async (roomUuid , params = {}) => {
|
|
5051
|
+
const qs = ApiRequester.getQueryString(params);
|
|
5052
|
+
|
|
5053
|
+
return client
|
|
5054
|
+
.get(`${baseUrl}/users/me/rooms/${roomUuid}/messages${qs.length ? `?${qs}` : ''}`)
|
|
5055
|
+
.then((response ) => ChatMessage.parseMany(response));
|
|
5056
|
+
},
|
|
5054
5057
|
|
|
5055
5058
|
sendRoomMessage: async (roomUuid , message ) =>
|
|
5056
5059
|
client.post(`${baseUrl}/users/me/rooms/${roomUuid}/messages`, message).then(ChatMessage.parse),
|
|
@@ -7027,6 +7030,7 @@ const MESSAGE = 'message';
|
|
|
7027
7030
|
const ACCEPTED = 'accepted';
|
|
7028
7031
|
const REJECTED = 'rejected';
|
|
7029
7032
|
const ON_TRACK$1 = 'onTrack';
|
|
7033
|
+
const ON_EARLY_MEDIA$1 = 'onEarlyMedia';
|
|
7030
7034
|
const ON_REINVITE$1 = 'reinvite';
|
|
7031
7035
|
const ON_ERROR = 'onError';
|
|
7032
7036
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
@@ -7110,6 +7114,7 @@ class WebRTCClient extends Emitter {
|
|
|
7110
7114
|
|
|
7111
7115
|
|
|
7112
7116
|
|
|
7117
|
+
|
|
7113
7118
|
|
|
7114
7119
|
|
|
7115
7120
|
static isAPrivateIp(ip ) {
|
|
@@ -7178,6 +7183,7 @@ class WebRTCClient extends Emitter {
|
|
|
7178
7183
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
7179
7184
|
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
7180
7185
|
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
7186
|
+
this.ON_EARLY_MEDIA = ON_EARLY_MEDIA$1;
|
|
7181
7187
|
}
|
|
7182
7188
|
|
|
7183
7189
|
configureMedia(media ) {
|
|
@@ -7465,6 +7471,11 @@ class WebRTCClient extends Emitter {
|
|
|
7465
7471
|
}
|
|
7466
7472
|
this._onAccepted(session, response.session, true);
|
|
7467
7473
|
},
|
|
7474
|
+
onProgress: (payload) => {
|
|
7475
|
+
if (payload.message.statusCode === 183) {
|
|
7476
|
+
this._onEarlyProgress(payload.session);
|
|
7477
|
+
}
|
|
7478
|
+
},
|
|
7468
7479
|
onReject: (response ) => {
|
|
7469
7480
|
logger$8.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
7470
7481
|
this._stopSendingStats(session);
|
|
@@ -8857,6 +8868,17 @@ class WebRTCClient extends Emitter {
|
|
|
8857
8868
|
};
|
|
8858
8869
|
}
|
|
8859
8870
|
|
|
8871
|
+
_onEarlyProgress(session ) {
|
|
8872
|
+
this._setupMedias(session);
|
|
8873
|
+
|
|
8874
|
+
const sessionId = this.getSipSessionId(session).substr(0, 20);
|
|
8875
|
+
this.updateRemoteStream(sessionId);
|
|
8876
|
+
|
|
8877
|
+
logger$8.info('Early media progress progress received', { sessionId });
|
|
8878
|
+
|
|
8879
|
+
this.eventEmitter.emit(ON_EARLY_MEDIA$1, session);
|
|
8880
|
+
}
|
|
8881
|
+
|
|
8860
8882
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8861
8883
|
logger$8.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8862
8884
|
|
|
@@ -8908,15 +8930,22 @@ class WebRTCClient extends Emitter {
|
|
|
8908
8930
|
|
|
8909
8931
|
_setupMedias(session , newStream ) {
|
|
8910
8932
|
// Safari hack, because you cannot call .play() from a non user action
|
|
8911
|
-
const sessionId = this.getSipSessionId(session);
|
|
8933
|
+
const sessionId = this.getSipSessionId(session).substr(0, 20);
|
|
8912
8934
|
const isConference = this.isConference(sessionId);
|
|
8913
8935
|
|
|
8936
|
+
if (sessionId in this.audioElements) {
|
|
8937
|
+
logger$8.info('html element already exists for session', { sessionId });
|
|
8938
|
+
return;
|
|
8939
|
+
}
|
|
8940
|
+
|
|
8914
8941
|
if (this._hasAudio() && this._isWeb() && !(sessionId in this.audioElements)) {
|
|
8915
8942
|
this.createAudioElementFor(sessionId);
|
|
8916
8943
|
}
|
|
8917
8944
|
|
|
8918
8945
|
const audioElement = this.audioElements[sessionId];
|
|
8919
|
-
const
|
|
8946
|
+
const sipSession = this.sipSessions[session.callId];
|
|
8947
|
+
const removeStream = this.getRemoteStream(sessionId);
|
|
8948
|
+
const stream = newStream || removeStream || sipSession.sessionDescriptionHandler.remoteMediaStream;
|
|
8920
8949
|
|
|
8921
8950
|
if (!this._isWeb() || !stream) {
|
|
8922
8951
|
return;
|
|
@@ -9248,6 +9277,7 @@ const ON_NETWORK_STATS = 'onNetworkStats';
|
|
|
9248
9277
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
9249
9278
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
9250
9279
|
const ON_DISCONNECTED = 'onDisconnected';
|
|
9280
|
+
const ON_EARLY_MEDIA = 'onEarlyMedia';
|
|
9251
9281
|
|
|
9252
9282
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
9253
9283
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
@@ -9289,6 +9319,7 @@ const events = [
|
|
|
9289
9319
|
ON_SIGNAL,
|
|
9290
9320
|
ON_NETWORK_STATS,
|
|
9291
9321
|
ON_DISCONNECTED,
|
|
9322
|
+
ON_EARLY_MEDIA,
|
|
9292
9323
|
];
|
|
9293
9324
|
|
|
9294
9325
|
const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
@@ -10718,6 +10749,10 @@ class WebRTCPhone extends Emitter {
|
|
|
10718
10749
|
logger$7.info('WebRTC disconnected');
|
|
10719
10750
|
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10720
10751
|
});
|
|
10752
|
+
this.client.on(this.client.ON_EARLY_MEDIA, () => {
|
|
10753
|
+
logger$7.info('WebRTC early media');
|
|
10754
|
+
this.eventEmitter.emit(ON_EARLY_MEDIA);
|
|
10755
|
+
});
|
|
10721
10756
|
|
|
10722
10757
|
this.client.on(this.client.REGISTERED, () => {
|
|
10723
10758
|
logger$7.info('WebRTC registered', {
|
|
@@ -11001,6 +11036,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
11001
11036
|
ON_CHAT: ON_CHAT,
|
|
11002
11037
|
ON_SIGNAL: ON_SIGNAL,
|
|
11003
11038
|
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
11039
|
+
ON_EARLY_MEDIA: ON_EARLY_MEDIA,
|
|
11004
11040
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
11005
11041
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
11006
11042
|
events: events,
|
|
@@ -5047,10 +5047,13 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
5047
5047
|
createRoom: async (name , users ) =>
|
|
5048
5048
|
client.post(`${baseUrl}/users/me/rooms`, { name, users }).then(ChatRoom.parse),
|
|
5049
5049
|
|
|
5050
|
-
getRoomMessages: async (roomUuid ) =>
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5050
|
+
getRoomMessages: async (roomUuid , params = {}) => {
|
|
5051
|
+
const qs = ApiRequester.getQueryString(params);
|
|
5052
|
+
|
|
5053
|
+
return client
|
|
5054
|
+
.get(`${baseUrl}/users/me/rooms/${roomUuid}/messages${qs.length ? `?${qs}` : ''}`)
|
|
5055
|
+
.then((response ) => ChatMessage.parseMany(response));
|
|
5056
|
+
},
|
|
5054
5057
|
|
|
5055
5058
|
sendRoomMessage: async (roomUuid , message ) =>
|
|
5056
5059
|
client.post(`${baseUrl}/users/me/rooms/${roomUuid}/messages`, message).then(ChatMessage.parse),
|
|
@@ -7027,6 +7030,7 @@ const MESSAGE = 'message';
|
|
|
7027
7030
|
const ACCEPTED = 'accepted';
|
|
7028
7031
|
const REJECTED = 'rejected';
|
|
7029
7032
|
const ON_TRACK$1 = 'onTrack';
|
|
7033
|
+
const ON_EARLY_MEDIA$1 = 'onEarlyMedia';
|
|
7030
7034
|
const ON_REINVITE$1 = 'reinvite';
|
|
7031
7035
|
const ON_ERROR = 'onError';
|
|
7032
7036
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
@@ -7110,6 +7114,7 @@ class WebRTCClient extends Emitter {
|
|
|
7110
7114
|
|
|
7111
7115
|
|
|
7112
7116
|
|
|
7117
|
+
|
|
7113
7118
|
|
|
7114
7119
|
|
|
7115
7120
|
static isAPrivateIp(ip ) {
|
|
@@ -7178,6 +7183,7 @@ class WebRTCClient extends Emitter {
|
|
|
7178
7183
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
7179
7184
|
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
7180
7185
|
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
7186
|
+
this.ON_EARLY_MEDIA = ON_EARLY_MEDIA$1;
|
|
7181
7187
|
}
|
|
7182
7188
|
|
|
7183
7189
|
configureMedia(media ) {
|
|
@@ -7465,6 +7471,11 @@ class WebRTCClient extends Emitter {
|
|
|
7465
7471
|
}
|
|
7466
7472
|
this._onAccepted(session, response.session, true);
|
|
7467
7473
|
},
|
|
7474
|
+
onProgress: (payload) => {
|
|
7475
|
+
if (payload.message.statusCode === 183) {
|
|
7476
|
+
this._onEarlyProgress(payload.session);
|
|
7477
|
+
}
|
|
7478
|
+
},
|
|
7468
7479
|
onReject: (response ) => {
|
|
7469
7480
|
logger$8.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
7470
7481
|
this._stopSendingStats(session);
|
|
@@ -8857,6 +8868,17 @@ class WebRTCClient extends Emitter {
|
|
|
8857
8868
|
};
|
|
8858
8869
|
}
|
|
8859
8870
|
|
|
8871
|
+
_onEarlyProgress(session ) {
|
|
8872
|
+
this._setupMedias(session);
|
|
8873
|
+
|
|
8874
|
+
const sessionId = this.getSipSessionId(session).substr(0, 20);
|
|
8875
|
+
this.updateRemoteStream(sessionId);
|
|
8876
|
+
|
|
8877
|
+
logger$8.info('Early media progress progress received', { sessionId });
|
|
8878
|
+
|
|
8879
|
+
this.eventEmitter.emit(ON_EARLY_MEDIA$1, session);
|
|
8880
|
+
}
|
|
8881
|
+
|
|
8860
8882
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8861
8883
|
logger$8.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8862
8884
|
|
|
@@ -8908,15 +8930,22 @@ class WebRTCClient extends Emitter {
|
|
|
8908
8930
|
|
|
8909
8931
|
_setupMedias(session , newStream ) {
|
|
8910
8932
|
// Safari hack, because you cannot call .play() from a non user action
|
|
8911
|
-
const sessionId = this.getSipSessionId(session);
|
|
8933
|
+
const sessionId = this.getSipSessionId(session).substr(0, 20);
|
|
8912
8934
|
const isConference = this.isConference(sessionId);
|
|
8913
8935
|
|
|
8936
|
+
if (sessionId in this.audioElements) {
|
|
8937
|
+
logger$8.info('html element already exists for session', { sessionId });
|
|
8938
|
+
return;
|
|
8939
|
+
}
|
|
8940
|
+
|
|
8914
8941
|
if (this._hasAudio() && this._isWeb() && !(sessionId in this.audioElements)) {
|
|
8915
8942
|
this.createAudioElementFor(sessionId);
|
|
8916
8943
|
}
|
|
8917
8944
|
|
|
8918
8945
|
const audioElement = this.audioElements[sessionId];
|
|
8919
|
-
const
|
|
8946
|
+
const sipSession = this.sipSessions[session.callId];
|
|
8947
|
+
const removeStream = this.getRemoteStream(sessionId);
|
|
8948
|
+
const stream = newStream || removeStream || sipSession.sessionDescriptionHandler.remoteMediaStream;
|
|
8920
8949
|
|
|
8921
8950
|
if (!this._isWeb() || !stream) {
|
|
8922
8951
|
return;
|
|
@@ -9248,6 +9277,7 @@ const ON_NETWORK_STATS = 'onNetworkStats';
|
|
|
9248
9277
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
9249
9278
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
9250
9279
|
const ON_DISCONNECTED = 'onDisconnected';
|
|
9280
|
+
const ON_EARLY_MEDIA = 'onEarlyMedia';
|
|
9251
9281
|
|
|
9252
9282
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
9253
9283
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
@@ -9289,6 +9319,7 @@ const events = [
|
|
|
9289
9319
|
ON_SIGNAL,
|
|
9290
9320
|
ON_NETWORK_STATS,
|
|
9291
9321
|
ON_DISCONNECTED,
|
|
9322
|
+
ON_EARLY_MEDIA,
|
|
9292
9323
|
];
|
|
9293
9324
|
|
|
9294
9325
|
const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
@@ -10718,6 +10749,10 @@ class WebRTCPhone extends Emitter {
|
|
|
10718
10749
|
logger$7.info('WebRTC disconnected');
|
|
10719
10750
|
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10720
10751
|
});
|
|
10752
|
+
this.client.on(this.client.ON_EARLY_MEDIA, () => {
|
|
10753
|
+
logger$7.info('WebRTC early media');
|
|
10754
|
+
this.eventEmitter.emit(ON_EARLY_MEDIA);
|
|
10755
|
+
});
|
|
10721
10756
|
|
|
10722
10757
|
this.client.on(this.client.REGISTERED, () => {
|
|
10723
10758
|
logger$7.info('WebRTC registered', {
|
|
@@ -11001,6 +11036,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
11001
11036
|
ON_CHAT: ON_CHAT,
|
|
11002
11037
|
ON_SIGNAL: ON_SIGNAL,
|
|
11003
11038
|
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
11039
|
+
ON_EARLY_MEDIA: ON_EARLY_MEDIA,
|
|
11004
11040
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
11005
11041
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
11006
11042
|
events: events,
|
|
@@ -5047,10 +5047,13 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
5047
5047
|
createRoom: async (name , users ) =>
|
|
5048
5048
|
client.post(`${baseUrl}/users/me/rooms`, { name, users }).then(ChatRoom.parse),
|
|
5049
5049
|
|
|
5050
|
-
getRoomMessages: async (roomUuid ) =>
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5050
|
+
getRoomMessages: async (roomUuid , params = {}) => {
|
|
5051
|
+
const qs = ApiRequester.getQueryString(params);
|
|
5052
|
+
|
|
5053
|
+
return client
|
|
5054
|
+
.get(`${baseUrl}/users/me/rooms/${roomUuid}/messages${qs.length ? `?${qs}` : ''}`)
|
|
5055
|
+
.then((response ) => ChatMessage.parseMany(response));
|
|
5056
|
+
},
|
|
5054
5057
|
|
|
5055
5058
|
sendRoomMessage: async (roomUuid , message ) =>
|
|
5056
5059
|
client.post(`${baseUrl}/users/me/rooms/${roomUuid}/messages`, message).then(ChatMessage.parse),
|
|
@@ -7027,6 +7030,7 @@ const MESSAGE = 'message';
|
|
|
7027
7030
|
const ACCEPTED = 'accepted';
|
|
7028
7031
|
const REJECTED = 'rejected';
|
|
7029
7032
|
const ON_TRACK$1 = 'onTrack';
|
|
7033
|
+
const ON_EARLY_MEDIA$1 = 'onEarlyMedia';
|
|
7030
7034
|
const ON_REINVITE$1 = 'reinvite';
|
|
7031
7035
|
const ON_ERROR = 'onError';
|
|
7032
7036
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
@@ -7110,6 +7114,7 @@ class WebRTCClient extends Emitter {
|
|
|
7110
7114
|
|
|
7111
7115
|
|
|
7112
7116
|
|
|
7117
|
+
|
|
7113
7118
|
|
|
7114
7119
|
|
|
7115
7120
|
static isAPrivateIp(ip ) {
|
|
@@ -7178,6 +7183,7 @@ class WebRTCClient extends Emitter {
|
|
|
7178
7183
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
7179
7184
|
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
7180
7185
|
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
7186
|
+
this.ON_EARLY_MEDIA = ON_EARLY_MEDIA$1;
|
|
7181
7187
|
}
|
|
7182
7188
|
|
|
7183
7189
|
configureMedia(media ) {
|
|
@@ -7465,6 +7471,11 @@ class WebRTCClient extends Emitter {
|
|
|
7465
7471
|
}
|
|
7466
7472
|
this._onAccepted(session, response.session, true);
|
|
7467
7473
|
},
|
|
7474
|
+
onProgress: (payload) => {
|
|
7475
|
+
if (payload.message.statusCode === 183) {
|
|
7476
|
+
this._onEarlyProgress(payload.session);
|
|
7477
|
+
}
|
|
7478
|
+
},
|
|
7468
7479
|
onReject: (response ) => {
|
|
7469
7480
|
logger$8.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
7470
7481
|
this._stopSendingStats(session);
|
|
@@ -8857,6 +8868,17 @@ class WebRTCClient extends Emitter {
|
|
|
8857
8868
|
};
|
|
8858
8869
|
}
|
|
8859
8870
|
|
|
8871
|
+
_onEarlyProgress(session ) {
|
|
8872
|
+
this._setupMedias(session);
|
|
8873
|
+
|
|
8874
|
+
const sessionId = this.getSipSessionId(session).substr(0, 20);
|
|
8875
|
+
this.updateRemoteStream(sessionId);
|
|
8876
|
+
|
|
8877
|
+
logger$8.info('Early media progress progress received', { sessionId });
|
|
8878
|
+
|
|
8879
|
+
this.eventEmitter.emit(ON_EARLY_MEDIA$1, session);
|
|
8880
|
+
}
|
|
8881
|
+
|
|
8860
8882
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8861
8883
|
logger$8.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8862
8884
|
|
|
@@ -8908,15 +8930,22 @@ class WebRTCClient extends Emitter {
|
|
|
8908
8930
|
|
|
8909
8931
|
_setupMedias(session , newStream ) {
|
|
8910
8932
|
// Safari hack, because you cannot call .play() from a non user action
|
|
8911
|
-
const sessionId = this.getSipSessionId(session);
|
|
8933
|
+
const sessionId = this.getSipSessionId(session).substr(0, 20);
|
|
8912
8934
|
const isConference = this.isConference(sessionId);
|
|
8913
8935
|
|
|
8936
|
+
if (sessionId in this.audioElements) {
|
|
8937
|
+
logger$8.info('html element already exists for session', { sessionId });
|
|
8938
|
+
return;
|
|
8939
|
+
}
|
|
8940
|
+
|
|
8914
8941
|
if (this._hasAudio() && this._isWeb() && !(sessionId in this.audioElements)) {
|
|
8915
8942
|
this.createAudioElementFor(sessionId);
|
|
8916
8943
|
}
|
|
8917
8944
|
|
|
8918
8945
|
const audioElement = this.audioElements[sessionId];
|
|
8919
|
-
const
|
|
8946
|
+
const sipSession = this.sipSessions[session.callId];
|
|
8947
|
+
const removeStream = this.getRemoteStream(sessionId);
|
|
8948
|
+
const stream = newStream || removeStream || sipSession.sessionDescriptionHandler.remoteMediaStream;
|
|
8920
8949
|
|
|
8921
8950
|
if (!this._isWeb() || !stream) {
|
|
8922
8951
|
return;
|
|
@@ -9248,6 +9277,7 @@ const ON_NETWORK_STATS = 'onNetworkStats';
|
|
|
9248
9277
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
9249
9278
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
9250
9279
|
const ON_DISCONNECTED = 'onDisconnected';
|
|
9280
|
+
const ON_EARLY_MEDIA = 'onEarlyMedia';
|
|
9251
9281
|
|
|
9252
9282
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
9253
9283
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
@@ -9289,6 +9319,7 @@ const events = [
|
|
|
9289
9319
|
ON_SIGNAL,
|
|
9290
9320
|
ON_NETWORK_STATS,
|
|
9291
9321
|
ON_DISCONNECTED,
|
|
9322
|
+
ON_EARLY_MEDIA,
|
|
9292
9323
|
];
|
|
9293
9324
|
|
|
9294
9325
|
const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
@@ -10718,6 +10749,10 @@ class WebRTCPhone extends Emitter {
|
|
|
10718
10749
|
logger$7.info('WebRTC disconnected');
|
|
10719
10750
|
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10720
10751
|
});
|
|
10752
|
+
this.client.on(this.client.ON_EARLY_MEDIA, () => {
|
|
10753
|
+
logger$7.info('WebRTC early media');
|
|
10754
|
+
this.eventEmitter.emit(ON_EARLY_MEDIA);
|
|
10755
|
+
});
|
|
10721
10756
|
|
|
10722
10757
|
this.client.on(this.client.REGISTERED, () => {
|
|
10723
10758
|
logger$7.info('WebRTC registered', {
|
|
@@ -11001,6 +11036,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
11001
11036
|
ON_CHAT: ON_CHAT,
|
|
11002
11037
|
ON_SIGNAL: ON_SIGNAL,
|
|
11003
11038
|
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
11039
|
+
ON_EARLY_MEDIA: ON_EARLY_MEDIA,
|
|
11004
11040
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
11005
11041
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
11006
11042
|
events: events,
|
|
@@ -5047,10 +5047,13 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
5047
5047
|
createRoom: async (name , users ) =>
|
|
5048
5048
|
client.post(`${baseUrl}/users/me/rooms`, { name, users }).then(ChatRoom.parse),
|
|
5049
5049
|
|
|
5050
|
-
getRoomMessages: async (roomUuid ) =>
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5050
|
+
getRoomMessages: async (roomUuid , params = {}) => {
|
|
5051
|
+
const qs = ApiRequester.getQueryString(params);
|
|
5052
|
+
|
|
5053
|
+
return client
|
|
5054
|
+
.get(`${baseUrl}/users/me/rooms/${roomUuid}/messages${qs.length ? `?${qs}` : ''}`)
|
|
5055
|
+
.then((response ) => ChatMessage.parseMany(response));
|
|
5056
|
+
},
|
|
5054
5057
|
|
|
5055
5058
|
sendRoomMessage: async (roomUuid , message ) =>
|
|
5056
5059
|
client.post(`${baseUrl}/users/me/rooms/${roomUuid}/messages`, message).then(ChatMessage.parse),
|
|
@@ -7027,6 +7030,7 @@ const MESSAGE = 'message';
|
|
|
7027
7030
|
const ACCEPTED = 'accepted';
|
|
7028
7031
|
const REJECTED = 'rejected';
|
|
7029
7032
|
const ON_TRACK$1 = 'onTrack';
|
|
7033
|
+
const ON_EARLY_MEDIA$1 = 'onEarlyMedia';
|
|
7030
7034
|
const ON_REINVITE$1 = 'reinvite';
|
|
7031
7035
|
const ON_ERROR = 'onError';
|
|
7032
7036
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
@@ -7110,6 +7114,7 @@ class WebRTCClient extends Emitter {
|
|
|
7110
7114
|
|
|
7111
7115
|
|
|
7112
7116
|
|
|
7117
|
+
|
|
7113
7118
|
|
|
7114
7119
|
|
|
7115
7120
|
static isAPrivateIp(ip ) {
|
|
@@ -7178,6 +7183,7 @@ class WebRTCClient extends Emitter {
|
|
|
7178
7183
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
7179
7184
|
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
7180
7185
|
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
7186
|
+
this.ON_EARLY_MEDIA = ON_EARLY_MEDIA$1;
|
|
7181
7187
|
}
|
|
7182
7188
|
|
|
7183
7189
|
configureMedia(media ) {
|
|
@@ -7465,6 +7471,11 @@ class WebRTCClient extends Emitter {
|
|
|
7465
7471
|
}
|
|
7466
7472
|
this._onAccepted(session, response.session, true);
|
|
7467
7473
|
},
|
|
7474
|
+
onProgress: (payload) => {
|
|
7475
|
+
if (payload.message.statusCode === 183) {
|
|
7476
|
+
this._onEarlyProgress(payload.session);
|
|
7477
|
+
}
|
|
7478
|
+
},
|
|
7468
7479
|
onReject: (response ) => {
|
|
7469
7480
|
logger$8.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
7470
7481
|
this._stopSendingStats(session);
|
|
@@ -8857,6 +8868,17 @@ class WebRTCClient extends Emitter {
|
|
|
8857
8868
|
};
|
|
8858
8869
|
}
|
|
8859
8870
|
|
|
8871
|
+
_onEarlyProgress(session ) {
|
|
8872
|
+
this._setupMedias(session);
|
|
8873
|
+
|
|
8874
|
+
const sessionId = this.getSipSessionId(session).substr(0, 20);
|
|
8875
|
+
this.updateRemoteStream(sessionId);
|
|
8876
|
+
|
|
8877
|
+
logger$8.info('Early media progress progress received', { sessionId });
|
|
8878
|
+
|
|
8879
|
+
this.eventEmitter.emit(ON_EARLY_MEDIA$1, session);
|
|
8880
|
+
}
|
|
8881
|
+
|
|
8860
8882
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8861
8883
|
logger$8.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8862
8884
|
|
|
@@ -8908,15 +8930,22 @@ class WebRTCClient extends Emitter {
|
|
|
8908
8930
|
|
|
8909
8931
|
_setupMedias(session , newStream ) {
|
|
8910
8932
|
// Safari hack, because you cannot call .play() from a non user action
|
|
8911
|
-
const sessionId = this.getSipSessionId(session);
|
|
8933
|
+
const sessionId = this.getSipSessionId(session).substr(0, 20);
|
|
8912
8934
|
const isConference = this.isConference(sessionId);
|
|
8913
8935
|
|
|
8936
|
+
if (sessionId in this.audioElements) {
|
|
8937
|
+
logger$8.info('html element already exists for session', { sessionId });
|
|
8938
|
+
return;
|
|
8939
|
+
}
|
|
8940
|
+
|
|
8914
8941
|
if (this._hasAudio() && this._isWeb() && !(sessionId in this.audioElements)) {
|
|
8915
8942
|
this.createAudioElementFor(sessionId);
|
|
8916
8943
|
}
|
|
8917
8944
|
|
|
8918
8945
|
const audioElement = this.audioElements[sessionId];
|
|
8919
|
-
const
|
|
8946
|
+
const sipSession = this.sipSessions[session.callId];
|
|
8947
|
+
const removeStream = this.getRemoteStream(sessionId);
|
|
8948
|
+
const stream = newStream || removeStream || sipSession.sessionDescriptionHandler.remoteMediaStream;
|
|
8920
8949
|
|
|
8921
8950
|
if (!this._isWeb() || !stream) {
|
|
8922
8951
|
return;
|
|
@@ -9248,6 +9277,7 @@ const ON_NETWORK_STATS = 'onNetworkStats';
|
|
|
9248
9277
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
9249
9278
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
9250
9279
|
const ON_DISCONNECTED = 'onDisconnected';
|
|
9280
|
+
const ON_EARLY_MEDIA = 'onEarlyMedia';
|
|
9251
9281
|
|
|
9252
9282
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
9253
9283
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
@@ -9289,6 +9319,7 @@ const events = [
|
|
|
9289
9319
|
ON_SIGNAL,
|
|
9290
9320
|
ON_NETWORK_STATS,
|
|
9291
9321
|
ON_DISCONNECTED,
|
|
9322
|
+
ON_EARLY_MEDIA,
|
|
9292
9323
|
];
|
|
9293
9324
|
|
|
9294
9325
|
const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
@@ -10718,6 +10749,10 @@ class WebRTCPhone extends Emitter {
|
|
|
10718
10749
|
logger$7.info('WebRTC disconnected');
|
|
10719
10750
|
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10720
10751
|
});
|
|
10752
|
+
this.client.on(this.client.ON_EARLY_MEDIA, () => {
|
|
10753
|
+
logger$7.info('WebRTC early media');
|
|
10754
|
+
this.eventEmitter.emit(ON_EARLY_MEDIA);
|
|
10755
|
+
});
|
|
10721
10756
|
|
|
10722
10757
|
this.client.on(this.client.REGISTERED, () => {
|
|
10723
10758
|
logger$7.info('WebRTC registered', {
|
|
@@ -11001,6 +11036,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
11001
11036
|
ON_CHAT: ON_CHAT,
|
|
11002
11037
|
ON_SIGNAL: ON_SIGNAL,
|
|
11003
11038
|
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
11039
|
+
ON_EARLY_MEDIA: ON_EARLY_MEDIA,
|
|
11004
11040
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
11005
11041
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
11006
11042
|
events: events,
|
package/lib/simple/utils.js
CHANGED
|
@@ -5049,10 +5049,13 @@ var chatdMethods = (client , baseUrl ) => ({
|
|
|
5049
5049
|
createRoom: async (name , users ) =>
|
|
5050
5050
|
client.post(`${baseUrl}/users/me/rooms`, { name, users }).then(ChatRoom.parse),
|
|
5051
5051
|
|
|
5052
|
-
getRoomMessages: async (roomUuid ) =>
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5052
|
+
getRoomMessages: async (roomUuid , params = {}) => {
|
|
5053
|
+
const qs = ApiRequester.getQueryString(params);
|
|
5054
|
+
|
|
5055
|
+
return client
|
|
5056
|
+
.get(`${baseUrl}/users/me/rooms/${roomUuid}/messages${qs.length ? `?${qs}` : ''}`)
|
|
5057
|
+
.then((response ) => ChatMessage.parseMany(response));
|
|
5058
|
+
},
|
|
5056
5059
|
|
|
5057
5060
|
sendRoomMessage: async (roomUuid , message ) =>
|
|
5058
5061
|
client.post(`${baseUrl}/users/me/rooms/${roomUuid}/messages`, message).then(ChatMessage.parse),
|
|
@@ -7029,6 +7032,7 @@ const MESSAGE = 'message';
|
|
|
7029
7032
|
const ACCEPTED = 'accepted';
|
|
7030
7033
|
const REJECTED = 'rejected';
|
|
7031
7034
|
const ON_TRACK$1 = 'onTrack';
|
|
7035
|
+
const ON_EARLY_MEDIA$1 = 'onEarlyMedia';
|
|
7032
7036
|
const ON_REINVITE$1 = 'reinvite';
|
|
7033
7037
|
const ON_ERROR = 'onError';
|
|
7034
7038
|
const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
|
|
@@ -7112,6 +7116,7 @@ class WebRTCClient extends Emitter {
|
|
|
7112
7116
|
|
|
7113
7117
|
|
|
7114
7118
|
|
|
7119
|
+
|
|
7115
7120
|
|
|
7116
7121
|
|
|
7117
7122
|
static isAPrivateIp(ip ) {
|
|
@@ -7180,6 +7185,7 @@ class WebRTCClient extends Emitter {
|
|
|
7180
7185
|
this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
|
|
7181
7186
|
this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
|
|
7182
7187
|
this.ON_DISCONNECTED = ON_DISCONNECTED$1;
|
|
7188
|
+
this.ON_EARLY_MEDIA = ON_EARLY_MEDIA$1;
|
|
7183
7189
|
}
|
|
7184
7190
|
|
|
7185
7191
|
configureMedia(media ) {
|
|
@@ -7467,6 +7473,11 @@ class WebRTCClient extends Emitter {
|
|
|
7467
7473
|
}
|
|
7468
7474
|
this._onAccepted(session, response.session, true);
|
|
7469
7475
|
},
|
|
7476
|
+
onProgress: (payload) => {
|
|
7477
|
+
if (payload.message.statusCode === 183) {
|
|
7478
|
+
this._onEarlyProgress(payload.session);
|
|
7479
|
+
}
|
|
7480
|
+
},
|
|
7470
7481
|
onReject: (response ) => {
|
|
7471
7482
|
logger$8.info('on call rejected', { id: session.id, fromTag: session.fromTag });
|
|
7472
7483
|
this._stopSendingStats(session);
|
|
@@ -8859,6 +8870,17 @@ class WebRTCClient extends Emitter {
|
|
|
8859
8870
|
};
|
|
8860
8871
|
}
|
|
8861
8872
|
|
|
8873
|
+
_onEarlyProgress(session ) {
|
|
8874
|
+
this._setupMedias(session);
|
|
8875
|
+
|
|
8876
|
+
const sessionId = this.getSipSessionId(session).substr(0, 20);
|
|
8877
|
+
this.updateRemoteStream(sessionId);
|
|
8878
|
+
|
|
8879
|
+
logger$8.info('Early media progress progress received', { sessionId });
|
|
8880
|
+
|
|
8881
|
+
this.eventEmitter.emit(ON_EARLY_MEDIA$1, session);
|
|
8882
|
+
}
|
|
8883
|
+
|
|
8862
8884
|
_onAccepted(session , sessionDialog , withEvent = true) {
|
|
8863
8885
|
logger$8.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
|
|
8864
8886
|
|
|
@@ -8910,15 +8932,22 @@ class WebRTCClient extends Emitter {
|
|
|
8910
8932
|
|
|
8911
8933
|
_setupMedias(session , newStream ) {
|
|
8912
8934
|
// Safari hack, because you cannot call .play() from a non user action
|
|
8913
|
-
const sessionId = this.getSipSessionId(session);
|
|
8935
|
+
const sessionId = this.getSipSessionId(session).substr(0, 20);
|
|
8914
8936
|
const isConference = this.isConference(sessionId);
|
|
8915
8937
|
|
|
8938
|
+
if (sessionId in this.audioElements) {
|
|
8939
|
+
logger$8.info('html element already exists for session', { sessionId });
|
|
8940
|
+
return;
|
|
8941
|
+
}
|
|
8942
|
+
|
|
8916
8943
|
if (this._hasAudio() && this._isWeb() && !(sessionId in this.audioElements)) {
|
|
8917
8944
|
this.createAudioElementFor(sessionId);
|
|
8918
8945
|
}
|
|
8919
8946
|
|
|
8920
8947
|
const audioElement = this.audioElements[sessionId];
|
|
8921
|
-
const
|
|
8948
|
+
const sipSession = this.sipSessions[session.callId];
|
|
8949
|
+
const removeStream = this.getRemoteStream(sessionId);
|
|
8950
|
+
const stream = newStream || removeStream || sipSession.sessionDescriptionHandler.remoteMediaStream;
|
|
8922
8951
|
|
|
8923
8952
|
if (!this._isWeb() || !stream) {
|
|
8924
8953
|
return;
|
|
@@ -9250,6 +9279,7 @@ const ON_NETWORK_STATS = 'onNetworkStats';
|
|
|
9250
9279
|
const ON_CHAT = 'phone/ON_CHAT';
|
|
9251
9280
|
const ON_SIGNAL = 'phone/ON_SIGNAL';
|
|
9252
9281
|
const ON_DISCONNECTED = 'onDisconnected';
|
|
9282
|
+
const ON_EARLY_MEDIA = 'onEarlyMedia';
|
|
9253
9283
|
|
|
9254
9284
|
const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
|
|
9255
9285
|
const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
|
|
@@ -9291,6 +9321,7 @@ const events = [
|
|
|
9291
9321
|
ON_SIGNAL,
|
|
9292
9322
|
ON_NETWORK_STATS,
|
|
9293
9323
|
ON_DISCONNECTED,
|
|
9324
|
+
ON_EARLY_MEDIA,
|
|
9294
9325
|
];
|
|
9295
9326
|
|
|
9296
9327
|
const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
|
|
@@ -10720,6 +10751,10 @@ class WebRTCPhone extends Emitter {
|
|
|
10720
10751
|
logger$7.info('WebRTC disconnected');
|
|
10721
10752
|
this.eventEmitter.emit(ON_DISCONNECTED);
|
|
10722
10753
|
});
|
|
10754
|
+
this.client.on(this.client.ON_EARLY_MEDIA, () => {
|
|
10755
|
+
logger$7.info('WebRTC early media');
|
|
10756
|
+
this.eventEmitter.emit(ON_EARLY_MEDIA);
|
|
10757
|
+
});
|
|
10723
10758
|
|
|
10724
10759
|
this.client.on(this.client.REGISTERED, () => {
|
|
10725
10760
|
logger$7.info('WebRTC registered', {
|
|
@@ -11003,6 +11038,7 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
|
|
|
11003
11038
|
ON_CHAT: ON_CHAT,
|
|
11004
11039
|
ON_SIGNAL: ON_SIGNAL,
|
|
11005
11040
|
ON_DISCONNECTED: ON_DISCONNECTED,
|
|
11041
|
+
ON_EARLY_MEDIA: ON_EARLY_MEDIA,
|
|
11006
11042
|
MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
|
|
11007
11043
|
MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
|
|
11008
11044
|
events: events,
|