Dial a number or SIP URI from a given connection. A successful response will include a call_leg_id
which can be used to correlate the command with subsequent webhooks.
Expected Webhooks:
call.initiated
call.answered
or call.hangup
call.machine.detection.ended
if answering_machine_detection
was requestedcall.machine.greeting.ended
if answering_machine_detection
was set to detect_beep
, greeting_end
or detect_words
streaming.started
and streaming.stopped
or streaming.failed
if stream_url
was setCall request
Successful response with details about a call status.
{- "answering_machine_detection": "detect",
- "answering_machine_detection_config": {
- "after_greeting_silence_millis": 1000,
- "between_words_silence_millis": 1000,
- "greeting_duration_millis": 1000,
- "greeting_silence_duration_millis": 2000,
- "greeting_total_analysis_time_millis": 50000,
- "initial_silence_millis": 1000,
- "maximum_number_of_words": 1000,
- "maximum_word_length_millis": 2000,
- "silence_threshold": 512,
- "total_analysis_time_millis": 5000
}, - "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",
- "connection_id": "7267xxxxxxxxxxxxxx",
- "custom_headers": [
- {
- "name": "head_1",
- "value": "val_1"
}, - {
- "name": "head_2",
- "value": "val_2"
}
], - "dialogflow_config": {
- "analyze_sentiment": false,
- "partial_automated_agent_reply": false
}, - "enable_dialogflow": false,
- "from": "+18005550101",
- "from_display_name": "Company Name",
- "media_encryption": "SRTP",
- "link_to": "ilditnZK_eVysupV21KzmzN_sM29ygfauQojpm4BgFtfX5hXAcjotg==",
- "sip_auth_password": "password",
- "sip_auth_username": "username",
- "sip_headers": [
- {
- "name": "User-to-User",
- "value": "12345"
}
], - "sip_transport_protocol": "TLS",
- "send_silence_when_idle": true,
- "timeout_limit_secs": 60,
- "timeout_secs": 60,
- "transcription": true,
- "transcription_config": {
- "interim_results": true
}, - "webhook_url_method": "POST"
}
{- "data": {
- "call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
- "call_duration": 50,
- "call_leg_id": "2dc6fc34-f9e0-11ea-b68e-02420a0f7768",
- "call_session_id": "2dc1b3c8-f9e0-11ea-bc5a-02420a0f7768",
- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "is_alive": false,
- "record_type": "call"
}
}
{- "data": {
- "event_type": "call.answered",
- "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0",
- "occurred_at": "2018-02-02T22:25:27.521992Z",
- "payload": {
- "call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
- "call_leg_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "call_session_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "connection_id": "7267xxxxxxxxxxxxxx",
- "from": "+35319605860",
- "state": "answered",
- "to": "+35319605860"
}, - "record_type": "event"
}
}
Answer an incoming call. You must issue this command before executing subsequent commands on an incoming call.
Expected Webhooks:
call.answered
streaming.started
and streaming.stopped
or streaming.failed
if stream_url
was setAnswer call request
billing_group_id | string <uuid> Use this field to set the Billing Group ID for the call. Must be a valid and existing Billing Group ID. |
client_state | string Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string. |
command_id | string Use this field to avoid duplicate commands. Telnyx will ignore any command with the same |
Array of objects (Custom SIP Header) Custom headers to be added to the SIP INVITE response. | |
preferred_codecs | string The list of comma-separated codecs in a preferred order for the media to be received. |
Array of objects (SIP Header) SIP headers to be added to the SIP INVITE response. Currently only User-to-User header is supported. | |
object (SoundModifications) Use this field to modify sound effects, for example adjust the pitch. | |
stream_track | string Default: "inbound_track" Specifies which track should be streamed. |
stream_url | string The destination WebSocket address where the stream is going to be delivered. |
send_silence_when_idle | boolean Default: false Generate silence RTP packets when no transmission available. |
webhook_url | string Use this field to override the URL for which Telnyx will send subsequent webhooks to for this call. |
webhook_url_method | string Default: "POST" HTTP request type used for |
Successful response upon making a call control command.
{- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",
- "webhook_url_method": "POST",
- "send_silence_when_idle": true
}
{- "data": {
- "result": "ok"
}
}
{- "data": {
- "event_type": "call.answered",
- "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0",
- "occurred_at": "2018-02-02T22:25:27.521992Z",
- "payload": {
- "call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
- "call_leg_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "call_session_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "connection_id": "7267xxxxxxxxxxxxxx",
- "from": "+35319605860",
- "state": "answered",
- "to": "+35319605860"
}, - "record_type": "event"
}
}
Bridge two call control calls.
Expected Webhooks:
call.bridged
for Leg Acall.bridged
for Leg BBridge call request
call_control_id required | string The Call Control ID of the call you want to bridge with. |
client_state | string Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string. |
command_id | string Use this field to avoid duplicate commands. Telnyx will ignore any command with the same |
park_after_unbridge | string Specifies behavior after the bridge ends (i.e. the opposite leg either hangs up or is transferred). If supplied with the value |
queue | string The name of the queue you want to bridge with, can't be used together with call_control_id parameter. Bridging with a queue means bridging with the first call in the queue. The call will always be removed from the queue regardless of whether bridging succeeds. Returns an error when the queue is empty. |
Successful response upon making a call control command.
{- "call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",
- "park_after_unbridge": "self"
}
{- "data": {
- "result": "ok"
}
}
{- "data": {
- "event_type": "call.bridged",
- "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0",
- "occurred_at": "2018-02-02T22:25:27.521992Z",
- "payload": {
- "call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
- "call_leg_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "call_session_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "connection_id": "7267xxxxxxxxxxxxxx",
- "from": "+35319605860",
- "state": "bridged",
- "to": "+35319605860"
}, - "record_type": "event"
}
}
Updates client state
Updates client state for every subsequent webhook
Successful response upon making a call control command.
{- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d"
}
{- "data": {
- "result": "ok"
}
}
Put the call in a queue.
Enqueue call request
client_state | string Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string. |
command_id | string Use this field to avoid duplicate commands. Telnyx will ignore any command with the same |
max_size | integer Default: 100 The maximum number of calls allowed in the queue at a given time. Can't be modified for an existing queue. |
max_wait_time_secs | integer The number of seconds after which the call will be removed from the queue. |
queue_name | string The name of the queue the call should be put in. If a queue with a given name doesn't exist yet it will be created. |
Successful response upon making a call control command.
{- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",
- "max_size": 20,
- "max_wait_time_secs": 600,
- "queue_name": "support"
}
{- "data": {
- "result": "ok"
}
}
{- "data": {
- "event_type": "call.enqueued",
- "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0",
- "occurred_at": "2018-02-02T22:25:27.521992Z",
- "payload": {
- "call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
- "call_leg_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "call_session_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "connection_id": "7267xxxxxxxxxxxxxx",
- "current_position": 5,
- "queue": "support"
}, - "record_type": "event"
}
}
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.
Expected Webhooks:
call.fork.started
call.fork.stopped
Simple Telnyx RTP Encapsulation Protocol (STREP)
Note: This header/encapsulation is not used when the rx
and tx
parameters have been specified; it only applies when media is forked
using the target
attribute.
If the destination for forked media is specified using the "target"
attribute, the RTP will be encapsulated in an extra Telnyx protocol,
which adds a 24 byte header to the RTP payload in each packet. The STREP
header includes the Call Control call_leg_id
for stream
identification, along with bits that represent the direction (inbound or
outbound) of the media. This 24-byte header sits between the UDP header
and the RTP header.
The STREP header makes it possible to fork RTP for multiple calls (or two RTP streams for the same call) to the same IP:port, where the streams can be demultiplexed by your application using the information in the header. Of course, it's still possible to ignore this header completely, for example, if sending forked media for different calls to different ports or IP addresses. In this case, simply strip 24 bytes (or use the second byte to find the header length) from the received UDP payload to get the RTP (RTP header and payload).
STREP Specification
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|1 1|Version|L|D| HeaderLen | reserved (2 bytes) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| reserved (4 bytes, for UDP ports or anything else) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| The call_leg_id |
| from Call Control |
| (128 bits / 16 bytes) |
| (this is binary data) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
11
Static bits 11, always set to 11 to easily distinguish forked media
from RTP (10) and T.38 media (usually 00) and SIP (which begins
with a capital letter, so begins with bits 01). This is a magic number.
Version
Four bits to indicate the version number of the protocol, starting at 0001.
L
One bit to represent the leg of the call (A or B).
0 represents the A (first) leg of the call.
1 represents the B (second) leg of the call.
D
One bit to represent the direction of this RTP stream.
0 represents media received by Telnyx.
1 represents media transmitted by Telnyx.
HeaderLen (1 byte)
The length of the header in bytes.
Note that this value does not include the length of the payload. The total
size of the RTP can be calculated by subtracting the HeaderLen from the UDP
length (minus 8 for the UDP header).
In version 1, this value will always be 24.
Reserved (6 bytes)
Reserved for future use and to make sure that the header is a multiple of 32 bits
Call Leg ID
A 128-bit identifier for the call leg.
This is the call_leg_id from Call Control.
Fork media request
client_state | string Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string. |
command_id | string Use this field to avoid duplicate commands. Telnyx will ignore any command with the same |
rx | string The network target, udp:ip_address:port, where the call's incoming RTP media packets should be forwarded. |
stream_type | string Default: "raw" Optionally specify a media type to stream. If |
target | string The network target, udp:ip_address:port, where the call's RTP media packets should be forwarded. Both incoming and outgoing media packets will be delivered to the specified target, and information about the stream will be included in the encapsulation protocol header, including the direction (0 = inbound; 1 = outbound), leg (0 = A-leg; 1 = B-leg), and call_leg_id. |
tx | string The network target, udp:ip_address:port, where the call's outgoing RTP media packets should be forwarded. |
Successful response upon making a call control command.
{- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",
- "rx": "udp:192.0.2.1:9000",
- "target": "udp:192.0.2.1:9000",
- "tx": "udp:192.0.2.1:9001"
}
{- "data": {
- "result": "ok"
}
}
{- "data": {
- "event_type": "call.fork.started",
- "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0",
- "occurred_at": "2018-02-02T22:25:27.521992Z",
- "payload": {
- "call_control_id": "v2:OycMASgvIjsGIAVEx8x3n9rYeKnUJx6a3V8VGhs5futnr17KZhujZA",
- "call_leg_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "call_session_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "connection_id": "7267xxxxxxxxxxxxxx",
- "stream_type": "decrypted"
}, - "record_type": "event"
}
}
Stop forking a call.
Expected Webhooks:
call.fork.stopped
Stop forking media request
client_state | string Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string. |
command_id | string Use this field to avoid duplicate commands. Telnyx will ignore any command with the same |
stream_type | string Default: "raw" Optionally specify a |
Successful response upon making a call control command.
{- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901"
}
{- "data": {
- "result": "ok"
}
}
{- "data": {
- "event_type": "call.fork.stopped",
- "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0",
- "occurred_at": "2018-02-02T22:25:27.521992Z",
- "payload": {
- "call_control_id": "v2:OycMASgvIjsGIAVEx8x3n9rYeKnUJx6a3V8VGhs5futnr17KZhujZA",
- "call_leg_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "call_session_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "connection_id": "7267xxxxxxxxxxxxxx",
- "stream_type": "decrypted"
}, - "record_type": "event"
}
}
Gather DTMF signals to build interactive menus.
You can pass a list of valid digits. The Answer command must be issued before the gather
command.
Expected Webhooks:
call.dtmf.received
(you may receive many of these webhooks)call.gather.ended
Gather
client_state | string Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string. |
command_id | string Use this field to avoid duplicate commands. Telnyx will ignore any command with the same |
initial_timeout_millis | integer <int32> Default: 5000 The number of milliseconds to wait for the first DTMF. |
inter_digit_timeout_millis | integer <int32> Default: 5000 The number of milliseconds to wait for input between digits. |
maximum_digits | integer <int32> Default: 128 The maximum number of digits to fetch. This parameter has a maximum value of 128. |
minimum_digits | integer <int32> Default: 1 The minimum number of digits to fetch. This parameter has a minimum value of 1. |
terminating_digit | string Default: "#" The digit used to terminate input if fewer than |
timeout_millis | integer <int32> Default: 60000 The number of milliseconds to wait to complete the request. |
valid_digits | string Default: "0123456789#*" A list of all digits accepted as valid. |
Successful response upon making a call control command.
{- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",
- "initial_timeout_millis": 10000,
- "inter_digit_timeout_millis": 10000,
- "maximum_digits": 10,
- "minimum_digits": 1,
- "terminating_digit": "#",
- "timeout_millis": 60000,
- "valid_digits": "123"
}
{- "data": {
- "result": "ok"
}
}
{- "data": {
- "event_type": "call.dtmf.received",
- "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0",
- "occurred_at": "2018-02-02T22:25:27.521992Z",
- "payload": {
- "call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
- "call_leg_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "call_session_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "connection_id": "7267xxxxxxxxxxxxxx",
- "digit": "#",
- "from": "+35319605860",
- "to": "+35319605860"
}, - "record_type": "event"
}
}
Stop current gather.
Expected Webhooks:
call.gather.ended
Stop current gather
Successful response upon making a call control command.
{- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901"
}
{- "data": {
- "result": "ok"
}
}
{- "data": {
- "event_type": "call.gather.ended",
- "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0",
- "occurred_at": "2018-02-02T22:25:27.521992Z",
- "payload": {
- "call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
- "call_leg_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "call_session_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "connection_id": "7267xxxxxxxxxxxxxx",
- "digits": "123",
- "from": "+35319605860",
- "status": "valid",
- "to": "+35319605860"
}, - "record_type": "event"
}
}
Play an audio file on the call until the required DTMF signals are gathered to build interactive menus.
You can pass a list of valid digits along with an 'invalid_audio_url', which will be played back at the beginning of each prompt. Playback will be interrupted when a DTMF signal is received. The Answer command must be issued before the gather_using_audio
command.
Expected Webhooks:
call.playback.started
call.playback.ended
call.dtmf.received
(you may receive many of these webhooks)call.gather.ended
Gather using audio request
audio_url | string The URL of a file to be played back at the beginning of each prompt. The URL can point to either a WAV or MP3 file. media_name and audio_url cannot be used together in one request. |
client_state | string Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string. |
command_id | string Use this field to avoid duplicate commands. Telnyx will ignore any command with the same |
inter_digit_timeout_millis | integer <int32> Default: 5000 The number of milliseconds to wait for input between digits. |
invalid_audio_url | string The URL of a file to play when digits don't match the |
invalid_media_name | string The media_name of a file to be played back when digits don't match the |
maximum_digits | integer <int32> Default: 128 The maximum number of digits to fetch. This parameter has a maximum value of 128. |
maximum_tries | integer <int32> Default: 3 The maximum number of times the file should be played if there is no input from the user on the call. |
media_name | string The media_name of a file to be played back at the beginning of each prompt. The media_name must point to a file previously uploaded to api.telnyx.com/v2/media by the same user/organization. The file must either be a WAV or MP3 file. |
minimum_digits | integer <int32> Default: 1 The minimum number of digits to fetch. This parameter has a minimum value of 1. |
terminating_digit | string Default: "#" The digit used to terminate input if fewer than |
timeout_millis | integer <int32> Default: 60000 The number of milliseconds to wait for a DTMF response after file playback ends before a replaying the sound file. |
valid_digits | string Default: "0123456789#*" A list of all digits accepted as valid. |
Successful response upon making a call control command.
{- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",
- "inter_digit_timeout_millis": 10000,
- "maximum_digits": 10,
- "minimum_digits": 1,
- "terminating_digit": "#",
- "timeout_millis": 10000,
- "valid_digits": "123"
}
{- "data": {
- "result": "ok"
}
}
{- "data": {
- "event_type": "call.dtmf.received",
- "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0",
- "occurred_at": "2018-02-02T22:25:27.521992Z",
- "payload": {
- "call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
- "call_leg_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "call_session_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "connection_id": "7267xxxxxxxxxxxxxx",
- "digit": "#",
- "from": "+35319605860",
- "to": "+35319605860"
}, - "record_type": "event"
}
}
Convert text to speech and play it on the call until the required DTMF signals are gathered to build interactive menus.
You can pass a list of valid digits along with an 'invalid_payload', which will be played back at the beginning of each prompt. Speech will be interrupted when a DTMF signal is received. The Answer command must be issued before the gather_using_speak
command.
Expected Webhooks:
call.dtmf.received
(you may receive many of these webhooks)call.gather.ended
Gather using speak request
client_state | string Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string. |
command_id | string Use this field to avoid duplicate commands. Telnyx will ignore any command with the same |
inter_digit_timeout_millis | integer <int32> Default: 5000 The number of milliseconds to wait for input between digits. |
invalid_payload | string The text or SSML to be converted into speech when digits don't match the |
language required | string The language you want spoken. |
maximum_digits | integer <int32> Default: 128 The maximum number of digits to fetch. This parameter has a maximum value of 128. |
maximum_tries | integer <int32> Default: 3 The maximum number of times that a file should be played back if there is no input from the user on the call. |
minimum_digits | integer <int32> Default: 1 The minimum number of digits to fetch. This parameter has a minimum value of 1. |
payload required | string The text or SSML to be converted into speech. There is a 3,000 character limit. |
payload_type | string Default: "text" The type of the provided payload. The payload can either be plain text, or Speech Synthesis Markup Language (SSML). |
service_level | string Default: "premium" This parameter impacts speech quality, language options and payload types. When using |
terminating_digit | string Default: "#" The digit used to terminate input if fewer than |
timeout_millis | integer <int32> Default: 60000 The number of milliseconds to wait for a DTMF response after speak ends before a replaying the sound file. |
valid_digits | string Default: "0123456789#*" A list of all digits accepted as valid. |
voice required | string The gender of the voice used to speak back the text. |
Successful response upon making a call control command.
{- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",
- "inter_digit_timeout_millis": 10000,
- "invalid_payload": "say this on call",
- "language": "arb",
- "maximum_digits": 10,
- "minimum_digits": 1,
- "payload": "say this on call",
- "payload_type": "text",
- "service_level": "premium",
- "terminating_digit": "#",
- "valid_digits": "123",
- "voice": "male"
}
{- "data": {
- "result": "ok"
}
}
{- "data": {
- "event_type": "call.dtmf.received",
- "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0",
- "occurred_at": "2018-02-02T22:25:27.521992Z",
- "payload": {
- "call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
- "call_leg_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "call_session_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "connection_id": "7267xxxxxxxxxxxxxx",
- "digit": "#",
- "from": "+35319605860",
- "to": "+35319605860"
}, - "record_type": "event"
}
}
Hang up the call.
Expected Webhooks:
call.hangup
call.recording.saved
Hangup request
Successful response upon making a call control command.
{- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901"
}
{- "data": {
- "result": "ok"
}
}
{- "data": {
- "event_type": "call.hangup",
- "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0",
- "occurred_at": "2018-02-02T22:25:27.521992Z",
- "payload": {
- "call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
- "call_leg_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "call_session_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "connection_id": "7267xxxxxxxxxxxxxx",
- "from": "+35319605860",
- "hangup_cause": "call_rejected",
- "hangup_source": "caller",
- "sip_hangup_cause": "603",
- "start_time": "2018-02-02T22:20:27.521992Z",
- "state": "hangup",
- "to": "+35319605860"
}, - "record_type": "event"
}
}
Removes the call from a queue.
Removes the call from the queue, the call currently is enqueued in.
Successful response upon making a call control command.
{- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901"
}
{- "data": {
- "result": "ok"
}
}
{- "data": {
- "event_type": "call.dequeued",
- "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0",
- "occurred_at": "2018-02-02T22:25:27.521992Z",
- "payload": {
- "call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
- "call_leg_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "call_session_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "connection_id": "7267xxxxxxxxxxxxxx",
- "queue": "support",
- "queue_position": 3,
- "reason": "leave"
}, - "record_type": "event"
}
}
Play an audio file on the call. If multiple play audio commands are issued consecutively, the audio files will be placed in a queue awaiting playback.
Notes:
overlay
is enabled, target_legs
is limited to self
.overlay=true
unless there is a Play Audio with overlay=false
actively playing.Expected Webhooks:
call.playback.started
call.playback.ended
Play audio URL request
audio_url | string The URL of a file to be played back on the call. The URL can point to either a WAV or MP3 file. media_name and audio_url cannot be used together in one request. |
cache_audio | boolean Default: true Caches the audio file. Useful when playing the same audio file multiple times during the call. |
client_state | string Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string. |
command_id | string Use this field to avoid duplicate commands. Telnyx will ignore any command with the same |
string or integer (Loopcount) | |
media_name | string The media_name of a file to be played back on the call. The media_name must point to a file previously uploaded to api.telnyx.com/v2/media by the same user/organization. The file must either be a WAV or MP3 file. |
overlay | boolean Default: false When enabled, audio will be mixed on top of any other audio that is actively being played back. Note that |
playback_content | string Allows a user to provide base64 encoded mp3. Note: when using this parameter, |
stop | string When specified, it stops the current audio being played. Specify |
target_legs | string Default: "self" Specifies the leg or legs on which audio will be played. If supplied, the value must be either |
Successful response upon making a call control command.
{- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",
- "loop": "infinity",
- "overlay": true,
- "stop": "current",
- "target_legs": "self"
}
{- "data": {
- "result": "ok"
}
}
{- "data": {
- "event_type": "call.playback.ended",
- "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0",
- "occurred_at": "2018-02-02T22:25:27.521992Z",
- "payload": {
- "call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
- "call_leg_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "call_session_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "connection_id": "7267xxxxxxxxxxxxxx",
- "media_name": "my_media_uploaded_to_media_storage_api",
- "overlay": false,
- "status": "completed"
}, - "record_type": "event"
}
}
Stop audio being played on the call.
Expected Webhooks:
call.playback.ended
or call.speak.ended
Stop audio playback request
client_state | string Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string. |
command_id | string Use this field to avoid duplicate commands. Telnyx will ignore any command with the same |
overlay | boolean Default: false When enabled, it stops the audio being played in the overlay queue. |
stop | string Default: "all" Use |
Successful response upon making a call control command.
{- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",
- "overlay": false,
- "stop": "all"
}
{- "data": {
- "result": "ok"
}
}
{- "data": {
- "event_type": "call.playback.ended",
- "id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777f0",
- "occurred_at": "2018-02-02T22:25:27.521992Z",
- "payload": {
- "call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
- "call_leg_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "call_session_id": "428c31b6-7af4-4bcb-b7f5-5013ef9657c1",
- "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
- "connection_id": "7267xxxxxxxxxxxxxx",
- "media_name": "my_media_uploaded_to_media_storage_api",
- "overlay": false,
- "status": "completed"
}, - "record_type": "event"
}
}
Pause recording the call. Recording can be resumed via Resume recording command.
Expected Webhooks:
There are no webhooks associated with this command.
Pause recording call request
Successful response upon making a call control command.
object (CallControlCommandResult) | ||