telnyx-sip-python

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

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

Telnyx Sip - Python

Telnyx Sip - Python

Installation

安装

bash
pip install telnyx
bash
pip install telnyx

Setup

初始化设置

python
import os
from telnyx import Telnyx

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

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

Get all outbound voice profiles

获取所有外呼语音配置文件

Get all outbound voice profiles belonging to the user that match the given filters.
GET /outbound_voice_profiles
python
page = client.outbound_voice_profiles.list()
page = page.data[0]
print(page.id)
获取符合给定筛选条件的、属于当前用户的所有外呼语音配置文件。
GET /outbound_voice_profiles
python
page = client.outbound_voice_profiles.list()
page = page.data[0]
print(page.id)

Create an outbound voice profile

创建外呼语音配置文件

Create an outbound voice profile.
POST /outbound_voice_profiles
— Required:
name
python
outbound_voice_profile = client.outbound_voice_profiles.create(
    name="office",
)
print(outbound_voice_profile.data)
创建一个外呼语音配置文件。
POST /outbound_voice_profiles
— 必填参数:
name
python
outbound_voice_profile = client.outbound_voice_profiles.create(
    name="office",
)
print(outbound_voice_profile.data)

Retrieve an outbound voice profile

获取单个外呼语音配置文件详情

Retrieves the details of an existing outbound voice profile.
GET /outbound_voice_profiles/{id}
python
outbound_voice_profile = client.outbound_voice_profiles.retrieve(
    "1293384261075731499",
)
print(outbound_voice_profile.data)
获取现有外呼语音配置文件的详细信息。
GET /outbound_voice_profiles/{id}
python
outbound_voice_profile = client.outbound_voice_profiles.retrieve(
    "1293384261075731499",
)
print(outbound_voice_profile.data)

Updates an existing outbound voice profile.

更新现有外呼语音配置文件

PATCH /outbound_voice_profiles/{id}
— Required:
name
python
outbound_voice_profile = client.outbound_voice_profiles.update(
    id="1293384261075731499",
    name="office",
)
print(outbound_voice_profile.data)
PATCH /outbound_voice_profiles/{id}
— 必填参数:
name
python
outbound_voice_profile = client.outbound_voice_profiles.update(
    id="1293384261075731499",
    name="office",
)
print(outbound_voice_profile.data)

Delete an outbound voice profile

删除外呼语音配置文件

Deletes an existing outbound voice profile.
DELETE /outbound_voice_profiles/{id}
python
outbound_voice_profile = client.outbound_voice_profiles.delete(
    "1293384261075731499",
)
print(outbound_voice_profile.data)
删除现有外呼语音配置文件。
DELETE /outbound_voice_profiles/{id}
python
outbound_voice_profile = client.outbound_voice_profiles.delete(
    "1293384261075731499",
)
print(outbound_voice_profile.data)

List connections

列出所有连接

Returns a list of your connections irrespective of type.
GET /connections
python
page = client.connections.list()
page = page.data[0]
print(page.id)
返回所有类型的连接列表。
GET /connections
python
page = client.connections.list()
page = page.data[0]
print(page.id)

Retrieve a connection

获取单个连接详情

Retrieves the high-level details of an existing connection.
GET /connections/{id}
python
connection = client.connections.retrieve(
    "id",
)
print(connection.data)
获取现有连接的高层级详细信息。
GET /connections/{id}
python
connection = client.connections.retrieve(
    "id",
)
print(connection.data)

List credential connections

列出凭证式连接

Returns a list of your credential connections.
GET /credential_connections
python
page = client.credential_connections.list()
page = page.data[0]
print(page.id)
返回所有凭证式连接的列表。
GET /credential_connections
python
page = client.credential_connections.list()
page = page.data[0]
print(page.id)

Create a credential connection

创建凭证式连接

Creates a credential connection.
POST /credential_connections
— Required:
user_name
,
password
,
connection_name
python
credential_connection = client.credential_connections.create(
    connection_name="my name",
    password="my123secure456password789",
    user_name="myusername123",
)
print(credential_connection.data)
创建一个凭证式连接。
POST /credential_connections
— 必填参数:
user_name
,
password
,
connection_name
python
credential_connection = client.credential_connections.create(
    connection_name="my name",
    password="my123secure456password789",
    user_name="myusername123",
)
print(credential_connection.data)

Retrieve a credential connection

获取单个凭证式连接详情

Retrieves the details of an existing credential connection.
GET /credential_connections/{id}
python
credential_connection = client.credential_connections.retrieve(
    "id",
)
print(credential_connection.data)
获取现有凭证式连接的详细信息。
GET /credential_connections/{id}
python
credential_connection = client.credential_connections.retrieve(
    "id",
)
print(credential_connection.data)

Update a credential connection

更新凭证式连接

Updates settings of an existing credential connection.
PATCH /credential_connections/{id}
python
credential_connection = client.credential_connections.update(
    id="id",
)
print(credential_connection.data)
更新现有凭证式连接的设置。
PATCH /credential_connections/{id}
python
credential_connection = client.credential_connections.update(
    id="id",
)
print(credential_connection.data)

Delete a credential connection

删除凭证式连接

Deletes an existing credential connection.
DELETE /credential_connections/{id}
python
credential_connection = client.credential_connections.delete(
    "id",
)
print(credential_connection.data)
删除现有凭证式连接。
DELETE /credential_connections/{id}
python
credential_connection = client.credential_connections.delete(
    "id",
)
print(credential_connection.data)

Check a Credential Connection Registration Status

检查凭证式连接注册状态

Checks the registration_status for a credential connection, (
registration_status
) as well as the timestamp for the last SIP registration event (
registration_status_updated_at
)
POST /credential_connections/{id}/actions/check_registration_status
python
response = client.credential_connections.actions.check_registration_status(
    "id",
)
print(response.data)
检查凭证式连接的注册状态(
registration_status
)以及最后一次SIP注册事件的时间戳(
registration_status_updated_at
POST /credential_connections/{id}/actions/check_registration_status
python
response = client.credential_connections.actions.check_registration_status(
    "id",
)
print(response.data)

List Ips

列出所有IP

Get all IPs belonging to the user that match the given filters.
GET /ips
python
page = client.ips.list()
page = page.data[0]
print(page.id)
获取符合给定筛选条件的、属于当前用户的所有IP。
GET /ips
python
page = client.ips.list()
page = page.data[0]
print(page.id)

Create an Ip

创建IP

Create a new IP object.
POST /ips
— Required:
ip_address
python
ip = client.ips.create(
    ip_address="192.168.0.0",
)
print(ip.data)
创建一个新的IP对象。
POST /ips
— 必填参数:
ip_address
python
ip = client.ips.create(
    ip_address="192.168.0.0",
)
print(ip.data)

Retrieve an Ip

获取单个IP详情

Return the details regarding a specific IP.
GET /ips/{id}
python
ip = client.ips.retrieve(
    "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
)
print(ip.data)
返回指定IP的详细信息。
GET /ips/{id}
python
ip = client.ips.retrieve(
    "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
)
print(ip.data)

Update an Ip

更新IP

Update the details of a specific IP.
PATCH /ips/{id}
— Required:
ip_address
python
ip = client.ips.update(
    id="6a09cdc3-8948-47f0-aa62-74ac943d6c58",
    ip_address="192.168.0.0",
)
print(ip.data)
更新指定IP的详细信息。
PATCH /ips/{id}
— 必填参数:
ip_address
python
ip = client.ips.update(
    id="6a09cdc3-8948-47f0-aa62-74ac943d6c58",
    ip_address="192.168.0.0",
)
print(ip.data)

Delete an Ip

删除IP

Delete an IP.
DELETE /ips/{id}
python
ip = client.ips.delete(
    "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
)
print(ip.data)
删除指定IP。
DELETE /ips/{id}
python
ip = client.ips.delete(
    "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
)
print(ip.data)

List Ip connections

列出所有IP连接

Returns a list of your IP connections.
GET /ip_connections
python
page = client.ip_connections.list()
page = page.data[0]
print(page.id)
返回所有IP连接的列表。
GET /ip_connections
python
page = client.ip_connections.list()
page = page.data[0]
print(page.id)

Create an Ip connection

创建IP连接

Creates an IP connection.
POST /ip_connections
python
ip_connection = client.ip_connections.create()
print(ip_connection.data)
创建一个IP连接。
POST /ip_connections
python
ip_connection = client.ip_connections.create()
print(ip_connection.data)

Retrieve an Ip connection

获取单个IP连接详情

Retrieves the details of an existing ip connection.
GET /ip_connections/{id}
python
ip_connection = client.ip_connections.retrieve(
    "id",
)
print(ip_connection.data)
获取现有IP连接的详细信息。
GET /ip_connections/{id}
python
ip_connection = client.ip_connections.retrieve(
    "id",
)
print(ip_connection.data)

Update an Ip connection

更新IP连接

Updates settings of an existing IP connection.
PATCH /ip_connections/{id}
python
ip_connection = client.ip_connections.update(
    id="id",
)
print(ip_connection.data)
更新现有IP连接的设置。
PATCH /ip_connections/{id}
python
ip_connection = client.ip_connections.update(
    id="id",
)
print(ip_connection.data)

Delete an Ip connection

删除IP连接

Deletes an existing IP connection.
DELETE /ip_connections/{id}
python
ip_connection = client.ip_connections.delete(
    "id",
)
print(ip_connection.data)
删除现有IP连接。
DELETE /ip_connections/{id}
python
ip_connection = client.ip_connections.delete(
    "id",
)
print(ip_connection.data)

List FQDNs

列出所有FQDN

Get all FQDNs belonging to the user that match the given filters.
GET /fqdns
python
page = client.fqdns.list()
page = page.data[0]
print(page.id)
获取符合给定筛选条件的、属于当前用户的所有FQDN。
GET /fqdns
python
page = client.fqdns.list()
page = page.data[0]
print(page.id)

Create an FQDN

创建FQDN

Create a new FQDN object.
POST /fqdns
— Required:
fqdn
,
dns_record_type
,
connection_id
python
fqdn = client.fqdns.create(
    connection_id="1516447646313612565",
    dns_record_type="a",
    fqdn="example.com",
)
print(fqdn.data)
创建一个新的FQDN对象。
POST /fqdns
— 必填参数:
fqdn
,
dns_record_type
,
connection_id
python
fqdn = client.fqdns.create(
    connection_id="1516447646313612565",
    dns_record_type="a",
    fqdn="example.com",
)
print(fqdn.data)

Retrieve an FQDN

获取单个FQDN详情

Return the details regarding a specific FQDN.
GET /fqdns/{id}
python
fqdn = client.fqdns.retrieve(
    "id",
)
print(fqdn.data)
返回指定FQDN的详细信息。
GET /fqdns/{id}
python
fqdn = client.fqdns.retrieve(
    "id",
)
print(fqdn.data)

Update an FQDN

更新FQDN

Update the details of a specific FQDN.
PATCH /fqdns/{id}
python
fqdn = client.fqdns.update(
    id="id",
)
print(fqdn.data)
更新指定FQDN的详细信息。
PATCH /fqdns/{id}
python
fqdn = client.fqdns.update(
    id="id",
)
print(fqdn.data)

Delete an FQDN

删除FQDN

Delete an FQDN.
DELETE /fqdns/{id}
python
fqdn = client.fqdns.delete(
    "id",
)
print(fqdn.data)
删除指定FQDN。
DELETE /fqdns/{id}
python
fqdn = client.fqdns.delete(
    "id",
)
print(fqdn.data)

List FQDN connections

列出所有FQDN连接

Returns a list of your FQDN connections.
GET /fqdn_connections
python
page = client.fqdn_connections.list()
page = page.data[0]
print(page.id)
返回所有FQDN连接的列表。
GET /fqdn_connections
python
page = client.fqdn_connections.list()
page = page.data[0]
print(page.id)

Create an FQDN connection

创建FQDN连接

Creates a FQDN connection.
POST /fqdn_connections
— Required:
connection_name
python
fqdn_connection = client.fqdn_connections.create(
    connection_name="string",
)
print(fqdn_connection.data)
创建一个FQDN连接。
POST /fqdn_connections
— 必填参数:
connection_name
python
fqdn_connection = client.fqdn_connections.create(
    connection_name="string",
)
print(fqdn_connection.data)

Retrieve an FQDN connection

获取单个FQDN连接详情

Retrieves the details of an existing FQDN connection.
GET /fqdn_connections/{id}
python
fqdn_connection = client.fqdn_connections.retrieve(
    "id",
)
print(fqdn_connection.data)
获取现有FQDN连接的详细信息。
GET /fqdn_connections/{id}
python
fqdn_connection = client.fqdn_connections.retrieve(
    "id",
)
print(fqdn_connection.data)

Update an FQDN connection

更新FQDN连接

Updates settings of an existing FQDN connection.
PATCH /fqdn_connections/{id}
python
fqdn_connection = client.fqdn_connections.update(
    id="id",
)
print(fqdn_connection.data)
更新现有FQDN连接的设置。
PATCH /fqdn_connections/{id}
python
fqdn_connection = client.fqdn_connections.update(
    id="id",
)
print(fqdn_connection.data)

Delete an FQDN connection

删除FQDN连接

Deletes an FQDN connection.
DELETE /fqdn_connections/{id}
python
fqdn_connection = client.fqdn_connections.delete(
    "id",
)
print(fqdn_connection.data)
删除指定FQDN连接。
DELETE /fqdn_connections/{id}
python
fqdn_connection = client.fqdn_connections.delete(
    "id",
)
print(fqdn_connection.data)

List Mobile Voice Connections

列出所有移动语音连接

GET /v2/mobile_voice_connections
python
page = client.mobile_voice_connections.list()
page = page.data[0]
print(page.id)
GET /v2/mobile_voice_connections
python
page = client.mobile_voice_connections.list()
page = page.data[0]
print(page.id)

Create a Mobile Voice Connection

创建移动语音连接

POST /v2/mobile_voice_connections
python
mobile_voice_connection = client.mobile_voice_connections.create()
print(mobile_voice_connection.data)
POST /v2/mobile_voice_connections
python
mobile_voice_connection = client.mobile_voice_connections.create()
print(mobile_voice_connection.data)

Retrieve a Mobile Voice Connection

获取单个移动语音连接详情

GET /v2/mobile_voice_connections/{id}
python
mobile_voice_connection = client.mobile_voice_connections.retrieve(
    "id",
)
print(mobile_voice_connection.data)
GET /v2/mobile_voice_connections/{id}
python
mobile_voice_connection = client.mobile_voice_connections.retrieve(
    "id",
)
print(mobile_voice_connection.data)

Update a Mobile Voice Connection

更新移动语音连接

PATCH /v2/mobile_voice_connections/{id}
python
mobile_voice_connection = client.mobile_voice_connections.update(
    id="id",
)
print(mobile_voice_connection.data)
PATCH /v2/mobile_voice_connections/{id}
python
mobile_voice_connection = client.mobile_voice_connections.update(
    id="id",
)
print(mobile_voice_connection.data)

Delete a Mobile Voice Connection

删除移动语音连接

DELETE /v2/mobile_voice_connections/{id}
python
mobile_voice_connection = client.mobile_voice_connections.delete(
    "id",
)
print(mobile_voice_connection.data)
DELETE /v2/mobile_voice_connections/{id}
python
mobile_voice_connection = client.mobile_voice_connections.delete(
    "id",
)
print(mobile_voice_connection.data)