Skip to navigation
Agents

Speech helpers

View as MarkdownOpen in Claude

The signalwire.speech module gives the words a voice should say for digits and amounts, and signalwire.speech.spelling reads letters, digits, and email addresses a caller spelled out. All of them work on English text.

The platform normalizes text before its pronunciation rules run, so a bare number is already words by then: add_pronunciation() can’t make "10001" read digit by digit. Put the words these functions return in a say action, or in the tool result the model reads back.

from signalwire.speech import say_digits, say_last_digits, say_money, number_words
from signalwire.speech.spelling import read_spelled, spoken_email, spelling_variants

Numbers

Spelled input

Example

A tool that reads an account number back digit by digit:

from signalwire import AgentBase, FunctionResult
from signalwire.speech import say_digits
agent = AgentBase(name="billing", route="/billing")
def read_account(args, raw_data):
words = say_digits(args["account"], group=4)
return FunctionResult("Read the account number back.").say(
f"Your account number is {words}."
)
agent.define_tool(
"read_account", "Read the caller's account number back",
{"type": "object", "properties": {"account": {"type": "string"}}, "required": ["account"]},
read_account,
)