v52

latestOpenAPI 3.1.0raw.githubusercontent.com2026-07-311,1941,9384.1 MB
Call Commands

Answer call

Answer an incoming call. You must issue this command before executing subsequent commands on an incoming call.

Expected Webhooks:

  • call.answered
  • call.hold and call.unhold if the call is held/unheld
  • call.deepfake_detection.result if deepfake_detection was enabled
  • call.deepfake_detection.error if deepfake_detection was enabled and an error occurred
  • streaming.started, streaming.stopped or streaming.failed if stream_url was set

When the record parameter is set to record-from-answer, the response will include a recording_id field.

post/calls/{call_control_id}/actions/answer

Path parameters

call_control_idstring required

Unique identifier and token for controlling the call

Request body

billing_group_idstring uuid

Use this field to set the Billing Group ID for the call. Must be a valid and existing Billing Group ID.

client_statestring

Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string.

command_idstring

Use this field to avoid duplicate commands. Telnyx will ignore any command with the same command_id for the same call_control_id.

preferred_codecs'G722,PCMU,PCMA,G729,OPUS,VP8,H264'

The list of comma-separated codecs in a preferred order for the forked media to be received.

record'record-from-answer'

Start recording automatically after an event. Disabled by default.

record_channels'single' | 'dual'

Defines which channel should be recorded ('single' or 'dual') when record is specified.

record_custom_file_namestring

The custom recording file name to be used instead of the default call_leg_id. Telnyx will still add a Unix timestamp suffix.

record_format'wav' | 'mp3'

Defines the format of the recording ('wav' or 'mp3') when record is specified.

record_max_lengthinteger

Defines the maximum length for the recording in seconds when record is specified. The minimum value is 0. The maximum value is 43200. The default value is 0 (infinite).

record_timeout_secsinteger

The number of seconds that Telnyx will wait for the recording to be stopped if silence is detected when record is specified. The timer only starts when the speech is detected. Please note that call transcription is used to detect silence and the related charge will be applied. The minimum value is 0. The default value is 0 (infinite).

record_track'both' | 'inbound' | 'outbound'

The audio track to be recorded. Can be either both, inbound or outbound. If only single track is specified (inbound, outbound), channels configuration is ignored and it will be recorded as mono (single channel).

record_trim'trim-silence'

When set to trim-silence, silence will be removed from the beginning and end of the recording.

send_silence_when_idleboolean

Generate silence RTP packets when no transmission available.

stream_bidirectional_codec'PCMU' | 'PCMA' | 'G722' | 'OPUS' | 'AMR-WB' | 'L16'

Indicates codec for bidirectional streaming RTP payloads. Used only with stream_bidirectional_mode=rtp. Case sensitive.

stream_bidirectional_mode'mp3' | 'rtp'

Configures method of bidirectional streaming (mp3, rtp).

stream_bidirectional_target_legs'both' | 'self' | 'opposite'

Specifies which call legs should receive the bidirectional stream audio.

stream_codec'PCMU' | 'PCMA' | 'G722' | 'OPUS' | 'AMR-WB' | 'L16' | 'default'

Specifies the codec to be used for the streamed audio. When set to 'default' or when transcoding is not possible, the codec from the call will be used.

stream_track'inbound_track' | 'outbound_track' | 'both_tracks'

Specifies which track should be streamed.

stream_urlstring

The destination WebSocket address where the stream is going to be delivered.

transcriptionboolean

Enable transcription upon call answer. The default value is false.

webhook_retries_policiesobject

A map of event types to retry policies. Each retry policy contains an array of retries_ms specifying the delays between retry attempts in milliseconds. Maximum 5 retries, total delay cannot exceed 60 seconds.

webhook_urlstring

Use this field to override the URL for which Telnyx will send subsequent webhooks to for this call.

webhook_url_method'POST' | 'GET'

HTTP request type used for webhook_url.

webhook_urlsobject

A map of event types to webhook URLs. When an event of the specified type occurs, the webhook URL associated with that event type will be called instead of webhook_url. Events not mapped here will use the default webhook_url.

webhook_urls_method'POST' | 'GET'

HTTP request method to invoke webhook_urls.

Example request

{
  "assistant": {
    "greeting": "Hi, I'm your assistant. How can I help?",
    "id": "asst_123",
    "tools": [
      {
        "hangup": {},
        "type": "hangup"
      }
    ]
  },
  "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
  "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",
  "deepfake_detection": {
    "enabled": true,
    "rtp_timeout": 30,
    "timeout": 15
  },
  "send_silence_when_idle": true,
  "webhook_url": "https://www.example.com/server-b/",
  "webhook_url_method": "POST"
}

Response

Successful response upon making a call control command that includes recording_id.

Example response

{
  "data": {
    "recording_id": "d7e9c1d4-8b2a-4b8f-b3a7-9a671c9e9b0a",
    "result": "ok"
  }
}