M3: chat widget, owner dashboard, super-admin panel
- Embeddable vanilla-JS chat widget (one script tag + tenant public key):
WebSocket, resumable sessions (24h localStorage token), honeypot + per-IP
and per-message rate limits, Bosnian UI (§7)
- Session auth (bcrypt + signed cookies), owner accounts + super-admins,
admin impersonation ('otvori kao salon', §11)
- Owner dashboard (§10, Bosnian): requests with same actions as email,
call/chat history with transcripts, usage bar; settings for profile,
working hours (manual + LLM paste-to-parse), services CRUD + 'Zalijepi
cjenovnik' LLM import with review step, scheduling (Google OAuth free/busy
read-only + calendar mappings + buffers, partner status), telephony
(forwarding MMI codes per operator, ring group, worker SIP creds + QR),
agent voice/price-mode/notes + widget snippet, notifications/SMS templates
- Super-admin panel (§11): tenant CRUD incl. plan/minutes/paid-until,
partner API config (encrypted secrets), number/SIM registry + assignment,
connectivity test (live availability + dry-run push), versioned prompt
template editor with publish/rollback, playground, usage overview, health
- Fixes: WAL + busy_timeout for sqlite tests, no awaits in WS disconnect
path (deadlock), template publish autoflush bug
- 76 tests green (incl. widget WS e2e booking flow); dashboard, widget and
admin verified live in a browser against Postgres
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
47
gogo/telephony/forwarding.py
Normal file
47
gogo/telephony/forwarding.py
Normal file
@@ -0,0 +1,47 @@
|
||||
"""Per-operator conditional call forwarding codes (§5.1, M5 write-only).
|
||||
|
||||
BiH mobile operators use standard GSM MMI codes. The dashboard shows these for
|
||||
the salon's assigned Gogo number; the owner dials them once on their phone.
|
||||
Live verification with each operator happens in the joint hardware session
|
||||
(HARDWARE_TESTING.md).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
OPERATORS = {
|
||||
"mtel": "m:tel",
|
||||
"bhtelecom": "BH Telecom",
|
||||
"eronet": "HT Eronet",
|
||||
}
|
||||
|
||||
|
||||
@dataclass
|
||||
class ForwardingCodes:
|
||||
operator: str
|
||||
operator_label: str
|
||||
activate_no_answer: str
|
||||
activate_busy: str
|
||||
activate_unreachable: str
|
||||
deactivate_all: str
|
||||
check_status: str
|
||||
|
||||
|
||||
def forwarding_codes(operator: str, gogo_number: str, no_answer_seconds: int = 15) -> ForwardingCodes:
|
||||
"""Standard GSM MMI codes (same across BiH operators; kept per-operator so any
|
||||
operator-specific quirks found during live testing can be encoded here)."""
|
||||
n = gogo_number.replace(" ", "")
|
||||
if operator not in OPERATORS:
|
||||
raise ValueError(f"unknown operator: {operator}")
|
||||
# round to the nearest supported no-answer delay (5..30 in steps of 5)
|
||||
delay = min(30, max(5, 5 * round(no_answer_seconds / 5)))
|
||||
return ForwardingCodes(
|
||||
operator=operator,
|
||||
operator_label=OPERATORS[operator],
|
||||
activate_no_answer=f"**61*{n}**{delay}#",
|
||||
activate_busy=f"**67*{n}#",
|
||||
activate_unreachable=f"**62*{n}#",
|
||||
deactivate_all="##002#",
|
||||
check_status="*#61#",
|
||||
)
|
||||
Reference in New Issue
Block a user