opensips-js-vue 0.1.39 → 0.1.41

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.
@@ -1,108 +1,123 @@
1
1
  import { AnswerOptions } from 'jssip/lib/RTCSession';
2
+ import { CallListener } from 'jssip/lib/RTCSession';
2
3
  import type { ComputedRef } from 'vue';
4
+ import { ConfirmedListener } from 'jssip/lib/RTCSession';
5
+ import { ConnectingListener } from 'jssip/lib/RTCSession';
6
+ import { DTMFListener } from 'jssip/lib/RTCSession';
3
7
  import { EndEvent } from 'jssip/lib/RTCSession';
8
+ import { EndListener } from 'jssip/lib/RTCSession';
9
+ import { EventEmitter } from 'events';
4
10
  import { ExtraContactParams } from 'jssip/lib/Registrator';
5
- import { ICall as ICall_2 } from '@/types/rtc';
6
- import { ICallStatus as ICallStatus_2 } from '@/types/rtc';
7
- import { IMessage as IMessage_2 } from '@/types/msrp';
11
+ import { HoldListener } from 'jssip/lib/RTCSession';
12
+ import { IceCandidateListener } from 'jssip/lib/RTCSession';
8
13
  import { IncomingAckEvent } from 'jssip/lib/RTCSession';
9
14
  import { IncomingEvent } from 'jssip/lib/RTCSession';
10
- import { IncomingMSRPSessionEvent } from '@/helpers/UA';
11
15
  import { IncomingRequest } from 'jssip/lib/SIPMessage';
12
- import { ITimeData as ITimeData_2 } from '@/types/timer';
16
+ import { InfoListener } from 'jssip/lib/RTCSession';
13
17
  import { MediaConstraints } from 'jssip/lib/RTCSession';
14
- import { MODULES } from '@/enum/modules';
15
- import MSRPMessage from '@/lib/msrp/message';
16
- import { MSRPSession } from '@/lib/msrp/session';
17
- import { MSRPSessionEventMap } from '@/lib/msrp/session';
18
- import { MSRPSessionExtended as MSRPSessionExtended_2 } from '@/types/msrp';
18
+ import { MuteListener } from 'jssip/lib/RTCSession';
19
+ import { OnHoldResult } from 'jssip/lib/RTCSession';
20
+ import { Originator } from 'jssip/lib/RTCSession';
19
21
  import { OutgoingAckEvent } from 'jssip/lib/RTCSession';
20
22
  import { OutgoingEvent } from 'jssip/lib/RTCSession';
21
- import { OutgoingMSRPSessionEvent } from '@/helpers/UA';
23
+ import { PeerConnectionListener } from 'jssip/lib/RTCSession';
22
24
  import type { Ref } from 'vue';
23
- import { RoomChangeEmitType as RoomChangeEmitType_2 } from '@/types/rtc';
25
+ import { ReferListener } from 'jssip/lib/RTCSession';
26
+ import { ReInviteListener } from 'jssip/lib/RTCSession';
27
+ import { RTCPeerConnectionDeprecated } from 'jssip/lib/RTCSession';
24
28
  import { RTCSession } from 'jssip/lib/RTCSession';
25
29
  import { RTCSessionEventMap } from 'jssip/lib/RTCSession';
26
- import { RTCSessionExtended as RTCSessionExtended_2 } from '@/types/rtc';
30
+ import { SDPListener } from 'jssip/lib/RTCSession';
31
+ import { SendingListener } from 'jssip/lib/RTCSession';
27
32
  import { SessionDirection } from 'jssip/lib/RTCSession';
28
- import { StreamMediaType as StreamMediaType_2 } from '@/types/rtc';
33
+ import { UA } from 'jssip';
29
34
  import { UAConfiguration } from 'jssip/lib/UA';
30
35
  import { UAEventMap } from 'jssip/lib/UA';
36
+ import { UpdateListener } from 'jssip/lib/RTCSession';
31
37
 
32
- export declare type ActiveRoomListener = (event: number | undefined) => void
38
+ declare type ActiveRoomListener = (event: number | undefined) => void
33
39
 
34
- export declare type addRoomListener = (value: RoomChangeEmitType_2) => void
40
+ declare type addRoomListener = (value: RoomChangeEmitType) => void
35
41
 
36
- export declare interface AnswerOptionsExtended extends AnswerOptions {
42
+ declare interface AnswerOptionsExtended extends AnswerOptions {
37
43
  mediaConstraints?: MediaConstraints | ExactConstraints
38
44
  }
39
45
 
40
- export declare type AudioModuleName = typeof MODULES.AUDIO
46
+ declare interface AnswerOptionsExtended_2 extends AnswerOptions {
47
+ mediaConstraints?: MediaConstraints | ExactConstraints_2
48
+ }
49
+
50
+ declare type AudioModuleName = typeof MODULES.AUDIO
41
51
 
42
- export declare type CallAddingProgressListener = (callId: string | undefined) => void
52
+ declare type CallAddingProgressListener = (callId: string | undefined) => void
43
53
 
44
- export declare interface CallOptionsExtended extends AnswerOptionsExtended {
54
+ declare interface CallOptionsExtended extends AnswerOptionsExtended {
45
55
  eventHandlers?: Partial<RTCSessionEventMap>;
46
56
  anonymous?: boolean;
47
57
  fromUserName?: string;
48
58
  fromDisplayName?: string;
49
59
  }
50
60
 
51
- export declare type CallTime = Record<string, TempTimeData>
61
+ declare interface CallOptionsExtended_2 extends AnswerOptionsExtended_2 {
62
+ eventHandlers?: Partial<RTCSessionEventMap>;
63
+ anonymous?: boolean;
64
+ fromUserName?: string;
65
+ fromDisplayName?: string;
66
+ }
52
67
 
53
- export declare type changeActiveCallsListener = (event: { [key: string]: ICall_2 }) => void
68
+ declare type changeActiveCallsListener = (event: { [key: string]: ICall }) => void
54
69
 
55
- export declare type changeActiveInputMediaDeviceListener = (event: string) => void
70
+ declare type changeActiveInputMediaDeviceListener = (event: string) => void
56
71
 
57
- export declare type changeActiveMessagesListener = (event: { [key: string]: IMessage_2 }) => void
72
+ declare type changeActiveMessagesListener = (event: { [key: string]: IMessage_2 }) => void
58
73
 
59
- export declare type changeActiveOutputMediaDeviceListener = (event: string) => void
74
+ declare type changeActiveOutputMediaDeviceListener = (event: string) => void
60
75
 
61
- export declare type changeActiveStreamListener = (value: MediaStream) => void
76
+ declare type changeActiveStreamListener = (value: MediaStream) => void
62
77
 
63
- export declare type changeAudioStateListener = (state: boolean) => void
78
+ declare type changeAudioStateListener = (state: boolean) => void
64
79
 
65
- export declare type changeAvailableDeviceListListener = (event: Array<MediaDeviceInfo>) => void
80
+ declare type changeAvailableDeviceListListener = (event: Array<MediaDeviceInfo>) => void
66
81
 
67
- export declare type changeCallMetricsListener = (event: { [key: string]: any }) => void
82
+ declare type changeCallMetricsListener = (event: { [key: string]: any }) => void
68
83
 
69
- export declare type changeCallStatusListener = (event: { [key: string]: ICallStatus_2 }) => void
84
+ declare type changeCallStatusListener = (event: { [key: string]: ICallStatus }) => void
70
85
 
71
- export declare type changeCallTimeListener = (event: { [key: string]: ITimeData_2 }) => void
86
+ declare type changeCallTimeListener = (event: { [key: string]: ITimeData }) => void
72
87
 
73
- export declare type changeCallVolumeListener = (event: ChangeVolumeEventType) => void
88
+ declare type changeCallVolumeListener = (event: ChangeVolumeEventType) => void
74
89
 
75
- export declare type changeIsCallWaitingListener = (value: boolean) => void
90
+ declare type changeIsCallWaitingListener = (value: boolean) => void
76
91
 
77
- export declare type changeIsDNDListener = (value: boolean) => void
92
+ declare type changeIsDNDListener = (value: boolean) => void
78
93
 
79
- export declare type changeIsMutedListener = (value: boolean) => void
94
+ declare type changeIsMutedListener = (value: boolean) => void
80
95
 
81
- export declare type changeMainVideoStreamListener = (event: { name: string, event: MediaStream }) => void
96
+ declare type changeMsrpSessionListener = (session: IMessage_2 | null) => void
82
97
 
83
- export declare type changeMuteWhenJoinListener = (value: boolean) => void
98
+ declare type changeMuteWhenJoinListener = (value: boolean) => void
84
99
 
85
- export declare type changeNoiseReductionStateListener = (event: boolean) => void
100
+ declare type changeNoiseReductionStateListener = (event: boolean) => void
86
101
 
87
- export declare type changeVideoStateListener = (state: boolean) => void
102
+ declare type changeVideoStateListener = (state: boolean) => void
88
103
 
89
104
  export declare type ChangeVolumeEventType = {
90
105
  callId: string
91
106
  volume: number
92
107
  }
93
108
 
94
- export declare type CommonLogMethodType = (...args: unknown[]) => void
109
+ declare type CommonLogMethodType = (...args: unknown[]) => void
95
110
 
96
- export declare type conferenceEndListener = (sessionId) => void
111
+ declare type conferenceEndListener = (sessionId) => void
97
112
 
98
- export declare type conferenceStartListener = () => void
113
+ declare type conferenceStartListener = () => void
99
114
 
100
- export declare type connectionListener = (value: boolean) => void
115
+ declare type connectionListener = (value: boolean) => void
101
116
 
102
- export declare type connectionStateChangeListener = (event: ConnectionStateChangeType) => void
117
+ declare type connectionStateChangeListener = (event: ConnectionStateChangeType) => void
103
118
 
104
119
  export declare type ConnectionStateChangeType = {
105
- session: RTCSessionExtended_2,
120
+ session: RTCSessionExtended,
106
121
  connectionState: string
107
122
  }
108
123
 
@@ -113,7 +128,14 @@ export declare interface CustomLoggerType {
113
128
  debug: CommonLogMethodType
114
129
  }
115
130
 
116
- export declare type ExactConstraints = {
131
+ declare type ExactConstraints = {
132
+ audio?: {
133
+ deviceId: {exact: string}
134
+ }
135
+ video?: boolean;
136
+ }
137
+
138
+ declare type ExactConstraints_2 = {
117
139
  audio?: {
118
140
  deviceId: {exact: string}
119
141
  }
@@ -136,15 +158,15 @@ export declare interface ICallStatus {
136
158
  isTransferred: boolean
137
159
  }
138
160
 
139
- export declare interface ICallStatusUpdate {
140
- callId: string
141
- isMoving?: boolean
142
- isTransferring?: boolean
143
- isMerging?: boolean
144
- isTransferred?: boolean
161
+ export declare interface IMessage extends MSRPSessionExtended {
162
+ roomId?: number
163
+ localMuted?: boolean
164
+ localHold?: boolean
165
+ audioTag?: StreamMediaType
166
+ terminate(): void
145
167
  }
146
168
 
147
- declare interface IMessage extends MSRPSessionExtended {
169
+ declare interface IMessage_2 extends MSRPSessionExtended_2 {
148
170
  roomId?: number
149
171
  localMuted?: boolean
150
172
  localHold?: boolean
@@ -152,14 +174,18 @@ declare interface IMessage extends MSRPSessionExtended {
152
174
  terminate(): void
153
175
  }
154
176
 
155
- export declare type IncomingMSRPSessionListener = (event: IncomingMSRPSessionEvent) => void;
177
+ declare interface IncomingMSRPSessionEvent {
178
+ originator: Originator.REMOTE;
179
+ session: MSRPSession;
180
+ request: IncomingRequest;
181
+ }
182
+
183
+ declare type IncomingMSRPSessionListener = (event: IncomingMSRPSessionEvent) => void;
156
184
 
157
185
  declare type InitOpensipsConfiguration = Omit<IOpenSIPSConfiguration, 'uri' | 'session_timers' | 'password' | 'noiseReductionOptions'> & {
158
186
  noiseReductionOptions?: NoiseReductionOptionsWithoutVadModule
159
187
  }
160
188
 
161
- export declare type IntervalType = ReturnType<typeof setInterval>
162
-
163
189
  export declare type IOpenSIPSConfiguration = Omit<UAConfigurationExtended, 'sockets'>
164
190
 
165
191
  export declare interface IOpenSIPSJSOptions {
@@ -183,10 +209,6 @@ export declare interface IRoom {
183
209
  roomId: number
184
210
  }
185
211
 
186
- export declare type IRoomUpdate = Omit<IRoom, 'started'> & {
187
- started?: Date
188
- }
189
-
190
212
  export declare interface ITimeData {
191
213
  callId: string
192
214
  hours: number
@@ -195,38 +217,305 @@ export declare interface ITimeData {
195
217
  formatted: string
196
218
  }
197
219
 
220
+ declare type Listener = (event: unknown) => void
221
+
222
+ declare type Listener_3 = (event: unknown) => void
223
+
198
224
  export declare type ListenerCallbackFnType<T extends ListenersKeyType> = OpenSIPSEventMap[T]
199
225
 
200
226
  export declare type ListenerEventType = EndEvent | IncomingEvent | OutgoingEvent | IncomingAckEvent | OutgoingAckEvent
201
227
 
202
- export declare type ListenersCallbackFnType = OpenSIPSEventMap[ListenersKeyType]
203
-
204
- export declare type ListenersKeyType = keyof OpenSIPSEventMap
228
+ declare type ListenersKeyType = keyof OpenSIPSEventMap
205
229
 
206
230
  declare type MediaDeviceOption = Omit<MediaDeviceInfo, 'toJSON'>
207
231
 
208
- export declare interface MediaEvent extends Event {
209
- stream: MediaStream
232
+ declare type memberHangupListener = (event: object) => void
233
+
234
+ declare type memberJoinListener = (event: object) => void
235
+
236
+ declare const MODULES: {
237
+ readonly AUDIO: "audio";
238
+ readonly VIDEO: "video";
239
+ readonly MSRP: "msrp";
240
+ };
241
+
242
+ declare type Modules = AudioModuleName | VideoModuleName | MSRPModuleName
243
+
244
+ export declare const MSRP_EVT: {
245
+ readonly CREATE: "m.conversation.create";
246
+ readonly MESSAGE: "m.conversation.message";
247
+ readonly MEMBER: "m.conversation.member";
248
+ readonly CLOSED: "m.conversation.closed";
249
+ readonly SYNC: "m.sync";
250
+ readonly UPLOAD_REQUEST: "m.upload.request";
251
+ readonly UPLOAD_RESPONSE: "m.upload.response";
252
+ readonly FILE_ACCESS_REQUEST: "m.file.access.request";
253
+ readonly FILE_ACCESS_RESPONSE: "m.file.access.response";
254
+ readonly REACTION: "m.reaction";
255
+ readonly TYPING: "m.typing";
256
+ readonly SENT: "m.sent";
257
+ readonly DELIVERED: "m.delivered";
258
+ readonly READ: "m.read";
259
+ readonly FAILED: "m.failed";
260
+ readonly SENDING: "m.sending";
261
+ };
262
+
263
+ declare type msrpConversationCreatedListener = (payload: {
264
+ conversationKey: string
265
+ conversation: MSRPConversationState_2
266
+ }) => void
267
+
268
+ declare type msrpConversationRemovedListener = (payload: { conversationKey: string }) => void
269
+
270
+ export declare interface MSRPConversationState {
271
+ conversationKey: string
272
+ creator: string | null
273
+ members: Set<string>
274
+ memberRoles: Map<string, MSRPMemberRole>
275
+ currentUserRole: MSRPMemberRole
276
+ currentUserStatus: MSRPMembership | null
277
+ state_events: { [key: string]: { [stateKey: string]: any } }
278
+ created_at: number
279
+ updated_at: number
280
+ status?: string
281
+ }
282
+
283
+ declare interface MSRPConversationState_2 {
284
+ conversationKey: string
285
+ creator: string | null
286
+ members: Set<string>
287
+ memberRoles: Map<string, MSRPMemberRole_2>
288
+ currentUserRole: MSRPMemberRole_2
289
+ currentUserStatus: MSRPMembership_2 | null
290
+ state_events: { [key: string]: { [stateKey: string]: any } }
291
+ created_at: number
292
+ updated_at: number
293
+ status?: string
294
+ }
295
+
296
+ declare type msrpConversationUpdatedListener = (payload: {
297
+ conversationKey: string
298
+ patch: Partial<MSRPConversationState_2>
299
+ }) => void
300
+
301
+ declare type MSRPInitializingListener = (sessionId: string | undefined) => void
302
+
303
+ export declare type MSRPMemberRole = 'in_charge' | 'manager' | 'assigned'
304
+
305
+ declare type MSRPMemberRole_2 = 'in_charge' | 'manager' | 'assigned'
306
+
307
+ export declare type MSRPMembership = 'join' | 'leave' | 'invite' | 'ban'
308
+
309
+ declare type MSRPMembership_2 = 'join' | 'leave' | 'invite' | 'ban'
310
+
311
+ declare class MSRPMessage {
312
+ protocol: string
313
+ ident: string
314
+ code: number
315
+ method: string
316
+ headers: any
317
+ body: string
318
+ direction: string
319
+
320
+ constructor(msg: string)
321
+ addHeader(name: string, content: string): void
322
+ getHeader(name: string): string
323
+ toString(): string
324
+ }
325
+
326
+ declare type msrpMessageAddedListener = (payload: {
327
+ conversationKey: string
328
+ message: any
329
+ }) => void
330
+
331
+ export declare type MSRPMessageEventType = {
332
+ message: MSRPMessage,
333
+ session: MSRPSessionExtended_2
210
334
  }
211
335
 
212
- export declare type memberHangupListener = (event: object) => void
336
+ declare type MSRPMessageListener = (event: MSRPMessageEventType) => void;
213
337
 
214
- export declare type memberJoinListener = (event: object) => void
338
+ export declare type MSRPMessageStatus = 'pending' | 'sent' | 'delivered' | 'read' | 'failed'
215
339
 
216
- export declare type Modules = AudioModuleName | VideoModuleName | MSRPModuleName
340
+ declare type MSRPMessageStatus_2 = 'pending' | 'sent' | 'delivered' | 'read' | 'failed'
217
341
 
218
- export declare type MSRPInitializingListener = (sessionId: string | undefined) => void
342
+ declare type MSRPModuleName = typeof MODULES.MSRP
219
343
 
220
- export declare type MSRPMessageEventType = {
221
- message: MSRPMessage,
222
- session: MSRPSessionExtended_2
344
+ declare interface MSRPOptions extends AnswerOptions {
345
+ eventHandlers?: Partial<MSRPSessionEventMap>
346
+ anonymous?: boolean;
347
+ fromUserName?: string;
348
+ fromDisplayName?: string;
349
+ }
350
+
351
+ declare interface MSRPOptions_2 extends AnswerOptions {
352
+ eventHandlers?: Partial<MSRPSessionEventMap_2>
353
+ anonymous?: boolean;
354
+ fromUserName?: string;
355
+ fromDisplayName?: string;
223
356
  }
224
357
 
225
- export declare type MSRPMessageListener = (event: MSRPMessageEventType) => void;
358
+ declare type msrpReactionChangedListener = (payload: {
359
+ conversationKey: string
360
+ eventId: string
361
+ emoji: string
362
+ action: 'add' | 'remove'
363
+ sender: string
364
+ updatedAt: number
365
+ }) => void
366
+
367
+ declare type msrpReceiptChangedListener = (payload: {
368
+ conversationKey: string
369
+ eventId: string
370
+ status: MSRPMessageStatus_2
371
+ updatedAt: number
372
+ }) => void
373
+
374
+ declare class MSRPSession extends EventEmitter {
375
+ _ua: UAExtendedInterface
376
+ id: any
377
+ credentials: any
378
+ status: string
379
+ target: string
380
+ message: string
381
+
382
+ constructor(ua: UAExtendedInterface)
383
+
384
+ get direction(): SessionDirection;
385
+
386
+ get connection(): RTCPeerConnectionDeprecated;
387
+
388
+ get start_time(): Date;
389
+
390
+ isOnHold(): OnHoldResult;
391
+
392
+ mute(options?: MediaConstraints): void;
393
+
394
+ unmute(options?: MediaConstraints): void;
395
+
396
+ init_incoming(request: any): void;
397
+
398
+ isEnded(): boolean;
399
+
400
+ connect(target?:string): void
401
+
402
+ sendMSRP(message: string): void
403
+
404
+ _sendOk(message: string): void
226
405
 
227
- export declare type MSRPModuleName = typeof MODULES.MSRP
406
+ _sendReport(message: string): void
228
407
 
229
- declare interface MSRPSessionExtended extends MSRPSession {
408
+ terminate(options?: any): void
409
+
410
+ receiveRequest(request: unknown): void
411
+
412
+ on<T extends keyof MSRPSessionEventMap>(type: T, listener: MSRPSessionEventMap[T]): this;
413
+ }
414
+
415
+ declare class MSRPSession_2 extends EventEmitter {
416
+ _ua: UAExtendedInterface_2
417
+ id: any
418
+ credentials: any
419
+ status: string
420
+ target: string
421
+ message: string
422
+
423
+ constructor(ua: UAExtendedInterface_2)
424
+
425
+ get direction(): SessionDirection;
426
+
427
+ get connection(): RTCPeerConnectionDeprecated;
428
+
429
+ get start_time(): Date;
430
+
431
+ isOnHold(): OnHoldResult;
432
+
433
+ mute(options?: MediaConstraints): void;
434
+
435
+ unmute(options?: MediaConstraints): void;
436
+
437
+ init_incoming(request: any): void;
438
+
439
+ isEnded(): boolean;
440
+
441
+ connect(target?:string): void
442
+
443
+ sendMSRP(message: string): void
444
+
445
+ _sendOk(message: string): void
446
+
447
+ _sendReport(message: string): void
448
+
449
+ terminate(options?: any): void
450
+
451
+ receiveRequest(request: unknown): void
452
+
453
+ on<T extends keyof MSRPSessionEventMap_2>(type: T, listener: MSRPSessionEventMap_2[T]): this;
454
+ }
455
+
456
+ declare interface MSRPSessionEventMap {
457
+ 'peerconnection': PeerConnectionListener;
458
+ 'connecting': ConnectingListener;
459
+ 'sending': SendingListener;
460
+ 'progress': CallListener;
461
+ 'accepted': CallListener;
462
+ 'confirmed': ConfirmedListener;
463
+ 'ended': EndListener;
464
+ 'failed': EndListener;
465
+ 'newDTMF': DTMFListener;
466
+ 'newInfo': InfoListener;
467
+ 'hold': HoldListener;
468
+ 'unhold': HoldListener;
469
+ 'muted': MuteListener;
470
+ 'unmuted': MuteListener;
471
+ 'reinvite': ReInviteListener;
472
+ 'update': UpdateListener;
473
+ 'refer': ReferListener;
474
+ 'replaces': ReferListener;
475
+ 'sdp': SDPListener;
476
+ 'icecandidate': IceCandidateListener;
477
+ 'getusermediafailed': Listener;
478
+ 'active' : Listener;
479
+ 'msgHistoryUpdate' : Listener;
480
+ 'newMessage' : Listener;
481
+ 'peerconnection:createofferfailed': Listener;
482
+ 'peerconnection:createanswerfailed': Listener;
483
+ 'peerconnection:setlocaldescriptionfailed': Listener;
484
+ 'peerconnection:setremotedescriptionfailed': Listener;
485
+ }
486
+
487
+ declare interface MSRPSessionEventMap_2 {
488
+ 'peerconnection': PeerConnectionListener;
489
+ 'connecting': ConnectingListener;
490
+ 'sending': SendingListener;
491
+ 'progress': CallListener;
492
+ 'accepted': CallListener;
493
+ 'confirmed': ConfirmedListener;
494
+ 'ended': EndListener;
495
+ 'failed': EndListener;
496
+ 'newDTMF': DTMFListener;
497
+ 'newInfo': InfoListener;
498
+ 'hold': HoldListener;
499
+ 'unhold': HoldListener;
500
+ 'muted': MuteListener;
501
+ 'unmuted': MuteListener;
502
+ 'reinvite': ReInviteListener;
503
+ 'update': UpdateListener;
504
+ 'refer': ReferListener;
505
+ 'replaces': ReferListener;
506
+ 'sdp': SDPListener;
507
+ 'icecandidate': IceCandidateListener;
508
+ 'getusermediafailed': Listener_3;
509
+ 'active' : Listener_3;
510
+ 'msgHistoryUpdate' : Listener_3;
511
+ 'newMessage' : Listener_3;
512
+ 'peerconnection:createofferfailed': Listener_3;
513
+ 'peerconnection:createanswerfailed': Listener_3;
514
+ 'peerconnection:setlocaldescriptionfailed': Listener_3;
515
+ 'peerconnection:setremotedescriptionfailed': Listener_3;
516
+ }
517
+
518
+ export declare interface MSRPSessionExtended extends MSRPSession_2 {
230
519
  id: string
231
520
  status: string
232
521
  start_time: Date
@@ -246,10 +535,62 @@ declare interface MSRPSessionExtended extends MSRPSession {
246
535
  answer(options?: any): void
247
536
  _init_incomeing(): void
248
537
  sendMSRP(body: string): void
249
- on<T extends keyof MSRPSessionEventMap>(type: T, listener: MSRPSessionEventMap[T]): this;
538
+ on<T extends keyof MSRPSessionEventMap_2>(type: T, listener: MSRPSessionEventMap_2[T]): this;
539
+ }
540
+
541
+ declare interface MSRPSessionExtended_2 extends MSRPSession_2 {
542
+ id: string
543
+ status: string
544
+ start_time: Date
545
+ direction: SessionDirection
546
+ _id: string
547
+ _cancel_reason: string
548
+ _contact: string
549
+ _end_time: Date
550
+ _eventsCount: number
551
+ _from_tag: string
552
+ _is_canceled: boolean
553
+ _is_confirmed: boolean
554
+ _late_sdp: string
555
+ _status: number
556
+ _remote_identity: string
557
+ target_addr: Array<string>
558
+ answer(options?: any): void
559
+ _init_incomeing(): void
560
+ sendMSRP(body: string): void
561
+ on<T extends keyof MSRPSessionEventMap_2>(type: T, listener: MSRPSessionEventMap_2[T]): this;
250
562
  }
251
563
 
252
- export declare type MSRPSessionListener = IncomingMSRPSessionListener | OutgoingMSRPSessionListener;
564
+ declare type MSRPSessionListener = IncomingMSRPSessionListener | OutgoingMSRPSessionListener;
565
+
566
+ declare type msrpSyncCompletedListener = (payload: {
567
+ conversations: { [key: string]: MSRPConversationState_2 }
568
+ messagesByConversation: { [key: string]: any[] }
569
+ }) => void
570
+
571
+ declare type msrpTypingListener = (payload: {
572
+ conversationKey: string
573
+ sender: string
574
+ isTyping: boolean
575
+ }) => void
576
+
577
+ declare interface MSRPTypingState {
578
+ sender: string;
579
+ isTyping: boolean;
580
+ updatedAt: number;
581
+ }
582
+
583
+ export declare interface MSRPUploadResult {
584
+ upload_url: string
585
+ expires_in?: number
586
+ mime_type: string
587
+ request_id: string
588
+ filename?: string
589
+ preview_url?: string
590
+ icon_url?: string
591
+ transcription?: string
592
+ media_type?: string
593
+ }
253
594
 
254
595
  export declare type NoiseReductionMode = 'disabled' | 'enabled' | 'dynamic'
255
596
 
@@ -276,7 +617,7 @@ export declare interface NoiseReductionOptions {
276
617
 
277
618
  export declare type NoiseReductionOptionsWithoutVadModule = Omit<NoiseReductionOptions, 'vadModule'>
278
619
 
279
- export declare type OnTransportCallback = (parsed: object, message: string) => void
620
+ declare type OnTransportCallback = (parsed: object, message: string) => void
280
621
 
281
622
  export declare interface OpensipsConnectOptions {
282
623
  domain: string
@@ -320,6 +661,16 @@ export declare interface OpenSIPSEventMap extends UAEventMap {
320
661
  connectionStateChange: connectionStateChangeListener
321
662
  newMSRPMessage: MSRPMessageListener
322
663
  newMSRPSession: MSRPSessionListener
664
+ // MSRP events listeners
665
+ changeMsrpSession: changeMsrpSessionListener
666
+ msrpSyncCompleted: msrpSyncCompletedListener
667
+ msrpConversationCreated: msrpConversationCreatedListener
668
+ msrpConversationRemoved: msrpConversationRemovedListener
669
+ msrpConversationUpdated: msrpConversationUpdatedListener
670
+ msrpMessageAdded: msrpMessageAddedListener
671
+ msrpReceiptChanged: msrpReceiptChangedListener
672
+ msrpReactionChanged: msrpReactionChangedListener
673
+ msrpTyping: msrpTypingListener
323
674
  // JANUS
324
675
  conferenceStart: conferenceStartListener
325
676
  conferenceEnd: conferenceEndListener
@@ -333,36 +684,41 @@ export declare interface OpenSIPSEventMap extends UAEventMap {
333
684
  changeVideoState: changeVideoStateListener
334
685
  }
335
686
 
336
- export declare type OutgoingMSRPSessionListener = (event: OutgoingMSRPSessionEvent) => void;
687
+ declare interface OutgoingMSRPSessionEvent {
688
+ originator: Originator.LOCAL;
689
+ session: MSRPSession;
690
+ request: IncomingRequest;
691
+ }
692
+
693
+ declare type OutgoingMSRPSessionListener = (event: OutgoingMSRPSessionEvent) => void;
337
694
 
338
695
  declare interface PNExtraHeaders {
339
696
  [key: string]: string
340
697
  }
341
698
 
342
- export declare type readyListener = (value: boolean) => void
699
+ declare type readyListener = (value: boolean) => void
343
700
 
344
- export declare type reconnectionAttemptsLimitListener = () => void
701
+ declare type reconnectionAttemptsLimitListener = () => void
345
702
 
346
- export declare type reconnectionListener = (value: boolean) => void
703
+ declare type reconnectionListener = (value: boolean) => void
347
704
 
348
- export declare interface RemoteIdentityCallType {
705
+ declare interface RemoteIdentityCallType {
349
706
  _display_name: string
350
707
  _uri: {
351
708
  _user: string
352
709
  }
353
710
  }
354
711
 
355
- export declare type removeRoomListener = (value: RoomChangeEmitType_2) => void
712
+ declare type removeRoomListener = (value: RoomChangeEmitType) => void
356
713
 
357
- export declare type RoomChangeEmitType = {
714
+ declare type RoomChangeEmitType = {
358
715
  room: IRoom
359
716
  roomList: { [key: number]: IRoom }
360
717
  }
361
718
 
362
- export declare type RoomDeletedListener = (roomId: number) => void
719
+ declare type RoomDeletedListener = (roomId: number) => void
363
720
 
364
721
  declare type RTCBundlePolicy_2 = 'balanced' | 'max-bundle' | 'max-compat'
365
- export { RTCBundlePolicy_2 as RTCBundlePolicy }
366
722
 
367
723
  declare interface RTCConfiguration_2 {
368
724
  bundlePolicy?: RTCBundlePolicy_2;
@@ -372,22 +728,18 @@ declare interface RTCConfiguration_2 {
372
728
  iceTransportPolicy?: RTCIceTransportPolicy_2;
373
729
  rtcpMuxPolicy?: RTCRtcpMuxPolicy_2;
374
730
  }
375
- export { RTCConfiguration_2 as RTCConfiguration }
376
731
 
377
732
  declare interface RTCIceServer_2 {
378
733
  credential?: string;
379
734
  urls: string | string[];
380
735
  username?: string;
381
736
  }
382
- export { RTCIceServer_2 as RTCIceServer }
383
737
 
384
738
  declare type RTCIceTransportPolicy_2 = 'all' | 'relay'
385
- export { RTCIceTransportPolicy_2 as RTCIceTransportPolicy }
386
739
 
387
740
  declare type RTCRtcpMuxPolicy_2 = 'require'
388
- export { RTCRtcpMuxPolicy_2 as RTCRtcpMuxPolicy }
389
741
 
390
- export declare interface RTCSessionExtended extends RTCSession {
742
+ declare interface RTCSessionExtended extends RTCSession {
391
743
  id: string
392
744
  _automaticHold: boolean
393
745
  _id: string
@@ -410,49 +762,90 @@ export declare interface RTCSessionExtended extends RTCSession {
410
762
  init_icncoming(request: IncomingRequest): void
411
763
  }
412
764
 
413
- export declare type startBlurListener = () => void
765
+ declare type startBlurListener = () => void
414
766
 
415
- export declare type startScreenShareListener = (event: MediaStream) => void
767
+ declare type startScreenShareListener = (event: MediaStream) => void
416
768
 
417
- export declare type stopBlurListener = () => void
769
+ declare type stopBlurListener = () => void
418
770
 
419
- export declare type stopScreenShareListener = () => void
771
+ declare type stopScreenShareListener = () => void
420
772
 
421
- export declare interface StreamMediaType extends HTMLAudioElement {
773
+ declare interface StreamMediaType extends HTMLAudioElement {
422
774
  className: string
423
775
  setSinkId (id: string): Promise<void>
424
776
  }
425
777
 
426
- export declare type TempTimeData = Omit<ITimeData, 'callId'> & {
427
- callId: string | undefined
778
+ declare interface StreamMediaType_2 extends HTMLAudioElement {
779
+ className: string
780
+ setSinkId (id: string): Promise<void>
428
781
  }
429
782
 
430
- export declare type TestEventListener = (event: { test: string }) => void
783
+ declare type TestEventListener = (event: { test: string }) => void
431
784
 
432
- export declare interface TriggerListenerOptions {
785
+ export declare interface TriggerMSRPListenerOptions {
433
786
  listenerType: string
434
- session: RTCSessionExtended
787
+ session: MSRPSessionExtended
435
788
  event?: ListenerEventType
436
789
  }
437
790
 
438
- export declare type UAConfigurationExtended = UAConfiguration & {
791
+ declare type UAConfigurationExtended = UAConfiguration & {
439
792
  reconnectionAttemptsLimit?: number
440
793
  overrideUserAgent?: (userAgent: string) => string
441
794
  noiseReductionOptions?: NoiseReductionOptions
442
795
  onTransportCallback?: OnTransportCallback
443
796
  }
444
797
 
445
- export declare type updateRoomListener = (value: RoomChangeEmitType_2) => void
798
+ declare interface UAExtendedInterface extends UA {
799
+ //_msrp_sessions: MSRPSession[]
800
+ _transactions: {
801
+ nist: object,
802
+ nict: object,
803
+ ist: object,
804
+ ict: object
805
+ }
806
+
807
+ call (target: string, options?: CallOptionsExtended): RTCSession
808
+ newMSRPSession (session: MSRPSession, data: object): void
809
+ destroyMSRPSession (session: MSRPSession): void
810
+ receiveRequest (request: any): void
811
+ startMSRP (target: string, options: MSRPOptions): MSRPSession
812
+ terminateMSRPSessions (options: object): void
813
+ stop (): void
814
+ }
815
+
816
+ declare interface UAExtendedInterface_2 extends UA {
817
+ //_msrp_sessions: MSRPSession[]
818
+ _transactions: {
819
+ nist: object,
820
+ nict: object,
821
+ ist: object,
822
+ ict: object
823
+ }
824
+
825
+ call (target: string, options?: CallOptionsExtended_2): RTCSession
826
+ newMSRPSession (session: MSRPSession_2, data: object): void
827
+ destroyMSRPSession (session: MSRPSession_2): void
828
+ receiveRequest (request: any): void
829
+ startMSRP (target: string, options: MSRPOptions_2): MSRPSession_2
830
+ terminateMSRPSessions (options: object): void
831
+ stop (): void
832
+ }
833
+
834
+ declare type UnreadCounts = {
835
+ [conversationKey: string]: number;
836
+ };
837
+
838
+ declare type updateRoomListener = (value: RoomChangeEmitType) => void
446
839
 
447
840
  export declare function useVsipInject(): VsipAPI;
448
841
 
449
842
  export declare function useVsipProvide(): VsipAPI;
450
843
 
451
- export declare interface VADModule {
844
+ declare interface VADModule {
452
845
  MicVAD: any
453
846
  }
454
847
 
455
- export declare interface VADOptions {
848
+ declare interface VADOptions {
456
849
  model: 'v5' | 'legacy'
457
850
  positiveSpeechThreshold: number
458
851
  negativeSpeechThreshold: number
@@ -460,12 +853,7 @@ export declare interface VADOptions {
460
853
  preSpeechPadFrames: number
461
854
  }
462
855
 
463
- export declare interface VADSessionState {
464
- isSpeaking: boolean
465
- currentMode: 'clean' | 'noisy'
466
- }
467
-
468
- export declare type VideoModuleName = typeof MODULES.VIDEO
856
+ declare type VideoModuleName = typeof MODULES.VIDEO
469
857
 
470
858
  export declare interface VsipAPI {
471
859
  state: VsipAPIState
@@ -496,11 +884,7 @@ declare interface VsipAPIActions {
496
884
  unholdCall: (callId: string) => void
497
885
  answerCall: (callId: string) => void
498
886
  moveCall: (callId: string, roomId: number) => Promise<void>
499
- msrpAnswer: (callId: string) => void
500
- messageTerminate: (callId: string) => void
501
- initCall: (target: string, addToCurrentRoom: boolean, holdOtherCalls = false) => void
502
- sendMSRP: (msrpSessionId: string, body: string) => void
503
- initMSRP: (target: string, body: string, options: object) => void
887
+ initCall: (target: string, addToCurrentRoom: boolean, holdOtherCalls?: boolean) => void
504
888
  setMicrophone: (deviceId: string) => Promise<void>
505
889
  setSpeaker: (deviceId: string) => Promise<void>
506
890
  sendDTMF: (callId: string, value: string) => void
@@ -509,6 +893,30 @@ declare interface VsipAPIActions {
509
893
  setSpeakerVolume: (value: number) => void
510
894
  setAutoAnswer: (value: boolean) => void
511
895
  setMetricsConfig: (config: WebrtcMetricsConfigType) => void
896
+ // ---------- MSRP ----------
897
+ initMSRP: (options?: object) => void
898
+ initMSRPAndSendMessage: (target: string, body: string, options?: object) => void
899
+ msrpAnswer: (callId: string) => void
900
+ messageTerminate: (callId: string) => void
901
+ sendMSRP: (msrpSessionId: string, body: string) => void
902
+ safeSendMSRP: (body: string) => boolean
903
+ sendCreateConversationMessage: (targetSip: string | string[]) => boolean
904
+ sendTextMessage: (conversationKey: string, text: string) => boolean
905
+ sendMediaMessage: (conversationKey: string, uploadResult: MSRPUploadResult, caption?: string) => boolean
906
+ sendReaction: (conversationKey: string, targetEventId: string, emoji: string) => boolean
907
+ sendTypingIndicator: (conversationKey: string, isTyping: boolean) => boolean
908
+ startTypingKeepAlive: (conversationKey: string) => void
909
+ stopTypingKeepAlive: (sendStop?: boolean) => void
910
+ sendReadReceipt: (conversationKey: string) => boolean
911
+ closeConversation: (conversationKey: string, reason?: string, cause?: string) => boolean
912
+ changeMemberRole: (conversationKey: string, targetUri: string, newRole: MSRPMemberRole) => boolean
913
+ acceptInvite: (conversationKey: string) => boolean
914
+ rejectInvite: (conversationKey: string) => boolean
915
+ leaveConversation: (conversationKey: string) => boolean
916
+ setActiveConversation: (conversationKey: string | null) => void
917
+ requestUploadUrl: (conversationKey: string, filename: string, mimeType: string, fileSize: number) => Promise<MSRPUploadResult>
918
+ requestFileAccess: (conversationKey: string, eventId: string) => Promise<unknown>
919
+ uploadFile: (conversationKey: string, file: File, caption?: string) => Promise<MSRPUploadResult>
512
920
  }
513
921
 
514
922
  declare interface VsipAPIState {
@@ -521,7 +929,6 @@ declare interface VsipAPIState {
521
929
  addCallToCurrentRoom: Ref<boolean>
522
930
  callAddingInProgress: Ref<string | undefined>
523
931
  activeRooms: Ref<{ [key: number]: IRoom }>
524
- msrpHistory: Ref<{ [key: string]: Array<MSRPMessage> }>
525
932
  availableMediaDevices: Ref<Array<MediaDeviceInfo>>
526
933
  inputMediaDeviceList: Ref<Array<MediaDeviceOption>>
527
934
  outputMediaDeviceList: Ref<Array<MediaDeviceOption>>
@@ -540,9 +947,24 @@ declare interface VsipAPIState {
540
947
  callTime: Ref<{ [key: string]: ITimeData }>
541
948
  callMetrics: Ref<{ [key: string]: unknown }>
542
949
  noiseReductionState: Ref<boolean>
543
- }
544
-
545
- declare interface WebrtcMetricsConfigType {
950
+ // ---------- MSRP session ----------
951
+ currentMsrpSession: Ref<IMessage | null>
952
+ isMSRPInitializing: Ref<boolean>
953
+ hasActiveMsrpSession: ComputedRef<boolean>
954
+ // ---------- MSRP conversation state ----------
955
+ // Metadata and chat history are kept as two parallel maps so that
956
+ // message activity doesn't invalidate metadata-only consumers.
957
+ conversations: Ref<{ [conversationKey: string]: MSRPConversationState }>
958
+ messagesByConversation: Ref<{ [conversationKey: string]: any[] }>
959
+ currentConversationKey: Ref<string | null>
960
+ currentConversation: ComputedRef<MSRPConversationState | null>
961
+ currentMessages: ComputedRef<any[]>
962
+ sortedConversations: ComputedRef<MSRPConversationState[]>
963
+ typingByConversation: Ref<{ [conversationKey: string]: MSRPTypingState }>
964
+ unreadByConversation: Ref<UnreadCounts>
965
+ }
966
+
967
+ export declare interface WebrtcMetricsConfigType {
546
968
  refreshEvery?: number
547
969
  startAfter?: number
548
970
  stopAfter?: number