Optional anonymous_anonymous_login login options
The target ID to use for the anonymous login. this is typically the ID of the AI assistant you want to connect to.
Optional target_Optional parameters to pass to the target. These are forwarded to voice-sdk-proxy and mapped to custom headers on the SIP INVITE.
A string indicating the target type, for now only ai_assistant is supported.
Optional target_The target version ID to use for the anonymous login. This is optional and can be used to specify a particular version of the AI assistant.
Optional callInterval in milliseconds for collecting call statistics. Stats are aggregated over each interval and stored locally until call end.
5000 (5 seconds)
Optional debugEnable debug mode for this client. This will gather WebRTC debugging information.
Optional debugDebug output option
Optional enableEnable automatic call quality reporting to voice-sdk-proxy. When enabled, WebRTC stats are collected periodically during calls and posted to the voice-sdk-proxy /call_report endpoint when the call ends.
true
Optional envEnvironment to use for the connection. So far this property is only for internal purposes.
Optional forceForce the use of a relay ICE candidate.
Optional iceICE Servers to use for all calls within the client connection. Overrides the default ones.
Optional keepBy passing keepConnectionAliveOnSocketClose as true, the SDK will attempt to keep Peer connection alive
when the WebSocket connection is closed unexpectedly (e.g. network interruption, device sleep, etc).
Optional loginThe username to authenticate with your SIP Connection.
login and password will take precedence over
login_token for authentication.
Optional login_The JSON Web Token (JWT) to authenticate with your SIP Connection. This is the recommended authentication strategy. See how to create one.
Optional mediaConfiguration for media permissions recovery on inbound calls.
When enabled and the initial getUserMedia call fails while answering,
the SDK emits a recoverable telnyx.error event with resume() and
reject() callbacks so the app can prompt the user to fix permissions
before the call fails.
Recovery is attempted only for inbound calls. If the app calls
resume(), the SDK retries getUserMedia. If the app calls reject()
or does not respond before timeout, recovery fails and the call is
terminated with the usual media error flow.
Enable the recovery flow.
Optional onCalled when retry fails, the timeout expires, or the app calls reject().
Optional onCalled when the retry getUserMedia succeeds after resume().
Maximum time in ms to wait for the app to call resume() or reject(). Recommended max 25000.
import {isMediaRecoveryErrorEvent} from "@telnyx/webrtc"
const client = new TelnyxRTC({
login_token: '...',
mediaPermissionsRecovery: {
enabled: true,
timeout: 20000,
onSuccess: () => console.log('Media recovered'),
onError: (err) => console.error('Recovery failed', err),
},
});
client.on('telnyx.error', (event) => {
if (isMediaRecoveryErrorEvent(event)) {
showPermissionDialog({
onContinue: () => event.resume(),
onCancel: () => event.reject?.(),
});
}
});
Optional mutedDisabled microphone by default when the call starts or adding a new audio source.
Optional passwordThe password to authenticate with your SIP Connection.
Optional prefetchEnable or disable prefetching ICE candidates. Defaults to true.
Optional regionRegion to use for the connection.
Optional ringbackA URL to a wav/mp3 ringback file that will be used when you disable "Generate Ringback Tone" in your SIP Connection.
Optional ringtoneA URL to a wav/mp3 ringtone file.
Optional rtcRTC connection IP address to use instead of the default one. Useful when using a custom signaling server.
Optional rtcRTC connection port to use instead of the default one. Useful when using a custom signaling server.
Optional skipWhen reconnecting with a stored voice_sdk_id, append
?skip_last_voice_sdk_id=true to the WebSocket URL so VSP routes
the connection to a different b2bua-rtc instance instead of sticky-
reconnecting to the same one. Useful when retrying after errors
caused by stale state on a specific b2bua-rtc node.
false
Optional trickleEnable or disable Trickle ICE.
Optional useUse Telnyx's Canary RTC server
IClientOptions IClientOptions