feat(connect): caller ID as an integration: calls on the signed-in live connection, matched on the server
Plan step 3.5.
- The public /api/phone/ws socket is removed (anyone on the LAN could listen to every
caller). GET /api/phone/call-event stays public for the Grandstream UCM but is LAN-only in
the proxy (the 443 blocks' LAN-only location now covers it, in nginx-proxy/nginx.conf and
install.sh), with an optional shared secret (setting caller_id.secret → &key=).
- Calls are logged (phone_calls, migration 0023), matched to a customer on the server
(services/caller_id.py: Greek number rules moved from the manager) and published as
`call_incoming` {call_id, at, number, ext, customer card: visits, spent, last 3 orders} to
users with caller_id.use and to the counter POS screens. GET /api/phone/calls (the log),
GET /api/customers/lookup?phone=. Calls older than a minute don't pop up (replays).
- Manager: PhoneListener on the live connection and the shared Dialog (no more downloading
every customer to match); Integrations → Caller ID shows the server's log live and the UCM
Action URL. Counter: CallPopup with "New takeaway sale".
- Tests: tests/test_caller_id.py (10), terminal unit test, e2e terminal and manager.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -590,6 +590,19 @@ try {
|
||||
r.check('fees: …and it never shows in the products list', !(await api('GET', '/api/products/?all=true', { token: boss })).some(p => p.id === feeProduct?.id))
|
||||
await page.screenshot({ path: path.join(OUT, 'manager-fees.png'), fullPage: true })
|
||||
|
||||
// 3.5: caller ID in the manager, on the signed-in live connection
|
||||
await api('PUT', '/api/platform/modules/caller_id', { token: boss, body: { enabled: true } }).catch(() => {})
|
||||
await page.goto(`${APP}/apps/phone`)
|
||||
await page.getByTestId('phone-page').waitFor({ timeout: 10_000 })
|
||||
await page.waitForFunction(() => document.documentElement.dataset.live === 'ready', null, { timeout: 10_000 }).catch(() => {})
|
||||
await fetch(`${backend.url}/api/phone/call-event?caller=2101112233&ext=101`)
|
||||
r.check('caller ID: a call pops up in the manager (unknown number)', await page.getByTestId('call-popup').waitFor({ timeout: 8000 }).then(() => true).catch(() => false)
|
||||
&& (await page.getByTestId('call-popup').textContent()).includes('2101112233'))
|
||||
await page.getByTestId('call-close').click()
|
||||
r.check('caller ID: …and is in the call log', await page.getByTestId('call-row').first().waitFor({ timeout: 5000 }).then(() => true).catch(() => false)
|
||||
&& (await page.getByTestId('call-log').textContent()).includes('2101112233'))
|
||||
await page.screenshot({ path: path.join(OUT, 'manager-calls.png'), fullPage: true })
|
||||
|
||||
// 3.4: the customer display's idle screen, the venue's choice
|
||||
await api('PUT', '/api/platform/modules/customer_display', { token: boss, body: { enabled: true } }).catch(() => {})
|
||||
await page.goto(`${APP}/settings`)
|
||||
|
||||
Reference in New Issue
Block a user