//native
type Telnyx = {
apiKey: string
}
/**
* Create an FQDN connection
* Creates a FQDN connection.
*/
export async function main(
auth: Telnyx,
body: {
active?: false | true
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
transport_protocol?: 'UDP' | 'TCP' | 'TLS'
default_on_hold_comfort_noise_enabled?: false | true
dtmf_type?: 'RFC 2833' | 'Inband' | 'SIP INFO'
encode_contact_header_enabled?: false | true
encrypted_media?: 'SRTP'
microsoft_teams_sbc?: false | true
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[]
default_routing_method?: 'sequential' | 'round-robin'
default_primary_fqdn_id?: string
default_secondary_fqdn_id?: string
default_tertiary_fqdn_id?: 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
sip_region?: 'US' | 'Europe' | 'Australia'
sip_subdomain?: string
sip_subdomain_receive_settings?: 'only_my_connections' | 'from_anyone'
timeout_1xx_secs?: number
timeout_2xx_secs?: number
shaken_stir_enabled?: false | true
}
outbound?: {
ani_override?: string
ani_override_type?: 'always' | 'normal' | 'emergency'
call_parking_enabled?: false | true
channel_limit?: number
generate_ringback_tone?: false | true
instant_ringback_enabled?: false | true
ip_authentication_method?: 'credential-authentication' | 'ip-authentication'
ip_authentication_apiKey?: string
localization?: string
outbound_voice_profile_id?: string
t38_reinvite_source?:
| 'telnyx'
| 'customer'
| 'disabled'
| 'passthru'
| 'caller-passthru'
| 'callee-passthru'
tech_prefix?: string
encrypted_media?: 'SRTP'
timeout_1xx_secs?: number
timeout_2xx_secs?: number
}
}
) {
const url = new URL(`https://api.telnyx.com/v2/fqdn_connections`)
const response = await fetch(url, {
method: 'POST',
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