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:
@@ -10,6 +10,7 @@ import models.table # noqa: F401
|
||||
import models.printer # noqa: F401
|
||||
import models.product # noqa: F401
|
||||
import models.customers # noqa: F401
|
||||
import models.phone_call # noqa: F401
|
||||
import models.order # noqa: F401 also registers OrderAuditLog, OrderDiscount, PrintJob
|
||||
import models.business_day # noqa: F401
|
||||
import models.shift # noqa: F401 WaiterShift, ShiftBreak
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
from sqlalchemy import Column, ForeignKey, Integer, String
|
||||
|
||||
from core.timeutil import UTCDateTime, utcnow
|
||||
from database import Base
|
||||
|
||||
|
||||
class PhoneCall(Base):
|
||||
"""An incoming call the venue's phone system reported (caller ID, plan step 3.5)."""
|
||||
__tablename__ = "phone_calls"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
at = Column(UTCDateTime, default=utcnow, nullable=False, index=True)
|
||||
number = Column(String, nullable=False) # as the phone system sent it
|
||||
ext = Column(String, nullable=True) # the extension that was dialled
|
||||
customer_id = Column(Integer, ForeignKey("customers.id", ondelete="SET NULL"), nullable=True)
|
||||
Reference in New Issue
Block a user