← Back to Blog

We Built the Call Ourselves

For most of this year our phone assistant ran on a managed voice product: a hosted agent that took the call, understood the caller, and reached into our platform through a set of tools to check availability and book. It was a reasonable way to start. The provider handled the telephone network, the speech, the turn-taking. We handled the calendar and the record. On Friday evening we switched it off, and as of last night a caller to our line is talking to code we wrote.

This is a post about why, because the why is the part that generalizes.

Where the managed route failed

Three things, in the order we found them. First, the product could not be copied for a second clinic. Each clinic needed its own agent, and the path for cloning one produced an agent that looked identical in every setting and whose tools never fired. We reproduced it and built each agent by hand instead; that does not scale past a handful of clinics and we knew it. Second, the product had no Canadian region. A clinic in Alberta could use it only by accepting that the voice processing happened in the United States, which is a disclosure we can make but would rather not have to. Third, and the one I underrated at the start: the record of the call depended on the agent remembering to call us. When it forgot, or hung up abruptly, our live monitor showed a call that had ended ten minutes ago, and the length of a call was never recorded, because the product never told us when it ended.

Each of those is the same problem wearing a different coat. The call was not ours. We were a set of tools at the end of someone else's conversation.

What owning the call means

Now the carrier delivers the call's audio to a service we run, and that service holds the whole conversation. It speaks the carrier's own protocol — the handshake, the stream of twenty-millisecond audio frames, the signatures on every webhook. It does the telephone audio arithmetic itself, from the carrier's narrow eight-kilohertz sound to what the model listens at and back. It opens a live session with the model, plays the greeting, and runs the same booking operations the old agent used, as the call's own tools. It screens every finished sentence the caller says before any write is allowed to happen. It transfers the call to a person on one sentence. And when the call ends, it is the service, not the model, that writes the record: how the call ended, how long it was, what was done.

The call is never recorded. The code itself refuses the carrier's recording options, and a check in our build fails if anyone ever adds one. What remains afterwards is the clinic's record, in the clinic's silo.

THE TRADE A managed product gives you the telephone, the speech and the turn-taking for free, and keeps the call. Owning the call means owning all three. We now maintain a carrier protocol, a stack of audio filters and a live model session that used to be someone else's problem. In exchange, nothing about a patient's phone call happens anywhere we cannot see, record or stop.

The first night

We built the replacement in two days, deliberately in one piece rather than as a prototype first, because the prototype would have been thrown away and the real thing had to carry the same guarantees as the rest of the platform from its first call. The nightly check got a new step the same day: it places a synthetic call on both of our synthetic clinics, through the real carrier protocol, and judges the result the way it judges everything else. Last night was its first run. On both clinics the greeting came back, the model answered 477 milliseconds after the caller stopped speaking, the session ended as a hang-up, and one call record landed with a real duration in it. A duration. After months without one.

It also found three things we had got wrong, which is what it is for: a storage permission the phone service lacked, a count that waited on something it should not have, and a first call on a freshly started instance that took eight and a half seconds to greet where a warm one took one and a half. All three were fixed by the afternoon. I will write about what the check saw in a separate post, because it deserves one.

What this means for a clinic

A clinic's phone line is the place a patient meets the practice first and most often. For it to be answered by an AI, the clinic has to be able to say where the call goes, who can hear it, whether it is kept, and how a person gets reached. With a managed product, the honest answers to those questions came with asterisks. Now they are one sentence each, and the record that proves them is the clinic's own.

We did not want to own the telephone. It turned out that owning the telephone was the only way to keep the promise.

Want a phone assistant whose call never leaves your hands? Apply for Beta Access.