telnyx-texml-javascript

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

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

Telnyx Texml - JavaScript

Telnyx TeXML - JavaScript

Installation

安装

bash
npm install telnyx
bash
npm install telnyx

Setup

设置

javascript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
All examples below assume
client
is already initialized as shown above.
javascript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: process.env['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:
javascript
try {
  const result = await client.messages.send({ to: '+13125550001', from: '+13125550002', text: 'Hello' });
} catch (err) {
  if (err instanceof Telnyx.APIConnectionError) {
    console.error('Network error — check connectivity and retry');
  } else if (err instanceof Telnyx.RateLimitError) {
    // 429: rate limited — wait and retry with exponential backoff
    const retryAfter = err.headers?.['retry-after'] || 1;
    await new Promise(r => setTimeout(r, retryAfter * 1000));
  } else if (err instanceof Telnyx.APIError) {
    console.error(`API error ${err.status}: ${err.message}`);
    if (err.status === 422) {
      console.error('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)而失败。生产代码中务必处理错误:
javascript
try {
  const result = await client.messages.send({ to: '+13125550001', from: '+13125550002', text: 'Hello' });
} catch (err) {
  if (err instanceof Telnyx.APIConnectionError) {
    console.error('网络错误 — 检查连接性并重试');
  } else if (err instanceof Telnyx.RateLimitError) {
    // 429:速率受限 — 等待后使用指数退避策略重试
    const retryAfter = err.headers?.['retry-after'] || 1;
    await new Promise(r => setTimeout(r, retryAfter * 1000));
  } else if (err instanceof Telnyx.APIError) {
    console.error(`API错误 ${err.status}: ${err.message}`);
    if (err.status === 422) {
      console.error('验证错误 — 检查必填字段和格式');
    }
  }
}
常见错误代码:
401
无效API密钥,
403
权限不足,
404
资源未找到,
422
验证错误(检查字段格式),
429
速率受限(使用指数退避策略重试)。

Important Notes

重要说明

  • Pagination: List methods return an auto-paginating iterator. Use
    for await (const item of result) { ... }
    to iterate through all pages automatically.
  • 分页:列表方法返回自动分页的迭代器。使用
    for await (const item of result) { ... }
    自动遍历所有页面。

Fetch multiple call resources

获取多个通话资源

Returns multiple call resources for an account. This endpoint is eventually consistent.
GET /texml/Accounts/{account_sid}/Calls
javascript
const response = await client.texml.accounts.calls.retrieveCalls('account_sid');

console.log(response.calls);
Returns:
calls
(array[object]),
end
(integer),
first_page_uri
(string),
next_page_uri
(string),
page
(integer),
page_size
(integer),
start
(integer),
uri
(string)
返回账户下的多个通话资源。该接口最终一致。
GET /texml/Accounts/{account_sid}/Calls
javascript
const response = await client.texml.accounts.calls.retrieveCalls('account_sid');

console.log(response.calls);
返回:
calls
(对象数组),
end
(整数),
first_page_uri
(字符串),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
start
(整数),
uri
(字符串)

Initiate an outbound call

发起外呼通话

Initiate an outbound TeXML call. Telnyx will request TeXML from the XML Request URL configured for the connection in the Mission Control Portal.
POST /texml/Accounts/{account_sid}/Calls
— Required:
To
,
From
,
ApplicationSid
Optional:
AsyncAmd
(boolean),
AsyncAmdStatusCallback
(string),
AsyncAmdStatusCallbackMethod
(enum: GET, POST),
CallerId
(string),
CancelPlaybackOnDetectMessageEnd
(boolean),
CancelPlaybackOnMachineDetection
(boolean),
CustomHeaders
(array[object]),
DetectionMode
(enum: Premium, Regular),
FallbackUrl
(string),
MachineDetection
(enum: Enable, Disable, DetectMessageEnd),
MachineDetectionSilenceTimeout
(integer),
MachineDetectionSpeechEndThreshold
(integer),
MachineDetectionSpeechThreshold
(integer),
MachineDetectionTimeout
(integer),
PreferredCodecs
(string),
Record
(boolean),
RecordingChannels
(enum: mono, dual),
RecordingStatusCallback
(string),
RecordingStatusCallbackEvent
(string),
RecordingStatusCallbackMethod
(enum: GET, POST),
RecordingTimeout
(integer),
RecordingTrack
(enum: inbound, outbound, both),
SendRecordingUrl
(boolean),
SipAuthPassword
(string),
SipAuthUsername
(string),
SipRegion
(enum: US, Europe, Canada, Australia, Middle East),
StatusCallback
(string),
StatusCallbackEvent
(enum: initiated, ringing, answered, completed),
StatusCallbackMethod
(enum: GET, POST),
SuperviseCallSid
(string),
SupervisingRole
(enum: barge, whisper, monitor),
Texml
(string),
TimeLimit
(integer),
Timeout
(integer),
Trim
(enum: trim-silence, do-not-trim),
Url
(string),
UrlMethod
(enum: GET, POST)
javascript
const response = await client.texml.accounts.calls.calls('account_sid', {
  ApplicationSid: 'example-app-sid',
  From: '+13120001234',
  To: '+13121230000',
});

console.log(response.from);
Returns:
from
(string),
status
(string),
to
(string)
发起TeXML外呼通话。Telnyx将从Mission Control门户中为连接配置的XML请求URL获取TeXML。
POST /texml/Accounts/{account_sid}/Calls
— 必填:
To
From
ApplicationSid
可选:
AsyncAmd
(布尔值),
AsyncAmdStatusCallback
(字符串),
AsyncAmdStatusCallbackMethod
(枚举:GET、POST),
CallerId
(字符串),
CancelPlaybackOnDetectMessageEnd
(布尔值),
CancelPlaybackOnMachineDetection
(布尔值),
CustomHeaders
(对象数组),
DetectionMode
(枚举:Premium、Regular),
FallbackUrl
(字符串),
MachineDetection
(枚举:Enable、Disable、DetectMessageEnd),
MachineDetectionSilenceTimeout
(整数),
MachineDetectionSpeechEndThreshold
(整数),
MachineDetectionSpeechThreshold
(整数),
MachineDetectionTimeout
(整数),
PreferredCodecs
(字符串),
Record
(布尔值),
RecordingChannels
(枚举:mono、dual),
RecordingStatusCallback
(字符串),
RecordingStatusCallbackEvent
(字符串),
RecordingStatusCallbackMethod
(枚举:GET、POST),
RecordingTimeout
(整数),
RecordingTrack
(枚举:inbound、outbound、both),
SendRecordingUrl
(布尔值),
SipAuthPassword
(字符串),
SipAuthUsername
(字符串),
SipRegion
(枚举:US、Europe、Canada、Australia、Middle East),
StatusCallback
(字符串),
StatusCallbackEvent
(枚举:initiated、ringing、answered、completed),
StatusCallbackMethod
(枚举:GET、POST),
SuperviseCallSid
(字符串),
SupervisingRole
(枚举:barge、whisper、monitor),
Texml
(字符串),
TimeLimit
(整数),
Timeout
(整数),
Trim
(枚举:trim-silence、do-not-trim),
Url
(字符串),
UrlMethod
(枚举:GET、POST)
javascript
const response = await client.texml.accounts.calls.calls('account_sid', {
  ApplicationSid: 'example-app-sid',
  From: '+13120001234',
  To: '+13121230000',
});

console.log(response.from);
返回:
from
(字符串),
status
(字符串),
to
(字符串)

Fetch a call

获取单个通话

Returns an individual call identified by its CallSid. This endpoint is eventually consistent.
GET /texml/Accounts/{account_sid}/Calls/{call_sid}
javascript
const call = await client.texml.accounts.calls.retrieve('call_sid', { account_sid: '550e8400-e29b-41d4-a716-446655440000' });

console.log(call.account_sid);
Returns:
account_sid
(string),
answered_by
(enum: human, machine, not_sure),
caller_name
(string),
date_created
(string),
date_updated
(string),
direction
(enum: inbound, outbound),
duration
(string),
end_time
(string),
from
(string),
from_formatted
(string),
price
(string),
price_unit
(string),
sid
(string),
start_time
(string),
status
(enum: ringing, in-progress, canceled, completed, failed, busy, no-answer),
to
(string),
to_formatted
(string),
uri
(string)
返回由CallSid标识的单个通话资源。该接口最终一致。
GET /texml/Accounts/{account_sid}/Calls/{call_sid}
javascript
const call = await client.texml.accounts.calls.retrieve('call_sid', { account_sid: '550e8400-e29b-41d4-a716-446655440000' });

console.log(call.account_sid);
返回:
account_sid
(字符串),
answered_by
(枚举:human、machine、not_sure),
caller_name
(字符串),
date_created
(字符串),
date_updated
(字符串),
direction
(枚举:inbound、outbound),
duration
(字符串),
end_time
(字符串),
from
(字符串),
from_formatted
(字符串),
price
(字符串),
price_unit
(字符串),
sid
(字符串),
start_time
(字符串),
status
(枚举:ringing、in-progress、canceled、completed、failed、busy、no-answer),
to
(字符串),
to_formatted
(字符串),
uri
(字符串)

Update call

更新通话

Update TeXML call. Please note that the keys present in the payload MUST BE formatted in CamelCase as specified in the example.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}
javascript
const call = await client.texml.accounts.calls.update('call_sid', { account_sid: '550e8400-e29b-41d4-a716-446655440000' });

console.log(call.account_sid);
Returns:
account_sid
(string),
answered_by
(enum: human, machine, not_sure),
caller_name
(string),
date_created
(string),
date_updated
(string),
direction
(enum: inbound, outbound),
duration
(string),
end_time
(string),
from
(string),
from_formatted
(string),
price
(string),
price_unit
(string),
sid
(string),
start_time
(string),
status
(enum: ringing, in-progress, canceled, completed, failed, busy, no-answer),
to
(string),
to_formatted
(string),
uri
(string)
更新TeXML通话。请注意,请求体中的键必须按照示例指定的驼峰式格式编写。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}
javascript
const call = await client.texml.accounts.calls.update('call_sid', { account_sid: '550e8400-e29b-41d4-a716-446655440000' });

console.log(call.account_sid);
返回:
account_sid
(字符串),
answered_by
(枚举:human、machine、not_sure),
caller_name
(字符串),
date_created
(字符串),
date_updated
(字符串),
direction
(枚举:inbound、outbound),
duration
(字符串),
end_time
(字符串),
from
(字符串),
from_formatted
(字符串),
price
(字符串),
price_unit
(字符串),
sid
(字符串),
start_time
(字符串),
status
(枚举:ringing、in-progress、canceled、completed、failed、busy、no-answer),
to
(字符串),
to_formatted
(字符串),
uri
(字符串)

Fetch recordings for a call

获取通话录音

Returns recordings for a call identified by call_sid.
GET /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json
javascript
const response = await client.texml.accounts.calls.recordingsJson.retrieveRecordingsJson(
  'call_sid',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000' },
);

console.log(response.end);
Returns:
end
(integer),
first_page_uri
(uri),
next_page_uri
(string),
page
(integer),
page_size
(integer),
previous_page_uri
(uri),
recordings
(array[object]),
start
(integer),
uri
(string)
返回由call_sid标识的通话的录音资源。
GET /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json
javascript
const response = await client.texml.accounts.calls.recordingsJson.retrieveRecordingsJson(
  'call_sid',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000' },
);

console.log(response.end);
返回:
end
(整数),
first_page_uri
(uri),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
previous_page_uri
(uri),
recordings
(对象数组),
start
(整数),
uri
(字符串)

Request recording for a call

请求通话录音

Starts recording with specified parameters for call identified by call_sid.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json
javascript
const response = await client.texml.accounts.calls.recordingsJson.recordingsJson('call_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(response.account_sid);
Returns:
account_sid
(string),
call_sid
(string),
channels
(enum: 1, 2),
conference_sid
(uuid),
date_created
(date-time),
date_updated
(date-time),
duration
(string | null),
error_code
(string | null),
price
(string | null),
price_unit
(string | null),
sid
(string),
source
(enum: StartCallRecordingAPI, StartConferenceRecordingAPI, OutboundAPI, DialVerb, Conference, RecordVerb, Trunking),
start_time
(date-time),
track
(enum: inbound, outbound, both),
uri
(string)
为call_sid标识的通话启动指定参数的录音。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings.json
javascript
const response = await client.texml.accounts.calls.recordingsJson.recordingsJson('call_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(response.account_sid);
返回:
account_sid
(字符串),
call_sid
(字符串),
channels
(枚举:1、2),
conference_sid
(uuid),
date_created
(date-time),
date_updated
(date-time),
duration
(字符串 | null),
error_code
(字符串 | null),
price
(字符串 | null),
price_unit
(字符串 | null),
sid
(字符串),
source
(枚举:StartCallRecordingAPI、StartConferenceRecordingAPI、OutboundAPI、DialVerb、Conference、RecordVerb、Trunking),
start_time
(date-time),
track
(枚举:inbound、outbound、both),
uri
(字符串)

Update recording on a call

更新通话录音

Updates recording resource for particular call.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings/{recording_sid}.json
javascript
const response = await client.texml.accounts.calls.recordings.recordingSidJson(
  '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000', call_sid: '550e8400-e29b-41d4-a716-446655440000' },
);

console.log(response.account_sid);
Returns:
account_sid
(string),
call_sid
(string),
channels
(enum: 1, 2),
conference_sid
(uuid),
date_created
(date-time),
date_updated
(date-time),
duration
(string | null),
error_code
(string | null),
price
(string | null),
price_unit
(string | null),
sid
(string),
source
(enum: StartCallRecordingAPI, StartConferenceRecordingAPI, OutboundAPI, DialVerb, Conference, RecordVerb, Trunking),
start_time
(date-time),
track
(enum: inbound, outbound, both),
uri
(string)
更新特定通话的录音资源。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Recordings/{recording_sid}.json
javascript
const response = await client.texml.accounts.calls.recordings.recordingSidJson(
  '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000', call_sid: '550e8400-e29b-41d4-a716-446655440000' },
);

console.log(response.account_sid);
返回:
account_sid
(字符串),
call_sid
(字符串),
channels
(枚举:1、2),
conference_sid
(uuid),
date_created
(date-time),
date_updated
(date-time),
duration
(字符串 | null),
error_code
(字符串 | null),
price
(字符串 | null),
price_unit
(字符串 | null),
sid
(字符串),
source
(枚举:StartCallRecordingAPI、StartConferenceRecordingAPI、OutboundAPI、DialVerb、Conference、RecordVerb、Trunking),
start_time
(date-time),
track
(枚举:inbound、outbound、both),
uri
(字符串)

Request siprec session for a call

请求通话SIPREC会话

Starts siprec session with specified parameters for call identified by call_sid.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec.json
javascript
const response = await client.texml.accounts.calls.siprecJson('call_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(response.account_sid);
Returns:
account_sid
(string),
call_sid
(string),
date_created
(string),
date_updated
(string),
error_code
(string),
sid
(string),
start_time
(string),
status
(enum: in-progress, stopped),
track
(enum: both_tracks, inbound_track, outbound_track),
uri
(string)
为call_sid标识的通话启动指定参数的SIPREC会话。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec.json
javascript
const response = await client.texml.accounts.calls.siprecJson('call_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(response.account_sid);
返回:
account_sid
(字符串),
call_sid
(字符串),
date_created
(字符串),
date_updated
(字符串),
error_code
(字符串),
sid
(字符串),
start_time
(字符串),
status
(枚举:in-progress、stopped),
track
(枚举:both_tracks、inbound_track、outbound_track),
uri
(字符串)

Updates siprec session for a call

更新通话SIPREC会话

Updates siprec session identified by siprec_sid.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec/{siprec_sid}.json
javascript
const response = await client.texml.accounts.calls.siprec.siprecSidJson('siprec_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
  call_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(response.account_sid);
Returns:
account_sid
(string),
call_sid
(string),
date_updated
(string),
error_code
(string),
sid
(string),
status
(enum: in-progress, stopped),
uri
(string)
更新由siprec_sid标识的SIPREC会话。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Siprec/{siprec_sid}.json
javascript
const response = await client.texml.accounts.calls.siprec.siprecSidJson('siprec_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
  call_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(response.account_sid);
返回:
account_sid
(字符串),
call_sid
(字符串),
date_updated
(字符串),
error_code
(字符串),
sid
(字符串),
status
(枚举:in-progress、stopped),
uri
(字符串)

Start streaming media from a call.

启动通话媒体流

Starts streaming media from a call to a specific WebSocket address.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Streams.json
javascript
const response = await client.texml.accounts.calls.streamsJson('call_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(response.account_sid);
Returns:
account_sid
(string),
call_sid
(string),
date_updated
(date-time),
name
(string),
sid
(string),
status
(enum: in-progress),
uri
(string)
启动通话媒体流到指定WebSocket地址。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Streams.json
javascript
const response = await client.texml.accounts.calls.streamsJson('call_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(response.account_sid);
返回:
account_sid
(字符串),
call_sid
(字符串),
date_updated
(date-time),
name
(字符串),
sid
(字符串),
status
(枚举:in-progress),
uri
(字符串)

Update streaming on a call

更新通话媒体流

Updates streaming resource for particular call.
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Streams/{streaming_sid}.json
javascript
const response = await client.texml.accounts.calls.streams.streamingSidJson(
  '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000', call_sid: '550e8400-e29b-41d4-a716-446655440000' },
);

console.log(response.account_sid);
Returns:
account_sid
(string),
call_sid
(string),
date_updated
(date-time),
sid
(string),
status
(enum: stopped),
uri
(string)
更新特定通话的媒体流资源。
POST /texml/Accounts/{account_sid}/Calls/{call_sid}/Streams/{streaming_sid}.json
javascript
const response = await client.texml.accounts.calls.streams.streamingSidJson(
  '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000', call_sid: '550e8400-e29b-41d4-a716-446655440000' },
);

console.log(response.account_sid);
返回:
account_sid
(字符串),
call_sid
(字符串),
date_updated
(date-time),
sid
(字符串),
status
(枚举:stopped),
uri
(字符串)

List conference resources

列出会议资源

Lists conference resources.
GET /texml/Accounts/{account_sid}/Conferences
javascript
const response = await client.texml.accounts.conferences.retrieveConferences('account_sid');

console.log(response.conferences);
Returns:
conferences
(array[object]),
end
(integer),
first_page_uri
(string),
next_page_uri
(string),
page
(integer),
page_size
(integer),
start
(integer),
uri
(string)
列出会议资源。
GET /texml/Accounts/{account_sid}/Conferences
javascript
const response = await client.texml.accounts.conferences.retrieveConferences('account_sid');

console.log(response.conferences);
返回:
conferences
(对象数组),
end
(整数),
first_page_uri
(字符串),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
start
(整数),
uri
(字符串)

Fetch a conference resource

获取单个会议资源

Returns a conference resource.
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}
javascript
const conference = await client.texml.accounts.conferences.retrieve('conference_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(conference.account_sid);
Returns:
account_sid
(string),
api_version
(string),
call_sid_ending_conference
(string),
date_created
(string),
date_updated
(string),
friendly_name
(string),
reason_conference_ended
(enum: participant-with-end-conference-on-exit-left, last-participant-left, conference-ended-via-api, time-exceeded),
region
(string),
sid
(string),
status
(enum: init, in-progress, completed),
subresource_uris
(object),
uri
(string)
返回单个会议资源。
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}
javascript
const conference = await client.texml.accounts.conferences.retrieve('conference_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(conference.account_sid);
返回:
account_sid
(字符串),
api_version
(字符串),
call_sid_ending_conference
(字符串),
date_created
(字符串),
date_updated
(字符串),
friendly_name
(字符串),
reason_conference_ended
(枚举:participant-with-end-conference-on-exit-left、last-participant-left、conference-ended-via-api、time-exceeded),
region
(字符串),
sid
(字符串),
status
(枚举:init、in-progress、completed),
subresource_uris
(对象),
uri
(字符串)

Update a conference resource

更新会议资源

Updates a conference resource.
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}
javascript
const conference = await client.texml.accounts.conferences.update('conference_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(conference.account_sid);
Returns:
account_sid
(string),
api_version
(string),
call_sid_ending_conference
(string),
date_created
(string),
date_updated
(string),
friendly_name
(string),
reason_conference_ended
(enum: participant-with-end-conference-on-exit-left, last-participant-left, conference-ended-via-api, time-exceeded),
region
(string),
sid
(string),
status
(enum: init, in-progress, completed),
subresource_uris
(object),
uri
(string)
更新会议资源。
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}
javascript
const conference = await client.texml.accounts.conferences.update('conference_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(conference.account_sid);
返回:
account_sid
(字符串),
api_version
(字符串),
call_sid_ending_conference
(字符串),
date_created
(字符串),
date_updated
(字符串),
friendly_name
(字符串),
reason_conference_ended
(枚举:participant-with-end-conference-on-exit-left、last-participant-left、conference-ended-via-api、time-exceeded),
region
(字符串),
sid
(字符串),
status
(枚举:init、in-progress、completed),
subresource_uris
(对象),
uri
(字符串)

List conference participants

列出会议参与者

Lists conference participants
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants
javascript
const response = await client.texml.accounts.conferences.participants.retrieveParticipants(
  'conference_sid',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000' },
);

console.log(response.end);
Returns:
end
(integer),
first_page_uri
(string),
next_page_uri
(string),
page
(integer),
page_size
(integer),
participants
(array[object]),
start
(integer),
uri
(string)
列出会议参与者
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants
javascript
const response = await client.texml.accounts.conferences.participants.retrieveParticipants(
  'conference_sid',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000' },
);

console.log(response.end);
返回:
end
(整数),
first_page_uri
(字符串),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
participants
(对象数组),
start
(整数),
uri
(字符串)

Dial a new conference participant

拨打新会议参与者

Dials a new conference participant
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants
javascript
const response = await client.texml.accounts.conferences.participants.participants(
  'conference_sid',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000' },
);

console.log(response.account_sid);
Returns:
account_sid
(string),
call_sid
(string),
coaching
(boolean),
coaching_call_sid
(string),
conference_sid
(uuid),
end_conference_on_exit
(boolean),
hold
(boolean),
muted
(boolean),
status
(enum: connecting, connected, completed),
uri
(string)
拨打新会议参与者
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants
javascript
const response = await client.texml.accounts.conferences.participants.participants(
  'conference_sid',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000' },
);

console.log(response.account_sid);
返回:
account_sid
(字符串),
call_sid
(字符串),
coaching
(布尔值),
coaching_call_sid
(字符串),
conference_sid
(uuid),
end_conference_on_exit
(布尔值),
hold
(布尔值),
muted
(布尔值),
status
(枚举:connecting、connected、completed),
uri
(字符串)

Get conference participant resource

获取会议参与者资源

Gets conference participant resource
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
javascript
const participant = await client.texml.accounts.conferences.participants.retrieve(
  'call_sid_or_participant_label',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000', conference_sid: '550e8400-e29b-41d4-a716-446655440000' },
);

console.log(participant.account_sid);
Returns:
account_sid
(string),
api_version
(string),
call_sid
(string),
call_sid_legacy
(string),
coaching
(boolean),
coaching_call_sid
(string),
coaching_call_sid_legacy
(string),
conference_sid
(uuid),
date_created
(string),
date_updated
(string),
end_conference_on_exit
(boolean),
hold
(boolean),
muted
(boolean),
status
(enum: connecting, connected, completed),
uri
(string)
获取会议参与者资源
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
javascript
const participant = await client.texml.accounts.conferences.participants.retrieve(
  'call_sid_or_participant_label',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000', conference_sid: '550e8400-e29b-41d4-a716-446655440000' },
);

console.log(participant.account_sid);
返回:
account_sid
(字符串),
api_version
(字符串),
call_sid
(字符串),
call_sid_legacy
(字符串),
coaching
(布尔值),
coaching_call_sid
(字符串),
coaching_call_sid_legacy
(字符串),
conference_sid
(uuid),
date_created
(字符串),
date_updated
(字符串),
end_conference_on_exit
(布尔值),
hold
(布尔值),
muted
(布尔值),
status
(枚举:connecting、connected、completed),
uri
(字符串)

Update a conference participant

更新会议参与者

Updates a conference participant
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
javascript
const participant = await client.texml.accounts.conferences.participants.update(
  'call_sid_or_participant_label',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000', conference_sid: '550e8400-e29b-41d4-a716-446655440000' },
);

console.log(participant.account_sid);
Returns:
account_sid
(string),
api_version
(string),
call_sid
(string),
call_sid_legacy
(string),
coaching
(boolean),
coaching_call_sid
(string),
coaching_call_sid_legacy
(string),
conference_sid
(uuid),
date_created
(string),
date_updated
(string),
end_conference_on_exit
(boolean),
hold
(boolean),
muted
(boolean),
status
(enum: connecting, connected, completed),
uri
(string)
更新会议参与者
POST /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
javascript
const participant = await client.texml.accounts.conferences.participants.update(
  'call_sid_or_participant_label',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000', conference_sid: '550e8400-e29b-41d4-a716-446655440000' },
);

console.log(participant.account_sid);
返回:
account_sid
(字符串),
api_version
(字符串),
call_sid
(字符串),
call_sid_legacy
(字符串),
coaching
(布尔值),
coaching_call_sid
(字符串),
coaching_call_sid_legacy
(字符串),
conference_sid
(uuid),
date_created
(字符串),
date_updated
(字符串),
end_conference_on_exit
(布尔值),
hold
(布尔值),
muted
(布尔值),
status
(枚举:connecting、connected、completed),
uri
(字符串)

Delete a conference participant

删除会议参与者

Deletes a conference participant
DELETE /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
javascript
await client.texml.accounts.conferences.participants.delete('call_sid_or_participant_label', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
  conference_sid: '550e8400-e29b-41d4-a716-446655440000',
});
删除会议参与者
DELETE /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Participants/{call_sid_or_participant_label}
javascript
await client.texml.accounts.conferences.participants.delete('call_sid_or_participant_label', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
  conference_sid: '550e8400-e29b-41d4-a716-446655440000',
});

List conference recordings

列出会议录音

Lists conference recordings
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings
javascript
const response = await client.texml.accounts.conferences.retrieveRecordings('conference_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(response.end);
Returns:
end
(integer),
first_page_uri
(string),
next_page_uri
(string),
page
(integer),
page_size
(integer),
participants
(array[object]),
recordings
(array[object]),
start
(integer),
uri
(string)
列出会议录音
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings
javascript
const response = await client.texml.accounts.conferences.retrieveRecordings('conference_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(response.end);
返回:
end
(整数),
first_page_uri
(字符串),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
participants
(对象数组),
recordings
(对象数组),
start
(整数),
uri
(字符串)

Fetch recordings for a conference

获取会议录音

Returns recordings for a conference identified by conference_sid.
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings.json
javascript
const response = await client.texml.accounts.conferences.retrieveRecordingsJson('conference_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(response.end);
Returns:
end
(integer),
first_page_uri
(uri),
next_page_uri
(string),
page
(integer),
page_size
(integer),
previous_page_uri
(uri),
recordings
(array[object]),
start
(integer),
uri
(string)
返回由conference_sid标识的会议的录音资源。
GET /texml/Accounts/{account_sid}/Conferences/{conference_sid}/Recordings.json
javascript
const response = await client.texml.accounts.conferences.retrieveRecordingsJson('conference_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(response.end);
返回:
end
(整数),
first_page_uri
(uri),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
previous_page_uri
(uri),
recordings
(对象数组),
start
(整数),
uri
(字符串)

List queue resources

列出队列资源

Lists queue resources.
GET /texml/Accounts/{account_sid}/Queues
javascript
// Automatically fetches more pages as needed.
for await (const queueListResponse of client.texml.accounts.queues.list('account_sid')) {
  console.log(queueListResponse.account_sid);
}
Returns:
end
(integer),
first_page_uri
(string),
next_page_uri
(string),
page
(integer),
page_size
(integer),
queues
(array[object]),
start
(integer),
uri
(string)
列出队列资源。
GET /texml/Accounts/{account_sid}/Queues
javascript
// 自动按需获取更多页面。
for await (const queueListResponse of client.texml.accounts.queues.list('account_sid')) {
  console.log(queueListResponse.account_sid);
}
返回:
end
(整数),
first_page_uri
(字符串),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
queues
(对象数组),
start
(整数),
uri
(字符串)

Create a new queue

创建新队列

Creates a new queue resource.
POST /texml/Accounts/{account_sid}/Queues
javascript
const queue = await client.texml.accounts.queues.create('account_sid');

console.log(queue.account_sid);
Returns:
account_sid
(string),
average_wait_time
(integer),
current_size
(integer),
date_created
(string),
date_updated
(string),
max_size
(integer),
sid
(string),
subresource_uris
(object),
uri
(string)
创建新队列资源。
POST /texml/Accounts/{account_sid}/Queues
javascript
const queue = await client.texml.accounts.queues.create('account_sid');

console.log(queue.account_sid);
返回:
account_sid
(字符串),
average_wait_time
(整数),
current_size
(整数),
date_created
(字符串),
date_updated
(字符串),
max_size
(整数),
sid
(字符串),
subresource_uris
(对象),
uri
(字符串)

Fetch a queue resource

获取单个队列资源

Returns a queue resource.
GET /texml/Accounts/{account_sid}/Queues/{queue_sid}
javascript
const queue = await client.texml.accounts.queues.retrieve('queue_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(queue.account_sid);
Returns:
account_sid
(string),
average_wait_time
(integer),
current_size
(integer),
date_created
(string),
date_updated
(string),
max_size
(integer),
sid
(string),
subresource_uris
(object),
uri
(string)
返回单个队列资源。
GET /texml/Accounts/{account_sid}/Queues/{queue_sid}
javascript
const queue = await client.texml.accounts.queues.retrieve('queue_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(queue.account_sid);
返回:
account_sid
(字符串),
average_wait_time
(整数),
current_size
(整数),
date_created
(字符串),
date_updated
(字符串),
max_size
(整数),
sid
(字符串),
subresource_uris
(对象),
uri
(字符串)

Update a queue resource

更新队列资源

Updates a queue resource.
POST /texml/Accounts/{account_sid}/Queues/{queue_sid}
javascript
const queue = await client.texml.accounts.queues.update('queue_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(queue.account_sid);
Returns:
account_sid
(string),
average_wait_time
(integer),
current_size
(integer),
date_created
(string),
date_updated
(string),
max_size
(integer),
sid
(string),
subresource_uris
(object),
uri
(string)
更新队列资源。
POST /texml/Accounts/{account_sid}/Queues/{queue_sid}
javascript
const queue = await client.texml.accounts.queues.update('queue_sid', {
  account_sid: '550e8400-e29b-41d4-a716-446655440000',
});

console.log(queue.account_sid);
返回:
account_sid
(字符串),
average_wait_time
(整数),
current_size
(整数),
date_created
(字符串),
date_updated
(字符串),
max_size
(整数),
sid
(字符串),
subresource_uris
(对象),
uri
(字符串)

Delete a queue resource

删除队列资源

Delete a queue resource.
DELETE /texml/Accounts/{account_sid}/Queues/{queue_sid}
javascript
await client.texml.accounts.queues.delete('queue_sid', { account_sid: '550e8400-e29b-41d4-a716-446655440000' });
删除队列资源。
DELETE /texml/Accounts/{account_sid}/Queues/{queue_sid}
javascript
await client.texml.accounts.queues.delete('queue_sid', { account_sid: '550e8400-e29b-41d4-a716-446655440000' });

Fetch multiple recording resources

获取多个录音资源

Returns multiple recording resources for an account.
GET /texml/Accounts/{account_sid}/Recordings.json
javascript
const response = await client.texml.accounts.retrieveRecordingsJson('account_sid');

console.log(response.end);
Returns:
end
(integer),
first_page_uri
(uri),
next_page_uri
(string),
page
(integer),
page_size
(integer),
previous_page_uri
(uri),
recordings
(array[object]),
start
(integer),
uri
(string)
返回账户下的多个录音资源。
GET /texml/Accounts/{account_sid}/Recordings.json
javascript
const response = await client.texml.accounts.retrieveRecordingsJson('account_sid');

console.log(response.end);
返回:
end
(整数),
first_page_uri
(uri),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
previous_page_uri
(uri),
recordings
(对象数组),
start
(整数),
uri
(字符串)

Fetch recording resource

获取单个录音资源

Returns recording resource identified by recording id.
GET /texml/Accounts/{account_sid}/Recordings/{recording_sid}.json
javascript
const texmlGetCallRecordingResponseBody =
  await client.texml.accounts.recordings.json.retrieveRecordingSidJson(
    '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
    { account_sid: '550e8400-e29b-41d4-a716-446655440000' },
  );

console.log(texmlGetCallRecordingResponseBody.account_sid);
Returns:
account_sid
(string),
call_sid
(string),
channels
(enum: 1, 2),
conference_sid
(uuid),
date_created
(date-time),
date_updated
(date-time),
duration
(string | null),
error_code
(string | null),
media_url
(uri),
sid
(string),
source
(enum: StartCallRecordingAPI, StartConferenceRecordingAPI, OutboundAPI, DialVerb, Conference, RecordVerb, Trunking),
start_time
(date-time),
status
(enum: in-progress, completed, paused, stopped),
subresources_uris
(object),
uri
(string)
返回由录音ID标识的录音资源。
GET /texml/Accounts/{account_sid}/Recordings/{recording_sid}.json
javascript
const texmlGetCallRecordingResponseBody =
  await client.texml.accounts.recordings.json.retrieveRecordingSidJson(
    '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
    { account_sid: '550e8400-e29b-41d4-a716-446655440000' },
  );

console.log(texmlGetCallRecordingResponseBody.account_sid);
返回:
account_sid
(字符串),
call_sid
(字符串),
channels
(枚举:1、2),
conference_sid
(uuid),
date_created
(date-time),
date_updated
(date-time),
duration
(字符串 | null),
error_code
(字符串 | null),
media_url
(uri),
sid
(字符串),
source
(枚举:StartCallRecordingAPI、StartConferenceRecordingAPI、OutboundAPI、DialVerb、Conference、RecordVerb、Trunking),
start_time
(date-time),
status
(枚举:in-progress、completed、paused、stopped),
subresources_uris
(对象),
uri
(字符串)

Delete recording resource

删除录音资源

Deletes recording resource identified by recording id.
DELETE /texml/Accounts/{account_sid}/Recordings/{recording_sid}.json
javascript
await client.texml.accounts.recordings.json.deleteRecordingSidJson(
  '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000' },
);
删除由录音ID标识的录音资源。
DELETE /texml/Accounts/{account_sid}/Recordings/{recording_sid}.json
javascript
await client.texml.accounts.recordings.json.deleteRecordingSidJson(
  '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000' },
);

List recording transcriptions

列出录音转录资源

Returns multiple recording transcription resources for an account.
GET /texml/Accounts/{account_sid}/Transcriptions.json
javascript
const response = await client.texml.accounts.retrieveTranscriptionsJson('account_sid');

console.log(response.end);
Returns:
end
(integer),
first_page_uri
(uri),
next_page_uri
(string),
page
(integer),
page_size
(integer),
previous_page_uri
(uri),
start
(integer),
transcriptions
(array[object]),
uri
(string)
返回账户下的多个录音转录资源。
GET /texml/Accounts/{account_sid}/Transcriptions.json
javascript
const response = await client.texml.accounts.retrieveTranscriptionsJson('account_sid');

console.log(response.end);
返回:
end
(整数),
first_page_uri
(uri),
next_page_uri
(字符串),
page
(整数),
page_size
(整数),
previous_page_uri
(uri),
start
(整数),
transcriptions
(对象数组),
uri
(字符串)

Fetch a recording transcription resource

获取单个录音转录资源

Returns the recording transcription resource identified by its ID.
GET /texml/Accounts/{account_sid}/Transcriptions/{recording_transcription_sid}.json
javascript
const response =
  await client.texml.accounts.transcriptions.json.retrieveRecordingTranscriptionSidJson(
    '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
    { account_sid: '550e8400-e29b-41d4-a716-446655440000' },
  );

console.log(response.account_sid);
Returns:
account_sid
(string),
api_version
(string),
call_sid
(string),
date_created
(date-time),
date_updated
(date-time),
duration
(string | null),
recording_sid
(string),
sid
(string),
status
(enum: in-progress, completed),
transcription_text
(string),
uri
(string)
返回由ID标识的录音转录资源。
GET /texml/Accounts/{account_sid}/Transcriptions/{recording_transcription_sid}.json
javascript
const response =
  await client.texml.accounts.transcriptions.json.retrieveRecordingTranscriptionSidJson(
    '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
    { account_sid: '550e8400-e29b-41d4-a716-446655440000' },
  );

console.log(response.account_sid);
返回:
account_sid
(字符串),
api_version
(字符串),
call_sid
(字符串),
date_created
(date-time),
date_updated
(date-time),
duration
(字符串 | null),
recording_sid
(字符串),
sid
(字符串),
status
(枚举:in-progress、completed),
transcription_text
(字符串),
uri
(字符串)

Delete a recording transcription

删除录音转录资源

Permanently deletes a recording transcription.
DELETE /texml/Accounts/{account_sid}/Transcriptions/{recording_transcription_sid}.json
javascript
await client.texml.accounts.transcriptions.json.deleteRecordingTranscriptionSidJson(
  '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000' },
);
永久删除录音转录资源。
DELETE /texml/Accounts/{account_sid}/Transcriptions/{recording_transcription_sid}.json
javascript
await client.texml.accounts.transcriptions.json.deleteRecordingTranscriptionSidJson(
  '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
  { account_sid: '550e8400-e29b-41d4-a716-446655440000' },
);

Create a TeXML secret

创建TeXML密钥

Create a TeXML secret which can be later used as a Dynamic Parameter for TeXML when using Mustache Templates in your TeXML. In your TeXML you will be able to use your secret name, and this name will be replaced by the actual secret value when processing the TeXML on Telnyx side. The secrets are not visible in any logs.
POST /texml/secrets
— Required:
name
,
value
javascript
const response = await client.texml.secrets({ name: 'My Secret Name', value: 'My Secret Value' });

console.log(response.data);
Returns:
name
(string),
value
(enum: REDACTED)
创建TeXML密钥,后续可在TeXML中使用Mustache模板时作为动态参数。在TeXML中可使用密钥名称,Telnyx处理TeXML时会将名称替换为实际密钥值。密钥不会出现在任何日志中。
POST /texml/secrets
— 必填:
name
value
javascript
const response = await client.texml.secrets({ name: 'My Secret Name', value: 'My Secret Value' });

console.log(response.data);
返回:
name
(字符串),
value
(枚举:REDACTED)

List all TeXML Applications

列出所有TeXML应用

Returns a list of your TeXML Applications.
GET /texml_applications
javascript
// Automatically fetches more pages as needed.
for await (const texmlApplication of client.texmlApplications.list()) {
  console.log(texmlApplication.id);
}
Returns:
active
(boolean),
anchorsite_override
(enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(boolean),
created_at
(string),
dtmf_type
(enum: RFC 2833, Inband, SIP INFO),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
friendly_name
(string),
id
(string),
inbound
(object),
outbound
(object),
record_type
(string),
status_callback
(uri),
status_callback_method
(enum: get, post),
tags
(array[string]),
updated_at
(string),
voice_fallback_url
(uri),
voice_method
(enum: get, post),
voice_url
(uri)
返回TeXML应用列表。
GET /texml_applications
javascript
// 自动按需获取更多页面。
for await (const texmlApplication of client.texmlApplications.list()) {
  console.log(texmlApplication.id);
}
返回:
active
(布尔值),
anchorsite_override
(枚举:Latency、Chicago, IL、Ashburn, VA、San Jose, CA、Sydney, Australia、Amsterdam, Netherlands、London, UK、Toronto, Canada、Vancouver, Canada、Frankfurt, Germany),
call_cost_in_webhooks
(布尔值),
created_at
(字符串),
dtmf_type
(枚举:RFC 2833、Inband、SIP INFO),
first_command_timeout
(布尔值),
first_command_timeout_secs
(整数),
friendly_name
(字符串),
id
(字符串),
inbound
(对象),
outbound
(对象),
record_type
(字符串),
status_callback
(uri),
status_callback_method
(枚举:get、post),
tags
(字符串数组),
updated_at
(字符串),
voice_fallback_url
(uri),
voice_method
(枚举:get、post),
voice_url
(uri)

Creates a TeXML Application

创建TeXML应用

Creates a TeXML Application.
POST /texml_applications
— Required:
friendly_name
,
voice_url
Optional:
active
(boolean),
anchorsite_override
(enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(boolean),
dtmf_type
(enum: RFC 2833, Inband, SIP INFO),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
inbound
(object),
outbound
(object),
status_callback
(uri),
status_callback_method
(enum: get, post),
tags
(array[string]),
voice_fallback_url
(uri),
voice_method
(enum: get, post)
javascript
const texmlApplication = await client.texmlApplications.create({
  friendly_name: 'call-router',
  voice_url: 'https://example.com',
});

console.log(texmlApplication.data);
Returns:
active
(boolean),
anchorsite_override
(enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(boolean),
created_at
(string),
dtmf_type
(enum: RFC 2833, Inband, SIP INFO),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
friendly_name
(string),
id
(string),
inbound
(object),
outbound
(object),
record_type
(string),
status_callback
(uri),
status_callback_method
(enum: get, post),
tags
(array[string]),
updated_at
(string),
voice_fallback_url
(uri),
voice_method
(enum: get, post),
voice_url
(uri)
创建TeXML应用。
POST /texml_applications
— 必填:
friendly_name
voice_url
可选:
active
(布尔值),
anchorsite_override
(枚举:Latency、Chicago, IL、Ashburn, VA、San Jose, CA、Sydney, Australia、Amsterdam, Netherlands、London, UK、Toronto, Canada、Vancouver, Canada、Frankfurt, Germany),
call_cost_in_webhooks
(布尔值),
dtmf_type
(枚举:RFC 2833、Inband、SIP INFO),
first_command_timeout
(布尔值),
first_command_timeout_secs
(整数),
inbound
(对象),
outbound
(对象),
status_callback
(uri),
status_callback_method
(枚举:get、post),
tags
(字符串数组),
voice_fallback_url
(uri),
voice_method
(枚举:get、post)
javascript
const texmlApplication = await client.texmlApplications.create({
  friendly_name: 'call-router',
  voice_url: 'https://example.com',
});

console.log(texmlApplication.data);
返回:
active
(布尔值),
anchorsite_override
(枚举:Latency、Chicago, IL、Ashburn, VA、San Jose, CA、Sydney, Australia、Amsterdam, Netherlands、London, UK、Toronto, Canada、Vancouver, Canada、Frankfurt, Germany),
call_cost_in_webhooks
(布尔值),
created_at
(字符串),
dtmf_type
(枚举:RFC 2833、Inband、SIP INFO),
first_command_timeout
(布尔值),
first_command_timeout_secs
(整数),
friendly_name
(字符串),
id
(字符串),
inbound
(对象),
outbound
(对象),
record_type
(字符串),
status_callback
(uri),
status_callback_method
(枚举:get、post),
tags
(字符串数组),
updated_at
(字符串),
voice_fallback_url
(uri),
voice_method
(枚举:get、post),
voice_url
(uri)

Retrieve a TeXML Application

获取TeXML应用

Retrieves the details of an existing TeXML Application.
GET /texml_applications/{id}
javascript
const texmlApplication = await client.texmlApplications.retrieve('1293384261075731499');

console.log(texmlApplication.data);
Returns:
active
(boolean),
anchorsite_override
(enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(boolean),
created_at
(string),
dtmf_type
(enum: RFC 2833, Inband, SIP INFO),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
friendly_name
(string),
id
(string),
inbound
(object),
outbound
(object),
record_type
(string),
status_callback
(uri),
status_callback_method
(enum: get, post),
tags
(array[string]),
updated_at
(string),
voice_fallback_url
(uri),
voice_method
(enum: get, post),
voice_url
(uri)
获取现有TeXML应用的详细信息。
GET /texml_applications/{id}
javascript
const texmlApplication = await client.texmlApplications.retrieve('1293384261075731499');

console.log(texmlApplication.data);
返回:
active
(布尔值),
anchorsite_override
(枚举:Latency、Chicago, IL、Ashburn, VA、San Jose, CA、Sydney, Australia、Amsterdam, Netherlands、London, UK、Toronto, Canada、Vancouver, Canada、Frankfurt, Germany),
call_cost_in_webhooks
(布尔值),
created_at
(字符串),
dtmf_type
(枚举:RFC 2833、Inband、SIP INFO),
first_command_timeout
(布尔值),
first_command_timeout_secs
(整数),
friendly_name
(字符串),
id
(字符串),
inbound
(对象),
outbound
(对象),
record_type
(字符串),
status_callback
(uri),
status_callback_method
(枚举:get、post),
tags
(字符串数组),
updated_at
(字符串),
voice_fallback_url
(uri),
voice_method
(枚举:get、post),
voice_url
(uri)

Update a TeXML Application

更新TeXML应用

Updates settings of an existing TeXML Application.
PATCH /texml_applications/{id}
— Required:
friendly_name
,
voice_url
Optional:
active
(boolean),
anchorsite_override
(enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(boolean),
dtmf_type
(enum: RFC 2833, Inband, SIP INFO),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
inbound
(object),
outbound
(object),
status_callback
(uri),
status_callback_method
(enum: get, post),
tags
(array[string]),
voice_fallback_url
(uri),
voice_method
(enum: get, post)
javascript
const texmlApplication = await client.texmlApplications.update('1293384261075731499', {
  friendly_name: 'call-router',
  voice_url: 'https://example.com',
});

console.log(texmlApplication.data);
Returns:
active
(boolean),
anchorsite_override
(enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(boolean),
created_at
(string),
dtmf_type
(enum: RFC 2833, Inband, SIP INFO),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
friendly_name
(string),
id
(string),
inbound
(object),
outbound
(object),
record_type
(string),
status_callback
(uri),
status_callback_method
(enum: get, post),
tags
(array[string]),
updated_at
(string),
voice_fallback_url
(uri),
voice_method
(enum: get, post),
voice_url
(uri)
更新现有TeXML应用的设置。
PATCH /texml_applications/{id}
— 必填:
friendly_name
voice_url
可选:
active
(布尔值),
anchorsite_override
(枚举:Latency、Chicago, IL、Ashburn, VA、San Jose, CA、Sydney, Australia、Amsterdam, Netherlands、London, UK、Toronto, Canada、Vancouver, Canada、Frankfurt, Germany),
call_cost_in_webhooks
(布尔值),
dtmf_type
(枚举:RFC 2833、Inband、SIP INFO),
first_command_timeout
(布尔值),
first_command_timeout_secs
(整数),
inbound
(对象),
outbound
(对象),
status_callback
(uri),
status_callback_method
(枚举:get、post),
tags
(字符串数组),
voice_fallback_url
(uri),
voice_method
(枚举:get、post)
javascript
const texmlApplication = await client.texmlApplications.update('1293384261075731499', {
  friendly_name: 'call-router',
  voice_url: 'https://example.com',
});

console.log(texmlApplication.data);
返回:
active
(布尔值),
anchorsite_override
(枚举:Latency、Chicago, IL、Ashburn, VA、San Jose, CA、Sydney, Australia、Amsterdam, Netherlands、London, UK、Toronto, Canada、Vancouver, Canada、Frankfurt, Germany),
call_cost_in_webhooks
(布尔值),
created_at
(字符串),
dtmf_type
(枚举:RFC 2833、Inband、SIP INFO),
first_command_timeout
(布尔值),
first_command_timeout_secs
(整数),
friendly_name
(字符串),
id
(字符串),
inbound
(对象),
outbound
(对象),
record_type
(字符串),
status_callback
(uri),
status_callback_method
(枚举:get、post),
tags
(字符串数组),
updated_at
(字符串),
voice_fallback_url
(uri),
voice_method
(枚举:get、post),
voice_url
(uri)

Deletes a TeXML Application

删除TeXML应用

Deletes a TeXML Application.
DELETE /texml_applications/{id}
javascript
const texmlApplication = await client.texmlApplications.delete('1293384261075731499');

console.log(texmlApplication.data);
Returns:
active
(boolean),
anchorsite_override
(enum: Latency, Chicago, IL, Ashburn, VA, San Jose, CA, Sydney, Australia, Amsterdam, Netherlands, London, UK, Toronto, Canada, Vancouver, Canada, Frankfurt, Germany),
call_cost_in_webhooks
(boolean),
created_at
(string),
dtmf_type
(enum: RFC 2833, Inband, SIP INFO),
first_command_timeout
(boolean),
first_command_timeout_secs
(integer),
friendly_name
(string),
id
(string),
inbound
(object),
outbound
(object),
record_type
(string),
status_callback
(uri),
status_callback_method
(enum: get, post),
tags
(array[string]),
updated_at
(string),
voice_fallback_url
(uri),
voice_method
(enum: get, post),
voice_url
(uri)
删除TeXML应用。
DELETE /texml_applications/{id}
javascript
const texmlApplication = await client.texmlApplications.delete('1293384261075731499');

console.log(texmlApplication.data);
返回:
active
(布尔值),
anchorsite_override
(枚举:Latency、Chicago, IL、Ashburn, VA、San Jose, CA、Sydney, Australia、Amsterdam, Netherlands、London, UK、Toronto, Canada、Vancouver, Canada、Frankfurt, Germany),
call_cost_in_webhooks
(布尔值),
created_at
(字符串),
dtmf_type
(枚举:RFC 2833、Inband、SIP INFO),
first_command_timeout
(布尔值),
first_command_timeout_secs
(整数),
friendly_name
(字符串),
id
(字符串),
inbound
(对象),
outbound
(对象),
record_type
(字符串),
status_callback
(uri),
status_callback_method
(枚举:get、post),
tags
(字符串数组),
updated_at
(字符串),
voice_fallback_url
(uri),
voice_method
(枚举:get、post),
voice_url
(uri)