react-sip-kit 0.2.0
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/LICENSE +21 -0
- package/README.md +107 -0
- package/dist/components/audio/index.d.ts +7 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/video/index.d.ts +13 -0
- package/dist/configs/index.d.ts +12 -0
- package/dist/configs/types.d.ts +111 -0
- package/dist/constructors/audioBlobs.d.ts +13 -0
- package/dist/constructors/buddy.d.ts +26 -0
- package/dist/constructors/index.d.ts +3 -0
- package/dist/constructors/line.d.ts +12 -0
- package/dist/events/registration/index.d.ts +15 -0
- package/dist/events/transport/index.d.ts +5 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/useDetectDevices/index.d.ts +1 -0
- package/dist/hooks/useSessionEvents/index.d.ts +18 -0
- package/dist/hooks/useSessionEvents/types.d.ts +13 -0
- package/dist/hooks/useSessionMethods/index.d.ts +21 -0
- package/dist/hooks/useSessionMethods/types.d.ts +31 -0
- package/dist/hooks/useSpdOptions/index.d.ts +27 -0
- package/dist/index.cjs +19616 -0
- package/dist/index.d.ts +378 -0
- package/dist/index.mjs +19611 -0
- package/dist/methods/initialization/index.d.ts +3 -0
- package/dist/methods/registration/index.d.ts +3 -0
- package/dist/methods/session/index.d.ts +2 -0
- package/dist/provider.d.ts +5 -0
- package/dist/store/index.d.ts +28 -0
- package/dist/store/types.d.ts +149 -0
- package/dist/types.d.ts +49 -0
- package/dist/utils/dayjs.d.ts +3 -0
- package/dist/utils/deepMerge.d.ts +1 -0
- package/dist/utils/formatDuration.d.ts +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/utcDateNow.d.ts +1 -0
- package/package.json +98 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Shervin Ghajar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# react-sip-kit
|
|
2
|
+
|
|
3
|
+
A modern, modular, and type-safe SIP (Session Initiation Protocol) provider for React applications.
|
|
4
|
+
Built for real-time web telephony, this library offers a clean, scalable, and fully configurable SIP core, decoupled from UI and legacy global state.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- π **SIP Core**: Register, make, receive, and manage SIP calls (audio & video)
|
|
11
|
+
- π **Transfer & Conference**: Supports call transfer and conferencing
|
|
12
|
+
- π₯ **Video Call Support**: Video call features with device selection
|
|
13
|
+
- π **Ringtone & Notifications**: Customizable audio output for ringtones and notifications
|
|
14
|
+
- π₯ **Buddy/Contact Management**: Manage contacts (buddies) and pass contact data across sessions
|
|
15
|
+
- βοΈ **Fully Configurable**: All settings (account, features, media, UI, etc.) are passed as propsβno global state or localStorage dependencies
|
|
16
|
+
- π§© **Type-Safe & Modular**: Strong TypeScript types, modular config, and easy to extend
|
|
17
|
+
- π§ͺ **Testable**: Stateless SIP core, easy to mock and test
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install react-sip-kit
|
|
25
|
+
# or
|
|
26
|
+
yarn add react-sip-kit
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { SipProvider } from 'react-sip-kit';
|
|
35
|
+
import { defaultSipConfigs } from 'react-sip-kit/configs';
|
|
36
|
+
|
|
37
|
+
<SipProvider
|
|
38
|
+
configs={{
|
|
39
|
+
...defaultSipConfigs,
|
|
40
|
+
account: {
|
|
41
|
+
username: 'user',
|
|
42
|
+
password: 'password',
|
|
43
|
+
domain: 'sip.example.com',
|
|
44
|
+
wssServer: 'wss.example.com',
|
|
45
|
+
webSocketPort: 7443,
|
|
46
|
+
serverPath: '/ws',
|
|
47
|
+
},
|
|
48
|
+
features: {
|
|
49
|
+
enableVideo: true,
|
|
50
|
+
enableRingtone: true,
|
|
51
|
+
},
|
|
52
|
+
// Add or override other config sections as needed
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
{/* Your app components */}
|
|
56
|
+
</SipProvider>;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Configuration
|
|
62
|
+
|
|
63
|
+
All configuration is passed via the `configs` prop.
|
|
64
|
+
See [`src/configs/types.ts`](src/configs/types.ts) for the full config structure.
|
|
65
|
+
|
|
66
|
+
**Example config:**
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
{
|
|
70
|
+
account: { ... },
|
|
71
|
+
features: { ... },
|
|
72
|
+
media: { ... },
|
|
73
|
+
// ...other sections
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
You can import and extend the default config:
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
import { defaultSipConfigs } from 'react-sip-kit/configs';
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## API
|
|
86
|
+
|
|
87
|
+
- **`<SipProvider configs={...}>`**
|
|
88
|
+
Provides SIP context and manages SIP sessions for your app.
|
|
89
|
+
|
|
90
|
+
- **Context hooks**
|
|
91
|
+
Use React context or custom hooks to access SIP state, session methods, and events.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
MIT
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Author
|
|
102
|
+
|
|
103
|
+
**Shervin Ghajar**
|
|
104
|
+
[GitHub](https://github.com/shervin-ghajar)
|
|
105
|
+
Email: ssghajar.work@gmail.com
|
|
106
|
+
|
|
107
|
+
---
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AudioHTMLAttributes } from 'react';
|
|
2
|
+
interface AudioProps extends AudioHTMLAttributes<HTMLAudioElement> {
|
|
3
|
+
lineNumber: string | number;
|
|
4
|
+
type?: 'transfer' | 'conference';
|
|
5
|
+
}
|
|
6
|
+
export declare const Audio: ({ lineNumber, type, ...rest }: AudioProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HTMLAttributes, VideoHTMLAttributes } from 'react';
|
|
2
|
+
interface DefaultVideoProps {
|
|
3
|
+
lineNumber: string | number;
|
|
4
|
+
}
|
|
5
|
+
interface LocalVideoProps extends VideoHTMLAttributes<HTMLVideoElement>, DefaultVideoProps {
|
|
6
|
+
type: 'local';
|
|
7
|
+
}
|
|
8
|
+
interface RemoteVidepProps extends HTMLAttributes<HTMLDivElement>, DefaultVideoProps {
|
|
9
|
+
type: 'remote';
|
|
10
|
+
}
|
|
11
|
+
type VideoProps = LocalVideoProps | RemoteVidepProps;
|
|
12
|
+
export declare const Video: ({ lineNumber, ...rest }: VideoProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SipAccountConfig, SipAdvancedConfig, SipConfigs, SipFeaturesConfig, SipMediaConfig, SipPermissionsConfig, SipPolicyConfig, SipRecordingConfig, SipRegistrationConfig, SipStorageConfig, SipXmppConfig } from './types';
|
|
2
|
+
export declare const defaultAccountConfig: SipAccountConfig;
|
|
3
|
+
export declare const defaultFeaturesConfig: SipFeaturesConfig;
|
|
4
|
+
export declare const defaultMediaConfig: SipMediaConfig;
|
|
5
|
+
export declare const defaultPolicyConfig: SipPolicyConfig;
|
|
6
|
+
export declare const defaultRegistrationConfig: SipRegistrationConfig;
|
|
7
|
+
export declare const defaultStorageConfig: SipStorageConfig;
|
|
8
|
+
export declare const defaultRecordingConfig: SipRecordingConfig;
|
|
9
|
+
export declare const defaultAdvancedConfig: SipAdvancedConfig;
|
|
10
|
+
export declare const defaultXmppConfig: SipXmppConfig;
|
|
11
|
+
export declare const defaultPermissionsConfig: SipPermissionsConfig;
|
|
12
|
+
export declare const defaultSipConfigs: SipConfigs;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export interface SipConfigs {
|
|
2
|
+
account: SipAccountConfig;
|
|
3
|
+
features: SipFeaturesConfig;
|
|
4
|
+
media: SipMediaConfig;
|
|
5
|
+
policy: SipPolicyConfig;
|
|
6
|
+
registration: SipRegistrationConfig;
|
|
7
|
+
storage: SipStorageConfig;
|
|
8
|
+
recording: SipRecordingConfig;
|
|
9
|
+
advanced: SipAdvancedConfig;
|
|
10
|
+
xmpp: SipXmppConfig;
|
|
11
|
+
permissions: SipPermissionsConfig;
|
|
12
|
+
}
|
|
13
|
+
export interface SipPermissionsConfig {
|
|
14
|
+
enableSendFiles: boolean;
|
|
15
|
+
enableSendImages: boolean;
|
|
16
|
+
enableAudioRecording: boolean;
|
|
17
|
+
enableVideoRecording: boolean;
|
|
18
|
+
enableSms: boolean;
|
|
19
|
+
enableFax: boolean;
|
|
20
|
+
enableEmail: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface SipXmppConfig {
|
|
23
|
+
server: string;
|
|
24
|
+
websocketPort: string;
|
|
25
|
+
websocketPath: string;
|
|
26
|
+
domain: string;
|
|
27
|
+
profileUser: string;
|
|
28
|
+
realm: string;
|
|
29
|
+
realmSeparator: string;
|
|
30
|
+
chatGroupService: string;
|
|
31
|
+
}
|
|
32
|
+
export interface SipAdvancedConfig {
|
|
33
|
+
didLength: number;
|
|
34
|
+
maxDidLength: number;
|
|
35
|
+
singleInstance: boolean;
|
|
36
|
+
chatEngine: string;
|
|
37
|
+
}
|
|
38
|
+
export interface SipRecordingConfig {
|
|
39
|
+
videoResampleSize: string;
|
|
40
|
+
recordingVideoSize: string;
|
|
41
|
+
recordingVideoFps: number;
|
|
42
|
+
recordingLayout: string;
|
|
43
|
+
}
|
|
44
|
+
export interface SipStorageConfig {
|
|
45
|
+
streamBuffer: number;
|
|
46
|
+
maxDataStoreDays: number;
|
|
47
|
+
posterJpegQuality: number;
|
|
48
|
+
}
|
|
49
|
+
export interface SipRegistrationConfig {
|
|
50
|
+
transportConnectionTimeout: number;
|
|
51
|
+
transportReconnectionAttempts: number;
|
|
52
|
+
transportReconnectionTimeout: number;
|
|
53
|
+
registerExpires: number;
|
|
54
|
+
registerExtraHeaders: string;
|
|
55
|
+
registerExtraContactParams: string;
|
|
56
|
+
registerContactParams: string;
|
|
57
|
+
wssInTransport: boolean;
|
|
58
|
+
ipInContact: boolean;
|
|
59
|
+
bundlePolicy: string;
|
|
60
|
+
iceStunServerJson: string;
|
|
61
|
+
iceStunCheckTimeout: number;
|
|
62
|
+
subscribeToYourself: boolean;
|
|
63
|
+
voiceMailSubscribe: boolean;
|
|
64
|
+
voicemailDid: string;
|
|
65
|
+
subscribeVoicemailExpires: number;
|
|
66
|
+
inviteExtraHeaders: string;
|
|
67
|
+
noAnswerTimeout: number;
|
|
68
|
+
}
|
|
69
|
+
export interface SipPolicyConfig {
|
|
70
|
+
autoAnswerPolicy: string;
|
|
71
|
+
doNotDisturbPolicy: string;
|
|
72
|
+
callWaitingPolicy: string;
|
|
73
|
+
callRecordingPolicy: string;
|
|
74
|
+
intercomPolicy: string;
|
|
75
|
+
}
|
|
76
|
+
export interface SipMediaConfig {
|
|
77
|
+
audioInputDeviceId: string;
|
|
78
|
+
audioOutputDeviceId: string;
|
|
79
|
+
videoInputDeviceId: string;
|
|
80
|
+
ringerOutputDeviceId: string;
|
|
81
|
+
maxFrameRate: number | string;
|
|
82
|
+
videoHeight: number | string;
|
|
83
|
+
videoAspectRatio: number | string;
|
|
84
|
+
autoGainControl: boolean;
|
|
85
|
+
echoCancellation: boolean;
|
|
86
|
+
noiseSuppression: boolean;
|
|
87
|
+
mirrorVideo: string;
|
|
88
|
+
maxVideoBandwidth: number;
|
|
89
|
+
startVideoFullScreen: boolean;
|
|
90
|
+
}
|
|
91
|
+
export interface SipFeaturesConfig {
|
|
92
|
+
enableVideo: boolean;
|
|
93
|
+
enableRingtone: boolean;
|
|
94
|
+
enableTextMessaging: boolean;
|
|
95
|
+
enableTransfer: boolean;
|
|
96
|
+
enableConference: boolean;
|
|
97
|
+
enableTextExpressions: boolean;
|
|
98
|
+
enableTextDictate: boolean;
|
|
99
|
+
enableAlphanumericDial: boolean;
|
|
100
|
+
enableAccountSettings: boolean;
|
|
101
|
+
enableAppearanceSettings: boolean;
|
|
102
|
+
enableNotificationSettings: boolean;
|
|
103
|
+
}
|
|
104
|
+
export interface SipAccountConfig {
|
|
105
|
+
username: string;
|
|
106
|
+
password: string;
|
|
107
|
+
domain: string;
|
|
108
|
+
wssServer: string;
|
|
109
|
+
webSocketPort: string | number;
|
|
110
|
+
serverPath: string;
|
|
111
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type AudioBlobsType = Record<'Alert' | 'Ringtone' | 'speech_orig' | 'Busy_UK' | 'Busy_US' | 'CallWaiting' | 'Congestion_UK' | 'Congestion_US' | 'EarlyMedia_Australia' | 'EarlyMedia_European' | 'EarlyMedia_Japan' | 'EarlyMedia_UK' | 'EarlyMedia_US', {
|
|
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 {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BuddyType } from '../store/types';
|
|
2
|
+
export declare class Buddy implements BuddyType {
|
|
3
|
+
type: 'extension' | 'xmpp' | 'contact' | 'group';
|
|
4
|
+
identity: string;
|
|
5
|
+
CallerIDName: string;
|
|
6
|
+
ExtNo: string;
|
|
7
|
+
MobileNumber?: string;
|
|
8
|
+
ContactNumber1?: string;
|
|
9
|
+
ContactNumber2?: string;
|
|
10
|
+
lastActivity: string;
|
|
11
|
+
Desc: string;
|
|
12
|
+
Email: string;
|
|
13
|
+
jid?: string;
|
|
14
|
+
devState: string;
|
|
15
|
+
presence: string;
|
|
16
|
+
missed: number;
|
|
17
|
+
IsSelected: boolean;
|
|
18
|
+
imageObjectURL: string;
|
|
19
|
+
presenceText: string;
|
|
20
|
+
EnableDuringDnd: boolean;
|
|
21
|
+
EnableSubscribe: boolean;
|
|
22
|
+
SubscribeUser: string;
|
|
23
|
+
AllowAutoDelete: boolean;
|
|
24
|
+
Pinned: boolean;
|
|
25
|
+
constructor(type: 'extension' | 'xmpp' | 'contact' | 'group', identity: string, CallerIDName: string | undefined, ExtNo: string, MobileNumber?: string, ContactNumber1?: string, ContactNumber2?: string, lastActivity?: string, Desc?: string, Email?: string, jid?: string, EnableDuringDnd?: boolean, EnableSubscribe?: boolean, subscription?: string | null, AllowAutoDelete?: boolean, Pinned?: boolean);
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BuddyType, LineType, SipInvitationType } from '../store/types';
|
|
2
|
+
export declare class Line implements LineType {
|
|
3
|
+
lineNumber: number;
|
|
4
|
+
DisplayName: string;
|
|
5
|
+
DisplayNumber: string;
|
|
6
|
+
BuddyObj: BuddyType | null;
|
|
7
|
+
sipSession: SipInvitationType | null;
|
|
8
|
+
LocalSoundMeter: any;
|
|
9
|
+
RemoteSoundMeter: any;
|
|
10
|
+
IsSelected: boolean;
|
|
11
|
+
constructor(lineNumber: number, displayName: string, displayNumber: string, buddyObj?: BuddyType | null, sipSession?: SipInvitationType | null);
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SipUserAgent } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Called when account is registered
|
|
4
|
+
*/
|
|
5
|
+
export declare function onRegistered(userAgent: SipUserAgent): void;
|
|
6
|
+
/**
|
|
7
|
+
* Called if UserAgent can connect, but not register.
|
|
8
|
+
* @param {string} response Incoming request message
|
|
9
|
+
* @param {string} cause Cause message. Unused
|
|
10
|
+
**/
|
|
11
|
+
export declare function onRegisterFailed(response: any, cause: any): void;
|
|
12
|
+
/**
|
|
13
|
+
* Called when Unregister is requested
|
|
14
|
+
*/
|
|
15
|
+
export declare function onUnregistered(userAgent: SipUserAgent): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SipUserAgent } from '../../types';
|
|
2
|
+
export declare function onTransportConnected(userAgent?: SipUserAgent): void;
|
|
3
|
+
export declare function onTransportConnectError(error: any, userAgent?: SipUserAgent): void;
|
|
4
|
+
export declare function onTransportDisconnected(userAgent: SipUserAgent): void;
|
|
5
|
+
export declare function reconnectTransport(userAgent?: SipUserAgent): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useDetectDevices: () => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { LineType, SipSessionDescriptionHandler, SipSessionType } from '../../store/types';
|
|
2
|
+
import { CallbackFunction } from '../../types';
|
|
3
|
+
import { Bye, Message } from 'sip.js';
|
|
4
|
+
import { IncomingRequestMessage, IncomingResponse } from 'sip.js/lib/core';
|
|
5
|
+
export declare const useSessionEvents: () => {
|
|
6
|
+
onInviteCancel: (lineObj: LineType, response: IncomingRequestMessage, callback?: CallbackFunction<any>) => void;
|
|
7
|
+
onInviteAccepted: (lineObj: LineType, includeVideo: boolean, response?: IncomingResponse) => void;
|
|
8
|
+
onInviteTrying: (lineObj: LineType, response: IncomingResponse) => void;
|
|
9
|
+
onInviteProgress: (lineObj: LineType, response: IncomingResponse) => void;
|
|
10
|
+
onInviteRejected: (lineObj: LineType, response: IncomingResponse, callback?: CallbackFunction<any>) => void;
|
|
11
|
+
onInviteRedirected: (lineObj: LineType, response: IncomingResponse) => void;
|
|
12
|
+
onSessionReceivedBye: (lineObj: LineType, response: Bye, callback?: CallbackFunction<any>) => void;
|
|
13
|
+
onSessionReinvited: (lineObj: LineType, response: IncomingRequestMessage) => void;
|
|
14
|
+
onSessionReceivedMessage: (lineObj: LineType, response: Message) => void;
|
|
15
|
+
onSessionDescriptionHandlerCreated: (lineObj: LineType, sdh: SipSessionDescriptionHandler, provisional: boolean, includeVideo?: boolean) => void;
|
|
16
|
+
onTrackAddedEvent: (lineObj: LineType, includeVideo?: boolean) => void;
|
|
17
|
+
onTransferSessionDescriptionHandlerCreated: (lineObj: LineType, session: SipSessionType, sdh: SipSessionDescriptionHandler, includeVideo?: boolean) => void;
|
|
18
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface SipMediaStream extends MediaStream {
|
|
2
|
+
trackId?: string;
|
|
3
|
+
mid?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface MediaStreamTrackType extends MediaStreamTrack {
|
|
6
|
+
mid: RTCRtpTransceiver['mid'];
|
|
7
|
+
IsMixedTrack: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface RTCRtpTransceiverType extends RTCRtpTransceiver {
|
|
10
|
+
track: RTCRtpTransceiver['receiver']['track'] & {
|
|
11
|
+
mid: RTCRtpTransceiver['mid'];
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BuddyType, LineType, SipInvitationType } from '../../store/types';
|
|
2
|
+
export declare const useSessionMethods: () => {
|
|
3
|
+
receiveCall: (session: SipInvitationType) => void;
|
|
4
|
+
answerAudioSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
5
|
+
answerVideoSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
6
|
+
makeAudioSession: (lineObj: LineType, dialledNumber: string, extraHeaders?: Array<string>) => void;
|
|
7
|
+
makeVideoSession: (lineObj: LineType, dialledNumber: string, extraHeaders?: Array<string>) => void;
|
|
8
|
+
rejectCall: (lineNumber: LineType["lineNumber"]) => void;
|
|
9
|
+
dialByLine: (type: "audio" | "video", numToDial: string, buddy?: BuddyType, CallerID?: string, extraHeaders?: Array<string>) => void;
|
|
10
|
+
endSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
11
|
+
holdSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
12
|
+
unholdSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
13
|
+
muteSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
14
|
+
unmuteSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
15
|
+
cancelSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
16
|
+
startTransferSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
17
|
+
cancelTransferSession: (lineNumber: LineType["lineNumber"]) => void;
|
|
18
|
+
attendedTransferSession: (baseLine: LineType, transferLineNumber: LineType["lineNumber"]) => void;
|
|
19
|
+
cancelAttendedTransferSession: (baseLine: LineType, transferLineNumber: LineType["lineNumber"]) => void;
|
|
20
|
+
teardownSession: (lineObj: LineType) => void;
|
|
21
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useSessionMethods } from '.';
|
|
2
|
+
export interface SessionDescriptionHandlerOptions {
|
|
3
|
+
constraints: {
|
|
4
|
+
audio: AudioSessionConstraints | boolean;
|
|
5
|
+
video: VideoSessionConstraints | boolean;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export type AudioSessionConstraints = {
|
|
9
|
+
deviceId: string | {
|
|
10
|
+
exact: string;
|
|
11
|
+
};
|
|
12
|
+
autoGainControl?: boolean;
|
|
13
|
+
echoCancellation?: boolean;
|
|
14
|
+
noiseSuppression?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type VideoSessionConstraints = {
|
|
17
|
+
deviceId: string | {
|
|
18
|
+
exact: string;
|
|
19
|
+
};
|
|
20
|
+
autoGainControl?: boolean;
|
|
21
|
+
echoCancellation?: boolean;
|
|
22
|
+
noiseSuppression?: boolean;
|
|
23
|
+
frameRate?: string | null;
|
|
24
|
+
height?: string | null;
|
|
25
|
+
aspectRatio?: string | null;
|
|
26
|
+
};
|
|
27
|
+
export type SPDOptionsType = Record<'sessionDescriptionHandlerOptions', SessionDescriptionHandlerOptions> & Partial<{
|
|
28
|
+
earlyMedia: boolean;
|
|
29
|
+
extraHeaders: string[];
|
|
30
|
+
}>;
|
|
31
|
+
export type SessionMethods = ReturnType<typeof useSessionMethods>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SPDOptionsType } from '../useSessionMethods/types';
|
|
2
|
+
export declare const useSpdOptions: () => {
|
|
3
|
+
answerAudioSpdOptions: ({ option: defaultOption }?: {
|
|
4
|
+
option?: SPDOptionsType;
|
|
5
|
+
}) => SPDOptionsType | undefined;
|
|
6
|
+
makeAudioSpdOptions: ({ extraHeaders }: {
|
|
7
|
+
extraHeaders?: string[];
|
|
8
|
+
}) => Record<"sessionDescriptionHandlerOptions", import("../useSessionMethods/types").SessionDescriptionHandlerOptions> & Partial<{
|
|
9
|
+
earlyMedia: boolean;
|
|
10
|
+
extraHeaders: string[];
|
|
11
|
+
}> & {
|
|
12
|
+
earlyMedia: boolean;
|
|
13
|
+
extraHeaders?: string[];
|
|
14
|
+
};
|
|
15
|
+
answerVideoSpdOptions: ({ option: defaultOption }?: {
|
|
16
|
+
option?: SPDOptionsType;
|
|
17
|
+
}) => SPDOptionsType | undefined;
|
|
18
|
+
makeVideoSpdOptions: ({ extraHeaders }: {
|
|
19
|
+
extraHeaders?: string[];
|
|
20
|
+
}) => Record<"sessionDescriptionHandlerOptions", import("../useSessionMethods/types").SessionDescriptionHandlerOptions> & Partial<{
|
|
21
|
+
earlyMedia: boolean;
|
|
22
|
+
extraHeaders: string[];
|
|
23
|
+
}> & {
|
|
24
|
+
earlyMedia: boolean;
|
|
25
|
+
extraHeaders?: string[];
|
|
26
|
+
};
|
|
27
|
+
};
|