Skip to content
Français

What an IVR is, and why companies still use one

  • Lesson 22
  • 30 min
  • Module 7: Build a small IVR

Where we are

So far, we listened to calls after they ended. Now Larkfield wants its phone line to answer by itself out of hours. In this lesson, we see an IVR as a map of states, and the measures that tell a good phone menu from a bad one.

Plays from YouTube. Nothing loads from YouTube until you press play. Privacy
Lesson 22 of 36 · Speech AI: Transcribe, Understand and SpeakWhat an IVR is, and why companies still use one

What you will be able to do

See a phone menu as a small map of states. Then learn the four numbers that tell Larkfield whether its out-of-hours phone line helps callers or only annoys them.

Before you startWhat to know and to have readyAbout 30 minutes

What you need to know

What you need

  • Nothing to install. This lesson has no code. You listen to one call and read one diagram.

You call your pharmacy at 9 p.m. Nobody is there. A recorded voice answers: “For opening hours, press 1. To check a prescription, press 2.” You press 2. The voice asks for your prescription number. You type it. The voice says: “Your prescription is ready. You can collect it tomorrow after 8 a.m.” You hang up. Your question is answered, and no person worked late for it.

Now think of a bad version of the same call. The voice lists nine options. None of them fits your question. You press 0, and the voice says “Sorry, I did not understand” and plays the nine options again. You hang up, angry, and you call again the next morning.

Both are the same kind of system. The difference is in how it is built and how it is tested. This module builds the good kind for Larkfield.

The problem: Larkfield’s phone rings when nobody is there

Section titled “The problem: Larkfield’s phone rings when nobody is there”

Larkfield’s help desk takes about 4,000 calls a month, in English and French. About 900 of them come out of hours, when no agent works. Today, those callers hear a message and call again later.

Many of these questions are simple. “Where is my order?” “When are you open?” “I want to send something back.” An agent answers each one in a few minutes. Larkfield’s team counts the cost of a call that a person handles at US$4.00 (6 minutes at US$40 an hour). That number is an assumption in the course data, not a measured price.

Omar, the product manager, asks a fair question: “Can the phone line answer the simple questions by itself, out of hours? And can it pass every other caller to a person the next morning, with their question already written down?”

A phone line that answers by itself is called an IVR, for interactive voice response. “Interactive” means it reacts to what the caller does. “Voice response” means it answers with speech. You have used many: banks, airlines, doctors’ offices and parcel companies all have one.

Think of a board game. Your piece is always on one square. A roll of the dice moves it to another square, by fixed rules. You always know where you are and what can happen next.

An IVR works the same way. At every moment of the call, it is in one state: “asking for the language”, “asking what the caller needs”, “asking for the order number”. In each state, it plays a prompt (a sentence it says), and it listens. What the caller says or presses moves the call to the next state. Engineers call this a state machine, because the whole program is a set of states and the rules for moving between them.

Here is the map of the Larkfield IVR that you build in this module:

A flow chart of six boxes. Greeting and language, then Menu, then Order number, then Confirm, then Answer. From Menu, hours go straight to Answer. From Confirm, no goes back to Order number. Dotted arrows go from Greeting, Menu, Order number and Confirm to A person takes over, after two misses or when the caller presses 0.
The Larkfield IVR as a map of states. Solid arrows: what a caller normally does. Dotted arrows: the way to a person.
Text description of the diagram

The call starts in Greeting and language: the caller says “English” or “Français”, or presses 1 or 2. Then Menu: the caller says what they need, or presses 1 for orders, 2 for opening hours, 3 for returns. Opening hours are answered at once. For an order status or a return, the IVR needs the Order number, then it reads the number back in Confirm. A “yes” leads to the Answer. A “no” goes back to the order number. From every state, a dotted arrow leads to A person: after two misses, or when the caller presses 0.

Two kinds of trouble have their own names, because every IVR must handle them:

  • A no-input: the caller says nothing. Maybe they did not hear the question, or they are thinking. The Larkfield IVR waits 5 seconds.
  • A no-match: the caller says or presses something that does not fit. For example, they press 7 in a menu that has only 1, 2 and 3.

Each one counts as a miss. After the first miss, the IVR asks again, in a different way. After the second miss in the same state, it stops trying and passes the call to a person. A caller should never be stuck in a loop.

Before you build anything, listen to one call through the finished IVR. Call I-009 is one of the course’s recorded test calls. The caller wants to know where their order is.

Test call I-009 through the Larkfield IVR, 52 seconds, on a phone line (8,000 samples a second). Both voices are synthetic. The caller is Kokoro (voice bm_george). The IVR is Piper, trained on the LJ Speech corpus. We placed the caller’s recorded turns and the IVR’s prompts at the times of the recorded test run.

Listen to the French sentence in the welcome: the IVR says it with its English voice, so a French caller hears French with an American accent. This is a real flaw, and we keep it on purpose. You learn why it happens, and how a better welcome avoids it, in Text-to-speech for prompts.

Transcript (seconds from the start of the call):

  • 0 s, IVR: “Welcome to Larkfield. You are talking to an automated assistant. For English, say English or press 1. Pour le français, dites français ou appuyez sur 2.”
  • 10.98 s, caller: “English.”
  • 14.2 s, IVR: “How can I help? Say order status, opening hours, or start a return. You can also press 1 for orders, 2 for opening hours, 3 for returns, or 0 for a person.”
  • 25.05 s, caller: “Where is my order?”
  • 28.1 s, IVR: “Please say or type your six-digit order number.”
  • 30.88 s, caller: “four seven nine nine zero seven”
  • 34.9 s, IVR: “Order 4 7 9, 9 0 7. Is that right? Say yes or no, or press 1 for yes and 2 for no.”
  • 43.56 s, caller: “Yes.”
  • 46 s, IVR: “Your Cedar raised bed was delivered on May 11. Thank you for calling Larkfield. Goodbye.”

The same call as a picture. Time runs from left to right:

A timeline of call I-009 from 0 to 52 seconds in four rows. State: language, menu, number, confirm, done. IVR says: welcome, menu, number, confirm, status. Caller: four short waveforms after each prompt. IVR heard: English, Where is my order?, 479907, Yes. Yes.
Call I-009 through the states. The top row is the state. The second row is each prompt the IVR plays. The third row is the caller's voice. The bottom row is what the IVR heard (Whisper base), at the moment it decided.
Text description of the diagram

The call moves through five states: language, menu, number, confirm and done. In each state, the IVR plays one prompt, then the caller answers. The IVR heard “English.”, then “Where is my order?”, then “479907.”, then “Yes. Yes.”. Each answer moved the call one state forward. The welcome and the menu prompts are long: together they take more than 20 seconds of the call.

Look at the call record that the IVR wrote at the end. It is the same kind of record that the analytics of Module 6 read:

{"language": "en", "intent": "order_status", "order": "479907",
"outcome": "status_given", "handoff_reason": null,
"heard": ["English.", "Where is my order?", "479907.", "Yes. Yes."],
"prompts": ["welcome", "menu", "number", "confirm", "status"], "misses": 0}

The intent is what the caller wants (order_status). The outcome is how the call ended (status_given). When a person takes over, handoff_reason says why. In this call, nothing went wrong, so it is empty.

Tomás, the AI engineer, does not like menus. “Why build a phone menu at all? A language model can talk about anything.” It is a fair question, and Module 8 answers it with measurements. Here are the menu’s three strengths, which any replacement must keep.

The map of states is the whole program. You can read it, draw it and test every path. The IVR never invents a promise, because every sentence it says is written in advance.

A menu runs on a small server. Its speech recognition is a small Whisper model on a CPU, and its voice is Piper on the same CPU. Larkfield’s cost table counts the IVR’s compute at about US$0.002 a call (an assumption). A person costs US$4.00 a call.

A menu can only do the few things it was built for: read an order status, read the opening hours, start a return. When it is not sure, it passes the call to a person. It cannot be talked into refunding an order.

Callers do not hate menus. They hate bad ones. Four mistakes make most of the anger:

  1. Long prompts. The caller must listen to every option before they can choose. Our own welcome takes about 11 seconds, and our menu about 11 more. That is already long. The next lesson measures it and makes it shorter.
  2. No way out. The caller wants a person, and the menu never offers one. Every Larkfield state accepts 0 for a person.
  3. Asking the same thing again. The caller types their order number, and then the person who answers asks for it again. The Larkfield IVR passes what it heard to the person.
  4. Not understanding. The caller says “my parcel never came”, and the menu says “Sorry, I did not understand”. Speech recognition and good intent rules reduce this, and the fallback to the keypad catches the rest.

How to tell a good IVR from a bad one: four measures

Section titled “How to tell a good IVR from a bad one: four measures”

“Do the callers like it?” is hard to measure on every call. These four numbers are easy to measure, and together they tell most of the story.

Containment is the share of calls that the IVR finishes by itself, without a person. The name comes from contact centres: the call is “contained” in the self-service system. Higher is better, but only if the answers are right.

Handling time is how long a call takes. For an IVR, the useful version is the time to the answer: how many seconds a contained caller waits before they hear what they called for. Long prompts and repeated questions make it worse.

A hang-up is a caller who ends the call before the IVR answers or a person takes over. Each one is a caller who will likely call again, angry. Larkfield counts a hang-up at US$8 (an assumption).

A wrong intent is a call where the IVR understood the wrong need. For example, the caller asked for an order status, and the IVR started a return. In a large contact centre, the same mistake sends a caller to the wrong team, a wrong transfer. Larkfield has one team, so it measures wrong intents. A wrong action costs US$15 (an assumption), more than a call to a person.

Here are ten imagined calls, to see how the four numbers come out. They are constructed, not measured.

Call What the caller wanted What the IVR did Seconds to the answer
1 Order status Gave the status 46
2 Opening hours Gave the hours 27
3 Order status Gave the status 52
4 Return Passed to a person (order not returnable) –
5 Order status Passed to a person (number not understood) –
6 A person Passed to a person –
7 Opening hours Gave the hours 39
8 Order status Started a return (wrong intent) –
9 Something unclear Passed to a person –
10 Order status The caller hung up –

Count each measure:

  • Containment: calls 1, 2, 3 and 7 were finished by the IVR with the right answer. That is 4 of 10, or 40%. Call 8 is not counted: a wrong answer is not containment.
  • Time to the answer: (46 + 27 + 52 + 39) ÷ 4 = 41 seconds.
  • Hang-ups: call 10, so 1 of 10.
  • Wrong intents: call 8, so 1 of 10.
  • To a person: calls 4, 5, 6 and 9, so 4 of 10.

Now the cost, with Larkfield’s assumptions. The four calls to a person cost 4 × US$4 = US$16. The hang-up costs US$8. The wrong return costs US$15. So the one wrong intent costs almost as much as four calls to a person. When the IVR is not sure, a person is the cheaper choice. That rule shapes every state of the map.

You cannot test a phone line by calling it a hundred times yourself. So the course has 100 recorded IVR test calls: 60 public ones for your work, 20 hidden ones for a final check, and 20 for the final assignment. Each test call holds only the caller’s side: one short recording per turn (speech, keypad tones or silence). It also holds the expected result: the language, the intent, the outcome and the order number.

The calls are synthetic: open text-to-speech voices read the callers’ turns, and our code added the phone line. There are 13 kinds of test call. For example: a status asked by keypad or by speech, an order number with a long pause, a caller who changes their mind, a silent caller, and a caller who asks for a person. Every number in this module is measured on these calls, so it is “on Larkfield’s synthetic calls”. Real callers are harder.

Build one when many calls ask the same few simple questions, and the answers come from a system you trust (the order system). A wrong answer must also be easy to avoid. Larkfield’s out-of-hours line fits.

Do not build one when most callers have a different, complex problem, such as a damaged item or a billing dispute. Do not build one either when callers are upset and need a person. A menu then only delays the person they need.

What it costs: the server and its models are cheap. The real cost is the work: writing short prompts, handling every miss, and testing every path with recorded calls. The rest of this module does that work.

Common mistake

Containment that hides angry callers

Symptom: a team reports “containment 80%!” after a month. Complaints rise at the same time.

Cause: they counted every call that did not reach a person as contained. That included callers who hung up after the third “Sorry, I did not understand”, and callers who got a wrong answer.

Fix: count a call as contained only when the IVR gave the right answer. Report hang-ups and wrong intents next to containment, every time. A test set with the expected outcome of each call makes this possible.

Consequence in AI work: one number can always be gamed. Report it with the numbers that show its cost, the way a recall is reported with its precision.

Check your understanding

Twenty calls: 7 got the right answer from the IVR, 2 got a wrong answer, 3 hung up, and 8 were passed to a person. What is the containment?

Show the answer

35%: only the 7 calls with the right answer count, so 7 ÷ 20 = 0.35. The 2 wrong answers are wrong intents (10%), and the 3 hang-ups are 15%. They do not count as contained, even though no person worked on them.

Check your understanding

The IVR is in the Confirm state and reads back the order number. The caller says "no". Where does the call go next, and why not straight to a person?

Show the answer

Back to Order number, to ask again in a different way (“please type it on your keypad”). A “no” is a miss. After the first miss the IVR tries once more, because the IVR may have misheard the caller. After a second miss, a person takes over.

Check your understanding

With Larkfield's costs (a person US$4, a wrong action US$15), why should an unsure IVR pass the call to a person instead of guessing?

Show the answer

A guess that is wrong costs US$15, almost four times the US$4 of a call to a person. A guess that is right saves only US$4. So the IVR should act only when it is confident, for example after the caller confirms the order number. It should pass every unsure call to a person.

Recap

  • An IVR is a phone line that reacts to what the caller says or presses. It is a state machine: in each state it plays a prompt and listens.
  • A no-input (silence) and a no-match (an answer that does not fit) are misses. Ask again in a different way once, then pass the call to a person.
  • A menu is predictable, cheap and safe. Callers hate long prompts, no way out, repeated questions and “Sorry, I did not understand”.
  • Measure containment (right answers only), time to the answer, hang-ups and wrong intents, always together.
  • With Larkfield’s costs, a wrong action (US$15) costs more than a person (US$4): an unsure IVR passes the call on.

You can now draw an IVR as a map of states and say how to judge it. But an IVR speaks, and our welcome already takes about 11 seconds. Next, you give the IVR its voice, and you make its prompts short and clear on a phone line.

Next: Text-to-speech for prompts