WIP - Add Telnyx voice provider#1461
Conversation
🦋 Changeset detectedLatest commit: 994f090 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
Oliver-Zimmerman
left a comment
There was a problem hiding this comment.
Nice port overall — I think you’ve preserved the core architecture well, especially the split between STT/TTS/telephony and the browser-side PSTN bridge model. My main ask would be to swap the example for one that better shows the real value of the provider: the current example reads mostly like a browser STT/TTS demo, while the distinctive bit here is the phone/PSTN path. I’d suggest porting one of the original phone/hybrid examples instead, e.g. examples/phone-voice-agent: https://github.com/team-telnyx/voice-cloudflare/tree/main/examples/phone-voice-agent”
Summary
Adds first-class Telnyx support for the Cloudflare voice pipeline, addressing #1367.
This PR introduces a new
@cloudflare/voice-telnyxprovider package undervoice-providers/telnyxand a smallexamples/telnyx-voice-agentstarter app.What changed
@cloudflare/voice-telnyxvoice-providers/*conventions.@cloudflare/voice-telnyx@cloudflare/voice-telnyx/stt@cloudflare/voice-telnyx/tts@cloudflare/voice-telnyx/telephonyTranscriber/TranscriberSession:TTSProviderandStreamingTTSProvider:TelnyxCallBridgeTelnyxPhoneTransportTelnyxPhoneClientTelnyxJWTEndpointcreateTelnyxVoiceConfigExample app
examples/telnyx-voice-agent, a compact starter using:useVoiceAgentfor browser microphone/audio UX.env.examplewith:TELNYX_API_KEYTELNYX_CREDENTIAL_CONNECTION_IDfor telephony experimentsAttribution / dependency metadata
@telnyx/webrtcfor telephony support.NOTICEto document that parts of this provider are adapted from Telnyx's@telnyx/voice-cloudflarepackage, whose npm metadata declares MIT licensing.Validation
Passed:
Also ran:
That currently fails on existing
packages/ai-chattype errors unrelated to this PR, including missing exports fromagents/chatandAgentConnection.pathtype mismatches inpackages/ai-chat/src/react-tests/use-agent-chat.test.tsx.Notes for reviewers
TelnyxPhoneTransportexpects server audio as 16 kHz mono PCM16. The README calls out usingwithVoice(Agent, { audioFormat: "pcm16" })and clientpreferredFormat: "pcm16"for PSTN routing.Refs #1367