Skip to main content

FlexML Responses

Introduction

When CarrierX makes an HTTP request, your application must respond with

  • a 200 status
  • a set FlexML instructions (FlexML is XML of a specific syntax). Each set of FlexML instructions is wrapped within <Response> start and end tags.
<Response>
...
</Response>

Verbs

Tags nested inside of Response tags are called verbs, and may have attributes that modify those verbs. Verbs are:

  • Executed top-to-bottom, unless a verb explicitly branches execution to another set of instructions.
  • May include nested verbs (actions) or nouns (details of the verb).

Example FlexML Response

<Response>
<Gather action="http://www.example.com/path/to/handler" timeout="5">
<Say>Please enter the extension of the party you would like to reach. </Say>
</Gather>
<Say>You did not enter an extension. </Say>
<Hangup />
</Response>

The Response above says, collect DTMF input from the other party, asking them to enter an extension, and wait up to 5 seconds for input. If we get input, request another set of instructions from http://www.example.com/path/to/handler. If not, tell the other party we did not get an extension and end the call.

Breakdown of the Example

  1. Gather - Get DTMF input from the other party.

    Attributes

    • action — URL for the next FlexML response if DTMF input is collected. If an input is collected from the other party, no further verbs in this Response will be executed. Instead, the new Response returned from this action URL will be executed. If no input is collected, the next verb after Gather will be executed.
    • timeout — Seconds to wait for input. The timeout begins after the embedded Say verb.

    Embedded Verb

    • Say - Use text-to-speech to ask the other party to enter an extension. Because this verb is within the Gather, it is executed right away. Being inside the Gather, user input is collected while the Say is executed.

  2. Say - Use text-to-speech to tell the other party no input was collected.

  3. Hangup - End the call.

If input is received, the action URL overrides the remaining verbs in the current response.