Skip to main content

FlexML Requests

Introduction

For inbound calls, the url and method from the DID object will be used. If the url value in the DID object is not set, then the url and method values from the Account object will be used instead.

For outbound calls, these values are set in the Call object. CarrierX will make a request to the URL provided, and expects to receive FlexML instructions in the response. These instructions contain a set of ordered commands that will be used to handle the call. The method value is the type of request that will be made to the url, either POST or GET.

Request Data

Data about the call will be passed in the request body in the JSON format if the method is POST. Data will be passed as query parameters if the method is GET.

AttributeData TypeDescription
AccountSid
string

The account secure ID. This field is not yet supported and will be blank.

ApiVersion
string

The API version used to make the call.

CallerName
string

The CNAM of the calling party.

CallSid
string

The call secure ID. This value will remain the same throughout the duration of the call.

CallStatus
string

Denotes if an error has occurred. Refer to the table below for a list of values that appear in this field.

Direction
string

Denotes whether the call was inbound or outbound.

ForwardedFrom
string

Contains the phone number in the Diversion header, if present. This is used in cases such as conditional call forwarding. Note that not all carriers support passing this information in the header.

From
string

The calling party phone number, in the E.164 format.

OriginalFrom
string

The calling party phone number in a raw format, received directly from the carrier. Note that in development, From will generally be used.

OriginalTo
string

The phone number that was dialed in a raw format, received directly from the carrier. Note that in development, To will generally be used.

RequestUrl
string

The URL of the FlexML that was running to trigger the current request.

To
string

The phone number that is dialed, in the E.164 format.

Successful requests return a JSON response that looks like the following:

{
"AccountSid":"",
"ApiVersion":"2.0",
"CallerName":"",
"CallSid":"4695bc4a0932bcd2e99492e523db9ee2",
"CallStatus":"completed",
"Direction":"inbound",
"From":"15162065338",
"OriginalFrom":"+15162065338",
"OriginalTo":"15162065337",
"RequestUrl":"https://sampleurl.com/example",
"To":"15162065337"
}

CallStatus Values

The following are values that appear in the CallStatus field.

ValueDescription
busyThere was a busy signal.
cancelThe calling party canceled the call instead of answering it.
completedThe call was answered normally.
failedThe call failed to go through. There are a number of reasons why this can happen, including that the phone number was not valid or all channels were busy.
noanswerThere were too many rings without an answer.

In addition to the Request Data described in the table above, data can also include the URL holding the recording audio and the duration of the recording in seconds. Callback data depends on the type of FlexML instructions being executed.

Please refer to the individual verb sections for additional data returned when using those verbs.