telnyx-sip-integrations-javascript

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 Sip Integrations - JavaScript

Telnyx SIP集成 - 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('Network error — check connectivity and retry');
  } 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 error ${err.status}: ${err.message}`);
    if (err.status === 422) {
      console.error('Validation error — check required fields and formats');
    }
  }
}
常见错误码:
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) { ... }
    即可自动遍历所有页面。

Retrieve a stored credential

获取存储的凭证

Returns the information about custom storage credentials.
GET /custom_storage_credentials/{connection_id}
javascript
const customStorageCredential = await client.customStorageCredentials.retrieve('connection_id');

console.log(customStorageCredential.connection_id);
Returns:
backend
(enum: gcs, s3, azure),
configuration
(object)
返回自定义存储凭证的相关信息。
GET /custom_storage_credentials/{connection_id}
javascript
const customStorageCredential = await client.customStorageCredentials.retrieve('connection_id');

console.log(customStorageCredential.connection_id);
返回值:
backend
(枚举值:gcs, s3, azure)、
configuration
(对象)

Create a custom storage credential

创建自定义存储凭证

Creates a custom storage credentials configuration.
POST /custom_storage_credentials/{connection_id}
javascript
const customStorageCredential = await client.customStorageCredentials.create('connection_id', {
  backend: 'gcs',
  configuration: { backend: 'gcs' },
});

console.log(customStorageCredential.connection_id);
Returns:
backend
(enum: gcs, s3, azure),
configuration
(object)
创建自定义存储凭证配置。
POST /custom_storage_credentials/{connection_id}
javascript
const customStorageCredential = await client.customStorageCredentials.create('connection_id', {
  backend: 'gcs',
  configuration: { backend: 'gcs' },
});

console.log(customStorageCredential.connection_id);
返回值:
backend
(枚举值:gcs, s3, azure)、
configuration
(对象)

Update a stored credential

更新存储的凭证

Updates a stored custom credentials configuration.
PUT /custom_storage_credentials/{connection_id}
javascript
const customStorageCredential = await client.customStorageCredentials.update('connection_id', {
  backend: 'gcs',
  configuration: { backend: 'gcs' },
});

console.log(customStorageCredential.connection_id);
Returns:
backend
(enum: gcs, s3, azure),
configuration
(object)
更新已存储的自定义凭证配置。
PUT /custom_storage_credentials/{connection_id}
javascript
const customStorageCredential = await client.customStorageCredentials.update('connection_id', {
  backend: 'gcs',
  configuration: { backend: 'gcs' },
});

console.log(customStorageCredential.connection_id);
返回值:
backend
(枚举值:gcs, s3, azure)、
configuration
(对象)

Delete a stored credential

删除存储的凭证

Deletes a stored custom credentials configuration.
DELETE /custom_storage_credentials/{connection_id}
javascript
await client.customStorageCredentials.delete('connection_id');
删除已存储的自定义凭证配置。
DELETE /custom_storage_credentials/{connection_id}
javascript
await client.customStorageCredentials.delete('connection_id');

Retrieve stored Dialogflow Connection

获取存储的Dialogflow连接

Return details of the Dialogflow connection associated with the given CallControl connection.
GET /dialogflow_connections/{connection_id}
javascript
const dialogflowConnection = await client.dialogflowConnections.retrieve('connection_id');

console.log(dialogflowConnection.data);
Returns:
connection_id
(string),
conversation_profile_id
(string),
environment
(string),
record_type
(string),
service_account
(string)
返回与指定CallControl连接关联的Dialogflow连接详情。
GET /dialogflow_connections/{connection_id}
javascript
const dialogflowConnection = await client.dialogflowConnections.retrieve('connection_id');

console.log(dialogflowConnection.data);
返回值:
connection_id
(字符串)、
conversation_profile_id
(字符串)、
environment
(字符串)、
record_type
(字符串)、
service_account
(字符串)

Create a Dialogflow Connection

创建Dialogflow连接

Save Dialogflow Credentiails to Telnyx, so it can be used with other Telnyx services.
POST /dialogflow_connections/{connection_id}
javascript
const dialogflowConnection = await client.dialogflowConnections.create('connection_id', {
  service_account: {
    type: 'bar',
    project_id: 'bar',
    private_key_id: 'bar',
    private_key: 'bar',
    client_email: 'bar',
    client_id: 'bar',
    auth_uri: 'bar',
    token_uri: 'bar',
    auth_provider_x509_cert_url: 'bar',
    client_x509_cert_url: 'bar',
  },
});

console.log(dialogflowConnection.data);
Returns:
connection_id
(string),
conversation_profile_id
(string),
environment
(string),
record_type
(string),
service_account
(string)
将Dialogflow凭证保存到Telnyx,以便与其他Telnyx服务配合使用。
POST /dialogflow_connections/{connection_id}
javascript
const dialogflowConnection = await client.dialogflowConnections.create('connection_id', {
  service_account: {
    type: 'bar',
    project_id: 'bar',
    private_key_id: 'bar',
    private_key: 'bar',
    client_email: 'bar',
    client_id: 'bar',
    auth_uri: 'bar',
    token_uri: 'bar',
    auth_provider_x509_cert_url: 'bar',
    client_x509_cert_url: 'bar',
  },
});

console.log(dialogflowConnection.data);
返回值:
connection_id
(字符串)、
conversation_profile_id
(字符串)、
environment
(字符串)、
record_type
(字符串)、
service_account
(字符串)

Update stored Dialogflow Connection

更新存储的Dialogflow连接

Updates a stored Dialogflow Connection.
PUT /dialogflow_connections/{connection_id}
javascript
const dialogflowConnection = await client.dialogflowConnections.update('connection_id', {
  service_account: {
    type: 'bar',
    project_id: 'bar',
    private_key_id: 'bar',
    private_key: 'bar',
    client_email: 'bar',
    client_id: 'bar',
    auth_uri: 'bar',
    token_uri: 'bar',
    auth_provider_x509_cert_url: 'bar',
    client_x509_cert_url: 'bar',
  },
});

console.log(dialogflowConnection.data);
Returns:
connection_id
(string),
conversation_profile_id
(string),
environment
(string),
record_type
(string),
service_account
(string)
更新已存储的Dialogflow连接。
PUT /dialogflow_connections/{connection_id}
javascript
const dialogflowConnection = await client.dialogflowConnections.update('connection_id', {
  service_account: {
    type: 'bar',
    project_id: 'bar',
    private_key_id: 'bar',
    private_key: 'bar',
    client_email: 'bar',
    client_id: 'bar',
    auth_uri: 'bar',
    token_uri: 'bar',
    auth_provider_x509_cert_url: 'bar',
    client_x509_cert_url: 'bar',
  },
});

console.log(dialogflowConnection.data);
返回值:
connection_id
(字符串)、
conversation_profile_id
(字符串)、
environment
(字符串)、
record_type
(字符串)、
service_account
(字符串)

Delete stored Dialogflow Connection

删除存储的Dialogflow连接

Deletes a stored Dialogflow Connection.
DELETE /dialogflow_connections/{connection_id}
javascript
await client.dialogflowConnections.delete('connection_id');
删除已存储的Dialogflow连接。
DELETE /dialogflow_connections/{connection_id}
javascript
await client.dialogflowConnections.delete('connection_id');

List all External Connections

列出所有外部连接

This endpoint returns a list of your External Connections inside the 'data' attribute of the response. External Connections are used by Telnyx customers to seamless configure SIP trunking integrations with Telnyx Partners, through External Voice Integrations in Mission Control Portal.
GET /external_connections
javascript
// Automatically fetches more pages as needed.
for await (const externalConnection of client.externalConnections.list()) {
  console.log(externalConnection.id);
}
Returns:
active
(boolean),
created_at
(string),
credential_active
(boolean),
external_sip_connection
(enum: zoom, operator_connect),
id
(string),
inbound
(object),
outbound
(object),
record_type
(string),
tags
(array[string]),
updated_at
(string),
webhook_api_version
(enum: 1, 2),
webhook_event_failover_url
(uri),
webhook_event_url
(uri),
webhook_timeout_secs
(integer | null)
该接口会在响应的
data
属性中返回你的所有外部连接列表。Telnyx客户可通过任务控制门户的外部语音集成功能,使用外部连接无缝配置与Telnyx合作伙伴的SIP中继集成。
GET /external_connections
javascript
// 按需自动拉取更多页面
for await (const externalConnection of client.externalConnections.list()) {
  console.log(externalConnection.id);
}
返回值:
active
(布尔值)、
created_at
(字符串)、
credential_active
(布尔值)、
external_sip_connection
(枚举值:zoom, operator_connect)、
id
(字符串)、
inbound
(对象)、
outbound
(对象)、
record_type
(字符串)、
tags
(字符串数组)、
updated_at
(字符串)、
webhook_api_version
(枚举值:1, 2)、
webhook_event_failover_url
(uri)、
webhook_event_url
(uri)、
webhook_timeout_secs
(整数 | null)

Creates an External Connection

创建外部连接

Creates a new External Connection based on the parameters sent in the request. The external_sip_connection and outbound voice profile id are required. Once created, you can assign phone numbers to your application using the
/phone_numbers
endpoint.
POST /external_connections
— Required:
external_sip_connection
,
outbound
Optional:
active
(boolean),
inbound
(object),
tags
(array[string]),
webhook_event_failover_url
(uri),
webhook_event_url
(uri),
webhook_timeout_secs
(integer | null)
javascript
const externalConnection = await client.externalConnections.create({
  external_sip_connection: 'zoom',
  outbound: {},
});

console.log(externalConnection.data);
Returns:
active
(boolean),
created_at
(string),
credential_active
(boolean),
external_sip_connection
(enum: zoom, operator_connect),
id
(string),
inbound
(object),
outbound
(object),
record_type
(string),
tags
(array[string]),
updated_at
(string),
webhook_api_version
(enum: 1, 2),
webhook_event_failover_url
(uri),
webhook_event_url
(uri),
webhook_timeout_secs
(integer | null)
根据请求参数创建新的外部连接。
external_sip_connection
和出站语音配置ID为必填项。创建完成后,你可以使用
/phone_numbers
接口为你的应用分配电话号码。
POST /external_connections
— 必填参数:
external_sip_connection
outbound
可选参数:
active
(布尔值)、
inbound
(对象)、
tags
(字符串数组)、
webhook_event_failover_url
(uri)、
webhook_event_url
(uri)、
webhook_timeout_secs
(整数 | null)
javascript
const externalConnection = await client.externalConnections.create({
  external_sip_connection: 'zoom',
  outbound: {},
});

console.log(externalConnection.data);
返回值:
active
(布尔值)、
created_at
(字符串)、
credential_active
(布尔值)、
external_sip_connection
(枚举值:zoom, operator_connect)、
id
(字符串)、
inbound
(对象)、
outbound
(对象)、
record_type
(字符串)、
tags
(字符串数组)、
updated_at
(字符串)、
webhook_api_version
(枚举值:1, 2)、
webhook_event_failover_url
(uri)、
webhook_event_url
(uri)、
webhook_timeout_secs
(整数 | null)

List all log messages

列出所有日志消息

Retrieve a list of log messages for all external connections associated with your account.
GET /external_connections/log_messages
javascript
// Automatically fetches more pages as needed.
for await (const logMessageListResponse of client.externalConnections.logMessages.list()) {
  console.log(logMessageListResponse.code);
}
Returns:
log_messages
(array[object]),
meta
(object)
获取与你的账户关联的所有外部连接的日志消息列表。
GET /external_connections/log_messages
javascript
// 按需自动拉取更多页面
for await (const logMessageListResponse of client.externalConnections.logMessages.list()) {
  console.log(logMessageListResponse.code);
}
返回值:
log_messages
(对象数组)、
meta
(对象)

Retrieve a log message

获取单条日志消息

Retrieve a log message for an external connection associated with your account.
GET /external_connections/log_messages/{id}
javascript
const logMessage = await client.externalConnections.logMessages.retrieve('1293384261075731499');

console.log(logMessage.log_messages);
Returns:
log_messages
(array[object])
获取与你的账户关联的某个外部连接的单条日志消息。
GET /external_connections/log_messages/{id}
javascript
const logMessage = await client.externalConnections.logMessages.retrieve('1293384261075731499');

console.log(logMessage.log_messages);
返回值:
log_messages
(对象数组)

Dismiss a log message

标记日志消息为已处理

Dismiss a log message for an external connection associated with your account.
DELETE /external_connections/log_messages/{id}
javascript
const response = await client.externalConnections.logMessages.dismiss('1293384261075731499');

console.log(response.success);
Returns:
success
(boolean)
将与你的账户关联的某个外部连接的日志消息标记为已处理。
DELETE /external_connections/log_messages/{id}
javascript
const response = await client.externalConnections.logMessages.dismiss('1293384261075731499');

console.log(response.success);
返回值:
success
(布尔值)

Retrieve an External Connection

获取单个外部连接

Return the details of an existing External Connection inside the 'data' attribute of the response.
GET /external_connections/{id}
javascript
const externalConnection = await client.externalConnections.retrieve('1293384261075731499');

console.log(externalConnection.data);
Returns:
active
(boolean),
created_at
(string),
credential_active
(boolean),
external_sip_connection
(enum: zoom, operator_connect),
id
(string),
inbound
(object),
outbound
(object),
record_type
(string),
tags
(array[string]),
updated_at
(string),
webhook_api_version
(enum: 1, 2),
webhook_event_failover_url
(uri),
webhook_event_url
(uri),
webhook_timeout_secs
(integer | null)
在响应的
data
属性中返回现有外部连接的详情。
GET /external_connections/{id}
javascript
const externalConnection = await client.externalConnections.retrieve('1293384261075731499');

console.log(externalConnection.data);
返回值:
active
(布尔值)、
created_at
(字符串)、
credential_active
(布尔值)、
external_sip_connection
(枚举值:zoom, operator_connect)、
id
(字符串)、
inbound
(对象)、
outbound
(对象)、
record_type
(字符串)、
tags
(字符串数组)、
updated_at
(字符串)、
webhook_api_version
(枚举值:1, 2)、
webhook_event_failover_url
(uri)、
webhook_event_url
(uri)、
webhook_timeout_secs
(整数 | null)

Update an External Connection

更新外部连接

Updates settings of an existing External Connection based on the parameters of the request.
PATCH /external_connections/{id}
— Required:
outbound
Optional:
active
(boolean),
inbound
(object),
tags
(array[string]),
webhook_event_failover_url
(uri),
webhook_event_url
(uri),
webhook_timeout_secs
(integer | null)
javascript
const externalConnection = await client.externalConnections.update('1293384261075731499', {
  outbound: { outbound_voice_profile_id: '1911630617284445511' },
});

console.log(externalConnection.data);
Returns:
active
(boolean),
created_at
(string),
credential_active
(boolean),
external_sip_connection
(enum: zoom, operator_connect),
id
(string),
inbound
(object),
outbound
(object),
record_type
(string),
tags
(array[string]),
updated_at
(string),
webhook_api_version
(enum: 1, 2),
webhook_event_failover_url
(uri),
webhook_event_url
(uri),
webhook_timeout_secs
(integer | null)
根据请求参数更新现有外部连接的设置。
PATCH /external_connections/{id}
— 必填参数:
outbound
可选参数:
active
(布尔值)、
inbound
(对象)、
tags
(字符串数组)、
webhook_event_failover_url
(uri)、
webhook_event_url
(uri)、
webhook_timeout_secs
(整数 | null)
javascript
const externalConnection = await client.externalConnections.update('1293384261075731499', {
  outbound: { outbound_voice_profile_id: '1911630617284445511' },
});

console.log(externalConnection.data);
返回值:
active
(布尔值)、
created_at
(字符串)、
credential_active
(布尔值)、
external_sip_connection
(枚举值:zoom, operator_connect)、
id
(字符串)、
inbound
(对象)、
outbound
(对象)、
record_type
(字符串)、
tags
(字符串数组)、
updated_at
(字符串)、
webhook_api_version
(枚举值:1, 2)、
webhook_event_failover_url
(uri)、
webhook_event_url
(uri)、
webhook_timeout_secs
(整数 | null)

Deletes an External Connection

删除外部连接

Permanently deletes an External Connection. Deletion may be prevented if the application is in use by phone numbers, is active, or if it is an Operator Connect connection. To remove an Operator Connect integration please contact Telnyx support.
DELETE /external_connections/{id}
javascript
const externalConnection = await client.externalConnections.delete('1293384261075731499');

console.log(externalConnection.data);
Returns:
active
(boolean),
created_at
(string),
credential_active
(boolean),
external_sip_connection
(enum: zoom, operator_connect),
id
(string),
inbound
(object),
outbound
(object),
record_type
(string),
tags
(array[string]),
updated_at
(string),
webhook_api_version
(enum: 1, 2),
webhook_event_failover_url
(uri),
webhook_event_url
(uri),
webhook_timeout_secs
(integer | null)
永久删除外部连接。如果应用正被电话号码使用、处于激活状态,或者是Operator Connect连接,则可能无法删除。如需移除Operator Connect集成,请联系Telnyx支持团队。
DELETE /external_connections/{id}
javascript
const externalConnection = await client.externalConnections.delete('1293384261075731499');

console.log(externalConnection.data);
返回值:
active
(布尔值)、
created_at
(字符串)、
credential_active
(布尔值)、
external_sip_connection
(枚举值:zoom, operator_connect)、
id
(字符串)、
inbound
(对象)、
outbound
(对象)、
record_type
(字符串)、
tags
(字符串数组)、
updated_at
(字符串)、
webhook_api_version
(枚举值:1, 2)、
webhook_event_failover_url
(uri)、
webhook_event_url
(uri)、
webhook_timeout_secs
(整数 | null)

List all civic addresses and locations

列出所有市政地址和位置

Returns the civic addresses and locations from Microsoft Teams.
GET /external_connections/{id}/civic_addresses
javascript
const civicAddresses = await client.externalConnections.civicAddresses.list('1293384261075731499');

console.log(civicAddresses.data);
Returns:
city_or_town
(string),
city_or_town_alias
(string),
company_name
(string),
country
(string),
country_or_district
(string),
default_location_id
(uuid),
description
(string),
house_number
(string),
house_number_suffix
(string),
id
(uuid),
locations
(array[object]),
postal_or_zip_code
(string),
record_type
(string),
state_or_province
(string),
street_name
(string),
street_suffix
(string)
返回Microsoft Teams中的市政地址和位置。
GET /external_connections/{id}/civic_addresses
javascript
const civicAddresses = await client.externalConnections.civicAddresses.list('1293384261075731499');

console.log(civicAddresses.data);
返回值:
city_or_town
(字符串)、
city_or_town_alias
(字符串)、
company_name
(字符串)、
country
(字符串)、
country_or_district
(字符串)、
default_location_id
(uuid)、
description
(字符串)、
house_number
(字符串)、
house_number_suffix
(字符串)、
id
(uuid)、
locations
(对象数组)、
postal_or_zip_code
(字符串)、
record_type
(字符串)、
state_or_province
(字符串)、
street_name
(字符串)、
street_suffix
(字符串)

Retrieve a Civic Address

获取单个市政地址

Return the details of an existing Civic Address with its Locations inside the 'data' attribute of the response.
GET /external_connections/{id}/civic_addresses/{address_id}
javascript
const civicAddress = await client.externalConnections.civicAddresses.retrieve(
  '318fb664-d341-44d2-8405-e6bfb9ced6d9',
  { id: '1293384261075731499' },
);

console.log(civicAddress.data);
Returns:
city_or_town
(string),
city_or_town_alias
(string),
company_name
(string),
country
(string),
country_or_district
(string),
default_location_id
(uuid),
description
(string),
house_number
(string),
house_number_suffix
(string),
id
(uuid),
locations
(array[object]),
postal_or_zip_code
(string),
record_type
(string),
state_or_province
(string),
street_name
(string),
street_suffix
(string)
在响应的
data
属性中返回现有市政地址及其位置的详情。
GET /external_connections/{id}/civic_addresses/{address_id}
javascript
const civicAddress = await client.externalConnections.civicAddresses.retrieve(
  '318fb664-d341-44d2-8405-e6bfb9ced6d9',
  { id: '1293384261075731499' },
);

console.log(civicAddress.data);
返回值:
city_or_town
(字符串)、
city_or_town_alias
(字符串)、
company_name
(字符串)、
country
(字符串)、
country_or_district
(字符串)、
default_location_id
(uuid)、
description
(字符串)、
house_number
(字符串)、
house_number_suffix
(字符串)、
id
(uuid)、
locations
(对象数组)、
postal_or_zip_code
(字符串)、
record_type
(字符串)、
state_or_province
(字符串)、
street_name
(字符串)、
street_suffix
(字符串)

Update a location's static emergency address

更新位置的静态紧急地址

PATCH /external_connections/{id}/locations/{location_id}
— Required:
static_emergency_address_id
javascript
const response = await client.externalConnections.updateLocation(
  '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
  {
    id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
    static_emergency_address_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
  },
);

console.log(response.data);
Returns:
accepted_address_suggestions
(boolean),
location_id
(uuid),
static_emergency_address_id
(uuid)
PATCH /external_connections/{id}/locations/{location_id}
— 必填参数:
static_emergency_address_id
javascript
const response = await client.externalConnections.updateLocation(
  '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
  {
    id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
    static_emergency_address_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
  },
);

console.log(response.data);
返回值:
accepted_address_suggestions
(布尔值)、
location_id
(uuid)、
static_emergency_address_id
(uuid)

List all phone numbers

列出所有电话号码

Returns a list of all active phone numbers associated with the given external connection.
GET /external_connections/{id}/phone_numbers
javascript
// Automatically fetches more pages as needed.
for await (const externalConnectionPhoneNumber of client.externalConnections.phoneNumbers.list(
  '1293384261075731499',
)) {
  console.log(externalConnectionPhoneNumber.civic_address_id);
}
Returns:
acquired_capabilities
(array[string]),
civic_address_id
(uuid),
displayed_country_code
(string),
location_id
(uuid),
number_id
(string),
telephone_number
(string),
ticket_id
(uuid)
返回与指定外部连接关联的所有激活电话号码列表。
GET /external_connections/{id}/phone_numbers
javascript
// 按需自动拉取更多页面
for await (const externalConnectionPhoneNumber of client.externalConnections.phoneNumbers.list(
  '1293384261075731499',
)) {
  console.log(externalConnectionPhoneNumber.civic_address_id);
}
返回值:
acquired_capabilities
(字符串数组)、
civic_address_id
(uuid)、
displayed_country_code
(字符串)、
location_id
(uuid)、
number_id
(字符串)、
telephone_number
(字符串)、
ticket_id
(uuid)

Retrieve a phone number

获取单个电话号码

Return the details of a phone number associated with the given external connection.
GET /external_connections/{id}/phone_numbers/{phone_number_id}
javascript
const phoneNumber = await client.externalConnections.phoneNumbers.retrieve('1234567889', {
  id: '1293384261075731499',
});

console.log(phoneNumber.data);
Returns:
acquired_capabilities
(array[string]),
civic_address_id
(uuid),
displayed_country_code
(string),
location_id
(uuid),
number_id
(string),
telephone_number
(string),
ticket_id
(uuid)
返回与指定外部连接关联的电话号码详情。
GET /external_connections/{id}/phone_numbers/{phone_number_id}
javascript
const phoneNumber = await client.externalConnections.phoneNumbers.retrieve('1234567889', {
  id: '1293384261075731499',
});

console.log(phoneNumber.data);
返回值:
acquired_capabilities
(字符串数组)、
civic_address_id
(uuid)、
displayed_country_code
(字符串)、
location_id
(uuid)、
number_id
(字符串)、
telephone_number
(字符串)、
ticket_id
(uuid)

Update a phone number

更新电话号码

Asynchronously update settings of the phone number associated with the given external connection.
PATCH /external_connections/{id}/phone_numbers/{phone_number_id}
Optional:
location_id
(uuid)
javascript
const phoneNumber = await client.externalConnections.phoneNumbers.update('1234567889', {
  id: '1293384261075731499',
});

console.log(phoneNumber.data);
Returns:
acquired_capabilities
(array[string]),
civic_address_id
(uuid),
displayed_country_code
(string),
location_id
(uuid),
number_id
(string),
telephone_number
(string),
ticket_id
(uuid)
异步更新与指定外部连接关联的电话号码设置。
PATCH /external_connections/{id}/phone_numbers/{phone_number_id}
可选参数:
location_id
(uuid)
javascript
const phoneNumber = await client.externalConnections.phoneNumbers.update('1234567889', {
  id: '1293384261075731499',
});

console.log(phoneNumber.data);
返回值:
acquired_capabilities
(字符串数组)、
civic_address_id
(uuid)、
displayed_country_code
(字符串)、
location_id
(uuid)、
number_id
(字符串)、
telephone_number
(字符串)、
ticket_id
(uuid)

List all Releases

列出所有释放请求

Returns a list of your Releases for the given external connection. These are automatically created when you change the
connection_id
of a phone number that is currently on Microsoft Teams.
GET /external_connections/{id}/releases
javascript
// Automatically fetches more pages as needed.
for await (const releaseListResponse of client.externalConnections.releases.list(
  '1293384261075731499',
)) {
  console.log(releaseListResponse.tenant_id);
}
Returns:
created_at
(string),
error_message
(string),
status
(enum: pending_upload, pending, in_progress, complete, failed, expired, unknown),
telephone_numbers
(array[object]),
tenant_id
(uuid),
ticket_id
(uuid)
返回指定外部连接的所有释放请求列表。当你修改当前绑定在Microsoft Teams上的电话号码的
connection_id
时,系统会自动创建这些请求。
GET /external_connections/{id}/releases
javascript
// 按需自动拉取更多页面
for await (const releaseListResponse of client.externalConnections.releases.list(
  '1293384261075731499',
)) {
  console.log(releaseListResponse.tenant_id);
}
返回值:
created_at
(字符串)、
error_message
(字符串)、
status
(枚举值:pending_upload, pending, in_progress, complete, failed, expired, unknown)、
telephone_numbers
(对象数组)、
tenant_id
(uuid)、
ticket_id
(uuid)

Retrieve a Release request

获取单个释放请求

Return the details of a Release request and its phone numbers.
GET /external_connections/{id}/releases/{release_id}
javascript
const release = await client.externalConnections.releases.retrieve(
  '7b6a6449-b055-45a6-81f6-f6f0dffa4cc6',
  { id: '1293384261075731499' },
);

console.log(release.data);
Returns:
created_at
(string),
error_message
(string),
status
(enum: pending_upload, pending, in_progress, complete, failed, expired, unknown),
telephone_numbers
(array[object]),
tenant_id
(uuid),
ticket_id
(uuid)
返回释放请求及其关联电话号码的详情。
GET /external_connections/{id}/releases/{release_id}
javascript
const release = await client.externalConnections.releases.retrieve(
  '7b6a6449-b055-45a6-81f6-f6f0dffa4cc6',
  { id: '1293384261075731499' },
);

console.log(release.data);
返回值:
created_at
(字符串)、
error_message
(字符串)、
status
(枚举值:pending_upload, pending, in_progress, complete, failed, expired, unknown)、
telephone_numbers
(对象数组)、
tenant_id
(uuid)、
ticket_id
(uuid)

List all Upload requests

列出所有上传请求

Returns a list of your Upload requests for the given external connection.
GET /external_connections/{id}/uploads
javascript
// Automatically fetches more pages as needed.
for await (const upload of client.externalConnections.uploads.list('1293384261075731499')) {
  console.log(upload.location_id);
}
Returns:
available_usages
(array[string]),
error_code
(string),
error_message
(string),
location_id
(uuid),
status
(enum: pending_upload, pending, in_progress, partial_success, success, error),
tenant_id
(uuid),
ticket_id
(uuid),
tn_upload_entries
(array[object])
返回指定外部连接的所有上传请求列表。
GET /external_connections/{id}/uploads
javascript
// 按需自动拉取更多页面
for await (const upload of client.externalConnections.uploads.list('1293384261075731499')) {
  console.log(upload.location_id);
}
返回值:
available_usages
(字符串数组)、
error_code
(字符串)、
error_message
(字符串)、
location_id
(uuid)、
status
(枚举值:pending_upload, pending, in_progress, partial_success, success, error)、
tenant_id
(uuid)、
ticket_id
(uuid)、
tn_upload_entries
(对象数组)

Creates an Upload request

创建上传请求

Creates a new Upload request to Microsoft teams with the included phone numbers. Only one of civic_address_id or location_id must be provided, not both. The maximum allowed phone numbers for the numbers_ids array is 1000.
POST /external_connections/{id}/uploads
— Required:
number_ids
Optional:
additional_usages
(array[string]),
civic_address_id
(uuid),
location_id
(uuid),
usage
(enum: calling_user_assignment, first_party_app_assignment)
javascript
const upload = await client.externalConnections.uploads.create('1293384261075731499', {
  number_ids: [
    '3920457616934164700',
    '3920457616934164701',
    '3920457616934164702',
    '3920457616934164703',
  ],
});

console.log(upload.ticket_id);
Returns:
success
(boolean),
ticket_id
(uuid)
向Microsoft Teams创建新的上传请求,附带指定的电话号码。
civic_address_id
location_id
仅需提供其中一个,不可同时提供。
numbers_ids
数组最多支持1000个电话号码。
POST /external_connections/{id}/uploads
— 必填参数:
number_ids
可选参数:
additional_usages
(字符串数组)、
civic_address_id
(uuid)、
location_id
(uuid)、
usage
(枚举值:calling_user_assignment, first_party_app_assignment)
javascript
const upload = await client.externalConnections.uploads.create('1293384261075731499', {
  number_ids: [
    '3920457616934164700',
    '3920457616934164701',
    '3920457616934164702',
    '3920457616934164703',
  ],
});

console.log(upload.ticket_id);
返回值:
success
(布尔值)、
ticket_id
(uuid)

Refresh the status of all Upload requests

刷新所有上传请求状态

Forces a recheck of the status of all pending Upload requests for the given external connection in the background.
POST /external_connections/{id}/uploads/refresh
javascript
const response = await client.externalConnections.uploads.refreshStatus('1293384261075731499');

console.log(response.success);
Returns:
success
(boolean)
在后台强制重新检查指定外部连接所有待处理上传请求的状态。
POST /external_connections/{id}/uploads/refresh
javascript
const response = await client.externalConnections.uploads.refreshStatus('1293384261075731499');

console.log(response.success);
返回值:
success
(布尔值)

Get the count of pending upload requests

获取待处理上传请求计数

Returns the count of all pending upload requests for the given external connection.
GET /external_connections/{id}/uploads/status
javascript
const response = await client.externalConnections.uploads.pendingCount('1293384261075731499');

console.log(response.data);
Returns:
pending_numbers_count
(integer),
pending_orders_count
(integer)
返回指定外部连接所有待处理上传请求的数量。
GET /external_connections/{id}/uploads/status
javascript
const response = await client.externalConnections.uploads.pendingCount('1293384261075731499');

console.log(response.data);
返回值:
pending_numbers_count
(整数)、
pending_orders_count
(整数)

Retrieve an Upload request

获取单个上传请求

Return the details of an Upload request and its phone numbers.
GET /external_connections/{id}/uploads/{ticket_id}
javascript
const upload = await client.externalConnections.uploads.retrieve(
  '7b6a6449-b055-45a6-81f6-f6f0dffa4cc6',
  { id: '1293384261075731499' },
);

console.log(upload.data);
Returns:
available_usages
(array[string]),
error_code
(string),
error_message
(string),
location_id
(uuid),
status
(enum: pending_upload, pending, in_progress, partial_success, success, error),
tenant_id
(uuid),
ticket_id
(uuid),
tn_upload_entries
(array[object])
返回上传请求及其关联电话号码的详情。
GET /external_connections/{id}/uploads/{ticket_id}
javascript
const upload = await client.externalConnections.uploads.retrieve(
  '7b6a6449-b055-45a6-81f6-f6f0dffa4cc6',
  { id: '1293384261075731499' },
);

console.log(upload.data);
返回值:
available_usages
(字符串数组)、
error_code
(字符串)、
error_message
(字符串)、
location_id
(uuid)、
status
(枚举值:pending_upload, pending, in_progress, partial_success, success, error)、
tenant_id
(uuid)、
ticket_id
(uuid)、
tn_upload_entries
(对象数组)

Retry an Upload request

重试上传请求

If there were any errors during the upload process, this endpoint will retry the upload request. In some cases this will reattempt the existing upload request, in other cases it may create a new upload request. Please check the ticket_id in the response to determine if a new upload request was created.
POST /external_connections/{id}/uploads/{ticket_id}/retry
javascript
const response = await client.externalConnections.uploads.retry(
  '7b6a6449-b055-45a6-81f6-f6f0dffa4cc6',
  { id: '1293384261075731499' },
);

console.log(response.data);
Returns:
available_usages
(array[string]),
error_code
(string),
error_message
(string),
location_id
(uuid),
status
(enum: pending_upload, pending, in_progress, partial_success, success, error),
tenant_id
(uuid),
ticket_id
(uuid),
tn_upload_entries
(array[object])
如果上传过程中出现任何错误,该接口将重试上传请求。部分情况下会重试现有上传请求,其他情况下可能会创建新的上传请求。请查看响应中的
ticket_id
确认是否创建了新的上传请求。
POST /external_connections/{id}/uploads/{ticket_id}/retry
javascript
const response = await client.externalConnections.uploads.retry(
  '7b6a6449-b055-45a6-81f6-f6f0dffa4cc6',
  { id: '1293384261075731499' },
);

console.log(response.data);
返回值:
available_usages
(字符串数组)、
error_code
(字符串)、
error_message
(字符串)、
location_id
(uuid)、
status
(枚举值:pending_upload, pending, in_progress, partial_success, success, error)、
tenant_id
(uuid)、
ticket_id
(uuid)、
tn_upload_entries
(对象数组)

List uploaded media

列出已上传媒体

Returns a list of stored media files.
GET /media
javascript
const media = await client.media.list();

console.log(media.data);
Returns:
content_type
(string),
created_at
(string),
expires_at
(string),
media_name
(string),
updated_at
(string)
返回存储的媒体文件列表。
GET /media
javascript
const media = await client.media.list();

console.log(media.data);
返回值:
content_type
(字符串)、
created_at
(字符串)、
expires_at
(字符串)、
media_name
(字符串)、
updated_at
(字符串)

Upload media

上传媒体

Upload media file to Telnyx so it can be used with other Telnyx services
POST /media
— Required:
media_url
Optional:
media_name
(string),
ttl_secs
(integer)
javascript
const response = await client.media.upload({ media_url: 'http://www.example.com/audio.mp3' });

console.log(response.data);
Returns:
content_type
(string),
created_at
(string),
expires_at
(string),
media_name
(string),
updated_at
(string)
将媒体文件上传到Telnyx,以便与其他Telnyx服务配合使用。
POST /media
— 必填参数:
media_url
可选参数:
media_name
(字符串)、
ttl_secs
(整数)
javascript
const response = await client.media.upload({ media_url: 'http://www.example.com/audio.mp3' });

console.log(response.data);
返回值:
content_type
(字符串)、
created_at
(字符串)、
expires_at
(字符串)、
media_name
(字符串)、
updated_at
(字符串)

Retrieve stored media

获取存储的媒体

Returns the information about a stored media file.
GET /media/{media_name}
javascript
const media = await client.media.retrieve('media_name');

console.log(media.data);
Returns:
content_type
(string),
created_at
(string),
expires_at
(string),
media_name
(string),
updated_at
(string)
返回存储的媒体文件的相关信息。
GET /media/{media_name}
javascript
const media = await client.media.retrieve('media_name');

console.log(media.data);
返回值:
content_type
(字符串)、
created_at
(字符串)、
expires_at
(字符串)、
media_name
(字符串)、
updated_at
(字符串)

Update stored media

更新存储的媒体

Updates a stored media file.
PUT /media/{media_name}
Optional:
media_url
(string),
ttl_secs
(integer)
javascript
const media = await client.media.update('media_name');

console.log(media.data);
Returns:
content_type
(string),
created_at
(string),
expires_at
(string),
media_name
(string),
updated_at
(string)
更新已存储的媒体文件。
PUT /media/{media_name}
可选参数:
media_url
(字符串)、
ttl_secs
(整数)
javascript
const media = await client.media.update('media_name');

console.log(media.data);
返回值:
content_type
(字符串)、
created_at
(字符串)、
expires_at
(字符串)、
media_name
(字符串)、
updated_at
(字符串)

Deletes stored media

删除存储的媒体

Deletes a stored media file.
DELETE /media/{media_name}
javascript
await client.media.delete('media_name');
删除已存储的媒体文件。
DELETE /media/{media_name}
javascript
await client.media.delete('media_name');

Download stored media

下载存储的媒体

Downloads a stored media file.
GET /media/{media_name}/download
javascript
const response = await client.media.download('media_name');

console.log(response);

const content = await response.blob();
console.log(content);
下载已存储的媒体文件。
GET /media/{media_name}/download
javascript
const response = await client.media.download('media_name');

console.log(response);

const content = await response.blob();
console.log(content);

Refresh Operator Connect integration

刷新Operator Connect集成

This endpoint will make an asynchronous request to refresh the Operator Connect integration with Microsoft Teams for the current user. This will create new external connections on the user's account if needed, and/or report the integration results as log messages.
POST /operator_connect/actions/refresh
javascript
const response = await client.operatorConnect.actions.refresh();

console.log(response.message);
Returns:
message
(string),
success
(boolean)
该接口会发起异步请求,为当前用户刷新与Microsoft Teams的Operator Connect集成。如有需要,会在用户账户上创建新的外部连接,并且/或者将集成结果记录为日志消息
POST /operator_connect/actions/refresh
javascript
const response = await client.operatorConnect.actions.refresh();

console.log(response.message);
返回值:
message
(字符串)、
success
(布尔值)

List all recording transcriptions

列出所有录音转写

Returns a list of your recording transcriptions.
GET /recording_transcriptions
javascript
// Automatically fetches more pages as needed.
for await (const recordingTranscription of client.recordingTranscriptions.list()) {
  console.log(recordingTranscription.id);
}
Returns:
created_at
(string),
duration_millis
(int32),
id
(string),
record_type
(enum: recording_transcription),
recording_id
(string),
status
(enum: in-progress, completed),
transcription_text
(string),
updated_at
(string)
返回你的所有录音转写列表。
GET /recording_transcriptions
javascript
// 按需自动拉取更多页面
for await (const recordingTranscription of client.recordingTranscriptions.list()) {
  console.log(recordingTranscription.id);
}
返回值:
created_at
(字符串)、
duration_millis
(int32)、
id
(字符串)、
record_type
(枚举值:recording_transcription)、
recording_id
(字符串)、
status
(枚举值:in-progress, completed)、
transcription_text
(字符串)、
updated_at
(字符串)

Retrieve a recording transcription

获取单个录音转写

Retrieves the details of an existing recording transcription.
GET /recording_transcriptions/{recording_transcription_id}
javascript
const recordingTranscription = await client.recordingTranscriptions.retrieve(
  '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
);

console.log(recordingTranscription.data);
Returns:
created_at
(string),
duration_millis
(int32),
id
(string),
record_type
(enum: recording_transcription),
recording_id
(string),
status
(enum: in-progress, completed),
transcription_text
(string),
updated_at
(string)
获取现有录音转写的详情。
GET /recording_transcriptions/{recording_transcription_id}
javascript
const recordingTranscription = await client.recordingTranscriptions.retrieve(
  '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
);

console.log(recordingTranscription.data);
返回值:
created_at
(字符串)、
duration_millis
(int32)、
id
(字符串)、
record_type
(枚举值:recording_transcription)、
recording_id
(字符串)、
status
(枚举值:in-progress, completed)、
transcription_text
(字符串)、
updated_at
(字符串)

Delete a recording transcription

删除录音转写

Permanently deletes a recording transcription.
DELETE /recording_transcriptions/{recording_transcription_id}
javascript
const recordingTranscription = await client.recordingTranscriptions.delete(
  '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
);

console.log(recordingTranscription.data);
Returns:
created_at
(string),
duration_millis
(int32),
id
(string),
record_type
(enum: recording_transcription),
recording_id
(string),
status
(enum: in-progress, completed),
transcription_text
(string),
updated_at
(string)
永久删除录音转写。
DELETE /recording_transcriptions/{recording_transcription_id}
javascript
const recordingTranscription = await client.recordingTranscriptions.delete(
  '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
);

console.log(recordingTranscription.data);
返回值:
created_at
(字符串)、
duration_millis
(int32)、
id
(字符串)、
record_type
(枚举值:recording_transcription)、
recording_id
(字符串)、
status
(枚举值:in-progress, completed)、
transcription_text
(字符串)、
updated_at
(字符串)

List all call recordings

列出所有通话录音

Returns a list of your call recordings.
GET /recordings
javascript
// Automatically fetches more pages as needed.
for await (const recordingResponseData of client.recordings.list()) {
  console.log(recordingResponseData.id);
}
Returns:
call_control_id
(string),
call_leg_id
(string),
call_session_id
(string),
channels
(enum: single, dual),
conference_id
(string),
connection_id
(string),
created_at
(string),
download_urls
(object),
duration_millis
(int32),
from
(string),
id
(string),
initiated_by
(string),
record_type
(enum: recording),
recording_ended_at
(string),
recording_started_at
(string),
source
(enum: conference, call),
status
(enum: completed),
to
(string),
updated_at
(string)
返回你的所有通话录音列表。
GET /recordings
javascript
// 按需自动拉取更多页面
for await (const recordingResponseData of client.recordings.list()) {
  console.log(recordingResponseData.id);
}
返回值:
call_control_id
(字符串)、
call_leg_id
(字符串)、
call_session_id
(字符串)、
channels
(枚举值:single, dual)、
conference_id
(字符串)、
connection_id
(字符串)、
created_at
(字符串)、
download_urls
(对象)、
duration_millis
(int32)、
from
(字符串)、
id
(字符串)、
initiated_by
(字符串)、
record_type
(枚举值:recording)、
recording_ended_at
(字符串)、
recording_started_at
(字符串)、
source
(枚举值:conference, call)、
status
(枚举值:completed)、
to
(字符串)、
updated_at
(字符串)

Delete a list of call recordings

批量删除通话录音

Permanently deletes a list of call recordings.
POST /recordings/actions/delete
javascript
const action = await client.recordings.actions.delete({
  ids: ['428c31b6-7af4-4bcb-b7f5-5013ef9657c1', '428c31b6-7af4-4bcb-b7f5-5013ef9657c2'],
});

console.log(action.status);
Returns:
status
(enum: ok)
永久删除一组通话录音。
POST /recordings/actions/delete
javascript
const action = await client.recordings.actions.delete({
  ids: ['428c31b6-7af4-4bcb-b7f5-5013ef9657c1', '428c31b6-7af4-4bcb-b7f5-5013ef9657c2'],
});

console.log(action.status);
返回值:
status
(枚举值:ok)

Retrieve a call recording

获取单个通话录音

Retrieves the details of an existing call recording.
GET /recordings/{recording_id}
javascript
const recording = await client.recordings.retrieve('recording_id');

console.log(recording.data);
Returns:
call_control_id
(string),
call_leg_id
(string),
call_session_id
(string),
channels
(enum: single, dual),
conference_id
(string),
connection_id
(string),
created_at
(string),
download_urls
(object),
duration_millis
(int32),
from
(string),
id
(string),
initiated_by
(string),
record_type
(enum: recording),
recording_ended_at
(string),
recording_started_at
(string),
source
(enum: conference, call),
status
(enum: completed),
to
(string),
updated_at
(string)
获取现有通话录音的详情。
GET /recordings/{recording_id}
javascript
const recording = await client.recordings.retrieve('recording_id');

console.log(recording.data);
返回值:
call_control_id
(字符串)、
call_leg_id
(字符串)、
call_session_id
(字符串)、
channels
(枚举值:single, dual)、
conference_id
(字符串)、
connection_id
(字符串)、
created_at
(字符串)、
download_urls
(对象)、
duration_millis
(int32)、
from
(字符串)、
id
(字符串)、
initiated_by
(字符串)、
record_type
(枚举值:recording)、
recording_ended_at
(字符串)、
recording_started_at
(字符串)、
source
(枚举值:conference, call)、
status
(枚举值:completed)、
to
(字符串)、
updated_at
(字符串)

Delete a call recording

删除通话录音

Permanently deletes a call recording.
DELETE /recordings/{recording_id}
javascript
const recording = await client.recordings.delete('recording_id');

console.log(recording.data);
Returns:
call_control_id
(string),
call_leg_id
(string),
call_session_id
(string),
channels
(enum: single, dual),
conference_id
(string),
connection_id
(string),
created_at
(string),
download_urls
(object),
duration_millis
(int32),
from
(string),
id
(string),
initiated_by
(string),
record_type
(enum: recording),
recording_ended_at
(string),
recording_started_at
(string),
source
(enum: conference, call),
status
(enum: completed),
to
(string),
updated_at
(string)
永久删除通话录音。
DELETE /recordings/{recording_id}
javascript
const recording = await client.recordings.delete('recording_id');

console.log(recording.data);
返回值:
call_control_id
(字符串)、
call_leg_id
(字符串)、
call_session_id
(字符串)、
channels
(枚举值:single, dual)、
conference_id
(字符串)、
connection_id
(字符串)、
created_at
(字符串)、
download_urls
(对象)、
duration_millis
(int32)、
from
(字符串)、
id
(字符串)、
initiated_by
(字符串)、
record_type
(枚举值:recording)、
recording_ended_at
(字符串)、
recording_started_at
(字符串)、
source
(枚举值:conference, call)、
status
(枚举值:completed)、
to
(字符串)、
updated_at
(字符串)

Create a SIPREC connector

创建SIPREC连接器

Creates a new SIPREC connector configuration.
POST /siprec_connectors
javascript
const siprecConnector = await client.siprecConnectors.create({
  host: 'siprec.telnyx.com',
  name: 'my-siprec-connector',
  port: 5060,
});

console.log(siprecConnector.data);
Returns:
app_subdomain
(string),
created_at
(string),
host
(string),
name
(string),
port
(integer),
record_type
(string),
updated_at
(string)
创建新的SIPREC连接器配置。
POST /siprec_connectors
javascript
const siprecConnector = await client.siprecConnectors.create({
  host: 'siprec.telnyx.com',
  name: 'my-siprec-connector',
  port: 5060,
});

console.log(siprecConnector.data);
返回值:
app_subdomain
(字符串)、
created_at
(字符串)、
host
(字符串)、
name
(字符串)、
port
(整数)、
record_type
(字符串)、
updated_at
(字符串)

Retrieve a SIPREC connector

获取SIPREC连接器

Returns details of a stored SIPREC connector.
GET /siprec_connectors/{connector_name}
javascript
const siprecConnector = await client.siprecConnectors.retrieve('connector_name');

console.log(siprecConnector.data);
Returns:
app_subdomain
(string),
created_at
(string),
host
(string),
name
(string),
port
(integer),
record_type
(string),
updated_at
(string)
返回已存储的SIPREC连接器详情。
GET /siprec_connectors/{connector_name}
javascript
const siprecConnector = await client.siprecConnectors.retrieve('connector_name');

console.log(siprecConnector.data);
返回值:
app_subdomain
(字符串)、
created_at
(字符串)、
host
(字符串)、
name
(字符串)、
port
(整数)、
record_type
(字符串)、
updated_at
(字符串)

Update a SIPREC connector

更新SIPREC连接器

Updates a stored SIPREC connector configuration.
PUT /siprec_connectors/{connector_name}
javascript
const siprecConnector = await client.siprecConnectors.update('connector_name', {
  host: 'siprec.telnyx.com',
  name: 'my-siprec-connector',
  port: 5060,
});

console.log(siprecConnector.data);
Returns:
app_subdomain
(string),
created_at
(string),
host
(string),
name
(string),
port
(integer),
record_type
(string),
updated_at
(string)
更新已存储的SIPREC连接器配置。
PUT /siprec_connectors/{connector_name}
javascript
const siprecConnector = await client.siprecConnectors.update('connector_name', {
  host: 'siprec.telnyx.com',
  name: 'my-siprec-connector',
  port: 5060,
});

console.log(siprecConnector.data);
返回值:
app_subdomain
(字符串)、
created_at
(字符串)、
host
(字符串)、
name
(字符串)、
port
(整数)、
record_type
(字符串)、
updated_at
(字符串)

Delete a SIPREC connector

删除SIPREC连接器

Deletes a stored SIPREC connector.
DELETE /siprec_connectors/{connector_name}
javascript
await client.siprecConnectors.delete('connector_name');
删除已存储的SIPREC连接器。
DELETE /siprec_connectors/{connector_name}
javascript
await client.siprecConnectors.delete('connector_name');