Blog · · 4 min read
After-Hours Answering Service with AI: Messages and Next-Day Callbacks
How to have AI answer calls after hours: collect name, callback number and reason, route real emergencies to on-call staff, and build a next-day callback list.
Key points
- An AI answering after hours collects the caller's name, callback number and reason as structured fields, which voicemail often fails to capture.
- Use a separate after-hours agent settings that says when someone will call back and only hands off genuine emergencies.
- Receive the results by webhook after each call and turn them into a callback queue your team works through first thing in the morning.
You can have an AI answer every call that comes in after hours, collect the caller's name, callback number and reason, and set up a callback for the next business day. Unlike voicemail, the AI asks for anything that's missing and reads the details back, so the morning shift doesn't start with a pile of half-audible messages. The few calls that really can't wait get routed to whoever is on call.
Why not just voicemail?
Voicemail is easy, but someone has to listen to every message and type it up, and a surprising number leave out a name or say the number too fast to catch.
| Voicemail | AI answering | |
|---|---|---|
| Name and callback number | Missing if the caller forgets | Asked for until it has them |
| Mishearing | Discovered the next morning | Caught on the spot by reading back |
| Morning workload | Listen and transcribe | Read a list of structured fields |
| Urgent calls | Noticed the next morning | Routed to on-call staff if they match your rules |
| Simple questions | Not answered | Hours, location and other FAQs answered |
Switching setups by time of day
What the AI should do changes when the office closes. During hours it can hand callers to staff; after hours, the default is a callback. So run two agents and pick one based on when the call arrives.
The after-hours setup differs in four places:
- Greeting. Say up front that the office is closed: "We're closed for the day, but I can take your details and have someone call you back tomorrow."
- Fields. Name, callback number, reason, plus a preferred callback time.
- Handoff conditions. Narrowed to genuine emergencies only.
- Closing. Say when they'll hear back: "Someone from our team will call you tomorrow morning."
Holidays work the same way: your phone flow decides, not the AI. Holiday calendars differ by business, so store them as a per-customer setting in your SaaS.
Handling emergencies
Some calls can't wait until morning: a burst pipe for a property manager, a broken-down vehicle for a repair shop, a patient in pain after surgery. Define "urgent" per industry in concrete terms and put it in the handoff conditions.
- When a condition matches, the AI decides to hand off and ends its part.
- Your phone flow forwards the call to the on-call mobile.
- If there's no on-call staff, play the emergency contact information and end.
Describe situations, not words. "The caller says it's urgent" sends everything to the on-call phone, because everyone thinks their call is urgent. "Water is actively leaking and won't stop" doesn't. See designing AI-to-human handoff for more.
The next-morning callback loop
After-hours answering isn't done until someone calls back:
- When the conversation ends, the fields and a summary arrive by webhook.
- You add them to a "needs callback" queue in your product.
- In the morning, staff work the queue, ordered by preferred callback time.
- Each callback gets marked done with a note on the outcome.
Posting each call to Slack or Teams as well lets staff see the overnight count before they're even at their desks; see notifying staff after calls.
Doing this with voicast
In voicast, create an after-hours agent settings and choose it from your Twilio voice webhook by passing <Parameter name="agent"> when you're closed. Without that parameter, the tenant's default setup is used. Here's a small Express app; adjust the time zone and hours to your customer's.
import express from 'express';
const app = express();
app.use(express.urlencoded({ extended: false }));
function isOpen(now = new Date(), timeZone = 'America/New_York'): boolean {
const parts = new Intl.DateTimeFormat('en-US', {
timeZone, weekday: 'short', hour: 'numeric', hour12: false,
}).formatToParts(now);
const day = parts.find((p) => p.type === 'weekday')!.value;
const hour = Number(parts.find((p) => p.type === 'hour')!.value);
return !['Sat', 'Sun'].includes(day) && hour >= 9 && hour < 18;
}
app.post('/twilio/voice', (req, res) => {
const agent = isOpen() ? '' : `<Parameter name="agent" value="${process.env.AFTER_HOURS_AGENT_ID}" />`;
res.type('text/xml').send(`<Response>
<Connect action="https://saas.example.com/twilio/after">
<Stream url="wss://voice.voicast.jp/ws">
<Parameter name="tenant" value="${process.env.TENANT_ID}" />
<Parameter name="secret" value="${process.env.TENANT_SECRET}" />
<Parameter name="from" value="${req.body.From}" />
${agent}
</Stream>
</Connect>
</Response>`);
});
app.post('/twilio/after', async (req, res) => {
const r = await fetch(`https://api.voicast.jp/v1/calls/by-provider/${req.body.CallSid}`, {
headers: { authorization: `Bearer ${process.env.VOICAST_API_KEY}` },
});
const call = await r.json();
const twiml = call.outcome === 'handoff'
? `<Dial>${process.env.ON_CALL_NUMBER}</Dial>`
: '<Hangup/>';
res.type('text/xml').send(`<Response>${twiml}</Response>`);
});
app.listen(3000);In the after-hours setup, list only real emergencies in handoff_when and state the callback timing in closing. Results arrive in the call.ended webhook (outcome and fields) and call.summary_ready (summary and category). Receive call.summary_ready and post from your own server to send the summary to Slack or another chat tool after each call. Twilio documents how the <Connect> action URL works in its TwiML reference.
One note for international teams: voicast's phone field type validates Japanese numbers (10 or 11 digits starting with 0) and re-asks if the number doesn't fit. For other countries, use a text field for the callback number and validate it in your own code.
FAQ
Can the AI answer only after hours?
Yes. Your phone flow decides by time: ring staff as usual during business hours and connect to voicast only when closed. In the example above, return a <Dial> to your front desk when isOpen() is true.
What if the on-call transfer isn't answered?
That's handled in your phone flow. Use the action URL on Twilio's <Dial> to detect no answer, then play emergency guidance or take whatever fallback step the business has chosen.
What's left if the caller hangs up before giving a number?
The call's outcome is hangup. The caller ID you passed in as from is still stored on the conversation record, so the business can decide whether to call that number back.