//native
type Telnyx = {
apiKey: string
}
/**
* Update a credential connection
* Updates settings of an existing credential connection.
*/
export async function main(
auth: Telnyx,
id: string,
body: {
active?: false | true
user_name?: string
password?: string
anchorsite_override?:
| 'Latency'
| 'Chicago, IL'
| 'Ashburn, VA'
| 'San Jose, CA'
| 'Sydney, Australia'
| 'Amsterdam, Netherlands'
| 'London, UK'
| 'Toronto, Canada'
| 'Vancouver, Canada'
| 'Frankfurt, Germany'
connection_name?: string
sip_uri_calling_preference?: 'disabled' | 'unrestricted' | 'internal'
default_on_hold_comfort_noise_enabled?: false | true
dtmf_type?: 'RFC 2833' | 'Inband' | 'SIP INFO'
encode_contact_header_enabled?: false | true
encrypted_media?: 'SRTP'
onnet_t38_passthrough_enabled?: false | true
ios_push_credential_id?: string
android_push_credential_id?: string
webhook_event_url?: string
webhook_event_failover_url?: string
webhook_api_version?: '1' | '2'
webhook_timeout_secs?: number
rtcp_settings?: {
port?: 'rtcp-mux' | 'rtp+1'
capture_enabled?: false | true
report_frequency_secs?: number
}
inbound?: {
ani_number_format?: '+E.164' | 'E.164' | '+E.164-national' | 'E.164-national'
dnis_number_format?: '+e164' | 'e164' | 'national' | 'sip_username'
codecs?: string[]
channel_limit?: number
generate_ringback_tone?: false | true
isup_headers_enabled?: false | true
prack_enabled?: false | true
privacy_zone_enabled?: false | true
sip_compact_headers_enabled?: false | true
timeout_1xx_secs?: number
timeout_2xx_secs?: string
shaken_stir_enabled?: false | true
}
outbound?: {
call_parking_enabled?: false | true
ani_override?: string
ani_override_type?: 'always' | 'normal' | 'emergency'
channel_limit?: number
instant_ringback_enabled?: false | true
generate_ringback_tone?: false | true
localization?: string
t38_reinvite_source?:
| 'disabled'
| 'telnyx'
| 'customer'
| 'passthru'
| 'caller-passthru'
| 'callee-passthru'
outbound_voice_profile_id?: string
}
}
) {
const url = new URL(`https://api.telnyx.com/v2/credential_connections/${id}`)
const response = await fetch(url, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 428 days ago