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:
2026-11-16 09:06:39 +02:00
co-authored by Claude Opus 5.5
parent 88a9703902
commit dabe807ce0
28 changed files with 609 additions and 501 deletions
+3
View File
@@ -116,5 +116,8 @@
"media_type": "Upload a JPG, PNG, WebP or GIF image.",
"media_too_big": "The image is too big (at most {{max_mb}} MB).",
"qr_url_missing": "Enter the link the QR code opens."
},
"caller_id": {
"key_invalid": "The phone system's key is missing or wrong."
}
}
+20
View File
@@ -658,5 +658,25 @@
"pickSlides": "Pick the photos, in order (tap again to remove)",
"upload": "Upload images",
"noImages": "No images yet: upload some (JPG, PNG, WebP or GIF, up to 5 MB)."
},
"calls": {
"title": "Caller ID",
"intro": "Incoming calls from your phone system, with the caller's customer card when we know them. The manager and the counter show a popup.",
"incoming": "Incoming call",
"close": "Close",
"unknown": "Unknown caller",
"unknownBody": "Not one of your customers yet.",
"ext": "ext. {{ext}}",
"visits": "Visits",
"spent": "Spent",
"recent": "Last orders",
"noOrders": "No orders yet",
"items_one": "{{count}} item",
"items_other": "{{count}} items",
"log": "Calls",
"none": "No calls yet",
"setup": "Connect the phone system",
"setupBody": "In the Grandstream UCM, set the Action URL for incoming calls to this address (it only works from inside the venue):",
"setupSecret": "For extra safety, set a key in Settings (caller_id.secret) and add &key=<the key> to the address."
}
}
+7
View File
@@ -464,6 +464,13 @@
"arrive": "They're here: seat them",
"cancel": "Cancel",
"noShow": "No-show"
},
"call": {
"title": "Incoming call",
"unknown": "Unknown caller",
"takeaway": "New takeaway sale",
"visits_one": "{{count}} visit · {{spent}}",
"visits_other": "{{count}} visits · {{spent}}"
}
},
"display": {