@cemscale-voip/voip-sdk 1.2.0 → 1.2.1
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 +30 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -149,6 +149,34 @@ const { apiKeys } = await voip.listApiKeys();
|
|
|
149
149
|
await voip.revokeApiKey('key-id');
|
|
150
150
|
```
|
|
151
151
|
|
|
152
|
+
## Connecting a WebRTC Softphone
|
|
153
|
+
|
|
154
|
+
Your app doesn't need to know or store SIP passwords. Use the API key to fetch credentials on the fly:
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
// 1. Get SIP credentials for the extension (API key handles auth)
|
|
158
|
+
const { sipCredentials } = await voip.getSipCredentialsByNumber('1001');
|
|
159
|
+
|
|
160
|
+
// sipCredentials = {
|
|
161
|
+
// extension: "1001",
|
|
162
|
+
// displayName: "Alice",
|
|
163
|
+
// password: "auto-provided", <-- API returns it, your app doesn't store it
|
|
164
|
+
// sipDomain: "sip.cemscale.com",
|
|
165
|
+
// wsUri: "wss://sip.cemscale.com/ws",
|
|
166
|
+
// registrar: "sip:sip.cemscale.com"
|
|
167
|
+
// }
|
|
168
|
+
|
|
169
|
+
// 2. Also get TURN credentials for NAT traversal
|
|
170
|
+
const turn = await voip.getTurnCredentials();
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Two methods available:
|
|
174
|
+
|
|
175
|
+
| Method | Use when |
|
|
176
|
+
|--------|----------|
|
|
177
|
+
| `getSipCredentials(extensionId)` | You have the extension UUID |
|
|
178
|
+
| `getSipCredentialsByNumber('1001')` | You have the extension number |
|
|
179
|
+
|
|
152
180
|
## WebRTC Softphone (Browser Only)
|
|
153
181
|
|
|
154
182
|
For building a browser-based softphone, use the `WebRTCPhone` class or the `useVoIP` React hook.
|
|
@@ -210,6 +238,8 @@ function PhoneWidget() {
|
|
|
210
238
|
| `getCallForward(id)` | Get forwarding |
|
|
211
239
|
| `getExtensionByCrmUser(crmUserId)` | Lookup by CRM user |
|
|
212
240
|
| `updateCrmMapping(id, params)` | Set CRM mapping |
|
|
241
|
+
| `getSipCredentials(id)` | SIP credentials by extension UUID |
|
|
242
|
+
| `getSipCredentialsByNumber('1001')` | SIP credentials by extension number |
|
|
213
243
|
|
|
214
244
|
### Conferences
|
|
215
245
|
| Method | Description |
|