What you add
A model does not know today’s date, and a server clock may be in another time zone.Prefetch reads what the call needs before the greeting and saves it into the state.
First, three more state fields for the clock.
salon/state.py
salon/agent.py
Clockreads one time zone, once. Itsassignmaps each state value to a clock field:date,day_of_weekortime.CallValuecopies a value the call carries, here the caller’s number fromstate.call.calling_number, intocustomer_phone. A browser call has no number, so that value stays empty.save_call_startsaves what the call was started with. It also readsUNMUTE_CALL_START, so a browser call can pretend to be a phone call.GREETING.check(PREFETCH)refuses, at import, a greeting that names a value prefetch does not fill.
verify_customer has read it back and the caller said yes.
Then tell the concierge what day it is. Add this line to CONCIERGE_PROMPT.
new_call where you built it by hand before.
state.call has no number. On a phone call, unmute_core.livekit.sip_call_info and unmute_core.pipecat.telephony_call_info read it from the carrier. Pass the result as call. Telephony shows how.
Try it
To try the caller ID path, simulate a phone caller, then start the agent.- Say “Can I book a haircut for Friday?” Robin should offer times on the coming Friday, with no question about today’s date.
- When Robin asks for your number, it should read back the one from caller ID and wait for a yes.
Why it works this way
The model reads today’s date from the state, so a call that starts at 11 pm in Madrid still gets Madrid’s date. The value is read once. A call that crosses midnight keeps the day it began on. Prefetch runs before the greeting. The first model request then has the date, and no tool call is spent to fetch it.What you have now
Next: Quiet callers
Set the turn pace, nudge a quiet caller and end a long call.