1Why my mom needed a bot
In the summer of 2023 my mom called Eastlink, a regional telecom in Atlantic Canada, to cancel her cable. They put her on hold. About two hours later she hung up, having talked to no one and cancelled nothing.
When she told me, my first reaction was outrage on her behalf. Two hours is an absurd wait for any service, and she was waiting for permission to stop paying for one. My second reaction was the dangerous one, familiar to anyone who has written a script instead of doing something by hand: I could probably automate that.
Not the cancelling, just the measuring. I wanted to know whether two hours was normal or she'd drawn the short straw, whether there was a best and a worst time to call, and whether you could predict the wait at all. There was, and you could, roughly.
I'd used Twilio before, to send text messages for an earlier project. Going from “send a text” to “make a phone call and sit on hold for an hour” was a smaller step than it should have been. What followed was several weeks of building, debugging, accidentally running up a phone bill and slowly collecting a dataset I doubt anyone at Eastlink wanted to exist.
2How the bot waits on hold
First I had to map Eastlink's phone tree, which meant calling them by hand. The automated menu (an IVR, or Interactive Voice Response system) is three levels deep. After a bilingual greeting you press 3 for English, then 1 for Residential, then 1 again for “Cancel or Modify Service.”
Then I taught a bot to get through it. Twilio's TwiML markup lets you send DTMF tones, the beeps a phone keypad makes, with precise timing. The bot places the call, waits a set number of seconds for the greeting to finish, then sends 3 → 1 → 1. It does this faster and more reliably than a person can.
twilio-ivr-bot v1.0
IdleTarget: +1 (888) 345-1111
Once it's through the menu, the bot waits in the queue. Measuring the wait relies on a slightly inelegant fact: the bot can't talk. It has no voice and nothing to say. When an agent finally answers and hears silence, they do what anyone would: say “Hello?” once or twice, wait a few seconds and hang up. The Flask server checks on the call every second, so it notices when the call ends and records how long it lasted. About two minutes of that is the trip through the menu. The rest is hold.
I know this means an Eastlink agent kept picking up the phone to silence and adding another entry to whatever log they keep for abandoned calls. To those agents: I'm sorry. You were part of a study you never agreed to, and your employer's hold times aren't your fault.
3What's actually in the repo
There are three parts, and they run unattended during business hours: a Next.js dashboard, a small Flask service and a loop in the background that keeps making the call. The GitHub repo is plainer than my memory of it, which helps.
In the committed prototype the scheduler isn't a cron job at all. It's a long-running Flask process that checks the clock on Atlantic Standard Time, places calls only on weekdays between 8 a.m. and 6 p.m., then sleeps for 15 minutes before trying again. That's less clever than I remembered, but a lot of useful software is a loop with limits.
The Flask backend places the outbound call and keeps a tiny state object for the front end. The repo version starts the call through Twilio's REST API, waits through a few fixed pauses, then sends 3 → 1 → 1 as inline TwiML. Instead of waiting for callbacks, the script just polls the call until it ends or times out. It isn't elegant, but it's very easy to follow.
The prototype keeps recent measurements in memory and serves them from a single /call_status endpoint. For the longer run I exported the measurements so the chart had something durable to read. I still didn't use a real database. At this scale, adding one would have been less engineering than performance art.
The Next.js frontend is the part for people. It polls the Flask endpoint, shows the latest status and plots hold time with Chart.js, so nobody has to work out a cancellation strategy from raw timestamps. This was the part I built for my mom.
- Loop in the Flask process checks the clock (08:00–18:00 AST, Mon–Fri)
- Flask places outbound call via Twilio REST API; timer begins
- Inline TwiML sends DTMF tones:
3 → 1 → 1 - Bot enters hold queue
- Agent answers, hears silence, disconnects
- Flask polls the call every second until it ends
- Duration + timestamp kept in a list in memory
- Frontend polls API and re-renders chart
4When to call Eastlink
Over about four weeks the bot placed 224 calls during business hours. Of those, 56 reached an agent, meaning someone answered and then hung up. The rest either went unanswered or ended in Twilio errors.
The pattern was clear, and it repeated every day. Calls between 8 and 9 a.m. averaged three to five minutes on hold, which means the call center is fully staffed at opening, nobody else is calling yet, or both. Waits climbed through the morning to a plateau of about 60 to 90 minutes between noon and 2 p.m., then peaked at 127 to 150 minutes around 3 p.m. By 5 p.m. they were back to roughly 40 minutes as the queue drained before closing.
t (elapsed)
42m 27s
Table 1. The study in numbers. Hold times come from the 56 calls that reached an agent.
| Metric | Value |
|---|---|
| Total calls placed | 224 |
| Successful connections | 56 |
| Optimal call window | 08:00–09:00 |
| Mean hold (08:00–09:00) | 4.2 min |
| Peak hold (observed) | 150 min |
| Peak hour | ~15:00 |
| Twilio cost (total) | $38.47 |
That was useful right away. With four weeks of data in hand, my mom called Eastlink at 8:15 on a Tuesday morning. She reached an agent in seven minutes and cancelled her cable. The whole call took less time than one episode of the TV she was cancelling.
5What went wrong
I'd like to say it worked from the first run. It didn't. The real phone network is hard on software written in an afternoon and tested mostly against my own voicemail.
- The after-hours calls.
- The first version of the scheduler got the time zone wrong, so for three days the bot called Eastlink while the office was closed and reached a recording saying so. Twilio bills by the minute whether or not a person answers, and the recording loops, so the bot listened until it timed out. That came to several dollars for exactly zero useful data points.
- Paying by the minute.
- Twilio charges $0.013 a minute for outbound calls. That sounds like nothing until the bot sits on hold for 150 minutes and a single call costs $1.95. Over 224 calls, the Twilio bill came to $38.47.
- Touch-tone timing.
- The phone tree needs pauses between tones. Send them too fast and the menu misses them. Too slow and it times out and drops you back at the main menu. I found the right timing by calling Eastlink over and over and pressing buttons at different speeds until it worked. The version in the repo waits 45 seconds before the first tone, then 25 seconds and 40 seconds before the next two. That's almost two minutes of menu on every call.
- Knowing when a person picks up.
- Twilio has no API for “a human just picked up the phone.” It can spot answering machines by their cadence, but a customer service agent sounds exactly like a person, because they are one. Getting hung up on works, but it adds a consistent error of about 10–15 seconds, the time between the agent answering and giving up on the silence. When the waits run from 3 to 150 minutes, that's close enough.
- The Twilio number.
- After about 100 calls from the same number to the same Eastlink line, I started to wonder whether Eastlink would flag or block it. I saw no sign that it did, but I didn't test it properly either. If you want to try this yourself, rotate your Twilio numbers, or at least accept that yours may get a reputation.
6Was it worth $38.47 in phone calls?
By any reasonable measure this was an overreaction to a customer service complaint. My mom wanted to cancel her cable. I built a bot that phoned Eastlink for a month, spent $38.47 on API calls and handed her a chart. She could have called at a random time and gotten lucky. She could have driven to the Eastlink office. She could have, as she eventually pointed out, “just waited on hold like a normal person.”
Still, the overkill turned up something real: telecom hold times are predictable. They follow a pattern that repeats every day, and anyone willing to collect the data can know it. Eastlink certainly does, and presumably staffs its call center from similar projections. Customers don't. They call when they call, wait however long they wait and assume it's random.
It isn't random. Call at 8 a.m. and you'll wait five minutes. Call at 3 p.m. and you might wait two and a half hours. A pattern that steady looks like a choice, and a long wait is a good way to make cancelling feel like work. Measuring it with a bot doesn't change that, but I liked making it visible, even if the thing I made visible was a phone queue.
All in, it cost $38.47 in Twilio credit, a $5 DigitalOcean droplet for one month and about 20 hours of my time. My mom cancelled her $89-a-month cable in one short call. You're welcome to work out the return on that. I'd have built it either way. Most of my projects exist because I was curious and slightly annoyed.

