home / skills / openclaw / skills / telnyx-voice-streaming-java

This skill enables real-time Telnyx voice streaming in Java, for forking media, streaming, and live transcription with code examples.

npx playbooks add skill openclaw/skills --skill telnyx-voice-streaming-java

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.9 KB
---
name: telnyx-voice-streaming-java
description: >-
  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 Java SDK examples.
metadata:
  author: telnyx
  product: voice-streaming
  language: java
  generated_by: telnyx-ext-skills-generator
---

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

# Telnyx Voice Streaming - Java

## Installation

```text
// See https://github.com/team-telnyx/telnyx-java for Maven/Gradle setup
```

## Setup

```java
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

TelnyxClient client = TelnyxOkHttpClient.fromEnv();
```

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

## Forking start

Call forking allows you to stream the media from a call to a specific target in realtime.

`POST /calls/{call_control_id}/actions/fork_start`

```java
import com.telnyx.sdk.models.calls.actions.ActionStartForkingParams;
import com.telnyx.sdk.models.calls.actions.ActionStartForkingResponse;

ActionStartForkingResponse response = client.calls().actions().startForking("call_control_id");
```

## Forking stop

Stop forking a call.

`POST /calls/{call_control_id}/actions/fork_stop`

```java
import com.telnyx.sdk.models.calls.actions.ActionStopForkingParams;
import com.telnyx.sdk.models.calls.actions.ActionStopForkingResponse;

ActionStopForkingResponse response = client.calls().actions().stopForking("call_control_id");
```

## Streaming start

Start streaming the media from a call to a specific WebSocket address or Dialogflow connection in near-realtime.

`POST /calls/{call_control_id}/actions/streaming_start`

```java
import com.telnyx.sdk.models.calls.actions.ActionStartStreamingParams;
import com.telnyx.sdk.models.calls.actions.ActionStartStreamingResponse;

ActionStartStreamingResponse response = client.calls().actions().startStreaming("call_control_id");
```

## Streaming stop

Stop streaming a call to a WebSocket.

`POST /calls/{call_control_id}/actions/streaming_stop`

```java
import com.telnyx.sdk.models.calls.actions.ActionStopStreamingParams;
import com.telnyx.sdk.models.calls.actions.ActionStopStreamingResponse;

ActionStopStreamingResponse response = client.calls().actions().stopStreaming("call_control_id");
```

## Transcription start

Start real-time transcription.

`POST /calls/{call_control_id}/actions/transcription_start`

```java
import com.telnyx.sdk.models.calls.actions.ActionStartTranscriptionParams;
import com.telnyx.sdk.models.calls.actions.ActionStartTranscriptionResponse;
import com.telnyx.sdk.models.calls.actions.TranscriptionStartRequest;

ActionStartTranscriptionParams params = ActionStartTranscriptionParams.builder()
    .callControlId("call_control_id")
    .transcriptionStartRequest(TranscriptionStartRequest.builder().build())
    .build();
ActionStartTranscriptionResponse response = client.calls().actions().startTranscription(params);
```

## Transcription stop

Stop real-time transcription.

`POST /calls/{call_control_id}/actions/transcription_stop`

```java
import com.telnyx.sdk.models.calls.actions.ActionStopTranscriptionParams;
import com.telnyx.sdk.models.calls.actions.ActionStopTranscriptionResponse;

ActionStopTranscriptionResponse response = client.calls().actions().stopTranscription("call_control_id");
```

---

## Webhooks

The following webhook events are sent to your configured webhook URL.
All webhooks include `telnyx-timestamp` and `telnyx-signature-ed25519` headers for verification (Standard Webhooks compatible).

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

Overview

This skill streams call audio in real time from Telnyx calls, forks media to external destinations, and runs live transcription. It includes Java SDK examples showing how to start/stop forking, streaming, and real-time transcription. Use it to feed live audio into analytics, ASR, or AI pipelines for immediate insights and actions.

How this skill works

The skill uses Telnyx call actions to control media flows for a given call_control_id. It triggers APIs to start/stop forking (send media to another SIP/WebRTC target), start/stop streaming to a WebSocket or Dialogflow connection, and start/stop real-time transcription. Webhook events report state changes and transcription data so your application can verify and process incoming audio and transcripts.

When to use it

  • Integrating live speech analytics or sentiment detection into phone calls
  • Sending call audio to an external SIP/WebRTC endpoint or a third-party media processor
  • Feeding live audio into an ASR or voice AI model for real-time responses
  • Recording or duplicating media streams for compliance or monitoring
  • Enabling live transcription for agent assist or captions during calls

Best practices

  • Initialize the Telnyx Java client from environment variables and reuse the client instance across requests
  • Validate webhook signatures using telnyx-signature-ed25519 and timestamp headers for security
  • Use distinct call_control_id values per call and handle idempotency when starting/stopping actions
  • Monitor callStreamingFailed and callForkStopped webhooks to implement retries or fallbacks
  • Limit sensitive data exposure when forwarding media; ensure destination endpoints are secure

Example use cases

  • Real-time transcription displayed to agents for live note-taking and quality control
  • Forking a call to a compliance recorder while the original call continues
  • Streaming call audio to an ML service for live keyword spotting and routing
  • Forwarding audio to Dialogflow for conversational IVR responses during a call
  • Building live captioning for accessibility or remote conferencing

FAQ

What credentials are required to use the Java examples?

Set your Telnyx API key and any required environment variables and initialize the Telnyx client (TelnyxOkHttpClient.fromEnv()).

How do I receive live transcription or streaming results?

Subscribe to webhook events and verify incoming requests using the provided signature and timestamp headers; transcription events contain the live text payloads.