Call Commands
Dial
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.hold and call.unhold if the call is held/unheld
- call.machine.detection.ended if answering_machine_detection was requested
- call.machine.greeting.ended if answering_machine_detection was requested to detect the end of machine greeting
- call.machine.premium.detection.ended if answering_machine_detection=premium was requested
- call.machine.premium.greeting.ended if answering_machine_detection=premium was requested and a beep was detected
- 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
Request body
Example request
{
"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
},
"audio_url": "http://www.example.com/sounds/greeting.wav",
"bridge_intent": true,
"bridge_on_answer": true,
"client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
"command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",
"conference_config": {
"conference_name": "telnyx-conference",
"start_conference_on_enter": true
},
"connection_id": "7267xxxxxxxxxxxxxx",
"conversation_relay_config": {
"custom_parameters": {
"customer_id": "12345"
},
"dtmf_detection": true,
"greeting": "Hi! Ask me anything!",
"interruptible": "speech",
"interruptible_greeting": "dtmf",
"language": "en-US",
"tts_provider": "telnyx",
"url": "wss://example.com/conversation-relay",
"voice": "Telnyx.KokoroTTS.af"
},
"custom_headers": [
{
"name": "head_1",
"value": "val_1"
},
{
"name": "head_2",
"value": "val_2"
}
],
"deepfake_detection": {
"enabled": true,
"rtp_timeout": 30,
"timeout": 15
},
"dialogflow_config": {
"analyze_sentiment": false,
"partial_automated_agent_reply": false
},
"enable_dialogflow": false,
"from": "+18005550101",
"from_display_name": "Company Name",
"link_to": "ilditnZK_eVysupV21KzmzN_sM29ygfauQojpm4BgFtfX5hXAcjotg==",
"media_encryption": "SRTP",
"send_digits_on_answer": "wwww200",
"send_silence_when_idle": true,
"sip_auth_password": "password",
"sip_auth_username": "username",
"sip_headers": [
{
"name": "User-to-User",
"value": "12345"
}
],
"sip_transport_protocol": "TLS",
"stream_track": "both_tracks",
"stream_url": "wss://www.example.com/websocket",
"time_limit_secs": 60,
"timeout_secs": 60,
"to": "+18005550100 or sip:username@sip.telnyx.com;secure=srtp",
"webhook_retries_policies": {
"call.hangup": {
"retries_ms": [
1000,
2000,
5000
]
}
},
"webhook_url": "https://www.example.com/server-b/",
"webhook_url_method": "POST",
"webhook_urls": {
"call.bridge": "https://www.example.com/webhooks/bridge",
"call.hangup": "https://www.example.com/webhooks/hangup"
},
"webhook_urls_method": "POST"
}Response
Successful response with details about a call status that includes recording_id.
Example response
{
"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",
"end_time": "2019-01-23T18:11:52.574Z",
"is_alive": false,
"record_type": "call",
"recording_id": "d7e9c1d4-8b2a-4b8f-b3a7-9a671c9e9b0a",
"start_time": "2019-01-23T18:10:02.574Z"
}
}