team-telnyx/telnyx-skills

telnyx-voice-streaming-ruby

>- Stream call audio in real-time, fork media to external destinations, and transcribe speech live. Use for real-time analytics and AI integrations. This skill provides Ruby SDK examples.

First seen Mar 7, 2026

Installation

$ npx skills add team-telnyx/telnyx-skills --skill telnyx-voice-streaming-ruby

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from team-telnyx/telnyx-skills · top by installs.

npx skills add team-telnyx/telnyx-skills

Browse all from team-telnyx/telnyx-skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 188
License LICENSE
Default branch main
Open issues 2
Status Active

Skill metadata

Parsed from SKILL.md frontmatter.

More metadata
author
telnyx
product
voice-streaming
language
ruby
generated_by
telnyx-openapi-pipeline

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 12,862 B
  • docs SUMMARY.md 219 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 9 installs

SKILL.md

<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->

Telnyx Voice Streaming - Ruby

Installation

gem install telnyx

Setup

require "telnyx"

client = Telnyx::Client.new(
  api_key: ENV["TELNYX_API_KEY"], # This is the default and can be omitted
)

All examples below assume client is already initialized as shown above.

Error Handling

All API calls can fail with network errors, rate limits (429), validation errors (422), or authentication errors (401). Always handle errors in production code:

begin
  result = client.messages.send_(to: "+13125550001", from: "+13125550002", text: "Hello")
rescue Telnyx::Errors::APIConnectionError
  puts "Network error — check connectivity and retry"
rescue Telnyx::Errors::RateLimitError
  # 429: rate limited — wait and retry with exponential backoff
  sleep(1) # Check Retry-After header for actual delay
rescue Telnyx::Errors::APIStatusError => e
  puts "API error #{e.status}: #{e.message}"
  if e.status == 422
    puts "Validation error — check required fields and formats"
  end
end

Common error codes: 401 invalid API key, 403 insufficient permissions, 404 resource not found, 422 validation error (check field formats), 429 rate limited (retry with exponential backoff).

Forking start

Call forking allows you to stream the media from a call to a specific target in realtime. This stream can be used to enable realtime audio analysis to support a variety of use cases, including fraud detection, or the creation of AI-generated audio responses. Requests must specify either the target attribute or the rx and tx attributes.

POST /calls/{callcontrolid}/actions/fork_start

Optional: clientstate (string), commandid (string), rx (string), stream_type (enum: decrypted), tx (string)

response = client.calls.actions.start_forking("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ")

puts(response)

Returns: result (string)

Forking stop

Stop forking a call. Expected Webhooks:

  • call.fork.stopped

POST /calls/{callcontrolid}/actions/fork_stop

Optional: clientstate (string), commandid (string), stream_type (enum: raw, decrypted)

response = client.calls.actions.stop_forking("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ")

puts(response)

Returns: result (string)

Streaming start

Start streaming the media from a call to a specific WebSocket address or Dialogflow connection in near-realtime. Audio will be delivered as base64-encoded RTP payload (raw audio), wrapped in JSON payloads. Please find more details about media streaming messages specification under the link.

POST /calls/{callcontrolid}/actions/streaming_start

Optional: clientstate (string), commandid (string), customparameters (array[object]), dialogflowconfig (object), enabledialogflow (boolean), streamauthtoken (string), streambidirectionalcodec (enum: PCMU, PCMA, G722, OPUS, AMR-WB, L16), streambidirectionalmode (enum: mp3, rtp), streambidirectionalsamplingrate (enum: 8000, 16000, 22050, 24000, 48000), streambidirectionaltargetlegs (enum: both, self, opposite), streamcodec (enum: PCMU, PCMA, G722, OPUS, AMR-WB, L16, default), streamtrack (enum: inboundtrack, outboundtrack, bothtracks), stream_url (string)

response = client.calls.actions.start_streaming("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ")

puts(response)

Returns: result (string)

Streaming stop

Stop streaming a call to a WebSocket. Expected Webhooks:

  • streaming.stopped

POST /calls/{callcontrolid}/actions/streaming_stop

Optional: clientstate (string), commandid (string), stream_id (uuid)

response = client.calls.actions.stop_streaming("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ")

puts(response)

Returns: result (string)

Transcription start

Start real-time transcription. Transcription will stop on call hang-up, or can be initiated via the Transcription stop command. Expected Webhooks:

  • call.transcription

POST /calls/{callcontrolid}/actions/transcription_start

Optional: clientstate (string), commandid (string), transcriptionengine (enum: Google, Telnyx, Deepgram, Azure, xAI, AssemblyAI, Speechmatics, Soniox, Parakeet, A, B), transcriptionengineconfig (object), transcriptiontracks (string)

response = client.calls.actions.start_transcription("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ")

puts(response)

Returns: result (string)

Transcription stop

Stop real-time transcription.

POST /calls/{callcontrolid}/actions/transcription_stop

Optional: clientstate (string), commandid (string)

response = client.calls.actions.stop_transcription("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ")

puts(response)

Returns: result (string)


Webhooks

Webhook Verification

Telnyx signs webhooks with Ed25519. Each request includes telnyx-signature-ed25519 and telnyx-timestamp headers. Always verify signatures in production:

# In your webhook handler (e.g., Sinatra — use raw body):
post "/webhooks" do
  payload = request.body.read
  headers = {
    "telnyx-signature-ed25519" => request.env["HTTP_TELNYX_SIGNATURE_ED25519"],
    "telnyx-timestamp" => request.env["HTTP_TELNYX_TIMESTAMP"],
  }
  begin
    event = client.webhooks.unwrap(payload, headers)
  rescue => e
    halt 400, "Invalid signature: #{e.message}"
  end
  # Signature valid — event is the parsed webhook payload
  puts "Received event: #{event.data.event_type}"
  status 200
end

The following webhook events are sent to your configured webhook URL. All webhooks include telnyx-timestamp and telnyx-signature-ed25519 headers for Ed25519 signature verification. Use client.webhooks.unwrap() to verify.

Event Description
callForkStarted Call Fork Started
callForkStopped Call Fork Stopped
callStreamingFailed Call Streaming Failed
callStreamingStarted Call Streaming Started
callStreamingStopped Call Streaming Stopped
transcription Transcription

Webhook payload fields

callForkStarted

Field Type Description
data.record_type enum: event Identifies the type of the resource.
data.event_type enum: call.fork.started The type of event being delivered.
data.id uuid Identifies the type of resource.
data.occurred_at date-time ISO 8601 datetime of when the event occurred.
data.payload.connection_id string Call Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.callcontrolid string Unique ID for controlling the call.
data.payload.calllegid string ID that is unique to the call and can be used to correlate webhook events.
data.payload.callsessionid string ID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state string State received from a command.
data.payload.stream_type enum: decrypted Type of media streamed.

callForkStopped

Field Type Description
data.record_type enum: event Identifies the type of the resource.
data.event_type enum: call.fork.stopped The type of event being delivered.
data.id uuid Identifies the type of resource.
data.occurred_at date-time ISO 8601 datetime of when the event occurred.
data.payload.connection_id string Call Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.callcontrolid string Unique ID for controlling the call.
data.payload.calllegid string ID that is unique to the call and can be used to correlate webhook events.
data.payload.callsessionid string ID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state string State received from a command.
data.payload.stream_type enum: decrypted Type of media streamed.

callStreamingFailed

Field Type Description
data.record_type enum: event Identifies the resource.
data.event_type enum: streaming.failed The type of event being delivered.
data.id uuid Identifies the type of resource.
data.occurred_at date-time ISO 8601 datetime of when the event occurred.
data.payload.callcontrolid string Call ID used to issue commands via Call Control API.
data.payload.connection_id string Call Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.calllegid string ID that is unique to the call and can be used to correlate webhook events.
data.payload.callsessionid string ID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state string State received from a command.
data.payload.failure_reason string A short description explaning why the media streaming failed.
data.payload.stream_id uuid Identifies the streaming.
data.payload.stream_type enum: websocket, dialogflow The type of stream connection the stream is performing.

callStreamingStarted

Field Type Description
data.record_type enum: event Identifies the type of the resource.
data.event_type enum: streaming.started The type of event being delivered.
data.id uuid Identifies the type of resource.
data.occurred_at date-time ISO 8601 datetime of when the event occurred.
data.payload.callcontrolid string Call ID used to issue commands via Call Control API.
data.payload.connection_id string Call Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.calllegid string ID that is unique to the call and can be used to correlate webhook events.
data.payload.callsessionid string ID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state string State received from a command.
data.payload.stream_url string Destination WebSocket address where the stream is going to be delivered.

callStreamingStopped

Field Type Description
data.record_type enum: event Identifies the type of the resource.
data.event_type enum: streaming.stopped The type of event being delivered.
data.id uuid Identifies the type of resource.
data.occurred_at date-time ISO 8601 datetime of when the event occurred.
data.payload.callcontrolid string Call ID used to issue commands via Call Control API.
data.payload.connection_id string Call Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.calllegid string ID that is unique to the call and can be used to correlate webhook events.
data.payload.callsessionid string ID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state string State received from a command.
data.payload.stream_url string Destination WebSocket address where the stream is going to be delivered.

transcription

Field Type Description
data.record_type enum: event Identifies the type of the resource.
data.event_type enum: call.transcription The type of event being delivered.
data.id uuid Identifies the type of resource.
data.occurred_at date-time ISO 8601 datetime of when the event occurred.
data.payload.callcontrolid string Unique identifier and token for controlling the call.
data.payload.calllegid string ID that is unique to the call and can be used to correlate webhook events.
data.payload.callsessionid string ID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state string Use this field to add state to every subsequent webhook.
data.payload.connection_id string Call Control App ID (formerly Telnyx connection ID) used in the call.