telnyx-voice-ruby

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->

Telnyx Voice - Ruby

Telnyx Voice - Ruby

Installation

安装

bash
gem install telnyx
bash
gem install telnyx

Setup

初始化设置

ruby
require "telnyx"

client = Telnyx::Client.new(
  api_key: ENV["TELNYX_API_KEY"], # This is the default and can be omitted
)
All examples below assume
client
is already initialized as shown above.
ruby
require "telnyx"

client = Telnyx::Client.new(
  api_key: ENV["TELNYX_API_KEY"], # This is the default and can be omitted
)
以下所有示例均假设
client
已按上述方式完成初始化。

Answer call

接听呼叫

Answer an incoming call.
POST /calls/{call_control_id}/actions/answer
Optional:
billing_group_id
(uuid),
client_state
(string),
command_id
(string),
custom_headers
(array[object]),
preferred_codecs
(enum),
record
(enum),
record_channels
(enum),
record_custom_file_name
(string),
record_format
(enum),
record_max_length
(int32),
record_timeout_secs
(int32),
record_track
(enum),
record_trim
(enum),
send_silence_when_idle
(boolean),
sip_headers
(array[object]),
sound_modifications
(object),
stream_bidirectional_codec
(enum),
stream_bidirectional_mode
(enum),
stream_bidirectional_target_legs
(enum),
stream_codec
(enum),
stream_track
(enum),
stream_url
(string),
transcription
(boolean),
transcription_config
(object),
webhook_url
(string),
webhook_url_method
(enum)
ruby
response = client.calls.actions.answer("call_control_id")

puts(response)
接听来电。
POST /calls/{call_control_id}/actions/answer
可选参数:
billing_group_id
(uuid)、
client_state
(字符串)、
command_id
(字符串)、
custom_headers
(对象数组)、
preferred_codecs
(枚举类型)、
record
(枚举类型)、
record_channels
(枚举类型)、
record_custom_file_name
(字符串)、
record_format
(枚举类型)、
record_max_length
(32位整数)、
record_timeout_secs
(32位整数)、
record_track
(枚举类型)、
record_trim
(枚举类型)、
send_silence_when_idle
(布尔值)、
sip_headers
(对象数组)、
sound_modifications
(对象)、
stream_bidirectional_codec
(枚举类型)、
stream_bidirectional_mode
(枚举类型)、
stream_bidirectional_target_legs
(枚举类型)、
stream_codec
(枚举类型)、
stream_track
(枚举类型)、
stream_url
(字符串)、
transcription
(布尔值)、
transcription_config
(对象)、
webhook_url
(字符串)、
webhook_url_method
(枚举类型)
ruby
response = client.calls.actions.answer("call_control_id")

puts(response)

Bridge calls

桥接呼叫

Bridge two call control calls.
POST /calls/{call_control_id}/actions/bridge
— Required:
call_control_id
Optional:
client_state
(string),
command_id
(string),
mute_dtmf
(enum),
park_after_unbridge
(string),
play_ringtone
(boolean),
queue
(string),
record
(enum),
record_channels
(enum),
record_custom_file_name
(string),
record_format
(enum),
record_max_length
(int32),
record_timeout_secs
(int32),
record_track
(enum),
record_trim
(enum),
ringtone
(enum),
video_room_context
(string),
video_room_id
(uuid)
ruby
response = client.calls.actions.bridge(
  "call_control_id",
  call_control_id_to_bridge_with: "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg"
)

puts(response)
桥接两个呼叫控制会话。
POST /calls/{call_control_id}/actions/bridge
— 必填参数:
call_control_id
可选参数:
client_state
(字符串)、
command_id
(字符串)、
mute_dtmf
(枚举类型)、
park_after_unbridge
(字符串)、
play_ringtone
(布尔值)、
queue
(字符串)、
record
(枚举类型)、
record_channels
(枚举类型)、
record_custom_file_name
(字符串)、
record_format
(枚举类型)、
record_max_length
(32位整数)、
record_timeout_secs
(32位整数)、
record_track
(枚举类型)、
record_trim
(枚举类型)、
ringtone
(枚举类型)、
video_room_context
(字符串)、
video_room_id
(uuid)
ruby
response = client.calls.actions.bridge(
  "call_control_id",
  call_control_id_to_bridge_with: "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg"
)

puts(response)

Dial

发起呼叫

Dial a number or SIP URI from a given connection.
POST /calls
— Required:
connection_id
,
to
,
from
Optional:
answering_machine_detection
(enum),
answering_machine_detection_config
(object),
audio_url
(string),
billing_group_id
(uuid),
bridge_intent
(boolean),
bridge_on_answer
(boolean),
client_state
(string),
command_id
(string),
conference_config
(object),
custom_headers
(array[object]),
dialogflow_config
(object),
enable_dialogflow
(boolean),
from_display_name
(string),
link_to
(string),
media_encryption
(enum),
media_name
(string),
park_after_unbridge
(string),
preferred_codecs
(string),
record
(enum),
record_channels
(enum),
record_custom_file_name
(string),
record_format
(enum),
record_max_length
(int32),
record_timeout_secs
(int32),
record_track
(enum),
record_trim
(enum),
send_silence_when_idle
(boolean),
sip_auth_password
(string),
sip_auth_username
(string),
sip_headers
(array[object]),
sip_region
(enum),
sip_transport_protocol
(enum),
sound_modifications
(object),
stream_auth_token
(string),
stream_bidirectional_codec
(enum),
stream_bidirectional_mode
(enum),
stream_bidirectional_sampling_rate
(enum),
stream_bidirectional_target_legs
(enum),
stream_codec
(enum),
stream_establish_before_call_originate
(boolean),
stream_track
(enum),
stream_url
(string),
supervise_call_control_id
(string),
supervisor_role
(enum),
time_limit_secs
(int32),
timeout_secs
(int32),
transcription
(boolean),
transcription_config
(object),
webhook_url
(string),
webhook_url_method
(enum)
ruby
response = client.calls.dial(
  connection_id: "7267xxxxxxxxxxxxxx",
  from: "+18005550101",
  to: "+18005550100"
)

puts(response)
从指定连接拨打号码或SIP URI。
POST /calls
— 必填参数:
connection_id
to
from
可选参数:
answering_machine_detection
(枚举类型)、
answering_machine_detection_config
(对象)、
audio_url
(字符串)、
billing_group_id
(uuid)、
bridge_intent
(布尔值)、
bridge_on_answer
(布尔值)、
client_state
(字符串)、
command_id
(字符串)、
conference_config
(对象)、
custom_headers
(对象数组)、
dialogflow_config
(对象)、
enable_dialogflow
(布尔值)、
from_display_name
(字符串)、
link_to
(字符串)、
media_encryption
(枚举类型)、
media_name
(字符串)、
park_after_unbridge
(字符串)、
preferred_codecs
(字符串)、
record
(枚举类型)、
record_channels
(枚举类型)、
record_custom_file_name
(字符串)、
record_format
(枚举类型)、
record_max_length
(32位整数)、
record_timeout_secs
(32位整数)、
record_track
(枚举类型)、
record_trim
(枚举类型)、
send_silence_when_idle
(布尔值)、
sip_auth_password
(字符串)、
sip_auth_username
(字符串)、
sip_headers
(对象数组)、
sip_region
(枚举类型)、
sip_transport_protocol
(枚举类型)、
sound_modifications
(对象)、
stream_auth_token
(字符串)、
stream_bidirectional_codec
(枚举类型)、
stream_bidirectional_mode
(枚举类型)、
stream_bidirectional_sampling_rate
(枚举类型)、
stream_bidirectional_target_legs
(枚举类型)、
stream_codec
(枚举类型)、
stream_establish_before_call_originate
(布尔值)、
stream_track
(枚举类型)、
stream_url
(字符串)、
supervise_call_control_id
(字符串)、
supervisor_role
(枚举类型)、
time_limit_secs
(32位整数)、
timeout_secs
(32位整数)、
transcription
(布尔值)、
transcription_config
(对象)、
webhook_url
(字符串)、
webhook_url_method
(枚举类型)
ruby
response = client.calls.dial(
  connection_id: "7267xxxxxxxxxxxxxx",
  from: "+18005550101",
  to: "+18005550100"
)

puts(response)

Hangup call

挂断呼叫

Hang up the call.
POST /calls/{call_control_id}/actions/hangup
Optional:
client_state
(string),
command_id
(string)
ruby
response = client.calls.actions.hangup("call_control_id")

puts(response)
挂断当前呼叫。
POST /calls/{call_control_id}/actions/hangup
可选参数:
client_state
(字符串)、
command_id
(字符串)
ruby
response = client.calls.actions.hangup("call_control_id")

puts(response)

Transfer call

转接呼叫

Transfer a call to a new destination.
POST /calls/{call_control_id}/actions/transfer
— Required:
to
Optional:
answering_machine_detection
(enum),
answering_machine_detection_config
(object),
audio_url
(string),
client_state
(string),
command_id
(string),
custom_headers
(array[object]),
early_media
(boolean),
from
(string),
from_display_name
(string),
media_encryption
(enum),
media_name
(string),
mute_dtmf
(enum),
park_after_unbridge
(string),
preferred_codecs
(string),
record
(enum),
record_channels
(enum),
record_custom_file_name
(string),
record_format
(enum),
record_max_length
(int32),
record_timeout_secs
(int32),
record_track
(enum),
record_trim
(enum),
sip_auth_password
(string),
sip_auth_username
(string),
sip_headers
(array[object]),
sip_region
(enum),
sip_transport_protocol
(enum),
sound_modifications
(object),
target_leg_client_state
(string),
time_limit_secs
(int32),
timeout_secs
(int32),
webhook_retries_policies
(object),
webhook_url
(string),
webhook_url_method
(enum),
webhook_urls
(object),
webhook_urls_method
(enum)
ruby
response = client.calls.actions.transfer("call_control_id", to: "+18005550100")

puts(response)
将呼叫转接至新的目标地址。
POST /calls/{call_control_id}/actions/transfer
— 必填参数:
to
可选参数:
answering_machine_detection
(枚举类型)、
answering_machine_detection_config
(对象)、
audio_url
(字符串)、
client_state
(字符串)、
command_id
(字符串)、
custom_headers
(对象数组)、
early_media
(布尔值)、
from
(字符串)、
from_display_name
(字符串)、
media_encryption
(枚举类型)、
media_name
(字符串)、
mute_dtmf
(枚举类型)、
park_after_unbridge
(字符串)、
preferred_codecs
(字符串)、
record
(枚举类型)、
record_channels
(枚举类型)、
record_custom_file_name
(字符串)、
record_format
(枚举类型)、
record_max_length
(32位整数)、
record_timeout_secs
(32位整数)、
record_track
(枚举类型)、
record_trim
(枚举类型)、
sip_auth_password
(字符串)、
sip_auth_username
(字符串)、
sip_headers
(对象数组)、
sip_region
(枚举类型)、
sip_transport_protocol
(枚举类型)、
sound_modifications
(对象)、
target_leg_client_state
(字符串)、
time_limit_secs
(32位整数)、
timeout_secs
(32位整数)、
webhook_retries_policies
(对象)、
webhook_url
(字符串)、
webhook_url_method
(枚举类型)、
webhook_urls
(对象)、
webhook_urls_method
(枚举类型)
ruby
response = client.calls.actions.transfer("call_control_id", to: "+18005550100")

puts(response)

List all active calls for given connection

列出指定连接的所有活跃呼叫

Lists all active calls for given connection.
GET /connections/{connection_id}/active_calls
ruby
page = client.connections.list_active_calls("1293384261075731461")

puts(page)
列出指定连接下的所有活跃呼叫。
GET /connections/{connection_id}/active_calls
ruby
page = client.connections.list_active_calls("1293384261075731461")

puts(page)

List call control applications

列出呼叫控制应用

Return a list of call control applications.
GET /call_control_applications
ruby
page = client.call_control_applications.list

puts(page)
返回呼叫控制应用列表。
GET /call_control_applications
ruby
page = client.call_control_applications.list

puts(page)

Create a call control application

创建呼叫控制应用

Create a call control application.
POST /call_control_applications
— Required:
application_name
,
webhook_event_url
Optional:
active
(boolean),
anchorsite_override
(enum),
call_cost_in_webhooks
(boolean),
dtmf_type
(enum),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
inbound
(object),
outbound
(object),
redact_dtmf_debug_logging
(boolean),
webhook_api_version
(enum),
webhook_event_failover_url
(url),
webhook_timeout_secs
(['integer', 'null'])
ruby
call_control_application = client.call_control_applications.create(
  application_name: "call-router",
  webhook_event_url: "https://example.com"
)

puts(call_control_application)
创建一个呼叫控制应用。
POST /call_control_applications
— 必填参数:
application_name
webhook_event_url
可选参数:
active
(布尔值)、
anchorsite_override
(枚举类型)、
call_cost_in_webhooks
(布尔值)、
dtmf_type
(枚举类型)、
first_command_timeout
(布尔值)、
first_command_timeout_secs
(整数)、
inbound
(对象)、
outbound
(对象)、
redact_dtmf_debug_logging
(布尔值)、
webhook_api_version
(枚举类型)、
webhook_event_failover_url
(URL)、
webhook_timeout_secs
(整数或null)
ruby
call_control_application = client.call_control_applications.create(
  application_name: "call-router",
  webhook_event_url: "https://example.com"
)

puts(call_control_application)

Retrieve a call control application

获取呼叫控制应用详情

Retrieves the details of an existing call control application.
GET /call_control_applications/{id}
ruby
call_control_application = client.call_control_applications.retrieve("1293384261075731499")

puts(call_control_application)
获取现有呼叫控制应用的详细信息。
GET /call_control_applications/{id}
ruby
call_control_application = client.call_control_applications.retrieve("1293384261075731499")

puts(call_control_application)

Update a call control application

更新呼叫控制应用

Updates settings of an existing call control application.
PATCH /call_control_applications/{id}
— Required:
application_name
,
webhook_event_url
Optional:
active
(boolean),
anchorsite_override
(enum),
call_cost_in_webhooks
(boolean),
dtmf_type
(enum),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
inbound
(object),
outbound
(object),
redact_dtmf_debug_logging
(boolean),
tags
(array[string]),
webhook_api_version
(enum),
webhook_event_failover_url
(url),
webhook_timeout_secs
(['integer', 'null'])
ruby
call_control_application = client.call_control_applications.update(
  "1293384261075731499",
  application_name: "call-router",
  webhook_event_url: "https://example.com"
)

puts(call_control_application)
更新现有呼叫控制应用的设置。
PATCH /call_control_applications/{id}
— 必填参数:
application_name
webhook_event_url
可选参数:
active
(布尔值)、
anchorsite_override
(枚举类型)、
call_cost_in_webhooks
(布尔值)、
dtmf_type
(枚举类型)、
first_command_timeout
(布尔值)、
first_command_timeout_secs
(整数)、
inbound
(对象)、
outbound
(对象)、
redact_dtmf_debug_logging
(布尔值)、
tags
(字符串数组)、
webhook_api_version
(枚举类型)、
webhook_event_failover_url
(URL)、
webhook_timeout_secs
(整数或null)
ruby
call_control_application = client.call_control_applications.update(
  "1293384261075731499",
  application_name: "call-router",
  webhook_event_url: "https://example.com"
)

puts(call_control_application)

Delete a call control application

删除呼叫控制应用

Deletes a call control application.
DELETE /call_control_applications/{id}
ruby
call_control_application = client.call_control_applications.delete("1293384261075731499")

puts(call_control_application)
删除一个呼叫控制应用。
DELETE /call_control_applications/{id}
ruby
call_control_application = client.call_control_applications.delete("1293384261075731499")

puts(call_control_application)

List call events

列出呼叫事件

Filters call events by given filter parameters.
GET /call_events
ruby
page = client.call_events.list

puts(page)

根据指定筛选参数过滤呼叫事件。
GET /call_events
ruby
page = client.call_events.list

puts(page)

Webhooks

Webhooks

The following webhook events are sent to your configured webhook URL. All webhooks include
telnyx-timestamp
and
telnyx-signature-ed25519
headers for verification (Standard Webhooks compatible).
EventDescription
callAnswered
Call Answered
callStreamingStarted
Call Streaming Started
callStreamingStopped
Call Streaming Stopped
callStreamingFailed
Call Streaming Failed
callBridged
Call Bridged
callInitiated
Call Initiated
callHangup
Call Hangup
callRecordingSaved
Call Recording Saved
callMachineDetectionEnded
Call Machine Detection Ended
callMachineGreetingEnded
Call Machine Greeting Ended
callMachinePremiumDetectionEnded
Call Machine Premium Detection Ended
callMachinePremiumGreetingEnded
Call Machine Premium Greeting Ended
以下Webhook事件将发送至您配置的Webhook URL。所有Webhook均包含
telnyx-timestamp
telnyx-signature-ed25519
头信息用于验证(兼容标准Webhooks)。
事件描述
callAnswered
呼叫已接听
callStreamingStarted
呼叫流已启动
callStreamingStopped
呼叫流已停止
callStreamingFailed
呼叫流启动失败
callBridged
呼叫已桥接
callInitiated
呼叫已发起
callHangup
呼叫已挂断
callRecordingSaved
呼叫录音已保存
callMachineDetectionEnded
答录机检测已结束
callMachineGreetingEnded
答录机问候语已结束
callMachinePremiumDetectionEnded
高级答录机检测已结束
callMachinePremiumGreetingEnded
高级答录机问候语已结束

Webhook payload fields

Webhook 负载字段

callAnswered
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringCall Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.custom_headers
array[object]Custom headers set on answer command
data.payload.sip_headers
array[object]User-to-User and Diversion headers from sip invite.
data.payload.from
stringNumber or SIP URI placing the call.
data.payload.to
stringDestination number or SIP URI of the call.
data.payload.start_time
date-timeISO 8601 datetime of when the call started.
data.payload.state
enumState received from a command.
data.payload.tags
array[string]Array of tags associated to number.
callStreamingStarted
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringCall Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.stream_url
stringDestination WebSocket address where the stream is going to be delivered.
callStreamingStopped
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringCall Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.stream_url
stringDestination WebSocket address where the stream is going to be delivered.
callStreamingFailed
FieldTypeDescription
data.record_type
enumIdentifies the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringCall Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.failure_reason
stringA short description explaning why the media streaming failed.
data.payload.stream_id
uuidIdentifies the streaming.
data.payload.stream_type
enumThe type of stream connection the stream is performing.
callBridged
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringCall Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.from
stringNumber or SIP URI placing the call.
data.payload.to
stringDestination number or SIP URI of the call.
callInitiated
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringCall Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.connection_codecs
stringThe list of comma-separated codecs enabled for the connection.
data.payload.offered_codecs
stringThe list of comma-separated codecs offered by caller.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.custom_headers
array[object]Custom headers from sip invite
data.payload.sip_headers
array[object]User-to-User and Diversion headers from sip invite.
data.payload.shaken_stir_attestation
stringSHAKEN/STIR attestation level.
data.payload.shaken_stir_validated
booleanWhether attestation was successfully validated or not.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.caller_id_name
stringCaller id.
data.payload.call_screening_result
stringCall screening result.
data.payload.from
stringNumber or SIP URI placing the call.
data.payload.to
stringDestination number or SIP URI of the call.
data.payload.direction
enumWhether the call is
incoming
or
outgoing
.
data.payload.state
enumState received from a command.
data.payload.start_time
date-timeISO 8601 datetime of when the call started.
data.payload.tags
array[string]Array of tags associated to number.
callHangup
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringCall Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.custom_headers
array[object]Custom headers set on answer command
data.payload.sip_headers
array[object]User-to-User and Diversion headers from sip invite.
data.payload.from
stringNumber or SIP URI placing the call.
data.payload.to
stringDestination number or SIP URI of the call.
data.payload.start_time
date-timeISO 8601 datetime of when the call started.
data.payload.state
enumState received from a command.
data.payload.tags
array[string]Array of tags associated to number.
data.payload.hangup_cause
enumThe reason the call was ended (
call_rejected
,
normal_clearing
,
originator_cancel
,
timeout
,
time_limit
, `use...
data.payload.hangup_source
enumThe party who ended the call (
callee
,
caller
,
unknown
).
data.payload.sip_hangup_cause
stringThe reason the call was ended (SIP response code).
data.payload.call_quality_stats
['object', 'null']Call quality statistics aggregated from the CHANNEL_HANGUP_COMPLETE event.
callRecordingSaved
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.connection_id
stringCall Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.client_state
stringState received from a command.
data.payload.recording_started_at
date-timeISO 8601 datetime of when recording started.
data.payload.recording_ended_at
date-timeISO 8601 datetime of when recording ended.
data.payload.channels
enumWhether recording was recorded in
single
or
dual
channel.
callMachineDetectionEnded
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringCall Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.from
stringNumber or SIP URI placing the call.
data.payload.to
stringDestination number or SIP URI of the call.
data.payload.result
enumAnswering machine detection result.
callMachineGreetingEnded
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringCall Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.from
stringNumber or SIP URI placing the call.
data.payload.to
stringDestination number or SIP URI of the call.
data.payload.result
enumAnswering machine greeting ended result.
callMachinePremiumDetectionEnded
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringCall Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.from
stringNumber or SIP URI placing the call.
data.payload.to
stringDestination number or SIP URI of the call.
data.payload.result
enumPremium Answering Machine Detection result.
callMachinePremiumGreetingEnded
FieldTypeDescription
data.record_type
enumIdentifies the type of the resource.
data.event_type
enumThe type of event being delivered.
data.id
uuidIdentifies the type of resource.
data.occurred_at
date-timeISO 8601 datetime of when the event occurred.
data.payload.call_control_id
stringCall ID used to issue commands via Call Control API.
data.payload.connection_id
stringCall Control App ID (formerly Telnyx connection ID) used in the call.
data.payload.call_leg_id
stringID that is unique to the call and can be used to correlate webhook events.
data.payload.call_session_id
stringID that is unique to the call session and can be used to correlate webhook events.
data.payload.client_state
stringState received from a command.
data.payload.from
stringNumber or SIP URI placing the call.
data.payload.to
stringDestination number or SIP URI of the call.
data.payload.result
enumPremium Answering Machine Greeting Ended result.
callAnswered
字段类型描述
data.record_type
枚举标识资源类型
data.event_type
枚举标识所传递的事件类型
data.id
uuid标识资源ID
data.occurred_at
日期时间事件发生的ISO 8601格式时间
data.payload.call_control_id
字符串用于通过Call Control API发送命令的呼叫ID
data.payload.connection_id
字符串呼叫中使用的Call Control应用ID(原Telnyx连接ID)
data.payload.call_leg_id
字符串呼叫唯一ID,用于关联Webhook事件
data.payload.call_session_id
字符串呼叫会话唯一ID,用于关联Webhook事件
data.payload.client_state
字符串从命令中接收的状态信息
data.payload.custom_headers
对象数组接听命令中设置的自定义头信息
data.payload.sip_headers
对象数组SIP邀请中的用户对用户及转移头信息
data.payload.from
字符串发起呼叫的号码或SIP URI
data.payload.to
字符串呼叫的目标号码或SIP URI
data.payload.start_time
日期时间呼叫启动的ISO 8601格式时间
data.payload.state
枚举从命令中接收的状态信息
data.payload.tags
字符串数组与号码关联的标签数组
callStreamingStarted
字段类型描述
data.record_type
枚举标识资源类型
data.event_type
枚举标识所传递的事件类型
data.id
uuid标识资源ID
data.occurred_at
日期时间事件发生的ISO 8601格式时间
data.payload.call_control_id
字符串用于通过Call Control API发送命令的呼叫ID
data.payload.connection_id
字符串呼叫中使用的Call Control应用ID(原Telnyx连接ID)
data.payload.call_leg_id
字符串呼叫唯一ID,用于关联Webhook事件
data.payload.call_session_id
字符串呼叫会话唯一ID,用于关联Webhook事件
data.payload.client_state
字符串从命令中接收的状态信息
data.payload.stream_url
字符串呼叫流将发送至的目标WebSocket地址
callStreamingStopped
字段类型描述
data.record_type
枚举标识资源类型
data.event_type
枚举标识所传递的事件类型
data.id
uuid标识资源ID
data.occurred_at
日期时间事件发生的ISO 8601格式时间
data.payload.call_control_id
字符串用于通过Call Control API发送命令的呼叫ID
data.payload.connection_id
字符串呼叫中使用的Call Control应用ID(原Telnyx连接ID)
data.payload.call_leg_id
字符串呼叫唯一ID,用于关联Webhook事件
data.payload.call_session_id
字符串呼叫会话唯一ID,用于关联Webhook事件
data.payload.client_state
字符串从命令中接收的状态信息
data.payload.stream_url
字符串呼叫流将发送至的目标WebSocket地址
callStreamingFailed
字段类型描述
data.record_type
枚举标识资源类型
data.event_type
枚举标识所传递的事件类型
data.id
uuid标识资源ID
data.occurred_at
日期时间事件发生的ISO 8601格式时间
data.payload.call_control_id
字符串用于通过Call Control API发送命令的呼叫ID
data.payload.connection_id
字符串呼叫中使用的Call Control应用ID(原Telnyx连接ID)
data.payload.call_leg_id
字符串呼叫唯一ID,用于关联Webhook事件
data.payload.call_session_id
字符串呼叫会话唯一ID,用于关联Webhook事件
data.payload.client_state
字符串从命令中接收的状态信息
data.payload.failure_reason
字符串媒体流启动失败的简短说明
data.payload.stream_id
uuid标识流ID
data.payload.stream_type
枚举流连接的类型
callBridged
字段类型描述
data.record_type
枚举标识资源类型
data.event_type
枚举标识所传递的事件类型
data.id
uuid标识资源ID
data.occurred_at
日期时间事件发生的ISO 8601格式时间
data.payload.call_control_id
字符串用于通过Call Control API发送命令的呼叫ID
data.payload.connection_id
字符串呼叫中使用的Call Control应用ID(原Telnyx连接ID)
data.payload.call_leg_id
字符串呼叫唯一ID,用于关联Webhook事件
data.payload.call_session_id
字符串呼叫会话唯一ID,用于关联Webhook事件
data.payload.client_state
字符串从命令中接收的状态信息
data.payload.from
字符串发起呼叫的号码或SIP URI
data.payload.to
字符串呼叫的目标号码或SIP URI
callInitiated
字段类型描述
data.record_type
枚举标识资源类型
data.event_type
枚举标识所传递的事件类型
data.id
uuid标识资源ID
data.occurred_at
日期时间事件发生的ISO 8601格式时间
data.payload.call_control_id
字符串用于通过Call Control API发送命令的呼叫ID
data.payload.connection_id
字符串呼叫中使用的Call Control应用ID(原Telnyx连接ID)
data.payload.connection_codecs
字符串连接启用的编解码器列表,以逗号分隔
data.payload.offered_codecs
字符串呼叫方提供的编解码器列表,以逗号分隔
data.payload.call_leg_id
字符串呼叫唯一ID,用于关联Webhook事件
data.payload.custom_headers
对象数组SIP邀请中的自定义头信息
data.payload.sip_headers
对象数组SIP邀请中的用户对用户及转移头信息
data.payload.shaken_stir_attestation
字符串SHAKEN/STIR认证级别
data.payload.shaken_stir_validated
布尔值认证是否成功验证
data.payload.call_session_id
字符串呼叫会话唯一ID,用于关联Webhook事件
data.payload.client_state
字符串从命令中接收的状态信息
data.payload.caller_id_name
字符串来电显示名称
data.payload.call_screening_result
字符串呼叫筛选结果
data.payload.from
字符串发起呼叫的号码或SIP URI
data.payload.to
字符串呼叫的目标号码或SIP URI
data.payload.direction
枚举呼叫方向,
incoming
(呼入)或
outgoing
(呼出)
data.payload.state
枚举从命令中接收的状态信息
data.payload.start_time
日期时间呼叫启动的ISO 8601格式时间
data.payload.tags
字符串数组与号码关联的标签数组
callHangup
字段类型描述
data.record_type
枚举标识资源类型
data.event_type
枚举标识所传递的事件类型
data.id
uuid标识资源ID
data.occurred_at
日期时间事件发生的ISO 8601格式时间
data.payload.call_control_id
字符串用于通过Call Control API发送命令的呼叫ID
data.payload.connection_id
字符串呼叫中使用的Call Control应用ID(原Telnyx连接ID)
data.payload.call_leg_id
字符串呼叫唯一ID,用于关联Webhook事件
data.payload.call_session_id
字符串呼叫会话唯一ID,用于关联Webhook事件
data.payload.client_state
字符串从命令中接收的状态信息
data.payload.custom_headers
对象数组接听命令中设置的自定义头信息
data.payload.sip_headers
对象数组SIP邀请中的用户对用户及转移头信息
data.payload.from
字符串发起呼叫的号码或SIP URI
data.payload.to
字符串呼叫的目标号码或SIP URI
data.payload.start_time
日期时间呼叫启动的ISO 8601格式时间
data.payload.state
枚举从命令中接收的状态信息
data.payload.tags
字符串数组与号码关联的标签数组
data.payload.hangup_cause
枚举呼叫结束原因(
call_rejected
normal_clearing
originator_cancel
timeout
time_limit
等)
data.payload.hangup_source
枚举结束呼叫的一方(
callee
被叫、
caller
主叫、
unknown
未知)
data.payload.sip_hangup_cause
字符串呼叫结束的SIP响应码原因
data.payload.call_quality_stats
对象或null从CHANNEL_HANGUP_COMPLETE事件聚合的呼叫质量统计信息
callRecordingSaved
字段类型描述
data.record_type
枚举标识资源类型
data.event_type
枚举标识所传递的事件类型
data.id
uuid标识资源ID
data.occurred_at
日期时间事件发生的ISO 8601格式时间
data.payload.call_leg_id
字符串呼叫唯一ID,用于关联Webhook事件
data.payload.call_session_id
字符串呼叫会话唯一ID,用于关联Webhook事件
data.payload.connection_id
字符串呼叫中使用的Call Control应用ID(原Telnyx连接ID)
data.payload.client_state
字符串从命令中接收的状态信息
data.payload.recording_started_at
日期时间录音启动的ISO 8601格式时间
data.payload.recording_ended_at
日期时间录音结束的ISO 8601格式时间
data.payload.channels
枚举录音声道类型,
single
单声道或
dual
双声道
callMachineDetectionEnded
字段类型描述
data.record_type
枚举标识资源类型
data.event_type
枚举标识所传递的事件类型
data.id
uuid标识资源ID
data.occurred_at
日期时间事件发生的ISO 8601格式时间
data.payload.call_control_id
字符串用于通过Call Control API发送命令的呼叫ID
data.payload.connection_id
字符串呼叫中使用的Call Control应用ID(原Telnyx连接ID)
data.payload.call_leg_id
字符串呼叫唯一ID,用于关联Webhook事件
data.payload.call_session_id
字符串呼叫会话唯一ID,用于关联Webhook事件
data.payload.client_state
字符串从命令中接收的状态信息
data.payload.from
字符串发起呼叫的号码或SIP URI
data.payload.to
字符串呼叫的目标号码或SIP URI
data.payload.result
枚举答录机检测结果
callMachineGreetingEnded
字段类型描述
data.record_type
枚举标识资源类型
data.event_type
枚举标识所传递的事件类型
data.id
uuid标识资源ID
data.occurred_at
日期时间事件发生的ISO 8601格式时间
data.payload.call_control_id
字符串用于通过Call Control API发送命令的呼叫ID
data.payload.connection_id
字符串呼叫中使用的Call Control应用ID(原Telnyx连接ID)
data.payload.call_leg_id
字符串呼叫唯一ID,用于关联Webhook事件
data.payload.call_session_id
字符串呼叫会话唯一ID,用于关联Webhook事件
data.payload.client_state
字符串从命令中接收的状态信息
data.payload.from
字符串发起呼叫的号码或SIP URI
data.payload.to
字符串呼叫的目标号码或SIP URI
data.payload.result
枚举答录机问候语检测结果
callMachinePremiumDetectionEnded
字段类型描述
data.record_type
枚举标识资源类型
data.event_type
枚举标识所传递的事件类型
data.id
uuid标识资源ID
data.occurred_at
日期时间事件发生的ISO 8601格式时间
data.payload.call_control_id
字符串用于通过Call Control API发送命令的呼叫ID
data.payload.connection_id
字符串呼叫中使用的Call Control应用ID(原Telnyx连接ID)
data.payload.call_leg_id
字符串呼叫唯一ID,用于关联Webhook事件
data.payload.call_session_id
字符串呼叫会话唯一ID,用于关联Webhook事件
data.payload.client_state
字符串从命令中接收的状态信息
data.payload.from
字符串发起呼叫的号码或SIP URI
data.payload.to
字符串呼叫的目标号码或SIP URI
data.payload.result
枚举高级答录机检测结果
callMachinePremiumGreetingEnded
字段类型描述
data.record_type
枚举标识资源类型
data.event_type
枚举标识所传递的事件类型
data.id
uuid标识资源ID
data.occurred_at
日期时间事件发生的ISO 8601格式时间
data.payload.call_control_id
字符串用于通过Call Control API发送命令的呼叫ID
data.payload.connection_id
字符串呼叫中使用的Call Control应用ID(原Telnyx连接ID)
data.payload.call_leg_id
字符串呼叫唯一ID,用于关联Webhook事件
data.payload.call_session_id
字符串呼叫会话唯一ID,用于关联Webhook事件
data.payload.client_state
字符串从命令中接收的状态信息
data.payload.from
字符串发起呼叫的号码或SIP URI
data.payload.to
字符串呼叫的目标号码或SIP URI
data.payload.result
枚举高级答录机问候语检测结果