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 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-based softphones and SIP clients.
4
- Supports **audio/video calls**, **recording**, **screen sharing**, and **device management** all with a clean, extensible architecture.
5
-
6
- ---
7
-
8
- ## ✨ Features
9
-
10
- * 📞 **Audio & Video Calls** — with automatic device detection
11
- * 🎥 **Video Support** — manage local & remote streams seamlessly
12
- * 🔴 **Call Recording** — audio and video recording out of the box
13
- * 🖥️ **Screen Sharing** — during video calls
14
- * 🎧 **Device Management** — select audio/video input & output devices
15
- * 🔄 **Multi-account & Multi-line Support** — handle multiple SIP accounts and concurrent calls
16
- * ⚡ **TypeScript-first** — fast, modular, type-safe APIs
17
- * 🛠️ **Configurable & Extensible** — tailor to your SIP setup
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
- ## 🚀 Basic Usage
32
-
33
- ### 1. Initialize a global `SipManager`
34
-
35
- Instead of wrapping your app with a provider, you now create a single `SipManager` instance and add accounts dynamically.
36
-
37
- ```tsx
38
- // main.ts
39
- import App from './App';
40
- import { SipManager } from 'react-sip-kit';
41
- import { StrictMode, useEffect, useState } from 'react';
42
- import { createRoot } from 'react-dom/client';
43
- ------------------------------------------------------------
44
- export const SipConnection = new SipManager(); // Initilizing SipManager
45
- ------------------------------------------------------------
46
- const Providers = () => {
47
- const configs = [{
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
- // ...(other configs)
57
- }]
58
-
59
- useEffect(() => {
60
- // Add new configs dynamically
61
- configs.forEach((config) => {
62
- SipConnection.add(config);
63
- });
64
- }, [configs]);
65
-
66
- return (
67
- <StrictMode>
68
- {configs.map((config) => (
69
- <App key={config.account.username} username={config.account.username} />
70
- ))}
71
- </StrictMode>
72
- );
73
- };
74
-
75
- createRoot(document.getElementById('root')!).render(<Providers />);
76
- ```
77
-
78
- ---
79
-
80
- ### 2. Access SIP state and methods (per account)
81
-
82
- Each account is keyed by its **username**.
83
- You can fetch **methods** and **watch state** like this:
84
-
85
- ```tsx
86
- // App.tsx
87
- import { SipConnection } from './main';
88
-
89
- function App({ username }: { username: string }) {
90
- const { dialByNumber } = SipConnection.methods(username);
91
- const { watch } = SipConnection.get(username);
92
- const { lines, status } = watch();
93
-
94
- return (
95
- <>
96
- <h2>
97
- Web Phone {username} — {status}
98
- </h2>
99
- <button onClick={() => dialByNumber('audio', '1012')}>Call 1012</button>
100
- <button onClick={() => dialByNumber('video', '1012')}>Video Call 1012</button>
101
- </>
102
- );
103
- }
104
- ```
105
-
106
- ---
107
-
108
- ### 3. Watch line/session data with `useWatchSessionData`
109
-
110
- For fine-grained updates, subscribe to session fields:
111
-
112
- ```tsx
113
- import { useWatchSessionData } from 'react-sip-kit';
114
-
115
- function RecordingStatus({ lineNumber }: { lineNumber: number }) {
116
- const isRecording = useWatchSessionData({
117
- lineNumber,
118
- name: 'recordMedia.recording',
119
- });
120
-
121
- return <p>Recording: {isRecording ? 'Yes' : 'No'}</p>;
122
- }
123
- ```
124
-
125
- You can also watch multiple fields:
126
-
127
- ```tsx
128
- const [localMediaStreamStatus, isRecording] = useWatchSessionData({
129
- lineNumber: 1,
130
- name: ['localMediaStreamStatus', 'recordMedia.recording'],
131
- });
132
- ```
133
-
134
- ---
135
-
136
- ### 4. Render media streams
137
-
138
- Media components (`<Video/>` & `<Audio/>`) are bound per line:
139
-
140
- ```tsx
141
- import { VideoStream, AudioStream } from 'react-sip-kit';
142
-
143
- <VideoStream type="local" lineNumber={1} />
144
- <VideoStream type="remote" lineNumber={1} />
145
- <AudioStream type="local" lineNumber={1} />
146
- <AudioStream type="remote" lineNumber={1} />
147
- ```
148
-
149
- ---
150
-
151
- ## ⚙️ Configuration
152
-
153
- Each account supports SIP and media options:
154
-
155
- ```ts
156
- {
157
- account: {
158
- domain: 'your.sip.domain',
159
- username: 'user',
160
- password: 'secret',
161
- wssServer: 'your.sip.domain',
162
- webSocketPort: '8089',
163
- serverPath: '/ws',
164
- },
165
- features: { enableVideo: true },
166
- media: {
167
- audioInputDeviceId: 'default',
168
- audioOutputDeviceId: 'default',
169
- videoInputDeviceId: 'default',
170
- },
171
- registration: { registerExpires: 3600 },
172
- }
173
- ```
174
-
175
- ---
176
-
177
- ## 💡 Best Practices
178
-
179
- * Always pass the `username` when calling `SipConnection.methods(username)` or `SipConnection.get(username)`.
180
- * Use `.watch()` for reactive state (`lines`, `status`).
181
- * Use `useWatchSessionData` for **line-specific** updates (mute, hold, video state, recording, etc.).
182
- * Render `<VideoStream>` and `<AudioStream>` **only for active calls**.
183
- * Manage device permissions (mic/camera) upfront.
184
- * If adding accounts dynamically, call `SipConnection.add(config)` for each.
185
-
186
- ---
187
-
188
- ## 🧑‍💻 Full Example
189
-
190
- See the [`/example`](https://github.com/shervin-ghajar/react-sip-kit/tree/main/example) folder for:
191
-
192
- * Multiple SIP accounts in one UI
193
- * Audio & video calls
194
- * Hold, mute, attended transfer
195
- * Call recording & screen sharing
196
- * Local & remote media rendering
197
-
198
- ---
199
-
200
- ## 📄 License
201
-
202
- MIT License
203
-
204
- ---
205
-
206
- ## 👤 Author
207
-
208
- **Shervin Ghajar**
209
-
210
- * GitHub: [@shervin-ghajar](https://github.com/shervin-ghajar)
211
- * NPM: [react-sip-kit](https://www.npmjs.com/package/react-sip-kit)
212
- * Repository: [react-sip-kit](https://github.com/shervin-ghajar/react-sip-kit)
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
- lineNumber: string | number;
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: ({ lineNumber, ...rest }: AudioProps) => import("react/jsx-runtime").JSX.Element;
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
- lineNumber: string | number;
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: ({ lineNumber, ...rest }: VideoProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const Video: ({ lineKey, ...rest }: VideoProps) => import("react/jsx-runtime").JSX.Element;
15
15
  export {};
@@ -1,4 +1,4 @@
1
- import { SipAccountConfig, SipAdvancedConfig, SipConfigs, SipFeaturesConfig, SipMediaConfig, SipPermissionsConfig, SipPolicyConfig, SipRecordingConfig, SipRegistrationConfig, SipStorageConfig, SipXmppConfig } from './types';
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;
@@ -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
- lineNumber: number;
4
- displayNumber: string;
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(lineNumber: number, displayNumber: string);
11
+ constructor(configKey: SipConfigs['key'], username: SipAccountConfig['username'], lineKey: LineType['lineKey'], remoteNumber: string);
9
12
  }
@@ -1,16 +1,16 @@
1
- import { SipAccountConfig } from '../../configs/types';
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(username: SipAccountConfig['username'], userAgent: SipUserAgent): void;
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(username: SipAccountConfig['username'], response: any, cause: any): void;
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(username: SipAccountConfig['username'], userAgent: SipUserAgent): void;
16
+ export declare function onUnregistered(configKey: SipConfigs['key'], userAgent: SipUserAgent): void;
@@ -1,10 +1,10 @@
1
- import { SipAccountConfig } from '../../configs/types';
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: ({ username }: {
7
- username: SipAccountConfig["username"];
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>;