Answer call
Answer an incoming call. You must issue this command before executing subsequent commands on an incoming call.
Expected Webhooks:
call.answeredcall.holdandcall.unholdif the call is held/unheldcall.deepfake_detection.resultifdeepfake_detectionwas enabledcall.deepfake_detection.errorifdeepfake_detectionwas enabled and an error occurredstreaming.started,streaming.stoppedorstreaming.failedifstream_urlwas set
When the record parameter is set to record-from-answer, the response will include a recording_id field.
Documentation Index
Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
Use this file to discover all available pages before exploring further.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Unique identifier and token for controlling the call
Body
Answer call request
AI Assistant configuration. All fields except id are optional — the assistant's stored configuration will be used as fallback for any omitted fields.
Starts a Conversation Relay session automatically when the answered/dialed call is answered. This embedded shape is supported on answer and dial. It uses public field names (url, dtmf_detection, greeting, voice, language, etc.) and maps them to the underlying Conversation Relay action. client_state, tts_language, and transcription_language inside this object are ignored; use the parent command's client_state and command_id fields instead.
{
"url": "wss://example.com/conversation-relay",
"dtmf_detection": true,
"greeting": "Hi! Ask me anything!",
"voice": "Telnyx.KokoroTTS.af",
"tts_provider": "telnyx",
"voice_settings": { "type": "telnyx" },
"language": "en-US",
"languages": [
{
"language": "en-US",
"voice": "Telnyx.Ultra.alloy",
"tts_provider": "telnyx",
"transcription_engine": "Deepgram",
"transcription_engine_config": { "transcription_model": "deepgram/nova-3" }
}
],
"interruptible": "speech",
"interruptible_greeting": "dtmf",
"custom_parameters": { "customer_id": "12345" }
}Use this field to set the Billing Group ID for the call. Must be a valid and existing Billing Group ID.
"f5586561-8ff0-4291-a0ac-84fe544797bd"
Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string.
"aGF2ZSBhIG5pY2UgZGF5ID1d"
Use this field to avoid duplicate commands. Telnyx will ignore any command with the same command_id for the same call_control_id.
"891510ac-f3e4-11e8-af5b-de00688a4901"
Custom headers to be added to the SIP INVITE response.
[
{ "name": "head_1", "value": "val_1" },
{ "name": "head_2", "value": "val_2" }
]The list of comma-separated codecs in a preferred order for the forked media to be received.
G722,PCMU,PCMA,G729,OPUS,VP8,H264 "G722,PCMU,PCMA,G729,OPUS,VP8,H264"
SIP headers to be added to the SIP INVITE response. Currently only User-to-User header is supported.
[
{ "name": "User-to-User", "value": "value" }
]Use this field to modify sound effects, for example adjust the pitch.
{
"pitch": 0.8,
"semitone": -2,
"octaves": 0.1,
"track": "both"
}The destination WebSocket address where the stream is going to be delivered.
"wss://www.example.com/websocket"
Specifies which track should be streamed.
inbound_track, outbound_track, both_tracks "both_tracks"
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.
PCMU, PCMA, G722, OPUS, AMR-WB, L16, default "PCMA"
Configures method of bidirectional streaming (mp3, rtp).
mp3, rtp "rtp"
Indicates codec for bidirectional streaming RTP payloads. Used only with stream_bidirectional_mode=rtp. Case sensitive.
PCMU, PCMA, G722, OPUS, AMR-WB, L16 "G722"
Specifies which call legs should receive the bidirectional stream audio.
both, self, opposite "both"
Generate silence RTP packets when no transmission available.
true
Use this field to override the URL for which Telnyx will send subsequent webhooks to for this call.
"https://www.example.com/server-b/"
HTTP request type used for webhook_url.
POST, GET "GET"
Enable transcription upon call answer. The default value is false.
true
{
"transcription_engine": "Google",
"transcription_engine_config": {
"transcription_engine": "Google",
"language": "en"
},
"client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
"command_id": "891510ac-f3e4-11e8-af5b-de00688a4901"
}Start recording automatically after an event. Disabled by default.
record-from-answer "record-from-answer"
Defines which channel should be recorded ('single' or 'dual') when record is specified.
single, dual "single"
Defines the format of the recording ('wav' or 'mp3') when record is specified.
wav, mp3 "wav"
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).
1000
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).
100
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).
both, inbound, outbound "outbound"
When set to trim-silence, silence will be removed from the beginning and end of the recording.
trim-silence "trim-silence"
The custom recording file name to be used instead of the default call_leg_id. Telnyx will still add a Unix timestamp suffix.
1 - 40"my_recording_file_name"
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.
{
"call.hangup": "https://www.example.com/webhooks/hangup",
"call.bridge": "https://www.example.com/webhooks/bridge"
}HTTP request method to invoke webhook_urls.
POST, GET "POST"
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.
{
"call.hangup": { "retries_ms": [1000, 2000, 5000] }
}Enables deepfake detection on the call. When enabled, audio from the remote party is streamed to a detection service that analyzes whether the voice is AI-generated. Results are delivered via the call.deepfake_detection.result webhook.
Response
Successful response upon making a call control command that includes recording_id.
{
"result": "ok",
"recording_id": "d7e9c1d4-8b2a-4b8f-b3a7-9a671c9e9b0a"
}