//native
type Telnyx = {
apiKey: string
}
/**
* Update a call control application
* Updates settings of an existing call control application.
*/
export async function main(
auth: Telnyx,
id: string,
body: {
application_name: string
webhook_event_url: string
active?: false | true
anchorsite_override?: '"Latency"' | '"Chicago, IL"' | '"Ashburn, VA"' | '"San Jose, CA"'
dtmf_type?: 'RFC 2833' | 'Inband' | 'SIP INFO'
first_command_timeout?: false | true
first_command_timeout_secs?: number
inbound?: {
channel_limit?: number
shaken_stir_enabled?: false | true
sip_subdomain?: string
sip_subdomain_receive_settings?: 'only_my_connections' | 'from_anyone'
}
outbound?: { channel_limit?: number; outbound_voice_profile_id?: string }
webhook_api_version?: '1' | '2'
webhook_event_failover_url?: string
webhook_timeout_secs?: number
}
) {
const url = new URL(`https://api.telnyx.com/v2/call_control_applications/${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