react-sip-kit 0.3.62 → 0.5.19
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/README.md +110 -42
- package/dist/configs/types.d.ts +2 -2
- package/dist/constructors/index.d.ts +0 -1
- package/dist/events/registration/index.d.ts +4 -3
- package/dist/{hooks/useSessionEvents → events/session}/index.d.ts +4 -1
- package/dist/events/transport/index.d.ts +5 -4
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/useDeep/index.d.ts +1 -0
- package/dist/hooks/useSipManager/index.d.ts +8 -0
- package/dist/hooks/useWatchSessionData/index.d.ts +23 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/initializer.d.ts +13 -0
- package/dist/manager.d.ts +62 -0
- package/dist/methods/initialization/index.d.ts +2 -0
- package/dist/methods/registration/index.d.ts +4 -3
- package/dist/methods/session/index.d.ts +38 -2
- package/dist/{hooks/useSpdOptions → methods/session/spdOptions}/index.d.ts +7 -4
- package/dist/{hooks/useSessionMethods → methods/session}/types.d.ts +18 -2
- package/dist/store/index.d.ts +4 -3
- package/dist/store/types.d.ts +27 -20
- package/dist/types.d.ts +6 -18
- package/dist/utils/getMediaDevices/index.d.ts +9 -0
- package/dist/utils/getMediaDevices/types.d.ts +8 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +4 -3
- package/dist/constructors/audioBlobs.d.ts +0 -13
- package/dist/hooks/useGetMediaDevices/index.d.ts +0 -10
- package/dist/hooks/useSessionMethods/index.d.ts +0 -27
- package/dist/provider.d.ts +0 -4
- /package/dist/{hooks/useSessionEvents → events/session}/types.d.ts +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SipConfigs } from './configs/types';
|
|
2
|
+
import { SipUserAgent } from './types';
|
|
3
|
+
export declare class SipInitializer {
|
|
4
|
+
private ua?;
|
|
5
|
+
private configs;
|
|
6
|
+
private username;
|
|
7
|
+
constructor(configs: SipConfigs);
|
|
8
|
+
init(): Promise<void>;
|
|
9
|
+
private detectDevices;
|
|
10
|
+
private createUserAgent;
|
|
11
|
+
getUserAgent(): SipUserAgent | undefined;
|
|
12
|
+
stop(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { LineType, SipUserAgentStatus } from './store/types';
|
|
2
|
+
import { SipManagerConfig } from './types';
|
|
3
|
+
export declare class SipManager {
|
|
4
|
+
private instances;
|
|
5
|
+
/**
|
|
6
|
+
* Create and initialize a SIP session for an account
|
|
7
|
+
*/
|
|
8
|
+
add(config: SipManagerConfig): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Get an existing SIP methods by username
|
|
11
|
+
*/
|
|
12
|
+
methods(username: string): {
|
|
13
|
+
receiveSession: (invitation: import("./store/types").SipInvitationType) => void;
|
|
14
|
+
answerAudioSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
15
|
+
answerVideoSession: (lineNumber: LineType["lineNumber"], enableVideo?: boolean) => void;
|
|
16
|
+
makeAudioSession: (lineObj: LineType, dialledNumber: string, extraHeaders?: Array<string>) => void;
|
|
17
|
+
makeVideoSession: (lineObj: LineType, dialledNumber: string, extraHeaders?: Array<string>) => void;
|
|
18
|
+
toggleLocalVideoTrack: (lineNumber: LineType["lineNumber"]) => Promise<void>;
|
|
19
|
+
toggleShareScreen: (lineNumber: LineType["lineNumber"]) => Promise<void>;
|
|
20
|
+
rejectSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
21
|
+
dialByNumber: (type: Extract<import("./types").CallType, "audio" | "video">, dialNumber: string, extraHeaders?: Array<string>) => void;
|
|
22
|
+
makeConferenceSession: (lineObj: LineType, extraHeaders?: Array<string>) => void;
|
|
23
|
+
endSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
24
|
+
recordSession: (lineNumber: LineType["lineNumber"]) => {
|
|
25
|
+
start: () => Promise<void>;
|
|
26
|
+
stop: () => void;
|
|
27
|
+
};
|
|
28
|
+
toggleMuteSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
29
|
+
toggleHoldSession: (lineNumber: LineType["lineNumber"], forcedValue?: boolean) => Promise<void>;
|
|
30
|
+
cancelSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
31
|
+
startTransferSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
32
|
+
cancelTransferSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
33
|
+
attendedTransferSession: (baseLine: LineType, transferLineNumber: LineType["lineNumber"]) => void;
|
|
34
|
+
cancelAttendedTransferSession: (baseLine: LineType, transferLineNumber: LineType["lineNumber"]) => void;
|
|
35
|
+
teardownSession: typeof import("./methods/session").teardownSession;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Get an existing SIP by username
|
|
39
|
+
*/
|
|
40
|
+
get(username: string): {
|
|
41
|
+
status: SipUserAgentStatus;
|
|
42
|
+
lines: LineType[];
|
|
43
|
+
watch: () => {
|
|
44
|
+
status: SipUserAgentStatus | undefined;
|
|
45
|
+
lines: LineType[];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Check the existance of SIP instance by username
|
|
50
|
+
*/
|
|
51
|
+
has(username: string): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Stop and remove a SIP session
|
|
54
|
+
*/
|
|
55
|
+
stop(username: string): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Stop and clear all SIP sessions
|
|
58
|
+
*/
|
|
59
|
+
stopAll(): Promise<void>;
|
|
60
|
+
getUsernameByNumber(lineNumber: LineType['lineNumber']): string | null;
|
|
61
|
+
getSessionByNumber(lineNumber: LineType['lineNumber']): import("./store/types").SipInvitationType | import("./store/types").SipInviterType | null;
|
|
62
|
+
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import { SipConfigs } from '../../configs/types';
|
|
1
2
|
export declare function detectDevices(): Promise<MediaDeviceInfo[]>;
|
|
2
3
|
export declare function getMediaPermissions(media?: 'audio' | 'video'): Promise<MediaStream>;
|
|
4
|
+
export declare const initilizeMediaStreams: (configs: SipConfigs) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function
|
|
1
|
+
import { SipAccountConfig } from '../../configs/types';
|
|
2
|
+
export declare function register(username: SipAccountConfig['username'], userAgent?: import("../..").SipUserAgent | null): void;
|
|
3
|
+
export declare function unregister(username: SipAccountConfig['username'], skipUnsubscribe?: boolean, userAgent?: import("../..").SipUserAgent | null): void;
|
|
4
|
+
export declare function refreshRegistration(username: SipAccountConfig['username']): void;
|
|
@@ -1,5 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { SipAccountConfig } from '../../configs/types';
|
|
2
|
+
import { LineType, SipInvitationType } from '../../store/types';
|
|
3
|
+
import { CallType } from '../../types';
|
|
4
|
+
import { SendMessageSessionEnum, SendMessageSessionValueType } from './types';
|
|
5
|
+
export declare const sessionMethods: ({ username }: {
|
|
6
|
+
username: SipAccountConfig["username"];
|
|
7
|
+
}) => {
|
|
8
|
+
receiveSession: (invitation: SipInvitationType) => void;
|
|
9
|
+
answerAudioSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
10
|
+
answerVideoSession: (lineNumber: LineType["lineNumber"], enableVideo?: boolean) => void;
|
|
11
|
+
makeAudioSession: (lineObj: LineType, dialledNumber: string, extraHeaders?: Array<string>) => void;
|
|
12
|
+
makeVideoSession: (lineObj: LineType, dialledNumber: string, extraHeaders?: Array<string>) => void;
|
|
13
|
+
toggleLocalVideoTrack: (lineNumber: LineType["lineNumber"]) => Promise<void>;
|
|
14
|
+
toggleShareScreen: (lineNumber: LineType["lineNumber"]) => Promise<void>;
|
|
15
|
+
rejectSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
16
|
+
dialByNumber: (type: Extract<CallType, "audio" | "video">, dialNumber: string, extraHeaders?: Array<string>) => void;
|
|
17
|
+
makeConferenceSession: (lineObj: LineType, extraHeaders?: Array<string>) => void;
|
|
18
|
+
endSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
19
|
+
recordSession: (lineNumber: LineType["lineNumber"]) => {
|
|
20
|
+
start: () => Promise<void>;
|
|
21
|
+
stop: () => void;
|
|
22
|
+
};
|
|
23
|
+
toggleMuteSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
24
|
+
toggleHoldSession: (lineNumber: LineType["lineNumber"], forcedValue?: boolean) => Promise<void>;
|
|
25
|
+
cancelSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
26
|
+
startTransferSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
27
|
+
cancelTransferSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
28
|
+
attendedTransferSession: (baseLine: LineType, transferLineNumber: LineType["lineNumber"]) => void;
|
|
29
|
+
cancelAttendedTransferSession: (baseLine: LineType, transferLineNumber: LineType["lineNumber"]) => void;
|
|
30
|
+
teardownSession: typeof teardownSession;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Teardown Call Session Based on Line
|
|
34
|
+
* @param lineObj
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
3
37
|
export declare function teardownSession(lineObj: LineType): void;
|
|
4
38
|
export declare function sendMessageSession<T extends SendMessageSessionEnum>(session: LineType['sipSession'], type: T, value: SendMessageSessionValueType[T]): Promise<void>;
|
|
5
39
|
/**
|
|
@@ -9,3 +43,5 @@ export declare function sendVideoActivationWithAckRetry(session: LineType['sipSe
|
|
|
9
43
|
maxRetries?: number;
|
|
10
44
|
delayMs?: number;
|
|
11
45
|
}): Promise<void>;
|
|
46
|
+
export declare const getUsernameByNumber: (lineNumber: LineType["lineNumber"]) => SipAccountConfig["username"] | null;
|
|
47
|
+
export declare const getSessionByNumber: (lineNumber: LineType["lineNumber"]) => LineType["sipSession"] | null;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { SipAccountConfig } from '../../../configs/types';
|
|
2
|
+
import { SPDOptionsType } from '../types';
|
|
3
|
+
export declare const spdOptions: ({ username }: {
|
|
4
|
+
username: SipAccountConfig["username"];
|
|
5
|
+
}) => {
|
|
3
6
|
answerAudioSpdOptions: ({ option: defaultOption }?: {
|
|
4
7
|
option?: SPDOptionsType;
|
|
5
8
|
}) => SPDOptionsType | undefined;
|
|
6
9
|
makeAudioSpdOptions: ({ extraHeaders }: {
|
|
7
10
|
extraHeaders?: string[];
|
|
8
|
-
}) => Record<"sessionDescriptionHandlerOptions", import("../
|
|
11
|
+
}) => Record<"sessionDescriptionHandlerOptions", import("../types").SessionDescriptionHandlerOptions> & Partial<{
|
|
9
12
|
earlyMedia: boolean;
|
|
10
13
|
extraHeaders: string[];
|
|
11
14
|
}> & {
|
|
@@ -17,7 +20,7 @@ export declare const useSpdOptions: () => {
|
|
|
17
20
|
}) => SPDOptionsType | undefined;
|
|
18
21
|
makeVideoSpdOptions: ({ extraHeaders }: {
|
|
19
22
|
extraHeaders?: string[];
|
|
20
|
-
}) => Record<"sessionDescriptionHandlerOptions", import("../
|
|
23
|
+
}) => Record<"sessionDescriptionHandlerOptions", import("../types").SessionDescriptionHandlerOptions> & Partial<{
|
|
21
24
|
earlyMedia: boolean;
|
|
22
25
|
extraHeaders: string[];
|
|
23
26
|
}> & {
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sessionMethods } from '.';
|
|
2
|
+
export declare enum SendMessageSessionEnum {
|
|
3
|
+
'SOUND_TOGGLE' = "SOUND_TOGGLE",
|
|
4
|
+
'VIDEO_TOGGLE' = "VIDEO_TOGGLE",
|
|
5
|
+
'SCREEN_SHARE_TOGGLE' = "SCREEN_SHARE_TOGGLE",
|
|
6
|
+
'VIDEO_TOGGLE_ACK' = "VIDEO_TOGGLE_ACK"
|
|
7
|
+
}
|
|
8
|
+
export type SendMessageSessionValueType = {
|
|
9
|
+
[SendMessageSessionEnum.SOUND_TOGGLE]: boolean;
|
|
10
|
+
[SendMessageSessionEnum.VIDEO_TOGGLE]: boolean;
|
|
11
|
+
[SendMessageSessionEnum.SCREEN_SHARE_TOGGLE]: boolean;
|
|
12
|
+
[SendMessageSessionEnum.VIDEO_TOGGLE_ACK]: null | undefined | '';
|
|
13
|
+
};
|
|
14
|
+
export type SendMessageRequestBody<T extends SendMessageSessionEnum = SendMessageSessionEnum.SOUND_TOGGLE> = {
|
|
15
|
+
type: T;
|
|
16
|
+
value: SendMessageSessionValueType[T];
|
|
17
|
+
};
|
|
2
18
|
export interface SessionDescriptionHandlerOptions {
|
|
3
19
|
constraints: {
|
|
4
20
|
audio: AudioSessionConstraints | boolean;
|
|
@@ -28,4 +44,4 @@ export type SPDOptionsType = Record<'sessionDescriptionHandlerOptions', SessionD
|
|
|
28
44
|
earlyMedia: boolean;
|
|
29
45
|
extraHeaders: string[];
|
|
30
46
|
}>;
|
|
31
|
-
export type SessionMethods = ReturnType<typeof
|
|
47
|
+
export type SessionMethods = ReturnType<typeof sessionMethods>;
|
package/dist/store/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { SipConfigs } from '../configs/types';
|
|
1
|
+
import { SipAccountConfig, SipConfigs } from '../configs/types';
|
|
2
|
+
import { SipUserAgent } from '../types';
|
|
2
3
|
import { SipStoreStateType } from './types';
|
|
3
4
|
export declare const useSipStore: import("zustand").UseBoundStore<import("zustand").StoreApi<SipStoreStateType>>;
|
|
4
5
|
/**
|
|
@@ -15,12 +16,12 @@ export declare const getSipStore: () => SipStoreStateType;
|
|
|
15
16
|
*
|
|
16
17
|
* Get sip store userAgent for none functional components
|
|
17
18
|
*/
|
|
18
|
-
export declare const getSipStoreUserAgent: (
|
|
19
|
+
export declare const getSipStoreUserAgent: (username: SipAccountConfig["username"]) => SipUserAgent | null;
|
|
19
20
|
/**
|
|
20
21
|
*
|
|
21
22
|
* Get sip store configs for none functional components
|
|
22
23
|
*/
|
|
23
|
-
export declare const
|
|
24
|
+
export declare const getSipUsernameConfigs: (username: SipAccountConfig["username"]) => SipConfigs | null;
|
|
24
25
|
/**
|
|
25
26
|
*
|
|
26
27
|
* Init sip store for none functional components
|
package/dist/store/types.d.ts
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import { SipConfigs } from '../configs/types';
|
|
2
|
-
import { AudioBlobs } from '../constructors';
|
|
1
|
+
import { SipAccountConfig, SipConfigs } from '../configs/types';
|
|
3
2
|
import { CallbackFunction, CallType, SipUserAgent } from '../types';
|
|
4
3
|
import { Invitation, Inviter, Session, SessionDescriptionHandler, SessionDescriptionHandlerOptions } from 'sip.js';
|
|
5
4
|
import { IncomingInviteRequest } from 'sip.js/lib/core';
|
|
6
5
|
export interface SipStoreStateType {
|
|
7
|
-
configs: SipConfigs;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
configs: Record<SipAccountConfig['username'], SipConfigs> | null;
|
|
7
|
+
statuses: Record<SipAccountConfig['username'], SipUserAgentStatus> | null;
|
|
8
|
+
userAgents?: Record<SipAccountConfig['username'], SipUserAgent>;
|
|
9
|
+
lines: Record<SipAccountConfig['username'], Record<LineType['lineNumber'], LineType>>;
|
|
10
|
+
usernamesByLineNumber: Record<LineType['lineNumber'], SipAccountConfig['username']>;
|
|
11
11
|
devicesInfo: DevicesInfoType;
|
|
12
12
|
setSipStore: (state: Partial<SipStoreStateType>) => void;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
setConfig: (username: SipAccountConfig['username'], userAgent: SipConfigs) => void;
|
|
14
|
+
setUserAgent: (username: SipAccountConfig['username'], userAgent: SipUserAgent) => void;
|
|
15
|
+
addLine: (username: SipAccountConfig['username'], line: LineType) => void;
|
|
15
16
|
updateLine: (line: LineType, callback?: CallbackFunction) => void;
|
|
16
|
-
removeLine: (
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
removeLine: (lineNumber: LineType['lineNumber']) => void;
|
|
18
|
+
remove: (username: SipAccountConfig['username']) => void;
|
|
19
|
+
removeAll: () => void;
|
|
20
|
+
findLineByNumber: (lineNumber: LineType['lineNumber']) => LineType | null;
|
|
21
|
+
getSessionByNumber: (lineNumber: LineType['lineNumber']) => LineType['sipSession'] | null;
|
|
22
|
+
getUsernameByNumber: (lineNumber: LineType['lineNumber']) => SipAccountConfig['username'] | null;
|
|
19
23
|
getNewLineNumber: () => number;
|
|
20
|
-
countIdSessions: (id: string) => number;
|
|
21
24
|
}
|
|
22
25
|
export interface SipInvitationType extends Omit<Invitation, 'incomingInviteRequest' | 'sessionDescriptionHandler'> {
|
|
23
26
|
data: Partial<SipSessionDataType>;
|
|
@@ -25,9 +28,13 @@ export interface SipInvitationType extends Omit<Invitation, 'incomingInviteReque
|
|
|
25
28
|
sessionDescriptionHandler: SipSessionDescriptionHandler;
|
|
26
29
|
sessionDescriptionHandlerOptionsReInvite: SipSessionDescriptionHandlerOptions;
|
|
27
30
|
isOnHold: boolean;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
initiateLocalMediaStreams: (params: InitiateMediaStreamsParams) => void;
|
|
32
|
+
initiateRemoteMediaStreams: (params: InitiateMediaStreamsParams) => void;
|
|
33
|
+
}
|
|
34
|
+
export interface InitiateMediaStreamsParams {
|
|
35
|
+
videoEnabled?: boolean;
|
|
36
|
+
pc?: RTCPeerConnection;
|
|
37
|
+
configs?: SipConfigs;
|
|
31
38
|
}
|
|
32
39
|
export interface SipSessionDescriptionHandlerOptions extends SessionDescriptionHandlerOptions {
|
|
33
40
|
hold: boolean;
|
|
@@ -37,9 +44,8 @@ export interface SipInviterType extends Inviter {
|
|
|
37
44
|
sessionDescriptionHandler: SipSessionDescriptionHandler;
|
|
38
45
|
sessionDescriptionHandlerOptionsReInvite: SipSessionDescriptionHandlerOptions;
|
|
39
46
|
isOnHold: boolean;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
initiateRemoteMediaStreams: (videoEnabled?: boolean, pc?: RTCPeerConnection) => void;
|
|
47
|
+
initiateLocalMediaStreams: (params: InitiateMediaStreamsParams) => void;
|
|
48
|
+
initiateRemoteMediaStreams: (params: InitiateMediaStreamsParams) => void;
|
|
43
49
|
}
|
|
44
50
|
export interface SipSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
45
51
|
peerConnection: RTCPeerConnection;
|
|
@@ -58,8 +64,9 @@ export interface SipSessionType extends Session {
|
|
|
58
64
|
export interface SipSessionDataType {
|
|
59
65
|
line: number;
|
|
60
66
|
callDirection: 'inbound' | 'outbound';
|
|
67
|
+
callType: CallType;
|
|
61
68
|
terminateBy: string;
|
|
62
|
-
|
|
69
|
+
remoteNumber: string;
|
|
63
70
|
earlyReject: boolean;
|
|
64
71
|
reasonCode: number;
|
|
65
72
|
reasonText: string;
|
|
@@ -76,7 +83,6 @@ export interface SipSessionDataType {
|
|
|
76
83
|
localMediaStreamStatus: MediaStremStatus;
|
|
77
84
|
remoteMediaStreamStatus: MediaStremStatus;
|
|
78
85
|
videoAckReceived: boolean;
|
|
79
|
-
dialledNumber: string;
|
|
80
86
|
transfer: Array<SipSessionTransferType>;
|
|
81
87
|
audioSourceTrack: MediaStreamTrack | null;
|
|
82
88
|
videoSourceTrack: MediaStreamTrack | null;
|
|
@@ -121,4 +127,5 @@ interface MediaStremStatus {
|
|
|
121
127
|
videoEnabled: boolean;
|
|
122
128
|
screenShareEnabled: boolean;
|
|
123
129
|
}
|
|
130
|
+
export type SipUserAgentStatus = 'disconnected' | 'connecting' | 'connected';
|
|
124
131
|
export {};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SipConfigs } from './configs/types';
|
|
2
2
|
import { reconnectTransport } from './events/transport';
|
|
3
|
-
import {
|
|
4
|
-
import { LineType, SipSessionType } from './store/types';
|
|
3
|
+
import { SipSessionType } from './store/types';
|
|
5
4
|
import { Registerer, Subscriber, UserAgent } from 'sip.js';
|
|
6
5
|
export interface SipUserAgent extends UserAgent {
|
|
7
6
|
isReRegister: boolean;
|
|
@@ -24,27 +23,16 @@ export interface SipUserAgent extends UserAgent {
|
|
|
24
23
|
selfSub: Subscriber | null;
|
|
25
24
|
voicemailSub: Subscriber | null;
|
|
26
25
|
}
|
|
27
|
-
type
|
|
28
|
-
account:
|
|
26
|
+
export type SipManagerConfig = {
|
|
27
|
+
account: SipConfigs['account'];
|
|
29
28
|
} & {
|
|
30
|
-
[P in Exclude<keyof
|
|
29
|
+
[P in Exclude<keyof SipConfigs, 'account'>]?: Partial<SipConfigs[P]>;
|
|
31
30
|
};
|
|
32
|
-
export interface
|
|
33
|
-
|
|
34
|
-
configs: SipProviderConfigs<T>;
|
|
35
|
-
}
|
|
36
|
-
export interface SipContextType {
|
|
37
|
-
status: 'connected' | 'disconnected';
|
|
38
|
-
lines: LineType[];
|
|
39
|
-
transport: SipContextTransportType;
|
|
40
|
-
}
|
|
41
|
-
export interface SipContextSessionType {
|
|
42
|
-
methods: Omit<ReturnType<typeof useSessionMethods>, 'receiveCall'>;
|
|
43
|
-
events: ReturnType<typeof useSessionEvents>;
|
|
31
|
+
export interface SipManagerProps {
|
|
32
|
+
configs: SipManagerConfig[];
|
|
44
33
|
}
|
|
45
34
|
export interface SipContextTransportType {
|
|
46
35
|
reconnectTransport: typeof reconnectTransport;
|
|
47
36
|
}
|
|
48
37
|
export type CallbackFunction<T = any> = (value?: T) => void;
|
|
49
38
|
export type CallType = 'audio' | 'video' | 'conferenceAudio' | 'conferenceVideo' | 'transferAudio' | 'transferVideo';
|
|
50
|
-
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SipAccountConfig } from '../../configs/types';
|
|
2
|
+
export declare const getMediaDevices: (username: SipAccountConfig["username"]) => Promise<{
|
|
3
|
+
hasAudioDevice: boolean;
|
|
4
|
+
audioInputDevices: MediaDeviceInfo[];
|
|
5
|
+
hasSpeakerDevice: boolean;
|
|
6
|
+
speakerDevices: MediaDeviceInfo[];
|
|
7
|
+
hasVideoDevice: boolean;
|
|
8
|
+
videoInputDevices: MediaDeviceInfo[];
|
|
9
|
+
}>;
|
package/dist/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-sip-kit",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.19",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Shervin Ghajar",
|
|
@@ -57,7 +57,8 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"dayjs": "^1.11.13",
|
|
59
59
|
"sip.js": "0.21.2",
|
|
60
|
-
"zustand": "^5.0.1"
|
|
60
|
+
"zustand": "^5.0.1",
|
|
61
|
+
"lodash.isequal": "^4.5.0"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
63
64
|
"@eslint/js": "9.13.0",
|
|
@@ -66,7 +67,7 @@
|
|
|
66
67
|
"@rollup/plugin-terser": "^0.4.4",
|
|
67
68
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
68
69
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
69
|
-
"@types/
|
|
70
|
+
"@types/lodash.isequal": "^4.5.8",
|
|
70
71
|
"@types/react": "18.3.12",
|
|
71
72
|
"@types/react-dom": "18.3.1",
|
|
72
73
|
"@typescript-eslint/eslint-plugin": "^8.15.0",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
type AudioBlobsType = Record<'Alert' | 'Ringtone' | 'CallWaiting', {
|
|
2
|
-
file: string;
|
|
3
|
-
url: string;
|
|
4
|
-
blob?: string | ArrayBuffer | null;
|
|
5
|
-
}>;
|
|
6
|
-
export declare class AudioBlobs {
|
|
7
|
-
private static instance;
|
|
8
|
-
private audioBlobs;
|
|
9
|
-
private constructor();
|
|
10
|
-
static getInstance(overwrite?: Partial<AudioBlobsType>): AudioBlobs;
|
|
11
|
-
getAudios(): AudioBlobsType;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare const useGetMediaDevices: () => {
|
|
2
|
-
getDevices: () => Promise<{
|
|
3
|
-
hasAudioDevice: boolean;
|
|
4
|
-
audioInputDevices: MediaDeviceInfo[];
|
|
5
|
-
hasSpeakerDevice: boolean;
|
|
6
|
-
speakerDevices: MediaDeviceInfo[];
|
|
7
|
-
hasVideoDevice: boolean;
|
|
8
|
-
videoInputDevices: MediaDeviceInfo[];
|
|
9
|
-
}>;
|
|
10
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { LineType, SipInvitationType } from '../../store/types';
|
|
2
|
-
import { CallType } from '../../types';
|
|
3
|
-
export declare const useSessionMethods: () => {
|
|
4
|
-
receiveSession: (invitation: SipInvitationType) => void;
|
|
5
|
-
answerAudioSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
6
|
-
answerVideoSession: (lineNumber: LineType["lineNumber"], enableVideo?: boolean) => void;
|
|
7
|
-
makeAudioSession: (lineObj: LineType, dialledNumber: string, extraHeaders?: Array<string>) => void;
|
|
8
|
-
makeVideoSession: (lineObj: LineType, dialledNumber: string, extraHeaders?: Array<string>) => void;
|
|
9
|
-
toggleLocalVideoTrack: (lineNumber: LineType["lineNumber"]) => Promise<void>;
|
|
10
|
-
toggleShareScreen: (lineNumber: LineType["lineNumber"]) => Promise<void>;
|
|
11
|
-
rejectSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
12
|
-
dialByNumber: (type: Extract<CallType, "audio" | "video">, dialNumber: string, extraHeaders?: Array<string>) => void;
|
|
13
|
-
makeConferenceSession: (lineObj: LineType, extraHeaders?: Array<string>) => void;
|
|
14
|
-
endSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
15
|
-
recordSession: (lineNumber: LineType["lineNumber"]) => {
|
|
16
|
-
start: () => Promise<void>;
|
|
17
|
-
stop: () => void;
|
|
18
|
-
};
|
|
19
|
-
toggleMuteSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
20
|
-
toggleHoldSession: (lineNumber: LineType["lineNumber"], forcedValue?: boolean) => Promise<void>;
|
|
21
|
-
cancelSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
22
|
-
startTransferSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
23
|
-
cancelTransferSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
24
|
-
attendedTransferSession: (baseLine: LineType, transferLineNumber: LineType["lineNumber"]) => void;
|
|
25
|
-
cancelAttendedTransferSession: (baseLine: LineType, transferLineNumber: LineType["lineNumber"]) => void;
|
|
26
|
-
teardownSession: (lineObj: LineType) => void;
|
|
27
|
-
};
|
package/dist/provider.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { SipContextType, SipProviderProps } from './types';
|
|
2
|
-
export declare const SipContext: import("react").Context<SipContextType | undefined>;
|
|
3
|
-
export declare const SipProvider: ({ children, configs }: SipProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export declare const useSipProvider: () => SipContextType;
|
|
File without changes
|