telnyx-mcp 6.56.0 → 6.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11164,38 +11164,38 @@ const EMBEDDED_METHODS = [
11164
11164
  "webhook_urls_method?: 'POST' | 'GET';",
11165
11165
  ],
11166
11166
  response: "{ data?: { call_control_id: string; call_leg_id: string; call_session_id: string; is_alive: boolean; record_type: 'call'; call_duration?: number; client_state?: string; end_time?: string; recording_id?: string; start_time?: string; }; }",
11167
- markdown: "## dial\n\n`client.calls.dial(connection_id: string, from: string, to: string | string[], answering_machine_detection?: 'premium' | 'detect' | 'detect_beep' | 'detect_words' | 'greeting_end' | 'disabled', answering_machine_detection_config?: { after_greeting_silence_millis?: number; between_words_silence_millis?: number; greeting_duration_millis?: number; greeting_silence_duration_millis?: number; greeting_total_analysis_time_millis?: number; initial_silence_millis?: number; maximum_number_of_words?: number; maximum_word_length_millis?: number; silence_threshold?: number; total_analysis_time_millis?: number; }, assistant?: { id: string; dynamic_variables?: object; external_llm?: object; fallback_config?: object; greeting?: string; instructions?: string; llm_api_key_ref?: string; mcp_servers?: object[]; model?: string; name?: string; observability_settings?: object; openai_api_key_ref?: string; tools?: book_appointment_tool | check_availability_tool | webhook_tool | hangup_tool | transfer_tool | call_control_retrieval_tool[]; }, audio_url?: string, billing_group_id?: string, bridge_intent?: boolean, bridge_on_answer?: boolean, client_state?: string, command_id?: string, conference_config?: { id?: string; beep_enabled?: 'always' | 'never' | 'on_enter' | 'on_exit'; conference_name?: string; early_media?: boolean; end_conference_on_exit?: boolean; hold?: boolean; hold_audio_url?: string; hold_media_name?: string; mute?: boolean; soft_end_conference_on_exit?: boolean; start_conference_on_create?: boolean; start_conference_on_enter?: boolean; supervisor_role?: 'barge' | 'monitor' | 'none' | 'whisper'; whisper_call_control_ids?: string[]; }, custom_headers?: { name: string; value: string; }[], deepfake_detection?: { enabled: boolean; rtp_timeout?: number; timeout?: number; }, dialogflow_config?: { analyze_sentiment?: boolean; partial_automated_agent_reply?: boolean; }, enable_dialogflow?: boolean, from_display_name?: string, link_to?: string, media_encryption?: 'disabled' | 'SRTP' | 'DTLS', media_name?: string, park_after_unbridge?: string, preferred_codecs?: string, prevent_double_bridge?: boolean, privacy?: 'id' | 'none', record?: 'record-from-answer', record_channels?: 'single' | 'dual', record_custom_file_name?: string, record_format?: 'wav' | 'mp3', record_max_length?: number, record_timeout_secs?: number, record_track?: 'both' | 'inbound' | 'outbound', record_trim?: 'trim-silence', send_silence_when_idle?: boolean, sip_auth_password?: string, sip_auth_username?: string, sip_headers?: { name: 'User-to-User'; value: string; }[], sip_region?: 'US' | 'Europe' | 'Canada' | 'Australia' | 'Middle East', sip_transport_protocol?: 'UDP' | 'TCP' | 'TLS', sound_modifications?: { octaves?: number; pitch?: number; semitone?: number; track?: string; }, stream_auth_token?: string, stream_bidirectional_codec?: 'PCMU' | 'PCMA' | 'G722' | 'OPUS' | 'AMR-WB' | 'L16', stream_bidirectional_mode?: 'mp3' | 'rtp', stream_bidirectional_sampling_rate?: 8000 | 16000 | 22050 | 24000 | 48000, stream_bidirectional_target_legs?: 'both' | 'self' | 'opposite', stream_codec?: 'PCMU' | 'PCMA' | 'G722' | 'OPUS' | 'AMR-WB' | 'L16' | 'default', stream_establish_before_call_originate?: boolean, stream_track?: 'inbound_track' | 'outbound_track' | 'both_tracks', stream_url?: string, supervise_call_control_id?: string, supervisor_role?: 'barge' | 'whisper' | 'monitor', time_limit_secs?: number, timeout_secs?: number, transcription?: boolean, transcription_config?: { client_state?: string; command_id?: string; transcription_engine?: 'Google' | 'Telnyx' | 'Deepgram' | 'Azure' | 'xAI' | 'AssemblyAI' | 'A' | 'B'; transcription_engine_config?: transcription_engine_google_config | transcription_engine_telnyx_config | transcription_engine_azure_config | transcription_engine_xai_config | transcription_engine_assemblyai_config | transcription_engine_a_config | transcription_engine_b_config | deepgram_nova2_config | deepgram_nova3_config; transcription_tracks?: string; }, webhook_retries_policies?: object, webhook_url?: string, webhook_url_method?: 'POST' | 'GET', webhook_urls?: object, webhook_urls_method?: 'POST' | 'GET'): { data?: object; }`\n\n**post** `/calls`\n\nDial a number or SIP URI from a given connection. A successful response will include a `call_leg_id` which can be used to correlate the command with subsequent webhooks.\n\n**Expected Webhooks:**\n\n- `call.initiated`\n- `call.answered` or `call.hangup`\n- `call.hold` and `call.unhold` if the call is held/unheld\n- `call.machine.detection.ended` if `answering_machine_detection` was requested\n- `call.machine.greeting.ended` if `answering_machine_detection` was requested to detect the end of machine greeting\n- `call.machine.premium.detection.ended` if `answering_machine_detection=premium` was requested\n- `call.machine.premium.greeting.ended` if `answering_machine_detection=premium` was requested and a beep was detected\n- `call.deepfake_detection.result` if `deepfake_detection` was enabled\n- `call.deepfake_detection.error` if `deepfake_detection` was enabled and an error occurred\n- `streaming.started`, `streaming.stopped` or `streaming.failed` if `stream_url` was set\n\nWhen the `record` parameter is set to `record-from-answer`, the response will include a `recording_id` field.\n\n\n### Parameters\n\n- `connection_id: string`\n The ID of the Call Control App (formerly ID of the connection) to be used when dialing the destination.\n\n- `from: string`\n The `from` number to be used as the caller id presented to the destination (`to` number). The number should be in +E164 format.\n\n- `to: string | string[]`\n The DID or SIP URI to dial out to. Multiple DID or SIP URIs can be provided using an array of strings\n\n- `answering_machine_detection?: 'premium' | 'detect' | 'detect_beep' | 'detect_words' | 'greeting_end' | 'disabled'`\n Enables Answering Machine Detection. Telnyx offers Premium and Standard detections. With Premium detection, when a call is answered, Telnyx runs real-time detection and sends a `call.machine.premium.detection.ended` webhook with one of the following results: `human_residence`, `human_business`, `machine`, `silence` or `fax_detected`. If we detect a beep, we also send a `call.machine.premium.greeting.ended` webhook with the result of `beep_detected`. If we detect a beep before `call.machine.premium.detection.ended` we only send `call.machine.premium.greeting.ended`, and if we detect a beep after `call.machine.premium.detection.ended`, we send both webhooks. With Standard detection, when a call is answered, Telnyx runs real-time detection to determine if it was picked up by a human or a machine and sends an `call.machine.detection.ended` webhook with the analysis result. If `greeting_end` or `detect_words` is used and a `machine` is detected, you will receive another `call.machine.greeting.ended` webhook when the answering machine greeting ends with a beep or silence. If `detect_beep` is used, you will only receive `call.machine.greeting.ended` if a beep is detected.\n\n- `answering_machine_detection_config?: { after_greeting_silence_millis?: number; between_words_silence_millis?: number; greeting_duration_millis?: number; greeting_silence_duration_millis?: number; greeting_total_analysis_time_millis?: number; initial_silence_millis?: number; maximum_number_of_words?: number; maximum_word_length_millis?: number; silence_threshold?: number; total_analysis_time_millis?: number; }`\n Optional configuration parameters to modify 'answering_machine_detection' performance. Only `total_analysis_time_millis` and `greeting_duration_millis` parameters are applicable when `premium` is selected as answering_machine_detection.\n - `after_greeting_silence_millis?: number`\n Silence duration threshold after a greeting message or voice for it be considered human.\n - `between_words_silence_millis?: number`\n Maximum threshold for silence between words.\n - `greeting_duration_millis?: number`\n Maximum threshold of a human greeting. If greeting longer than this value, considered machine.\n - `greeting_silence_duration_millis?: number`\n If machine already detected, maximum threshold for silence between words. If exceeded, the greeting is considered ended.\n - `greeting_total_analysis_time_millis?: number`\n If machine already detected, maximum timeout threshold to determine the end of the machine greeting.\n - `initial_silence_millis?: number`\n If initial silence duration is greater than this value, consider it a machine.\n - `maximum_number_of_words?: number`\n If number of detected words is greater than this value, consder it a machine.\n - `maximum_word_length_millis?: number`\n If a single word lasts longer than this threshold, consider it a machine.\n - `silence_threshold?: number`\n Minimum noise threshold for any analysis.\n - `total_analysis_time_millis?: number`\n Maximum timeout threshold for overall detection.\n\n- `assistant?: { id: string; dynamic_variables?: object; external_llm?: { authentication_method?: 'token' | 'certificate'; base_url?: string; certificate_ref?: string; forward_metadata?: boolean; llm_api_key_ref?: string; model?: string; token_retrieval_url?: string; }; fallback_config?: { external_llm?: { authentication_method?: 'token' | 'certificate'; base_url?: string; certificate_ref?: string; forward_metadata?: boolean; llm_api_key_ref?: string; model?: string; token_retrieval_url?: string; }; llm_api_key_ref?: string; model?: string; }; greeting?: string; instructions?: string; llm_api_key_ref?: string; mcp_servers?: object[]; model?: string; name?: string; observability_settings?: object; openai_api_key_ref?: string; tools?: { book_appointment: book_appointment_tool_params; type: 'book_appointment'; } | { check_availability: check_availability_tool_params; type: 'check_availability'; } | { type: 'webhook'; webhook: object; } | { hangup: hangup_tool_params; type: 'hangup'; } | { transfer: object; type: 'transfer'; } | { retrieval: call_control_bucket_ids; type: 'retrieval'; }[]; }`\n AI Assistant configuration. All fields except `id` are optional — the assistant's stored configuration will be used as fallback for any omitted fields.\n - `id: string`\n The identifier of the AI assistant to use.\n - `dynamic_variables?: object`\n Map of dynamic variables and their default values. Dynamic variables can be referenced in instructions, greeting, and tool definitions using the `{{variable_name}}` syntax. Call-control-agent automatically merges in `telnyx_call_*` variables (telnyx_call_to, telnyx_call_from, telnyx_conversation_channel, telnyx_agent_target, telnyx_end_user_target, telnyx_call_caller_id_name) and custom header variables.\n - `external_llm?: { authentication_method?: 'token' | 'certificate'; base_url?: string; certificate_ref?: string; forward_metadata?: boolean; llm_api_key_ref?: string; model?: string; token_retrieval_url?: string; }`\n External LLM configuration for bringing your own LLM endpoint.\n - `fallback_config?: { external_llm?: { authentication_method?: 'token' | 'certificate'; base_url?: string; certificate_ref?: string; forward_metadata?: boolean; llm_api_key_ref?: string; model?: string; token_retrieval_url?: string; }; llm_api_key_ref?: string; model?: string; }`\n Fallback LLM configuration used when the primary LLM provider is unavailable.\n - `greeting?: string`\n Initial greeting text spoken when the assistant starts. Can be plain text for any voice or SSML for `AWS.Polly.<voice_id>` voices. There is a 3,000 character limit.\n - `instructions?: string`\n System instructions for the voice assistant. Can be templated with [dynamic variables](https://developers.telnyx.com/docs/inference/ai-assistants/dynamic-variables). This will overwrite the instructions set in the assistant configuration.\n - `llm_api_key_ref?: string`\n Integration secret identifier for the LLM provider API key. Use this field to reference an [integration secret](https://developers.telnyx.com/api/secrets-manager/integration-secrets/create-integration-secret) containing your LLM provider API key. Supports any LLM provider (OpenAI, Anthropic, etc.).\n - `mcp_servers?: object[]`\n MCP (Model Context Protocol) server configurations for extending the assistant's capabilities with external tools and data sources.\n - `model?: string`\n LLM model override for this call. If omitted, the assistant's configured model is used.\n - `name?: string`\n Assistant name override for this call.\n - `observability_settings?: object`\n Observability configuration for the assistant session, including Langfuse integration for tracing and monitoring.\n - `openai_api_key_ref?: string`\n Deprecated — use `llm_api_key_ref` instead. Integration secret identifier for the OpenAI API key. This field is maintained for backward compatibility; `llm_api_key_ref` is the canonical field name and supports all LLM providers.\n - `tools?: { book_appointment: { api_key_ref: string; event_type_id: number; attendee_name?: string; attendee_timezone?: string; }; type: 'book_appointment'; } | { check_availability: { api_key_ref: string; event_type_id: number; }; type: 'check_availability'; } | { type: 'webhook'; webhook: { description: string; name: string; url: string; body_parameters?: { properties?: object; required?: string[]; type?: 'object'; }; headers?: { name?: string; value?: string; }[]; method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'; path_parameters?: { properties?: object; required?: string[]; type?: 'object'; }; query_parameters?: { properties?: object; required?: string[]; type?: 'object'; }; }; } | { hangup: { description?: string; }; type: 'hangup'; } | { transfer: { from: string; targets: { to: string; name?: string; }[] | string; }; type: 'transfer'; } | { retrieval: { bucket_ids: string[]; max_num_results?: number; }; type: 'retrieval'; }[]`\n Inline tool definitions available to the assistant (webhook, retrieval, transfer, hangup, etc.). Overrides the assistant's stored tools if provided.\n\n- `audio_url?: string`\n The URL of a file to be played back to the callee when the call is answered. The URL can point to either a WAV or MP3 file. media_name and audio_url cannot be used together in one request.\n\n- `billing_group_id?: string`\n Use this field to set the Billing Group ID for the call. Must be a valid and existing Billing Group ID.\n\n- `bridge_intent?: boolean`\n Indicates the intent to bridge this call with the call specified in link_to. When bridge_intent is true, link_to becomes required and the from number will be overwritten by the from number from the linked call.\n\n- `bridge_on_answer?: boolean`\n Whether to automatically bridge answered call to the call specified in link_to. When bridge_on_answer is true, link_to becomes required.\n\n- `client_state?: string`\n Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string.\n\n- `command_id?: string`\n Use this field to avoid duplicate commands. Telnyx will ignore others Dial commands with the same `command_id`.\n\n- `conference_config?: { id?: string; beep_enabled?: 'always' | 'never' | 'on_enter' | 'on_exit'; conference_name?: string; early_media?: boolean; end_conference_on_exit?: boolean; hold?: boolean; hold_audio_url?: string; hold_media_name?: string; mute?: boolean; soft_end_conference_on_exit?: boolean; start_conference_on_create?: boolean; start_conference_on_enter?: boolean; supervisor_role?: 'barge' | 'monitor' | 'none' | 'whisper'; whisper_call_control_ids?: string[]; }`\n Optional configuration parameters to dial new participant into a conference.\n - `id?: string`\n Conference ID to be joined\n - `beep_enabled?: 'always' | 'never' | 'on_enter' | 'on_exit'`\n Whether a beep sound should be played when the participant joins and/or leaves the conference. Can be used to override the conference-level setting.\n - `conference_name?: string`\n Conference name to be joined\n - `early_media?: boolean`\n Controls the moment when dialled call is joined into conference. If set to `true` user will be joined as soon as media is available (ringback). If `false` user will be joined when call is answered. Defaults to `true`\n - `end_conference_on_exit?: boolean`\n Whether the conference should end and all remaining participants be hung up after the participant leaves the conference. Defaults to \"false\".\n - `hold?: boolean`\n Whether the participant should be put on hold immediately after joining the conference. Defaults to \"false\".\n - `hold_audio_url?: string`\n The URL of a file to be played to the participant when they are put on hold after joining the conference. hold_media_name and hold_audio_url cannot be used together in one request. Takes effect only when \"start_conference_on_create\" is set to \"false\". This property takes effect only if \"hold\" is set to \"true\".\n - `hold_media_name?: string`\n The media_name of a file to be played to the participant when they are put on hold after joining the conference. The media_name must point to a file previously uploaded to api.telnyx.com/v2/media by the same user/organization. The file must either be a WAV or MP3 file. Takes effect only when \"start_conference_on_create\" is set to \"false\". This property takes effect only if \"hold\" is set to \"true\".\n - `mute?: boolean`\n Whether the participant should be muted immediately after joining the conference. Defaults to \"false\".\n - `soft_end_conference_on_exit?: boolean`\n Whether the conference should end after the participant leaves the conference. NOTE this doesn't hang up the other participants. Defaults to \"false\".\n - `start_conference_on_create?: boolean`\n Whether the conference should be started on creation. If the conference isn't started all participants that join are automatically put on hold. Defaults to \"true\".\n - `start_conference_on_enter?: boolean`\n Whether the conference should be started after the participant joins the conference. Defaults to \"false\".\n - `supervisor_role?: 'barge' | 'monitor' | 'none' | 'whisper'`\n Sets the joining participant as a supervisor for the conference. A conference can have multiple supervisors. \"barge\" means the supervisor enters the conference as a normal participant. This is the same as \"none\". \"monitor\" means the supervisor is muted but can hear all participants. \"whisper\" means that only the specified \"whisper_call_control_ids\" can hear the supervisor. Defaults to \"none\".\n - `whisper_call_control_ids?: string[]`\n Array of unique call_control_ids the joining supervisor can whisper to. If none provided, the supervisor will join the conference as a monitoring participant only.\n\n- `custom_headers?: { name: string; value: string; }[]`\n Custom headers to be added to the SIP INVITE.\n\n- `deepfake_detection?: { enabled: boolean; rtp_timeout?: number; timeout?: number; }`\n Enables deepfake detection on the call. When enabled, audio from the remote party is streamed to a detection service that analyzes whether the voice is AI-generated. Results are delivered via the `call.deepfake_detection.result` webhook.\n - `enabled: boolean`\n Whether deepfake detection is enabled.\n - `rtp_timeout?: number`\n Maximum time in seconds to wait for RTP audio before timing out. If no audio is received within this window, detection stops with an error.\n - `timeout?: number`\n Maximum time in seconds to wait for a detection result before timing out.\n\n- `dialogflow_config?: { analyze_sentiment?: boolean; partial_automated_agent_reply?: boolean; }`\n - `analyze_sentiment?: boolean`\n Enable sentiment analysis from Dialogflow.\n - `partial_automated_agent_reply?: boolean`\n Enable partial automated agent reply from Dialogflow.\n\n- `enable_dialogflow?: boolean`\n Enables Dialogflow for the current call. The default value is false.\n\n- `from_display_name?: string`\n The `from_display_name` string to be used as the caller id name (SIP From Display Name) presented to the destination (`to` number). The string should have a maximum of 128 characters, containing only letters, numbers, spaces, and -_~!.+ special characters. If ommited, the display name will be the same as the number in the `from` field.\n\n- `link_to?: string`\n Use another call's control id for sharing the same call session id\n\n- `media_encryption?: 'disabled' | 'SRTP' | 'DTLS'`\n Defines whether media should be encrypted on the call.\n\n- `media_name?: string`\n The media_name of a file to be played back to the callee when the call is answered. The media_name must point to a file previously uploaded to api.telnyx.com/v2/media by the same user/organization. The file must either be a WAV or MP3 file.\n\n- `park_after_unbridge?: string`\n If supplied with the value `self`, the current leg will be parked after unbridge. If not set, the default behavior is to hang up the leg. When park_after_unbridge is set, link_to becomes required.\n\n- `preferred_codecs?: string`\n The list of comma-separated codecs in a preferred order for the forked media to be received.\n\n- `prevent_double_bridge?: boolean`\n Prevents bridging and hangs up the call if the target is already bridged. Disabled by default.\n\n- `privacy?: 'id' | 'none'`\n Indicates the privacy level to be used for the call. When set to `id`, caller ID information (name and number) will be hidden from the called party. When set to `none` or omitted, caller ID will be shown normally.\n\n- `record?: 'record-from-answer'`\n Start recording automatically after an event. Disabled by default.\n\n- `record_channels?: 'single' | 'dual'`\n Defines which channel should be recorded ('single' or 'dual') when `record` is specified.\n\n- `record_custom_file_name?: string`\n The custom recording file name to be used instead of the default `call_leg_id`. Telnyx will still add a Unix timestamp suffix.\n\n- `record_format?: 'wav' | 'mp3'`\n Defines the format of the recording ('wav' or 'mp3') when `record` is specified.\n\n- `record_max_length?: number`\n Defines the maximum length for the recording in seconds when `record` is specified. The minimum value is 0. The maximum value is 43200. The default value is 0 (infinite).\n\n- `record_timeout_secs?: number`\n The number of seconds that Telnyx will wait for the recording to be stopped if silence is detected when `record` is specified. The timer only starts when the speech is detected. Please note that call transcription is used to detect silence and the related charge will be applied. The minimum value is 0. The default value is 0 (infinite).\n\n- `record_track?: 'both' | 'inbound' | 'outbound'`\n The audio track to be recorded. Can be either `both`, `inbound` or `outbound`. If only single track is specified (`inbound`, `outbound`), `channels` configuration is ignored and it will be recorded as mono (single channel).\n\n- `record_trim?: 'trim-silence'`\n When set to `trim-silence`, silence will be removed from the beginning and end of the recording.\n\n- `send_silence_when_idle?: boolean`\n Generate silence RTP packets when no transmission available.\n\n- `sip_auth_password?: string`\n SIP Authentication password used for SIP challenges.\n\n- `sip_auth_username?: string`\n SIP Authentication username used for SIP challenges.\n\n- `sip_headers?: { name: 'User-to-User'; value: string; }[]`\n SIP headers to be added to the SIP INVITE request. Currently only User-to-User header is supported.\n\n- `sip_region?: 'US' | 'Europe' | 'Canada' | 'Australia' | 'Middle East'`\n Defines the SIP region to be used for the call.\n\n- `sip_transport_protocol?: 'UDP' | 'TCP' | 'TLS'`\n Defines SIP transport protocol to be used on the call.\n\n- `sound_modifications?: { octaves?: number; pitch?: number; semitone?: number; track?: string; }`\n Use this field to modify sound effects, for example adjust the pitch.\n - `octaves?: number`\n Adjust the pitch in octaves, values should be between -1 and 1, default 0\n - `pitch?: number`\n Set the pitch directly, value should be > 0, default 1 (lower = lower tone)\n - `semitone?: number`\n Adjust the pitch in semitones, values should be between -14 and 14, default 0\n - `track?: string`\n The track to which the sound modifications will be applied. Accepted values are `inbound` or `outbound`\n\n- `stream_auth_token?: string`\n An authentication token to be sent as part of the WebSocket connection when using streaming. Maximum length is 4000 characters.\n\n- `stream_bidirectional_codec?: 'PCMU' | 'PCMA' | 'G722' | 'OPUS' | 'AMR-WB' | 'L16'`\n Indicates codec for bidirectional streaming RTP payloads. Used only with stream_bidirectional_mode=rtp. Case sensitive.\n\n- `stream_bidirectional_mode?: 'mp3' | 'rtp'`\n Configures method of bidirectional streaming (mp3, rtp).\n\n- `stream_bidirectional_sampling_rate?: 8000 | 16000 | 22050 | 24000 | 48000`\n Audio sampling rate.\n\n- `stream_bidirectional_target_legs?: 'both' | 'self' | 'opposite'`\n Specifies which call legs should receive the bidirectional stream audio.\n\n- `stream_codec?: 'PCMU' | 'PCMA' | 'G722' | 'OPUS' | 'AMR-WB' | 'L16' | 'default'`\n Specifies the codec to be used for the streamed audio. When set to 'default' or when transcoding is not possible, the codec from the call will be used.\n\n- `stream_establish_before_call_originate?: boolean`\n Establish websocket connection before dialing the destination. This is useful for cases where the websocket connection takes a long time to establish.\n\n- `stream_track?: 'inbound_track' | 'outbound_track' | 'both_tracks'`\n Specifies which track should be streamed.\n\n- `stream_url?: string`\n The destination WebSocket address where the stream is going to be delivered.\n\n- `supervise_call_control_id?: string`\n The call leg which will be supervised by the new call.\n\n- `supervisor_role?: 'barge' | 'whisper' | 'monitor'`\n The role of the supervisor call. 'barge' means that supervisor call hears and is being heard by both ends of the call (caller & callee). 'whisper' means that only supervised_call_control_id hears supervisor but supervisor can hear everything. 'monitor' means that nobody can hear supervisor call, but supervisor can hear everything on the call.\n\n- `time_limit_secs?: number`\n Sets the maximum duration of a Call Control Leg in seconds. If the time limit is reached, the call will hangup and a `call.hangup` webhook with a `hangup_cause` of `time_limit` will be sent. For example, by setting a time limit of 120 seconds, a Call Leg will be automatically terminated two minutes after being answered. The default time limit is 14400 seconds or 4 hours and this is also the maximum allowed call length.\n\n- `timeout_secs?: number`\n The number of seconds that Telnyx will wait for the call to be answered by the destination to which it is being called. If the timeout is reached before an answer is received, the call will hangup and a `call.hangup` webhook with a `hangup_cause` of `timeout` will be sent. Minimum value is 5 seconds. Maximum value is 600 seconds.\n\n- `transcription?: boolean`\n Enable transcription upon call answer. The default value is false.\n\n- `transcription_config?: { client_state?: string; command_id?: string; transcription_engine?: 'Google' | 'Telnyx' | 'Deepgram' | 'Azure' | 'xAI' | 'AssemblyAI' | 'A' | 'B'; transcription_engine_config?: { enable_speaker_diarization?: boolean; hints?: string[]; interim_results?: boolean; language?: google_transcription_language; max_speaker_count?: number; min_speaker_count?: number; model?: string; profanity_filter?: boolean; speech_context?: object[]; transcription_engine?: 'Google'; use_enhanced?: boolean; } | { language?: telnyx_transcription_language; transcription_engine?: 'Telnyx'; transcription_model?: 'openai/whisper-tiny' | 'openai/whisper-large-v3-turbo'; } | { region: 'australiaeast' | 'centralindia' | 'eastus' | 'northcentralus' | 'westeurope' | 'westus2'; transcription_engine: 'Azure'; api_key_ref?: string; language?: string; } | { interim_results?: boolean; language?: string; transcription_engine?: 'xAI'; transcription_model?: 'xai/grok-stt'; } | { interim_results?: boolean; transcription_engine?: 'AssemblyAI'; transcription_model?: 'assemblyai/universal-streaming'; } | { enable_speaker_diarization?: boolean; hints?: string[]; interim_results?: boolean; language?: google_transcription_language; max_speaker_count?: number; min_speaker_count?: number; model?: string; profanity_filter?: boolean; speech_context?: object[]; transcription_engine?: 'A'; use_enhanced?: boolean; } | { language?: telnyx_transcription_language; transcription_engine?: 'B'; transcription_model?: 'openai/whisper-tiny' | 'openai/whisper-large-v3-turbo'; } | { transcription_engine: 'deepgram/nova-2'; transcription_model: 'deepgram/nova-2'; interim_results?: boolean; keywords_boosting?: object; language?: string; utterance_end_ms?: number; } | { transcription_engine: 'deepgram/nova-3'; transcription_model: 'deepgram/nova-3'; interim_results?: boolean; keywords_boosting?: object; language?: string; utterance_end_ms?: number; }; transcription_tracks?: string; }`\n - `client_state?: string`\n Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string.\n - `command_id?: string`\n Use this field to avoid duplicate commands. Telnyx will ignore any command with the same `command_id` for the same `call_control_id`.\n - `transcription_engine?: 'Google' | 'Telnyx' | 'Deepgram' | 'Azure' | 'xAI' | 'AssemblyAI' | 'A' | 'B'`\n Engine to use for speech recognition. Legacy values `A` - `Google`, `B` - `Telnyx` are supported for backward compatibility.\n - `transcription_engine_config?: { enable_speaker_diarization?: boolean; hints?: string[]; interim_results?: boolean; language?: string; max_speaker_count?: number; min_speaker_count?: number; model?: string; profanity_filter?: boolean; speech_context?: { boost?: number; phrases?: string[]; }[]; transcription_engine?: 'Google'; use_enhanced?: boolean; } | { language?: string; transcription_engine?: 'Telnyx'; transcription_model?: 'openai/whisper-tiny' | 'openai/whisper-large-v3-turbo'; } | { region: 'australiaeast' | 'centralindia' | 'eastus' | 'northcentralus' | 'westeurope' | 'westus2'; transcription_engine: 'Azure'; api_key_ref?: string; language?: string; } | { interim_results?: boolean; language?: string; transcription_engine?: 'xAI'; transcription_model?: 'xai/grok-stt'; } | { interim_results?: boolean; transcription_engine?: 'AssemblyAI'; transcription_model?: 'assemblyai/universal-streaming'; } | { enable_speaker_diarization?: boolean; hints?: string[]; interim_results?: boolean; language?: string; max_speaker_count?: number; min_speaker_count?: number; model?: string; profanity_filter?: boolean; speech_context?: { boost?: number; phrases?: string[]; }[]; transcription_engine?: 'A'; use_enhanced?: boolean; } | { language?: string; transcription_engine?: 'B'; transcription_model?: 'openai/whisper-tiny' | 'openai/whisper-large-v3-turbo'; } | { transcription_engine: 'deepgram/nova-2'; transcription_model: 'deepgram/nova-2'; interim_results?: boolean; keywords_boosting?: object; language?: string; utterance_end_ms?: number; } | { transcription_engine: 'deepgram/nova-3'; transcription_model: 'deepgram/nova-3'; interim_results?: boolean; keywords_boosting?: object; language?: string; utterance_end_ms?: number; }`\n - `transcription_tracks?: string`\n Indicates which leg of the call will be transcribed. Use `inbound` for the leg that requested the transcription, `outbound` for the other leg, and `both` for both legs of the call. Will default to `inbound`.\n\n- `webhook_retries_policies?: object`\n A map of event types to retry policies. Each retry policy contains an array of `retries_ms` specifying the delays between retry attempts in milliseconds. Maximum 5 retries, total delay cannot exceed 60 seconds.\n\n- `webhook_url?: string`\n Use this field to override the URL for which Telnyx will send subsequent webhooks to for this call.\n\n- `webhook_url_method?: 'POST' | 'GET'`\n HTTP request type used for `webhook_url`.\n\n- `webhook_urls?: object`\n A map of event types to webhook URLs. When an event of the specified type occurs, the webhook URL associated with that event type will be called instead of the default webhook URL. Events not mapped here will use the default webhook URL.\n\n- `webhook_urls_method?: 'POST' | 'GET'`\n HTTP request method to invoke `webhook_urls`.\n\n### Returns\n\n- `{ data?: { call_control_id: string; call_leg_id: string; call_session_id: string; is_alive: boolean; record_type: 'call'; call_duration?: number; client_state?: string; end_time?: string; recording_id?: string; start_time?: string; }; }`\n\n - `data?: { call_control_id: string; call_leg_id: string; call_session_id: string; is_alive: boolean; record_type: 'call'; call_duration?: number; client_state?: string; end_time?: string; recording_id?: string; start_time?: string; }`\n\n### Example\n\n```typescript\nimport Telnyx from 'telnyx';\n\nconst client = new Telnyx();\n\nconst response = await client.calls.dial({\n connection_id: '7267xxxxxxxxxxxxxx',\n from: '+18005550101',\n to: '+18005550100 or sip:username@sip.telnyx.com',\n});\n\nconsole.log(response);\n```",
11167
+ markdown: "## dial\n\n`client.calls.dial(connection_id: string, from: string, to: string | string[], answering_machine_detection?: 'premium' | 'detect' | 'detect_beep' | 'detect_words' | 'greeting_end' | 'disabled', answering_machine_detection_config?: { after_greeting_silence_millis?: number; between_words_silence_millis?: number; greeting_duration_millis?: number; greeting_silence_duration_millis?: number; greeting_total_analysis_time_millis?: number; initial_silence_millis?: number; maximum_number_of_words?: number; maximum_word_length_millis?: number; silence_threshold?: number; total_analysis_time_millis?: number; }, assistant?: { id: string; dynamic_variables?: object; external_llm?: object; fallback_config?: object; greeting?: string; instructions?: string; llm_api_key_ref?: string; mcp_servers?: object[]; model?: string; name?: string; observability_settings?: object; openai_api_key_ref?: string; tools?: book_appointment_tool | check_availability_tool | webhook_tool | hangup_tool | transfer_tool | call_control_retrieval_tool[]; }, audio_url?: string, billing_group_id?: string, bridge_intent?: boolean, bridge_on_answer?: boolean, client_state?: string, command_id?: string, conference_config?: { id?: string; beep_enabled?: 'always' | 'never' | 'on_enter' | 'on_exit'; conference_name?: string; early_media?: boolean; end_conference_on_exit?: boolean; hold?: boolean; hold_audio_url?: string; hold_media_name?: string; mute?: boolean; soft_end_conference_on_exit?: boolean; start_conference_on_create?: boolean; start_conference_on_enter?: boolean; supervisor_role?: 'barge' | 'monitor' | 'none' | 'whisper'; whisper_call_control_ids?: string[]; }, custom_headers?: { name: string; value: string; }[], deepfake_detection?: { enabled: boolean; rtp_timeout?: number; timeout?: number; }, dialogflow_config?: { analyze_sentiment?: boolean; partial_automated_agent_reply?: boolean; }, enable_dialogflow?: boolean, from_display_name?: string, link_to?: string, media_encryption?: 'disabled' | 'SRTP' | 'DTLS', media_name?: string, park_after_unbridge?: string, preferred_codecs?: string, prevent_double_bridge?: boolean, privacy?: 'id' | 'none', record?: 'record-from-answer', record_channels?: 'single' | 'dual', record_custom_file_name?: string, record_format?: 'wav' | 'mp3', record_max_length?: number, record_timeout_secs?: number, record_track?: 'both' | 'inbound' | 'outbound', record_trim?: 'trim-silence', send_silence_when_idle?: boolean, sip_auth_password?: string, sip_auth_username?: string, sip_headers?: { name: 'User-to-User'; value: string; }[], sip_region?: 'US' | 'Europe' | 'Canada' | 'Australia' | 'Middle East', sip_transport_protocol?: 'UDP' | 'TCP' | 'TLS', sound_modifications?: { octaves?: number; pitch?: number; semitone?: number; track?: string; }, stream_auth_token?: string, stream_bidirectional_codec?: 'PCMU' | 'PCMA' | 'G722' | 'OPUS' | 'AMR-WB' | 'L16', stream_bidirectional_mode?: 'mp3' | 'rtp', stream_bidirectional_sampling_rate?: 8000 | 16000 | 22050 | 24000 | 48000, stream_bidirectional_target_legs?: 'both' | 'self' | 'opposite', stream_codec?: 'PCMU' | 'PCMA' | 'G722' | 'OPUS' | 'AMR-WB' | 'L16' | 'default', stream_establish_before_call_originate?: boolean, stream_track?: 'inbound_track' | 'outbound_track' | 'both_tracks', stream_url?: string, supervise_call_control_id?: string, supervisor_role?: 'barge' | 'whisper' | 'monitor', time_limit_secs?: number, timeout_secs?: number, transcription?: boolean, transcription_config?: { client_state?: string; command_id?: string; transcription_engine?: 'Google' | 'Telnyx' | 'Deepgram' | 'Azure' | 'xAI' | 'AssemblyAI' | 'A' | 'B'; transcription_engine_config?: transcription_engine_google_config | transcription_engine_telnyx_config | transcription_engine_azure_config | transcription_engine_xai_config | transcription_engine_assemblyai_config | transcription_engine_a_config | transcription_engine_b_config | deepgram_nova2_config | deepgram_nova3_config; transcription_tracks?: string; }, webhook_retries_policies?: object, webhook_url?: string, webhook_url_method?: 'POST' | 'GET', webhook_urls?: object, webhook_urls_method?: 'POST' | 'GET'): { data?: object; }`\n\n**post** `/calls`\n\nDial a number or SIP URI from a given connection. A successful response will include a `call_leg_id` which can be used to correlate the command with subsequent webhooks.\n\n**Expected Webhooks:**\n\n- `call.initiated`\n- `call.answered` or `call.hangup`\n- `call.hold` and `call.unhold` if the call is held/unheld\n- `call.machine.detection.ended` if `answering_machine_detection` was requested\n- `call.machine.greeting.ended` if `answering_machine_detection` was requested to detect the end of machine greeting\n- `call.machine.premium.detection.ended` if `answering_machine_detection=premium` was requested\n- `call.machine.premium.greeting.ended` if `answering_machine_detection=premium` was requested and a beep was detected\n- `call.deepfake_detection.result` if `deepfake_detection` was enabled\n- `call.deepfake_detection.error` if `deepfake_detection` was enabled and an error occurred\n- `streaming.started`, `streaming.stopped` or `streaming.failed` if `stream_url` was set\n\nWhen the `record` parameter is set to `record-from-answer`, the response will include a `recording_id` field.\n\n\n### Parameters\n\n- `connection_id: string`\n The ID of the Call Control App (formerly ID of the connection) to be used when dialing the destination.\n\n- `from: string`\n The `from` number to be used as the caller id presented to the destination (`to` number). The number should be in +E164 format.\n\n- `to: string | string[]`\n The DID or SIP URI to dial out to. Multiple DID or SIP URIs can be provided using an array of strings. For SIP URI destinations, append `;secure=true` or `;secure=srtp` to enable SRTP media encryption for that endpoint, or `;secure=dtls` to enable DTLS media encryption for that endpoint. If `media_encryption` is set to `SRTP` or `DTLS`, it takes precedence over any per-endpoint `secure` URI parameter.\n\n- `answering_machine_detection?: 'premium' | 'detect' | 'detect_beep' | 'detect_words' | 'greeting_end' | 'disabled'`\n Enables Answering Machine Detection. Telnyx offers Premium and Standard detections. With Premium detection, when a call is answered, Telnyx runs real-time detection and sends a `call.machine.premium.detection.ended` webhook with one of the following results: `human_residence`, `human_business`, `machine`, `silence` or `fax_detected`. If we detect a beep, we also send a `call.machine.premium.greeting.ended` webhook with the result of `beep_detected`. If we detect a beep before `call.machine.premium.detection.ended` we only send `call.machine.premium.greeting.ended`, and if we detect a beep after `call.machine.premium.detection.ended`, we send both webhooks. With Standard detection, when a call is answered, Telnyx runs real-time detection to determine if it was picked up by a human or a machine and sends an `call.machine.detection.ended` webhook with the analysis result. If `greeting_end` or `detect_words` is used and a `machine` is detected, you will receive another `call.machine.greeting.ended` webhook when the answering machine greeting ends with a beep or silence. If `detect_beep` is used, you will only receive `call.machine.greeting.ended` if a beep is detected.\n\n- `answering_machine_detection_config?: { after_greeting_silence_millis?: number; between_words_silence_millis?: number; greeting_duration_millis?: number; greeting_silence_duration_millis?: number; greeting_total_analysis_time_millis?: number; initial_silence_millis?: number; maximum_number_of_words?: number; maximum_word_length_millis?: number; silence_threshold?: number; total_analysis_time_millis?: number; }`\n Optional configuration parameters to modify 'answering_machine_detection' performance. Only `total_analysis_time_millis` and `greeting_duration_millis` parameters are applicable when `premium` is selected as answering_machine_detection.\n - `after_greeting_silence_millis?: number`\n Silence duration threshold after a greeting message or voice for it be considered human.\n - `between_words_silence_millis?: number`\n Maximum threshold for silence between words.\n - `greeting_duration_millis?: number`\n Maximum threshold of a human greeting. If greeting longer than this value, considered machine.\n - `greeting_silence_duration_millis?: number`\n If machine already detected, maximum threshold for silence between words. If exceeded, the greeting is considered ended.\n - `greeting_total_analysis_time_millis?: number`\n If machine already detected, maximum timeout threshold to determine the end of the machine greeting.\n - `initial_silence_millis?: number`\n If initial silence duration is greater than this value, consider it a machine.\n - `maximum_number_of_words?: number`\n If number of detected words is greater than this value, consder it a machine.\n - `maximum_word_length_millis?: number`\n If a single word lasts longer than this threshold, consider it a machine.\n - `silence_threshold?: number`\n Minimum noise threshold for any analysis.\n - `total_analysis_time_millis?: number`\n Maximum timeout threshold for overall detection.\n\n- `assistant?: { id: string; dynamic_variables?: object; external_llm?: { authentication_method?: 'token' | 'certificate'; base_url?: string; certificate_ref?: string; forward_metadata?: boolean; llm_api_key_ref?: string; model?: string; token_retrieval_url?: string; }; fallback_config?: { external_llm?: { authentication_method?: 'token' | 'certificate'; base_url?: string; certificate_ref?: string; forward_metadata?: boolean; llm_api_key_ref?: string; model?: string; token_retrieval_url?: string; }; llm_api_key_ref?: string; model?: string; }; greeting?: string; instructions?: string; llm_api_key_ref?: string; mcp_servers?: object[]; model?: string; name?: string; observability_settings?: object; openai_api_key_ref?: string; tools?: { book_appointment: book_appointment_tool_params; type: 'book_appointment'; } | { check_availability: check_availability_tool_params; type: 'check_availability'; } | { type: 'webhook'; webhook: object; } | { hangup: hangup_tool_params; type: 'hangup'; } | { transfer: object; type: 'transfer'; } | { retrieval: call_control_bucket_ids; type: 'retrieval'; }[]; }`\n AI Assistant configuration. All fields except `id` are optional — the assistant's stored configuration will be used as fallback for any omitted fields.\n - `id: string`\n The identifier of the AI assistant to use.\n - `dynamic_variables?: object`\n Map of dynamic variables and their default values. Dynamic variables can be referenced in instructions, greeting, and tool definitions using the `{{variable_name}}` syntax. Call-control-agent automatically merges in `telnyx_call_*` variables (telnyx_call_to, telnyx_call_from, telnyx_conversation_channel, telnyx_agent_target, telnyx_end_user_target, telnyx_call_caller_id_name) and custom header variables.\n - `external_llm?: { authentication_method?: 'token' | 'certificate'; base_url?: string; certificate_ref?: string; forward_metadata?: boolean; llm_api_key_ref?: string; model?: string; token_retrieval_url?: string; }`\n External LLM configuration for bringing your own LLM endpoint.\n - `fallback_config?: { external_llm?: { authentication_method?: 'token' | 'certificate'; base_url?: string; certificate_ref?: string; forward_metadata?: boolean; llm_api_key_ref?: string; model?: string; token_retrieval_url?: string; }; llm_api_key_ref?: string; model?: string; }`\n Fallback LLM configuration used when the primary LLM provider is unavailable.\n - `greeting?: string`\n Initial greeting text spoken when the assistant starts. Can be plain text for any voice or SSML for `AWS.Polly.<voice_id>` voices. There is a 3,000 character limit.\n - `instructions?: string`\n System instructions for the voice assistant. Can be templated with [dynamic variables](https://developers.telnyx.com/docs/inference/ai-assistants/dynamic-variables). This will overwrite the instructions set in the assistant configuration.\n - `llm_api_key_ref?: string`\n Integration secret identifier for the LLM provider API key. Use this field to reference an [integration secret](https://developers.telnyx.com/api/secrets-manager/integration-secrets/create-integration-secret) containing your LLM provider API key. Supports any LLM provider (OpenAI, Anthropic, etc.).\n - `mcp_servers?: object[]`\n MCP (Model Context Protocol) server configurations for extending the assistant's capabilities with external tools and data sources.\n - `model?: string`\n LLM model override for this call. If omitted, the assistant's configured model is used.\n - `name?: string`\n Assistant name override for this call.\n - `observability_settings?: object`\n Observability configuration for the assistant session, including Langfuse integration for tracing and monitoring.\n - `openai_api_key_ref?: string`\n Deprecated — use `llm_api_key_ref` instead. Integration secret identifier for the OpenAI API key. This field is maintained for backward compatibility; `llm_api_key_ref` is the canonical field name and supports all LLM providers.\n - `tools?: { book_appointment: { api_key_ref: string; event_type_id: number; attendee_name?: string; attendee_timezone?: string; }; type: 'book_appointment'; } | { check_availability: { api_key_ref: string; event_type_id: number; }; type: 'check_availability'; } | { type: 'webhook'; webhook: { description: string; name: string; url: string; body_parameters?: { properties?: object; required?: string[]; type?: 'object'; }; headers?: { name?: string; value?: string; }[]; method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'; path_parameters?: { properties?: object; required?: string[]; type?: 'object'; }; query_parameters?: { properties?: object; required?: string[]; type?: 'object'; }; }; } | { hangup: { description?: string; }; type: 'hangup'; } | { transfer: { from: string; targets: { to: string; name?: string; }[] | string; }; type: 'transfer'; } | { retrieval: { bucket_ids: string[]; max_num_results?: number; }; type: 'retrieval'; }[]`\n Inline tool definitions available to the assistant (webhook, retrieval, transfer, hangup, etc.). Overrides the assistant's stored tools if provided.\n\n- `audio_url?: string`\n The URL of a file to be played back to the callee when the call is answered. The URL can point to either a WAV or MP3 file. media_name and audio_url cannot be used together in one request.\n\n- `billing_group_id?: string`\n Use this field to set the Billing Group ID for the call. Must be a valid and existing Billing Group ID.\n\n- `bridge_intent?: boolean`\n Indicates the intent to bridge this call with the call specified in link_to. When bridge_intent is true, link_to becomes required and the from number will be overwritten by the from number from the linked call.\n\n- `bridge_on_answer?: boolean`\n Whether to automatically bridge answered call to the call specified in link_to. When bridge_on_answer is true, link_to becomes required.\n\n- `client_state?: string`\n Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string.\n\n- `command_id?: string`\n Use this field to avoid duplicate commands. Telnyx will ignore others Dial commands with the same `command_id`.\n\n- `conference_config?: { id?: string; beep_enabled?: 'always' | 'never' | 'on_enter' | 'on_exit'; conference_name?: string; early_media?: boolean; end_conference_on_exit?: boolean; hold?: boolean; hold_audio_url?: string; hold_media_name?: string; mute?: boolean; soft_end_conference_on_exit?: boolean; start_conference_on_create?: boolean; start_conference_on_enter?: boolean; supervisor_role?: 'barge' | 'monitor' | 'none' | 'whisper'; whisper_call_control_ids?: string[]; }`\n Optional configuration parameters to dial new participant into a conference.\n - `id?: string`\n Conference ID to be joined\n - `beep_enabled?: 'always' | 'never' | 'on_enter' | 'on_exit'`\n Whether a beep sound should be played when the participant joins and/or leaves the conference. Can be used to override the conference-level setting.\n - `conference_name?: string`\n Conference name to be joined\n - `early_media?: boolean`\n Controls the moment when dialled call is joined into conference. If set to `true` user will be joined as soon as media is available (ringback). If `false` user will be joined when call is answered. Defaults to `true`\n - `end_conference_on_exit?: boolean`\n Whether the conference should end and all remaining participants be hung up after the participant leaves the conference. Defaults to \"false\".\n - `hold?: boolean`\n Whether the participant should be put on hold immediately after joining the conference. Defaults to \"false\".\n - `hold_audio_url?: string`\n The URL of a file to be played to the participant when they are put on hold after joining the conference. hold_media_name and hold_audio_url cannot be used together in one request. Takes effect only when \"start_conference_on_create\" is set to \"false\". This property takes effect only if \"hold\" is set to \"true\".\n - `hold_media_name?: string`\n The media_name of a file to be played to the participant when they are put on hold after joining the conference. The media_name must point to a file previously uploaded to api.telnyx.com/v2/media by the same user/organization. The file must either be a WAV or MP3 file. Takes effect only when \"start_conference_on_create\" is set to \"false\". This property takes effect only if \"hold\" is set to \"true\".\n - `mute?: boolean`\n Whether the participant should be muted immediately after joining the conference. Defaults to \"false\".\n - `soft_end_conference_on_exit?: boolean`\n Whether the conference should end after the participant leaves the conference. NOTE this doesn't hang up the other participants. Defaults to \"false\".\n - `start_conference_on_create?: boolean`\n Whether the conference should be started on creation. If the conference isn't started all participants that join are automatically put on hold. Defaults to \"true\".\n - `start_conference_on_enter?: boolean`\n Whether the conference should be started after the participant joins the conference. Defaults to \"false\".\n - `supervisor_role?: 'barge' | 'monitor' | 'none' | 'whisper'`\n Sets the joining participant as a supervisor for the conference. A conference can have multiple supervisors. \"barge\" means the supervisor enters the conference as a normal participant. This is the same as \"none\". \"monitor\" means the supervisor is muted but can hear all participants. \"whisper\" means that only the specified \"whisper_call_control_ids\" can hear the supervisor. Defaults to \"none\".\n - `whisper_call_control_ids?: string[]`\n Array of unique call_control_ids the joining supervisor can whisper to. If none provided, the supervisor will join the conference as a monitoring participant only.\n\n- `custom_headers?: { name: string; value: string; }[]`\n Custom headers to be added to the SIP INVITE.\n\n- `deepfake_detection?: { enabled: boolean; rtp_timeout?: number; timeout?: number; }`\n Enables deepfake detection on the call. When enabled, audio from the remote party is streamed to a detection service that analyzes whether the voice is AI-generated. Results are delivered via the `call.deepfake_detection.result` webhook.\n - `enabled: boolean`\n Whether deepfake detection is enabled.\n - `rtp_timeout?: number`\n Maximum time in seconds to wait for RTP audio before timing out. If no audio is received within this window, detection stops with an error.\n - `timeout?: number`\n Maximum time in seconds to wait for a detection result before timing out.\n\n- `dialogflow_config?: { analyze_sentiment?: boolean; partial_automated_agent_reply?: boolean; }`\n - `analyze_sentiment?: boolean`\n Enable sentiment analysis from Dialogflow.\n - `partial_automated_agent_reply?: boolean`\n Enable partial automated agent reply from Dialogflow.\n\n- `enable_dialogflow?: boolean`\n Enables Dialogflow for the current call. The default value is false.\n\n- `from_display_name?: string`\n The `from_display_name` string to be used as the caller id name (SIP From Display Name) presented to the destination (`to` number). The string should have a maximum of 128 characters, containing only letters, numbers, spaces, and -_~!.+ special characters. If ommited, the display name will be the same as the number in the `from` field.\n\n- `link_to?: string`\n Use another call's control id for sharing the same call session id\n\n- `media_encryption?: 'disabled' | 'SRTP' | 'DTLS'`\n Defines whether media should be encrypted on the call. For SIP URI destinations, media encryption can also be requested per endpoint with the `secure` URI parameter: `;secure=true` or `;secure=srtp` enables SRTP, and `;secure=dtls` enables DTLS. This parameter, when set to `SRTP` or `DTLS`, takes precedence over the per-endpoint `secure` value.\n\n- `media_name?: string`\n The media_name of a file to be played back to the callee when the call is answered. The media_name must point to a file previously uploaded to api.telnyx.com/v2/media by the same user/organization. The file must either be a WAV or MP3 file.\n\n- `park_after_unbridge?: string`\n If supplied with the value `self`, the current leg will be parked after unbridge. If not set, the default behavior is to hang up the leg. When park_after_unbridge is set, link_to becomes required.\n\n- `preferred_codecs?: string`\n The list of comma-separated codecs in a preferred order for the forked media to be received.\n\n- `prevent_double_bridge?: boolean`\n Prevents bridging and hangs up the call if the target is already bridged. Disabled by default.\n\n- `privacy?: 'id' | 'none'`\n Indicates the privacy level to be used for the call. When set to `id`, caller ID information (name and number) will be hidden from the called party. When set to `none` or omitted, caller ID will be shown normally.\n\n- `record?: 'record-from-answer'`\n Start recording automatically after an event. Disabled by default.\n\n- `record_channels?: 'single' | 'dual'`\n Defines which channel should be recorded ('single' or 'dual') when `record` is specified.\n\n- `record_custom_file_name?: string`\n The custom recording file name to be used instead of the default `call_leg_id`. Telnyx will still add a Unix timestamp suffix.\n\n- `record_format?: 'wav' | 'mp3'`\n Defines the format of the recording ('wav' or 'mp3') when `record` is specified.\n\n- `record_max_length?: number`\n Defines the maximum length for the recording in seconds when `record` is specified. The minimum value is 0. The maximum value is 43200. The default value is 0 (infinite).\n\n- `record_timeout_secs?: number`\n The number of seconds that Telnyx will wait for the recording to be stopped if silence is detected when `record` is specified. The timer only starts when the speech is detected. Please note that call transcription is used to detect silence and the related charge will be applied. The minimum value is 0. The default value is 0 (infinite).\n\n- `record_track?: 'both' | 'inbound' | 'outbound'`\n The audio track to be recorded. Can be either `both`, `inbound` or `outbound`. If only single track is specified (`inbound`, `outbound`), `channels` configuration is ignored and it will be recorded as mono (single channel).\n\n- `record_trim?: 'trim-silence'`\n When set to `trim-silence`, silence will be removed from the beginning and end of the recording.\n\n- `send_silence_when_idle?: boolean`\n Generate silence RTP packets when no transmission available.\n\n- `sip_auth_password?: string`\n SIP Authentication password used for SIP challenges.\n\n- `sip_auth_username?: string`\n SIP Authentication username used for SIP challenges.\n\n- `sip_headers?: { name: 'User-to-User'; value: string; }[]`\n SIP headers to be added to the SIP INVITE request. Currently only User-to-User header is supported.\n\n- `sip_region?: 'US' | 'Europe' | 'Canada' | 'Australia' | 'Middle East'`\n Defines the SIP region to be used for the call.\n\n- `sip_transport_protocol?: 'UDP' | 'TCP' | 'TLS'`\n Defines SIP transport protocol to be used on the call.\n\n- `sound_modifications?: { octaves?: number; pitch?: number; semitone?: number; track?: string; }`\n Use this field to modify sound effects, for example adjust the pitch.\n - `octaves?: number`\n Adjust the pitch in octaves, values should be between -1 and 1, default 0\n - `pitch?: number`\n Set the pitch directly, value should be > 0, default 1 (lower = lower tone)\n - `semitone?: number`\n Adjust the pitch in semitones, values should be between -14 and 14, default 0\n - `track?: string`\n The track to which the sound modifications will be applied. Accepted values are `inbound` or `outbound`\n\n- `stream_auth_token?: string`\n An authentication token to be sent as part of the WebSocket connection when using streaming. Maximum length is 4000 characters.\n\n- `stream_bidirectional_codec?: 'PCMU' | 'PCMA' | 'G722' | 'OPUS' | 'AMR-WB' | 'L16'`\n Indicates codec for bidirectional streaming RTP payloads. Used only with stream_bidirectional_mode=rtp. Case sensitive.\n\n- `stream_bidirectional_mode?: 'mp3' | 'rtp'`\n Configures method of bidirectional streaming (mp3, rtp).\n\n- `stream_bidirectional_sampling_rate?: 8000 | 16000 | 22050 | 24000 | 48000`\n Audio sampling rate.\n\n- `stream_bidirectional_target_legs?: 'both' | 'self' | 'opposite'`\n Specifies which call legs should receive the bidirectional stream audio.\n\n- `stream_codec?: 'PCMU' | 'PCMA' | 'G722' | 'OPUS' | 'AMR-WB' | 'L16' | 'default'`\n Specifies the codec to be used for the streamed audio. When set to 'default' or when transcoding is not possible, the codec from the call will be used.\n\n- `stream_establish_before_call_originate?: boolean`\n Establish websocket connection before dialing the destination. This is useful for cases where the websocket connection takes a long time to establish.\n\n- `stream_track?: 'inbound_track' | 'outbound_track' | 'both_tracks'`\n Specifies which track should be streamed.\n\n- `stream_url?: string`\n The destination WebSocket address where the stream is going to be delivered.\n\n- `supervise_call_control_id?: string`\n The call leg which will be supervised by the new call.\n\n- `supervisor_role?: 'barge' | 'whisper' | 'monitor'`\n The role of the supervisor call. 'barge' means that supervisor call hears and is being heard by both ends of the call (caller & callee). 'whisper' means that only supervised_call_control_id hears supervisor but supervisor can hear everything. 'monitor' means that nobody can hear supervisor call, but supervisor can hear everything on the call.\n\n- `time_limit_secs?: number`\n Sets the maximum duration of a Call Control Leg in seconds. If the time limit is reached, the call will hangup and a `call.hangup` webhook with a `hangup_cause` of `time_limit` will be sent. For example, by setting a time limit of 120 seconds, a Call Leg will be automatically terminated two minutes after being answered. The default time limit is 14400 seconds or 4 hours and this is also the maximum allowed call length.\n\n- `timeout_secs?: number`\n The number of seconds that Telnyx will wait for the call to be answered by the destination to which it is being called. If the timeout is reached before an answer is received, the call will hangup and a `call.hangup` webhook with a `hangup_cause` of `timeout` will be sent. Minimum value is 5 seconds. Maximum value is 600 seconds.\n\n- `transcription?: boolean`\n Enable transcription upon call answer. The default value is false.\n\n- `transcription_config?: { client_state?: string; command_id?: string; transcription_engine?: 'Google' | 'Telnyx' | 'Deepgram' | 'Azure' | 'xAI' | 'AssemblyAI' | 'A' | 'B'; transcription_engine_config?: { enable_speaker_diarization?: boolean; hints?: string[]; interim_results?: boolean; language?: google_transcription_language; max_speaker_count?: number; min_speaker_count?: number; model?: string; profanity_filter?: boolean; speech_context?: object[]; transcription_engine?: 'Google'; use_enhanced?: boolean; } | { language?: telnyx_transcription_language; transcription_engine?: 'Telnyx'; transcription_model?: 'openai/whisper-tiny' | 'openai/whisper-large-v3-turbo'; } | { region: 'australiaeast' | 'centralindia' | 'eastus' | 'northcentralus' | 'westeurope' | 'westus2'; transcription_engine: 'Azure'; api_key_ref?: string; language?: string; } | { interim_results?: boolean; language?: string; transcription_engine?: 'xAI'; transcription_model?: 'xai/grok-stt'; } | { interim_results?: boolean; transcription_engine?: 'AssemblyAI'; transcription_model?: 'assemblyai/universal-streaming'; } | { enable_speaker_diarization?: boolean; hints?: string[]; interim_results?: boolean; language?: google_transcription_language; max_speaker_count?: number; min_speaker_count?: number; model?: string; profanity_filter?: boolean; speech_context?: object[]; transcription_engine?: 'A'; use_enhanced?: boolean; } | { language?: telnyx_transcription_language; transcription_engine?: 'B'; transcription_model?: 'openai/whisper-tiny' | 'openai/whisper-large-v3-turbo'; } | { transcription_engine: 'deepgram/nova-2'; transcription_model: 'deepgram/nova-2'; interim_results?: boolean; keywords_boosting?: object; language?: string; utterance_end_ms?: number; } | { transcription_engine: 'deepgram/nova-3'; transcription_model: 'deepgram/nova-3'; interim_results?: boolean; keywords_boosting?: object; language?: string; utterance_end_ms?: number; }; transcription_tracks?: string; }`\n - `client_state?: string`\n Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string.\n - `command_id?: string`\n Use this field to avoid duplicate commands. Telnyx will ignore any command with the same `command_id` for the same `call_control_id`.\n - `transcription_engine?: 'Google' | 'Telnyx' | 'Deepgram' | 'Azure' | 'xAI' | 'AssemblyAI' | 'A' | 'B'`\n Engine to use for speech recognition. Legacy values `A` - `Google`, `B` - `Telnyx` are supported for backward compatibility.\n - `transcription_engine_config?: { enable_speaker_diarization?: boolean; hints?: string[]; interim_results?: boolean; language?: string; max_speaker_count?: number; min_speaker_count?: number; model?: string; profanity_filter?: boolean; speech_context?: { boost?: number; phrases?: string[]; }[]; transcription_engine?: 'Google'; use_enhanced?: boolean; } | { language?: string; transcription_engine?: 'Telnyx'; transcription_model?: 'openai/whisper-tiny' | 'openai/whisper-large-v3-turbo'; } | { region: 'australiaeast' | 'centralindia' | 'eastus' | 'northcentralus' | 'westeurope' | 'westus2'; transcription_engine: 'Azure'; api_key_ref?: string; language?: string; } | { interim_results?: boolean; language?: string; transcription_engine?: 'xAI'; transcription_model?: 'xai/grok-stt'; } | { interim_results?: boolean; transcription_engine?: 'AssemblyAI'; transcription_model?: 'assemblyai/universal-streaming'; } | { enable_speaker_diarization?: boolean; hints?: string[]; interim_results?: boolean; language?: string; max_speaker_count?: number; min_speaker_count?: number; model?: string; profanity_filter?: boolean; speech_context?: { boost?: number; phrases?: string[]; }[]; transcription_engine?: 'A'; use_enhanced?: boolean; } | { language?: string; transcription_engine?: 'B'; transcription_model?: 'openai/whisper-tiny' | 'openai/whisper-large-v3-turbo'; } | { transcription_engine: 'deepgram/nova-2'; transcription_model: 'deepgram/nova-2'; interim_results?: boolean; keywords_boosting?: object; language?: string; utterance_end_ms?: number; } | { transcription_engine: 'deepgram/nova-3'; transcription_model: 'deepgram/nova-3'; interim_results?: boolean; keywords_boosting?: object; language?: string; utterance_end_ms?: number; }`\n - `transcription_tracks?: string`\n Indicates which leg of the call will be transcribed. Use `inbound` for the leg that requested the transcription, `outbound` for the other leg, and `both` for both legs of the call. Will default to `inbound`.\n\n- `webhook_retries_policies?: object`\n A map of event types to retry policies. Each retry policy contains an array of `retries_ms` specifying the delays between retry attempts in milliseconds. Maximum 5 retries, total delay cannot exceed 60 seconds.\n\n- `webhook_url?: string`\n Use this field to override the URL for which Telnyx will send subsequent webhooks to for this call.\n\n- `webhook_url_method?: 'POST' | 'GET'`\n HTTP request type used for `webhook_url`.\n\n- `webhook_urls?: object`\n A map of event types to webhook URLs. When an event of the specified type occurs, the webhook URL associated with that event type will be called instead of the default webhook URL. Events not mapped here will use the default webhook URL.\n\n- `webhook_urls_method?: 'POST' | 'GET'`\n HTTP request method to invoke `webhook_urls`.\n\n### Returns\n\n- `{ data?: { call_control_id: string; call_leg_id: string; call_session_id: string; is_alive: boolean; record_type: 'call'; call_duration?: number; client_state?: string; end_time?: string; recording_id?: string; start_time?: string; }; }`\n\n - `data?: { call_control_id: string; call_leg_id: string; call_session_id: string; is_alive: boolean; record_type: 'call'; call_duration?: number; client_state?: string; end_time?: string; recording_id?: string; start_time?: string; }`\n\n### Example\n\n```typescript\nimport Telnyx from 'telnyx';\n\nconst client = new Telnyx();\n\nconst response = await client.calls.dial({\n connection_id: '7267xxxxxxxxxxxxxx',\n from: '+18005550101',\n to: '+18005550100 or sip:username@sip.telnyx.com;secure=srtp',\n});\n\nconsole.log(response);\n```",
11168
11168
  perLanguage: {
11169
11169
  typescript: {
11170
11170
  method: 'client.calls.dial',
11171
- example: "import Telnyx from 'telnyx';\n\nconst client = new Telnyx({\n apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.calls.dial({\n connection_id: '7267xxxxxxxxxxxxxx',\n from: '+18005550101',\n to: '+18005550100 or sip:username@sip.telnyx.com',\n});\n\nconsole.log(response.data);",
11171
+ example: "import Telnyx from 'telnyx';\n\nconst client = new Telnyx({\n apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.calls.dial({\n connection_id: '7267xxxxxxxxxxxxxx',\n from: '+18005550101',\n to: '+18005550100 or sip:username@sip.telnyx.com;secure=srtp',\n});\n\nconsole.log(response.data);",
11172
11172
  },
11173
11173
  python: {
11174
11174
  method: 'calls.dial',
11175
- example: 'import os\nfrom telnyx import Telnyx\n\nclient = Telnyx(\n api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.calls.dial(\n connection_id="7267xxxxxxxxxxxxxx",\n from_="+18005550101",\n to="+18005550100 or sip:username@sip.telnyx.com",\n)\nprint(response.data)',
11175
+ example: 'import os\nfrom telnyx import Telnyx\n\nclient = Telnyx(\n api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.calls.dial(\n connection_id="7267xxxxxxxxxxxxxx",\n from_="+18005550101",\n to="+18005550100 or sip:username@sip.telnyx.com;secure=srtp",\n)\nprint(response.data)',
11176
11176
  },
11177
11177
  java: {
11178
11178
  method: 'calls().dial',
11179
- example: 'package com.telnyx.sdk.example;\n\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport com.telnyx.sdk.models.calls.CallDialParams;\nimport com.telnyx.sdk.models.calls.CallDialResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n TelnyxClient client = TelnyxOkHttpClient.fromEnv();\n\n CallDialParams params = CallDialParams.builder()\n .connectionId("7267xxxxxxxxxxxxxx")\n .from("+18005550101")\n .to("+18005550100 or sip:username@sip.telnyx.com")\n .build();\n CallDialResponse response = client.calls().dial(params);\n }\n}',
11179
+ example: 'package com.telnyx.sdk.example;\n\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport com.telnyx.sdk.models.calls.CallDialParams;\nimport com.telnyx.sdk.models.calls.CallDialResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n TelnyxClient client = TelnyxOkHttpClient.fromEnv();\n\n CallDialParams params = CallDialParams.builder()\n .connectionId("7267xxxxxxxxxxxxxx")\n .from("+18005550101")\n .to("+18005550100 or sip:username@sip.telnyx.com;secure=srtp")\n .build();\n CallDialResponse response = client.calls().dial(params);\n }\n}',
11180
11180
  },
11181
11181
  go: {
11182
11182
  method: 'client.Calls.Dial',
11183
- example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/team-telnyx/telnyx-go"\n\t"github.com/team-telnyx/telnyx-go/option"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Calls.Dial(context.TODO(), telnyx.CallDialParams{\n\t\tConnectionID: "7267xxxxxxxxxxxxxx",\n\t\tFrom: "+18005550101",\n\t\tTo: telnyx.CallDialParamsToUnion{\n\t\t\tOfString: telnyx.String("+18005550100 or sip:username@sip.telnyx.com"),\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.Data)\n}\n',
11183
+ example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/team-telnyx/telnyx-go"\n\t"github.com/team-telnyx/telnyx-go/option"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Calls.Dial(context.TODO(), telnyx.CallDialParams{\n\t\tConnectionID: "7267xxxxxxxxxxxxxx",\n\t\tFrom: "+18005550101",\n\t\tTo: telnyx.CallDialParamsToUnion{\n\t\t\tOfString: telnyx.String("+18005550100 or sip:username@sip.telnyx.com;secure=srtp"),\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.Data)\n}\n',
11184
11184
  },
11185
11185
  ruby: {
11186
11186
  method: 'calls.dial',
11187
- example: 'require "telnyx"\n\ntelnyx = Telnyx::Client.new(api_key: "My API Key")\n\nresponse = telnyx.calls.dial(\n connection_id: "7267xxxxxxxxxxxxxx",\n from: "+18005550101",\n to: "+18005550100 or sip:username@sip.telnyx.com"\n)\n\nputs(response)',
11187
+ example: 'require "telnyx"\n\ntelnyx = Telnyx::Client.new(api_key: "My API Key")\n\nresponse = telnyx.calls.dial(\n connection_id: "7267xxxxxxxxxxxxxx",\n from: "+18005550101",\n to: "+18005550100 or sip:username@sip.telnyx.com;secure=srtp"\n)\n\nputs(response)',
11188
11188
  },
11189
11189
  cli: {
11190
11190
  method: 'calls dial',
11191
- example: "telnyx calls dial \\\n --api-key 'My API Key' \\\n --connection-id 7267xxxxxxxxxxxxxx \\\n --from +18005550101 \\\n --to '+18005550100 or sip:username@sip.telnyx.com'",
11191
+ example: "telnyx calls dial \\\n --api-key 'My API Key' \\\n --connection-id 7267xxxxxxxxxxxxxx \\\n --from +18005550101 \\\n --to '+18005550100 or sip:username@sip.telnyx.com;secure=srtp'",
11192
11192
  },
11193
11193
  php: {
11194
11194
  method: 'calls->dial',
11195
- example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->calls->dial(\n connectionID: '7267xxxxxxxxxxxxxx',\n from: '+18005550101',\n to: '+18005550100 or sip:username@sip.telnyx.com',\n answeringMachineDetection: 'detect',\n answeringMachineDetectionConfig: [\n 'afterGreetingSilenceMillis' => 1000,\n 'betweenWordsSilenceMillis' => 1000,\n 'greetingDurationMillis' => 1000,\n 'greetingSilenceDurationMillis' => 2000,\n 'greetingTotalAnalysisTimeMillis' => 50000,\n 'initialSilenceMillis' => 1000,\n 'maximumNumberOfWords' => 1000,\n 'maximumWordLengthMillis' => 2000,\n 'silenceThreshold' => 512,\n 'totalAnalysisTimeMillis' => 5000,\n ],\n assistant: [\n 'id' => 'id',\n 'dynamicVariables' => [\n 'customer_name' => 'John', 'account_id' => 'ACC-12345'\n ],\n 'externalLlm' => [\n 'authenticationMethod' => 'token',\n 'baseURL' => 'base_url',\n 'certificateRef' => 'certificate_ref',\n 'forwardMetadata' => true,\n 'llmAPIKeyRef' => 'llm_api_key_ref',\n 'model' => 'model',\n 'tokenRetrievalURL' => 'token_retrieval_url',\n ],\n 'fallbackConfig' => [\n 'externalLlm' => [\n 'authenticationMethod' => 'token',\n 'baseURL' => 'base_url',\n 'certificateRef' => 'certificate_ref',\n 'forwardMetadata' => true,\n 'llmAPIKeyRef' => 'llm_api_key_ref',\n 'model' => 'model',\n 'tokenRetrievalURL' => 'token_retrieval_url',\n ],\n 'llmAPIKeyRef' => 'llm_api_key_ref',\n 'model' => 'model',\n ],\n 'greeting' => 'greeting',\n 'instructions' => 'You are a friendly voice assistant.',\n 'llmAPIKeyRef' => 'my_llm_api_key',\n 'mcpServers' => [['foo' => 'bar']],\n 'model' => 'gpt-4o',\n 'name' => 'name',\n 'observabilitySettings' => ['foo' => 'bar'],\n 'openaiAPIKeyRef' => 'my_openai_api_key',\n 'tools' => [\n [\n 'bookAppointment' => [\n 'apiKeyRef' => 'my_calcom_api_key',\n 'eventTypeID' => 0,\n 'attendeeName' => 'attendee_name',\n 'attendeeTimezone' => 'attendee_timezone',\n ],\n 'type' => 'book_appointment',\n ],\n ],\n ],\n audioURL: 'http://www.example.com/sounds/greeting.wav',\n billingGroupID: 'f5586561-8ff0-4291-a0ac-84fe544797bd',\n bridgeIntent: true,\n bridgeOnAnswer: true,\n clientState: 'aGF2ZSBhIG5pY2UgZGF5ID1d',\n commandID: '891510ac-f3e4-11e8-af5b-de00688a4901',\n conferenceConfig: [\n 'id' => '0ccc7b54-4df3-4bca-a65a-3da1ecc777f0',\n 'beepEnabled' => 'on_exit',\n 'conferenceName' => 'telnyx-conference',\n 'earlyMedia' => false,\n 'endConferenceOnExit' => true,\n 'hold' => true,\n 'holdAudioURL' => 'http://example.com/message.wav',\n 'holdMediaName' => 'my_media_uploaded_to_media_storage_api',\n 'mute' => true,\n 'softEndConferenceOnExit' => true,\n 'startConferenceOnCreate' => false,\n 'startConferenceOnEnter' => true,\n 'supervisorRole' => 'whisper',\n 'whisperCallControlIDs' => [\n 'v2:Sg1xxxQ_U3ixxxyXT_VDNI3xxxazZdg6Vxxxs4-GNYxxxVaJPOhFMRQ',\n 'v2:qqpb0mmvd-ovhhBr0BUQQn0fld5jIboaaX3-De0DkqXHzbf8d75xkw',\n ],\n ],\n customHeaders: [\n ['name' => 'head_1', 'value' => 'val_1'],\n ['name' => 'head_2', 'value' => 'val_2'],\n ],\n deepfakeDetection: ['enabled' => true, 'rtpTimeout' => 30, 'timeout' => 15],\n dialogflowConfig: [\n 'analyzeSentiment' => false, 'partialAutomatedAgentReply' => false\n ],\n enableDialogflow: false,\n fromDisplayName: 'Company Name',\n linkTo: 'ilditnZK_eVysupV21KzmzN_sM29ygfauQojpm4BgFtfX5hXAcjotg==',\n mediaEncryption: 'SRTP',\n mediaName: 'my_media_uploaded_to_media_storage_api',\n parkAfterUnbridge: 'self',\n preferredCodecs: 'G722,PCMU,PCMA,G729,OPUS,VP8,H264',\n preventDoubleBridge: true,\n privacy: 'id',\n record: 'record-from-answer',\n recordChannels: 'single',\n recordCustomFileName: 'my_recording_file_name',\n recordFormat: 'wav',\n recordMaxLength: 1000,\n recordTimeoutSecs: 100,\n recordTrack: 'outbound',\n recordTrim: 'trim-silence',\n sendSilenceWhenIdle: true,\n sipAuthPassword: 'password',\n sipAuthUsername: 'username',\n sipHeaders: [['name' => 'User-to-User', 'value' => '12345']],\n sipRegion: 'Canada',\n sipTransportProtocol: 'TLS',\n soundModifications: [\n 'octaves' => 0.1, 'pitch' => 0.8, 'semitone' => -2, 'track' => 'both'\n ],\n streamAuthToken: 'your-auth-token',\n streamBidirectionalCodec: StreamBidirectionalCodec::G722,\n streamBidirectionalMode: StreamBidirectionalMode::RTP,\n streamBidirectionalSamplingRate: StreamBidirectionalSamplingRate::RATE_16000,\n streamBidirectionalTargetLegs: StreamBidirectionalTargetLegs::BOTH,\n streamCodec: StreamCodec::PCMA,\n streamEstablishBeforeCallOriginate: true,\n streamTrack: 'both_tracks',\n streamURL: 'wss://www.example.com/websocket',\n superviseCallControlID: 'v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg',\n supervisorRole: 'barge',\n timeLimitSecs: 60,\n timeoutSecs: 60,\n transcription: true,\n transcriptionConfig: [\n 'clientState' => 'aGF2ZSBhIG5pY2UgZGF5ID1d',\n 'commandID' => '891510ac-f3e4-11e8-af5b-de00688a4901',\n 'transcriptionEngine' => 'Google',\n 'transcriptionEngineConfig' => [\n 'enableSpeakerDiarization' => true,\n 'hints' => ['string'],\n 'interimResults' => true,\n 'language' => GoogleTranscriptionLanguage::EN,\n 'maxSpeakerCount' => 4,\n 'minSpeakerCount' => 4,\n 'model' => 'latest_long',\n 'profanityFilter' => true,\n 'speechContext' => [['boost' => 1, 'phrases' => ['string']]],\n 'transcriptionEngine' => 'Google',\n 'useEnhanced' => true,\n ],\n 'transcriptionTracks' => 'both',\n ],\n webhookRetriesPolicies: [\n 'call.hangup' => ['retriesMs' => [1000, 2000, 5000]]\n ],\n webhookURL: 'https://www.example.com/server-b/',\n webhookURLMethod: 'POST',\n webhookURLs: [\n 'call.hangup' => 'https://www.example.com/webhooks/hangup',\n 'call.bridge' => 'https://www.example.com/webhooks/bridge',\n ],\n webhookURLsMethod: 'POST',\n);\n\nvar_dump($response);",
11195
+ example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->calls->dial(\n connectionID: '7267xxxxxxxxxxxxxx',\n from: '+18005550101',\n to: '+18005550100 or sip:username@sip.telnyx.com;secure=srtp',\n answeringMachineDetection: 'detect',\n answeringMachineDetectionConfig: [\n 'afterGreetingSilenceMillis' => 1000,\n 'betweenWordsSilenceMillis' => 1000,\n 'greetingDurationMillis' => 1000,\n 'greetingSilenceDurationMillis' => 2000,\n 'greetingTotalAnalysisTimeMillis' => 50000,\n 'initialSilenceMillis' => 1000,\n 'maximumNumberOfWords' => 1000,\n 'maximumWordLengthMillis' => 2000,\n 'silenceThreshold' => 512,\n 'totalAnalysisTimeMillis' => 5000,\n ],\n assistant: [\n 'id' => 'id',\n 'dynamicVariables' => [\n 'customer_name' => 'John', 'account_id' => 'ACC-12345'\n ],\n 'externalLlm' => [\n 'authenticationMethod' => 'token',\n 'baseURL' => 'base_url',\n 'certificateRef' => 'certificate_ref',\n 'forwardMetadata' => true,\n 'llmAPIKeyRef' => 'llm_api_key_ref',\n 'model' => 'model',\n 'tokenRetrievalURL' => 'token_retrieval_url',\n ],\n 'fallbackConfig' => [\n 'externalLlm' => [\n 'authenticationMethod' => 'token',\n 'baseURL' => 'base_url',\n 'certificateRef' => 'certificate_ref',\n 'forwardMetadata' => true,\n 'llmAPIKeyRef' => 'llm_api_key_ref',\n 'model' => 'model',\n 'tokenRetrievalURL' => 'token_retrieval_url',\n ],\n 'llmAPIKeyRef' => 'llm_api_key_ref',\n 'model' => 'model',\n ],\n 'greeting' => 'greeting',\n 'instructions' => 'You are a friendly voice assistant.',\n 'llmAPIKeyRef' => 'my_llm_api_key',\n 'mcpServers' => [['foo' => 'bar']],\n 'model' => 'gpt-4o',\n 'name' => 'name',\n 'observabilitySettings' => ['foo' => 'bar'],\n 'openaiAPIKeyRef' => 'my_openai_api_key',\n 'tools' => [\n [\n 'bookAppointment' => [\n 'apiKeyRef' => 'my_calcom_api_key',\n 'eventTypeID' => 0,\n 'attendeeName' => 'attendee_name',\n 'attendeeTimezone' => 'attendee_timezone',\n ],\n 'type' => 'book_appointment',\n ],\n ],\n ],\n audioURL: 'http://www.example.com/sounds/greeting.wav',\n billingGroupID: 'f5586561-8ff0-4291-a0ac-84fe544797bd',\n bridgeIntent: true,\n bridgeOnAnswer: true,\n clientState: 'aGF2ZSBhIG5pY2UgZGF5ID1d',\n commandID: '891510ac-f3e4-11e8-af5b-de00688a4901',\n conferenceConfig: [\n 'id' => '0ccc7b54-4df3-4bca-a65a-3da1ecc777f0',\n 'beepEnabled' => 'on_exit',\n 'conferenceName' => 'telnyx-conference',\n 'earlyMedia' => false,\n 'endConferenceOnExit' => true,\n 'hold' => true,\n 'holdAudioURL' => 'http://example.com/message.wav',\n 'holdMediaName' => 'my_media_uploaded_to_media_storage_api',\n 'mute' => true,\n 'softEndConferenceOnExit' => true,\n 'startConferenceOnCreate' => false,\n 'startConferenceOnEnter' => true,\n 'supervisorRole' => 'whisper',\n 'whisperCallControlIDs' => [\n 'v2:Sg1xxxQ_U3ixxxyXT_VDNI3xxxazZdg6Vxxxs4-GNYxxxVaJPOhFMRQ',\n 'v2:qqpb0mmvd-ovhhBr0BUQQn0fld5jIboaaX3-De0DkqXHzbf8d75xkw',\n ],\n ],\n customHeaders: [\n ['name' => 'head_1', 'value' => 'val_1'],\n ['name' => 'head_2', 'value' => 'val_2'],\n ],\n deepfakeDetection: ['enabled' => true, 'rtpTimeout' => 30, 'timeout' => 15],\n dialogflowConfig: [\n 'analyzeSentiment' => false, 'partialAutomatedAgentReply' => false\n ],\n enableDialogflow: false,\n fromDisplayName: 'Company Name',\n linkTo: 'ilditnZK_eVysupV21KzmzN_sM29ygfauQojpm4BgFtfX5hXAcjotg==',\n mediaEncryption: 'SRTP',\n mediaName: 'my_media_uploaded_to_media_storage_api',\n parkAfterUnbridge: 'self',\n preferredCodecs: 'G722,PCMU,PCMA,G729,OPUS,VP8,H264',\n preventDoubleBridge: true,\n privacy: 'id',\n record: 'record-from-answer',\n recordChannels: 'single',\n recordCustomFileName: 'my_recording_file_name',\n recordFormat: 'wav',\n recordMaxLength: 1000,\n recordTimeoutSecs: 100,\n recordTrack: 'outbound',\n recordTrim: 'trim-silence',\n sendSilenceWhenIdle: true,\n sipAuthPassword: 'password',\n sipAuthUsername: 'username',\n sipHeaders: [['name' => 'User-to-User', 'value' => '12345']],\n sipRegion: 'Canada',\n sipTransportProtocol: 'TLS',\n soundModifications: [\n 'octaves' => 0.1, 'pitch' => 0.8, 'semitone' => -2, 'track' => 'both'\n ],\n streamAuthToken: 'your-auth-token',\n streamBidirectionalCodec: StreamBidirectionalCodec::G722,\n streamBidirectionalMode: StreamBidirectionalMode::RTP,\n streamBidirectionalSamplingRate: StreamBidirectionalSamplingRate::RATE_16000,\n streamBidirectionalTargetLegs: StreamBidirectionalTargetLegs::BOTH,\n streamCodec: StreamCodec::PCMA,\n streamEstablishBeforeCallOriginate: true,\n streamTrack: 'both_tracks',\n streamURL: 'wss://www.example.com/websocket',\n superviseCallControlID: 'v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg',\n supervisorRole: 'barge',\n timeLimitSecs: 60,\n timeoutSecs: 60,\n transcription: true,\n transcriptionConfig: [\n 'clientState' => 'aGF2ZSBhIG5pY2UgZGF5ID1d',\n 'commandID' => '891510ac-f3e4-11e8-af5b-de00688a4901',\n 'transcriptionEngine' => 'Google',\n 'transcriptionEngineConfig' => [\n 'enableSpeakerDiarization' => true,\n 'hints' => ['string'],\n 'interimResults' => true,\n 'language' => GoogleTranscriptionLanguage::EN,\n 'maxSpeakerCount' => 4,\n 'minSpeakerCount' => 4,\n 'model' => 'latest_long',\n 'profanityFilter' => true,\n 'speechContext' => [['boost' => 1, 'phrases' => ['string']]],\n 'transcriptionEngine' => 'Google',\n 'useEnhanced' => true,\n ],\n 'transcriptionTracks' => 'both',\n ],\n webhookRetriesPolicies: [\n 'call.hangup' => ['retriesMs' => [1000, 2000, 5000]]\n ],\n webhookURL: 'https://www.example.com/server-b/',\n webhookURLMethod: 'POST',\n webhookURLs: [\n 'call.hangup' => 'https://www.example.com/webhooks/hangup',\n 'call.bridge' => 'https://www.example.com/webhooks/bridge',\n ],\n webhookURLsMethod: 'POST',\n);\n\nvar_dump($response);",
11196
11196
  },
11197
11197
  http: {
11198
- example: 'curl https://api.telnyx.com/v2/calls \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $TELNYX_API_KEY" \\\n -d \'{\n "connection_id": "7267xxxxxxxxxxxxxx",\n "from": "+18005550101",\n "to": "+18005550100 or sip:username@sip.telnyx.com",\n "answering_machine_detection": "detect",\n "answering_machine_detection_config": {\n "after_greeting_silence_millis": 1000,\n "between_words_silence_millis": 1000,\n "greeting_duration_millis": 1000,\n "greeting_silence_duration_millis": 2000,\n "greeting_total_analysis_time_millis": 50000,\n "initial_silence_millis": 1000,\n "maximum_number_of_words": 1000,\n "maximum_word_length_millis": 2000,\n "silence_threshold": 512,\n "total_analysis_time_millis": 5000\n },\n "audio_url": "http://www.example.com/sounds/greeting.wav",\n "billing_group_id": "f5586561-8ff0-4291-a0ac-84fe544797bd",\n "bridge_intent": true,\n "bridge_on_answer": true,\n "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",\n "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",\n "conference_config": {\n "conference_name": "telnyx-conference",\n "start_conference_on_enter": true\n },\n "custom_headers": [\n {\n "name": "head_1",\n "value": "val_1"\n },\n {\n "name": "head_2",\n "value": "val_2"\n }\n ],\n "deepfake_detection": {\n "enabled": true,\n "rtp_timeout": 30,\n "timeout": 15\n },\n "dialogflow_config": {\n "analyze_sentiment": false,\n "partial_automated_agent_reply": false\n },\n "enable_dialogflow": false,\n "from_display_name": "Company Name",\n "link_to": "ilditnZK_eVysupV21KzmzN_sM29ygfauQojpm4BgFtfX5hXAcjotg==",\n "media_encryption": "SRTP",\n "media_name": "my_media_uploaded_to_media_storage_api",\n "park_after_unbridge": "self",\n "preferred_codecs": "G722,PCMU,PCMA,G729,OPUS,VP8,H264",\n "prevent_double_bridge": true,\n "privacy": "id",\n "record": "record-from-answer",\n "record_channels": "single",\n "record_custom_file_name": "my_recording_file_name",\n "record_format": "wav",\n "record_max_length": 1000,\n "record_timeout_secs": 100,\n "record_track": "outbound",\n "record_trim": "trim-silence",\n "send_silence_when_idle": true,\n "sip_auth_password": "password",\n "sip_auth_username": "username",\n "sip_headers": [\n {\n "name": "User-to-User",\n "value": "12345"\n }\n ],\n "sip_region": "Canada",\n "sip_transport_protocol": "TLS",\n "sound_modifications": {\n "octaves": 0.1,\n "pitch": 0.8,\n "semitone": -2,\n "track": "both"\n },\n "stream_auth_token": "your-auth-token",\n "stream_bidirectional_codec": "G722",\n "stream_bidirectional_mode": "rtp",\n "stream_bidirectional_sampling_rate": 16000,\n "stream_bidirectional_target_legs": "both",\n "stream_codec": "PCMA",\n "stream_establish_before_call_originate": true,\n "stream_track": "both_tracks",\n "stream_url": "wss://www.example.com/websocket",\n "supervise_call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",\n "time_limit_secs": 60,\n "timeout_secs": 60,\n "transcription": true,\n "transcription_config": {\n "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",\n "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",\n "transcription_engine": "Google",\n "transcription_engine_config": {\n "language": "en",\n "transcription_engine": "Google"\n }\n },\n "webhook_retries_policies": {\n "call.hangup": {\n "retries_ms": [\n 1000,\n 2000,\n 5000\n ]\n }\n },\n "webhook_url": "https://www.example.com/server-b/",\n "webhook_url_method": "POST",\n "webhook_urls": {\n "call.hangup": "https://www.example.com/webhooks/hangup",\n "call.bridge": "https://www.example.com/webhooks/bridge"\n },\n "webhook_urls_method": "POST"\n }\'',
11198
+ example: 'curl https://api.telnyx.com/v2/calls \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $TELNYX_API_KEY" \\\n -d \'{\n "connection_id": "7267xxxxxxxxxxxxxx",\n "from": "+18005550101",\n "to": "+18005550100 or sip:username@sip.telnyx.com;secure=srtp",\n "answering_machine_detection": "detect",\n "answering_machine_detection_config": {\n "after_greeting_silence_millis": 1000,\n "between_words_silence_millis": 1000,\n "greeting_duration_millis": 1000,\n "greeting_silence_duration_millis": 2000,\n "greeting_total_analysis_time_millis": 50000,\n "initial_silence_millis": 1000,\n "maximum_number_of_words": 1000,\n "maximum_word_length_millis": 2000,\n "silence_threshold": 512,\n "total_analysis_time_millis": 5000\n },\n "audio_url": "http://www.example.com/sounds/greeting.wav",\n "billing_group_id": "f5586561-8ff0-4291-a0ac-84fe544797bd",\n "bridge_intent": true,\n "bridge_on_answer": true,\n "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",\n "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",\n "conference_config": {\n "conference_name": "telnyx-conference",\n "start_conference_on_enter": true\n },\n "custom_headers": [\n {\n "name": "head_1",\n "value": "val_1"\n },\n {\n "name": "head_2",\n "value": "val_2"\n }\n ],\n "deepfake_detection": {\n "enabled": true,\n "rtp_timeout": 30,\n "timeout": 15\n },\n "dialogflow_config": {\n "analyze_sentiment": false,\n "partial_automated_agent_reply": false\n },\n "enable_dialogflow": false,\n "from_display_name": "Company Name",\n "link_to": "ilditnZK_eVysupV21KzmzN_sM29ygfauQojpm4BgFtfX5hXAcjotg==",\n "media_encryption": "SRTP",\n "media_name": "my_media_uploaded_to_media_storage_api",\n "park_after_unbridge": "self",\n "preferred_codecs": "G722,PCMU,PCMA,G729,OPUS,VP8,H264",\n "prevent_double_bridge": true,\n "privacy": "id",\n "record": "record-from-answer",\n "record_channels": "single",\n "record_custom_file_name": "my_recording_file_name",\n "record_format": "wav",\n "record_max_length": 1000,\n "record_timeout_secs": 100,\n "record_track": "outbound",\n "record_trim": "trim-silence",\n "send_silence_when_idle": true,\n "sip_auth_password": "password",\n "sip_auth_username": "username",\n "sip_headers": [\n {\n "name": "User-to-User",\n "value": "12345"\n }\n ],\n "sip_region": "Canada",\n "sip_transport_protocol": "TLS",\n "sound_modifications": {\n "octaves": 0.1,\n "pitch": 0.8,\n "semitone": -2,\n "track": "both"\n },\n "stream_auth_token": "your-auth-token",\n "stream_bidirectional_codec": "G722",\n "stream_bidirectional_mode": "rtp",\n "stream_bidirectional_sampling_rate": 16000,\n "stream_bidirectional_target_legs": "both",\n "stream_codec": "PCMA",\n "stream_establish_before_call_originate": true,\n "stream_track": "both_tracks",\n "stream_url": "wss://www.example.com/websocket",\n "supervise_call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",\n "time_limit_secs": 60,\n "timeout_secs": 60,\n "transcription": true,\n "transcription_config": {\n "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",\n "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",\n "transcription_engine": "Google",\n "transcription_engine_config": {\n "language": "en",\n "transcription_engine": "Google"\n }\n },\n "webhook_retries_policies": {\n "call.hangup": {\n "retries_ms": [\n 1000,\n 2000,\n 5000\n ]\n }\n },\n "webhook_url": "https://www.example.com/server-b/",\n "webhook_url_method": "POST",\n "webhook_urls": {\n "call.hangup": "https://www.example.com/webhooks/hangup",\n "call.bridge": "https://www.example.com/webhooks/bridge"\n },\n "webhook_urls_method": "POST"\n }\'',
11199
11199
  },
11200
11200
  },
11201
11201
  },
@@ -13159,38 +13159,38 @@ const EMBEDDED_METHODS = [
13159
13159
  "webhook_urls_method?: 'POST' | 'GET';",
13160
13160
  ],
13161
13161
  response: '{ data?: { result?: string; }; }',
13162
- markdown: "## transfer\n\n`client.calls.actions.transfer(call_control_id: string, to: string, answering_machine_detection?: 'premium' | 'detect' | 'detect_beep' | 'detect_words' | 'greeting_end' | 'disabled', answering_machine_detection_config?: { after_greeting_silence_millis?: number; between_words_silence_millis?: number; greeting_duration_millis?: number; greeting_silence_duration_millis?: number; greeting_total_analysis_time_millis?: number; initial_silence_millis?: number; maximum_number_of_words?: number; maximum_word_length_millis?: number; silence_threshold?: number; total_analysis_time_millis?: number; }, audio_url?: string, client_state?: string, command_id?: string, custom_headers?: { name: string; value: string; }[], early_media?: boolean, from?: string, from_display_name?: string, media_encryption?: 'disabled' | 'SRTP' | 'DTLS', media_name?: string, mute_dtmf?: 'none' | 'both' | 'self' | 'opposite', park_after_unbridge?: string, preferred_codecs?: string, privacy?: 'id' | 'none', record?: 'record-from-answer', record_channels?: 'single' | 'dual', record_custom_file_name?: string, record_format?: 'wav' | 'mp3', record_max_length?: number, record_timeout_secs?: number, record_track?: 'both' | 'inbound' | 'outbound', record_trim?: 'trim-silence', sip_auth_password?: string, sip_auth_username?: string, sip_headers?: { name: 'User-to-User'; value: string; }[], sip_region?: 'US' | 'Europe' | 'Canada' | 'Australia' | 'Middle East', sip_transport_protocol?: 'UDP' | 'TCP' | 'TLS', sound_modifications?: { octaves?: number; pitch?: number; semitone?: number; track?: string; }, target_leg_client_state?: string, time_limit_secs?: number, timeout_secs?: number, webhook_retries_policies?: object, webhook_url?: string, webhook_url_method?: 'POST' | 'GET', webhook_urls?: object, webhook_urls_method?: 'POST' | 'GET'): { data?: call_control_command_result; }`\n\n**post** `/calls/{call_control_id}/actions/transfer`\n\nTransfer a call to a new destination. If the transfer is unsuccessful, a `call.hangup` webhook for the other call (Leg B) will be sent indicating that the transfer could not be completed. The original call will remain active and may be issued additional commands, potentially transfering the call to an alternate destination.\n\n**Expected Webhooks:**\n\n- `call.initiated`\n- `call.bridged` to Leg B\n- `call.answered` or `call.hangup`\n- `call.machine.detection.ended` if `answering_machine_detection` was requested\n- `call.machine.greeting.ended` if `answering_machine_detection` was requested to detect the end of machine greeting\n- `call.machine.premium.detection.ended` if `answering_machine_detection=premium` was requested\n- `call.machine.premium.greeting.ended` if `answering_machine_detection=premium` was requested and a beep was detected\n\n\n### Parameters\n\n- `call_control_id: string`\n\n- `to: string`\n The DID or SIP URI to dial out to.\n\n- `answering_machine_detection?: 'premium' | 'detect' | 'detect_beep' | 'detect_words' | 'greeting_end' | 'disabled'`\n Enables Answering Machine Detection. When a call is answered, Telnyx runs real-time detection to determine if it was picked up by a human or a machine and sends an `call.machine.detection.ended` webhook with the analysis result. If 'greeting_end' or 'detect_words' is used and a 'machine' is detected, you will receive another 'call.machine.greeting.ended' webhook when the answering machine greeting ends with a beep or silence. If `detect_beep` is used, you will only receive 'call.machine.greeting.ended' if a beep is detected.\n\n- `answering_machine_detection_config?: { after_greeting_silence_millis?: number; between_words_silence_millis?: number; greeting_duration_millis?: number; greeting_silence_duration_millis?: number; greeting_total_analysis_time_millis?: number; initial_silence_millis?: number; maximum_number_of_words?: number; maximum_word_length_millis?: number; silence_threshold?: number; total_analysis_time_millis?: number; }`\n Optional configuration parameters to modify 'answering_machine_detection' performance. Only `total_analysis_time_millis` and `greeting_duration_millis` parameters are applicable when `premium` is selected as answering_machine_detection.\n - `after_greeting_silence_millis?: number`\n Silence duration threshold after a greeting message or voice for it be considered human.\n - `between_words_silence_millis?: number`\n Maximum threshold for silence between words.\n - `greeting_duration_millis?: number`\n Maximum threshold of a human greeting. If greeting longer than this value, considered machine.\n - `greeting_silence_duration_millis?: number`\n If machine already detected, maximum threshold for silence between words. If exceeded, the greeting is considered ended.\n - `greeting_total_analysis_time_millis?: number`\n If machine already detected, maximum timeout threshold to determine the end of the machine greeting.\n - `initial_silence_millis?: number`\n If initial silence duration is greater than this value, consider it a machine.\n - `maximum_number_of_words?: number`\n If number of detected words is greater than this value, consder it a machine.\n - `maximum_word_length_millis?: number`\n If a single word lasts longer than this threshold, consider it a machine.\n - `silence_threshold?: number`\n Minimum noise threshold for any analysis.\n - `total_analysis_time_millis?: number`\n Maximum timeout threshold for overall detection.\n\n- `audio_url?: string`\n The URL of a file to be played back when the transfer destination answers before bridging the call. The URL can point to either a WAV or MP3 file. media_name and audio_url cannot be used together in one request.\n\n- `client_state?: string`\n Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string.\n\n- `command_id?: string`\n Use this field to avoid duplicate commands. Telnyx will ignore any command with the same `command_id` for the same `call_control_id`.\n\n- `custom_headers?: { name: string; value: string; }[]`\n Custom headers to be added to the SIP INVITE.\n\n- `early_media?: boolean`\n If set to false, early media will not be passed to the originating leg.\n\n- `from?: string`\n The `from` number to be used as the caller id presented to the destination (`to` number). The number should be in +E164 format. This attribute will default to the `to` number of the original call if omitted.\n\n- `from_display_name?: string`\n The `from_display_name` string to be used as the caller id name (SIP From Display Name) presented to the destination (`to` number). The string should have a maximum of 128 characters, containing only letters, numbers, spaces, and -_~!.+ special characters. If ommited, the display name will be the same as the number in the `from` field.\n\n- `media_encryption?: 'disabled' | 'SRTP' | 'DTLS'`\n Defines whether media should be encrypted on the new call leg.\n\n- `media_name?: string`\n The media_name of a file to be played back when the transfer destination answers before bridging the call. The media_name must point to a file previously uploaded to api.telnyx.com/v2/media by the same user/organization. The file must either be a WAV or MP3 file.\n\n- `mute_dtmf?: 'none' | 'both' | 'self' | 'opposite'`\n When enabled, DTMF tones are not passed to the call participant. The webhooks containing the DTMF information will be sent.\n\n- `park_after_unbridge?: string`\n Specifies behavior after the bridge ends (i.e. the opposite leg either hangs up or is transferred). If supplied with the value `self`, the current leg will be parked after unbridge. If not set, the default behavior is to hang up the leg.\n\n- `preferred_codecs?: string`\n The list of comma-separated codecs in order of preference to be used during the call. The codecs supported are `G722`, `PCMU`, `PCMA`, `G729`, `OPUS`, `VP8`, `H264`, `AMR-WB`.\n\n- `privacy?: 'id' | 'none'`\n Indicates the privacy level to be used for the call. When set to `id`, caller ID information (name and number) will be hidden from the called party. When set to `none` or omitted, caller ID will be shown normally.\n\n- `record?: 'record-from-answer'`\n Start recording automatically after an event. Disabled by default.\n\n- `record_channels?: 'single' | 'dual'`\n Defines which channel should be recorded ('single' or 'dual') when `record` is specified.\n\n- `record_custom_file_name?: string`\n The custom recording file name to be used instead of the default `call_leg_id`. Telnyx will still add a Unix timestamp suffix.\n\n- `record_format?: 'wav' | 'mp3'`\n Defines the format of the recording ('wav' or 'mp3') when `record` is specified.\n\n- `record_max_length?: number`\n Defines the maximum length for the recording in seconds when `record` is specified. The minimum value is 0. The maximum value is 43200. The default value is 0 (infinite).\n\n- `record_timeout_secs?: number`\n The number of seconds that Telnyx will wait for the recording to be stopped if silence is detected when `record` is specified. The timer only starts when the speech is detected. Please note that call transcription is used to detect silence and the related charge will be applied. The minimum value is 0. The default value is 0 (infinite).\n\n- `record_track?: 'both' | 'inbound' | 'outbound'`\n The audio track to be recorded. Can be either `both`, `inbound` or `outbound`. If only single track is specified (`inbound`, `outbound`), `channels` configuration is ignored and it will be recorded as mono (single channel).\n\n- `record_trim?: 'trim-silence'`\n When set to `trim-silence`, silence will be removed from the beginning and end of the recording.\n\n- `sip_auth_password?: string`\n SIP Authentication password used for SIP challenges.\n\n- `sip_auth_username?: string`\n SIP Authentication username used for SIP challenges.\n\n- `sip_headers?: { name: 'User-to-User'; value: string; }[]`\n SIP headers to be added to the SIP INVITE. Currently only User-to-User header is supported.\n\n- `sip_region?: 'US' | 'Europe' | 'Canada' | 'Australia' | 'Middle East'`\n Defines the SIP region to be used for the call.\n\n- `sip_transport_protocol?: 'UDP' | 'TCP' | 'TLS'`\n Defines SIP transport protocol to be used on the call.\n\n- `sound_modifications?: { octaves?: number; pitch?: number; semitone?: number; track?: string; }`\n Use this field to modify sound effects, for example adjust the pitch.\n - `octaves?: number`\n Adjust the pitch in octaves, values should be between -1 and 1, default 0\n - `pitch?: number`\n Set the pitch directly, value should be > 0, default 1 (lower = lower tone)\n - `semitone?: number`\n Adjust the pitch in semitones, values should be between -14 and 14, default 0\n - `track?: string`\n The track to which the sound modifications will be applied. Accepted values are `inbound` or `outbound`\n\n- `target_leg_client_state?: string`\n Use this field to add state to every subsequent webhook for the new leg. It must be a valid Base-64 encoded string.\n\n- `time_limit_secs?: number`\n Sets the maximum duration of a Call Control Leg in seconds. If the time limit is reached, the call will hangup and a `call.hangup` webhook with a `hangup_cause` of `time_limit` will be sent. For example, by setting a time limit of 120 seconds, a Call Leg will be automatically terminated two minutes after being answered. The default time limit is 14400 seconds or 4 hours and this is also the maximum allowed call length.\n\n- `timeout_secs?: number`\n The number of seconds that Telnyx will wait for the call to be answered by the destination to which it is being transferred. If the timeout is reached before an answer is received, the call will hangup and a `call.hangup` webhook with a `hangup_cause` of `timeout` will be sent. Minimum value is 5 seconds. Maximum value is 600 seconds.\n\n- `webhook_retries_policies?: object`\n A map of event types to retry policies. Each retry policy contains an array of `retries_ms` specifying the delays between retry attempts in milliseconds. Maximum 5 retries, total delay cannot exceed 60 seconds.\n\n- `webhook_url?: string`\n Use this field to override the URL for which Telnyx will send subsequent webhooks to for this call.\n\n- `webhook_url_method?: 'POST' | 'GET'`\n HTTP request type used for `webhook_url`.\n\n- `webhook_urls?: object`\n A map of event types to webhook URLs. When an event of the specified type occurs, the webhook URL associated with that event type will be called instead of `webhook_url`. Events not mapped here will use the default `webhook_url`.\n\n- `webhook_urls_method?: 'POST' | 'GET'`\n HTTP request method to invoke `webhook_urls`.\n\n### Returns\n\n- `{ data?: { result?: string; }; }`\n\n - `data?: { result?: string; }`\n\n### Example\n\n```typescript\nimport Telnyx from 'telnyx';\n\nconst client = new Telnyx();\n\nconst response = await client.calls.actions.transfer('call_control_id', { to: '+18005550100 or sip:username@sip.telnyx.com' });\n\nconsole.log(response);\n```",
13162
+ markdown: "## transfer\n\n`client.calls.actions.transfer(call_control_id: string, to: string, answering_machine_detection?: 'premium' | 'detect' | 'detect_beep' | 'detect_words' | 'greeting_end' | 'disabled', answering_machine_detection_config?: { after_greeting_silence_millis?: number; between_words_silence_millis?: number; greeting_duration_millis?: number; greeting_silence_duration_millis?: number; greeting_total_analysis_time_millis?: number; initial_silence_millis?: number; maximum_number_of_words?: number; maximum_word_length_millis?: number; silence_threshold?: number; total_analysis_time_millis?: number; }, audio_url?: string, client_state?: string, command_id?: string, custom_headers?: { name: string; value: string; }[], early_media?: boolean, from?: string, from_display_name?: string, media_encryption?: 'disabled' | 'SRTP' | 'DTLS', media_name?: string, mute_dtmf?: 'none' | 'both' | 'self' | 'opposite', park_after_unbridge?: string, preferred_codecs?: string, privacy?: 'id' | 'none', record?: 'record-from-answer', record_channels?: 'single' | 'dual', record_custom_file_name?: string, record_format?: 'wav' | 'mp3', record_max_length?: number, record_timeout_secs?: number, record_track?: 'both' | 'inbound' | 'outbound', record_trim?: 'trim-silence', sip_auth_password?: string, sip_auth_username?: string, sip_headers?: { name: 'User-to-User'; value: string; }[], sip_region?: 'US' | 'Europe' | 'Canada' | 'Australia' | 'Middle East', sip_transport_protocol?: 'UDP' | 'TCP' | 'TLS', sound_modifications?: { octaves?: number; pitch?: number; semitone?: number; track?: string; }, target_leg_client_state?: string, time_limit_secs?: number, timeout_secs?: number, webhook_retries_policies?: object, webhook_url?: string, webhook_url_method?: 'POST' | 'GET', webhook_urls?: object, webhook_urls_method?: 'POST' | 'GET'): { data?: call_control_command_result; }`\n\n**post** `/calls/{call_control_id}/actions/transfer`\n\nTransfer a call to a new destination. If the transfer is unsuccessful, a `call.hangup` webhook for the other call (Leg B) will be sent indicating that the transfer could not be completed. The original call will remain active and may be issued additional commands, potentially transfering the call to an alternate destination.\n\n**Expected Webhooks:**\n\n- `call.initiated`\n- `call.bridged` to Leg B\n- `call.answered` or `call.hangup`\n- `call.machine.detection.ended` if `answering_machine_detection` was requested\n- `call.machine.greeting.ended` if `answering_machine_detection` was requested to detect the end of machine greeting\n- `call.machine.premium.detection.ended` if `answering_machine_detection=premium` was requested\n- `call.machine.premium.greeting.ended` if `answering_machine_detection=premium` was requested and a beep was detected\n\n\n### Parameters\n\n- `call_control_id: string`\n\n- `to: string`\n The DID or SIP URI to dial out to. For SIP URI destinations, append `;secure=true` or `;secure=srtp` to enable SRTP media encryption for that endpoint, or `;secure=dtls` to enable DTLS media encryption for that endpoint. If `media_encryption` is set to `SRTP` or `DTLS`, it takes precedence over any per-endpoint `secure` URI parameter.\n\n- `answering_machine_detection?: 'premium' | 'detect' | 'detect_beep' | 'detect_words' | 'greeting_end' | 'disabled'`\n Enables Answering Machine Detection. When a call is answered, Telnyx runs real-time detection to determine if it was picked up by a human or a machine and sends an `call.machine.detection.ended` webhook with the analysis result. If 'greeting_end' or 'detect_words' is used and a 'machine' is detected, you will receive another 'call.machine.greeting.ended' webhook when the answering machine greeting ends with a beep or silence. If `detect_beep` is used, you will only receive 'call.machine.greeting.ended' if a beep is detected.\n\n- `answering_machine_detection_config?: { after_greeting_silence_millis?: number; between_words_silence_millis?: number; greeting_duration_millis?: number; greeting_silence_duration_millis?: number; greeting_total_analysis_time_millis?: number; initial_silence_millis?: number; maximum_number_of_words?: number; maximum_word_length_millis?: number; silence_threshold?: number; total_analysis_time_millis?: number; }`\n Optional configuration parameters to modify 'answering_machine_detection' performance. Only `total_analysis_time_millis` and `greeting_duration_millis` parameters are applicable when `premium` is selected as answering_machine_detection.\n - `after_greeting_silence_millis?: number`\n Silence duration threshold after a greeting message or voice for it be considered human.\n - `between_words_silence_millis?: number`\n Maximum threshold for silence between words.\n - `greeting_duration_millis?: number`\n Maximum threshold of a human greeting. If greeting longer than this value, considered machine.\n - `greeting_silence_duration_millis?: number`\n If machine already detected, maximum threshold for silence between words. If exceeded, the greeting is considered ended.\n - `greeting_total_analysis_time_millis?: number`\n If machine already detected, maximum timeout threshold to determine the end of the machine greeting.\n - `initial_silence_millis?: number`\n If initial silence duration is greater than this value, consider it a machine.\n - `maximum_number_of_words?: number`\n If number of detected words is greater than this value, consder it a machine.\n - `maximum_word_length_millis?: number`\n If a single word lasts longer than this threshold, consider it a machine.\n - `silence_threshold?: number`\n Minimum noise threshold for any analysis.\n - `total_analysis_time_millis?: number`\n Maximum timeout threshold for overall detection.\n\n- `audio_url?: string`\n The URL of a file to be played back when the transfer destination answers before bridging the call. The URL can point to either a WAV or MP3 file. media_name and audio_url cannot be used together in one request.\n\n- `client_state?: string`\n Use this field to add state to every subsequent webhook. It must be a valid Base-64 encoded string.\n\n- `command_id?: string`\n Use this field to avoid duplicate commands. Telnyx will ignore any command with the same `command_id` for the same `call_control_id`.\n\n- `custom_headers?: { name: string; value: string; }[]`\n Custom headers to be added to the SIP INVITE.\n\n- `early_media?: boolean`\n If set to false, early media will not be passed to the originating leg.\n\n- `from?: string`\n The `from` number to be used as the caller id presented to the destination (`to` number). The number should be in +E164 format. This attribute will default to the `to` number of the original call if omitted.\n\n- `from_display_name?: string`\n The `from_display_name` string to be used as the caller id name (SIP From Display Name) presented to the destination (`to` number). The string should have a maximum of 128 characters, containing only letters, numbers, spaces, and -_~!.+ special characters. If ommited, the display name will be the same as the number in the `from` field.\n\n- `media_encryption?: 'disabled' | 'SRTP' | 'DTLS'`\n Defines whether media should be encrypted on the new call leg. For SIP URI destinations, media encryption can also be requested per endpoint with the `secure` URI parameter: `;secure=true` or `;secure=srtp` enables SRTP, and `;secure=dtls` enables DTLS. This parameter, when set to `SRTP` or `DTLS`, takes precedence over the per-endpoint `secure` value.\n\n- `media_name?: string`\n The media_name of a file to be played back when the transfer destination answers before bridging the call. The media_name must point to a file previously uploaded to api.telnyx.com/v2/media by the same user/organization. The file must either be a WAV or MP3 file.\n\n- `mute_dtmf?: 'none' | 'both' | 'self' | 'opposite'`\n When enabled, DTMF tones are not passed to the call participant. The webhooks containing the DTMF information will be sent.\n\n- `park_after_unbridge?: string`\n Specifies behavior after the bridge ends (i.e. the opposite leg either hangs up or is transferred). If supplied with the value `self`, the current leg will be parked after unbridge. If not set, the default behavior is to hang up the leg.\n\n- `preferred_codecs?: string`\n The list of comma-separated codecs in order of preference to be used during the call. The codecs supported are `G722`, `PCMU`, `PCMA`, `G729`, `OPUS`, `VP8`, `H264`, `AMR-WB`.\n\n- `privacy?: 'id' | 'none'`\n Indicates the privacy level to be used for the call. When set to `id`, caller ID information (name and number) will be hidden from the called party. When set to `none` or omitted, caller ID will be shown normally.\n\n- `record?: 'record-from-answer'`\n Start recording automatically after an event. Disabled by default.\n\n- `record_channels?: 'single' | 'dual'`\n Defines which channel should be recorded ('single' or 'dual') when `record` is specified.\n\n- `record_custom_file_name?: string`\n The custom recording file name to be used instead of the default `call_leg_id`. Telnyx will still add a Unix timestamp suffix.\n\n- `record_format?: 'wav' | 'mp3'`\n Defines the format of the recording ('wav' or 'mp3') when `record` is specified.\n\n- `record_max_length?: number`\n Defines the maximum length for the recording in seconds when `record` is specified. The minimum value is 0. The maximum value is 43200. The default value is 0 (infinite).\n\n- `record_timeout_secs?: number`\n The number of seconds that Telnyx will wait for the recording to be stopped if silence is detected when `record` is specified. The timer only starts when the speech is detected. Please note that call transcription is used to detect silence and the related charge will be applied. The minimum value is 0. The default value is 0 (infinite).\n\n- `record_track?: 'both' | 'inbound' | 'outbound'`\n The audio track to be recorded. Can be either `both`, `inbound` or `outbound`. If only single track is specified (`inbound`, `outbound`), `channels` configuration is ignored and it will be recorded as mono (single channel).\n\n- `record_trim?: 'trim-silence'`\n When set to `trim-silence`, silence will be removed from the beginning and end of the recording.\n\n- `sip_auth_password?: string`\n SIP Authentication password used for SIP challenges.\n\n- `sip_auth_username?: string`\n SIP Authentication username used for SIP challenges.\n\n- `sip_headers?: { name: 'User-to-User'; value: string; }[]`\n SIP headers to be added to the SIP INVITE. Currently only User-to-User header is supported.\n\n- `sip_region?: 'US' | 'Europe' | 'Canada' | 'Australia' | 'Middle East'`\n Defines the SIP region to be used for the call.\n\n- `sip_transport_protocol?: 'UDP' | 'TCP' | 'TLS'`\n Defines SIP transport protocol to be used on the call.\n\n- `sound_modifications?: { octaves?: number; pitch?: number; semitone?: number; track?: string; }`\n Use this field to modify sound effects, for example adjust the pitch.\n - `octaves?: number`\n Adjust the pitch in octaves, values should be between -1 and 1, default 0\n - `pitch?: number`\n Set the pitch directly, value should be > 0, default 1 (lower = lower tone)\n - `semitone?: number`\n Adjust the pitch in semitones, values should be between -14 and 14, default 0\n - `track?: string`\n The track to which the sound modifications will be applied. Accepted values are `inbound` or `outbound`\n\n- `target_leg_client_state?: string`\n Use this field to add state to every subsequent webhook for the new leg. It must be a valid Base-64 encoded string.\n\n- `time_limit_secs?: number`\n Sets the maximum duration of a Call Control Leg in seconds. If the time limit is reached, the call will hangup and a `call.hangup` webhook with a `hangup_cause` of `time_limit` will be sent. For example, by setting a time limit of 120 seconds, a Call Leg will be automatically terminated two minutes after being answered. The default time limit is 14400 seconds or 4 hours and this is also the maximum allowed call length.\n\n- `timeout_secs?: number`\n The number of seconds that Telnyx will wait for the call to be answered by the destination to which it is being transferred. If the timeout is reached before an answer is received, the call will hangup and a `call.hangup` webhook with a `hangup_cause` of `timeout` will be sent. Minimum value is 5 seconds. Maximum value is 600 seconds.\n\n- `webhook_retries_policies?: object`\n A map of event types to retry policies. Each retry policy contains an array of `retries_ms` specifying the delays between retry attempts in milliseconds. Maximum 5 retries, total delay cannot exceed 60 seconds.\n\n- `webhook_url?: string`\n Use this field to override the URL for which Telnyx will send subsequent webhooks to for this call.\n\n- `webhook_url_method?: 'POST' | 'GET'`\n HTTP request type used for `webhook_url`.\n\n- `webhook_urls?: object`\n A map of event types to webhook URLs. When an event of the specified type occurs, the webhook URL associated with that event type will be called instead of `webhook_url`. Events not mapped here will use the default `webhook_url`.\n\n- `webhook_urls_method?: 'POST' | 'GET'`\n HTTP request method to invoke `webhook_urls`.\n\n### Returns\n\n- `{ data?: { result?: string; }; }`\n\n - `data?: { result?: string; }`\n\n### Example\n\n```typescript\nimport Telnyx from 'telnyx';\n\nconst client = new Telnyx();\n\nconst response = await client.calls.actions.transfer('call_control_id', { to: '+18005550100 or sip:username@sip.telnyx.com;secure=srtp' });\n\nconsole.log(response);\n```",
13163
13163
  perLanguage: {
13164
13164
  typescript: {
13165
13165
  method: 'client.calls.actions.transfer',
13166
- example: "import Telnyx from 'telnyx';\n\nconst client = new Telnyx({\n apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.calls.actions.transfer('call_control_id', {\n to: '+18005550100 or sip:username@sip.telnyx.com',\n});\n\nconsole.log(response.data);",
13166
+ example: "import Telnyx from 'telnyx';\n\nconst client = new Telnyx({\n apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.calls.actions.transfer('call_control_id', {\n to: '+18005550100 or sip:username@sip.telnyx.com;secure=srtp',\n});\n\nconsole.log(response.data);",
13167
13167
  },
13168
13168
  python: {
13169
13169
  method: 'calls.actions.transfer',
13170
- example: 'import os\nfrom telnyx import Telnyx\n\nclient = Telnyx(\n api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.calls.actions.transfer(\n call_control_id="call_control_id",\n to="+18005550100 or sip:username@sip.telnyx.com",\n)\nprint(response.data)',
13170
+ example: 'import os\nfrom telnyx import Telnyx\n\nclient = Telnyx(\n api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.calls.actions.transfer(\n call_control_id="call_control_id",\n to="+18005550100 or sip:username@sip.telnyx.com;secure=srtp",\n)\nprint(response.data)',
13171
13171
  },
13172
13172
  java: {
13173
13173
  method: 'calls().actions().transfer',
13174
- example: 'package com.telnyx.sdk.example;\n\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport com.telnyx.sdk.models.calls.actions.ActionTransferParams;\nimport com.telnyx.sdk.models.calls.actions.ActionTransferResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n TelnyxClient client = TelnyxOkHttpClient.fromEnv();\n\n ActionTransferParams params = ActionTransferParams.builder()\n .callControlId("call_control_id")\n .to("+18005550100 or sip:username@sip.telnyx.com")\n .build();\n ActionTransferResponse response = client.calls().actions().transfer(params);\n }\n}',
13174
+ example: 'package com.telnyx.sdk.example;\n\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport com.telnyx.sdk.models.calls.actions.ActionTransferParams;\nimport com.telnyx.sdk.models.calls.actions.ActionTransferResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n TelnyxClient client = TelnyxOkHttpClient.fromEnv();\n\n ActionTransferParams params = ActionTransferParams.builder()\n .callControlId("call_control_id")\n .to("+18005550100 or sip:username@sip.telnyx.com;secure=srtp")\n .build();\n ActionTransferResponse response = client.calls().actions().transfer(params);\n }\n}',
13175
13175
  },
13176
13176
  go: {
13177
13177
  method: 'client.Calls.Actions.Transfer',
13178
- example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/team-telnyx/telnyx-go"\n\t"github.com/team-telnyx/telnyx-go/option"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Calls.Actions.Transfer(\n\t\tcontext.TODO(),\n\t\t"call_control_id",\n\t\ttelnyx.CallActionTransferParams{\n\t\t\tTo: "+18005550100 or sip:username@sip.telnyx.com",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.Data)\n}\n',
13178
+ example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/team-telnyx/telnyx-go"\n\t"github.com/team-telnyx/telnyx-go/option"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Calls.Actions.Transfer(\n\t\tcontext.TODO(),\n\t\t"call_control_id",\n\t\ttelnyx.CallActionTransferParams{\n\t\t\tTo: "+18005550100 or sip:username@sip.telnyx.com;secure=srtp",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.Data)\n}\n',
13179
13179
  },
13180
13180
  ruby: {
13181
13181
  method: 'calls.actions.transfer',
13182
- example: 'require "telnyx"\n\ntelnyx = Telnyx::Client.new(api_key: "My API Key")\n\nresponse = telnyx.calls.actions.transfer("call_control_id", to: "+18005550100 or sip:username@sip.telnyx.com")\n\nputs(response)',
13182
+ example: 'require "telnyx"\n\ntelnyx = Telnyx::Client.new(api_key: "My API Key")\n\nresponse = telnyx.calls.actions.transfer(\n "call_control_id",\n to: "+18005550100 or sip:username@sip.telnyx.com;secure=srtp"\n)\n\nputs(response)',
13183
13183
  },
13184
13184
  cli: {
13185
13185
  method: 'actions transfer',
13186
- example: "telnyx calls:actions transfer \\\n --api-key 'My API Key' \\\n --call-control-id call_control_id \\\n --to '+18005550100 or sip:username@sip.telnyx.com'",
13186
+ example: "telnyx calls:actions transfer \\\n --api-key 'My API Key' \\\n --call-control-id call_control_id \\\n --to '+18005550100 or sip:username@sip.telnyx.com;secure=srtp'",
13187
13187
  },
13188
13188
  php: {
13189
13189
  method: 'calls->actions->transfer',
13190
- example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->calls->actions->transfer(\n 'call_control_id',\n to: '+18005550100 or sip:username@sip.telnyx.com',\n answeringMachineDetection: 'detect',\n answeringMachineDetectionConfig: [\n 'afterGreetingSilenceMillis' => 1000,\n 'betweenWordsSilenceMillis' => 1000,\n 'greetingDurationMillis' => 1000,\n 'greetingSilenceDurationMillis' => 2000,\n 'greetingTotalAnalysisTimeMillis' => 50000,\n 'initialSilenceMillis' => 1000,\n 'maximumNumberOfWords' => 1000,\n 'maximumWordLengthMillis' => 2000,\n 'silenceThreshold' => 512,\n 'totalAnalysisTimeMillis' => 5000,\n ],\n audioURL: 'http://www.example.com/sounds/greeting.wav',\n clientState: 'aGF2ZSBhIG5pY2UgZGF5ID1d',\n commandID: '891510ac-f3e4-11e8-af5b-de00688a4901',\n customHeaders: [\n ['name' => 'head_1', 'value' => 'val_1'],\n ['name' => 'head_2', 'value' => 'val_2'],\n ],\n earlyMedia: true,\n from: '+18005550101',\n fromDisplayName: 'Company Name',\n mediaEncryption: 'SRTP',\n mediaName: 'my_media_uploaded_to_media_storage_api',\n muteDtmf: 'opposite',\n parkAfterUnbridge: 'self',\n preferredCodecs: 'G722,PCMU,PCMA,G729,OPUS,VP8,H264',\n privacy: 'id',\n record: 'record-from-answer',\n recordChannels: 'single',\n recordCustomFileName: 'my_recording_file_name',\n recordFormat: 'wav',\n recordMaxLength: 1000,\n recordTimeoutSecs: 100,\n recordTrack: 'outbound',\n recordTrim: 'trim-silence',\n sipAuthPassword: 'password',\n sipAuthUsername: 'username',\n sipHeaders: [['name' => 'User-to-User', 'value' => 'value']],\n sipRegion: 'Canada',\n sipTransportProtocol: 'TLS',\n soundModifications: [\n 'octaves' => 0.1, 'pitch' => 0.8, 'semitone' => -2, 'track' => 'both'\n ],\n targetLegClientState: 'aGF2ZSBhIG5pY2UgZGF5ID1d',\n timeLimitSecs: 60,\n timeoutSecs: 60,\n webhookRetriesPolicies: [\n 'call.answered' => ['retriesMs' => [1000, 2000, 5000]]\n ],\n webhookURL: 'https://www.example.com/server-b/',\n webhookURLMethod: 'POST',\n webhookURLs: [\n 'call.answered' => 'https://www.example.com/webhooks/answered',\n 'call.hangup' => 'https://www.example.com/webhooks/hangup',\n ],\n webhookURLsMethod: 'POST',\n);\n\nvar_dump($response);",
13190
+ example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->calls->actions->transfer(\n 'call_control_id',\n to: '+18005550100 or sip:username@sip.telnyx.com;secure=srtp',\n answeringMachineDetection: 'detect',\n answeringMachineDetectionConfig: [\n 'afterGreetingSilenceMillis' => 1000,\n 'betweenWordsSilenceMillis' => 1000,\n 'greetingDurationMillis' => 1000,\n 'greetingSilenceDurationMillis' => 2000,\n 'greetingTotalAnalysisTimeMillis' => 50000,\n 'initialSilenceMillis' => 1000,\n 'maximumNumberOfWords' => 1000,\n 'maximumWordLengthMillis' => 2000,\n 'silenceThreshold' => 512,\n 'totalAnalysisTimeMillis' => 5000,\n ],\n audioURL: 'http://www.example.com/sounds/greeting.wav',\n clientState: 'aGF2ZSBhIG5pY2UgZGF5ID1d',\n commandID: '891510ac-f3e4-11e8-af5b-de00688a4901',\n customHeaders: [\n ['name' => 'head_1', 'value' => 'val_1'],\n ['name' => 'head_2', 'value' => 'val_2'],\n ],\n earlyMedia: true,\n from: '+18005550101',\n fromDisplayName: 'Company Name',\n mediaEncryption: 'SRTP',\n mediaName: 'my_media_uploaded_to_media_storage_api',\n muteDtmf: 'opposite',\n parkAfterUnbridge: 'self',\n preferredCodecs: 'G722,PCMU,PCMA,G729,OPUS,VP8,H264',\n privacy: 'id',\n record: 'record-from-answer',\n recordChannels: 'single',\n recordCustomFileName: 'my_recording_file_name',\n recordFormat: 'wav',\n recordMaxLength: 1000,\n recordTimeoutSecs: 100,\n recordTrack: 'outbound',\n recordTrim: 'trim-silence',\n sipAuthPassword: 'password',\n sipAuthUsername: 'username',\n sipHeaders: [['name' => 'User-to-User', 'value' => 'value']],\n sipRegion: 'Canada',\n sipTransportProtocol: 'TLS',\n soundModifications: [\n 'octaves' => 0.1, 'pitch' => 0.8, 'semitone' => -2, 'track' => 'both'\n ],\n targetLegClientState: 'aGF2ZSBhIG5pY2UgZGF5ID1d',\n timeLimitSecs: 60,\n timeoutSecs: 60,\n webhookRetriesPolicies: [\n 'call.answered' => ['retriesMs' => [1000, 2000, 5000]]\n ],\n webhookURL: 'https://www.example.com/server-b/',\n webhookURLMethod: 'POST',\n webhookURLs: [\n 'call.answered' => 'https://www.example.com/webhooks/answered',\n 'call.hangup' => 'https://www.example.com/webhooks/hangup',\n ],\n webhookURLsMethod: 'POST',\n);\n\nvar_dump($response);",
13191
13191
  },
13192
13192
  http: {
13193
- example: 'curl https://api.telnyx.com/v2/calls/$CALL_CONTROL_ID/actions/transfer \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $TELNYX_API_KEY" \\\n -d \'{\n "to": "+18005550100 or sip:username@sip.telnyx.com",\n "answering_machine_detection": "detect",\n "answering_machine_detection_config": {\n "after_greeting_silence_millis": 1000,\n "between_words_silence_millis": 1000,\n "greeting_duration_millis": 1000,\n "greeting_silence_duration_millis": 2000,\n "greeting_total_analysis_time_millis": 50000,\n "initial_silence_millis": 1000,\n "maximum_number_of_words": 1000,\n "maximum_word_length_millis": 2000,\n "silence_threshold": 512,\n "total_analysis_time_millis": 5000\n },\n "audio_url": "http://www.example.com/sounds/greeting.wav",\n "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",\n "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",\n "custom_headers": [\n {\n "name": "head_1",\n "value": "val_1"\n },\n {\n "name": "head_2",\n "value": "val_2"\n }\n ],\n "early_media": true,\n "from": "+18005550101",\n "from_display_name": "Company Name",\n "media_encryption": "SRTP",\n "media_name": "my_media_uploaded_to_media_storage_api",\n "mute_dtmf": "opposite",\n "park_after_unbridge": "self",\n "preferred_codecs": "G722,PCMU,PCMA,G729,OPUS,VP8,H264",\n "privacy": "id",\n "record": "record-from-answer",\n "record_channels": "single",\n "record_custom_file_name": "my_recording_file_name",\n "record_format": "wav",\n "record_max_length": 1000,\n "record_timeout_secs": 100,\n "record_track": "outbound",\n "record_trim": "trim-silence",\n "sip_auth_password": "password",\n "sip_auth_username": "username",\n "sip_headers": [\n {\n "name": "User-to-User",\n "value": "value"\n }\n ],\n "sip_region": "Canada",\n "sip_transport_protocol": "TLS",\n "sound_modifications": {\n "octaves": 0.1,\n "pitch": 0.8,\n "semitone": -2,\n "track": "both"\n },\n "target_leg_client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",\n "time_limit_secs": 60,\n "timeout_secs": 60,\n "webhook_retries_policies": {\n "call.answered": {\n "retries_ms": [\n 1000,\n 2000,\n 5000\n ]\n }\n },\n "webhook_url": "https://www.example.com/server-b/",\n "webhook_url_method": "POST",\n "webhook_urls": {\n "call.answered": "https://www.example.com/webhooks/answered",\n "call.hangup": "https://www.example.com/webhooks/hangup"\n },\n "webhook_urls_method": "POST"\n }\'',
13193
+ example: 'curl https://api.telnyx.com/v2/calls/$CALL_CONTROL_ID/actions/transfer \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $TELNYX_API_KEY" \\\n -d \'{\n "to": "+18005550100 or sip:username@sip.telnyx.com;secure=srtp",\n "answering_machine_detection": "detect",\n "answering_machine_detection_config": {\n "after_greeting_silence_millis": 1000,\n "between_words_silence_millis": 1000,\n "greeting_duration_millis": 1000,\n "greeting_silence_duration_millis": 2000,\n "greeting_total_analysis_time_millis": 50000,\n "initial_silence_millis": 1000,\n "maximum_number_of_words": 1000,\n "maximum_word_length_millis": 2000,\n "silence_threshold": 512,\n "total_analysis_time_millis": 5000\n },\n "audio_url": "http://www.example.com/sounds/greeting.wav",\n "client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",\n "command_id": "891510ac-f3e4-11e8-af5b-de00688a4901",\n "custom_headers": [\n {\n "name": "head_1",\n "value": "val_1"\n },\n {\n "name": "head_2",\n "value": "val_2"\n }\n ],\n "early_media": true,\n "from": "+18005550101",\n "from_display_name": "Company Name",\n "media_encryption": "SRTP",\n "media_name": "my_media_uploaded_to_media_storage_api",\n "mute_dtmf": "opposite",\n "park_after_unbridge": "self",\n "preferred_codecs": "G722,PCMU,PCMA,G729,OPUS,VP8,H264",\n "privacy": "id",\n "record": "record-from-answer",\n "record_channels": "single",\n "record_custom_file_name": "my_recording_file_name",\n "record_format": "wav",\n "record_max_length": 1000,\n "record_timeout_secs": 100,\n "record_track": "outbound",\n "record_trim": "trim-silence",\n "sip_auth_password": "password",\n "sip_auth_username": "username",\n "sip_headers": [\n {\n "name": "User-to-User",\n "value": "value"\n }\n ],\n "sip_region": "Canada",\n "sip_transport_protocol": "TLS",\n "sound_modifications": {\n "octaves": 0.1,\n "pitch": 0.8,\n "semitone": -2,\n "track": "both"\n },\n "target_leg_client_state": "aGF2ZSBhIG5pY2UgZGF5ID1d",\n "time_limit_secs": 60,\n "timeout_secs": 60,\n "webhook_retries_policies": {\n "call.answered": {\n "retries_ms": [\n 1000,\n 2000,\n 5000\n ]\n }\n },\n "webhook_url": "https://www.example.com/server-b/",\n "webhook_url_method": "POST",\n "webhook_urls": {\n "call.answered": "https://www.example.com/webhooks/answered",\n "call.hangup": "https://www.example.com/webhooks/hangup"\n },\n "webhook_urls_method": "POST"\n }\'',
13194
13194
  },
13195
13195
  },
13196
13196
  },
@@ -49948,7 +49948,7 @@ const EMBEDDED_READMES = [
49948
49948
  },
49949
49949
  {
49950
49950
  language: 'java',
49951
- content: '# Telnyx Java API Library\n\n<!-- x-release-please-start-version -->\n[![Maven Central](https://img.shields.io/maven-central/v/com.telnyx.sdk/telnyx)](https://central.sonatype.com/artifact/com.telnyx.sdk/telnyx/0.0.1)\n\n<!-- x-release-please-end -->\n\nThe Telnyx Java SDK provides convenient access to the Telnyx REST API from applications written in Java.\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Telnyx MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=telnyx-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsInRlbG55eC1tY3AiXSwiZW52Ijp7IlRFTE5ZWF9BUElfS0VZIjoiTXkgQVBJIEtleSIsIlRFTE5ZWF9QVUJMSUNfS0VZIjoiTXkgUHVibGljIEtleSIsIlRFTE5ZWF9DTElFTlRfSUQiOiJNeSBDbGllbnQgSUQiLCJURUxOWVhfQ0xJRU5UX1NFQ1JFVCI6Ik15IENsaWVudCBTZWNyZXQifX0)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22telnyx-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22telnyx-mcp%22%5D%2C%22env%22%3A%7B%22TELNYX_API_KEY%22%3A%22My%20API%20Key%22%2C%22TELNYX_PUBLIC_KEY%22%3A%22My%20Public%20Key%22%2C%22TELNYX_CLIENT_ID%22%3A%22My%20Client%20ID%22%2C%22TELNYX_CLIENT_SECRET%22%3A%22My%20Client%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n\n\n## Installation\n\n<!-- x-release-please-start-version -->\n\n### Gradle\n\n~~~kotlin\nimplementation("com.telnyx.sdk:telnyx:0.0.1")\n~~~\n\n### Maven\n\n~~~xml\n<dependency>\n <groupId>com.telnyx.sdk</groupId>\n <artifactId>telnyx</artifactId>\n <version>0.0.1</version>\n</dependency>\n~~~\n\n<!-- x-release-please-end -->\n\n## Requirements\n\nThis library requires Java 8 or later.\n\n## Usage\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport com.telnyx.sdk.models.calls.CallDialParams;\nimport com.telnyx.sdk.models.calls.CallDialResponse;\n\n// Configures using the `telnyx.apiKey`, `telnyx.publicKey`, `telnyx.clientId`, `telnyx.clientSecret` and `telnyx.baseUrl` system properties\n// Or configures using the `TELNYX_API_KEY`, `TELNYX_PUBLIC_KEY`, `TELNYX_CLIENT_ID`, `TELNYX_CLIENT_SECRET` and `TELNYX_BASE_URL` environment variables\nTelnyxClient client = TelnyxOkHttpClient.fromEnv();\n\nCallDialParams params = CallDialParams.builder()\n .connectionId("conn12345")\n .from("+15557654321")\n .to("+15551234567")\n .webhookUrl("https://your-webhook.url/events")\n .build();\nCallDialResponse response = client.calls().dial(params);\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\n\n// Configures using the `telnyx.apiKey`, `telnyx.publicKey`, `telnyx.clientId`, `telnyx.clientSecret` and `telnyx.baseUrl` system properties\n// Or configures using the `TELNYX_API_KEY`, `TELNYX_PUBLIC_KEY`, `TELNYX_CLIENT_ID`, `TELNYX_CLIENT_SECRET` and `TELNYX_BASE_URL` environment variables\nTelnyxClient client = TelnyxOkHttpClient.fromEnv();\n```\n\nOr manually:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .apiKey("My API Key")\n .build();\n```\n\nOr using a combination of the two approaches:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n // Configures using the `telnyx.apiKey`, `telnyx.publicKey`, `telnyx.clientId`, `telnyx.clientSecret` and `telnyx.baseUrl` system properties\n // Or configures using the `TELNYX_API_KEY`, `TELNYX_PUBLIC_KEY`, `TELNYX_CLIENT_ID`, `TELNYX_CLIENT_SECRET` and `TELNYX_BASE_URL` environment variables\n .fromEnv()\n .apiKey("My API Key")\n .build();\n```\n\nSee this table for the available options:\n\n| Setter | System property | Environment variable | Required | Default value |\n| -------------- | --------------------- | ---------------------- | -------- | ----------------------------- |\n| `apiKey` | `telnyx.apiKey` | `TELNYX_API_KEY` | false | - |\n| `publicKey` | `telnyx.publicKey` | `TELNYX_PUBLIC_KEY` | false | - |\n| `clientId` | `telnyx.clientId` | `TELNYX_CLIENT_ID` | false | - |\n| `clientSecret` | `telnyx.clientSecret` | `TELNYX_CLIENT_SECRET` | false | - |\n| `baseUrl` | `telnyx.baseUrl` | `TELNYX_BASE_URL` | true | `"https://api.telnyx.com/v2"` |\n\nSystem properties take precedence over environment variables.\n\n> [!TIP]\n> Don\'t create more than one client in the same application. Each client has a connection pool and\n> thread pools, which are more efficient to share between requests.\n\n### Modifying configuration\n\nTo temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\n\nTelnyxClient clientWithOptions = client.withOptions(optionsBuilder -> {\n optionsBuilder.baseUrl("https://example.com");\n optionsBuilder.maxRetries(42);\n});\n```\n\nThe `withOptions()` method does not affect the original client or service.\n\n## Requests and responses\n\nTo send a request to the Telnyx API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class.\n\nFor example, `client.calls().dial(...)` should be called with an instance of `CallDialParams`, and it will return an instance of `CallDialResponse`.\n\n## Immutability\n\nEach class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.\n\nEach class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.\n\nBecause each class is immutable, builder modification will _never_ affect already built class instances.\n\n## Asynchronous execution\n\nThe default client is synchronous. To switch to asynchronous execution, call the `async()` method:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport com.telnyx.sdk.models.calls.CallDialParams;\nimport com.telnyx.sdk.models.calls.CallDialResponse;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `telnyx.apiKey`, `telnyx.publicKey`, `telnyx.clientId`, `telnyx.clientSecret` and `telnyx.baseUrl` system properties\n// Or configures using the `TELNYX_API_KEY`, `TELNYX_PUBLIC_KEY`, `TELNYX_CLIENT_ID`, `TELNYX_CLIENT_SECRET` and `TELNYX_BASE_URL` environment variables\nTelnyxClient client = TelnyxOkHttpClient.fromEnv();\n\nCallDialParams params = CallDialParams.builder()\n .connectionId("conn12345")\n .from("+15557654321")\n .to("+15551234567")\n .webhookUrl("https://your-webhook.url/events")\n .build();\nCompletableFuture<CallDialResponse> response = client.async().calls().dial(params);\n```\n\nOr create an asynchronous client from the beginning:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClientAsync;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClientAsync;\nimport com.telnyx.sdk.models.calls.CallDialParams;\nimport com.telnyx.sdk.models.calls.CallDialResponse;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `telnyx.apiKey`, `telnyx.publicKey`, `telnyx.clientId`, `telnyx.clientSecret` and `telnyx.baseUrl` system properties\n// Or configures using the `TELNYX_API_KEY`, `TELNYX_PUBLIC_KEY`, `TELNYX_CLIENT_ID`, `TELNYX_CLIENT_SECRET` and `TELNYX_BASE_URL` environment variables\nTelnyxClientAsync client = TelnyxOkHttpClientAsync.fromEnv();\n\nCallDialParams params = CallDialParams.builder()\n .connectionId("conn12345")\n .from("+15557654321")\n .to("+15551234567")\n .webhookUrl("https://your-webhook.url/events")\n .build();\nCompletableFuture<CallDialResponse> response = client.calls().dial(params);\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.\n\n\n\n## File uploads\n\nThe SDK defines methods that accept files.\n\nTo upload a file, pass a [`Path`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html):\n\n```java\nimport com.telnyx.sdk.models.ai.audio.AudioTranscribeParams;\nimport com.telnyx.sdk.models.ai.audio.AudioTranscribeResponse;\nimport java.nio.file.Paths;\n\nAudioTranscribeParams params = AudioTranscribeParams.builder()\n .model(AudioTranscribeParams.Model.DISTIL_WHISPER_DISTIL_LARGE_V2)\n .file(Paths.get("/path/to/file"))\n .build();\nAudioTranscribeResponse response = client.ai().audio().transcribe(params);\n```\n\nOr an arbitrary [`InputStream`](https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html):\n\n```java\nimport com.telnyx.sdk.models.ai.audio.AudioTranscribeParams;\nimport com.telnyx.sdk.models.ai.audio.AudioTranscribeResponse;\nimport java.net.URL;\n\nAudioTranscribeParams params = AudioTranscribeParams.builder()\n .model(AudioTranscribeParams.Model.DISTIL_WHISPER_DISTIL_LARGE_V2)\n .file(new URL("https://example.com//path/to/file").openStream())\n .build();\nAudioTranscribeResponse response = client.ai().audio().transcribe(params);\n```\n\nOr a `byte[]` array:\n\n```java\nimport com.telnyx.sdk.models.ai.audio.AudioTranscribeParams;\nimport com.telnyx.sdk.models.ai.audio.AudioTranscribeResponse;\n\nAudioTranscribeParams params = AudioTranscribeParams.builder()\n .model(AudioTranscribeParams.Model.DISTIL_WHISPER_DISTIL_LARGE_V2)\n .file("content".getBytes())\n .build();\nAudioTranscribeResponse response = client.ai().audio().transcribe(params);\n```\n\nNote that when passing a non-`Path` its filename is unknown so it will not be included in the request. To manually set a filename, pass a [`MultipartField`](telnyx-core/src/main/kotlin/com/telnyx/sdk/core/Values.kt):\n\n```java\nimport com.telnyx.sdk.core.MultipartField;\nimport com.telnyx.sdk.models.ai.audio.AudioTranscribeParams;\nimport com.telnyx.sdk.models.ai.audio.AudioTranscribeResponse;\nimport java.io.InputStream;\nimport java.net.URL;\n\nAudioTranscribeParams params = AudioTranscribeParams.builder()\n .model(AudioTranscribeParams.Model.DISTIL_WHISPER_DISTIL_LARGE_V2)\n .file(MultipartField.<InputStream>builder()\n .value(new URL("https://example.com//path/to/file").openStream())\n .filename("/path/to/file")\n .build())\n .build();\nAudioTranscribeResponse response = client.ai().audio().transcribe(params);\n```\n\n## Binary responses\n\nThe SDK defines methods that return binary responses, which are used for API responses that shouldn\'t necessarily be parsed, like non-JSON data.\n\nThese methods return [`HttpResponse`](telnyx-core/src/main/kotlin/com/telnyx/sdk/core/http/HttpResponse.kt):\n\n```java\nimport com.telnyx.sdk.core.http.HttpResponse;\nimport com.telnyx.sdk.models.ai.clusters.ClusterFetchGraphParams;\n\nHttpResponse response = client.ai().clusters().fetchGraph("task_id");\n```\n\nTo save the response content to a file, use the [`Files.copy(...)`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#copy-java.io.InputStream-java.nio.file.Path-java.nio.file.CopyOption...-) method:\n\n```java\nimport com.telnyx.sdk.core.http.HttpResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport java.nio.file.StandardCopyOption;\n\ntry (HttpResponse response = client.ai().clusters().fetchGraph(params)) {\n Files.copy(\n response.body(),\n Paths.get(path),\n StandardCopyOption.REPLACE_EXISTING\n );\n} catch (Exception e) {\n System.out.println("Something went wrong!");\n throw new RuntimeException(e);\n}\n```\n\nOr transfer the response content to any [`OutputStream`](https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html):\n\n```java\nimport com.telnyx.sdk.core.http.HttpResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\ntry (HttpResponse response = client.ai().clusters().fetchGraph(params)) {\n response.body().transferTo(Files.newOutputStream(Paths.get(path)));\n} catch (Exception e) {\n System.out.println("Something went wrong!");\n throw new RuntimeException(e);\n}\n```\n\n## Raw responses\n\nThe SDK defines methods that deserialize responses into instances of Java classes. However, these methods don\'t provide access to the response headers, status code, or the raw response body.\n\nTo access this data, prefix any HTTP method call on a client or service with `withRawResponse()`:\n\n```java\nimport com.telnyx.sdk.core.http.Headers;\nimport com.telnyx.sdk.core.http.HttpResponseFor;\nimport com.telnyx.sdk.models.numberorders.NumberOrderCreateParams;\nimport com.telnyx.sdk.models.numberorders.NumberOrderCreateResponse;\n\nNumberOrderCreateParams params = NumberOrderCreateParams.builder()\n .addPhoneNumber(NumberOrderCreateParams.PhoneNumber.builder()\n .phoneNumber("+15558675309")\n .build())\n .build();\nHttpResponseFor<NumberOrderCreateResponse> numberOrder = client.numberOrders().withRawResponse().create(params);\n\nint statusCode = numberOrder.statusCode();\nHeaders headers = numberOrder.headers();\n```\n\nYou can still deserialize the response into an instance of a Java class if needed:\n\n```java\nimport com.telnyx.sdk.models.numberorders.NumberOrderCreateResponse;\n\nNumberOrderCreateResponse parsedNumberOrder = numberOrder.parse();\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`TelnyxServiceException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/TelnyxServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:\n\n | Status | Exception |\n | ------ | -------------------------------------------------- |\n | 400 | [`BadRequestException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/BadRequestException.kt) |\n | 401 | [`UnauthorizedException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/UnauthorizedException.kt) |\n | 403 | [`PermissionDeniedException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/PermissionDeniedException.kt) |\n | 404 | [`NotFoundException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/NotFoundException.kt) |\n | 422 | [`UnprocessableEntityException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/UnprocessableEntityException.kt) |\n | 429 | [`RateLimitException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/RateLimitException.kt) |\n | 5xx | [`InternalServerException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/InternalServerException.kt) |\n | others | [`UnexpectedStatusCodeException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/UnexpectedStatusCodeException.kt) |\n\n- [`TelnyxIoException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/TelnyxIoException.kt): I/O networking errors.\n\n- [`TelnyxRetryableException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/TelnyxRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`TelnyxInvalidDataException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/TelnyxInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that\'s supposed to be required, but the API unexpectedly omitted it from the response.\n\n- [`TelnyxException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/TelnyxException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.\n\n## Pagination\n\nThe SDK defines methods that return a paginated lists of results. It provides convenient ways to access the results either one page at a time or item-by-item across all pages.\n\n### Auto-pagination\n\nTo iterate through all results across all pages, use the `autoPager()` method, which automatically fetches more pages as needed.\n\nWhen using the synchronous client, the method returns an [`Iterable`](https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html)\n\n```java\nimport com.telnyx.sdk.models.accessipaddress.AccessIpAddressListPage;\nimport com.telnyx.sdk.models.accessipaddress.AccessIpAddressResponse;\n\nAccessIpAddressListPage page = client.accessIpAddress().list();\n\n// Process as an Iterable\nfor (AccessIpAddressResponse accessIpAddress : page.autoPager()) {\n System.out.println(accessIpAddress);\n}\n\n// Process as a Stream\npage.autoPager()\n .stream()\n .limit(50)\n .forEach(accessIpAddress -> System.out.println(accessIpAddress));\n```\n\nWhen using the asynchronous client, the method returns an [`AsyncStreamResponse`](telnyx-core/src/main/kotlin/com/telnyx/sdk/core/http/AsyncStreamResponse.kt):\n\n```java\nimport com.telnyx.sdk.core.http.AsyncStreamResponse;\nimport com.telnyx.sdk.models.accessipaddress.AccessIpAddressListPageAsync;\nimport com.telnyx.sdk.models.accessipaddress.AccessIpAddressResponse;\nimport java.util.Optional;\nimport java.util.concurrent.CompletableFuture;\n\nCompletableFuture<AccessIpAddressListPageAsync> pageFuture = client.async().accessIpAddress().list();\n\npageFuture.thenRun(page -> page.autoPager().subscribe(accessIpAddress -> {\n System.out.println(accessIpAddress);\n}));\n\n// If you need to handle errors or completion of the stream\npageFuture.thenRun(page -> page.autoPager().subscribe(new AsyncStreamResponse.Handler<>() {\n @Override\n public void onNext(AccessIpAddressResponse accessIpAddress) {\n System.out.println(accessIpAddress);\n }\n\n @Override\n public void onComplete(Optional<Throwable> error) {\n if (error.isPresent()) {\n System.out.println("Something went wrong!");\n throw new RuntimeException(error.get());\n } else {\n System.out.println("No more!");\n }\n }\n}));\n\n// Or use futures\npageFuture.thenRun(page -> page.autoPager()\n .subscribe(accessIpAddress -> {\n System.out.println(accessIpAddress);\n })\n .onCompleteFuture()\n .whenComplete((unused, error) -> {\n if (error != null) {\n System.out.println("Something went wrong!");\n throw new RuntimeException(error);\n } else {\n System.out.println("No more!");\n }\n }));\n```\n\n### Manual pagination\n\nTo access individual page items and manually request the next page, use the `items()`,\n`hasNextPage()`, and `nextPage()` methods:\n\n```java\nimport com.telnyx.sdk.models.accessipaddress.AccessIpAddressListPage;\nimport com.telnyx.sdk.models.accessipaddress.AccessIpAddressResponse;\n\nAccessIpAddressListPage page = client.accessIpAddress().list();\nwhile (true) {\n for (AccessIpAddressResponse accessIpAddress : page.items()) {\n System.out.println(accessIpAddress);\n }\n\n if (!page.hasNextPage()) {\n break;\n }\n\n page = page.nextPage();\n}\n```\n\n## Logging\n\nEnable logging by setting the `TELNYX_LOG` environment variable to `info`:\n\n```sh\nexport TELNYX_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\nexport TELNYX_LOG=debug\n```\n\nOr configure the client manually using the `logLevel` method:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport com.telnyx.sdk.core.LogLevel;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .fromEnv()\n .logLevel(LogLevel.INFO)\n .build();\n```\n\n## ProGuard and R8\n\nAlthough the SDK uses reflection, it is still usable with [ProGuard](https://github.com/Guardsquare/proguard) and [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) because `telnyx-core` is published with a [configuration file](telnyx-core/src/main/resources/META-INF/proguard/telnyx-core.pro) containing [keep rules](https://www.guardsquare.com/manual/configuration/usage).\n\nProGuard and R8 should automatically detect and use the published rules, but you can also manually copy the keep rules if necessary.\n\n\n\n\n\n## Jackson\n\nThe SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default.\n\nThe SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config).\n\nIf the SDK threw an exception, but you\'re _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`TelnyxOkHttpClient`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/TelnyxOkHttpClient.kt) or [`TelnyxOkHttpClientAsync`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/TelnyxOkHttpClientAsync.kt).\n\n> [!CAUTION]\n> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.\n\nAlso note that there are bugs in older Jackson versions that can affect the SDK. We don\'t work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.\n\n## Network options\n\n### Retries\n\nThe SDK automatically retries 2 times by default, with a short exponential backoff between requests.\n\nOnly the following error types are retried:\n- Connection errors (for example, due to a network connectivity problem)\n- 408 Request Timeout\n- 409 Conflict\n- 429 Rate Limit\n- 5xx Internal\n\nThe API may also explicitly instruct the SDK to retry or not retry a request.\n\nTo set a custom number of retries, configure the client using the `maxRetries` method:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .fromEnv()\n .maxRetries(4)\n .build();\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default.\n\nTo set a custom timeout, configure the method call using the `timeout` method:\n\n```java\nimport com.telnyx.sdk.models.numberorders.NumberOrderCreateResponse;\n\nNumberOrderCreateResponse numberOrder = client.numberOrders().create(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build());\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport java.time.Duration;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .fromEnv()\n .timeout(Duration.ofSeconds(30))\n .build();\n```\n\n### Proxies\n\nTo route requests through a proxy, configure the client using the `proxy` method:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport java.net.InetSocketAddress;\nimport java.net.Proxy;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .fromEnv()\n .proxy(new Proxy(\n Proxy.Type.HTTP, new InetSocketAddress(\n "https://example.com", 8080\n )\n ))\n .build();\n```\n\nIf the proxy responds with `407 Proxy Authentication Required`, supply credentials by also configuring `proxyAuthenticator`:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport com.telnyx.sdk.core.http.ProxyAuthenticator;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .fromEnv()\n .proxy(...)\n // Or a custom implementation of `ProxyAuthenticator`.\n .proxyAuthenticator(ProxyAuthenticator.basic("username", "password"))\n .build();\n```\n\n### Connection pooling\n\nTo customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport java.time.Duration;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .fromEnv()\n // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.\n .maxIdleConnections(10)\n .keepAliveDuration(Duration.ofMinutes(2))\n .build();\n```\n\nIf both options are unset, OkHttp\'s default connection pool settings are used.\n\n### HTTPS\n\n> [!NOTE]\n> Most applications should not call these methods, and instead use the system defaults. The defaults include\n> special optimizations that can be lost if the implementations are modified.\n\nTo configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .fromEnv()\n // If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.\n .sslSocketFactory(yourSSLSocketFactory)\n .trustManager(yourTrustManager)\n .hostnameVerifier(yourHostnameVerifier)\n .build();\n```\n\n\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n- `telnyx-core`\n - Contains core SDK logic\n - Does not depend on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`TelnyxClient`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClient.kt), [`TelnyxClientAsync`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientAsync.kt), [`TelnyxClientImpl`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientImpl.kt), and [`TelnyxClientAsyncImpl`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientAsyncImpl.kt), all of which can work with any HTTP client\n- `telnyx-client-okhttp`\n - Depends on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`TelnyxOkHttpClient`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/TelnyxOkHttpClient.kt) and [`TelnyxOkHttpClientAsync`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/TelnyxOkHttpClientAsync.kt), which provide a way to construct [`TelnyxClientImpl`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientImpl.kt) and [`TelnyxClientAsyncImpl`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientAsyncImpl.kt), respectively, using OkHttp\n- `telnyx`\n - Depends on and exposes the APIs of both `telnyx-core` and `telnyx-client-okhttp`\n - Does not have its own logic\n\nThis structure allows replacing the SDK\'s default HTTP client without pulling in unnecessary dependencies.\n\n#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html)\n\n> [!TIP]\n> Try the available [network options](#network-options) before replacing the default client.\n\nTo use a customized `OkHttpClient`:\n\n1. Replace your [`telnyx` dependency](#installation) with `telnyx-core`\n2. Copy `telnyx-client-okhttp`\'s [`OkHttpClient`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`TelnyxClientImpl`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientImpl.kt) or [`TelnyxClientAsyncImpl`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientAsyncImpl.kt), similarly to [`TelnyxOkHttpClient`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/TelnyxOkHttpClient.kt) or [`TelnyxOkHttpClientAsync`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/TelnyxOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`telnyx` dependency](#installation) with `telnyx-core`\n2. Write a class that implements the [`HttpClient`](telnyx-core/src/main/kotlin/com/telnyx/sdk/core/http/HttpClient.kt) interface\n3. Construct [`TelnyxClientImpl`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientImpl.kt) or [`TelnyxClientAsyncImpl`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientAsyncImpl.kt), similarly to [`TelnyxOkHttpClient`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/TelnyxOkHttpClient.kt) or [`TelnyxOkHttpClientAsync`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/TelnyxOkHttpClientAsync.kt), using your new client class\n\n## Undocumented API functionality\n\nThe SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.\n\n### Parameters\n\nTo set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class:\n\n```java\nimport com.telnyx.sdk.core.JsonValue;\nimport com.telnyx.sdk.models.calls.CallDialParams;\n\nCallDialParams params = CallDialParams.builder()\n .putAdditionalHeader("Secret-Header", "42")\n .putAdditionalQueryParam("secret_query_param", "42")\n .putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))\n .build();\n```\n\nThese can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods.\n\nTo set undocumented parameters on _nested_ headers, query params, or body classes, call the `putAdditionalProperty` method on the nested class:\n\n```java\nimport com.telnyx.sdk.core.JsonValue;\nimport com.telnyx.sdk.models.calls.CallDialParams;\n\nCallDialParams params = CallDialParams.builder()\n .answeringMachineDetectionConfig(CallDialParams.AnsweringMachineDetectionConfig.builder()\n .putAdditionalProperty("secretProperty", JsonValue.from("42"))\n .build())\n .build();\n```\n\nThese properties can be accessed on the nested built object later using the `_additionalProperties()` method.\n\nTo set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](telnyx-core/src/main/kotlin/com/telnyx/sdk/core/Values.kt) object to its setter:\n\n```java\nimport com.telnyx.sdk.core.JsonValue;\nimport com.telnyx.sdk.models.calls.CallDialParams;\n\nCallDialParams params = CallDialParams.builder()\n .connectionId(JsonValue.from(42))\n .from("+15557654321")\n .to("+15551234567")\n .webhookUrl("https://your-webhook.url/events")\n .build();\n```\n\nThe most straightforward way to create a [`JsonValue`](telnyx-core/src/main/kotlin/com/telnyx/sdk/core/Values.kt) is using its `from(...)` method:\n\n```java\nimport com.telnyx.sdk.core.JsonValue;\nimport java.util.List;\nimport java.util.Map;\n\n// Create primitive JSON values\nJsonValue nullValue = JsonValue.from(null);\nJsonValue booleanValue = JsonValue.from(true);\nJsonValue numberValue = JsonValue.from(42);\nJsonValue stringValue = JsonValue.from("Hello World!");\n\n// Create a JSON array value equivalent to `["Hello", "World"]`\nJsonValue arrayValue = JsonValue.from(List.of(\n "Hello", "World"\n));\n\n// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }`\nJsonValue objectValue = JsonValue.from(Map.of(\n "a", 1,\n "b", 2\n));\n\n// Create an arbitrarily nested JSON equivalent to:\n// {\n// "a": [1, 2],\n// "b": [3, 4]\n// }\nJsonValue complexValue = JsonValue.from(Map.of(\n "a", List.of(\n 1, 2\n ),\n "b", List.of(\n 3, 4\n )\n));\n```\n\nNormally a `Builder` class\'s `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset.\n\nTo forcibly omit a required parameter or property, pass [`JsonMissing`](telnyx-core/src/main/kotlin/com/telnyx/sdk/core/Values.kt):\n\n```java\nimport com.telnyx.sdk.core.JsonMissing;\nimport com.telnyx.sdk.models.calls.CallDialParams;\n\nCallDialParams params = CallDialParams.builder()\n .from("+18005550101")\n .to("+18005550100 or sip:username@sip.telnyx.com")\n .connectionId(JsonMissing.of())\n .build();\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```java\nimport com.telnyx.sdk.core.JsonValue;\nimport java.util.Map;\n\nMap<String, JsonValue> additionalProperties = client.calls().dial(params)._additionalProperties();\nJsonValue secretPropertyValue = additionalProperties.get("secretProperty");\n\nString result = secretPropertyValue.accept(new JsonValue.Visitor<>() {\n @Override\n public String visitNull() {\n return "It\'s null!";\n }\n\n @Override\n public String visitBoolean(boolean value) {\n return "It\'s a boolean!";\n }\n\n @Override\n public String visitNumber(Number value) {\n return "It\'s a number!";\n }\n\n // Other methods include `visitMissing`, `visitString`, `visitArray`, and `visitObject`\n // The default implementation of each unimplemented method delegates to `visitDefault`, which throws by default, but can also be overridden\n});\n```\n\nTo access a property\'s raw JSON value, which may be undocumented, call its `_` prefixed method:\n\n```java\nimport com.telnyx.sdk.core.JsonField;\nimport java.util.Optional;\n\nJsonField<String> connectionId = client.calls().dial(params)._connectionId();\n\nif (connectionId.isMissing()) {\n // The property is absent from the JSON response\n} else if (connectionId.isNull()) {\n // The property was set to literal null\n} else {\n // Check if value was provided as a string\n // Other methods include `asNumber()`, `asBoolean()`, etc.\n Optional<String> jsonString = connectionId.asString();\n\n // Try to deserialize into a custom type\n MyClass myObject = connectionId.asUnknown().orElseThrow().convert(MyClass.class);\n}\n```\n\n### Response validation\n\nIn rare cases, the API may return a response that doesn\'t match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else.\n\nBy default, the SDK will not throw an exception in this case. It will throw [`TelnyxInvalidDataException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/TelnyxInvalidDataException.kt) only if you directly access the property.\n\nValidating the response is _not_ forwards compatible with new types from the API for existing fields.\n\nIf you would still prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```java\nimport com.telnyx.sdk.models.calls.CallDialResponse;\n\nCallDialResponse response = client.calls().dial(params).validate();\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```java\nimport com.telnyx.sdk.models.calls.CallDialResponse;\n\nCallDialResponse response = client.calls().dial(\n params, RequestOptions.builder().responseValidation(true).build()\n);\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .fromEnv()\n .responseValidation(true)\n .build();\n```\n\n## FAQ\n\n### Why don\'t you use plain `enum` classes?\n\nJava `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value.\n\n### Why do you represent fields using `JsonField<T>` instead of just plain `T`?\n\nUsing `JsonField<T>` enables a few features:\n\n- Allowing usage of [undocumented API functionality](#undocumented-api-functionality)\n- Lazily [validating the API response against the expected shape](#response-validation)\n- Representing absent vs explicitly null values\n\n### Why don\'t you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)?\n\nIt is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don\'t want to introduce a breaking change every time we add a field to a class.\n\n### Why don\'t you use checked exceptions?\n\nChecked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason.\n\nChecked exceptions:\n\n- Are verbose to handle\n- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error\n- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function)\n- Don\'t play well with lambdas (also due to the function coloring problem)\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/team-telnyx/telnyx-java/issues) with questions, bugs, or suggestions.\n',
49951
+ content: '# Telnyx Java API Library\n\n<!-- x-release-please-start-version -->\n[![Maven Central](https://img.shields.io/maven-central/v/com.telnyx.sdk/telnyx)](https://central.sonatype.com/artifact/com.telnyx.sdk/telnyx/0.0.1)\n\n<!-- x-release-please-end -->\n\nThe Telnyx Java SDK provides convenient access to the Telnyx REST API from applications written in Java.\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Telnyx MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=telnyx-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsInRlbG55eC1tY3AiXSwiZW52Ijp7IlRFTE5ZWF9BUElfS0VZIjoiTXkgQVBJIEtleSIsIlRFTE5ZWF9QVUJMSUNfS0VZIjoiTXkgUHVibGljIEtleSIsIlRFTE5ZWF9DTElFTlRfSUQiOiJNeSBDbGllbnQgSUQiLCJURUxOWVhfQ0xJRU5UX1NFQ1JFVCI6Ik15IENsaWVudCBTZWNyZXQifX0)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22telnyx-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22telnyx-mcp%22%5D%2C%22env%22%3A%7B%22TELNYX_API_KEY%22%3A%22My%20API%20Key%22%2C%22TELNYX_PUBLIC_KEY%22%3A%22My%20Public%20Key%22%2C%22TELNYX_CLIENT_ID%22%3A%22My%20Client%20ID%22%2C%22TELNYX_CLIENT_SECRET%22%3A%22My%20Client%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n\n\n## Installation\n\n<!-- x-release-please-start-version -->\n\n### Gradle\n\n~~~kotlin\nimplementation("com.telnyx.sdk:telnyx:0.0.1")\n~~~\n\n### Maven\n\n~~~xml\n<dependency>\n <groupId>com.telnyx.sdk</groupId>\n <artifactId>telnyx</artifactId>\n <version>0.0.1</version>\n</dependency>\n~~~\n\n<!-- x-release-please-end -->\n\n## Requirements\n\nThis library requires Java 8 or later.\n\n## Usage\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport com.telnyx.sdk.models.calls.CallDialParams;\nimport com.telnyx.sdk.models.calls.CallDialResponse;\n\n// Configures using the `telnyx.apiKey`, `telnyx.publicKey`, `telnyx.clientId`, `telnyx.clientSecret` and `telnyx.baseUrl` system properties\n// Or configures using the `TELNYX_API_KEY`, `TELNYX_PUBLIC_KEY`, `TELNYX_CLIENT_ID`, `TELNYX_CLIENT_SECRET` and `TELNYX_BASE_URL` environment variables\nTelnyxClient client = TelnyxOkHttpClient.fromEnv();\n\nCallDialParams params = CallDialParams.builder()\n .connectionId("conn12345")\n .from("+15557654321")\n .to("+15551234567")\n .webhookUrl("https://your-webhook.url/events")\n .build();\nCallDialResponse response = client.calls().dial(params);\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\n\n// Configures using the `telnyx.apiKey`, `telnyx.publicKey`, `telnyx.clientId`, `telnyx.clientSecret` and `telnyx.baseUrl` system properties\n// Or configures using the `TELNYX_API_KEY`, `TELNYX_PUBLIC_KEY`, `TELNYX_CLIENT_ID`, `TELNYX_CLIENT_SECRET` and `TELNYX_BASE_URL` environment variables\nTelnyxClient client = TelnyxOkHttpClient.fromEnv();\n```\n\nOr manually:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .apiKey("My API Key")\n .build();\n```\n\nOr using a combination of the two approaches:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n // Configures using the `telnyx.apiKey`, `telnyx.publicKey`, `telnyx.clientId`, `telnyx.clientSecret` and `telnyx.baseUrl` system properties\n // Or configures using the `TELNYX_API_KEY`, `TELNYX_PUBLIC_KEY`, `TELNYX_CLIENT_ID`, `TELNYX_CLIENT_SECRET` and `TELNYX_BASE_URL` environment variables\n .fromEnv()\n .apiKey("My API Key")\n .build();\n```\n\nSee this table for the available options:\n\n| Setter | System property | Environment variable | Required | Default value |\n| -------------- | --------------------- | ---------------------- | -------- | ----------------------------- |\n| `apiKey` | `telnyx.apiKey` | `TELNYX_API_KEY` | false | - |\n| `publicKey` | `telnyx.publicKey` | `TELNYX_PUBLIC_KEY` | false | - |\n| `clientId` | `telnyx.clientId` | `TELNYX_CLIENT_ID` | false | - |\n| `clientSecret` | `telnyx.clientSecret` | `TELNYX_CLIENT_SECRET` | false | - |\n| `baseUrl` | `telnyx.baseUrl` | `TELNYX_BASE_URL` | true | `"https://api.telnyx.com/v2"` |\n\nSystem properties take precedence over environment variables.\n\n> [!TIP]\n> Don\'t create more than one client in the same application. Each client has a connection pool and\n> thread pools, which are more efficient to share between requests.\n\n### Modifying configuration\n\nTo temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\n\nTelnyxClient clientWithOptions = client.withOptions(optionsBuilder -> {\n optionsBuilder.baseUrl("https://example.com");\n optionsBuilder.maxRetries(42);\n});\n```\n\nThe `withOptions()` method does not affect the original client or service.\n\n## Requests and responses\n\nTo send a request to the Telnyx API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class.\n\nFor example, `client.calls().dial(...)` should be called with an instance of `CallDialParams`, and it will return an instance of `CallDialResponse`.\n\n## Immutability\n\nEach class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.\n\nEach class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.\n\nBecause each class is immutable, builder modification will _never_ affect already built class instances.\n\n## Asynchronous execution\n\nThe default client is synchronous. To switch to asynchronous execution, call the `async()` method:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport com.telnyx.sdk.models.calls.CallDialParams;\nimport com.telnyx.sdk.models.calls.CallDialResponse;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `telnyx.apiKey`, `telnyx.publicKey`, `telnyx.clientId`, `telnyx.clientSecret` and `telnyx.baseUrl` system properties\n// Or configures using the `TELNYX_API_KEY`, `TELNYX_PUBLIC_KEY`, `TELNYX_CLIENT_ID`, `TELNYX_CLIENT_SECRET` and `TELNYX_BASE_URL` environment variables\nTelnyxClient client = TelnyxOkHttpClient.fromEnv();\n\nCallDialParams params = CallDialParams.builder()\n .connectionId("conn12345")\n .from("+15557654321")\n .to("+15551234567")\n .webhookUrl("https://your-webhook.url/events")\n .build();\nCompletableFuture<CallDialResponse> response = client.async().calls().dial(params);\n```\n\nOr create an asynchronous client from the beginning:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClientAsync;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClientAsync;\nimport com.telnyx.sdk.models.calls.CallDialParams;\nimport com.telnyx.sdk.models.calls.CallDialResponse;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `telnyx.apiKey`, `telnyx.publicKey`, `telnyx.clientId`, `telnyx.clientSecret` and `telnyx.baseUrl` system properties\n// Or configures using the `TELNYX_API_KEY`, `TELNYX_PUBLIC_KEY`, `TELNYX_CLIENT_ID`, `TELNYX_CLIENT_SECRET` and `TELNYX_BASE_URL` environment variables\nTelnyxClientAsync client = TelnyxOkHttpClientAsync.fromEnv();\n\nCallDialParams params = CallDialParams.builder()\n .connectionId("conn12345")\n .from("+15557654321")\n .to("+15551234567")\n .webhookUrl("https://your-webhook.url/events")\n .build();\nCompletableFuture<CallDialResponse> response = client.calls().dial(params);\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.\n\n\n\n## File uploads\n\nThe SDK defines methods that accept files.\n\nTo upload a file, pass a [`Path`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html):\n\n```java\nimport com.telnyx.sdk.models.ai.audio.AudioTranscribeParams;\nimport com.telnyx.sdk.models.ai.audio.AudioTranscribeResponse;\nimport java.nio.file.Paths;\n\nAudioTranscribeParams params = AudioTranscribeParams.builder()\n .model(AudioTranscribeParams.Model.DISTIL_WHISPER_DISTIL_LARGE_V2)\n .file(Paths.get("/path/to/file"))\n .build();\nAudioTranscribeResponse response = client.ai().audio().transcribe(params);\n```\n\nOr an arbitrary [`InputStream`](https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html):\n\n```java\nimport com.telnyx.sdk.models.ai.audio.AudioTranscribeParams;\nimport com.telnyx.sdk.models.ai.audio.AudioTranscribeResponse;\nimport java.net.URL;\n\nAudioTranscribeParams params = AudioTranscribeParams.builder()\n .model(AudioTranscribeParams.Model.DISTIL_WHISPER_DISTIL_LARGE_V2)\n .file(new URL("https://example.com//path/to/file").openStream())\n .build();\nAudioTranscribeResponse response = client.ai().audio().transcribe(params);\n```\n\nOr a `byte[]` array:\n\n```java\nimport com.telnyx.sdk.models.ai.audio.AudioTranscribeParams;\nimport com.telnyx.sdk.models.ai.audio.AudioTranscribeResponse;\n\nAudioTranscribeParams params = AudioTranscribeParams.builder()\n .model(AudioTranscribeParams.Model.DISTIL_WHISPER_DISTIL_LARGE_V2)\n .file("content".getBytes())\n .build();\nAudioTranscribeResponse response = client.ai().audio().transcribe(params);\n```\n\nNote that when passing a non-`Path` its filename is unknown so it will not be included in the request. To manually set a filename, pass a [`MultipartField`](telnyx-core/src/main/kotlin/com/telnyx/sdk/core/Values.kt):\n\n```java\nimport com.telnyx.sdk.core.MultipartField;\nimport com.telnyx.sdk.models.ai.audio.AudioTranscribeParams;\nimport com.telnyx.sdk.models.ai.audio.AudioTranscribeResponse;\nimport java.io.InputStream;\nimport java.net.URL;\n\nAudioTranscribeParams params = AudioTranscribeParams.builder()\n .model(AudioTranscribeParams.Model.DISTIL_WHISPER_DISTIL_LARGE_V2)\n .file(MultipartField.<InputStream>builder()\n .value(new URL("https://example.com//path/to/file").openStream())\n .filename("/path/to/file")\n .build())\n .build();\nAudioTranscribeResponse response = client.ai().audio().transcribe(params);\n```\n\n## Binary responses\n\nThe SDK defines methods that return binary responses, which are used for API responses that shouldn\'t necessarily be parsed, like non-JSON data.\n\nThese methods return [`HttpResponse`](telnyx-core/src/main/kotlin/com/telnyx/sdk/core/http/HttpResponse.kt):\n\n```java\nimport com.telnyx.sdk.core.http.HttpResponse;\nimport com.telnyx.sdk.models.ai.clusters.ClusterFetchGraphParams;\n\nHttpResponse response = client.ai().clusters().fetchGraph("task_id");\n```\n\nTo save the response content to a file, use the [`Files.copy(...)`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#copy-java.io.InputStream-java.nio.file.Path-java.nio.file.CopyOption...-) method:\n\n```java\nimport com.telnyx.sdk.core.http.HttpResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport java.nio.file.StandardCopyOption;\n\ntry (HttpResponse response = client.ai().clusters().fetchGraph(params)) {\n Files.copy(\n response.body(),\n Paths.get(path),\n StandardCopyOption.REPLACE_EXISTING\n );\n} catch (Exception e) {\n System.out.println("Something went wrong!");\n throw new RuntimeException(e);\n}\n```\n\nOr transfer the response content to any [`OutputStream`](https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html):\n\n```java\nimport com.telnyx.sdk.core.http.HttpResponse;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\n\ntry (HttpResponse response = client.ai().clusters().fetchGraph(params)) {\n response.body().transferTo(Files.newOutputStream(Paths.get(path)));\n} catch (Exception e) {\n System.out.println("Something went wrong!");\n throw new RuntimeException(e);\n}\n```\n\n## Raw responses\n\nThe SDK defines methods that deserialize responses into instances of Java classes. However, these methods don\'t provide access to the response headers, status code, or the raw response body.\n\nTo access this data, prefix any HTTP method call on a client or service with `withRawResponse()`:\n\n```java\nimport com.telnyx.sdk.core.http.Headers;\nimport com.telnyx.sdk.core.http.HttpResponseFor;\nimport com.telnyx.sdk.models.numberorders.NumberOrderCreateParams;\nimport com.telnyx.sdk.models.numberorders.NumberOrderCreateResponse;\n\nNumberOrderCreateParams params = NumberOrderCreateParams.builder()\n .addPhoneNumber(NumberOrderCreateParams.PhoneNumber.builder()\n .phoneNumber("+15558675309")\n .build())\n .build();\nHttpResponseFor<NumberOrderCreateResponse> numberOrder = client.numberOrders().withRawResponse().create(params);\n\nint statusCode = numberOrder.statusCode();\nHeaders headers = numberOrder.headers();\n```\n\nYou can still deserialize the response into an instance of a Java class if needed:\n\n```java\nimport com.telnyx.sdk.models.numberorders.NumberOrderCreateResponse;\n\nNumberOrderCreateResponse parsedNumberOrder = numberOrder.parse();\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`TelnyxServiceException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/TelnyxServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:\n\n | Status | Exception |\n | ------ | -------------------------------------------------- |\n | 400 | [`BadRequestException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/BadRequestException.kt) |\n | 401 | [`UnauthorizedException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/UnauthorizedException.kt) |\n | 403 | [`PermissionDeniedException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/PermissionDeniedException.kt) |\n | 404 | [`NotFoundException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/NotFoundException.kt) |\n | 422 | [`UnprocessableEntityException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/UnprocessableEntityException.kt) |\n | 429 | [`RateLimitException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/RateLimitException.kt) |\n | 5xx | [`InternalServerException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/InternalServerException.kt) |\n | others | [`UnexpectedStatusCodeException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/UnexpectedStatusCodeException.kt) |\n\n- [`TelnyxIoException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/TelnyxIoException.kt): I/O networking errors.\n\n- [`TelnyxRetryableException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/TelnyxRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`TelnyxInvalidDataException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/TelnyxInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that\'s supposed to be required, but the API unexpectedly omitted it from the response.\n\n- [`TelnyxException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/TelnyxException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.\n\n## Pagination\n\nThe SDK defines methods that return a paginated lists of results. It provides convenient ways to access the results either one page at a time or item-by-item across all pages.\n\n### Auto-pagination\n\nTo iterate through all results across all pages, use the `autoPager()` method, which automatically fetches more pages as needed.\n\nWhen using the synchronous client, the method returns an [`Iterable`](https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html)\n\n```java\nimport com.telnyx.sdk.models.accessipaddress.AccessIpAddressListPage;\nimport com.telnyx.sdk.models.accessipaddress.AccessIpAddressResponse;\n\nAccessIpAddressListPage page = client.accessIpAddress().list();\n\n// Process as an Iterable\nfor (AccessIpAddressResponse accessIpAddress : page.autoPager()) {\n System.out.println(accessIpAddress);\n}\n\n// Process as a Stream\npage.autoPager()\n .stream()\n .limit(50)\n .forEach(accessIpAddress -> System.out.println(accessIpAddress));\n```\n\nWhen using the asynchronous client, the method returns an [`AsyncStreamResponse`](telnyx-core/src/main/kotlin/com/telnyx/sdk/core/http/AsyncStreamResponse.kt):\n\n```java\nimport com.telnyx.sdk.core.http.AsyncStreamResponse;\nimport com.telnyx.sdk.models.accessipaddress.AccessIpAddressListPageAsync;\nimport com.telnyx.sdk.models.accessipaddress.AccessIpAddressResponse;\nimport java.util.Optional;\nimport java.util.concurrent.CompletableFuture;\n\nCompletableFuture<AccessIpAddressListPageAsync> pageFuture = client.async().accessIpAddress().list();\n\npageFuture.thenRun(page -> page.autoPager().subscribe(accessIpAddress -> {\n System.out.println(accessIpAddress);\n}));\n\n// If you need to handle errors or completion of the stream\npageFuture.thenRun(page -> page.autoPager().subscribe(new AsyncStreamResponse.Handler<>() {\n @Override\n public void onNext(AccessIpAddressResponse accessIpAddress) {\n System.out.println(accessIpAddress);\n }\n\n @Override\n public void onComplete(Optional<Throwable> error) {\n if (error.isPresent()) {\n System.out.println("Something went wrong!");\n throw new RuntimeException(error.get());\n } else {\n System.out.println("No more!");\n }\n }\n}));\n\n// Or use futures\npageFuture.thenRun(page -> page.autoPager()\n .subscribe(accessIpAddress -> {\n System.out.println(accessIpAddress);\n })\n .onCompleteFuture()\n .whenComplete((unused, error) -> {\n if (error != null) {\n System.out.println("Something went wrong!");\n throw new RuntimeException(error);\n } else {\n System.out.println("No more!");\n }\n }));\n```\n\n### Manual pagination\n\nTo access individual page items and manually request the next page, use the `items()`,\n`hasNextPage()`, and `nextPage()` methods:\n\n```java\nimport com.telnyx.sdk.models.accessipaddress.AccessIpAddressListPage;\nimport com.telnyx.sdk.models.accessipaddress.AccessIpAddressResponse;\n\nAccessIpAddressListPage page = client.accessIpAddress().list();\nwhile (true) {\n for (AccessIpAddressResponse accessIpAddress : page.items()) {\n System.out.println(accessIpAddress);\n }\n\n if (!page.hasNextPage()) {\n break;\n }\n\n page = page.nextPage();\n}\n```\n\n## Logging\n\nEnable logging by setting the `TELNYX_LOG` environment variable to `info`:\n\n```sh\nexport TELNYX_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\nexport TELNYX_LOG=debug\n```\n\nOr configure the client manually using the `logLevel` method:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport com.telnyx.sdk.core.LogLevel;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .fromEnv()\n .logLevel(LogLevel.INFO)\n .build();\n```\n\n## ProGuard and R8\n\nAlthough the SDK uses reflection, it is still usable with [ProGuard](https://github.com/Guardsquare/proguard) and [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) because `telnyx-core` is published with a [configuration file](telnyx-core/src/main/resources/META-INF/proguard/telnyx-core.pro) containing [keep rules](https://www.guardsquare.com/manual/configuration/usage).\n\nProGuard and R8 should automatically detect and use the published rules, but you can also manually copy the keep rules if necessary.\n\n\n\n\n\n## Jackson\n\nThe SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default.\n\nThe SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config).\n\nIf the SDK threw an exception, but you\'re _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`TelnyxOkHttpClient`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/TelnyxOkHttpClient.kt) or [`TelnyxOkHttpClientAsync`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/TelnyxOkHttpClientAsync.kt).\n\n> [!CAUTION]\n> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.\n\nAlso note that there are bugs in older Jackson versions that can affect the SDK. We don\'t work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.\n\n## Network options\n\n### Retries\n\nThe SDK automatically retries 2 times by default, with a short exponential backoff between requests.\n\nOnly the following error types are retried:\n- Connection errors (for example, due to a network connectivity problem)\n- 408 Request Timeout\n- 409 Conflict\n- 429 Rate Limit\n- 5xx Internal\n\nThe API may also explicitly instruct the SDK to retry or not retry a request.\n\nTo set a custom number of retries, configure the client using the `maxRetries` method:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .fromEnv()\n .maxRetries(4)\n .build();\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default.\n\nTo set a custom timeout, configure the method call using the `timeout` method:\n\n```java\nimport com.telnyx.sdk.models.numberorders.NumberOrderCreateResponse;\n\nNumberOrderCreateResponse numberOrder = client.numberOrders().create(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build());\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport java.time.Duration;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .fromEnv()\n .timeout(Duration.ofSeconds(30))\n .build();\n```\n\n### Proxies\n\nTo route requests through a proxy, configure the client using the `proxy` method:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport java.net.InetSocketAddress;\nimport java.net.Proxy;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .fromEnv()\n .proxy(new Proxy(\n Proxy.Type.HTTP, new InetSocketAddress(\n "https://example.com", 8080\n )\n ))\n .build();\n```\n\nIf the proxy responds with `407 Proxy Authentication Required`, supply credentials by also configuring `proxyAuthenticator`:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport com.telnyx.sdk.core.http.ProxyAuthenticator;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .fromEnv()\n .proxy(...)\n // Or a custom implementation of `ProxyAuthenticator`.\n .proxyAuthenticator(ProxyAuthenticator.basic("username", "password"))\n .build();\n```\n\n### Connection pooling\n\nTo customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\nimport java.time.Duration;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .fromEnv()\n // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.\n .maxIdleConnections(10)\n .keepAliveDuration(Duration.ofMinutes(2))\n .build();\n```\n\nIf both options are unset, OkHttp\'s default connection pool settings are used.\n\n### HTTPS\n\n> [!NOTE]\n> Most applications should not call these methods, and instead use the system defaults. The defaults include\n> special optimizations that can be lost if the implementations are modified.\n\nTo configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .fromEnv()\n // If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.\n .sslSocketFactory(yourSSLSocketFactory)\n .trustManager(yourTrustManager)\n .hostnameVerifier(yourHostnameVerifier)\n .build();\n```\n\n\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n- `telnyx-core`\n - Contains core SDK logic\n - Does not depend on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`TelnyxClient`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClient.kt), [`TelnyxClientAsync`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientAsync.kt), [`TelnyxClientImpl`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientImpl.kt), and [`TelnyxClientAsyncImpl`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientAsyncImpl.kt), all of which can work with any HTTP client\n- `telnyx-client-okhttp`\n - Depends on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`TelnyxOkHttpClient`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/TelnyxOkHttpClient.kt) and [`TelnyxOkHttpClientAsync`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/TelnyxOkHttpClientAsync.kt), which provide a way to construct [`TelnyxClientImpl`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientImpl.kt) and [`TelnyxClientAsyncImpl`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientAsyncImpl.kt), respectively, using OkHttp\n- `telnyx`\n - Depends on and exposes the APIs of both `telnyx-core` and `telnyx-client-okhttp`\n - Does not have its own logic\n\nThis structure allows replacing the SDK\'s default HTTP client without pulling in unnecessary dependencies.\n\n#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html)\n\n> [!TIP]\n> Try the available [network options](#network-options) before replacing the default client.\n\nTo use a customized `OkHttpClient`:\n\n1. Replace your [`telnyx` dependency](#installation) with `telnyx-core`\n2. Copy `telnyx-client-okhttp`\'s [`OkHttpClient`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`TelnyxClientImpl`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientImpl.kt) or [`TelnyxClientAsyncImpl`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientAsyncImpl.kt), similarly to [`TelnyxOkHttpClient`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/TelnyxOkHttpClient.kt) or [`TelnyxOkHttpClientAsync`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/TelnyxOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`telnyx` dependency](#installation) with `telnyx-core`\n2. Write a class that implements the [`HttpClient`](telnyx-core/src/main/kotlin/com/telnyx/sdk/core/http/HttpClient.kt) interface\n3. Construct [`TelnyxClientImpl`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientImpl.kt) or [`TelnyxClientAsyncImpl`](telnyx-core/src/main/kotlin/com/telnyx/sdk/client/TelnyxClientAsyncImpl.kt), similarly to [`TelnyxOkHttpClient`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/TelnyxOkHttpClient.kt) or [`TelnyxOkHttpClientAsync`](telnyx-client-okhttp/src/main/kotlin/com/telnyx/sdk/client/okhttp/TelnyxOkHttpClientAsync.kt), using your new client class\n\n## Undocumented API functionality\n\nThe SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.\n\n### Parameters\n\nTo set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class:\n\n```java\nimport com.telnyx.sdk.core.JsonValue;\nimport com.telnyx.sdk.models.calls.CallDialParams;\n\nCallDialParams params = CallDialParams.builder()\n .putAdditionalHeader("Secret-Header", "42")\n .putAdditionalQueryParam("secret_query_param", "42")\n .putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))\n .build();\n```\n\nThese can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods.\n\nTo set undocumented parameters on _nested_ headers, query params, or body classes, call the `putAdditionalProperty` method on the nested class:\n\n```java\nimport com.telnyx.sdk.core.JsonValue;\nimport com.telnyx.sdk.models.calls.CallDialParams;\n\nCallDialParams params = CallDialParams.builder()\n .answeringMachineDetectionConfig(CallDialParams.AnsweringMachineDetectionConfig.builder()\n .putAdditionalProperty("secretProperty", JsonValue.from("42"))\n .build())\n .build();\n```\n\nThese properties can be accessed on the nested built object later using the `_additionalProperties()` method.\n\nTo set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](telnyx-core/src/main/kotlin/com/telnyx/sdk/core/Values.kt) object to its setter:\n\n```java\nimport com.telnyx.sdk.core.JsonValue;\nimport com.telnyx.sdk.models.calls.CallDialParams;\n\nCallDialParams params = CallDialParams.builder()\n .connectionId(JsonValue.from(42))\n .from("+15557654321")\n .to("+15551234567")\n .webhookUrl("https://your-webhook.url/events")\n .build();\n```\n\nThe most straightforward way to create a [`JsonValue`](telnyx-core/src/main/kotlin/com/telnyx/sdk/core/Values.kt) is using its `from(...)` method:\n\n```java\nimport com.telnyx.sdk.core.JsonValue;\nimport java.util.List;\nimport java.util.Map;\n\n// Create primitive JSON values\nJsonValue nullValue = JsonValue.from(null);\nJsonValue booleanValue = JsonValue.from(true);\nJsonValue numberValue = JsonValue.from(42);\nJsonValue stringValue = JsonValue.from("Hello World!");\n\n// Create a JSON array value equivalent to `["Hello", "World"]`\nJsonValue arrayValue = JsonValue.from(List.of(\n "Hello", "World"\n));\n\n// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }`\nJsonValue objectValue = JsonValue.from(Map.of(\n "a", 1,\n "b", 2\n));\n\n// Create an arbitrarily nested JSON equivalent to:\n// {\n// "a": [1, 2],\n// "b": [3, 4]\n// }\nJsonValue complexValue = JsonValue.from(Map.of(\n "a", List.of(\n 1, 2\n ),\n "b", List.of(\n 3, 4\n )\n));\n```\n\nNormally a `Builder` class\'s `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset.\n\nTo forcibly omit a required parameter or property, pass [`JsonMissing`](telnyx-core/src/main/kotlin/com/telnyx/sdk/core/Values.kt):\n\n```java\nimport com.telnyx.sdk.core.JsonMissing;\nimport com.telnyx.sdk.models.calls.CallDialParams;\n\nCallDialParams params = CallDialParams.builder()\n .from("+18005550101")\n .to("+18005550100 or sip:username@sip.telnyx.com;secure=srtp")\n .connectionId(JsonMissing.of())\n .build();\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```java\nimport com.telnyx.sdk.core.JsonValue;\nimport java.util.Map;\n\nMap<String, JsonValue> additionalProperties = client.calls().dial(params)._additionalProperties();\nJsonValue secretPropertyValue = additionalProperties.get("secretProperty");\n\nString result = secretPropertyValue.accept(new JsonValue.Visitor<>() {\n @Override\n public String visitNull() {\n return "It\'s null!";\n }\n\n @Override\n public String visitBoolean(boolean value) {\n return "It\'s a boolean!";\n }\n\n @Override\n public String visitNumber(Number value) {\n return "It\'s a number!";\n }\n\n // Other methods include `visitMissing`, `visitString`, `visitArray`, and `visitObject`\n // The default implementation of each unimplemented method delegates to `visitDefault`, which throws by default, but can also be overridden\n});\n```\n\nTo access a property\'s raw JSON value, which may be undocumented, call its `_` prefixed method:\n\n```java\nimport com.telnyx.sdk.core.JsonField;\nimport java.util.Optional;\n\nJsonField<String> connectionId = client.calls().dial(params)._connectionId();\n\nif (connectionId.isMissing()) {\n // The property is absent from the JSON response\n} else if (connectionId.isNull()) {\n // The property was set to literal null\n} else {\n // Check if value was provided as a string\n // Other methods include `asNumber()`, `asBoolean()`, etc.\n Optional<String> jsonString = connectionId.asString();\n\n // Try to deserialize into a custom type\n MyClass myObject = connectionId.asUnknown().orElseThrow().convert(MyClass.class);\n}\n```\n\n### Response validation\n\nIn rare cases, the API may return a response that doesn\'t match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else.\n\nBy default, the SDK will not throw an exception in this case. It will throw [`TelnyxInvalidDataException`](telnyx-core/src/main/kotlin/com/telnyx/sdk/errors/TelnyxInvalidDataException.kt) only if you directly access the property.\n\nValidating the response is _not_ forwards compatible with new types from the API for existing fields.\n\nIf you would still prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```java\nimport com.telnyx.sdk.models.calls.CallDialResponse;\n\nCallDialResponse response = client.calls().dial(params).validate();\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```java\nimport com.telnyx.sdk.models.calls.CallDialResponse;\n\nCallDialResponse response = client.calls().dial(\n params, RequestOptions.builder().responseValidation(true).build()\n);\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.telnyx.sdk.client.TelnyxClient;\nimport com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;\n\nTelnyxClient client = TelnyxOkHttpClient.builder()\n .fromEnv()\n .responseValidation(true)\n .build();\n```\n\n## FAQ\n\n### Why don\'t you use plain `enum` classes?\n\nJava `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value.\n\n### Why do you represent fields using `JsonField<T>` instead of just plain `T`?\n\nUsing `JsonField<T>` enables a few features:\n\n- Allowing usage of [undocumented API functionality](#undocumented-api-functionality)\n- Lazily [validating the API response against the expected shape](#response-validation)\n- Representing absent vs explicitly null values\n\n### Why don\'t you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)?\n\nIt is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don\'t want to introduce a breaking change every time we add a field to a class.\n\n### Why don\'t you use checked exceptions?\n\nChecked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason.\n\nChecked exceptions:\n\n- Are verbose to handle\n- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error\n- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function)\n- Don\'t play well with lambdas (also due to the function coloring problem)\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/team-telnyx/telnyx-java/issues) with questions, bugs, or suggestions.\n',
49952
49952
  },
49953
49953
  {
49954
49954
  language: 'php',
@@ -49956,7 +49956,7 @@ const EMBEDDED_READMES = [
49956
49956
  },
49957
49957
  {
49958
49958
  language: 'python',
49959
- content: '# Telnyx Python API library\n\n<!-- prettier-ignore -->\n[![PyPI version](https://img.shields.io/pypi/v/telnyx.svg?label=pypi%20(stable))](https://pypi.org/project/telnyx/)\n\nThe Telnyx Python library provides convenient access to the Telnyx REST API from any Python 3.9+\napplication. The library includes type definitions for all request params and response fields,\nand offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Telnyx MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=telnyx-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsInRlbG55eC1tY3AiXSwiZW52Ijp7IlRFTE5ZWF9BUElfS0VZIjoiTXkgQVBJIEtleSIsIlRFTE5ZWF9QVUJMSUNfS0VZIjoiTXkgUHVibGljIEtleSIsIlRFTE5ZWF9DTElFTlRfSUQiOiJNeSBDbGllbnQgSUQiLCJURUxOWVhfQ0xJRU5UX1NFQ1JFVCI6Ik15IENsaWVudCBTZWNyZXQifX0)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22telnyx-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22telnyx-mcp%22%5D%2C%22env%22%3A%7B%22TELNYX_API_KEY%22%3A%22My%20API%20Key%22%2C%22TELNYX_PUBLIC_KEY%22%3A%22My%20Public%20Key%22%2C%22TELNYX_CLIENT_ID%22%3A%22My%20Client%20ID%22%2C%22TELNYX_CLIENT_SECRET%22%3A%22My%20Client%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\n The full API of this library can be found in [api.md](api.md).\n\n## Installation\n\n```sh\n# install from PyPI\npip install telnyx\n```\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```python\nimport os\nfrom telnyx import Telnyx\n\nclient = Telnyx(\n api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted\n)\n\nresponse = client.calls.dial(\n connection_id="conn12345",\n from_="+15557654321",\n to="+15551234567",\n webhook_url="https://your-webhook.url/events",\n)\nprint(response.data)\n```\n\nWhile you can provide an `api_key` keyword argument,\nwe recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)\nto add `TELNYX_API_KEY="My API Key"` to your `.env` file\nso that your API Key is not stored in source control.\n\n## Async usage\n\nSimply import `AsyncTelnyx` instead of `Telnyx` and use `await` with each API call:\n\n```python\nimport os\nimport asyncio\nfrom telnyx import AsyncTelnyx\n\nclient = AsyncTelnyx(\n api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted\n)\n\nasync def main() -> None:\n response = await client.calls.dial(\n connection_id="conn12345",\n from_="+15557654321",\n to="+15551234567",\n webhook_url="https://your-webhook.url/events",\n )\n print(response.data)\n\nasyncio.run(main())\n```\n\nFunctionality between the synchronous and asynchronous clients is otherwise identical.\n\n### With aiohttp\n\nBy default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.\n\nYou can enable this by installing `aiohttp`:\n\n```sh\n# install from PyPI\npip install telnyx[aiohttp]\n```\n\nThen you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:\n\n```python\nimport os\nimport asyncio\nfrom telnyx import DefaultAioHttpClient\nfrom telnyx import AsyncTelnyx\n\nasync def main() -> None:\n async with AsyncTelnyx(\n api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted\n http_client=DefaultAioHttpClient(),\n) as client:\n response = await client.calls.dial(\n connection_id="conn12345",\n from_="+15557654321",\n to="+15551234567",\n webhook_url="https://your-webhook.url/events",\n )\n print(response.data)\n\nasyncio.run(main())\n```\n\n\n\n## Using types\n\nNested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:\n\n- Serializing back into JSON, `model.to_json()`\n- Converting to a dictionary, `model.to_dict()`\n\nTyped requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.\n\n## Pagination\n\nList methods in the Telnyx API are paginated.\n\nThis library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:\n\n```python\nfrom telnyx import Telnyx\n\nclient = Telnyx()\n\nall_access_ip_addresses = []\n# Automatically fetches more pages as needed.\nfor access_ip_address in client.access_ip_address.list(\n page_number=1,\n page_size=50,\n):\n # Do something with access_ip_address here\n all_access_ip_addresses.append(access_ip_address)\nprint(all_access_ip_addresses)\n```\n\nOr, asynchronously:\n\n```python\nimport asyncio\nfrom telnyx import AsyncTelnyx\n\nclient = AsyncTelnyx()\n\nasync def main() -> None:\n all_access_ip_addresses = []\n # Iterate through items across all pages, issuing requests as needed.\n async for access_ip_address in client.access_ip_address.list(\n page_number=1,\n page_size=50,\n):\n all_access_ip_addresses.append(access_ip_address)\n print(all_access_ip_addresses)\n\nasyncio.run(main())\n```\n\nAlternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:\n\n```python\nfirst_page = await client.access_ip_address.list(\n page_number=1,\n page_size=50,\n)\nif first_page.has_next_page():\n print(f"will fetch next page using these details: {first_page.next_page_info()}")\n next_page = await first_page.get_next_page()\n print(f"number of items we just fetched: {len(next_page.data)}")\n\n# Remove `await` for non-async usage.\n```\n\nOr just work directly with the returned data:\n\n```python\nfirst_page = await client.access_ip_address.list(\n page_number=1,\n page_size=50,\n)\n\nprint(f"page number: {first_page.meta.page_number}") # => "page number: 1"\nfor access_ip_address in first_page.data:\n print(access_ip_address.id)\n\n# Remove `await` for non-async usage.\n```\n\n## Nested params\n\nNested parameters are dictionaries, typed using `TypedDict`, for example:\n\n```python\nfrom telnyx import Telnyx\n\nclient = Telnyx()\n\nresponse = client.calls.dial(\n connection_id="7267xxxxxxxxxxxxxx",\n from_="+18005550101",\n to="+18005550100 or sip:username@sip.telnyx.com",\n answering_machine_detection_config={\n "after_greeting_silence_millis": 1000,\n "between_words_silence_millis": 1000,\n "greeting_duration_millis": 1000,\n "greeting_silence_duration_millis": 2000,\n "greeting_total_analysis_time_millis": 50000,\n "initial_silence_millis": 1000,\n "maximum_number_of_words": 1000,\n "maximum_word_length_millis": 2000,\n "silence_threshold": 512,\n "total_analysis_time_millis": 5000,\n },\n)\nprint(response.answering_machine_detection_config)\n```\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.\n\n```python\nfrom pathlib import Path\nfrom telnyx import Telnyx\n\nclient = Telnyx()\n\nclient.ai.audio.transcribe(\n model="distil-whisper/distil-large-v2",\n file=Path("/path/to/file"),\n)\n```\n\nThe async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.\n\n## Handling errors\n\nWhen the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `telnyx.APIConnectionError` is raised.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `telnyx.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `telnyx.APIError`.\n\n```python\nimport telnyx\nfrom telnyx import Telnyx\n\nclient = Telnyx()\n\ntry:\n client.number_orders.create(\n phone_numbers=[{\n "phone_number": "+15558675309"\n }],\n )\nexcept telnyx.APIConnectionError as e:\n print("The server could not be reached")\n print(e.__cause__) # an underlying Exception, likely raised within httpx.\nexcept telnyx.RateLimitError as e:\n print("A 429 status code was received; we should back off a bit.")\nexcept telnyx.APIStatusError as e:\n print("Another non-200-range status code was received")\n print(e.status_code)\n print(e.response)\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors are automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors are all retried by default.\n\nYou can use the `max_retries` option to configure or disable retry settings:\n\n```python\nfrom telnyx import Telnyx\n\n# Configure the default for all requests:\nclient = Telnyx(\n # default is 2\n max_retries=0,\n)\n\n# Or, configure per-request:\nclient.with_options(max_retries = 5).number_orders.create(\n phone_numbers=[{\n "phone_number": "+15558675309"\n }],\n)\n```\n\n### Timeouts\n\nBy default requests time out after 1 minute. You can configure this with a `timeout` option,\nwhich accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:\n\n```python\nfrom telnyx import Telnyx\n\n# Configure the default for all requests:\nclient = Telnyx(\n # 20 seconds (default is 1 minute)\n timeout=20.0,\n)\n\n# More granular control:\nclient = Telnyx(\n timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),\n)\n\n# Override per-request:\nclient.with_options(timeout = 5.0).number_orders.create(\n phone_numbers=[{\n "phone_number": "+15558675309"\n }],\n)\n```\n\nOn timeout, an `APITimeoutError` is thrown.\n\nNote that requests that time out are [retried twice by default](#retries).\n\n\n\n## Advanced\n\n### Logging\n\nWe use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.\n\nYou can enable logging by setting the environment variable `TELNYX_LOG` to `info`.\n\n```shell\n$ export TELNYX_LOG=info\n```\n\nOr to `debug` for more verbose logging.\n\n### How to tell whether `None` means `null` or missing\n\nIn an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:\n\n```py\nif response.my_field is None:\n if \'my_field\' not in response.model_fields_set:\n print(\'Got json like {}, without a "my_field" key present at all.\')\n else:\n print(\'Got json like {"my_field": null}.\')\n```\n\n### Accessing raw response data (e.g. headers)\n\nThe "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,\n\n```py\nfrom telnyx import Telnyx\n\nclient = Telnyx()\nresponse = client.number_orders.with_raw_response.create(\n phone_numbers=[{\n "phone_number": "+15558675309"\n }],\n)\nprint(response.headers.get(\'X-My-Header\'))\n\nnumber_order = response.parse() # get the object that `number_orders.create()` would have returned\nprint(number_order.data)\n```\n\nThese methods return an [`APIResponse`](https://github.com/team-telnyx/telnyx-python/tree/master/src/telnyx/_response.py) object.\n\nThe async client returns an [`AsyncAPIResponse`](https://github.com/team-telnyx/telnyx-python/tree/master/src/telnyx/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.\n\n#### `.with_streaming_response`\n\nThe above interface eagerly reads the full response body when you make the request, which may not always be what you want.\n\nTo stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.\n\n```python\nwith client.number_orders.with_streaming_response.create(\n phone_numbers=[{\n "phone_number": "+15558675309"\n }],\n) as response :\n print(response.headers.get(\'X-My-Header\'))\n\n for line in response.iter_lines():\n print(line)\n```\n\nThe context manager is required so that the response will reliably be closed.\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API.\n\nIf you need to access undocumented endpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other\nhttp verbs. Options on the client will be respected (such as retries) when making this request.\n\n```py\nimport httpx\n\nresponse = client.post(\n "/foo",\n cast_to=httpx.Response,\n body={"my_param": True},\n)\n\nprint(response.headers.get("x-foo"))\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You\ncan also get all the extra fields on the Pydantic model as a dict with\n[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).\n\n### Configuring the HTTP client\n\nYou can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:\n\n- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)\n- Custom [transports](https://www.python-httpx.org/advanced/transports/)\n- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality\n\n```python\nimport httpx\nfrom telnyx import Telnyx, DefaultHttpxClient\n\nclient = Telnyx(\n # Or use the `TELNYX_BASE_URL` env var\n base_url="http://my.test.server.example.com:8083",\n http_client=DefaultHttpxClient(proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")),\n)\n```\n\nYou can also customize the client on a per-request basis by using `with_options()`:\n\n```python\nclient.with_options(http_client=DefaultHttpxClient(...))\n```\n\n### Managing HTTP resources\n\nBy default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.\n\n```py\nfrom telnyx import Telnyx\n\nwith Telnyx() as client:\n # make requests here\n ...\n\n# HTTP client is now closed\n```\n\n## Versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/team-telnyx/telnyx-python/issues) with questions, bugs, or suggestions.\n\n### Determining the installed version\n\nIf you\'ve upgraded to the latest version but aren\'t seeing any new features you were expecting then your python environment is likely still using an older version.\n\nYou can determine the version that is being used at runtime with:\n\n```py\nimport telnyx\nprint(telnyx.__version__)\n```\n\n## Requirements\n\nPython 3.9 or higher.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n',
49959
+ content: '# Telnyx Python API library\n\n<!-- prettier-ignore -->\n[![PyPI version](https://img.shields.io/pypi/v/telnyx.svg?label=pypi%20(stable))](https://pypi.org/project/telnyx/)\n\nThe Telnyx Python library provides convenient access to the Telnyx REST API from any Python 3.9+\napplication. The library includes type definitions for all request params and response fields,\nand offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Telnyx MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=telnyx-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsInRlbG55eC1tY3AiXSwiZW52Ijp7IlRFTE5ZWF9BUElfS0VZIjoiTXkgQVBJIEtleSIsIlRFTE5ZWF9QVUJMSUNfS0VZIjoiTXkgUHVibGljIEtleSIsIlRFTE5ZWF9DTElFTlRfSUQiOiJNeSBDbGllbnQgSUQiLCJURUxOWVhfQ0xJRU5UX1NFQ1JFVCI6Ik15IENsaWVudCBTZWNyZXQifX0)\n[![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22telnyx-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22telnyx-mcp%22%5D%2C%22env%22%3A%7B%22TELNYX_API_KEY%22%3A%22My%20API%20Key%22%2C%22TELNYX_PUBLIC_KEY%22%3A%22My%20Public%20Key%22%2C%22TELNYX_CLIENT_ID%22%3A%22My%20Client%20ID%22%2C%22TELNYX_CLIENT_SECRET%22%3A%22My%20Client%20Secret%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\n The full API of this library can be found in [api.md](api.md).\n\n## Installation\n\n```sh\n# install from PyPI\npip install telnyx\n```\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```python\nimport os\nfrom telnyx import Telnyx\n\nclient = Telnyx(\n api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted\n)\n\nresponse = client.calls.dial(\n connection_id="conn12345",\n from_="+15557654321",\n to="+15551234567",\n webhook_url="https://your-webhook.url/events",\n)\nprint(response.data)\n```\n\nWhile you can provide an `api_key` keyword argument,\nwe recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)\nto add `TELNYX_API_KEY="My API Key"` to your `.env` file\nso that your API Key is not stored in source control.\n\n## Async usage\n\nSimply import `AsyncTelnyx` instead of `Telnyx` and use `await` with each API call:\n\n```python\nimport os\nimport asyncio\nfrom telnyx import AsyncTelnyx\n\nclient = AsyncTelnyx(\n api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted\n)\n\nasync def main() -> None:\n response = await client.calls.dial(\n connection_id="conn12345",\n from_="+15557654321",\n to="+15551234567",\n webhook_url="https://your-webhook.url/events",\n )\n print(response.data)\n\nasyncio.run(main())\n```\n\nFunctionality between the synchronous and asynchronous clients is otherwise identical.\n\n### With aiohttp\n\nBy default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.\n\nYou can enable this by installing `aiohttp`:\n\n```sh\n# install from PyPI\npip install telnyx[aiohttp]\n```\n\nThen you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:\n\n```python\nimport os\nimport asyncio\nfrom telnyx import DefaultAioHttpClient\nfrom telnyx import AsyncTelnyx\n\nasync def main() -> None:\n async with AsyncTelnyx(\n api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted\n http_client=DefaultAioHttpClient(),\n) as client:\n response = await client.calls.dial(\n connection_id="conn12345",\n from_="+15557654321",\n to="+15551234567",\n webhook_url="https://your-webhook.url/events",\n )\n print(response.data)\n\nasyncio.run(main())\n```\n\n\n\n## Using types\n\nNested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:\n\n- Serializing back into JSON, `model.to_json()`\n- Converting to a dictionary, `model.to_dict()`\n\nTyped requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.\n\n## Pagination\n\nList methods in the Telnyx API are paginated.\n\nThis library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:\n\n```python\nfrom telnyx import Telnyx\n\nclient = Telnyx()\n\nall_access_ip_addresses = []\n# Automatically fetches more pages as needed.\nfor access_ip_address in client.access_ip_address.list(\n page_number=1,\n page_size=50,\n):\n # Do something with access_ip_address here\n all_access_ip_addresses.append(access_ip_address)\nprint(all_access_ip_addresses)\n```\n\nOr, asynchronously:\n\n```python\nimport asyncio\nfrom telnyx import AsyncTelnyx\n\nclient = AsyncTelnyx()\n\nasync def main() -> None:\n all_access_ip_addresses = []\n # Iterate through items across all pages, issuing requests as needed.\n async for access_ip_address in client.access_ip_address.list(\n page_number=1,\n page_size=50,\n):\n all_access_ip_addresses.append(access_ip_address)\n print(all_access_ip_addresses)\n\nasyncio.run(main())\n```\n\nAlternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:\n\n```python\nfirst_page = await client.access_ip_address.list(\n page_number=1,\n page_size=50,\n)\nif first_page.has_next_page():\n print(f"will fetch next page using these details: {first_page.next_page_info()}")\n next_page = await first_page.get_next_page()\n print(f"number of items we just fetched: {len(next_page.data)}")\n\n# Remove `await` for non-async usage.\n```\n\nOr just work directly with the returned data:\n\n```python\nfirst_page = await client.access_ip_address.list(\n page_number=1,\n page_size=50,\n)\n\nprint(f"page number: {first_page.meta.page_number}") # => "page number: 1"\nfor access_ip_address in first_page.data:\n print(access_ip_address.id)\n\n# Remove `await` for non-async usage.\n```\n\n## Nested params\n\nNested parameters are dictionaries, typed using `TypedDict`, for example:\n\n```python\nfrom telnyx import Telnyx\n\nclient = Telnyx()\n\nresponse = client.calls.dial(\n connection_id="7267xxxxxxxxxxxxxx",\n from_="+18005550101",\n to="+18005550100 or sip:username@sip.telnyx.com;secure=srtp",\n answering_machine_detection_config={\n "after_greeting_silence_millis": 1000,\n "between_words_silence_millis": 1000,\n "greeting_duration_millis": 1000,\n "greeting_silence_duration_millis": 2000,\n "greeting_total_analysis_time_millis": 50000,\n "initial_silence_millis": 1000,\n "maximum_number_of_words": 1000,\n "maximum_word_length_millis": 2000,\n "silence_threshold": 512,\n "total_analysis_time_millis": 5000,\n },\n)\nprint(response.answering_machine_detection_config)\n```\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.\n\n```python\nfrom pathlib import Path\nfrom telnyx import Telnyx\n\nclient = Telnyx()\n\nclient.ai.audio.transcribe(\n model="distil-whisper/distil-large-v2",\n file=Path("/path/to/file"),\n)\n```\n\nThe async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.\n\n## Handling errors\n\nWhen the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `telnyx.APIConnectionError` is raised.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `telnyx.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `telnyx.APIError`.\n\n```python\nimport telnyx\nfrom telnyx import Telnyx\n\nclient = Telnyx()\n\ntry:\n client.number_orders.create(\n phone_numbers=[{\n "phone_number": "+15558675309"\n }],\n )\nexcept telnyx.APIConnectionError as e:\n print("The server could not be reached")\n print(e.__cause__) # an underlying Exception, likely raised within httpx.\nexcept telnyx.RateLimitError as e:\n print("A 429 status code was received; we should back off a bit.")\nexcept telnyx.APIStatusError as e:\n print("Another non-200-range status code was received")\n print(e.status_code)\n print(e.response)\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors are automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors are all retried by default.\n\nYou can use the `max_retries` option to configure or disable retry settings:\n\n```python\nfrom telnyx import Telnyx\n\n# Configure the default for all requests:\nclient = Telnyx(\n # default is 2\n max_retries=0,\n)\n\n# Or, configure per-request:\nclient.with_options(max_retries = 5).number_orders.create(\n phone_numbers=[{\n "phone_number": "+15558675309"\n }],\n)\n```\n\n### Timeouts\n\nBy default requests time out after 1 minute. You can configure this with a `timeout` option,\nwhich accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:\n\n```python\nfrom telnyx import Telnyx\n\n# Configure the default for all requests:\nclient = Telnyx(\n # 20 seconds (default is 1 minute)\n timeout=20.0,\n)\n\n# More granular control:\nclient = Telnyx(\n timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),\n)\n\n# Override per-request:\nclient.with_options(timeout = 5.0).number_orders.create(\n phone_numbers=[{\n "phone_number": "+15558675309"\n }],\n)\n```\n\nOn timeout, an `APITimeoutError` is thrown.\n\nNote that requests that time out are [retried twice by default](#retries).\n\n\n\n## Advanced\n\n### Logging\n\nWe use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.\n\nYou can enable logging by setting the environment variable `TELNYX_LOG` to `info`.\n\n```shell\n$ export TELNYX_LOG=info\n```\n\nOr to `debug` for more verbose logging.\n\n### How to tell whether `None` means `null` or missing\n\nIn an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:\n\n```py\nif response.my_field is None:\n if \'my_field\' not in response.model_fields_set:\n print(\'Got json like {}, without a "my_field" key present at all.\')\n else:\n print(\'Got json like {"my_field": null}.\')\n```\n\n### Accessing raw response data (e.g. headers)\n\nThe "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,\n\n```py\nfrom telnyx import Telnyx\n\nclient = Telnyx()\nresponse = client.number_orders.with_raw_response.create(\n phone_numbers=[{\n "phone_number": "+15558675309"\n }],\n)\nprint(response.headers.get(\'X-My-Header\'))\n\nnumber_order = response.parse() # get the object that `number_orders.create()` would have returned\nprint(number_order.data)\n```\n\nThese methods return an [`APIResponse`](https://github.com/team-telnyx/telnyx-python/tree/master/src/telnyx/_response.py) object.\n\nThe async client returns an [`AsyncAPIResponse`](https://github.com/team-telnyx/telnyx-python/tree/master/src/telnyx/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.\n\n#### `.with_streaming_response`\n\nThe above interface eagerly reads the full response body when you make the request, which may not always be what you want.\n\nTo stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.\n\n```python\nwith client.number_orders.with_streaming_response.create(\n phone_numbers=[{\n "phone_number": "+15558675309"\n }],\n) as response :\n print(response.headers.get(\'X-My-Header\'))\n\n for line in response.iter_lines():\n print(line)\n```\n\nThe context manager is required so that the response will reliably be closed.\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API.\n\nIf you need to access undocumented endpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other\nhttp verbs. Options on the client will be respected (such as retries) when making this request.\n\n```py\nimport httpx\n\nresponse = client.post(\n "/foo",\n cast_to=httpx.Response,\n body={"my_param": True},\n)\n\nprint(response.headers.get("x-foo"))\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You\ncan also get all the extra fields on the Pydantic model as a dict with\n[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).\n\n### Configuring the HTTP client\n\nYou can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:\n\n- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)\n- Custom [transports](https://www.python-httpx.org/advanced/transports/)\n- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality\n\n```python\nimport httpx\nfrom telnyx import Telnyx, DefaultHttpxClient\n\nclient = Telnyx(\n # Or use the `TELNYX_BASE_URL` env var\n base_url="http://my.test.server.example.com:8083",\n http_client=DefaultHttpxClient(proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")),\n)\n```\n\nYou can also customize the client on a per-request basis by using `with_options()`:\n\n```python\nclient.with_options(http_client=DefaultHttpxClient(...))\n```\n\n### Managing HTTP resources\n\nBy default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.\n\n```py\nfrom telnyx import Telnyx\n\nwith Telnyx() as client:\n # make requests here\n ...\n\n# HTTP client is now closed\n```\n\n## Versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/team-telnyx/telnyx-python/issues) with questions, bugs, or suggestions.\n\n### Determining the installed version\n\nIf you\'ve upgraded to the latest version but aren\'t seeing any new features you were expecting then your python environment is likely still using an older version.\n\nYou can determine the version that is being used at runtime with:\n\n```py\nimport telnyx\nprint(telnyx.__version__)\n```\n\n## Requirements\n\nPython 3.9 or higher.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n',
49960
49960
  },
49961
49961
  {
49962
49962
  language: 'ruby',