Skip to main content
voice is written by set voice.*, or its greeting by the wizard when the project has a number. It becomes spec.voice in .telnyx/index.ts, and four functions in managed/voice.ts read it:
  • answerOptions is what the voice class passes to the voice() mixin’s answer when the media socket opens, as The Call Webhook shows.
  • speechOptionsFor feeds speechProvidersFor, which builds the STT and TTS providers.
  • defaultGreeting is returned by the voice class’s greeting, and spoken when the call is answered.
  • harnessOnCalls chooses the turn engine, the direct engine in managed/direct-turn.ts by default and the harness when voice.harness is true.
answerOptions(spec) sets the mixin’s call options.
  • eager is on unless voice.eager is false. A turn then starts on STT’s first guess that the caller has finished, and its audio is held until the guess is confirmed.
  • bargeIn and keypressInterrupts are passed only when voice sets them, and the mixin’s own defaults apply otherwise.
speechProvidersFor hands the speech options to the runtime SDK:
telnyxSpeechProviders(options) is the Telnyx STT and TTS pair from @telnyx/edge-runtime/voice. Its recognizer option tunes STT and its synthesizer option tunes TTS. Both reach Telnyx over the runtime’s own connection, with no credential in the class. A fifth, fillerOptions in managed/filler.ts, reads voice.filler:
fillerOptions is what the voice class’s reply uses to say one short phrase when the model is slow to start. DEFAULT_FILLER_AFTER_MS is 700, and the default phrases are “One moment.”, “Let me check that for you.” and “Sure, just a second.”. The Voice Loop is where the phrase is spoken. Voice is the user-facing side of the same fields.