telnyx-voice-java

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 - Java

Telnyx Voice - Java

Installation

安装

text
<!-- Maven -->
<dependency>
    <groupId>com.telnyx.sdk</groupId>
    <artifactId>telnyx</artifactId>
    <version>6.36.0</version>
</dependency>

// Gradle
implementation("com.telnyx.sdk:telnyx:6.36.0")
text
<!-- Maven -->
<dependency>
    <groupId>com.telnyx.sdk</groupId>
    <artifactId>telnyx</artifactId>
    <version>6.36.0</version>
</dependency>

// Gradle
implementation("com.telnyx.sdk:telnyx:6.36.0")

Setup

初始化设置

java
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

TelnyxClient client = TelnyxOkHttpClient.fromEnv();
All examples below assume
client
is already initialized as shown above.
java
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

TelnyxClient client = TelnyxOkHttpClient.fromEnv();
以下所有示例都假设
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:
java
import com.telnyx.sdk.models.calls.CallDialParams;
import com.telnyx.sdk.models.calls.CallDialResponse;
CallDialParams params = CallDialParams.builder()
    .connectionId("7267xxxxxxxxxxxxxx")
    .from("+18005550101")
    .to("+18005550100")
    .build();
CallDialResponse response = client.calls().dial(params);
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),生产环境代码请务必做好错误处理:
java
import com.telnyx.sdk.models.calls.CallDialParams;
import com.telnyx.sdk.models.calls.CallDialResponse;
CallDialParams params = CallDialParams.builder()
    .connectionId("7267xxxxxxxxxxxxxx")
    .from("+18005550101")
    .to("+18005550100")
    .build();
CallDialResponse response = client.calls().dial(params);
常见错误码:
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 a page. Use
    .autoPager()
    for automatic iteration:
    for (var item : page.autoPager()) { ... }
    . For manual control, use
    .hasNextPage()
    and
    .nextPage()
    .
  • 电话号码 必须采用E.164格式(例如:
    +13125550001
    ),需包含
    +
    前缀和国家代码,不得包含空格、破折号或括号。
  • 分页: 列表方法返回单页数据,如需自动遍历可使用
    .autoPager()
    for (var item : page.autoPager()) { ... }
    。如需手动控制分页,可使用
    .hasNextPage()
    .nextPage()
    方法。

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后,需使用事件payload中的
    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字段。
  • 如果本skill中没有展示你需要的参数、枚举或响应字段,请在编写代码前阅读references/api-details.md
  • 在使用
    ## 额外操作
    中的任意接口前,请阅读可选参数章节响应schema章节
  • 如需读取或匹配超出内联示例的webhook字段,请先阅读webhook payload参考

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...
connectionId
string (UUID)YesThe ID of the Call Control App (formerly ID of the connectio...
timeoutSecs
integerNoThe number of seconds that Telnyx will wait for the call to ...
billingGroupId
string (UUID)NoUse this field to set the Billing Group ID for the call.
clientState
stringNoUse this field to add state to every subsequent webhook.
...+48 optional params in references/api-details.md
java
import com.telnyx.sdk.models.calls.CallDialParams;
import com.telnyx.sdk.models.calls.CallDialResponse;

CallDialParams params = CallDialParams.builder()
    .connectionId("7267xxxxxxxxxxxxxx")
    .from("+18005550101")
    .to("+18005550100")
    .build();
CallDialResponse response = client.calls().dial(params);
Primary response fields:
  • response.data.callControlId
  • response.data.callLegId
  • response.data.callSessionId
  • response.data.isAlive
  • response.data.recordingId
  • response.data.callDuration
语音服务核心入口,Agent需要此处返回的异步呼叫控制标识符。
client.calls().dial()
POST /calls
参数类型必填描述
to
string (E.164)要拨打的DID或SIP URI
from
string (E.164)向被叫展示的主叫来电号码
connectionId
string (UUID)呼叫控制应用的ID(原连接ID)
timeoutSecs
integerTelnyx等待呼叫接通的最大秒数
billingGroupId
string (UUID)用于设置该通话的计费组ID
clientState
string用于向后续所有webhook添加自定义状态
...其余48个可选参数见references/api-details.md
java
import com.telnyx.sdk.models.calls.CallDialParams;
import com.telnyx.sdk.models.calls.CallDialResponse;

CallDialParams params = CallDialParams.builder()
    .connectionId("7267xxxxxxxxxxxxxx")
    .from("+18005550101")
    .to("+18005550100")
    .build();
CallDialResponse response = client.calls().dial(params);
核心响应字段:
  • response.data.callControlId
  • response.data.callLegId
  • response.data.callSessionId
  • response.data.isAlive
  • response.data.recordingId
  • response.data.callDuration

Answer an inbound call

接听入站呼叫

Primary inbound call-control command.
client.calls().actions().answer()
POST /calls/{call_control_id}/actions/answer
ParameterTypeRequiredDescription
callControlId
string (UUID)YesUnique identifier and token for controlling the call
billingGroupId
string (UUID)NoUse this field to set the Billing Group ID for the call.
clientState
stringNoUse this field to add state to every subsequent webhook.
webhookUrl
string (URL)NoUse this field to override the URL for which Telnyx will sen...
...+26 optional params in references/api-details.md
java
import com.telnyx.sdk.models.calls.actions.ActionAnswerParams;
import com.telnyx.sdk.models.calls.actions.ActionAnswerResponse;

ActionAnswerResponse response = client.calls().actions().answer("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ");
Primary response fields:
  • response.data.result
  • response.data.recordingId
入站呼叫控制核心指令
client.calls().actions().answer()
POST /calls/{call_control_id}/actions/answer
参数类型必填描述
callControlId
string (UUID)用于控制呼叫的唯一标识符和令牌
billingGroupId
string (UUID)用于设置该通话的计费组ID
clientState
string用于向后续所有webhook添加自定义状态
webhookUrl
string (URL)用于覆盖Telnyx发送事件的默认webhook地址
...其余26个可选参数见references/api-details.md
java
import com.telnyx.sdk.models.calls.actions.ActionAnswerParams;
import com.telnyx.sdk.models.calls.actions.ActionAnswerResponse;

ActionAnswerResponse response = client.calls().actions().answer("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ");
核心响应字段:
  • response.data.result
  • response.data.recordingId

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.
callControlId
string (UUID)YesUnique identifier and token for controlling the call
timeoutSecs
integerNoThe number of seconds that Telnyx will wait for the call to ...
clientState
stringNoUse this field to add state to every subsequent webhook.
webhookUrl
string (URL)NoUse this field to override the URL for which Telnyx will sen...
...+33 optional params in references/api-details.md
java
import com.telnyx.sdk.models.calls.actions.ActionTransferParams;
import com.telnyx.sdk.models.calls.actions.ActionTransferResponse;

ActionTransferParams params = ActionTransferParams.builder()
    .callControlId("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ")
    .to("+18005550100")
    .build();
ActionTransferResponse response = client.calls().actions().transfer(params);
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
callControlId
string (UUID)用于控制呼叫的唯一标识符和令牌
timeoutSecs
integerTelnyx等待转接呼叫接通的最大秒数
clientState
string用于向后续所有webhook添加自定义状态
webhookUrl
string (URL)用于覆盖Telnyx发送事件的默认webhook地址
...其余33个可选参数见references/api-details.md
java
import com.telnyx.sdk.models.calls.actions.ActionTransferParams;
import com.telnyx.sdk.models.calls.actions.ActionTransferResponse;

ActionTransferParams params = ActionTransferParams.builder()
    .callControlId("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ")
    .to("+18005550100")
    .build();
ActionTransferResponse response = client.calls().actions().transfer(params);
核心响应字段:
  • 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:
java
import com.telnyx.sdk.core.UnwrapWebhookParams;
import com.telnyx.sdk.core.http.Headers;

// In your webhook handler (e.g., Spring — use raw body):
@PostMapping("/webhooks")
public ResponseEntity<String> handleWebhook(
    @RequestBody String payload,
    HttpServletRequest request) {
  try {
    Headers headers = Headers.builder()
        .put("telnyx-signature-ed25519", request.getHeader("telnyx-signature-ed25519"))
        .put("telnyx-timestamp", request.getHeader("telnyx-timestamp"))
        .build();
    var event = client.webhooks().unwrap(
        UnwrapWebhookParams.builder()
            .body(payload)
            .headers(headers)
            .build());
    // Signature valid — process the event
    System.out.println("Received webhook event");
    return ResponseEntity.ok("OK");
  } catch (Exception e) {
    System.err.println("Webhook verification failed: " + e.getMessage());
    return ResponseEntity.badRequest().body("Invalid signature");
  }
}
Telnyx使用Ed25519对webhook进行签名,每个请求都包含
telnyx-signature-ed25519
telnyx-timestamp
头,生产环境请务必验证签名:
java
import com.telnyx.sdk.core.UnwrapWebhookParams;
import com.telnyx.sdk.core.http.Headers;

// 在你的webhook处理器中(例如Spring请使用原始body):
@PostMapping("/webhooks")
public ResponseEntity<String> handleWebhook(
    @RequestBody String payload,
    HttpServletRequest request) {
  try {
    Headers headers = Headers.builder()
        .put("telnyx-signature-ed25519", request.getHeader("telnyx-signature-ed25519"))
        .put("telnyx-timestamp", request.getHeader("telnyx-timestamp"))
        .build();
    var event = client.webhooks().unwrap(
        UnwrapWebhookParams.builder()
            .body(payload)
            .headers(headers)
            .build());
    // 签名验证通过,处理事件
    System.out.println("Received webhook event");
    return ResponseEntity.ok("OK");
  } catch (Exception e) {
    System.err.println("Webhook verification failed: " + e.getMessage());
    return ResponseEntity.badRequest().body("Invalid signature");
  }
}

Webhooks

Webhooks

These webhook payload fields are inline because they are part of the primary integration path.
以下webhook payload字段属于核心集成路径,已内联展示。

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 payload参考

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
callControlId
string (UUID)YesUnique identifier and token for controlling the call
clientState
stringNoUse this field to add state to every subsequent webhook.
commandId
string (UUID)NoUse this field to avoid duplicate commands.
customHeaders
array[object]NoCustom headers to be added to the SIP BYE message.
java
import com.telnyx.sdk.models.calls.actions.ActionHangupParams;
import com.telnyx.sdk.models.calls.actions.ActionHangupResponse;

ActionHangupResponse response = client.calls().actions().hangup("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ");
Primary response fields:
  • response.data.result
从webhook驱动的控制流程中结束正在进行的通话
client.calls().actions().hangup()
POST /calls/{call_control_id}/actions/hangup
参数类型必填描述
callControlId
string (UUID)用于控制呼叫的唯一标识符和令牌
clientState
string用于向后续所有webhook添加自定义状态
commandId
string (UUID)用于避免重复执行指令
customHeaders
array[object]添加到SIP BYE消息中的自定义头
java
import com.telnyx.sdk.models.calls.actions.ActionHangupParams;
import com.telnyx.sdk.models.calls.actions.ActionHangupResponse;

ActionHangupResponse response = client.calls().actions().hangup("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ");
核心响应字段:
  • 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
callControlId
string (UUID)YesThe Call Control ID of the call you want to bridge with, can...
callControlId
string (UUID)YesUnique identifier and token for controlling the call
clientState
stringNoUse this field to add state to every subsequent webhook.
commandId
string (UUID)NoUse this field to avoid duplicate commands.
videoRoomId
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
java
import com.telnyx.sdk.models.calls.actions.ActionBridgeParams;
import com.telnyx.sdk.models.calls.actions.ActionBridgeResponse;

ActionBridgeParams params = ActionBridgeParams.builder()
    .callControlIdToBridge("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ")
    .callControlId("v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg")
    .build();
ActionBridgeResponse response = client.calls().actions().bridge(params);
Primary response fields:
  • response.data.result
在现有工作流中触发后续操作,而非创建新的顶层资源
client.calls().actions().bridge()
POST /calls/{call_control_id}/actions/bridge
参数类型必填描述
callControlIdToBridge
string (UUID)要桥接的目标通话的呼叫控制ID
callControlId
string (UUID)用于控制当前呼叫的唯一标识符和令牌
clientState
string用于向后续所有webhook添加自定义状态
commandId
string (UUID)用于避免重复执行指令
videoRoomId
string (UUID)要桥接的视频房间ID,不可与其他桥接目标共用
...其余16个可选参数见references/api-details.md
java
import com.telnyx.sdk.models.calls.actions.ActionBridgeParams;
import com.telnyx.sdk.models.calls.actions.ActionBridgeResponse;

ActionBridgeParams params = ActionBridgeParams.builder()
    .callControlIdToBridge("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ")
    .callControlId("v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg")
    .build();
ActionBridgeResponse response = client.calls().actions().bridge(params);
核心响应字段:
  • 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.
callControlId
string (UUID)YesUnique identifier and token for controlling the call
clientState
stringNoUse this field to add state to every subsequent webhook.
commandId
string (UUID)NoUse this field to avoid duplicate commands.
java
import com.telnyx.sdk.models.calls.actions.ActionRejectParams;
import com.telnyx.sdk.models.calls.actions.ActionRejectResponse;

ActionRejectParams params = ActionRejectParams.builder()
    .callControlId("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ")
    .cause(ActionRejectParams.Cause.USER_BUSY)
    .build();
ActionRejectResponse response = client.calls().actions().reject(params);
Primary response fields:
  • response.data.result
在现有工作流中触发后续操作,而非创建新的顶层资源
client.calls().actions().reject()
POST /calls/{call_control_id}/actions/reject
参数类型必填描述
cause
enum (CALL_REJECTED, USER_BUSY)拒接呼叫的原因
callControlId
string (UUID)用于控制呼叫的唯一标识符和令牌
clientState
string用于向后续所有webhook添加自定义状态
commandId
string (UUID)用于避免重复执行指令
java
import com.telnyx.sdk.models.calls.actions.ActionRejectParams;
import com.telnyx.sdk.models.calls.actions.ActionRejectResponse;

ActionRejectParams params = ActionRejectParams.builder()
    .callControlId("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ")
    .cause(ActionRejectParams.Cause.USER_BUSY)
    .build();
ActionRejectResponse response = client.calls().actions().reject(params);
核心响应字段:
  • response.data.result

Retrieve a call status

获取通话状态

Fetch the current state before updating, deleting, or making control-flow decisions.
client.calls().retrieveStatus()
GET /calls/{call_control_id}
ParameterTypeRequiredDescription
callControlId
string (UUID)YesUnique identifier and token for controlling the call
java
import com.telnyx.sdk.models.calls.CallRetrieveStatusParams;
import com.telnyx.sdk.models.calls.CallRetrieveStatusResponse;

CallRetrieveStatusResponse response = client.calls().retrieveStatus("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ");
Primary response fields:
  • response.data.callControlId
  • response.data.callDuration
  • response.data.callLegId
  • response.data.callSessionId
  • response.data.clientState
  • response.data.endTime
在更新、删除或做控制流决策前获取当前通话状态
client.calls().retrieveStatus()
GET /calls/{call_control_id}
参数类型必填描述
callControlId
string (UUID)用于控制呼叫的唯一标识符和令牌
java
import com.telnyx.sdk.models.calls.CallRetrieveStatusParams;
import com.telnyx.sdk.models.calls.CallRetrieveStatusResponse;

CallRetrieveStatusResponse response = client.calls().retrieveStatus("v3:550e8400-e29b-41d4-a716-446655440000_gRU1OGRkYQ");
核心响应字段:
  • response.data.callControlId
  • response.data.callDuration
  • response.data.callLegId
  • response.data.callSessionId
  • response.data.clientState
  • response.data.endTime

List all active calls for given connection

列出指定连接下所有活跃通话

Fetch the current state before updating, deleting, or making control-flow decisions.
client.connections().listActiveCalls()
GET /connections/{connection_id}/active_calls
ParameterTypeRequiredDescription
connectionId
string (UUID)YesTelnyx connection id
page
objectNoConsolidated page parameter (deepObject style).
java
import com.telnyx.sdk.models.connections.ConnectionListActiveCallsPage;
import com.telnyx.sdk.models.connections.ConnectionListActiveCallsParams;

ConnectionListActiveCallsPage page = client.connections().listActiveCalls("1293384261075731461");
Response wrapper:
  • items:
    page.data
  • pagination:
    page.meta
Primary item fields:
  • callControlId
  • callDuration
  • callLegId
  • callSessionId
  • clientState
  • recordType
在更新、删除或做控制流决策前获取当前状态
client.connections().listActiveCalls()
GET /connections/{connection_id}/active_calls
参数类型必填描述
connectionId
string (UUID)Telnyx连接ID
page
object统一分页参数(deepObject格式)
java
import com.telnyx.sdk.models.connections.ConnectionListActiveCallsPage;
import com.telnyx.sdk.models.connections.ConnectionListActiveCallsParams;

ConnectionListActiveCallsPage page = client.connections().listActiveCalls("1293384261075731461");
响应包装:
  • 条目列表:
    page.data
  • 分页信息:
    page.meta
核心条目字段:
  • callControlId
  • callDuration
  • callLegId
  • callSessionId
  • clientState
  • recordType

List call control applications

列出呼叫控制应用

Inspect available resources or choose an existing resource before mutating it.
client.callControlApplications().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).
java
import com.telnyx.sdk.models.callcontrolapplications.CallControlApplicationListPage;
import com.telnyx.sdk.models.callcontrolapplications.CallControlApplicationListParams;

CallControlApplicationListPage page = client.callControlApplications().list();
Response wrapper:
  • items:
    page.data
  • pagination:
    page.meta
Primary item fields:
  • id
  • createdAt
  • updatedAt
  • active
  • anchorsiteOverride
  • applicationName

在修改资源前查看可用资源或选择现有资源
client.callControlApplications().list()
GET /call_control_applications
参数类型必填描述
sort
enum (created_at, connection_name, active)指定结果的排序规则
filter
object统一过滤参数(deepObject格式)
page
object统一分页参数(deepObject格式)
java
import com.telnyx.sdk.models.callcontrolapplications.CallControlApplicationListPage;
import com.telnyx.sdk.models.callcontrolapplications.CallControlApplicationListParams;

CallControlApplicationListPage page = client.callControlApplications().list();
响应包装:
  • 条目列表:
    page.data
  • 分页信息:
    page.meta
核心条目字段:
  • id
  • createdAt
  • updatedAt
  • active
  • anchorsiteOverride
  • applicationName

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.callControlApplications().create()
POST /call_control_applications
Create or provision an additional resource when the core tasks do not cover this flow.
applicationName
,
webhookEventUrl
Retrieve a call control application
client.callControlApplications().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.callControlApplications().update()
PATCH /call_control_applications/{id}
Modify an existing resource without recreating it.
applicationName
,
webhookEventUrl
,
id
Delete a call control application
client.callControlApplications().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.
sipAddress
,
callControlId
Send SIP info
client.calls().actions().sendSipInfo()
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.
contentType
,
body
,
callControlId
请优先使用上述核心任务。以下操作已列出准确的SDK方法和必填参数,完整可选参数、响应schema和低频率webhook payload请参考references/api-details.md。 在使用以下任意操作前,请阅读可选参数章节响应schema章节,请勿猜测缺失字段。
操作SDK方法接口地址使用场景必填参数
创建呼叫控制应用
client.callControlApplications().create()
POST /call_control_applications
当核心任务未覆盖该流程时,创建或配置额外资源
applicationName
,
webhookEventUrl
获取呼叫控制应用信息
client.callControlApplications().retrieve()
GET /call_control_applications/{id}
在更新、删除或做控制流决策前获取当前状态
id
更新呼叫控制应用
client.callControlApplications().update()
PATCH /call_control_applications/{id}
修改现有资源无需重新创建
applicationName
,
webhookEventUrl
,
id
删除呼叫控制应用
client.callControlApplications().delete()
DELETE /call_control_applications/{id}
移除、解绑或清理现有资源
id
SIP转接呼叫
client.calls().actions().refer()
POST /calls/{call_control_id}/actions/refer
在现有工作流中触发后续操作,而非创建新的顶层资源
sipAddress
,
callControlId
发送SIP信息
client.calls().actions().sendSipInfo()
POST /calls/{call_control_id}/actions/send_sip_info
在现有工作流中触发后续操作,而非创建新的顶层资源
contentType
,
body
,
callControlId

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
通话已桥接

完整可选参数、全量响应schema和所有webhook payload请查看references/api-details.md