UtteraUttera

Transcribing your Asterisk calls, step by step

September 15, 2026

If you have an Asterisk, you're already recording calls. And almost certainly those recordings are on a disk with nobody listening to them, because listening to them costs as much time as they lasted.

There are two ways to fix that, and it's worth starting with the easy one.

Start here: the calls you already have recorded

You don't have to touch Asterisk. Your phone system writes .wav files into a folder; you point a script at that folder and you have last week's calls transcribed and summarized.

git clone https://github.com/uttera/uttera-examples.git
cd uttera-examples/asterisk/recordings
export UTTERA_API_KEY=sk-echo-...
./transcribe-recording.sh /var/spool/asterisk/monitor/one-call.wav

If that works, bulk-reprocess.sh does the whole folder. It's by far the most common scenario and the one that pays off on day one: finding one sentence inside nine hours of recording stops being an impossible task.

The code is in uttera-examples/asterisk.

The other way: speaking and listening inside the call

Here you do get into the dialplan. There are two AGI scripts: one says a text in the call, and the other hears what the caller says.

cp agi/uttera_agi.py /var/lib/asterisk/agi-bin/
chmod +x /var/lib/asterisk/agi-bin/uttera_agi.py
ln -s uttera_agi.py /var/lib/asterisk/agi-bin/uttera-decir.agi
ln -s uttera_agi.py /var/lib/asterisk/agi-bin/uttera-oir.agi
apt install sox

And the key goes in the service environment, never in the dialplan:

# systemctl edit asterisk
[Service]
Environment=UTTERA_API_KEY=sk-echo-...
Environment=UTTERA_VOZ=nova

This isn't purism. A key written into the dialplan ends up in the backup, in the config repository, and in plain view of anyone with an Asterisk console — who are rarely the same people who should see a billing credential.

The five things that cost a day to find out

They're all solved in the published code. They're written here because reading them takes five minutes and discovering them takes an afternoon.

1. The audio conversion isn't optional. Synthesis generates at 24 kHz and the telephone channel runs at 8 kHz. If you hand the WAV to Asterisk as it is, it plays it at its own rate and the voice comes out fast and high-pitched, like a cartoon. That's why sox converts to .sln — raw PCM at 8 kHz — which is exactly what the channel expects.

2. You have to add silence at the end. Without a few tenths of tail (pad 0 0.4), Asterisk cuts off the last syllable when closing the file. The message is still understood almost every time, which is why it's a bug that survives for months without anyone reporting it.

3. STREAM FILE takes no extension. You give it the base name and it picks whichever format it finds. With an extension, nothing plays and there's no error.

4. Whisper doesn't stay quiet at silence. Send it an empty recording and it doesn't return an empty string: it invents a sentence, usually something like "Thanks for watching", because that abounds in the data it was trained on. The AGI discards recordings below 2,000 bytes before sending them. It saves you paying for a hallucination and, above all, it saves your automation acting on a sentence nobody said.

5. The quoting in SET VARIABLE and VERBOSE. The AGI parser splits on spaces: text without quotes arrives split and the variable keeps only the first word. And a quote inside the text throws off the rest of the line. They have to be escaped before sending.

And a difference in judgement that matters

Telephony timeouts are not API timeouts.

Uttera holds the connection open for up to two hours, because a three-hour recording has to be able to finish. But inside a call there is a person with the phone to their ear, and there two hours isn't a safety margin: it's absurd.

That's why these AGI scripts cut off at 30 seconds. If there's no answer by then, the call is already ruined, and the right thing is to say so and move the flow along, not leave someone listening to silence.

It's the kind of decision that isn't in any API documentation and that decides whether a voice integration is usable or not.

What to do with the text once you have it

The obvious thing is to archive it and be able to search. What really changes the working day is the summary: every call produces a written note with the commitments and the next steps, instead of depending on somebody remembering to write it.

And if that note is going to end up in a CRM or an agent, send the summary and not the transcript: it's twenty to thirty times fewer tokens.

Other phone systems

The scripts in recordings/ have nothing Asterisk-specific about them: they read files from a folder. If your FreePBX, 3CX or Issabel writes recordings into a directory, they work the same pointed there. If you get stuck with yours, write to support@uttera.ai and we'll look at it.

Anything to add or correct? Write to support@uttera.ai. If you correct us, we edit the post and credit you.

← All posts