//native
type Telnyx = {
apiKey: string
}
/**
* Updates an existing outbound voice profile.
* Updates an existing outbound voice profile.
*/
export async function main(
auth: Telnyx,
id: string,
body: {
name: string
traffic_type?: 'conversational'
service_plan?: 'global'
concurrent_call_limit?: number
enabled?: false | true
tags?: string[]
usage_payment_method?: 'rate-deck'
whitelisted_destinations?: string[]
max_destination_rate?: number
daily_spend_limit?: string
daily_spend_limit_enabled?: false | true
call_recording?: {
call_recording_type?: 'all' | 'none' | 'by_caller_phone_number'
call_recording_caller_phone_numbers?: string[]
call_recording_channels?: 'single' | 'dual'
call_recording_format?: 'wav' | 'mp3'
}
billing_group_id?: string
}
) {
const url = new URL(`https://api.telnyx.com/v2/outbound_voice_profiles/${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