Skip to main content
POST
/
texml
/
calls
/
{application_id}
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: 'My API Key',
});

const response = await client.texml.calls.initiate('application_id', {
  From: '+13120001234',
  To: '+13121230000',
});

console.log(response.data);
{
  "data": {
    "from": "+13120001234",
    "to": "+13121230000",
    "status": "queued"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

application_id
string
required

The ID of the TeXML application used for the call.

Body

application/json

Iniatiate Call request object

To
string
required

The phone number of the called party. Phone numbers are formatted with a + and country code.

Example:

"+16175551212"

From
string
required

The phone number of the party that initiated the call. Phone numbers are formatted with a + and country code.

Example:

"+16175551212"

CallerId
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.

Example:

"Info"

Url
string

The URL from which Telnyx will retrieve the TeXML call instructions.

Example:

"https://www.example.com/instructions.xml"

UrlMethod
enum<string>
default:POST

HTTP request type used for Url. The default value is inherited from TeXML Application setting.

Available options:
GET,
POST
Example:

"GET"

FallbackUrl
string

A failover URL for which Telnyx will retrieve the TeXML call instructions if the Url is not responding.

Example:

"https://www.example.com/instructions-fallback.xml"

StatusCallback
string

URL destination for Telnyx to send status callback events to for the call.

Example:

"https://www.example.com/callback"

StatusCallbackMethod
enum<string>
default:POST

HTTP request type used for StatusCallback.

Available options:
GET,
POST
Example:

"GET"

StatusCallbackEvent
enum<string>
default:completed

The call events for which Telnyx should send a webhook. Multiple events can be defined when separated by a space.

Available options:
initiated,
ringing,
answered,
completed
Example:

"iniated ringing"

MachineDetection
enum<string>
default:Disable

Enables Answering Machine Detection.

Available options:
Enable,
Disable,
DetectMessageEnd
Example:

"Enable"

DetectionMode
enum<string>
default:Regular

Allows you to chose between Premium and Standard detections.

Available options:
Premium,
Regular
Example:

"Premium"

AsyncAmd
boolean
default:false

Select whether to perform answering machine detection in the background. By default execution is blocked until Answering Machine Detection is completed.

Example:

true

AsyncAmdStatusCallback
string

URL destination for Telnyx to send AMD callback events to for the call.

Example:

"https://www.example.com/callback"

AsyncAmdStatusCallbackMethod
enum<string>
default:POST

HTTP request type used for AsyncAmdStatusCallback. The default value is inherited from TeXML Application setting.

Available options:
GET,
POST
Example:

"GET"

MachineDetectionTimeout
integer
default:30000

Maximum timeout threshold in milliseconds for overall detection.

Required range: 500 <= x <= 60000
Example:

5000

MachineDetectionSpeechThreshold
integer
default:3500

Maximum threshold of a human greeting. If greeting longer than this value, considered machine. Ignored when premium detection is used.

Example:

2000

MachineDetectionSpeechEndThreshold
integer
default:800

Silence duration threshold after a greeting message or voice for it be considered human. Ignored when premium detection is used.

Example:

2000

MachineDetectionSilenceTimeout
integer
default:3500

If initial silence duration is greater than this value, consider it a machine. Ignored when premium detection is used.

Example:

2000

CancelPlaybackOnMachineDetection
boolean
default:true

Whether to cancel ongoing playback on machine detection. Defaults to true.

Example:

false

CancelPlaybackOnDetectMessageEnd
boolean
default:true

Whether to cancel ongoing playback on greeting ended detection. Defaults to true.

Example:

false

PreferredCodecs
string

The list of comma-separated codecs to be offered on a call.

Example:

"PCMA,PCMU"

Record
boolean

Whether to record the entire participant's call leg. Defaults to false.

Example:

false

RecordingChannels
enum<string>

The number of channels in the final recording. Defaults to mono.

Available options:
mono,
dual
Example:

"dual"

RecordingStatusCallback
string

The URL the recording callbacks will be sent to.

Example:

"https://example.com/recording_status_callback"

RecordingStatusCallbackMethod
enum<string>

HTTP request type used for RecordingStatusCallback. Defaults to POST.

Available options:
GET,
POST
Example:

"GET"

RecordingStatusCallbackEvent
string

The changes to the recording's state that should generate a call to RecoridngStatusCallback. Can be: in-progress, completed and absent. Separate multiple values with a space. Defaults to completed.

Example:

"in-progress completed absent"

RecordingTimeout
integer
default:0

The number of seconds that Telnyx will wait for the recording to be stopped if silence is detected. The timer only starts when the speech is detected. Please note that the transcription is used to detect silence and the related charge will be applied. The minimum value is 0. The default value is 0 (infinite)

Example:

5

RecordingTrack
enum<string>

The audio track to record for the call. The default is both.

Available options:
inbound,
outbound,
both
Example:

"inbound"

SipAuthPassword
string

The password to use for SIP authentication.

Example:

"1234"

SipAuthUsername
string

The username to use for SIP authentication.

Example:

"user"

Trim
enum<string>

Whether to trim any leading and trailing silence from the recording. Defaults to trim-silence.

Available options:
trim-silence,
do-not-trim
Example:

false

Response

200 - application/json

Successful response upon initiating a TeXML call.

data
Initaite TeXML Call Result · object
Example:
{
"from": "+13120001234",
"to": "+13121230000",
"status": "queued"
}