Pivot

About Pivot

Execute an HTTP request to a web server about the call, expecting more callflow instructions in the response.

Schema

Validator for the Pivot callflow element

KeyDescriptionTypeDefaultRequiredSupport Level
cdr_urlOptional URL to send the CDR to at the end of the callstring(7..)false
`custom_request_headers./^[xX]-/`Include a custom X- headerstring()false
custom_request_headersCustom HTTP X- headers to be included on each Pivot request to the voice_urlobject()false
debugStore debug logs related to processing this Pivot callboolean()falsefalse
methodWhat HTTP verb to send the request(s) with`string(‘get''post''GET''POST’)`
req_body_formatWhat format should the request body have when using POST`string(‘form''json’)`formfalse
req_formatWhat format of Pivot will the your server respond with`string(‘kazoo''twiml’)`kazoofalse
req_timeout_msHow long, in milliseconds, to wait for a Pivot response from the HTTP serverinteger(..5000)false
skip_moduleWhen set to true this callflow action is skipped, advancing to the wildcard branch (if any)boolean()false
voice_urlWhat URL to request the initial Pivot callflowstring(7..)true
TwiML

TwiML support is limited at the moment; KAZOO JSON is highly encouraged.

Note

cdr_url is only applicable when using the XML (TwiML) format. When using the kazoo format, control is handed off to the Callflows app, with the Pivot process ending (and nothing waiting for the CDR). Instead, please use webhooks (specifically the CHANNEL_DESTROY event) to receive CDRs.

Handling failures

The Pivot request can fail for a number of reasons:

  • DNS resolution of the web server fails
  • Connection (TLS or clear) to the web server fails
  • Response is not of a known content-type
  • Response is not valid callflow JSON

The pivot callflow action waits until either

  1. The Pivot response is processed successfully, in which case the pivot callflow action exits quietly
  2. The Pivot response fails (for whatever reason), in which case the pivot callflow action goes to the default _ child branch (if any).

In the example below, if an error occurs when getting a response from {SERVER_URL}, the caller will hear the media at {MEDIA_ID} played and the call will end.

"flow": {
    "data": {
        "method": "GET",
        "req_timeout": "5",
        "req_format": "kazoo",
        "voice_url": "{SERVER_URL}"
    },
    "module": "pivot",
    "children": {
        "_": {
            "module": "play",
            "data": {
                "id": "{MEDIA_ID}"
            },
            "children": {}
        }
    }
}

On this page