@wazo/sdk 0.47.5 → 0.47.7
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/index.js +109 -14
- package/dist/index.mjs +107 -14
- package/dist/types/api/chatd.d.ts +3 -1
- package/dist/types/api/chatd.d.ts.map +1 -1
- package/dist/types/domain/CallSession.d.ts +3 -1
- package/dist/types/domain/CallSession.d.ts.map +1 -1
- package/dist/types/domain/ChatMessage.d.ts +11 -1
- package/dist/types/domain/ChatMessage.d.ts.map +1 -1
- package/dist/types/domain/ChatRoom.d.ts +3 -1
- package/dist/types/domain/ChatRoom.d.ts.map +1 -1
- package/dist/types/domain/Phone/WebRTCPhone.d.ts.map +1 -1
- package/dist/types/domain/UserIdentity.d.ts +21 -0
- package/dist/types/domain/UserIdentity.d.ts.map +1 -0
- package/dist/types/domain/types.d.ts +2 -0
- package/dist/types/domain/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types/WebSocketMessage.d.ts +11 -1
- package/dist/types/types/WebSocketMessage.d.ts.map +1 -1
- package/dist/types/utils/__tests__/sip-diversion.test.d.ts +2 -0
- package/dist/types/utils/__tests__/sip-diversion.test.d.ts.map +1 -0
- package/dist/types/utils/sip-diversion.d.ts +8 -0
- package/dist/types/utils/sip-diversion.d.ts.map +1 -0
- package/dist/types/web-rtc-client.d.ts.map +1 -1
- package/dist/types/websocket-client.d.ts +1 -0
- package/dist/types/websocket-client.d.ts.map +1 -1
- package/dist/wazo-sdk.js +105 -11
- package/package.json +1 -1
package/dist/wazo-sdk.js
CHANGED
|
@@ -33212,10 +33212,12 @@
|
|
|
33212
33212
|
setOnRefreshToken: ()=>setOnRefreshToken,
|
|
33213
33213
|
Profile: ()=>Profile,
|
|
33214
33214
|
getCallableNumber: ()=>getCallableNumber,
|
|
33215
|
+
UserIdentity: ()=>UserIdentity,
|
|
33215
33216
|
obfuscateToken: ()=>obfuscateToken,
|
|
33216
33217
|
IndirectTransfer: ()=>IndirectTransfer,
|
|
33217
33218
|
SipLine: ()=>SipLine,
|
|
33218
33219
|
getDisplayableNumber: ()=>getDisplayableNumber,
|
|
33220
|
+
parseDiversionHeader: ()=>parseDiversionHeader,
|
|
33219
33221
|
Agent: ()=>domain_Agent,
|
|
33220
33222
|
SwitchboardCall: ()=>domain_SwitchboardCall,
|
|
33221
33223
|
NotificationOptions: ()=>NotificationOptions,
|
|
@@ -33311,6 +33313,7 @@
|
|
|
33311
33313
|
CALL_LOG_USER_CREATED: ()=>CALL_LOG_USER_CREATED,
|
|
33312
33314
|
CALL_RESUMED: ()=>CALL_RESUMED,
|
|
33313
33315
|
CALL_UPDATED: ()=>CALL_UPDATED,
|
|
33316
|
+
CHATD_MESSAGE_DELIVERY_STATUS: ()=>CHATD_MESSAGE_DELIVERY_STATUS,
|
|
33314
33317
|
CHATD_PRESENCE_UPDATED: ()=>CHATD_PRESENCE_UPDATED,
|
|
33315
33318
|
CHATD_USER_ROOM_CREATED: ()=>CHATD_USER_ROOM_CREATED,
|
|
33316
33319
|
CHATD_USER_ROOM_MESSAGE_CREATED: ()=>CHATD_USER_ROOM_MESSAGE_CREATED,
|
|
@@ -34794,6 +34797,9 @@
|
|
|
34794
34797
|
userUuid;
|
|
34795
34798
|
roomUuid;
|
|
34796
34799
|
read;
|
|
34800
|
+
channelType;
|
|
34801
|
+
backend;
|
|
34802
|
+
deliveryStatus;
|
|
34797
34803
|
static parseMany(plain) {
|
|
34798
34804
|
if (!plain || !plain.items) return [];
|
|
34799
34805
|
return plain.items.map((item)=>ChatMessage.parse(item));
|
|
@@ -34806,13 +34812,16 @@
|
|
|
34806
34812
|
alias: plain.alias,
|
|
34807
34813
|
userUuid: plain.user_uuid,
|
|
34808
34814
|
read: true,
|
|
34809
|
-
roomUuid: plain.room ? plain.room.uuid : null
|
|
34815
|
+
roomUuid: plain.room ? plain.room.uuid : null,
|
|
34816
|
+
channelType: plain.delivery?.type ?? 'internal',
|
|
34817
|
+
backend: plain.delivery?.backend ?? null,
|
|
34818
|
+
deliveryStatus: plain.delivery?.status ?? null
|
|
34810
34819
|
});
|
|
34811
34820
|
}
|
|
34812
34821
|
static newFrom(message) {
|
|
34813
34822
|
return new_from(message, ChatMessage);
|
|
34814
34823
|
}
|
|
34815
|
-
constructor({ uuid, date, content, userUuid, alias, roomUuid, read } = {}){
|
|
34824
|
+
constructor({ uuid, date, content, userUuid, alias, roomUuid, read, channelType, backend, deliveryStatus } = {}){
|
|
34816
34825
|
this.uuid = uuid;
|
|
34817
34826
|
this.date = date;
|
|
34818
34827
|
this.content = content;
|
|
@@ -34821,6 +34830,9 @@
|
|
|
34821
34830
|
this.roomUuid = roomUuid;
|
|
34822
34831
|
this.read = read;
|
|
34823
34832
|
this.type = 'ChatMessage';
|
|
34833
|
+
this.channelType = channelType ?? 'internal';
|
|
34834
|
+
this.backend = backend ?? null;
|
|
34835
|
+
this.deliveryStatus = deliveryStatus ?? null;
|
|
34824
34836
|
}
|
|
34825
34837
|
is(other) {
|
|
34826
34838
|
return this.uuid === other.uuid;
|
|
@@ -35092,6 +35104,7 @@
|
|
|
35092
35104
|
isCaller;
|
|
35093
35105
|
answeredBySystem;
|
|
35094
35106
|
dialedExtension;
|
|
35107
|
+
diversion;
|
|
35095
35108
|
ringing;
|
|
35096
35109
|
paused;
|
|
35097
35110
|
sipCallId;
|
|
@@ -35109,7 +35122,7 @@
|
|
|
35109
35122
|
recordingState;
|
|
35110
35123
|
sipSession;
|
|
35111
35124
|
conference;
|
|
35112
|
-
constructor({ answered, answeredBySystem, isCaller, displayName, callId, muted, videoMuted, number, paused, ringing, startTime, creationTime, endTime, cameraEnabled, dialedExtension, sipCallId, sipStatus, callerNumber, call, autoAnswer, ignored, screensharing, recording, recordingPaused, recordingState, videoRemotelyDowngraded, sipSession, answerTime, conference }){
|
|
35125
|
+
constructor({ answered, answeredBySystem, isCaller, displayName, callId, muted, videoMuted, number, paused, ringing, startTime, creationTime, endTime, cameraEnabled, dialedExtension, diversion, sipCallId, sipStatus, callerNumber, call, autoAnswer, ignored, screensharing, recording, recordingPaused, recordingState, videoRemotelyDowngraded, sipSession, answerTime, conference }){
|
|
35113
35126
|
this.callId = callId;
|
|
35114
35127
|
this.sipCallId = sipCallId;
|
|
35115
35128
|
this.displayName = displayName;
|
|
@@ -35127,6 +35140,7 @@
|
|
|
35127
35140
|
this.callerNumber = callerNumber;
|
|
35128
35141
|
this.cameraEnabled = cameraEnabled;
|
|
35129
35142
|
this.dialedExtension = dialedExtension || '';
|
|
35143
|
+
this.diversion = diversion;
|
|
35130
35144
|
this.call = call;
|
|
35131
35145
|
this.sipStatus = sipStatus;
|
|
35132
35146
|
this.autoAnswer = autoAnswer || false;
|
|
@@ -36108,6 +36122,7 @@
|
|
|
36108
36122
|
name;
|
|
36109
36123
|
users;
|
|
36110
36124
|
kind;
|
|
36125
|
+
capabilities;
|
|
36111
36126
|
static parseMany(plain) {
|
|
36112
36127
|
if (!plain || !plain.items) return [];
|
|
36113
36128
|
return plain.items.map((item)=>ChatRoom.parse(item));
|
|
@@ -36117,20 +36132,53 @@
|
|
|
36117
36132
|
uuid: plain.uuid,
|
|
36118
36133
|
name: plain.name,
|
|
36119
36134
|
users: plain.users,
|
|
36120
|
-
kind: plain.kind
|
|
36135
|
+
kind: plain.kind,
|
|
36136
|
+
capabilities: plain.capabilities ?? [
|
|
36137
|
+
'internal'
|
|
36138
|
+
]
|
|
36121
36139
|
});
|
|
36122
36140
|
}
|
|
36123
36141
|
static newFrom(room) {
|
|
36124
36142
|
return new_from(room, ChatRoom);
|
|
36125
36143
|
}
|
|
36126
|
-
constructor({ uuid, name, users, kind } = {}){
|
|
36144
|
+
constructor({ uuid, name, users, kind, capabilities } = {}){
|
|
36127
36145
|
this.uuid = uuid;
|
|
36128
36146
|
this.name = name;
|
|
36129
36147
|
this.users = users;
|
|
36130
36148
|
this.kind = kind;
|
|
36149
|
+
this.capabilities = capabilities ?? [
|
|
36150
|
+
'internal'
|
|
36151
|
+
];
|
|
36131
36152
|
this.type = 'ChatRoom';
|
|
36132
36153
|
}
|
|
36133
36154
|
}
|
|
36155
|
+
class UserIdentity {
|
|
36156
|
+
uuid;
|
|
36157
|
+
type;
|
|
36158
|
+
backend;
|
|
36159
|
+
identity;
|
|
36160
|
+
static parseMany(plain) {
|
|
36161
|
+
if (!plain?.items) return [];
|
|
36162
|
+
return plain.items.map((item)=>UserIdentity.parse(item));
|
|
36163
|
+
}
|
|
36164
|
+
static parse(plain) {
|
|
36165
|
+
return new UserIdentity({
|
|
36166
|
+
uuid: plain.uuid,
|
|
36167
|
+
type: plain.type,
|
|
36168
|
+
backend: plain.backend,
|
|
36169
|
+
identity: plain.identity
|
|
36170
|
+
});
|
|
36171
|
+
}
|
|
36172
|
+
static newFrom(userIdentity) {
|
|
36173
|
+
return new_from(userIdentity, UserIdentity);
|
|
36174
|
+
}
|
|
36175
|
+
constructor({ uuid, type, backend, identity } = {}){
|
|
36176
|
+
this.uuid = uuid;
|
|
36177
|
+
this.type = type;
|
|
36178
|
+
this.backend = backend;
|
|
36179
|
+
this.identity = identity;
|
|
36180
|
+
}
|
|
36181
|
+
}
|
|
36134
36182
|
const MAX_PRESENCE_FETCHED = 30;
|
|
36135
36183
|
const chatd = (client, baseUrl)=>({
|
|
36136
36184
|
updateState: (contactUuid, state)=>client.put(`${baseUrl}/users/${contactUuid}/presences`, {
|
|
@@ -36170,8 +36218,23 @@
|
|
|
36170
36218
|
const qs = ApiRequester.getQueryString(params || {});
|
|
36171
36219
|
return client.get(`${baseUrl}/users/me/rooms/${roomUuid}/messages${qs.length ? `?${qs}` : ''}`).then((response)=>ChatMessage.parseMany(response));
|
|
36172
36220
|
},
|
|
36173
|
-
sendRoomMessage: async (roomUuid, message)=>
|
|
36174
|
-
|
|
36221
|
+
sendRoomMessage: async (roomUuid, message, senderIdentityUuid)=>{
|
|
36222
|
+
const senderIdentity = senderIdentityUuid ? {
|
|
36223
|
+
sender_identity_uuid: senderIdentityUuid
|
|
36224
|
+
} : {};
|
|
36225
|
+
const body = {
|
|
36226
|
+
...message,
|
|
36227
|
+
...senderIdentity
|
|
36228
|
+
};
|
|
36229
|
+
return client.post(`${baseUrl}/users/me/rooms/${roomUuid}/messages`, body).then(ChatMessage.parse);
|
|
36230
|
+
},
|
|
36231
|
+
getMessages: async (options)=>client.get(`${baseUrl}/users/me/rooms/messages`, options),
|
|
36232
|
+
getIdentities: async (roomUuid)=>{
|
|
36233
|
+
const query = roomUuid ? {
|
|
36234
|
+
room_uuid: roomUuid
|
|
36235
|
+
} : void 0;
|
|
36236
|
+
return client.get(`${baseUrl}/users/me/identities`, query).then((response)=>UserIdentity.parseMany(response));
|
|
36237
|
+
}
|
|
36175
36238
|
});
|
|
36176
36239
|
class IndirectTransfer {
|
|
36177
36240
|
status;
|
|
@@ -38084,6 +38147,7 @@ and limitations under the License.
|
|
|
38084
38147
|
const CHATD_PRESENCE_UPDATED = 'chatd_presence_updated';
|
|
38085
38148
|
const CHATD_USER_ROOM_MESSAGE_CREATED = 'chatd_user_room_message_created';
|
|
38086
38149
|
const CHATD_USER_ROOM_CREATED = 'chatd_user_room_created';
|
|
38150
|
+
const CHATD_MESSAGE_DELIVERY_STATUS = 'chatd_message_delivery_status';
|
|
38087
38151
|
const CONFERENCE_USER_PARTICIPANT_JOINED = 'conference_user_participant_joined';
|
|
38088
38152
|
const CONFERENCE_USER_PARTICIPANT_LEFT = 'conference_user_participant_left';
|
|
38089
38153
|
const CONFERENCE_USER_PARTICIPANT_TALK_STARTED = 'conference_user_participant_talk_started';
|
|
@@ -38419,6 +38483,7 @@ and limitations under the License.
|
|
|
38419
38483
|
CHATD_PRESENCE_UPDATED,
|
|
38420
38484
|
CHATD_USER_ROOM_MESSAGE_CREATED,
|
|
38421
38485
|
CHATD_USER_ROOM_CREATED,
|
|
38486
|
+
CHATD_MESSAGE_DELIVERY_STATUS,
|
|
38422
38487
|
CONFERENCE_USER_PARTICIPANT_JOINED,
|
|
38423
38488
|
CONFERENCE_USER_PARTICIPANT_LEFT,
|
|
38424
38489
|
MEETING_USER_PARTICIPANT_JOINED,
|
|
@@ -51698,6 +51763,10 @@ and limitations under the License.
|
|
|
51698
51763
|
_setupSession(session) {
|
|
51699
51764
|
const sipSessionId = this.getSipSessionId(session);
|
|
51700
51765
|
if (!session.delegate) session.delegate = {};
|
|
51766
|
+
if (session instanceof Invitation) {
|
|
51767
|
+
const diversion = session.request.getHeaders('Diversion');
|
|
51768
|
+
if (diversion?.length) session.diversion = diversion;
|
|
51769
|
+
}
|
|
51701
51770
|
session.delegate.onSessionDescriptionHandler = (sdh)=>{
|
|
51702
51771
|
sdh.on('error', (e)=>{
|
|
51703
51772
|
this.eventEmitter.emit(ON_ERROR, e);
|
|
@@ -53932,6 +54001,7 @@ and limitations under the License.
|
|
|
53932
54001
|
recordingPaused: !!fromSession && fromSession.isRecordingPaused(),
|
|
53933
54002
|
recordingState: fromSession ? fromSession.recordingState : RECORDING_STATE.INACTIVE,
|
|
53934
54003
|
sipSession,
|
|
54004
|
+
diversion: sipSession?.diversion,
|
|
53935
54005
|
conference: !!fromSession && fromSession.isConference(),
|
|
53936
54006
|
...extra
|
|
53937
54007
|
});
|
|
@@ -55134,13 +55204,13 @@ and limitations under the License.
|
|
|
55134
55204
|
class LocalParticipant_LocalParticipant extends Participant {
|
|
55135
55205
|
}
|
|
55136
55206
|
const LocalParticipant = LocalParticipant_LocalParticipant;
|
|
55137
|
-
class
|
|
55207
|
+
class RemoteParticipant extends Participant {
|
|
55138
55208
|
constructor(room, rawParticipant, extra = {}){
|
|
55139
55209
|
super(room, rawParticipant, extra);
|
|
55140
55210
|
if ('<unknown>' === this.name) this.name = String(this.number);
|
|
55141
55211
|
}
|
|
55142
55212
|
}
|
|
55143
|
-
const
|
|
55213
|
+
const room_RemoteParticipant = RemoteParticipant;
|
|
55144
55214
|
const Room_logger = IssueReporter.loggerFor('sdk-room');
|
|
55145
55215
|
class Room_Room extends Emitter {
|
|
55146
55216
|
callSession;
|
|
@@ -55640,7 +55710,7 @@ and limitations under the License.
|
|
|
55640
55710
|
}
|
|
55641
55711
|
_isParticipantJoining(participant) {
|
|
55642
55712
|
this.__associateStreams(participant);
|
|
55643
|
-
if (participant instanceof
|
|
55713
|
+
if (participant instanceof room_RemoteParticipant) this.eventEmitter.emit(this.CONFERENCE_USER_PARTICIPANT_JOINED, participant);
|
|
55644
55714
|
}
|
|
55645
55715
|
_saveLocalVideoStream(stream) {
|
|
55646
55716
|
const { localParticipant } = this;
|
|
@@ -55955,7 +56025,7 @@ and limitations under the License.
|
|
|
55955
56025
|
Websocket: simple_Websocket,
|
|
55956
56026
|
Room: room_Room,
|
|
55957
56027
|
SipRoom: room_SipRoom,
|
|
55958
|
-
RemoteParticipant:
|
|
56028
|
+
RemoteParticipant: room_RemoteParticipant,
|
|
55959
56029
|
LocalParticipant: LocalParticipant,
|
|
55960
56030
|
Participant: Participant,
|
|
55961
56031
|
Stream: Stream,
|
|
@@ -56088,6 +56158,30 @@ and limitations under the License.
|
|
|
56088
56158
|
console.info('DebugDevice - Put off speaker');
|
|
56089
56159
|
}
|
|
56090
56160
|
}
|
|
56161
|
+
const unquote = (value)=>{
|
|
56162
|
+
if (!value) return;
|
|
56163
|
+
if (value.length >= 2 && value.startsWith('"') && value.endsWith('"')) return value.slice(1, -1).replace(/\\(.)/g, '$1');
|
|
56164
|
+
return value;
|
|
56165
|
+
};
|
|
56166
|
+
const parseDiversionHeader = (raw)=>{
|
|
56167
|
+
if (!raw) return null;
|
|
56168
|
+
const header = grammar_Grammar.nameAddrHeaderParse(raw);
|
|
56169
|
+
if (!header) return null;
|
|
56170
|
+
const reason = unquote(header.getParam('reason'));
|
|
56171
|
+
const privacy = unquote(header.getParam('privacy'));
|
|
56172
|
+
return {
|
|
56173
|
+
number: header.uri.user ?? '',
|
|
56174
|
+
...header.displayName ? {
|
|
56175
|
+
name: header.displayName
|
|
56176
|
+
} : {},
|
|
56177
|
+
...reason ? {
|
|
56178
|
+
reason
|
|
56179
|
+
} : {},
|
|
56180
|
+
...privacy ? {
|
|
56181
|
+
privacy
|
|
56182
|
+
} : {}
|
|
56183
|
+
};
|
|
56184
|
+
};
|
|
56091
56185
|
const metadata_min_json = {
|
|
56092
56186
|
version: 4,
|
|
56093
56187
|
country_calling_codes: {
|