Skip to content
J-X0-cloudPublic

About

AI voice receptionist for restaurants: answers every call, books tables, takes pickup orders and answers menu questions.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Hostline

The AI voice receptionist for restaurants: answers every call, books tables, takes pickup orders and answers menu questions from the restaurant's own menu.

Live demo: https://www.freelancerportfoliohub.com/jameslee/projects/hostline/index.html

Preview

Overview

This repository contains the Hostline marketing site and the voice agent behind it, as two apps:

  • receptionist/ is an Elixir/Phoenix service that owns the voice agent. A telephony webhook drives a call-flow state machine, with one supervised process per live call. It books into a reservation book built on a real floor plan, fires pickup orders to the POS, answers menu and allergen questions only from the restaurant's own material, and hands calls to a person when the owner's house rules say so. It also serves the call log, menu, bookings and demo-request API.
  • The Next.js site (repo root) walks owners through the product, a full sample call, menu knowledge, house rules, the call log, flat-rate pricing and a demo request flow. The product mockups (live transcript, booking confirmation, pickup ticket, grounded-answer card, call log) are React components rendered from typed data, and the live parts (call log, house rules, demo requests) are fetched server-side from the receptionist service.

Features

  • Five pages: home, product, call log, pricing and book-a-demo, plus privacy and terms
  • Telephony webhook (POST /api/voice/webhook): signature-verified carrier callbacks, TwiML responses (speak and gather speech, dial the manager, hang up), a status callback that closes out abandoned calls, and SMS follow-ups
  • A process per call (Receptionist.Calls.CallServer): each live call is a GenServer under a DynamicSupervisor, registered by call SID, so turns of one call are serialised, a crash stays contained and idle calls are closed out on their own
  • Call-flow state machine (Receptionist.Calls.Flow): greeting → booking details → table choice → confirmation, ordering with a suggested add-on → read-back → POS, questions, message taking, transfers. It understands other nights ("tomorrow", "on Saturday"), falls back to other seating areas when one is full and re-offers if a table goes mid-call
  • Booking engine (Receptionist.Bookings): tables per seating area, opening hours and last seating per weekday, turn times by party size, a pacing limit on covers per slot, best-fit table assignment and nearest-time options per area, all inside one book process so the last table can't be double-booked
  • Pickup orders (Receptionist.Orders): spoken quantities and modifiers, merged lines, sales tax, ready times from the kitchen queue
  • Menu grounding (Receptionist.Menu.Index): alias and plural matching, allergen answers cited to the allergen sheet row, same-day kitchen notes (86s and specials) that override the printed menu, and an explicit "can't confirm" path when a dish isn't covered
  • House rules (Receptionist.HouseRules): plain-English rules (parties of 8+, complaints, kitchen queue, private events, asking for a person) that the product page renders from the same source the agent evaluates
  • Call log (/dashboard): KPIs, filterable call table, transcript panel and a same-day notes view, fed by GET /api/calls
  • CSS-only mobile navigation and FAQ accordions, duotone photography, no horizontal scroll at 390px

Tech stack

Area Choice
Voice service Elixir, Phoenix (API only), Bandit, OTP supervision
Website Next.js 15 (App Router), React 19, TypeScript (strict)
Styling Global CSS with design tokens, next/font/local
Voice Carrier webhooks + TwiML, SMS via the carrier's REST API (Req)
Data Restaurant knowledge base and seed call log as JSON in receptionist/priv/data
Testing ExUnit (unit, doctests, controller and scripted-call tests)
Tooling mix format, ESLint, Prettier, pnpm, Docker

Getting started

You need Elixir 1.18 / OTP 27 for the service and Node 22 with pnpm for the site.

1. Start the receptionist service (http://localhost:4000):

cd receptionist
mix setup
mix phx.server

2. Start the website (http://localhost:3000), in a second terminal from the repo root:

pnpm install
cp .env.example .env.local   # API_URL=http://localhost:4000
pnpm dev

The call log and the product page's house rules are read from the service on each request; if it isn't running those sections show a notice instead.

Run the tests

cd receptionist
mix test

The suite covers the text parsing, menu grounding, booking engine, POS and house rules, plays full scripted calls through the state machine, exercises the per-call processes (concurrency, idle timeout, crash isolation) and hits every endpoint, including signed and forged webhooks.

Simulate calls without a phone

cd receptionist
mix receptionist.simulate              # all scripts
mix receptionist.simulate --only pickup

Plays scripted calls (a Friday booking with an allergen question, a pickup order, menu questions, a large party) through the state machine and prints each turn with its citations, texts and transfers.

Connect a phone number

  1. Point your number's voice webhook at https://<receptionist-domain>/api/voice/webhook (HTTP POST), and its status callback at /api/voice/status.
  2. Set PUBLIC_BASE_URL, TELEPHONY_ACCOUNT_SID, TELEPHONY_AUTH_TOKEN and TELEPHONY_FROM_NUMBER on the service.
  3. Set MANAGER_PHONE_NUMBER for transfers.

For local testing with curl, start the service with SKIP_WEBHOOK_SIGNATURE=true:

curl -X POST localhost:4000/api/voice/webhook -d CallSid=CA1 --data-urlencode From=+13105550199 --data-urlencode To=+13105550100
curl -X POST localhost:4000/api/voice/webhook -d CallSid=CA1 --data-urlencode From=+13105550199 --data-urlencode To=+13105550100 \
  --data-urlencode "SpeechResult=Do you have a table for four tonight, around seven-thirty?"

API

All routes are served by the receptionist service.

Method & path Description
POST /api/voice/webhook Carrier webhook for every call turn; returns TwiML
POST /api/voice/status Carrier status callback; closes out finished calls
GET /api/calls Call log (type, attention=1, q filters) with counts
GET /api/calls/live Calls in progress and the stage each is at
GET /api/calls/:id One call with its transcript
GET /api/menu Menu with availability and allergen rows (at for a point in time)
POST /api/menu/answers What the host would answer to question, with citations
GET/POST /api/kitchen-notes Same-day 86s, specials and info; DELETE /api/kitchen-notes/:id
GET /api/availability Open slots and nearest options (date, party, time, area)
GET/POST /api/bookings Bookings and the night's covers; DELETE /api/bookings/:id cancels
GET /api/orders Pickup tickets and the kitchen queue; PUT /api/kitchen-queue
GET /api/house-rules The rules the agent evaluates, in plain English
POST /api/demo-requests Demo form submissions; field errors on 422
GET /health Health check

Environment variables

Variable App Description
API_URL Website Base URL of the receptionist service
NEXT_PUBLIC_SITE_URL Website Canonical site URL
PORT Service HTTP port (set by Railway)
SECRET_KEY_BASE Service Production secret, from mix phx.gen.secret
PHX_HOST Service Public host name of the service
PUBLIC_BASE_URL Service Public URL used for webhook signatures and <Gather> actions
TELEPHONY_ACCOUNT_SID Service Carrier account id (SMS)
TELEPHONY_AUTH_TOKEN Service Carrier auth token (signatures and SMS)
TELEPHONY_FROM_NUMBER Service Number texts are sent from
TELEPHONY_API_BASE_URL Service Carrier REST base URL
MANAGER_PHONE_NUMBER Service Where transfers are dialled
AGENT_VOICE Service Text-to-speech voice
SKIP_WEBHOOK_SIGNATURE Service true only for local development
DEMO_REQUEST_WEBHOOK_URL Service Destination for demo form submissions
POS_QUEUE_MINUTES Service Kitchen queue reported by the built-in POS adapter

Deployment

The service ships with a Dockerfile (a Phoenix release on slim Debian) and railway.json in receptionist/. On Railway, create one service with its root directory set to receptionist/, set SECRET_KEY_BASE, PHX_HOST and PUBLIC_BASE_URL, and the container binds to the PORT Railway provides. Deploy the website as a second service from the repo root and set API_URL to the receptionist's URL.

cd receptionist
docker build -t hostline-receptionist .
docker run -p 4000:4000 -e SECRET_KEY_BASE=$(mix phx.gen.secret) hostline-receptionist

Project structure

.
├── app/
│   ├── dashboard/      # call log page (reads GET /api/calls)
│   ├── demo/           # book a demo + server action
│   ├── pricing/
│   ├── product/
│   ├── globals.css
│   ├── layout.tsx
│   └── page.tsx        # homepage
├── components/
│   ├── call/           # transcript card, booking, ticket, grounded answer
│   ├── dashboard/      # call log dashboard, tiles, same-day notes
│   ├── home/  product/  pricing/  demo/
│   ├── layout/         # header, footer
│   ├── sections/       # CTA band, sub-page hero
│   └── ui/             # Icon, Button, Chip, Pill, Faq…
├── lib/
│   ├── api.ts          # server-side client for the receptionist service
│   └── data/           # typed page content and sample call
├── public/             # fonts and images
├── types/
└── receptionist/       # Elixir voice service
    ├── config/         # runtime config reads the environment
    ├── lib/
    │   ├── receptionist/
    │   │   ├── calls/          # session, flow state machine, per-call GenServer
    │   │   ├── bookings/       # floor plan, engine, reservation book, speech
    │   │   ├── menu/           # knowledge base structs, grounding index, kitchen notes
    │   │   ├── orders/         # lines, orders, POS adapter
    │   │   ├── call_log/       # call log entries
    │   │   ├── house_rules.ex  telephony.ex  sms.ex  text.ex  clock.ex
    │   │   └── demo_requests.ex
    │   ├── receptionist_web/   # router, controllers, signature plug
    │   └── mix/tasks/          # mix receptionist.simulate
    ├── priv/data/      # restaurant.json (menu, allergens, floor), call_log.json
    ├── test/
    └── Dockerfile

Scripts

Command Where Description
pnpm dev root Start the website dev server
pnpm build root Production build of the website
pnpm start root Serve the production build
pnpm lint root ESLint
pnpm typecheck root TypeScript, no emit
pnpm format root Prettier
mix phx.server receptionist/ Start the receptionist service
mix test receptionist/ ExUnit suite
mix receptionist.simulate receptionist/ Run scripted calls through the call flow
mix format receptionist/ Format Elixir code

About

AI voice receptionist for restaurants: answers every call, books tables, takes pickup orders and answers menu questions.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages