live: AMI-fed live state, /api/live WebSocket, dashboard and status dots
LiveState loads extension states and registered devices from Asterisk on every AMI connect and follows ExtensionStatus/ContactStatus; the hub sends a snapshot then deltas batched every 250 ms (devices for admins only), pings every 30 s and closes unauthenticated sockets with 4401. The web UI keeps one reconnecting socket in a zustand store, shows a Reconnecting banner, a Dashboard (online, on a call, telephony engine) and status dots. Fix: Asterisk 24 has no 'pjsip reload'; reload with 'module reload res_pjsip.so'. AMI errors now carry the CLI output. Milestone check, automated: call-test.ts registers two baresip phones and holds a 30 s call with RTP both ways (pnpm test:asterisk); the recorded session drives the live-state tests. scripts/e2e/m2-live.mjs runs api + Asterisk + phones + browser on a private Docker network: a new extension is live in Asterisk in ~1.3 s, the dashboard shows 2/2 online and red dots during the call. Task: M2-T6
This commit is contained in:
1 parent
1cfc13ead3
commit
c0c4036887
31 files changed
+4810
-28
No files matched your search
@@ -76,7 +76,7 @@ All files go to `/etc/asterisk/selfphoneng/`.
|
||||
|
||||
| File | Module | AMI `Command:` after change |
|
||||
|---|---|---|
|
||||
| `pjsip_selfphoneng.conf` | res_pjsip | `pjsip reload` (or restart-required if transports changed) |
|
||||
| `pjsip_selfphoneng.conf` | res_pjsip | `module reload res_pjsip.so` (or restart-required if transports changed). Asterisk 24 has no `pjsip reload` CLI command. |
|
||||
| `extensions_selfphoneng.conf` | pbx_config | `dialplan reload` |
|
||||
| `extensions_globals_selfphoneng.conf` | pbx_config | `dialplan reload` |
|
||||
| `voicemail_selfphoneng.conf` | app_voicemail | `voicemail reload` |
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
5. Build Fastify: plugins (cookie, rate-limit, multipart, websocket, static for
|
||||
`./public` with SPA fallback to `index.html` for non-`/api`, non-`/prov`, non-`/hooks` paths), then routes.
|
||||
6. Listen on `127.0.0.1:${API_PORT}`.
|
||||
7. Start the AMI client (§4). On every successful login: sync AstDB (§5.5), load
|
||||
live state (§5.1), `generator.apply({ trigger: 'startup', force: true })`.
|
||||
7. Start the AMI client (§4). On every successful login: sync AstDB (§5.5),
|
||||
`generator.apply({ trigger: 'startup', force: true })`, then load live state (§5.1). The apply comes
|
||||
first so hints for extensions created while Asterisk was away exist before their states are read.
|
||||
8. Start the voicemail watcher (§5.6) and the jobs (§8).
|
||||
9. On SIGTERM: stop jobs, close WS clients, close AMI, close DB, exit 0.
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ Legend: 📖 read · 🔨 build · ✅ done when
|
||||
**M2-T6 Live state v1 + dashboard**
|
||||
📖 04 §5.1 (extension states + contacts only), §5.2
|
||||
🔨 Live store, initial load, ExtensionStatus/ContactStatus handlers, `/api/live` WS, dashboard "extensions online", StatusDots in the Users table.
|
||||
✅ **Milestone check:** register two softphones (e.g. baresip/MicroSIP/Linphone) on the LAN as 101 and 102. 101 calls 102 → two-way audio for 30 s. The dashboard shows both online, and the dots go red during the call. Write `apps/api/test/sipp/register-and-call.xml` (or a baresip script) that automates register + call + BYE and run it in `pnpm test:asterisk`.
|
||||
✅ **Milestone check:** register two softphones (e.g. baresip/MicroSIP/Linphone) on the LAN as 101 and 102. 101 calls 102 → two-way audio for 30 s. The dashboard shows both online, and the dots go red during the call. Write `apps/api/test/sipp/register-and-call.xml` (or a baresip script) that automates register + call + BYE and run it in `pnpm test:asterisk`. **Done as `apps/api/test/asterisk/call-test.ts` (baresip in Docker, checks RTP both ways).**
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in new issue
Block a user