Capture full appointment details + validate dates in-call

In-call (system prompt + per-call calendar injection):
- Gather full name (prompt asks for last name if only first given).
- Confirm the caller-ID number; if declined, use the number the caller gives.
- Ask for and LOG insurance only — never promise/confirm/deny coverage or
  treatment based on it; staff verify on callback.
- Validate the requested date against an injected 45-day calendar (recomputed
  per call since the server is long-running). Push back on impossible/mismatched
  dates, e.g. "Monday lands on the sixth — would you like that date?".
- AGENT_NAME=AVA; 4s grace pause before hang-up (HANGUP_DELAY_SECS).

Logging (post-call extraction -> Odoo):
- Extract full name, phone_confirmed, chosen callback (caller-ID or alternate),
  insurance, reason, and preferred time annotated with a resolved YYYY-MM-DD
  date (today's date is fed to the extractor).
- odoo_client: insurance row on the lead note (log only — staff verify).

.gitignore: ignore rotated avc_run.log* files.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
tocmo0nlord
2026-06-25 03:00:35 +00:00
parent 93620be9bb
commit b8c71b15c2
6 changed files with 134 additions and 34 deletions

View File

@@ -58,7 +58,8 @@ def _find_or_create_partner(uid, models, name, phone):
return _exec(uid, models, "res.partner", "create", vals)
def create_appointment_request(patient_name, callback_number, reason, preferred_time, call_sid=None):
def create_appointment_request(patient_name, callback_number, reason, preferred_time,
insurance=None, call_sid=None):
"""Create the request in Odoo. Returns (model, record_id) or raises OdooError."""
uid, models = _connect()
summary = f"📞 Phone appt request — {patient_name or 'caller'}"
@@ -67,6 +68,7 @@ def create_appointment_request(patient_name, callback_number, reason, preferred_
("Name", patient_name),
("Callback", callback_number),
("Reason", reason),
("Insurance (log only — staff to verify coverage)", insurance),
("Preferred time (patient's words)", preferred_time),
("Twilio call SID", call_sid),
]