/telnyx-voice-advanced-javascript
Advanced call control features including DTMF sending, SIPREC recording, noise suppression, client state, and supervisor controls. This skill provides JavaScript SDK examples.
$ npx -y skills add team-telnyx/ai --skill telnyx-voice-advanced-javascript --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/telnyx-voice-advanced-javascript
Context preview
The summary Claude sees to decide when to auto-load this skill.
Advanced call control features including DTMF sending, SIPREC recording, noise suppression, client state, and supervisor controls. This skill provides JavaScript SDK examples.
SKILL.md
telnyx-voice-advanced-javascript.SKILL.mdname: telnyx-voice-advanced-javascript
description: >-
Advanced call control features including DTMF sending, SIPREC recording, noise
suppression, client state, and supervisor controls. This skill provides
JavaScript SDK examples.
metadata:
author: telnyx
product: voice-advanced
language: javascript
generated_by: telnyx-openapi-pipeline
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
Telnyx Voice Advanced - JavaScript
Installation
npm install telnyx@6.74.2
Setup
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.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:
try {
const result = await client.messages.send({ to: '+13125550001', from: '+13125550002', text: 'Hello' });
} catch (err) {
if (err instanceof Telnyx.APIConnectionError) {
console.error('Network error — check connectivity and retry');
} else if (err instanceof Telnyx.RateLimitError) {
// 429: rate limited — wait and retry with exponential backoff
const retryAfter = err.headers?.['retry-after'] || 1;
await new Promise(r => setTimeout(r, retryAfter * 1000));
} else if (err instanceof Telnyx.APIError) {
console.error(`API error ${err.status}: ${err.message}`);
if (err.status === 422) {
console.error('Validation error — check required fields and formats');
}
}
}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).
Join AI Assistant Conversation
Add a participant to an existing AI assistant conversation. Use this command to bring an additional call leg into a running AI conversation.
`POST /calls/{call_control_id}/actions/ai_assistant_join` — Required: `conversation_id`, `participant`
Optional: `client_state` (string), `command_id` (string)
const response = await client.calls.actions.joinAIAssistant('call_control_id', {
conversation_id: 'v3:abc123',
participant: { id: 'v3:abc123def456', role: 'user' },
});
console.log(response.data);Returns: `conversation_id` (uuid), `result` (string)
Update client state
Updates client state
`PUT /calls/{call_control_id}/actions/client_state_update` — Required: `client_state`
const response = await client.calls.actions.updateClientState('call_control_id', {
client_state: 'aGF2ZSBhIG5pY2UgZGF5ID1d',
});
console.log(response.data);Returns: `result` (string)
Start Conversation Relay
Start a Conversation Relay session on an active call. Conversation Relay connects the call audio to your WebSocket so your application can exchange realtime messages with the caller while Telnyx handles speech recognition and text-to-speech. Only one AI Assistant or Conversation Relay session can be active on a call at a time.
`POST /calls/{call_control_id}/actions/conversation_relay_start`
Optional: `assistant` (object), `client_state` (string), `command_id` (string), `conversation_relay_dtmf_detection` (boolean), `conversation_relay_settings` (object), `conversation_relay_url` (string), `custom_parameters` (object), `dtmf_detection` (boolean), `greeting` (string), `interruptible` (enum: none, any, speech, dtmf), `interruptible_greeting` (enum: none, any, speech, dtmf), `interruption_settings` (object), `language` (string), `languages` (array[object]), `provider` (string), `structured_provider` (object), `transcription` (object), `transcription_engine` (enum: Google, Telnyx, Deepgram, Azure, xAI, AssemblyAI, Speechmatics, Soniox, A, B), `transcription_engine_config` (object), `tts_provider` (string), `url` (string), `voice` (string), `voice_settings` (object)
const response = await client.calls.actions.startConversationRelay('v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ');
console.log(response.data);Returns: `conversation_relay_id` (string), `result` (string)
Stop Conversation Relay
Stop the active Conversation Relay session on a call.
`POST /calls/{call_control_id}/actions/conversation_relay_stop`
Optional: `client_state` (string), `command_id` (string)
const response = await client.calls.actions.stopConversationRelay('v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ');
console.log(response.data);Returns: `result` (string)
Send DTMF
Sends DTMF tones from this leg. DTMF tones will be heard by the other end of the call. **Expected Webhooks:**
There are no webhooks associated with this command.
`POST /calls/{call_control_id}/actions/send_dtmf` — Required: `digits`
Optional: `client_state` (string), `command_id` (string), `duration_millis` (int32)
const response = await client.calls.actions.sendDtmf('call_control_id', { digits: '1www2WABCDw9' });
console.log(response.data);Returns: `result` (string)
SIPREC start
Start siprec session to configured in SIPREC connector SRS.
**Expected Webhooks:**
- `siprec.started`
- `siprec.stopped`
- `siprec.failed`
`POST /calls/{call_control_id}/actions/siprec_start`
Optional: `client_state` (string), `connector_name` (string), `include_metadata_custom_headers` (boolean), `secure` (boolean), `session_timeout_secs` (integer), `sip_transport` (enum: udp, tcp, tls), `siprec_track` (enum: inbound_track, outbound_track, both_tracks)
const response = await client.calls.actions.startSiprec('v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ');
console.log(response.data);Returns: `result` (string)
SIPREC stop
Stop SIPREC session. **Expected Webhooks:**
- `siprec.stopped`
`POST /calls/{call_control_id}/actions/siprec_stop`
Op
Read more
name: telnyx-voice-advanced-javascript description: >- Advanced call control features including DTMF sending, SIPREC recording, noise suppression, client state, and supervisor controls. This skill provides JavaScript SDK examples. metadata: author: telnyx product: voice-advanced language: javascript generated_by: telnyx-openapi-pipeline
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
Telnyx Voice Advanced - JavaScript
Installation
npm install telnyx@6.74.2
Setup
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.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:
try {
const result = await client.messages.send({ to: '+13125550001', from: '+13125550002', text: 'Hello' });
} catch (err) {
if (err instanceof Telnyx.APIConnectionError) {
console.error('Network error — check connectivity and retry');
} else if (err instanceof Telnyx.RateLimitError) {
// 429: rate limited — wait and retry with exponential backoff
const retryAfter = err.headers?.['retry-after'] || 1;
await new Promise(r => setTimeout(r, retryAfter * 1000));
} else if (err instanceof Telnyx.APIError) {
console.error(`API error ${err.status}: ${err.message}`);
if (err.status === 422) {
console.error('Validation error — check required fields and formats');
}
}
}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).
Join AI Assistant Conversation
Add a participant to an existing AI assistant conversation. Use this command to bring an additional call leg into a running AI conversation.
`POST /calls/{call_control_id}/actions/ai_assistant_join` — Required: `conversation_id`, `participant`
Optional: `client_state` (string), `command_id` (string)
const response = await client.calls.actions.joinAIAssistant('call_control_id', {
conversation_id: 'v3:abc123',
participant: { id: 'v3:abc123def456', role: 'user' },
});
console.log(response.data);Returns: `conversation_id` (uuid), `result` (string)
Update client state
Updates client state
`PUT /calls/{call_control_id}/actions/client_state_update` — Required: `client_state`
const response = await client.calls.actions.updateClientState('call_control_id', {
client_state: 'aGF2ZSBhIG5pY2UgZGF5ID1d',
});
console.log(response.data);Returns: `result` (string)
Start Conversation Relay
Start a Conversation Relay session on an active call. Conversation Relay connects the call audio to your WebSocket so your application can exchange realtime messages with the caller while Telnyx handles speech recognition and text-to-speech. Only one AI Assistant or Conversation Relay session can be active on a call at a time.
`POST /calls/{call_control_id}/actions/conversation_relay_start`
Optional: `assistant` (object), `client_state` (string), `command_id` (string), `conversation_relay_dtmf_detection` (boolean), `conversation_relay_settings` (object), `conversation_relay_url` (string), `custom_parameters` (object), `dtmf_detection` (boolean), `greeting` (string), `interruptible` (enum: none, any, speech, dtmf), `interruptible_greeting` (enum: none, any, speech, dtmf), `interruption_settings` (object), `language` (string), `languages` (array[object]), `provider` (string), `structured_provider` (object), `transcription` (object), `transcription_engine` (enum: Google, Telnyx, Deepgram, Azure, xAI, AssemblyAI, Speechmatics, Soniox, A, B), `transcription_engine_config` (object), `tts_provider` (string), `url` (string), `voice` (string), `voice_settings` (object)
const response = await client.calls.actions.startConversationRelay('v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ');
console.log(response.data);Returns: `conversation_relay_id` (string), `result` (string)
Stop Conversation Relay
Stop the active Conversation Relay session on a call.
`POST /calls/{call_control_id}/actions/conversation_relay_stop`
Optional: `client_state` (string), `command_id` (string)
const response = await client.calls.actions.stopConversationRelay('v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ');
console.log(response.data);Returns: `result` (string)
Send DTMF
Sends DTMF tones from this leg. DTMF tones will be heard by the other end of the call. **Expected Webhooks:**
There are no webhooks associated with this command.
`POST /calls/{call_control_id}/actions/send_dtmf` — Required: `digits`
Optional: `client_state` (string), `command_id` (string), `duration_millis` (int32)
const response = await client.calls.actions.sendDtmf('call_control_id', { digits: '1www2WABCDw9' });
console.log(response.data);Returns: `result` (string)
SIPREC start
Start siprec session to configured in SIPREC connector SRS.
**Expected Webhooks:**
- `siprec.started`
- `siprec.stopped`
- `siprec.failed`
`POST /calls/{call_control_id}/actions/siprec_start`
Optional: `client_state` (string), `connector_name` (string), `include_metadata_custom_headers` (boolean), `secure` (boolean), `session_timeout_secs` (integer), `sip_transport` (enum: udp, tcp, tls), `siprec_track` (enum: inbound_track, outbound_track, both_tracks)
const response = await client.calls.actions.startSiprec('v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ');
console.log(response.data);Returns: `result` (string)
SIPREC stop
Stop SIPREC session. **Expected Webhooks:**
- `siprec.stopped`
`POST /calls/{call_control_id}/actions/siprec_stop`
Op
This repo is the one-stop shop for AI Agents and AI-first developers building with Telnyx — everything an agent needs to build production-grade applications and manage its account, from signup to funding.
Repo: team-telnyx/ai
Other skills on team-telnyx-ai.
- /telnyx-ai-assistants-curl
AI voice assistants with custom instructions, knowledge bases, and tool integrations.
Open skill - /telnyx-ai-assistants-go
AI voice assistants with custom instructions, knowledge bases, and tool integrations.
Open skill - /telnyx-ai-assistants-java
AI voice assistants with custom instructions, knowledge bases, and tool integrations.
Open skill - /telnyx-ai-assistants-javascript
AI voice assistants with custom instructions, knowledge bases, and tool integrations.
Open skill - /telnyx-ai-assistants-python
AI voice assistants with custom instructions, knowledge bases, and tool integrations.
Open skill - /telnyx-ai-assistants-ruby
AI voice assistants with custom instructions, knowledge bases, and tool integrations.
Open skill

