telnyx-voice-python

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
<!-- 由Telnyx OpenAPI规范自动生成。请勿编辑。 -->

Telnyx Voice - Python

Telnyx Voice - Python

Installation

安装

bash
pip install telnyx
bash
pip install telnyx

Setup

配置

python
import os
from telnyx import Telnyx

client = Telnyx(
    api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
)
All examples below assume
client
is already initialized as shown above.
python
import os
from telnyx import Telnyx

client = Telnyx(
    api_key=os.environ.get("TELNYX_API_KEY"),  # 这是默认值,可省略
)
以下所有示例均假设已按上述方式初始化
client

Error Handling

错误处理

All API calls can fail with network errors, rate limits (429), validation errors (422), or authentication errors (401). Always handle errors in production code:
python
import telnyx

try:
    response = client.calls.dial(
        connection_id="7267xxxxxxxxxxxxxx",
        from_="+18005550101",
        to="+18005550100",
    )
except telnyx.APIConnectionError:
    print("Network error — check connectivity and retry")
except telnyx.RateLimitError:
    import time
    time.sleep(1)  # Check Retry-After header for actual delay
except telnyx.APIStatusError as e:
    print(f"API error {e.status_code}: {e.message}")
    if e.status_code == 422:
        print("Validation error — check required fields and formats")
Common error codes:
401
invalid API key,
403
insufficient permissions,
404
resource not found,
422
validation error (check field formats),
429
rate limited (retry with exponential backoff).
所有API调用都可能因网络错误、速率限制(429)、验证错误(422)或身份验证错误(401)而失败。在生产代码中务必处理错误:
python
import telnyx

try:
    response = client.calls.dial(
        connection_id="7267xxxxxxxxxxxxxx",
        from_="+18005550101",
        to="+18005550100",
    )
except telnyx.APIConnectionError:
    print("网络错误 — 检查连接并重试")
except telnyx.RateLimitError:
    import time
    time.sleep(1)  # 查看Retry-After header获取实际延迟时间
except telnyx.APIStatusError as e:
    print(f"API错误 {e.status_code}: {e.message}")
    if e.status_code == 422:
        print("验证错误 — 检查必填字段和格式")
常见错误代码:
401
无效API密钥,
403
权限不足,
404
资源未找到,
422
验证错误(检查字段格式),
429
速率受限(使用指数退避策略重试)。

Important Notes

重要说明

  • Phone numbers must be in E.164 format (e.g.,
    +13125550001
    ). Include the
    +
    prefix and country code. No spaces, dashes, or parentheses.
  • Pagination: List methods return an auto-paginating iterator. Use
    for item in page_result:
    to iterate through all pages automatically.
  • 电话号码必须采用E.164格式(例如:
    +13125550001
    )。需包含
    +
    前缀和国家代码,不能有空格、短横线或括号。
  • 分页:列表方法返回自动分页的迭代器。使用
    for item in page_result:
    可自动遍历所有页面。

Operational Caveats

操作注意事项

  • Call Control is event-driven. After
    dial()
    or an inbound webhook, issue follow-up commands from webhook handlers using the
    call_control_id
    in the event payload.
  • Outbound and inbound flows are different: outbound calls start with
    dial()
    , while inbound calls must be answered from the incoming webhook before other commands run.
  • A publicly reachable webhook endpoint is required for real call control. Without it, calls may connect but your application cannot drive the live call state.
  • 呼叫控制是事件驱动的。执行
    dial()
    或收到入站webhook后,需使用事件负载中的
    call_control_id
    在webhook处理器中发出后续命令。
  • 呼出和呼入流程不同:呼出呼叫从
    dial()
    开始,而呼入呼叫必须先在入站webhook中接听,才能执行其他命令。
  • 实时呼叫控制需要一个可公开访问的webhook端点。如果没有,呼叫可能会接通,但应用无法控制实时呼叫状态。

Reference Use Rules

参考使用规则

Do not invent Telnyx parameters, enums, response fields, or webhook fields.
  • If the parameter, enum, or response field you need is not shown inline in this skill, read references/api-details.md before writing code.
  • Before using any operation in
    ## Additional Operations
    , read the optional-parameters section and the response-schemas section.
  • Before reading or matching webhook fields beyond the inline examples, read the webhook payload reference.
请勿自行编造Telnyx的参数、枚举、响应字段或webhook字段。
  • 如果本技能中未列出你需要的参数、枚举或响应字段,请在编写代码前阅读references/api-details.md
  • 在使用
    ## 额外操作
    中的任何操作之前,请阅读可选参数部分响应架构部分
  • 在读取或匹配示例以外的webhook字段之前,请阅读webhook负载参考

Core Tasks

核心任务

Dial an outbound call

发起呼出呼叫

Primary voice entrypoint. Agents need the async call-control identifiers returned here.
client.calls.dial()
POST /calls
ParameterTypeRequiredDescription
to
string (E.164)YesThe DID or SIP URI to dial out to.
from_
string (E.164)YesThe
from
number to be used as the caller id presented to t...
connection_id
string (UUID)YesThe ID of the Call Control App (formerly ID of the connectio...
timeout_secs
integerNoThe number of seconds that Telnyx will wait for the call to ...
billing_group_id
string (UUID)NoUse this field to set the Billing Group ID for the call.
client_state
stringNoUse this field to add state to every subsequent webhook.
...+48 optional params in references/api-details.md
python
response = client.calls.dial(
    connection_id="7267xxxxxxxxxxxxxx",
    from_="+18005550101",
    to="+18005550100",
)
print(response.data)
Primary response fields:
  • response.data.call_control_id
  • response.data.call_leg_id
  • response.data.call_session_id
  • response.data.is_alive
  • response.data.recording_id
  • response.data.call_duration
主要的语音入口。Agent需要此处返回的异步呼叫控制标识符。
client.calls.dial()
POST /calls
参数类型必填描述
to
string (E.164)要呼出的DID或SIP URI。
from_
string (E.164)作为主叫号码显示给被叫方的
from
号码。
connection_id
string (UUID)呼叫控制应用的ID(原连接ID)。
timeout_secs
integerTelnyx等待呼叫接通的秒数。
billing_group_id
string (UUID)使用此字段设置呼叫的计费组ID。
client_state
string使用此字段为后续所有webhook添加状态信息。
...references/api-details.md中还有48个可选参数
python
response = client.calls.dial(
    connection_id="7267xxxxxxxxxxxxxx",
    from_="+18005550101",
    to="+18005550100",
)
print(response.data)
主要响应字段:
  • response.data.call_control_id
  • response.data.call_leg_id
  • response.data.call_session_id
  • response.data.is_alive
  • response.data.recording_id
  • response.data.call_duration

Answer an inbound call

接听呼入呼叫

Primary inbound call-control command.
client.calls.actions.answer()
POST /calls/{call_control_id}/actions/answer
ParameterTypeRequiredDescription
call_control_id
string (UUID)YesUnique identifier and token for controlling the call
billing_group_id
string (UUID)NoUse this field to set the Billing Group ID for the call.
client_state
stringNoUse this field to add state to every subsequent webhook.
webhook_url
string (URL)NoUse this field to override the URL for which Telnyx will sen...
...+26 optional params in references/api-details.md
python
response = client.calls.actions.answer(
    call_control_id="550e8400-e29b-41d4-a716-446655440000",
)
print(response.data)
Primary response fields:
  • response.data.result
  • response.data.recording_id
主要的呼入呼叫控制命令。
client.calls.actions.answer()
POST /calls/{call_control_id}/actions/answer
参数类型必填描述
call_control_id
string (UUID)用于控制呼叫的唯一标识符和令牌
billing_group_id
string (UUID)使用此字段设置呼叫的计费组ID。
client_state
string使用此字段为后续所有webhook添加状态信息。
webhook_url
string (URL)使用此字段覆盖Telnyx发送webhook的URL。
...references/api-details.md中还有26个可选参数
python
response = client.calls.actions.answer(
    call_control_id="550e8400-e29b-41d4-a716-446655440000",
)
print(response.data)
主要响应字段:
  • response.data.result
  • response.data.recording_id

Transfer a live call

转接实时呼叫

Common post-answer control path with downstream webhook implications.
client.calls.actions.transfer()
POST /calls/{call_control_id}/actions/transfer
ParameterTypeRequiredDescription
to
string (E.164)YesThe DID or SIP URI to dial out to.
call_control_id
string (UUID)YesUnique identifier and token for controlling the call
timeout_secs
integerNoThe number of seconds that Telnyx will wait for the call to ...
client_state
stringNoUse this field to add state to every subsequent webhook.
webhook_url
string (URL)NoUse this field to override the URL for which Telnyx will sen...
...+33 optional params in references/api-details.md
python
response = client.calls.actions.transfer(
    call_control_id="550e8400-e29b-41d4-a716-446655440000",
    to="+18005550100",
)
print(response.data)
Primary response fields:
  • response.data.result

常见的接听后控制流程,会影响后续webhook。
client.calls.actions.transfer()
POST /calls/{call_control_id}/actions/transfer
参数类型必填描述
to
string (E.164)要转接的DID或SIP URI。
call_control_id
string (UUID)用于控制呼叫的唯一标识符和令牌
timeout_secs
integerTelnyx等待呼叫接通的秒数。
client_state
string使用此字段为后续所有webhook添加状态信息。
webhook_url
string (URL)使用此字段覆盖Telnyx发送webhook的URL。
...references/api-details.md中还有33个可选参数
python
response = client.calls.actions.transfer(
    call_control_id="550e8400-e29b-41d4-a716-446655440000",
    to="+18005550100",
)
print(response.data)
主要响应字段:
  • response.data.result

Webhook Verification

Webhook验证

Telnyx signs webhooks with Ed25519. Each request includes
telnyx-signature-ed25519
and
telnyx-timestamp
headers. Always verify signatures in production:
python
undefined
Telnyx使用Ed25519对webhook进行签名。每个请求都包含
telnyx-signature-ed25519
telnyx-timestamp
头。在生产环境中务必验证签名:
python
undefined

In your webhook handler (e.g., Flask — use raw body, not parsed JSON):

在你的webhook处理器中(例如Flask — 使用原始请求体,而非解析后的JSON):

@app.route("/webhooks", methods=["POST"]) def handle_webhook(): payload = request.get_data(as_text=True) # raw body as string headers = dict(request.headers) try: event = client.webhooks.unwrap(payload, headers=headers) except Exception as e: print(f"Webhook verification failed: {e}") return "Invalid signature", 400 # Signature valid — event is the parsed webhook payload print(f"Received event: {event.data.event_type}") return "OK", 200
undefined
@app.route("/webhooks", methods=["POST"]) def handle_webhook(): payload = request.get_data(as_text=True) # 原始请求体字符串 headers = dict(request.headers) try: event = client.webhooks.unwrap(payload, headers=headers) except Exception as e: print(f"Webhook验证失败: {e}") return "无效签名", 400 # 签名有效 — event是解析后的webhook负载 print(f"收到事件: {event.data.event_type}") return "OK", 200
undefined

Webhooks

Webhooks

These webhook payload fields are inline because they are part of the primary integration path.
以下webhook负载字段是内联显示的,因为它们属于主要集成流程的一部分。

Call Answered

呼叫已接通

FieldTypeDescription
data.record_type
enum: eventIdentifies the type of the resource.
data.event_type
enum: call.answeredThe 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 ev...
字段类型描述
data.record_type
enum: event标识资源类型。
data.event_type
enum: call.answered传递的事件类型。
data.id
uuid标识资源类型。
data.occurred_at
date-time事件发生的ISO 8601格式时间。
data.payload.call_control_id
string用于通过呼叫控制API发出命令的呼叫ID。
data.payload.connection_id
string呼叫中使用的呼叫控制应用ID(原Telnyx连接ID)。
data.payload.call_leg_id
string呼叫的唯一ID,可用于关联webhook事件。
data.payload.call_session_id
string呼叫会话的唯一ID,可用于关联webhook事件。

Call Hangup

呼叫已挂断

FieldTypeDescription
data.record_type
enum: eventIdentifies the type of the resource.
data.event_type
enum: call.hangupThe 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 ev...
字段类型描述
data.record_type
enum: event标识资源类型。
data.event_type
enum: call.hangup传递的事件类型。
data.id
uuid标识资源类型。
data.occurred_at
date-time事件发生的ISO 8601格式时间。
data.payload.call_control_id
string用于通过呼叫控制API发出命令的呼叫ID。
data.payload.connection_id
string呼叫中使用的呼叫控制应用ID(原Telnyx连接ID)。
data.payload.call_leg_id
string呼叫的唯一ID,可用于关联webhook事件。
data.payload.call_session_id
string呼叫会话的唯一ID,可用于关联webhook事件。

Call Initiated

呼叫已发起

FieldTypeDescription
data.record_type
enum: eventIdentifies the type of the resource.
data.event_type
enum: call.initiatedThe 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.
If you need webhook fields that are not listed inline here, read the webhook payload reference before writing the handler.

字段类型描述
data.record_type
enum: event标识资源类型。
data.event_type
enum: call.initiated传递的事件类型。
data.id
uuid标识资源类型。
data.occurred_at
date-time事件发生的ISO 8601格式时间。
data.payload.call_control_id
string用于通过呼叫控制API发出命令的呼叫ID。
data.payload.connection_id
string呼叫中使用的呼叫控制应用ID(原Telnyx连接ID)。
data.payload.connection_codecs
string连接启用的编解码器列表,用逗号分隔。
data.payload.offered_codecs
string主叫方提供的编解码器列表,用逗号分隔。
如果需要此处未列出的webhook字段,请在编写处理器前阅读webhook负载参考

Important Supporting Operations

重要辅助操作

Use these when the core tasks above are close to your flow, but you need a common variation or follow-up step.
当上述核心任务接近你的业务流程,但你需要常见变体或后续步骤时,可以使用这些操作。

Hangup call

挂断呼叫

End a live call from your webhook-driven control flow.
client.calls.actions.hangup()
POST /calls/{call_control_id}/actions/hangup
ParameterTypeRequiredDescription
call_control_id
string (UUID)YesUnique identifier and token for controlling the call
client_state
stringNoUse this field to add state to every subsequent webhook.
command_id
string (UUID)NoUse this field to avoid duplicate commands.
custom_headers
array[object]NoCustom headers to be added to the SIP BYE message.
python
response = client.calls.actions.hangup(
    call_control_id="550e8400-e29b-41d4-a716-446655440000",
)
print(response.data)
Primary response fields:
  • response.data.result
从webhook驱动的控制流程中结束实时呼叫。
client.calls.actions.hangup()
POST /calls/{call_control_id}/actions/hangup
参数类型必填描述
call_control_id
string (UUID)用于控制呼叫的唯一标识符和令牌
client_state
string使用此字段为后续所有webhook添加状态信息。
command_id
string (UUID)使用此字段避免重复命令。
custom_headers
array[object]要添加到SIP BYE消息中的自定义头。
python
response = client.calls.actions.hangup(
    call_control_id="550e8400-e29b-41d4-a716-446655440000",
)
print(response.data)
主要响应字段:
  • response.data.result

Bridge calls

桥接呼叫

Trigger a follow-up action in an existing workflow rather than creating a new top-level resource.
client.calls.actions.bridge()
POST /calls/{call_control_id}/actions/bridge
ParameterTypeRequiredDescription
call_control_id
string (UUID)YesThe Call Control ID of the call you want to bridge with, can...
call_control_id
string (UUID)YesUnique identifier and token for controlling the call
client_state
stringNoUse this field to add state to every subsequent webhook.
command_id
string (UUID)NoUse this field to avoid duplicate commands.
video_room_id
string (UUID)NoThe ID of the video room you want to bridge with, can't be u...
...+16 optional params in references/api-details.md
python
response = client.calls.actions.bridge(
    call_control_id_to_bridge="call_control_id",
    call_control_id_to_bridge_with="v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
)
print(response.data)
Primary response fields:
  • response.data.result
在现有工作流中触发后续操作,而非创建新的顶级资源。
client.calls.actions.bridge()
POST /calls/{call_control_id}/actions/bridge
参数类型必填描述
call_control_id
string (UUID)要桥接的呼叫的呼叫控制ID
call_control_id
string (UUID)用于控制呼叫的唯一标识符和令牌
client_state
string使用此字段为后续所有webhook添加状态信息。
command_id
string (UUID)使用此字段避免重复命令。
video_room_id
string (UUID)要桥接的视频房间ID,不能与...同时使用
...references/api-details.md中还有16个可选参数
python
response = client.calls.actions.bridge(
    call_control_id_to_bridge="call_control_id",
    call_control_id_to_bridge_with="v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
)
print(response.data)
主要响应字段:
  • response.data.result

Reject a call

拒绝呼叫

Trigger a follow-up action in an existing workflow rather than creating a new top-level resource.
client.calls.actions.reject()
POST /calls/{call_control_id}/actions/reject
ParameterTypeRequiredDescription
cause
enum (CALL_REJECTED, USER_BUSY)YesCause for call rejection.
call_control_id
string (UUID)YesUnique identifier and token for controlling the call
client_state
stringNoUse this field to add state to every subsequent webhook.
command_id
string (UUID)NoUse this field to avoid duplicate commands.
python
response = client.calls.actions.reject(
    call_control_id="550e8400-e29b-41d4-a716-446655440000",
    cause="USER_BUSY",
)
print(response.data)
Primary response fields:
  • response.data.result
在现有工作流中触发后续操作,而非创建新的顶级资源。
client.calls.actions.reject()
POST /calls/{call_control_id}/actions/reject
参数类型必填描述
cause
enum (CALL_REJECTED, USER_BUSY)拒绝呼叫的原因。
call_control_id
string (UUID)用于控制呼叫的唯一标识符和令牌
client_state
string使用此字段为后续所有webhook添加状态信息。
command_id
string (UUID)使用此字段避免重复命令。
python
response = client.calls.actions.reject(
    call_control_id="550e8400-e29b-41d4-a716-446655440000",
    cause="USER_BUSY",
)
print(response.data)
主要响应字段:
  • response.data.result

Retrieve a call status

查询呼叫状态

Fetch the current state before updating, deleting, or making control-flow decisions.
client.calls.retrieve_status()
GET /calls/{call_control_id}
ParameterTypeRequiredDescription
call_control_id
string (UUID)YesUnique identifier and token for controlling the call
python
response = client.calls.retrieve_status(
    "call_control_id",
)
print(response.data)
Primary response fields:
  • response.data.call_control_id
  • response.data.call_duration
  • response.data.call_leg_id
  • response.data.call_session_id
  • response.data.client_state
  • response.data.end_time
在更新、删除或做出控制流决策前获取当前状态。
client.calls.retrieve_status()
GET /calls/{call_control_id}
参数类型必填描述
call_control_id
string (UUID)用于控制呼叫的唯一标识符和令牌
python
response = client.calls.retrieve_status(
    "call_control_id",
)
print(response.data)
主要响应字段:
  • response.data.call_control_id
  • response.data.call_duration
  • response.data.call_leg_id
  • response.data.call_session_id
  • response.data.client_state
  • response.data.end_time

List all active calls for given connection

查询指定连接的所有活跃呼叫

Fetch the current state before updating, deleting, or making control-flow decisions.
client.connections.list_active_calls()
GET /connections/{connection_id}/active_calls
ParameterTypeRequiredDescription
connection_id
string (UUID)YesTelnyx connection id
page
objectNoConsolidated page parameter (deepObject style).
python
page = client.connections.list_active_calls(
    connection_id="1293384261075731461",
)
page = page.data[0]
print(page.call_control_id)
Response wrapper:
  • items:
    page.data
  • pagination:
    page.meta
Primary item fields:
  • call_control_id
  • call_duration
  • call_leg_id
  • call_session_id
  • client_state
  • record_type
在更新、删除或做出控制流决策前获取当前状态。
client.connections.list_active_calls()
GET /connections/{connection_id}/active_calls
参数类型必填描述
connection_id
string (UUID)Telnyx连接ID
page
object合并的分页参数(deepObject风格)。
python
page = client.connections.list_active_calls(
    connection_id="1293384261075731461",
)
page = page.data[0]
print(page.call_control_id)
响应包装器:
  • 条目:
    page.data
  • 分页:
    page.meta
主要条目字段:
  • call_control_id
  • call_duration
  • call_leg_id
  • call_session_id
  • client_state
  • record_type

List call control applications

查询呼叫控制应用

Inspect available resources or choose an existing resource before mutating it.
client.call_control_applications.list()
GET /call_control_applications
ParameterTypeRequiredDescription
sort
enum (created_at, connection_name, active)NoSpecifies the sort order for results.
filter
objectNoConsolidated filter parameter (deepObject style).
page
objectNoConsolidated page parameter (deepObject style).
python
page = client.call_control_applications.list()
page = page.data[0]
print(page.id)
Response wrapper:
  • items:
    page.data
  • pagination:
    page.meta
Primary item fields:
  • id
  • created_at
  • updated_at
  • active
  • anchorsite_override
  • application_name

在修改资源前检查可用资源或选择现有资源。
client.call_control_applications.list()
GET /call_control_applications
参数类型必填描述
sort
enum (created_at, connection_name, active)指定结果的排序顺序。
filter
object合并的筛选参数(deepObject风格)。
page
object合并的分页参数(deepObject风格)。
python
page = client.call_control_applications.list()
page = page.data[0]
print(page.id)
响应包装器:
  • 条目:
    page.data
  • 分页:
    page.meta
主要条目字段:
  • id
  • created_at
  • updated_at
  • active
  • anchorsite_override
  • application_name

Additional Operations

额外操作

Use the core tasks above first. The operations below are indexed here with exact SDK methods and required params; use references/api-details.md for full optional params, response schemas, and lower-frequency webhook payloads. Before using any operation below, read the optional-parameters section and the response-schemas section so you do not guess missing fields.
OperationSDK methodEndpointUse whenRequired params
Create a call control application
client.call_control_applications.create()
POST /call_control_applications
Create or provision an additional resource when the core tasks do not cover this flow.
application_name
,
webhook_event_url
Retrieve a call control application
client.call_control_applications.retrieve()
GET /call_control_applications/{id}
Fetch the current state before updating, deleting, or making control-flow decisions.
id
Update a call control application
client.call_control_applications.update()
PATCH /call_control_applications/{id}
Modify an existing resource without recreating it.
application_name
,
webhook_event_url
,
id
Delete a call control application
client.call_control_applications.delete()
DELETE /call_control_applications/{id}
Remove, detach, or clean up an existing resource.
id
SIP Refer a call
client.calls.actions.refer()
POST /calls/{call_control_id}/actions/refer
Trigger a follow-up action in an existing workflow rather than creating a new top-level resource.
sip_address
,
call_control_id
Send SIP info
client.calls.actions.send_sip_info()
POST /calls/{call_control_id}/actions/send_sip_info
Trigger a follow-up action in an existing workflow rather than creating a new top-level resource.
content_type
,
body
,
call_control_id
请优先使用上述核心任务。以下操作在此处索引,包含确切的SDK方法和必填参数;如需完整的可选参数、响应架构和低频webhook负载,请使用references/api-details.md。在使用以下任何操作前,请阅读可选参数部分响应架构部分,避免猜测缺失字段。
操作SDK方法端点使用场景必填参数
创建呼叫控制应用
client.call_control_applications.create()
POST /call_control_applications
当核心任务无法覆盖业务流程时,创建或配置额外资源。
application_name
,
webhook_event_url
查询呼叫控制应用
client.call_control_applications.retrieve()
GET /call_control_applications/{id}
在更新、删除或做出控制流决策前获取当前状态。
id
更新呼叫控制应用
client.call_control_applications.update()
PATCH /call_control_applications/{id}
修改现有资源,无需重新创建。
application_name
,
webhook_event_url
,
id
删除呼叫控制应用
client.call_control_applications.delete()
DELETE /call_control_applications/{id}
删除、分离或清理现有资源。
id
SIP转接呼叫
client.calls.actions.refer()
POST /calls/{call_control_id}/actions/refer
在现有工作流中触发后续操作,而非创建新的顶级资源。
sip_address
,
call_control_id
发送SIP信息
client.calls.actions.send_sip_info()
POST /calls/{call_control_id}/actions/send_sip_info
在现有工作流中触发后续操作,而非创建新的顶级资源。
content_type
,
body
,
call_control_id

Other Webhook Events

其他Webhook事件

Event
data.event_type
Description
callBridged
call.bridged
Call Bridged

For exhaustive optional parameters, full response schemas, and complete webhook payloads, see references/api-details.md.
事件
data.event_type
描述
callBridged
call.bridged
呼叫已桥接

如需完整的可选参数、响应架构和webhook负载,请查看references/api-details.md