Call Commands
Transfer call
Transfer a call to a new destination. If the transfer is unsuccessful, a call.hangup webhook for the other call (Leg B) will be sent indicating that the transfer could not be completed. The original call will remain active and may be issued additional commands, potentially transfering the call to an alternate destination.
Expected Webhooks:
- call.initiated
- call.bridged to Leg B
- call.answered or call.hangup
- 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
post/calls/{call_control_id}/actions/transfer
Path parameters
call_control_idstring required
Unique identifier and token for controlling the call
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",
"client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",
"command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",
"custom_headers": [
{
"name": "head_1",
"value": "val_1"
},
{
"name": "head_2",
"value": "val_2"
}
],
"early_media": true,
"from": "+18005550101",
"from_display_name": "Company Name",
"media_encryption": "SRTP",
"send_digits_on_answer": "wwww200",
"sip_auth_password": "password",
"sip_auth_username": "username",
"sip_headers": [
{
"name": "User-to-User",
"value": "value"
}
],
"sip_transport_protocol": "TLS",
"time_limit_secs": 60,
"timeout_secs": 60,
"to": "+18005550100 or sip:username@sip.telnyx.com;secure=srtp",
"webhook_url": "https://www.example.com/server-b/",
"webhook_url_method": "POST"
}Response
Successful response upon making a call control command.
Example response
{
"data": {
"result": "ok"
}
}