voxnix 2.0.0 → 2.1.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/README.md +16 -7
- package/dist/voxnix.iife.js +35 -35
- package/dist/voxnix.js +1107 -1069
- package/dist/voxnix.umd.cjs +35 -35
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ SIP/WebSocket, manages the agent status (Ready / Not Ready / AUX)
|
|
|
5
5
|
through the CPaaS API, and gives you **functions + events** to build your own calling UI in any stack:
|
|
6
6
|
React, Vue, Angular, or plain HTML.
|
|
7
7
|
|
|
8
|
-
**Current version: `2.
|
|
8
|
+
**Current version: `2.1.0`**. Voxnix ships no UI. Upgrading from 1.x? See [Migrating from 1.x](#migrating-from-1x).
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
@@ -231,6 +231,7 @@ All callbacks are optional. Payloads are described in [Events & callbacks](#even
|
|
|
231
231
|
| `mute(muted = true)` | — | `true` mutes the microphone, `false` unmutes it. Only during a connected call |
|
|
232
232
|
| `hold(onHold = true)` | — | `true` holds the call, `false` resumes it. Only during a connected call |
|
|
233
233
|
| `sendDtmf(tones)` | — | Send DTMF during a connected call. Accepts one tone or a string: `'5'`, `'123#'` |
|
|
234
|
+
| `transfer(target, { attended = false })` | `Promise<boolean>` | *(2.1+)* Transfer the connected call to `target`. Blind: REFER straight away. Attended: hold the caller, call `target`, and REFER (Replaces) once it answers. On success our leg is hung up (`onCallEnded` fires) |
|
|
234
235
|
| `setReady()` | `Promise<boolean>` | Agent → Ready. Emits `'REGISTERED'` + `'READY'` on success |
|
|
235
236
|
| `setNotReady()` | `Promise<boolean>` | Agent → Not Ready (CPaaS `Logout`). Emits `'SIP_CONNECTED'` + `'NOT_READY'` |
|
|
236
237
|
| `setAux(code = 'AUX', label = code)` | `Promise<boolean>` | Agent → AUX. `code` is sent to CPaaS as the reason; `label` is for your UI |
|
|
@@ -255,7 +256,7 @@ The call controls are safe to call at any time. Outside a valid state they do no
|
|
|
255
256
|
callDuration: '01:23', // 'MM:SS' or 'HH:MM:SS'
|
|
256
257
|
isMuted: false,
|
|
257
258
|
isOnHold: false,
|
|
258
|
-
remote: { number: '1002', name: 'Jane', direction: 'outgoing' }, // null when Idle
|
|
259
|
+
remote: { number: '1002', name: 'Jane', direction: 'outgoing', headers: {} }, // null when Idle
|
|
259
260
|
}
|
|
260
261
|
```
|
|
261
262
|
|
|
@@ -274,14 +275,15 @@ Subscribe with `voice.on(event, cb)`. Events that have a callback option fire th
|
|
|
274
275
|
| `call_status` | `'Idle'` \| `'Calling...'` \| `'Ringing'` \| `'InCall'` | `onCallStatus` |
|
|
275
276
|
| `call_duration` | `'00:42'`, every second while connected, `'00:00'` on end | — |
|
|
276
277
|
| `call_failed` | `cause` string, e.g. `'Busy'`, `'Rejected'`, `'Unavailable'` | `onCallFailed` |
|
|
277
|
-
| `incoming_call` | `{ number, name, direction: 'incoming' }` | `onIncomingCall` |
|
|
278
|
-
| `sync_call_answered` | `{ number, name, direction }` | `onCallAnswered` |
|
|
279
|
-
| `sync_call_ended` | `{ number, name, direction, cause, originator }` | `onCallEnded` |
|
|
280
|
-
| `sync_call_unanswered` | `{ number, name, direction, cause, originator }` | `onCallUnanswered` |
|
|
278
|
+
| `incoming_call` | `{ number, name, direction: 'incoming', headers }` | `onIncomingCall` |
|
|
279
|
+
| `sync_call_answered` | `{ number, name, direction, headers }` | `onCallAnswered` |
|
|
280
|
+
| `sync_call_ended` | `{ number, name, direction, headers, cause, originator }` | `onCallEnded` |
|
|
281
|
+
| `sync_call_unanswered` | `{ number, name, direction, headers, cause, originator }` | `onCallUnanswered` |
|
|
281
282
|
| `mute_status` | `boolean` | — |
|
|
282
283
|
| `hold_status` | `boolean` | — |
|
|
283
284
|
|
|
284
285
|
- `direction`: `'incoming'` or `'outgoing'`.
|
|
286
|
+
- `headers` *(2.1+)*: custom `X-*` headers of an incoming INVITE, e.g. `{ 'X-Call-Uuid': '…', 'X-Source-Type': 'whatsapp-call', 'X-Queue-Name': '…' }`. Always `{}` for outgoing calls. These values come from the caller side, so treat them as untrusted.
|
|
285
287
|
- `originator`: who ended the call. `'local'` means you, `'remote'` means the other side, `'system'` means a network or SIP error.
|
|
286
288
|
- `cause`: the end reason, such as `'Terminated'`, `'Canceled'`, `'Rejected'`, `'Busy'` or `'No Answer'`.
|
|
287
289
|
|
|
@@ -442,6 +444,8 @@ npm run watch # rebuild ESM + UMD on change
|
|
|
442
444
|
- **New SIP engine.** Call callbacks now receive `{ number, name, direction, ... }` instead of a raw SIP session object.
|
|
443
445
|
- `hold(true)` now holds and `hold(false)` resumes (1.x had them reversed).
|
|
444
446
|
- `onCallEnded` fires once per call. Before, it could fire twice for incoming calls.
|
|
447
|
+
- Call payloads include `headers` (2.1+), the `X-*` headers of an incoming INVITE. Use it instead of reading headers from the raw SIP session.
|
|
448
|
+
- Call transfer is `transfer(target, { attended })` (2.1+) instead of `refer()` on the raw session.
|
|
445
449
|
- New in 2.0: `sendDtmf`, `setReady`, `setNotReady`, `setAux`, `getState`, `on`, plus the options `onCallStatus`, `onCallFailed`, `ringtone` and `contacts`.
|
|
446
450
|
- `contacts` has no built-in demo entries any more. Pass your own map.
|
|
447
451
|
|
|
@@ -449,13 +453,18 @@ npm run watch # rebuild ESM + UMD on change
|
|
|
449
453
|
|
|
450
454
|
## Changelog
|
|
451
455
|
|
|
456
|
+
### v2.1.0
|
|
457
|
+
- `transfer(target, { attended })`: blind transfer (REFER), or attended (hold caller, consult call, REFER with Replaces)
|
|
458
|
+
- Call payloads and `getState().remote` include `headers`: the `X-*` headers of an incoming INVITE (`X-Call-Uuid`, `X-Source-Type`, `X-Queue-Name`, …)
|
|
459
|
+
- Build runs on `prepack`, so `npm pack` / `npm publish` always ship a fresh `dist`
|
|
460
|
+
|
|
452
461
|
### v2.0.0
|
|
453
462
|
- Removed the built-in React UI; Voxnix is now a headless SDK (no React / Tailwind dependencies)
|
|
454
463
|
- New internal SIP engine
|
|
455
464
|
- New API: `sendDtmf`, `setReady`, `setNotReady`, `setAux`, `getState`, `on`; options `onCallStatus`, `onCallFailed`, `ringtone`, `contacts`
|
|
456
465
|
- Configurable `cpaas_base_url`, `pbx_url` (SIP domain), `sip_url` (WSS host)
|
|
457
466
|
- Re-REGISTER + CPaaS poll when the extension reports `is_register = 0`
|
|
458
|
-
- Security: credentials and API responses are no longer logged (1.0.23–1.0.24 logged the full config); HTTPS-only CPaaS URL; `dial()` input validation;
|
|
467
|
+
- Security: credentials and API responses are no longer logged (1.0.23–1.0.24 logged the full config); HTTPS-only CPaaS URL; `dial()` input validation; build before publish
|
|
459
468
|
- Fixes: cancel while dialing, double `onCallEnded`, inverted `hold()`, outgoing call duration and callbacks, busy second incoming call, `destroy()` not stopping SIP, IIFE global `OmnixWidget.init`
|
|
460
469
|
|
|
461
470
|
### v1.0.12
|