react-jssip-kit 0.5.4 → 0.5.6
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.cjs.map +1 -1
- package/dist/index.d.cts +107 -456
- package/dist/index.d.ts +107 -456
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,438 +1,76 @@
|
|
|
1
|
+
import * as jssip_lib_RTCSession from 'jssip/lib/RTCSession';
|
|
2
|
+
import { RTCSessionEventMap, AnswerOptions, TerminateOptions, DTFMOptions, RTCSession, ReferOptions } from 'jssip/lib/RTCSession';
|
|
3
|
+
export { AnswerOptions, DTFMOptions, RTCSession, RTCSessionEventMap, ReferOptions, TerminateOptions } from 'jssip/lib/RTCSession';
|
|
4
|
+
import * as jssip_lib_UA from 'jssip/lib/UA';
|
|
5
|
+
import { UAEventMap, IncomingRTCSessionEvent, UAConfiguration, CallOptions, RTCSessionEvent } from 'jssip/lib/UA';
|
|
6
|
+
export { CallOptions } from 'jssip/lib/UA';
|
|
1
7
|
import { UA } from 'jssip';
|
|
2
8
|
export { WebSocketInterface } from 'jssip';
|
|
3
9
|
import * as react from 'react';
|
|
4
10
|
import react__default from 'react';
|
|
5
|
-
import * as jssip_lib_RTCSession from 'jssip/lib/RTCSession';
|
|
6
11
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
12
|
|
|
8
|
-
type Originator = "local" | "remote" | "system";
|
|
9
|
-
type SessionDirection = "incoming" | "outgoing";
|
|
10
|
-
|
|
11
|
-
interface SIPURI {
|
|
12
|
-
user: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface NameAddrHeader {
|
|
16
|
-
uri: SIPURI;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface IncomingRequest {
|
|
20
|
-
body?: string | { toString(): string };
|
|
21
|
-
from: NameAddrHeader;
|
|
22
|
-
to: NameAddrHeader;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface OutgoingRequest {
|
|
26
|
-
body?: string | { toString(): string };
|
|
27
|
-
from: NameAddrHeader;
|
|
28
|
-
to: NameAddrHeader;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface IncomingResponse {
|
|
32
|
-
status_code?: number;
|
|
33
|
-
reason_phrase?: string;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface ExtraHeaders {
|
|
37
|
-
extraHeaders?: string[];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
interface AnswerOptions extends ExtraHeaders {
|
|
41
|
-
mediaConstraints?: MediaStreamConstraints;
|
|
42
|
-
mediaStream?: MediaStream;
|
|
43
|
-
pcConfig?: RTCConfiguration;
|
|
44
|
-
rtcConstraints?: object;
|
|
45
|
-
rtcAnswerConstraints?: RTCOfferOptions;
|
|
46
|
-
rtcOfferConstraints?: RTCOfferOptions;
|
|
47
|
-
sessionTimersExpires?: number;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
interface RejectOptions extends ExtraHeaders {
|
|
51
|
-
status_code?: number;
|
|
52
|
-
reason_phrase?: string;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
interface TerminateOptions extends RejectOptions {
|
|
56
|
-
body?: string;
|
|
57
|
-
cause?: string;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
interface ReferOptions extends ExtraHeaders {
|
|
61
|
-
eventHandlers?: Record<string, unknown>;
|
|
62
|
-
replaces?: RTCSession;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
interface DTFMOptions extends ExtraHeaders {
|
|
66
|
-
duration?: number;
|
|
67
|
-
interToneGap?: number;
|
|
68
|
-
transportType?: string;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
interface HoldOptions extends ExtraHeaders {
|
|
72
|
-
useUpdate?: boolean;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
interface MediaStreamTypes {
|
|
76
|
-
audio?: boolean;
|
|
77
|
-
video?: boolean;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
interface DTMF {
|
|
81
|
-
tone: string;
|
|
82
|
-
duration: number;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
interface Info {
|
|
86
|
-
contentType: string;
|
|
87
|
-
body: string;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
interface PeerConnectionEvent {
|
|
91
|
-
peerconnection: RTCPeerConnection;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
interface ConnectingEvent {
|
|
95
|
-
request: IncomingRequest | OutgoingRequest;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
interface SendingEvent {
|
|
99
|
-
request: OutgoingRequest;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
interface IncomingEvent {
|
|
103
|
-
originator: Originator;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
interface OutgoingEvent {
|
|
107
|
-
originator: Originator;
|
|
108
|
-
response?: IncomingResponse;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
interface IncomingAckEvent {
|
|
112
|
-
originator: Originator;
|
|
113
|
-
ack: IncomingRequest;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
interface OutgoingAckEvent {
|
|
117
|
-
originator: Originator;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
interface EndEvent {
|
|
121
|
-
originator: Originator;
|
|
122
|
-
message?: IncomingRequest | IncomingResponse;
|
|
123
|
-
cause?: string;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
interface IncomingDTMFEvent {
|
|
127
|
-
originator: Originator;
|
|
128
|
-
dtmf: DTMF;
|
|
129
|
-
request?: IncomingRequest;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
interface OutgoingDTMFEvent {
|
|
133
|
-
originator: Originator;
|
|
134
|
-
dtmf: DTMF;
|
|
135
|
-
request?: OutgoingRequest;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
interface IncomingInfoEvent {
|
|
139
|
-
originator: Originator;
|
|
140
|
-
info: Info;
|
|
141
|
-
request?: IncomingRequest;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
interface OutgoingInfoEvent {
|
|
145
|
-
originator: Originator;
|
|
146
|
-
info: Info;
|
|
147
|
-
request?: OutgoingRequest;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
interface HoldEvent {
|
|
151
|
-
originator: Originator;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
interface ReInviteEvent {
|
|
155
|
-
request?: IncomingRequest;
|
|
156
|
-
callback?: VoidFunction;
|
|
157
|
-
reject?: (options?: RejectOptions) => void;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
interface ReferEvent {
|
|
161
|
-
request?: IncomingRequest;
|
|
162
|
-
accept?: () => void;
|
|
163
|
-
reject?: VoidFunction;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
interface SDPEvent {
|
|
167
|
-
originator: Originator;
|
|
168
|
-
type: string;
|
|
169
|
-
sdp: string;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
interface IceCandidateEvent {
|
|
173
|
-
candidate: RTCIceCandidate;
|
|
174
|
-
ready: VoidFunction;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
interface IncomingRTCSessionEvent {
|
|
178
|
-
originator: "remote";
|
|
179
|
-
session: RTCSession;
|
|
180
|
-
request: IncomingRequest;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
interface OutgoingRTCSessionEvent {
|
|
184
|
-
originator: "local";
|
|
185
|
-
session: RTCSession;
|
|
186
|
-
request: OutgoingRequest;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
type RTCSessionEvent = IncomingRTCSessionEvent | OutgoingRTCSessionEvent;
|
|
190
|
-
|
|
191
|
-
type RTCSessionEventMap = {
|
|
192
|
-
peerconnection: (event: PeerConnectionEvent) => void;
|
|
193
|
-
connecting: (event: ConnectingEvent) => void;
|
|
194
|
-
sending: (event: SendingEvent) => void;
|
|
195
|
-
progress: (event: IncomingEvent | OutgoingEvent) => void;
|
|
196
|
-
accepted: (event: IncomingEvent | OutgoingEvent) => void;
|
|
197
|
-
confirmed: (event: IncomingAckEvent | OutgoingAckEvent) => void;
|
|
198
|
-
ended: (event: EndEvent) => void;
|
|
199
|
-
failed: (event: EndEvent) => void;
|
|
200
|
-
newDTMF: (event: IncomingDTMFEvent | OutgoingDTMFEvent) => void;
|
|
201
|
-
newInfo: (event: IncomingInfoEvent | OutgoingInfoEvent) => void;
|
|
202
|
-
hold: (event: HoldEvent) => void;
|
|
203
|
-
unhold: (event: HoldEvent) => void;
|
|
204
|
-
muted: (event: MediaStreamTypes) => void;
|
|
205
|
-
unmuted: (event: MediaStreamTypes) => void;
|
|
206
|
-
reinvite: (event: ReInviteEvent) => void;
|
|
207
|
-
update: (event: ReInviteEvent) => void;
|
|
208
|
-
refer: (event: ReferEvent) => void;
|
|
209
|
-
replaces: (event: ReferEvent) => void;
|
|
210
|
-
sdp: (event: SDPEvent) => void;
|
|
211
|
-
icecandidate: (event: IceCandidateEvent) => void;
|
|
212
|
-
getusermediafailed: (error: unknown) => void;
|
|
213
|
-
"peerconnection:createofferfailed": (error: unknown) => void;
|
|
214
|
-
"peerconnection:createanswerfailed": (error: unknown) => void;
|
|
215
|
-
"peerconnection:setlocaldescriptionfailed": (error: unknown) => void;
|
|
216
|
-
"peerconnection:setremotedescriptionfailed": (error: unknown) => void;
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
interface RTCSession {
|
|
220
|
-
id: string;
|
|
221
|
-
direction: SessionDirection;
|
|
222
|
-
connection?: RTCPeerConnection;
|
|
223
|
-
answer(options?: AnswerOptions): void;
|
|
224
|
-
terminate(options?: TerminateOptions): void;
|
|
225
|
-
mute(options?: MediaStreamTypes): void;
|
|
226
|
-
unmute(options?: MediaStreamTypes): void;
|
|
227
|
-
hold(options?: HoldOptions, done?: VoidFunction): boolean;
|
|
228
|
-
unhold(options?: HoldOptions, done?: VoidFunction): boolean;
|
|
229
|
-
sendDTMF(tones: string | number, options?: DTFMOptions): void;
|
|
230
|
-
refer(target: string | RTCSession, options?: ReferOptions): void;
|
|
231
|
-
on<K extends keyof RTCSessionEventMap>(
|
|
232
|
-
type: K,
|
|
233
|
-
listener: RTCSessionEventMap[K]
|
|
234
|
-
): this;
|
|
235
|
-
off<K extends keyof RTCSessionEventMap>(
|
|
236
|
-
type: K,
|
|
237
|
-
listener: RTCSessionEventMap[K]
|
|
238
|
-
): this;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
interface UAConfiguration {
|
|
242
|
-
sockets: unknown | unknown[];
|
|
243
|
-
uri: string;
|
|
244
|
-
password?: string;
|
|
245
|
-
[key: string]: unknown;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
interface CallOptions extends AnswerOptions {
|
|
249
|
-
eventHandlers?: Partial<RTCSessionEventMap>;
|
|
250
|
-
anonymous?: boolean;
|
|
251
|
-
fromUserName?: string;
|
|
252
|
-
fromDisplayName?: string;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
interface ConnectingUAEvent {
|
|
256
|
-
socket: unknown;
|
|
257
|
-
attempts: number;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
interface ConnectedEvent {
|
|
261
|
-
socket: unknown;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
interface DisconnectEvent {
|
|
265
|
-
socket: unknown;
|
|
266
|
-
error: boolean;
|
|
267
|
-
code?: number;
|
|
268
|
-
reason?: string;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
interface RegisteredEvent {
|
|
272
|
-
response: IncomingResponse;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
interface UnRegisteredEvent {
|
|
276
|
-
response: IncomingResponse;
|
|
277
|
-
cause?: string;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
interface IncomingMessageEvent {
|
|
281
|
-
originator: Originator;
|
|
282
|
-
message: unknown;
|
|
283
|
-
request: IncomingRequest;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
interface OutgoingMessageEvent {
|
|
287
|
-
originator: Originator;
|
|
288
|
-
message: unknown;
|
|
289
|
-
request: OutgoingRequest;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
interface IncomingOptionsEvent {
|
|
293
|
-
originator: Originator;
|
|
294
|
-
request: IncomingRequest;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
interface OutgoingOptionsEvent {
|
|
298
|
-
originator: Originator;
|
|
299
|
-
request: OutgoingRequest;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
type UAEventMap = {
|
|
303
|
-
connecting: (event: ConnectingUAEvent) => void;
|
|
304
|
-
connected: (event: ConnectedEvent) => void;
|
|
305
|
-
disconnected: (event: DisconnectEvent) => void;
|
|
306
|
-
registered: (event: RegisteredEvent) => void;
|
|
307
|
-
unregistered: (event: UnRegisteredEvent) => void;
|
|
308
|
-
registrationFailed: (event: UnRegisteredEvent) => void;
|
|
309
|
-
registrationExpiring: () => void;
|
|
310
|
-
newRTCSession: (event: RTCSessionEvent) => void;
|
|
311
|
-
newMessage: (event: IncomingMessageEvent | OutgoingMessageEvent) => void;
|
|
312
|
-
sipEvent: (event: { event: unknown; request: IncomingRequest }) => void;
|
|
313
|
-
newOptions: (event: IncomingOptionsEvent | OutgoingOptionsEvent) => void;
|
|
314
|
-
};
|
|
315
|
-
|
|
316
13
|
type UAExtraEvents = {
|
|
317
|
-
|
|
318
|
-
|
|
14
|
+
error: {
|
|
15
|
+
cause: string;
|
|
16
|
+
code?: string;
|
|
17
|
+
raw?: any;
|
|
18
|
+
message?: string;
|
|
19
|
+
};
|
|
20
|
+
missed: IncomingRTCSessionEvent;
|
|
319
21
|
};
|
|
320
|
-
|
|
321
22
|
type UAEventName = keyof UAEventMap | keyof UAExtraEvents;
|
|
322
23
|
type SessionEventName = keyof RTCSessionEventMap;
|
|
323
|
-
|
|
324
|
-
declare const JsSIPEventName: {
|
|
325
|
-
readonly connecting: "connecting";
|
|
326
|
-
readonly connected: "connected";
|
|
327
|
-
readonly disconnected: "disconnected";
|
|
328
|
-
readonly registered: "registered";
|
|
329
|
-
readonly unregistered: "unregistered";
|
|
330
|
-
readonly registrationFailed: "registrationFailed";
|
|
331
|
-
readonly registrationExpiring: "registrationExpiring";
|
|
332
|
-
readonly newRTCSession: "newRTCSession";
|
|
333
|
-
readonly newMessage: "newMessage";
|
|
334
|
-
readonly sipEvent: "sipEvent";
|
|
335
|
-
readonly newOptions: "newOptions";
|
|
336
|
-
readonly peerconnection: "peerconnection";
|
|
337
|
-
readonly sending: "sending";
|
|
338
|
-
readonly progress: "progress";
|
|
339
|
-
readonly accepted: "accepted";
|
|
340
|
-
readonly confirmed: "confirmed";
|
|
341
|
-
readonly ended: "ended";
|
|
342
|
-
readonly failed: "failed";
|
|
343
|
-
readonly newDTMF: "newDTMF";
|
|
344
|
-
readonly newInfo: "newInfo";
|
|
345
|
-
readonly hold: "hold";
|
|
346
|
-
readonly unhold: "unhold";
|
|
347
|
-
readonly muted: "muted";
|
|
348
|
-
readonly unmuted: "unmuted";
|
|
349
|
-
readonly reinvite: "reinvite";
|
|
350
|
-
readonly update: "update";
|
|
351
|
-
readonly refer: "refer";
|
|
352
|
-
readonly replaces: "replaces";
|
|
353
|
-
readonly sdp: "sdp";
|
|
354
|
-
readonly error: "error";
|
|
355
|
-
readonly icecandidate: "icecandidate";
|
|
356
|
-
readonly getusermediafailed: "getusermediafailed";
|
|
357
|
-
readonly "peerconnection:createofferfailed": "peerconnection:createofferfailed";
|
|
358
|
-
readonly "peerconnection:createanswerfailed": "peerconnection:createanswerfailed";
|
|
359
|
-
readonly "peerconnection:setlocaldescriptionfailed": "peerconnection:setlocaldescriptionfailed";
|
|
360
|
-
readonly "peerconnection:setremotedescriptionfailed": "peerconnection:setremotedescriptionfailed";
|
|
361
|
-
readonly missed: "missed";
|
|
362
|
-
};
|
|
363
24
|
type JsSIPEventName = UAEventName | SessionEventName;
|
|
364
|
-
|
|
365
|
-
type
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
? UAExtraEvents[K]
|
|
369
|
-
: never;
|
|
370
|
-
|
|
371
|
-
type SessionEventPayload<K extends SessionEventName> =
|
|
372
|
-
K extends keyof RTCSessionEventMap ? Parameters<RTCSessionEventMap[K]>[0] : never;
|
|
373
|
-
|
|
374
|
-
type JsSIPEventPayload<K extends JsSIPEventName> = K extends UAEventName
|
|
375
|
-
? UAEventPayload<K>
|
|
376
|
-
: K extends SessionEventName
|
|
377
|
-
? SessionEventPayload<K>
|
|
378
|
-
: never;
|
|
379
|
-
|
|
380
|
-
type JsSIPEventHandler<K extends JsSIPEventName> = (
|
|
381
|
-
payload?: JsSIPEventPayload<K>
|
|
382
|
-
) => void;
|
|
383
|
-
|
|
25
|
+
type UAEventPayload<K extends UAEventName> = K extends keyof UAEventMap ? Parameters<UAEventMap[K]>[0] : K extends keyof UAExtraEvents ? UAExtraEvents[K] : never;
|
|
26
|
+
type SessionEventPayload<K extends SessionEventName> = K extends keyof RTCSessionEventMap ? Parameters<RTCSessionEventMap[K]>[0] : never;
|
|
27
|
+
type JsSIPEventPayload<K extends JsSIPEventName> = K extends UAEventName ? UAEventPayload<K> : K extends SessionEventName ? SessionEventPayload<K> : never;
|
|
28
|
+
type JsSIPEventHandler<K extends JsSIPEventName> = (payload?: JsSIPEventPayload<K>) => void;
|
|
384
29
|
type SipEventHandlers = {
|
|
385
|
-
|
|
30
|
+
[K in JsSIPEventName]?: JsSIPEventHandler<K>;
|
|
386
31
|
};
|
|
387
|
-
|
|
388
32
|
interface SipEventManager {
|
|
389
|
-
|
|
390
|
-
event: K,
|
|
391
|
-
handler: (payload?: UAEventPayload<K>) => void
|
|
392
|
-
) => () => void;
|
|
393
|
-
onSession: <K extends SessionEventName>(
|
|
394
|
-
sessionId: string,
|
|
395
|
-
event: K,
|
|
396
|
-
handler: (payload?: SessionEventPayload<K>) => void
|
|
397
|
-
) => () => void;
|
|
33
|
+
onUA: <K extends UAEventName>(event: K, handler: (payload?: UAEventPayload<K>) => void) => () => void;
|
|
34
|
+
onSession: <K extends SessionEventName>(sessionId: string, event: K, handler: (payload?: SessionEventPayload<K>) => void) => () => void;
|
|
398
35
|
}
|
|
399
|
-
|
|
400
36
|
type JsSIPEventMap = {
|
|
401
|
-
|
|
37
|
+
[K in JsSIPEventName]: JsSIPEventPayload<K>;
|
|
402
38
|
};
|
|
403
|
-
|
|
404
39
|
type SipConfiguration = Omit<UAConfiguration, "password" | "uri"> & {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Enable JsSIP debug logging. If string, treated as debug pattern.
|
|
42
|
+
*/
|
|
43
|
+
debug?: boolean | string;
|
|
44
|
+
/**
|
|
45
|
+
* Maximum allowed concurrent sessions. Additional sessions are rejected.
|
|
46
|
+
*/
|
|
47
|
+
maxSessionCount?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Milliseconds to keep enqueued outgoing media before dropping. Defaults to 30000.
|
|
50
|
+
*/
|
|
51
|
+
pendingMediaTtlMs?: number;
|
|
417
52
|
};
|
|
418
53
|
|
|
419
|
-
type StartOpts = {
|
|
420
|
-
debug?: boolean | string;
|
|
421
|
-
};
|
|
422
|
-
declare class SipUserAgent {
|
|
423
|
-
private _ua;
|
|
424
|
-
get ua(): UA | null;
|
|
425
|
-
get isStarted(): boolean;
|
|
426
|
-
get isRegistered(): boolean;
|
|
427
|
-
start(uri: string, password: string, config: Omit<SipConfiguration, "debug">, opts?: StartOpts): UA;
|
|
428
|
-
register(): void;
|
|
429
|
-
stop(): void;
|
|
430
|
-
getUA(): UA | null;
|
|
431
|
-
setDebug(debug?: boolean | string): void;
|
|
432
|
-
protected buildUAConfig(config: Omit<SipConfiguration, "debug">, uri: string, password: string): UAConfiguration;
|
|
433
|
-
protected ensureValid(cfg: UAConfiguration): void;
|
|
434
|
-
protected applyDebug(debug?: boolean | string): void;
|
|
435
|
-
protected createUA(cfg: UAConfiguration): UA;
|
|
54
|
+
type StartOpts = {
|
|
55
|
+
debug?: boolean | string;
|
|
56
|
+
};
|
|
57
|
+
declare class SipUserAgent {
|
|
58
|
+
private _ua;
|
|
59
|
+
get ua(): UA | null;
|
|
60
|
+
get isStarted(): boolean;
|
|
61
|
+
get isRegistered(): boolean;
|
|
62
|
+
start(uri: string, password: string, config: Omit<SipConfiguration, "debug">, opts?: StartOpts): UA;
|
|
63
|
+
register(): void;
|
|
64
|
+
stop(): void;
|
|
65
|
+
getUA(): UA | null;
|
|
66
|
+
setDebug(debug?: boolean | string): void;
|
|
67
|
+
protected buildUAConfig(config: Omit<SipConfiguration, "debug">, uri: string, password: string): UAConfiguration;
|
|
68
|
+
protected ensureValid(cfg: UAConfiguration): void;
|
|
69
|
+
protected applyDebug(debug?: boolean | string): void;
|
|
70
|
+
protected createUA(cfg: UAConfiguration): UA;
|
|
71
|
+
private readSessionFlag;
|
|
72
|
+
private persistSessionFlag;
|
|
73
|
+
private clearSessionFlag;
|
|
436
74
|
}
|
|
437
75
|
|
|
438
76
|
declare const SipStatus: {
|
|
@@ -522,23 +160,26 @@ declare class SipStateStore {
|
|
|
522
160
|
private emit;
|
|
523
161
|
}
|
|
524
162
|
|
|
525
|
-
type SipClientOptions = {
|
|
526
|
-
errorMessages?: Record<string, string>;
|
|
527
|
-
formatError?: SipErrorFormatter;
|
|
528
|
-
errorHandler?: SipErrorHandler;
|
|
529
|
-
debug?: boolean | string;
|
|
530
|
-
};
|
|
531
|
-
declare class SipClient extends EventTargetEmitter<JsSIPEventMap> {
|
|
532
|
-
readonly userAgent: SipUserAgent;
|
|
533
|
-
readonly stateStore: SipStateStore;
|
|
534
|
-
private readonly uaHandlers;
|
|
535
|
-
private readonly uaHandlerKeys;
|
|
536
|
-
private sessionHandlers;
|
|
537
|
-
private readonly errorHandler;
|
|
538
|
-
private debugPattern?;
|
|
539
|
-
private
|
|
540
|
-
private
|
|
541
|
-
|
|
163
|
+
type SipClientOptions = {
|
|
164
|
+
errorMessages?: Record<string, string>;
|
|
165
|
+
formatError?: SipErrorFormatter;
|
|
166
|
+
errorHandler?: SipErrorHandler;
|
|
167
|
+
debug?: boolean | string;
|
|
168
|
+
};
|
|
169
|
+
declare class SipClient extends EventTargetEmitter<JsSIPEventMap> {
|
|
170
|
+
readonly userAgent: SipUserAgent;
|
|
171
|
+
readonly stateStore: SipStateStore;
|
|
172
|
+
private readonly uaHandlers;
|
|
173
|
+
private readonly uaHandlerKeys;
|
|
174
|
+
private sessionHandlers;
|
|
175
|
+
private readonly errorHandler;
|
|
176
|
+
private debugPattern?;
|
|
177
|
+
private maxSessionCount;
|
|
178
|
+
private sessionManager;
|
|
179
|
+
private lifecycle;
|
|
180
|
+
private unloadHandler?;
|
|
181
|
+
private stateLogOff?;
|
|
182
|
+
get state(): SipState;
|
|
542
183
|
constructor(options?: SipClientOptions);
|
|
543
184
|
connect(uri: string, password: string, config: SipConfiguration): void;
|
|
544
185
|
registerUA(): void;
|
|
@@ -546,24 +187,28 @@ declare class SipClient extends EventTargetEmitter<JsSIPEventMap> {
|
|
|
546
187
|
call(target: string, callOptions?: CallOptions): void;
|
|
547
188
|
answer(sessionId: string, options?: AnswerOptions): boolean;
|
|
548
189
|
hangup(sessionId: string, options?: TerminateOptions): boolean;
|
|
190
|
+
hangupAll(options?: TerminateOptions): boolean;
|
|
549
191
|
toggleMute(sessionId: string): boolean;
|
|
550
192
|
toggleHold(sessionId: string): boolean;
|
|
551
|
-
sendDTMF(sessionId: string, tones: string | number, options?: DTFMOptions):
|
|
552
|
-
transfer(sessionId: string, target: string | RTCSession, options?: ReferOptions):
|
|
553
|
-
attendedTransfer(sessionId: string, otherSession: RTCSession):
|
|
193
|
+
sendDTMF(sessionId: string, tones: string | number, options?: DTFMOptions): boolean;
|
|
194
|
+
transfer(sessionId: string, target: string | RTCSession, options?: ReferOptions): boolean;
|
|
195
|
+
attendedTransfer(sessionId: string, otherSession: RTCSession): boolean;
|
|
554
196
|
onChange(fn: (s: SipState) => void): () => void;
|
|
555
197
|
private attachUAHandlers;
|
|
556
|
-
setDebug(debug?: boolean | string): void;
|
|
557
|
-
private attachSessionHandlers;
|
|
558
|
-
private detachSessionHandlers;
|
|
559
|
-
private detachUAHandlers;
|
|
560
|
-
private cleanupSession;
|
|
561
|
-
private cleanupAllSessions;
|
|
198
|
+
setDebug(debug?: boolean | string): void;
|
|
199
|
+
private attachSessionHandlers;
|
|
200
|
+
private detachSessionHandlers;
|
|
201
|
+
private detachUAHandlers;
|
|
202
|
+
private cleanupSession;
|
|
203
|
+
private cleanupAllSessions;
|
|
562
204
|
private createSessionHandlersFor;
|
|
563
205
|
protected onNewRTCSession(e: RTCSessionEvent): void;
|
|
564
206
|
protected onSessionFailed(error?: string, event?: RTCSessionEvent): void;
|
|
565
207
|
private emitError;
|
|
566
208
|
private resolveSessionId;
|
|
209
|
+
private sessionExists;
|
|
210
|
+
private resolveExistingSessionId;
|
|
211
|
+
private ensureMediaConstraints;
|
|
567
212
|
answerSession(sessionId: string, options?: AnswerOptions): boolean;
|
|
568
213
|
hangupSession(sessionId: string, options?: TerminateOptions): boolean;
|
|
569
214
|
toggleMuteSession(sessionId?: string): boolean;
|
|
@@ -572,17 +217,23 @@ declare class SipClient extends EventTargetEmitter<JsSIPEventMap> {
|
|
|
572
217
|
transferSession(sessionId: string, target: string | RTCSession, options?: ReferOptions): boolean;
|
|
573
218
|
attendedTransferSession(sessionId: string, otherSession: RTCSession): boolean;
|
|
574
219
|
setSessionMedia(sessionId: string, stream: MediaStream): void;
|
|
575
|
-
switchCameraSession(sessionId: string, track: MediaStreamTrack): boolean
|
|
220
|
+
switchCameraSession(sessionId: string, track: MediaStreamTrack): false | Promise<boolean>;
|
|
576
221
|
enableVideoSession(sessionId: string): boolean;
|
|
577
222
|
disableVideoSession(sessionId: string): boolean;
|
|
578
|
-
getSession(sessionId: string): RTCSession | null;
|
|
579
|
-
getSessionIds(): string[];
|
|
580
|
-
getSessions(): {
|
|
581
|
-
id: string;
|
|
582
|
-
session: RTCSession;
|
|
583
|
-
}[];
|
|
584
|
-
|
|
585
|
-
|
|
223
|
+
getSession(sessionId: string): RTCSession | null;
|
|
224
|
+
getSessionIds(): string[];
|
|
225
|
+
getSessions(): {
|
|
226
|
+
id: string;
|
|
227
|
+
session: RTCSession;
|
|
228
|
+
}[];
|
|
229
|
+
private attachBeforeUnload;
|
|
230
|
+
private detachBeforeUnload;
|
|
231
|
+
private syncDebugInspector;
|
|
232
|
+
private toggleStateLogger;
|
|
233
|
+
private diffState;
|
|
234
|
+
private getPersistedDebug;
|
|
235
|
+
}
|
|
236
|
+
declare function createSipClientInstance(options?: SipClientOptions): SipClient;
|
|
586
237
|
declare function createSipEventManager(client: SipClient): SipEventManager;
|
|
587
238
|
|
|
588
239
|
type SipContextType = {
|
|
@@ -594,13 +245,13 @@ declare const SipContext: react.Context<SipContextType | null>;
|
|
|
594
245
|
declare function useSipState(): SipState;
|
|
595
246
|
|
|
596
247
|
declare function useSipActions(): {
|
|
597
|
-
call: (target: string, callOptions?: CallOptions | undefined) => void;
|
|
598
|
-
answer: (sessionId: string, options?: AnswerOptions | undefined) => boolean;
|
|
599
|
-
hangup: (sessionId: string, options?: TerminateOptions | undefined) => boolean;
|
|
248
|
+
call: (target: string, callOptions?: jssip_lib_UA.CallOptions | undefined) => void;
|
|
249
|
+
answer: (sessionId: string, options?: jssip_lib_RTCSession.AnswerOptions | undefined) => boolean;
|
|
250
|
+
hangup: (sessionId: string, options?: jssip_lib_RTCSession.TerminateOptions | undefined) => boolean;
|
|
600
251
|
toggleMute: (sessionId?: string | undefined) => boolean;
|
|
601
252
|
toggleHold: (sessionId?: string | undefined) => boolean;
|
|
602
|
-
sendDTMF: (sessionId: string, tones: string | number, options?: DTFMOptions | undefined) => boolean;
|
|
603
|
-
transfer: (sessionId: string, target: string | jssip_lib_RTCSession.RTCSession, options?: ReferOptions | undefined) => boolean;
|
|
253
|
+
sendDTMF: (sessionId: string, tones: string | number, options?: jssip_lib_RTCSession.DTFMOptions | undefined) => boolean;
|
|
254
|
+
transfer: (sessionId: string, target: string | jssip_lib_RTCSession.RTCSession, options?: jssip_lib_RTCSession.ReferOptions | undefined) => boolean;
|
|
604
255
|
attendedTransfer: (sessionId: string, otherSession: jssip_lib_RTCSession.RTCSession) => boolean;
|
|
605
256
|
getSession: (sessionId: string) => jssip_lib_RTCSession.RTCSession | null;
|
|
606
257
|
getSessionIds: () => string[];
|
|
@@ -631,4 +282,4 @@ declare function SipProvider({ client, children, sipEventManager, }: {
|
|
|
631
282
|
children: react__default.ReactNode;
|
|
632
283
|
}): react_jsx_runtime.JSX.Element;
|
|
633
284
|
|
|
634
|
-
export {
|
|
285
|
+
export { CallDirection, CallDirection as CallDirectionType, CallPlayer, CallStatus, CallStatus as CallStatusType, type JsSIPEventMap, type JsSIPEventName, type SessionEventName, type SessionEventPayload, type SipConfiguration, SipContext, type SipContextType, type SipEventHandlers, type SipEventManager, SipProvider, type SipSessionState, type SipState, SipStatus, SipStatus as SipStatusType, type UAEventName, type UAEventPayload, createSipClientInstance, createSipEventManager, useSip, useSipActions, useSipEvent, useSipSessionEvent, useSipSessions, useSipState };
|