Update a phone number with voice settings
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const voice = await client.phoneNumbers.voice.update('1293384261075731499');
console.log(voice.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
voice = client.phone_numbers.voice.update(
id="1293384261075731499",
)
print(voice.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
voice, err := client.PhoneNumbers.Voice.Update(
context.TODO(),
"1293384261075731499",
telnyx.PhoneNumberVoiceUpdateParams{
UpdateVoiceSettings: telnyx.UpdateVoiceSettingsParam{},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", voice.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.phonenumbers.voice.UpdateVoiceSettings;
import com.telnyx.sdk.models.phonenumbers.voice.VoiceUpdateParams;
import com.telnyx.sdk.models.phonenumbers.voice.VoiceUpdateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
VoiceUpdateParams params = VoiceUpdateParams.builder()
.id("1293384261075731499")
.updateVoiceSettings(UpdateVoiceSettings.builder().build())
.build();
VoiceUpdateResponse voice = client.phoneNumbers().voice().update(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
voice = telnyx.phone_numbers.voice.update("1293384261075731499")
puts(voice)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$voice = $client->phoneNumbers->voice->update(
'1293384261075731499',
callForwarding: [
'callForwardingEnabled' => true,
'forwardingType' => 'always',
'forwardsTo' => '+13035559123',
],
callRecording: [
'inboundCallRecordingChannels' => 'single',
'inboundCallRecordingEnabled' => true,
'inboundCallRecordingFormat' => 'wav',
],
callerIDNameEnabled: true,
cnamListing: [
'cnamListingDetails' => 'example', 'cnamListingEnabled' => true
],
inboundCallScreening: 'disabled',
mediaFeatures: [
'acceptAnyRtpPacketsEnabled' => true,
'rtpAutoAdjustEnabled' => true,
't38FaxGatewayEnabled' => true,
],
techPrefixEnabled: true,
translatedNumber: '+13035559999',
usagePaymentMethod: 'pay-per-minute',
);
var_dump($voice);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx phone-numbers:voice update \
--api-key 'My API Key' \
--id 1293384261075731499curl --request PATCH \
--url https://api.telnyx.com/v2/phone_numbers/{id}/voice \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tech_prefix_enabled": true,
"translated_number": "+13035559999",
"caller_id_name_enabled": true,
"call_forwarding": {
"call_forwarding_enabled": true,
"forwards_to": "+13035559123",
"forwarding_type": "always"
},
"cnam_listing": {
"cnam_listing_enabled": true,
"cnam_listing_details": "example"
},
"usage_payment_method": "pay-per-minute",
"media_features": {
"rtp_auto_adjust_enabled": true,
"accept_any_rtp_packets_enabled": true,
"t38_fax_gateway_enabled": true
},
"call_recording": {
"inbound_call_recording_enabled": true,
"inbound_call_recording_format": "wav",
"inbound_call_recording_channels": "single"
},
"inbound_call_screening": "disabled"
}
'{
"data": {
"id": "1293384261075731499",
"record_type": "voice_settings",
"connection_id": "1d0e6cb8-8668-462e-94c6-49ae0f0ed48b",
"customer_reference": "customer-reference",
"tech_prefix_enabled": false,
"translated_number": "+13035559999",
"call_forwarding": {
"call_forwarding_enabled": true,
"forwards_to": "+13035559123",
"forwarding_type": "always"
},
"cnam_listing": {
"cnam_listing_enabled": true,
"cnam_listing_details": "example"
},
"emergency": {
"emergency_enabled": true,
"emergency_address_id": "1315261609962112019",
"emergency_status": "active"
},
"usage_payment_method": "pay-per-minute",
"media_features": {
"rtp_auto_adjust_enabled": true,
"accept_any_rtp_packets_enabled": true,
"t38_fax_gateway_enabled": true
},
"call_recording": {
"inbound_call_recording_enabled": true,
"inbound_call_recording_format": "wav",
"inbound_call_recording_channels": "single"
},
"inbound_call_screening": "disabled"
}
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "Could not understand the provided credentials.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Identifies the resource.
"1293384261075731499"
Body
Updated voice settings for the phone number.
Controls whether a tech prefix is enabled for this phone number.
This field allows you to rewrite the destination number of an inbound call before the call is routed to you. The value of this field may be any alphanumeric value, and the value will replace the number originally dialed.
Controls whether the caller ID name is enabled for this phone number.
The call forwarding settings for a phone number.
Show child attributes
Show child attributes
{
"call_forwarding_enabled": true,
"forwards_to": "+13035559123",
"forwarding_type": "always"
}
The CNAM listing settings for a phone number.
Show child attributes
Show child attributes
{
"cnam_listing_enabled": true,
"cnam_listing_details": "example"
}
Controls whether a number is billed per minute or uses your concurrent channels.
pay-per-minute, channel The media features settings for a phone number.
Show child attributes
Show child attributes
{
"rtp_auto_adjust_enabled": true,
"accept_any_rtp_packets_enabled": true,
"t38_fax_gateway_enabled": true
}
The call recording settings for a phone number.
Show child attributes
Show child attributes
{
"inbound_call_recording_enabled": true,
"inbound_call_recording_format": "wav",
"inbound_call_recording_channels": "single"
}
The inbound_call_screening setting is a phone number configuration option variable that allows users to configure their settings to block or flag fraudulent calls. It can be set to disabled, reject_calls, or flag_calls. This feature has an additional per-number monthly cost associated with it.
disabled, reject_calls, flag_calls Response
Successful response with details about a phone number including voice settings.
Show child attributes
Show child attributes
{
"id": "1293384261075731499",
"record_type": "voice_settings",
"connection_id": "1d0e6cb8-8668-462e-94c6-49ae0f0ed48b",
"customer_reference": "customer-reference",
"tech_prefix_enabled": false,
"translated_number": "+13035559999",
"call_forwarding": {
"call_forwarding_enabled": true,
"forwards_to": "+13035559123",
"forwarding_type": "always"
},
"cnam_listing": {
"cnam_listing_enabled": true,
"cnam_listing_details": "example"
},
"emergency": {
"emergency_enabled": true,
"emergency_address_id": "1315261609962112019",
"emergency_status": "active"
},
"usage_payment_method": "pay-per-minute",
"media_features": {
"rtp_auto_adjust_enabled": true,
"accept_any_rtp_packets_enabled": true,
"t38_fax_gateway_enabled": true
},
"call_recording": {
"inbound_call_recording_enabled": true,
"inbound_call_recording_format": "wav",
"inbound_call_recording_channels": "single"
},
"inbound_call_screening": "disabled"
}
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const voice = await client.phoneNumbers.voice.update('1293384261075731499');
console.log(voice.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
voice = client.phone_numbers.voice.update(
id="1293384261075731499",
)
print(voice.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
voice, err := client.PhoneNumbers.Voice.Update(
context.TODO(),
"1293384261075731499",
telnyx.PhoneNumberVoiceUpdateParams{
UpdateVoiceSettings: telnyx.UpdateVoiceSettingsParam{},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", voice.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.phonenumbers.voice.UpdateVoiceSettings;
import com.telnyx.sdk.models.phonenumbers.voice.VoiceUpdateParams;
import com.telnyx.sdk.models.phonenumbers.voice.VoiceUpdateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
VoiceUpdateParams params = VoiceUpdateParams.builder()
.id("1293384261075731499")
.updateVoiceSettings(UpdateVoiceSettings.builder().build())
.build();
VoiceUpdateResponse voice = client.phoneNumbers().voice().update(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
voice = telnyx.phone_numbers.voice.update("1293384261075731499")
puts(voice)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$voice = $client->phoneNumbers->voice->update(
'1293384261075731499',
callForwarding: [
'callForwardingEnabled' => true,
'forwardingType' => 'always',
'forwardsTo' => '+13035559123',
],
callRecording: [
'inboundCallRecordingChannels' => 'single',
'inboundCallRecordingEnabled' => true,
'inboundCallRecordingFormat' => 'wav',
],
callerIDNameEnabled: true,
cnamListing: [
'cnamListingDetails' => 'example', 'cnamListingEnabled' => true
],
inboundCallScreening: 'disabled',
mediaFeatures: [
'acceptAnyRtpPacketsEnabled' => true,
'rtpAutoAdjustEnabled' => true,
't38FaxGatewayEnabled' => true,
],
techPrefixEnabled: true,
translatedNumber: '+13035559999',
usagePaymentMethod: 'pay-per-minute',
);
var_dump($voice);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx phone-numbers:voice update \
--api-key 'My API Key' \
--id 1293384261075731499curl --request PATCH \
--url https://api.telnyx.com/v2/phone_numbers/{id}/voice \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tech_prefix_enabled": true,
"translated_number": "+13035559999",
"caller_id_name_enabled": true,
"call_forwarding": {
"call_forwarding_enabled": true,
"forwards_to": "+13035559123",
"forwarding_type": "always"
},
"cnam_listing": {
"cnam_listing_enabled": true,
"cnam_listing_details": "example"
},
"usage_payment_method": "pay-per-minute",
"media_features": {
"rtp_auto_adjust_enabled": true,
"accept_any_rtp_packets_enabled": true,
"t38_fax_gateway_enabled": true
},
"call_recording": {
"inbound_call_recording_enabled": true,
"inbound_call_recording_format": "wav",
"inbound_call_recording_channels": "single"
},
"inbound_call_screening": "disabled"
}
'{
"data": {
"id": "1293384261075731499",
"record_type": "voice_settings",
"connection_id": "1d0e6cb8-8668-462e-94c6-49ae0f0ed48b",
"customer_reference": "customer-reference",
"tech_prefix_enabled": false,
"translated_number": "+13035559999",
"call_forwarding": {
"call_forwarding_enabled": true,
"forwards_to": "+13035559123",
"forwarding_type": "always"
},
"cnam_listing": {
"cnam_listing_enabled": true,
"cnam_listing_details": "example"
},
"emergency": {
"emergency_enabled": true,
"emergency_address_id": "1315261609962112019",
"emergency_status": "active"
},
"usage_payment_method": "pay-per-minute",
"media_features": {
"rtp_auto_adjust_enabled": true,
"accept_any_rtp_packets_enabled": true,
"t38_fax_gateway_enabled": true
},
"call_recording": {
"inbound_call_recording_enabled": true,
"inbound_call_recording_format": "wav",
"inbound_call_recording_channels": "single"
},
"inbound_call_screening": "disabled"
}
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "Could not understand the provided credentials.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}