telnyx-numbers-config-ruby
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
<!-- 从Telnyx OpenAPI规范自动生成,请勿编辑。 -->
Telnyx Numbers Config - Ruby
Telnyx电话号码配置 - Ruby
Installation
安装
bash
gem install telnyxbash
gem install telnyxSetup
初始化配置
ruby
require "telnyx"
client = Telnyx::Client.new(
api_key: ENV["TELNYX_API_KEY"], # This is the default and can be omitted
)All examples below assume is already initialized as shown above.
clientruby
require "telnyx"
client = Telnyx::Client.new(
api_key: ENV["TELNYX_API_KEY"], # 这是默认配置,可省略
)以下所有示例都假设已经按照上述方式完成初始化。
clientError 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:
ruby
begin
result = client.messages.send_(to: "+13125550001", from: "+13125550002", text: "Hello")
rescue Telnyx::Errors::APIConnectionError
puts "Network error — check connectivity and retry"
rescue Telnyx::Errors::RateLimitError
# 429: rate limited — wait and retry with exponential backoff
sleep(1) # Check Retry-After header for actual delay
rescue Telnyx::Errors::APIStatusError => e
puts "API error #{e.status}: #{e.message}"
if e.status == 422
puts "Validation error — check required fields and formats"
end
endCommon error codes: invalid API key, insufficient permissions,
resource not found, validation error (check field formats),
rate limited (retry with exponential backoff).
401403404422429所有API调用都可能因网络错误、速率限制(429)、校验错误(422)或认证错误(401)而失败。在生产代码中请务必做好错误处理:
ruby
begin
result = client.messages.send_(to: "+13125550001", from: "+13125550002", text: "Hello")
rescue Telnyx::Errors::APIConnectionError
puts "网络错误 —— 检查网络连接后重试"
rescue Telnyx::Errors::RateLimitError
# 429:触发速率限制 —— 等待后使用指数退避策略重试
sleep(1) # 可查看Retry-After响应头获取准确的等待时长
rescue Telnyx::Errors::APIStatusError => e
puts "API错误 #{e.status}: #{e.message}"
if e.status == 422
puts "校验错误 —— 检查必填字段和格式是否正确"
end
end常见错误码: API密钥无效, 权限不足, 资源不存在, 校验错误(检查字段格式), 触发速率限制(使用指数退避策略重试)。
401403404422429Important Notes
重要注意事项
- Phone numbers must be in E.164 format (e.g., ). Include the
+13125550001prefix and country code. No spaces, dashes, or parentheses.+ - Pagination: Use for automatic iteration:
.auto_paging_each.page.auto_paging_each { |item| puts item.id }
- 电话号码必须符合E.164格式(例如:),需包含
+13125550001前缀和国家码,不得包含空格、短横线或括号。+ - 分页: 使用实现自动遍历分页结果:
.auto_paging_each。page.auto_paging_each { |item| puts item.id }
Bulk update phone number profiles
批量更新电话号码配置文件
POST /messaging_numbers_bulk_updatesmessaging_profile_idnumbersOptional: (boolean)
assign_onlyruby
messaging_numbers_bulk_update = client.messaging_numbers_bulk_updates.create(
messaging_profile_id: "00000000-0000-0000-0000-000000000000",
numbers: ["+18880000000", "+18880000001", "+18880000002"]
)
puts(messaging_numbers_bulk_update)Returns: (array[string]), (uuid), (array[string]), (enum: messaging_numbers_bulk_update), (array[string])
failedorder_idpendingrecord_typesuccessPOST /messaging_numbers_bulk_updatesmessaging_profile_idnumbers可选参数:(布尔值)
assign_onlyruby
messaging_numbers_bulk_update = client.messaging_numbers_bulk_updates.create(
messaging_profile_id: "00000000-0000-0000-0000-000000000000",
numbers: ["+18880000000", "+18880000001", "+18880000002"]
)
puts(messaging_numbers_bulk_update)返回参数:(字符串数组)、(UUID)、(字符串数组)、(枚举值:messaging_numbers_bulk_update)、(字符串数组)
failedorder_idpendingrecord_typesuccessRetrieve bulk update status
查询批量更新任务状态
GET /messaging_numbers_bulk_updates/{order_id}ruby
messaging_numbers_bulk_update = client.messaging_numbers_bulk_updates.retrieve("order_id")
puts(messaging_numbers_bulk_update)Returns: (array[string]), (uuid), (array[string]), (enum: messaging_numbers_bulk_update), (array[string])
failedorder_idpendingrecord_typesuccessGET /messaging_numbers_bulk_updates/{order_id}ruby
messaging_numbers_bulk_update = client.messaging_numbers_bulk_updates.retrieve("order_id")
puts(messaging_numbers_bulk_update)返回参数:(字符串数组)、(UUID)、(字符串数组)、(枚举值:messaging_numbers_bulk_update)、(字符串数组)
failedorder_idpendingrecord_typesuccessList mobile phone numbers with messaging settings
查询带消息配置的手机号码列表
GET /mobile_phone_numbers/messagingruby
page = client.mobile_phone_numbers.messaging.list
puts(page)Returns: (string), (date-time), (object), (string), (string), (string | null), (string), (string), (enum: messaging_phone_number, messaging_settings), (array[string]), (string), (enum: longcode), (date-time)
country_codecreated_atfeaturesidmessaging_productmessaging_profile_idorganization_idphone_numberrecord_typetagstraffic_typetypeupdated_atGET /mobile_phone_numbers/messagingruby
page = client.mobile_phone_numbers.messaging.list
puts(page)返回参数:(字符串)、(日期时间)、(对象)、(字符串)、(字符串)、(字符串 / 空)、(字符串)、(字符串)、(枚举值:messaging_phone_number、messaging_settings)、(字符串数组)、(字符串)、(枚举值:longcode)、(日期时间)
country_codecreated_atfeaturesidmessaging_productmessaging_profile_idorganization_idphone_numberrecord_typetagstraffic_typetypeupdated_atRetrieve a mobile phone number with messaging settings
查询单条带消息配置的手机号码
GET /mobile_phone_numbers/{id}/messagingruby
messaging = client.mobile_phone_numbers.messaging.retrieve("550e8400-e29b-41d4-a716-446655440000")
puts(messaging)Returns: (string), (date-time), (object), (string), (string), (string | null), (string), (string), (enum: messaging_phone_number, messaging_settings), (array[string]), (string), (enum: longcode), (date-time)
country_codecreated_atfeaturesidmessaging_productmessaging_profile_idorganization_idphone_numberrecord_typetagstraffic_typetypeupdated_atGET /mobile_phone_numbers/{id}/messagingruby
messaging = client.mobile_phone_numbers.messaging.retrieve("550e8400-e29b-41d4-a716-446655440000")
puts(messaging)返回参数:(字符串)、(日期时间)、(对象)、(字符串)、(字符串)、(字符串 / 空)、(字符串)、(字符串)、(枚举值:messaging_phone_number、messaging_settings)、(字符串数组)、(字符串)、(枚举值:longcode)、(日期时间)
country_codecreated_atfeaturesidmessaging_productmessaging_profile_idorganization_idphone_numberrecord_typetagstraffic_typetypeupdated_atList phone numbers
查询电话号码列表
GET /phone_numbersruby
page = client.phone_numbers.list
puts(page)Returns: (string | null), (boolean), (boolean), (boolean), (boolean), (string | null), (string | null), (string), (date-time), (string | null), (boolean), (string | null), (boolean), (enum: active, deprovisioning, disabled, provisioning, provisioning-failed), (string | null), (boolean), (string), (enum: disabled, reject_calls, flag_calls), (string | null), (string | null), (string), (enum: local, toll_free, mobile, national, shared_cost, landline, tollfree, shortcode, longcode), (string), (string), (object), (enum: purchase-pending, purchase-failed, port-pending, port-failed, active, deleted, emergency-only, ported-out, port-out-pending, requirement-info-pending, requirement-info-under-review, requirement-info-exception, provision-pending), (boolean), (array[string]), (string)
billing_group_idcall_forwarding_enabledcall_recording_enabledcaller_id_name_enabledcnam_listing_enabledconnection_idconnection_namecountry_iso_alpha2created_atcustomer_referencedeletion_lock_enabledemergency_address_idemergency_enabledemergency_statusexternal_pinhd_voice_enabledidinbound_call_screeningmessaging_profile_idmessaging_profile_namephone_numberphone_number_typepurchased_atrecord_typesource_typestatust38_fax_gateway_enabledtagsupdated_atGET /phone_numbersruby
page = client.phone_numbers.list
puts(page)返回参数:(字符串 / 空)、(布尔值)、(布尔值)、(布尔值)、(布尔值)、(字符串 / 空)、(字符串 / 空)、(字符串)、(日期时间)、(字符串 / 空)、(布尔值)、(字符串 / 空)、(布尔值)、(枚举值:active、deprovisioning、disabled、provisioning、provisioning-failed)、(字符串 / 空)、(布尔值)、(字符串)、(枚举值:disabled、reject_calls、flag_calls)、(字符串 / 空)、(字符串 / 空)、(字符串)、(枚举值:local、toll_free、mobile、national、shared_cost、landline、tollfree、shortcode、longcode)、(字符串)、(字符串)、(对象)、(枚举值:purchase-pending、purchase-failed、port-pending、port-failed、active、deleted、emergency-only、ported-out、port-out-pending、requirement-info-pending、requirement-info-under-review、requirement-info-exception、provision-pending)、(布尔值)、(字符串数组)、(字符串)
billing_group_idcall_forwarding_enabledcall_recording_enabledcaller_id_name_enabledcnam_listing_enabledconnection_idconnection_namecountry_iso_alpha2created_atcustomer_referencedeletion_lock_enabledemergency_address_idemergency_enabledemergency_statusexternal_pinhd_voice_enabledidinbound_call_screeningmessaging_profile_idmessaging_profile_namephone_numberphone_number_typepurchased_atrecord_typesource_typestatust38_fax_gateway_enabledtagsupdated_atVerify ownership of phone numbers
验证电话号码归属权
Verifies ownership of the provided phone numbers and returns a mapping of numbers to their IDs, plus a list of numbers not found in the account.
POST /phone_numbers/actions/verify_ownershipphone_numbersruby
response = client.phone_numbers.actions.verify_ownership(phone_numbers: ["+15551234567"])
puts(response)Returns: (array[object]), (array[string]), (string)
foundnot_foundrecord_type验证传入的电话号码归属权,返回号码与对应ID的映射关系,以及账号下不存在的号码列表。
POST /phone_numbers/actions/verify_ownershipphone_numbersruby
response = client.phone_numbers.actions.verify_ownership(phone_numbers: ["+15551234567"])
puts(response)返回参数:(对象数组)、(字符串数组)、(字符串)
foundnot_foundrecord_typeLists the phone numbers jobs
查询电话号码任务列表
GET /phone_numbers/jobsruby
page = client.phone_numbers.jobs.list
puts(page)Returns: (string), (date-time), (array[object]), (uuid), (array[object]), (array[object]), (string), (enum: pending, in_progress, completed, failed, expired), (array[object]), (enum: update_emergency_settings, delete_phone_numbers, update_phone_numbers), (string)
created_atetcfailed_operationsidpending_operationsphone_numbersrecord_typestatussuccessful_operationstypeupdated_atGET /phone_numbers/jobsruby
page = client.phone_numbers.jobs.list
puts(page)返回参数:(字符串)、(日期时间)、(对象数组)、(UUID)、(对象数组)、(对象数组)、(字符串)、(枚举值:pending、in_progress、completed、failed、expired)、(对象数组)、(枚举值:update_emergency_settings、delete_phone_numbers、update_phone_numbers)、(字符串)
created_atetcfailed_operationsidpending_operationsphone_numbersrecord_typestatussuccessful_operationstypeupdated_atDelete a batch of numbers
批量删除电话号码
Creates a new background job to delete a batch of numbers. At most one thousand numbers can be updated per API call.
POST /phone_numbers/jobs/delete_phone_numbersphone_numbersruby
response = client.phone_numbers.jobs.delete_batch(phone_numbers: ["+19705555098", "+19715555098", "32873127836"])
puts(response)Returns: (string), (date-time), (array[object]), (uuid), (array[object]), (array[object]), (string), (enum: pending, in_progress, completed, failed, expired), (array[object]), (enum: update_emergency_settings, delete_phone_numbers, update_phone_numbers), (string)
created_atetcfailed_operationsidpending_operationsphone_numbersrecord_typestatussuccessful_operationstypeupdated_at创建后台任务批量删除电话号码,单次API调用最多可操作1000个号码。
POST /phone_numbers/jobs/delete_phone_numbersphone_numbersruby
response = client.phone_numbers.jobs.delete_batch(phone_numbers: ["+19705555098", "+19715555098", "32873127836"])
puts(response)返回参数:(字符串)、(日期时间)、(对象数组)、(UUID)、(对象数组)、(对象数组)、(字符串)、(枚举值:pending、in_progress、completed、failed、expired)、(对象数组)、(枚举值:update_emergency_settings、delete_phone_numbers、update_phone_numbers)、(字符串)
created_atetcfailed_operationsidpending_operationsphone_numbersrecord_typestatussuccessful_operationstypeupdated_atUpdate the emergency settings from a batch of numbers
批量更新电话号码紧急设置
Creates a background job to update the emergency settings of a collection of phone numbers. At most one thousand numbers can be updated per API call.
POST /phone_numbers/jobs/update_emergency_settingsemergency_enabledphone_numbersOptional: (string | null)
emergency_address_idruby
response = client.phone_numbers.jobs.update_emergency_settings_batch(
emergency_enabled: true,
phone_numbers: ["+19705555098", "+19715555098", "32873127836"]
)
puts(response)Returns: (string), (date-time), (array[object]), (uuid), (array[object]), (array[object]), (string), (enum: pending, in_progress, completed, failed, expired), (array[object]), (enum: update_emergency_settings, delete_phone_numbers, update_phone_numbers), (string)
created_atetcfailed_operationsidpending_operationsphone_numbersrecord_typestatussuccessful_operationstypeupdated_at创建后台任务批量更新一组电话号码的紧急设置,单次API调用最多可操作1000个号码。
POST /phone_numbers/jobs/update_emergency_settingsemergency_enabledphone_numbers可选参数:(字符串 / 空)
emergency_address_idruby
response = client.phone_numbers.jobs.update_emergency_settings_batch(
emergency_enabled: true,
phone_numbers: ["+19705555098", "+19715555098", "32873127836"]
)
puts(response)返回参数:(字符串)、(日期时间)、(对象数组)、(UUID)、(对象数组)、(对象数组)、(字符串)、(枚举值:pending、in_progress、completed、failed、expired)、(对象数组)、(枚举值:update_emergency_settings、delete_phone_numbers、update_phone_numbers)、(字符串)
created_atetcfailed_operationsidpending_operationsphone_numbersrecord_typestatussuccessful_operationstypeupdated_atUpdate a batch of numbers
批量更新电话号码
Creates a new background job to update a batch of numbers. At most one thousand numbers can be updated per API call. At least one of the updateable fields must be submitted.
POST /phone_numbers/jobs/update_phone_numbersphone_numbersOptional: (string), (string), (string), (boolean), (string), (boolean), (array[string]), (object)
billing_group_idconnection_idcustomer_referencedeletion_lock_enabledexternal_pinhd_voice_enabledtagsvoiceruby
response = client.phone_numbers.jobs.update_batch(phone_numbers: ["1583466971586889004", "+13127367254"])
puts(response)Returns: (string), (date-time), (array[object]), (uuid), (array[object]), (array[object]), (string), (enum: pending, in_progress, completed, failed, expired), (array[object]), (enum: update_emergency_settings, delete_phone_numbers, update_phone_numbers), (string)
created_atetcfailed_operationsidpending_operationsphone_numbersrecord_typestatussuccessful_operationstypeupdated_at创建后台任务批量更新电话号码,单次API调用最多可操作1000个号码,至少需要传入一个可更新字段。
POST /phone_numbers/jobs/update_phone_numbersphone_numbers可选参数:(字符串)、(字符串)、(字符串)、(布尔值)、(字符串)、(布尔值)、(字符串数组)、(对象)
billing_group_idconnection_idcustomer_referencedeletion_lock_enabledexternal_pinhd_voice_enabledtagsvoiceruby
response = client.phone_numbers.jobs.update_batch(phone_numbers: ["1583466971586889004", "+13127367254"])
puts(response)返回参数:(字符串)、(日期时间)、(对象数组)、(UUID)、(对象数组)、(对象数组)、(字符串)、(枚举值:pending、in_progress、completed、failed、expired)、(对象数组)、(枚举值:update_emergency_settings、delete_phone_numbers、update_phone_numbers)、(字符串)
created_atetcfailed_operationsidpending_operationsphone_numbersrecord_typestatussuccessful_operationstypeupdated_atRetrieve a phone numbers job
查询单条电话号码任务
GET /phone_numbers/jobs/{id}ruby
job = client.phone_numbers.jobs.retrieve("550e8400-e29b-41d4-a716-446655440000")
puts(job)Returns: (string), (date-time), (array[object]), (uuid), (array[object]), (array[object]), (string), (enum: pending, in_progress, completed, failed, expired), (array[object]), (enum: update_emergency_settings, delete_phone_numbers, update_phone_numbers), (string)
created_atetcfailed_operationsidpending_operationsphone_numbersrecord_typestatussuccessful_operationstypeupdated_atGET /phone_numbers/jobs/{id}ruby
job = client.phone_numbers.jobs.retrieve("550e8400-e29b-41d4-a716-446655440000")
puts(job)返回参数:(字符串)、(日期时间)、(对象数组)、(UUID)、(对象数组)、(对象数组)、(字符串)、(枚举值:pending、in_progress、completed、failed、expired)、(对象数组)、(枚举值:update_emergency_settings、delete_phone_numbers、update_phone_numbers)、(字符串)
created_atetcfailed_operationsidpending_operationsphone_numbersrecord_typestatussuccessful_operationstypeupdated_atList phone numbers with messaging settings
查询带消息配置的电话号码列表
GET /phone_numbers/messagingruby
page = client.phone_numbers.messaging.list
puts(page)Returns: (string), (date-time), (array[string]), (object), (object), (string), (string), (string | null), (string), (string), (enum: messaging_phone_number, messaging_settings), (array[string]), (string), (enum: long-code, toll-free, short-code, longcode, tollfree, shortcode), (date-time)
country_codecreated_ateligible_messaging_productsfeatureshealthidmessaging_productmessaging_profile_idorganization_idphone_numberrecord_typetagstraffic_typetypeupdated_atGET /phone_numbers/messagingruby
page = client.phone_numbers.messaging.list
puts(page)返回参数:(字符串)、(日期时间)、(字符串数组)、(对象)、(对象)、(字符串)、(字符串)、(字符串 / 空)、(字符串)、(字符串)、(枚举值:messaging_phone_number、messaging_settings)、(字符串数组)、(字符串)、(枚举值:long-code、toll-free、short-code、longcode、tollfree、shortcode)、(日期时间)
country_codecreated_ateligible_messaging_productsfeatureshealthidmessaging_productmessaging_profile_idorganization_idphone_numberrecord_typetagstraffic_typetypeupdated_atSlim List phone numbers
精简版电话号码列表查询
List phone numbers, This endpoint is a lighter version of the /phone_numbers endpoint having higher performance and rate limit.
GET /phone_numbers/slimruby
page = client.phone_numbers.slim_list
puts(page)Returns: (string), (boolean), (boolean), (boolean), (boolean), (string), (string), (string), (string), (string), (boolean), (enum: active, deprovisioning, disabled, provisioning, provisioning-failed), (string), (boolean), (string), (enum: disabled, reject_calls, flag_calls), (string), (enum: local, toll_free, mobile, national, shared_cost, landline, tollfree, shortcode, longcode), (string), (string), (enum: purchase-pending, purchase-failed, port-pending, port-failed, active, deleted, emergency-only, ported-out, port-out-pending, requirement-info-pending, requirement-info-under-review, requirement-info-exception, provision-pending), (boolean), (string)
billing_group_idcall_forwarding_enabledcall_recording_enabledcaller_id_name_enabledcnam_listing_enabledconnection_idcountry_iso_alpha2created_atcustomer_referenceemergency_address_idemergency_enabledemergency_statusexternal_pinhd_voice_enabledidinbound_call_screeningphone_numberphone_number_typepurchased_atrecord_typestatust38_fax_gateway_enabledupdated_at查询电话号码列表,该接口是/phone_numbers接口的轻量版本,拥有更高的性能和速率限制。
GET /phone_numbers/slimruby
page = client.phone_numbers.slim_list
puts(page)返回参数:(字符串)、(布尔值)、(布尔值)、(布尔值)、(布尔值)、(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(布尔值)、(枚举值:active、deprovisioning、disabled、provisioning、provisioning-failed)、(字符串)、(布尔值)、(字符串)、(枚举值:disabled、reject_calls、flag_calls)、(字符串)、(枚举值:local、toll_free、mobile、national、shared_cost、landline、tollfree、shortcode、longcode)、(字符串)、(字符串)、(枚举值:purchase-pending、purchase-failed、port-pending、port-failed、active、deleted、emergency-only、ported-out、port-out-pending、requirement-info-pending、requirement-info-under-review、requirement-info-exception、provision-pending)、(布尔值)、(字符串)
billing_group_idcall_forwarding_enabledcall_recording_enabledcaller_id_name_enabledcnam_listing_enabledconnection_idcountry_iso_alpha2created_atcustomer_referenceemergency_address_idemergency_enabledemergency_statusexternal_pinhd_voice_enabledidinbound_call_screeningphone_numberphone_number_typepurchased_atrecord_typestatust38_fax_gateway_enabledupdated_atList phone numbers with voice settings
查询带语音配置的电话号码列表
GET /phone_numbers/voiceruby
page = client.phone_numbers.voice.list
puts(page)Returns: (object), (object), (object), (string), (string), (object), (string), (enum: disabled, reject_calls, flag_calls), (object), (string), (string), (boolean), (string), (enum: pay-per-minute, channel)
call_forwardingcall_recordingcnam_listingconnection_idcustomer_referenceemergencyidinbound_call_screeningmedia_featuresphone_numberrecord_typetech_prefix_enabledtranslated_numberusage_payment_methodGET /phone_numbers/voiceruby
page = client.phone_numbers.voice.list
puts(page)返回参数:(对象)、(对象)、(对象)、(字符串)、(字符串)、(对象)、(字符串)、(枚举值:disabled、reject_calls、flag_calls)、(对象)、(字符串)、(字符串)、(布尔值)、(字符串)、(枚举值:pay-per-minute、channel)
call_forwardingcall_recordingcnam_listingconnection_idcustomer_referenceemergencyidinbound_call_screeningmedia_featuresphone_numberrecord_typetech_prefix_enabledtranslated_numberusage_payment_methodRetrieve a phone number
查询单条电话号码
GET /phone_numbers/{id}ruby
phone_number = client.phone_numbers.retrieve("1293384261075731499")
puts(phone_number)Returns: (string | null), (boolean), (boolean), (boolean), (boolean), (string | null), (string | null), (string), (date-time), (string | null), (boolean), (string | null), (boolean), (enum: active, deprovisioning, disabled, provisioning, provisioning-failed), (string | null), (boolean), (string), (enum: disabled, reject_calls, flag_calls), (string | null), (string | null), (string), (enum: local, toll_free, mobile, national, shared_cost, landline, tollfree, shortcode, longcode), (string), (string), (object), (enum: purchase-pending, purchase-failed, port-pending, port-failed, active, deleted, emergency-only, ported-out, port-out-pending, requirement-info-pending, requirement-info-under-review, requirement-info-exception, provision-pending), (boolean), (array[string]), (string)
billing_group_idcall_forwarding_enabledcall_recording_enabledcaller_id_name_enabledcnam_listing_enabledconnection_idconnection_namecountry_iso_alpha2created_atcustomer_referencedeletion_lock_enabledemergency_address_idemergency_enabledemergency_statusexternal_pinhd_voice_enabledidinbound_call_screeningmessaging_profile_idmessaging_profile_namephone_numberphone_number_typepurchased_atrecord_typesource_typestatust38_fax_gateway_enabledtagsupdated_atGET /phone_numbers/{id}ruby
phone_number = client.phone_numbers.retrieve("1293384261075731499")
puts(phone_number)返回参数:(字符串 / 空)、(布尔值)、(布尔值)、(布尔值)、(布尔值)、(字符串 / 空)、(字符串 / 空)、(字符串)、(日期时间)、(字符串 / 空)、(布尔值)、(字符串 / 空)、(布尔值)、(枚举值:active、deprovisioning、disabled、provisioning、provisioning-failed)、(字符串 / 空)、(布尔值)、(字符串)、(枚举值:disabled、reject_calls、flag_calls)、(字符串 / 空)、(字符串 / 空)、(字符串)、(枚举值:local、toll_free、mobile、national、shared_cost、landline、tollfree、shortcode、longcode)、(字符串)、(字符串)、(对象)、(枚举值:purchase-pending、purchase-failed、port-pending、port-failed、active、deleted、emergency-only、ported-out、port-out-pending、requirement-info-pending、requirement-info-under-review、requirement-info-exception、provision-pending)、(布尔值)、(字符串数组)、(字符串)
billing_group_idcall_forwarding_enabledcall_recording_enabledcaller_id_name_enabledcnam_listing_enabledconnection_idconnection_namecountry_iso_alpha2created_atcustomer_referencedeletion_lock_enabledemergency_address_idemergency_enabledemergency_statusexternal_pinhd_voice_enabledidinbound_call_screeningmessaging_profile_idmessaging_profile_namephone_numberphone_number_typepurchased_atrecord_typesource_typestatust38_fax_gateway_enabledtagsupdated_atUpdate a phone number
更新单条电话号码
PATCH /phone_numbers/{id}Optional: (string), (string), (string), (string), (string), (boolean), (string), (array[string])
address_idbilling_group_idconnection_idcustomer_referenceexternal_pinhd_voice_enabledidtagsruby
phone_number = client.phone_numbers.update("1293384261075731499")
puts(phone_number)Returns: (string | null), (boolean), (boolean), (boolean), (boolean), (string | null), (string | null), (string), (date-time), (string | null), (boolean), (string | null), (boolean), (enum: active, deprovisioning, disabled, provisioning, provisioning-failed), (string | null), (boolean), (string), (enum: disabled, reject_calls, flag_calls), (string | null), (string | null), (string), (enum: local, toll_free, mobile, national, shared_cost, landline, tollfree, shortcode, longcode), (string), (string), (object), (enum: purchase-pending, purchase-failed, port-pending, port-failed, active, deleted, emergency-only, ported-out, port-out-pending, requirement-info-pending, requirement-info-under-review, requirement-info-exception, provision-pending), (boolean), (array[string]), (string)
billing_group_idcall_forwarding_enabledcall_recording_enabledcaller_id_name_enabledcnam_listing_enabledconnection_idconnection_namecountry_iso_alpha2created_atcustomer_referencedeletion_lock_enabledemergency_address_idemergency_enabledemergency_statusexternal_pinhd_voice_enabledidinbound_call_screeningmessaging_profile_idmessaging_profile_namephone_numberphone_number_typepurchased_atrecord_typesource_typestatust38_fax_gateway_enabledtagsupdated_atPATCH /phone_numbers/{id}可选参数:(字符串)、(字符串)、(字符串)、(字符串)、(字符串)、(布尔值)、(字符串)、(字符串数组)
address_idbilling_group_idconnection_idcustomer_referenceexternal_pinhd_voice_enabledidtagsruby
phone_number = client.phone_numbers.update("1293384261075731499")
puts(phone_number)返回参数:(字符串 / 空)、(布尔值)、(布尔值)、(布尔值)、(布尔值)、(字符串 / 空)、(字符串 / 空)、(字符串)、(日期时间)、(字符串 / 空)、(布尔值)、(字符串 / 空)、(布尔值)、(枚举值:active、deprovisioning、disabled、provisioning、provisioning-failed)、(字符串 / 空)、(布尔值)、(字符串)、(枚举值:disabled、reject_calls、flag_calls)、(字符串 / 空)、(字符串 / 空)、(字符串)、(枚举值:local、toll_free、mobile、national、shared_cost、landline、tollfree、shortcode、longcode)、(字符串)、(字符串)、(对象)、(枚举值:purchase-pending、purchase-failed、port-pending、port-failed、active、deleted、emergency-only、ported-out、port-out-pending、requirement-info-pending、requirement-info-under-review、requirement-info-exception、provision-pending)、(布尔值)、(字符串数组)、(字符串)
billing_group_idcall_forwarding_enabledcall_recording_enabledcaller_id_name_enabledcnam_listing_enabledconnection_idconnection_namecountry_iso_alpha2created_atcustomer_referencedeletion_lock_enabledemergency_address_idemergency_enabledemergency_statusexternal_pinhd_voice_enabledidinbound_call_screeningmessaging_profile_idmessaging_profile_namephone_numberphone_number_typepurchased_atrecord_typesource_typestatust38_fax_gateway_enabledtagsupdated_atDelete a phone number
删除单条电话号码
DELETE /phone_numbers/{id}ruby
phone_number = client.phone_numbers.delete("1293384261075731499")
puts(phone_number)Returns: (string), (boolean), (boolean), (boolean), (boolean), (string), (string), (string), (string), (boolean), (string), (boolean), (string), (boolean), (string), (string), (string), (string), (enum: local, toll_free, mobile, national, shared_cost, landline), (string), (string), (enum: purchase-pending, purchase-failed, port-pending, port-failed, active, deleted, emergency-only, ported-out, port-out-pending), (boolean), (array[string]), (string)
billing_group_idcall_forwarding_enabledcall_recording_enabledcaller_id_name_enabledcnam_listing_enabledconnection_idconnection_namecreated_atcustomer_referencedeletion_lock_enabledemergency_address_idemergency_enabledexternal_pinhd_voice_enabledidmessaging_profile_idmessaging_profile_namephone_numberphone_number_typepurchased_atrecord_typestatust38_fax_gateway_enabledtagsupdated_atDELETE /phone_numbers/{id}ruby
phone_number = client.phone_numbers.delete("1293384261075731499")
puts(phone_number)返回参数:(字符串)、(布尔值)、(布尔值)、(布尔值)、(布尔值)、(字符串)、(字符串)、(字符串)、(字符串)、(布尔值)、(字符串)、(布尔值)、(字符串)、(布尔值)、(字符串)、(字符串)、(字符串)、(字符串)、(枚举值:local、toll_free、mobile、national、shared_cost、landline)、(字符串)、(字符串)、(枚举值:purchase-pending、purchase-failed、port-pending、port-failed、active、deleted、emergency-only、ported-out、port-out-pending)、(布尔值)、(字符串数组)、(字符串)
billing_group_idcall_forwarding_enabledcall_recording_enabledcaller_id_name_enabledcnam_listing_enabledconnection_idconnection_namecreated_atcustomer_referencedeletion_lock_enabledemergency_address_idemergency_enabledexternal_pinhd_voice_enabledidmessaging_profile_idmessaging_profile_namephone_numberphone_number_typepurchased_atrecord_typestatust38_fax_gateway_enabledtagsupdated_atChange the bundle status for a phone number (set to being in a bundle or remove from a bundle)
变更电话号码的套餐状态(加入套餐或移出套餐)
PATCH /phone_numbers/{id}/actions/bundle_status_changebundle_idruby
response = client.phone_numbers.actions.change_bundle_status(
"1293384261075731499",
bundle_id: "5194d8fc-87e6-4188-baa9-1c434bbe861b"
)
puts(response)Returns: (object), (object), (object), (string), (string), (object), (string), (enum: disabled, reject_calls, flag_calls), (object), (string), (string), (boolean), (string), (enum: pay-per-minute, channel)
call_forwardingcall_recordingcnam_listingconnection_idcustomer_referenceemergencyidinbound_call_screeningmedia_featuresphone_numberrecord_typetech_prefix_enabledtranslated_numberusage_payment_methodPATCH /phone_numbers/{id}/actions/bundle_status_changebundle_idruby
response = client.phone_numbers.actions.change_bundle_status(
"1293384261075731499",
bundle_id: "5194d8fc-87e6-4188-baa9-1c434bbe861b"
)
puts(response)返回参数:(对象)、(对象)、(对象)、(字符串)、(字符串)、(对象)、(字符串)、(枚举值:disabled、reject_calls、flag_calls)、(对象)、(字符串)、(字符串)、(布尔值)、(字符串)、(枚举值:pay-per-minute、channel)
call_forwardingcall_recordingcnam_listingconnection_idcustomer_referenceemergencyidinbound_call_screeningmedia_featuresphone_numberrecord_typetech_prefix_enabledtranslated_numberusage_payment_methodEnable emergency for a phone number
启用电话号码的紧急服务
POST /phone_numbers/{id}/actions/enable_emergencyemergency_enabledemergency_address_idruby
response = client.phone_numbers.actions.enable_emergency(
"1293384261075731499",
emergency_address_id: "53829456729313",
emergency_enabled: true
)
puts(response)Returns: (object), (object), (object), (string), (string), (object), (string), (enum: disabled, reject_calls, flag_calls), (object), (string), (string), (boolean), (string), (enum: pay-per-minute, channel)
call_forwardingcall_recordingcnam_listingconnection_idcustomer_referenceemergencyidinbound_call_screeningmedia_featuresphone_numberrecord_typetech_prefix_enabledtranslated_numberusage_payment_methodPOST /phone_numbers/{id}/actions/enable_emergencyemergency_enabledemergency_address_idruby
response = client.phone_numbers.actions.enable_emergency(
"1293384261075731499",
emergency_address_id: "53829456729313",
emergency_enabled: true
)
puts(response)返回参数:(对象)、(对象)、(对象)、(字符串)、(字符串)、(对象)、(字符串)、(枚举值:disabled、reject_calls、flag_calls)、(对象)、(字符串)、(字符串)、(布尔值)、(字符串)、(枚举值:pay-per-minute、channel)
call_forwardingcall_recordingcnam_listingconnection_idcustomer_referenceemergencyidinbound_call_screeningmedia_featuresphone_numberrecord_typetech_prefix_enabledtranslated_numberusage_payment_methodRetrieve a phone number with messaging settings
查询单条带消息配置的电话号码
GET /phone_numbers/{id}/messagingruby
messaging = client.phone_numbers.messaging.retrieve("550e8400-e29b-41d4-a716-446655440000")
puts(messaging)Returns: (string), (date-time), (array[string]), (object), (object), (string), (string), (string | null), (string), (string), (enum: messaging_phone_number, messaging_settings), (array[string]), (string), (enum: long-code, toll-free, short-code, longcode, tollfree, shortcode), (date-time)
country_codecreated_ateligible_messaging_productsfeatureshealthidmessaging_productmessaging_profile_idorganization_idphone_numberrecord_typetagstraffic_typetypeupdated_atGET /phone_numbers/{id}/messagingruby
messaging = client.phone_numbers.messaging.retrieve("550e8400-e29b-41d4-a716-446655440000")
puts(messaging)返回参数:(字符串)、(日期时间)、(字符串数组)、(对象)、(对象)、(字符串)、(字符串)、(字符串 / 空)、(字符串)、(字符串)、(枚举值:messaging_phone_number、messaging_settings)、(字符串数组)、(字符串)、(枚举值:long-code、toll-free、short-code、longcode、tollfree、shortcode)、(日期时间)
country_codecreated_ateligible_messaging_productsfeatureshealthidmessaging_productmessaging_profile_idorganization_idphone_numberrecord_typetagstraffic_typetypeupdated_atUpdate the messaging profile and/or messaging product of a phone number
更新电话号码的消息配置和/或消息产品
PATCH /phone_numbers/{id}/messagingOptional: (string), (string), (array[string])
messaging_productmessaging_profile_idtagsruby
messaging = client.phone_numbers.messaging.update("550e8400-e29b-41d4-a716-446655440000")
puts(messaging)Returns: (string), (date-time), (array[string]), (object), (object), (string), (string), (string | null), (string), (string), (enum: messaging_phone_number, messaging_settings), (array[string]), (string), (enum: long-code, toll-free, short-code, longcode, tollfree, shortcode), (date-time)
country_codecreated_ateligible_messaging_productsfeatureshealthidmessaging_productmessaging_profile_idorganization_idphone_numberrecord_typetagstraffic_typetypeupdated_atPATCH /phone_numbers/{id}/messaging可选参数:(字符串)、(字符串)、(字符串数组)
messaging_productmessaging_profile_idtagsruby
messaging = client.phone_numbers.messaging.update("550e8400-e29b-41d4-a716-446655440000")
puts(messaging)返回参数:(字符串)、(日期时间)、(字符串数组)、(对象)、(对象)、(字符串)、(字符串)、(字符串 / 空)、(字符串)、(字符串)、(枚举值:messaging_phone_number、messaging_settings)、(字符串数组)、(字符串)、(枚举值:long-code、toll-free、short-code、longcode、tollfree、shortcode)、(日期时间)
country_codecreated_ateligible_messaging_productsfeatureshealthidmessaging_productmessaging_profile_idorganization_idphone_numberrecord_typetagstraffic_typetypeupdated_atRetrieve a phone number with voice settings
查询单条带语音配置的电话号码
GET /phone_numbers/{id}/voiceruby
voice = client.phone_numbers.voice.retrieve("1293384261075731499")
puts(voice)Returns: (object), (object), (object), (string), (string), (object), (string), (enum: disabled, reject_calls, flag_calls), (object), (string), (string), (boolean), (string), (enum: pay-per-minute, channel)
call_forwardingcall_recordingcnam_listingconnection_idcustomer_referenceemergencyidinbound_call_screeningmedia_featuresphone_numberrecord_typetech_prefix_enabledtranslated_numberusage_payment_methodGET /phone_numbers/{id}/voiceruby
voice = client.phone_numbers.voice.retrieve("1293384261075731499")
puts(voice)返回参数:(对象)、(对象)、(对象)、(字符串)、(字符串)、(对象)、(字符串)、(枚举值:disabled、reject_calls、flag_calls)、(对象)、(字符串)、(字符串)、(布尔值)、(字符串)、(枚举值:pay-per-minute、channel)
call_forwardingcall_recordingcnam_listingconnection_idcustomer_referenceemergencyidinbound_call_screeningmedia_featuresphone_numberrecord_typetech_prefix_enabledtranslated_numberusage_payment_methodUpdate a phone number with voice settings
更新电话号码的语音配置
PATCH /phone_numbers/{id}/voiceOptional: (object), (object), (boolean), (object), (enum: disabled, reject_calls, flag_calls), (object), (boolean), (string), (enum: pay-per-minute, channel)
call_forwardingcall_recordingcaller_id_name_enabledcnam_listinginbound_call_screeningmedia_featurestech_prefix_enabledtranslated_numberusage_payment_methodruby
voice = client.phone_numbers.voice.update("1293384261075731499")
puts(voice)Returns: (object), (object), (object), (string), (string), (object), (string), (enum: disabled, reject_calls, flag_calls), (object), (string), (string), (boolean), (string), (enum: pay-per-minute, channel)
call_forwardingcall_recordingcnam_listingconnection_idcustomer_referenceemergencyidinbound_call_screeningmedia_featuresphone_numberrecord_typetech_prefix_enabledtranslated_numberusage_payment_methodPATCH /phone_numbers/{id}/voice可选参数:(对象)、(对象)、(布尔值)、(对象)、(枚举值:disabled、reject_calls、flag_calls)、(对象)、(布尔值)、(字符串)、(枚举值:pay-per-minute、channel)
call_forwardingcall_recordingcaller_id_name_enabledcnam_listinginbound_call_screeningmedia_featurestech_prefix_enabledtranslated_numberusage_payment_methodruby
voice = client.phone_numbers.voice.update("1293384261075731499")
puts(voice)返回参数:(对象)、(对象)、(对象)、(字符串)、(字符串)、(对象)、(字符串)、(枚举值:disabled、reject_calls、flag_calls)、(对象)、(字符串)、(字符串)、(布尔值)、(字符串)、(枚举值:pay-per-minute、channel)
call_forwardingcall_recordingcnam_listingconnection_idcustomer_referenceemergencyidinbound_call_screeningmedia_featuresphone_numberrecord_typetech_prefix_enabledtranslated_numberusage_payment_methodList Mobile Phone Numbers
查询手机号码列表
GET /v2/mobile_phone_numbersruby
page = client.mobile_phone_numbers.list
puts(page)Returns: (object), (object), (boolean), (object), (string | null), (string | null), (string | null), (string), (date-time), (string | null), (string), (object), (enum: disabled, reject_calls, flag_calls), (boolean), (enum: inbound, outbound, both, disabled), (object), (string), (string), (uuid), (string), (array[string]), (date-time)
call_forwardingcall_recordingcaller_id_name_enabledcnam_listingconnection_idconnection_nameconnection_typecountry_iso_alpha2created_atcustomer_referenceidinboundinbound_call_screeningmobile_voice_enablednoise_suppressionoutboundphone_numberrecord_typesim_card_idstatustagsupdated_atGET /v2/mobile_phone_numbersruby
page = client.mobile_phone_numbers.list
puts(page)返回参数:(对象)、(对象)、(布尔值)、(对象)、(字符串 / 空)、(字符串 / 空)、(字符串 / 空)、(字符串)、(日期时间)、(字符串 / 空)、(字符串)、(对象)、(枚举值:disabled、reject_calls、flag_calls)、(布尔值)、(枚举值:inbound、outbound、both、disabled)、(对象)、(字符串)、(字符串)、(UUID)、(字符串)、(字符串数组)、(日期时间)
call_forwardingcall_recordingcaller_id_name_enabledcnam_listingconnection_idconnection_nameconnection_typecountry_iso_alpha2created_atcustomer_referenceidinboundinbound_call_screeningmobile_voice_enablednoise_suppressionoutboundphone_numberrecord_typesim_card_idstatustagsupdated_atRetrieve a Mobile Phone Number
查询单条手机号码
GET /v2/mobile_phone_numbers/{id}ruby
mobile_phone_number = client.mobile_phone_numbers.retrieve("550e8400-e29b-41d4-a716-446655440000")
puts(mobile_phone_number)Returns: (object), (object), (boolean), (object), (string | null), (string | null), (string | null), (string), (date-time), (string | null), (string), (object), (enum: disabled, reject_calls, flag_calls), (boolean), (enum: inbound, outbound, both, disabled), (object), (string), (string), (uuid), (string), (array[string]), (date-time)
call_forwardingcall_recordingcaller_id_name_enabledcnam_listingconnection_idconnection_nameconnection_typecountry_iso_alpha2created_atcustomer_referenceidinboundinbound_call_screeningmobile_voice_enablednoise_suppressionoutboundphone_numberrecord_typesim_card_idstatustagsupdated_atGET /v2/mobile_phone_numbers/{id}ruby
mobile_phone_number = client.mobile_phone_numbers.retrieve("550e8400-e29b-41d4-a716-446655440000")
puts(mobile_phone_number)返回参数:(对象)、(对象)、(布尔值)、(对象)、(字符串 / 空)、(字符串 / 空)、(字符串 / 空)、(字符串)、(日期时间)、(字符串 / 空)、(字符串)、(对象)、(枚举值:disabled、reject_calls、flag_calls)、(布尔值)、(枚举值:inbound、outbound、both、disabled)、(对象)、(字符串)、(字符串)、(UUID)、(字符串)、(字符串数组)、(日期时间)
call_forwardingcall_recordingcaller_id_name_enabledcnam_listingconnection_idconnection_nameconnection_typecountry_iso_alpha2created_atcustomer_referenceidinboundinbound_call_screeningmobile_voice_enablednoise_suppressionoutboundphone_numberrecord_typesim_card_idstatustagsupdated_atUpdate a Mobile Phone Number
更新单条手机号码
PATCH /v2/mobile_phone_numbers/{id}Optional: (object), (object), (boolean), (object), (string | null), (string | null), (object), (enum: disabled, reject_calls, flag_calls), (boolean), (object), (array[string])
call_forwardingcall_recordingcaller_id_name_enabledcnam_listingconnection_idcustomer_referenceinboundinbound_call_screeningnoise_suppressionoutboundtagsruby
mobile_phone_number = client.mobile_phone_numbers.update("550e8400-e29b-41d4-a716-446655440000")
puts(mobile_phone_number)Returns: (object), (object), (boolean), (object), (string | null), (string | null), (string | null), (string), (date-time), (string | null), (string), (object), (enum: disabled, reject_calls, flag_calls), (boolean), (enum: inbound, outbound, both, disabled), (object), (string), (string), (uuid), (string), (array[string]), (date-time)
call_forwardingcall_recordingcaller_id_name_enabledcnam_listingconnection_idconnection_nameconnection_typecountry_iso_alpha2created_atcustomer_referenceidinboundinbound_call_screeningmobile_voice_enablednoise_suppressionoutboundphone_numberrecord_typesim_card_idstatustagsupdated_atPATCH /v2/mobile_phone_numbers/{id}可选参数:(对象)、(对象)、(布尔值)、(对象)、(字符串 / 空)、(字符串 / 空)、(对象)、(枚举值:disabled、reject_calls、flag_calls)、(布尔值)、(对象)、(字符串数组)
call_forwardingcall_recordingcaller_id_name_enabledcnam_listingconnection_idcustomer_referenceinboundinbound_call_screeningnoise_suppressionoutboundtagsruby
mobile_phone_number = client.mobile_phone_numbers.update("550e8400-e29b-41d4-a716-446655440000")
puts(mobile_phone_number)返回参数:(对象)、(对象)、(布尔值)、(对象)、(字符串 / 空)、(字符串 / 空)、(字符串 / 空)、(字符串)、(日期时间)、(字符串 / 空)、(字符串)、(对象)、(枚举值:disabled、reject_calls、flag_calls)、(布尔值)、(枚举值:inbound、outbound、both、disabled)、(对象)、(字符串)、(字符串)、(UUID)、(字符串)、(字符串数组)、(日期时间)
call_forwardingcall_recordingcaller_id_name_enabledcnam_listingconnection_idconnection_nameconnection_typecountry_iso_alpha2created_atcustomer_referenceidinboundinbound_call_screeningmobile_voice_enablednoise_suppressionoutboundphone_numberrecord_typesim_card_idstatustagsupdated_at