react-sip-kit 0.5.21 → 0.7.0-beta
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 -21
- package/README.md +254 -212
- package/dist/components/audio/index.d.ts +2 -2
- package/dist/components/video/index.d.ts +2 -2
- package/dist/configs/index.d.ts +1 -3
- package/dist/configs/types.d.ts +1 -19
- package/dist/constructors/line.d.ts +6 -3
- package/dist/events/registration/index.d.ts +4 -4
- package/dist/events/session/index.d.ts +3 -3
- package/dist/events/transport/index.d.ts +5 -5
- package/dist/hooks/useSipManager/index.d.ts +3 -3
- package/dist/hooks/useWatchConfigs/index.d.ts +1 -0
- package/dist/hooks/useWatchSessionData/index.d.ts +69 -5
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +1 -1
- package/dist/initializer.d.ts +2 -1
- package/dist/manager.d.ts +70 -68
- package/dist/methods/registration/index.d.ts +4 -4
- package/dist/methods/session/index.d.ts +15 -17
- package/dist/methods/session/spdOptions/index.d.ts +3 -3
- package/dist/store/index.d.ts +3 -3
- package/dist/store/types.d.ts +42 -24
- package/dist/types.d.ts +58 -1
- package/dist/utils/generateUUID.d.ts +1 -0
- package/dist/utils/getMediaDevices/index.d.ts +2 -2
- package/dist/utils/index.d.ts +1 -0
- package/package.json +99 -99
package/LICENSE
CHANGED
|
@@ -1,21 +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.
|
|
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
CHANGED
|
@@ -1,212 +1,254 @@
|
|
|
1
|
-
# react-sip-kit
|
|
2
|
-
|
|
3
|
-
A modern **React SIP.js toolkit** for building web
|
|
4
|
-
Supports **audio/video calls**, **recording**, **screen sharing**, and **device management
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## ✨ Features
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
## 🚀
|
|
32
|
-
|
|
33
|
-
### 1
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
import
|
|
40
|
-
import {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
useEffect(() => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
<VideoStream type="
|
|
145
|
-
<
|
|
146
|
-
<AudioStream type="
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
1
|
+
# react-sip-kit
|
|
2
|
+
|
|
3
|
+
A modern **React SIP.js toolkit** for building web softphones and SIP clients.
|
|
4
|
+
Supports **audio/video calls**, **call recording**, **screen sharing**, and **device management**, all with a clean, extensible, TypeScript-first architecture.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## ✨ Features
|
|
9
|
+
|
|
10
|
+
- 📞 **Audio & Video Calls** — with device auto-detection
|
|
11
|
+
- 🎥 **Video Support** — render local & remote streams easily
|
|
12
|
+
- 🔴 **Call Recording** — audio/video capture
|
|
13
|
+
- 🖥️ **Screen Sharing** — during video calls
|
|
14
|
+
- 🎧 **Device Management** — choose input/output devices
|
|
15
|
+
- 🔄 **Multi-Account & Multi-Line Support** — concurrent calls
|
|
16
|
+
- ⚡ **TypeScript-first API** — safe and clean
|
|
17
|
+
- 🛠️ **Configurable & Extensible**
|
|
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
|
+
## 🚀 Quick Start
|
|
32
|
+
|
|
33
|
+
### 1️⃣ Create a SipManager Instance
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
// main.tsx
|
|
37
|
+
import App from './App';
|
|
38
|
+
import { SipManager } from 'react-sip-kit';
|
|
39
|
+
import { StrictMode, useEffect } from 'react';
|
|
40
|
+
import { createRoot } from 'react-dom/client';
|
|
41
|
+
|
|
42
|
+
export const SipConnection = new SipManager();
|
|
43
|
+
|
|
44
|
+
const Providers = () => {
|
|
45
|
+
const configs = [
|
|
46
|
+
{
|
|
47
|
+
key: 'support-01', // Optional → If omitted, defaults to account.username
|
|
48
|
+
account: {
|
|
49
|
+
domain: 'sip.example.com',
|
|
50
|
+
username: '1010',
|
|
51
|
+
password: 'password',
|
|
52
|
+
wssServer: 'sip.example.com',
|
|
53
|
+
webSocketPort: '8089',
|
|
54
|
+
serverPath: '/ws',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
configs.forEach((config) => SipConnection.add(config));
|
|
61
|
+
}, []);
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<StrictMode>
|
|
65
|
+
<App />
|
|
66
|
+
</StrictMode>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
createRoot(document.getElementById('root')!).render(<Providers />);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 🔑 Resolving Accounts & Sessions
|
|
76
|
+
|
|
77
|
+
All lookups use one of the following keys:
|
|
78
|
+
|
|
79
|
+
| Key | Purpose | Example |
|
|
80
|
+
| -------------- | ------------------------------------------------------------- | --------------------------------------------------- |
|
|
81
|
+
| `configKey` | Refers to a specific SIP account instance | `{ configKey: 'support-01' }` |
|
|
82
|
+
| `lineKey` | Refers to an **active call** / line | `{ lineKey: 1 }` |
|
|
83
|
+
| `remoteNumber` | Refers to peer phone number — must be paired with `configKey` | `{ configKey: 'support-01', remoteNumber: '1001' }` |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
### 2️⃣ Access Methods (Dial, Hold, Mute, etc.)
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
// Using configKey
|
|
91
|
+
const { dialByNumber } = SipConnection.getSessionMethodsBy({ configKey: 'support-01' });
|
|
92
|
+
dialByNumber('audio', '1002');
|
|
93
|
+
|
|
94
|
+
// Using lineKey (after a call is active)
|
|
95
|
+
SipConnection.getSessionMethodsBy({ lineKey: 1 }).hold();
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### 3️⃣ Read Account State (Reactive)
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
const { watch, status } = SipConnection.getAccountBy({ configKey: 'support-01' });
|
|
104
|
+
const account = watch(); // contains lines, registration, media devices, etc.
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
### 4️⃣ Track Session State (`useWatchSessionData`)
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
import { useWatchSessionData } from 'react-sip-kit';
|
|
113
|
+
|
|
114
|
+
const isRecording = useWatchSessionData({
|
|
115
|
+
key: { lineKey: 1 },
|
|
116
|
+
name: 'recordMedia.recording',
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const [mediaStatus, isMuted] = useWatchSessionData({
|
|
120
|
+
key: { configKey: 'support-01', remoteNumber: '1002' },
|
|
121
|
+
name: ['localMediaStreamStatus', 'localMediaStreamStatus.muted'],
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### 5️⃣ Resolver Helper Methods
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
SipConnection.getLineBy({ lineKey: 1 });
|
|
131
|
+
SipConnection.getLineBy({ configKey: 'support-01', remoteNumber: '1002' });
|
|
132
|
+
|
|
133
|
+
SipConnection.getSessionBy({ lineKey: 1 });
|
|
134
|
+
SipConnection.getUsernameBy({ configKey: 'support-01', remoteNumber: '1002' });
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
### 6️⃣ Render Media Streams
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
import { VideoStream, AudioStream } from 'react-sip-kit';
|
|
143
|
+
|
|
144
|
+
<VideoStream type="local" lineKey={1} />
|
|
145
|
+
<VideoStream type="remote" lineKey={1} />
|
|
146
|
+
<AudioStream type="local" lineKey={1} />
|
|
147
|
+
<AudioStream type="remote" lineKey={1} />
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
### 🧠 Managing Config Keys & Dynamic Rendering
|
|
153
|
+
|
|
154
|
+
```tsx
|
|
155
|
+
const configs = SipConnection.useWatchConfigs();
|
|
156
|
+
// → [{ key: 'support-01', account: {...} }, { key: 'sales-02', ... }]
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
✅ **When to use `useWatchConfigs()`**
|
|
160
|
+
|
|
161
|
+
| Scenario | Should you use it? | Reason |
|
|
162
|
+
| ------------------------------------------------------ | ----------------------- | ------------------------------------------------------------------------------- |
|
|
163
|
+
| Static single account | ❌ Not required | `configKey` is constant |
|
|
164
|
+
| You manually track configs in your own state | ❌ Optional | You already control the list |
|
|
165
|
+
| **Rendering UI for *each* config account dynamically** | ✅ **Yes — recommended** | Ensures you always use the correct `configKey`, even if keys are auto-generated |
|
|
166
|
+
| **Configs can be added or removed at runtime** | ✅ **Always** | Prevents mismatched lookups or stale references |
|
|
167
|
+
|
|
168
|
+
> **✔ Best Practice:**
|
|
169
|
+
> Always call `useWatchConfigs()` when rendering **lists of lines or accounts**, to ensure that each component receives the correct and *current* `configKey`.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
Example (Rendering a phone UI for *every* config dynamically):
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
const AccountsUI = () => {
|
|
177
|
+
const configs = SipConnection.useWatchConfigs();
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<>
|
|
181
|
+
{configs.map((config) => (
|
|
182
|
+
<Lines key={config.key} configKey={config.key} />
|
|
183
|
+
))}
|
|
184
|
+
</>
|
|
185
|
+
);
|
|
186
|
+
};
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## ⚙️ Configuration Schema
|
|
192
|
+
|
|
193
|
+
```ts
|
|
194
|
+
{
|
|
195
|
+
key?: string; // optional → falls back to account.username
|
|
196
|
+
account: {
|
|
197
|
+
domain: 'your.sip.domain',
|
|
198
|
+
username: 'user',
|
|
199
|
+
password: 'secret',
|
|
200
|
+
wssServer: 'your.sip.domain',
|
|
201
|
+
webSocketPort: '8089',
|
|
202
|
+
serverPath: '/ws',
|
|
203
|
+
},
|
|
204
|
+
features?: { enableVideo?: boolean },
|
|
205
|
+
media?: {
|
|
206
|
+
audioInputDeviceId?: string;
|
|
207
|
+
audioOutputDeviceId?: string;
|
|
208
|
+
videoInputDeviceId?: string;
|
|
209
|
+
},
|
|
210
|
+
registration?: { registerExpires?: number },
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## ✅ Best Practices
|
|
217
|
+
|
|
218
|
+
| Task | Recommended Approach |
|
|
219
|
+
| ---------------------- | --------------------------------- |
|
|
220
|
+
| Reference active call | Use `lineKey` when available |
|
|
221
|
+
| Reference account | Use `configKey` |
|
|
222
|
+
| Lookup by phone number | Use `{ configKey, remoteNumber }` |
|
|
223
|
+
| Track config keys | Use `useWatchConfigs()` |
|
|
224
|
+
| Watch configs state | `useWatchConfigs()` |
|
|
225
|
+
| Watch account state | `getAccountBy().watch()` |
|
|
226
|
+
| Watch session props | `useWatchSessionData()` |
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## 📂 Examples
|
|
231
|
+
|
|
232
|
+
Check [`/example`](https://github.com/shervin-ghajar/react-sip-kit/tree/main/example) for:
|
|
233
|
+
|
|
234
|
+
* Multi-account softphone
|
|
235
|
+
* Audio/video calls
|
|
236
|
+
* Hold / mute / attended transfer
|
|
237
|
+
* Call recording & screen sharing
|
|
238
|
+
* Stream rendering
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## 📄 License
|
|
243
|
+
|
|
244
|
+
MIT
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## 👤 Author
|
|
249
|
+
|
|
250
|
+
**Shervin Ghajar**
|
|
251
|
+
|
|
252
|
+
* GitHub: [https://github.com/shervin-ghajar](https://github.com/shervin-ghajar)
|
|
253
|
+
* NPM: [https://www.npmjs.com/package/react-sip-kit](https://www.npmjs.com/package/react-sip-kit)
|
|
254
|
+
* Repository: [https://github.com/shervin-ghajar/react-sip-kit](https://github.com/shervin-ghajar/react-sip-kit)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AudioHTMLAttributes, HTMLAttributes } from 'react';
|
|
2
2
|
interface DefaultAudioProps {
|
|
3
|
-
|
|
3
|
+
lineKey: string | number;
|
|
4
4
|
}
|
|
5
5
|
interface LocalAudioProps extends AudioHTMLAttributes<HTMLAudioElement>, DefaultAudioProps {
|
|
6
6
|
type: 'local';
|
|
@@ -11,5 +11,5 @@ interface RemoteAudioProps extends HTMLAttributes<HTMLDivElement>, DefaultAudioP
|
|
|
11
11
|
id?: `line-${number}-remoteAudios`;
|
|
12
12
|
}
|
|
13
13
|
type AudioProps = LocalAudioProps | RemoteAudioProps;
|
|
14
|
-
export declare const Audio: ({
|
|
14
|
+
export declare const Audio: ({ lineKey, ...rest }: AudioProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLAttributes, VideoHTMLAttributes } from 'react';
|
|
2
2
|
interface DefaultVideoProps {
|
|
3
|
-
|
|
3
|
+
lineKey: string | number;
|
|
4
4
|
}
|
|
5
5
|
interface LocalVideoProps extends VideoHTMLAttributes<HTMLVideoElement>, DefaultVideoProps {
|
|
6
6
|
type: 'local';
|
|
@@ -11,5 +11,5 @@ interface RemoteVidepProps extends HTMLAttributes<HTMLDivElement>, DefaultVideoP
|
|
|
11
11
|
id?: `line-${number}-${RemoteVidepProps['type']}Video` | `line-${number}-remoteVideos`;
|
|
12
12
|
}
|
|
13
13
|
type VideoProps = LocalVideoProps | RemoteVidepProps;
|
|
14
|
-
export declare const Video: ({
|
|
14
|
+
export declare const Video: ({ lineKey, ...rest }: VideoProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
export {};
|
package/dist/configs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SipAccountConfig, SipAdvancedConfig, SipConfigs, SipFeaturesConfig, SipMediaConfig,
|
|
1
|
+
import { SipAccountConfig, SipAdvancedConfig, SipConfigs, SipFeaturesConfig, SipMediaConfig, SipPolicyConfig, SipRecordingConfig, SipRegistrationConfig, SipStorageConfig } from './types';
|
|
2
2
|
export declare const defaultAccountConfig: SipAccountConfig;
|
|
3
3
|
export declare const defaultFeaturesConfig: SipFeaturesConfig;
|
|
4
4
|
export declare const defaultMediaConfig: SipMediaConfig;
|
|
@@ -7,6 +7,4 @@ export declare const defaultRegistrationConfig: SipRegistrationConfig;
|
|
|
7
7
|
export declare const defaultStorageConfig: SipStorageConfig;
|
|
8
8
|
export declare const defaultRecordingConfig: SipRecordingConfig;
|
|
9
9
|
export declare const defaultAdvancedConfig: SipAdvancedConfig;
|
|
10
|
-
export declare const defaultXmppConfig: SipXmppConfig;
|
|
11
|
-
export declare const defaultPermissionsConfig: SipPermissionsConfig;
|
|
12
10
|
export declare const defaultSipConfigs: SipConfigs;
|
package/dist/configs/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export interface SipConfigs {
|
|
2
|
+
key: string;
|
|
2
3
|
account: SipAccountConfig;
|
|
3
4
|
features: SipFeaturesConfig;
|
|
4
5
|
media: SipMediaConfig;
|
|
@@ -7,17 +8,6 @@ export interface SipConfigs {
|
|
|
7
8
|
storage: SipStorageConfig;
|
|
8
9
|
recording: SipRecordingConfig;
|
|
9
10
|
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
11
|
}
|
|
22
12
|
export interface SipXmppConfig {
|
|
23
13
|
server: string;
|
|
@@ -90,16 +80,8 @@ export interface SipMediaConfig {
|
|
|
90
80
|
}
|
|
91
81
|
export interface SipFeaturesConfig {
|
|
92
82
|
enableVideo: boolean;
|
|
93
|
-
enableRingtone: boolean;
|
|
94
|
-
enableTextMessaging: boolean;
|
|
95
83
|
enableTransfer: boolean;
|
|
96
84
|
enableConference: boolean;
|
|
97
|
-
enableTextExpressions: boolean;
|
|
98
|
-
enableTextDictate: boolean;
|
|
99
|
-
enableAlphanumericDial: boolean;
|
|
100
|
-
enableAccountSettings: boolean;
|
|
101
|
-
enableAppearanceSettings: boolean;
|
|
102
|
-
enableNotificationSettings: boolean;
|
|
103
85
|
}
|
|
104
86
|
export interface SipAccountConfig {
|
|
105
87
|
username: string;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { SipAccountConfig, SipConfigs } from '../configs/types';
|
|
1
2
|
import { LineType, SipInvitationType } from '../store/types';
|
|
2
3
|
export declare class Line implements LineType {
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
configKey: SipConfigs['key'];
|
|
5
|
+
lineKey: LineType['lineKey'];
|
|
6
|
+
remoteNumber: string;
|
|
7
|
+
username: string;
|
|
5
8
|
sipSession: SipInvitationType | null;
|
|
6
9
|
localSoundMeter: any;
|
|
7
10
|
remoteSoundMeter: any;
|
|
8
|
-
constructor(
|
|
11
|
+
constructor(configKey: SipConfigs['key'], username: SipAccountConfig['username'], lineKey: LineType['lineKey'], remoteNumber: string);
|
|
9
12
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SipConfigs } from '../../configs/types';
|
|
2
2
|
import { SipUserAgent } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Called when account is registered
|
|
5
5
|
*/
|
|
6
|
-
export declare function onRegistered(
|
|
6
|
+
export declare function onRegistered(configKey: SipConfigs['key'], userAgent: SipUserAgent): void;
|
|
7
7
|
/**
|
|
8
8
|
* Called if UserAgent can connect, but not register.
|
|
9
9
|
* @param {string} response Incoming request message
|
|
10
10
|
* @param {string} cause Cause message. Unused
|
|
11
11
|
**/
|
|
12
|
-
export declare function onRegisterFailed(
|
|
12
|
+
export declare function onRegisterFailed(configKey: SipConfigs['key'], response: any, cause: any): void;
|
|
13
13
|
/**
|
|
14
14
|
* Called when Unregister is requested
|
|
15
15
|
*/
|
|
16
|
-
export declare function onUnregistered(
|
|
16
|
+
export declare function onUnregistered(configKey: SipConfigs['key'], userAgent: SipUserAgent): void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SipConfigs } from '../../configs/types';
|
|
2
2
|
import { LineType, SipSessionDescriptionHandler, SipSessionType } from '../../store/types';
|
|
3
3
|
import { CallbackFunction } from '../../types';
|
|
4
4
|
import { Bye, Message } from 'sip.js';
|
|
5
5
|
import { IncomingRequestMessage, IncomingResponse } from 'sip.js/lib/core';
|
|
6
|
-
export declare const sessionEvents: ({
|
|
7
|
-
|
|
6
|
+
export declare const sessionEvents: ({ configKey }: {
|
|
7
|
+
configKey: SipConfigs["key"];
|
|
8
8
|
}) => {
|
|
9
9
|
onInviteCancel: (lineObj: LineType, response: IncomingRequestMessage, callback?: CallbackFunction<any>) => void;
|
|
10
10
|
onInviteAccepted: (lineObj: LineType, videoEnabled: boolean, response?: IncomingResponse) => Promise<void>;
|