Call Control Verbs
  • 09 Sep 2021
  • 4 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Call Control Verbs

  • Dark
    Light
  • PDF

Article Summary

Call control verbs are returned from 3rd party REST endpoints to control the flow of a call dynamically. We expect a JSON response as an array. Here is an example which returns some text to speech and then plays a beep:

[
    {
        "say" : {
            "text" : [
                "Welcome to callable!",
                "Have a great day!"
            ],
            "loop" : 1,
            "voice" : "en-GB-Standard-A"
        }
    },
    {
    "play" : {
        "url" : "https://recordable.io/sounds/beep.mp3",
        "loop" : 1
    }
]

To determine how your software responds, you will need to know some information about the call. We POST the following minimal payload to your registered webhook:

{
    "callId":"6624872eb9991b38efa4d444",
    "from":"441234567890",
    "to":"441234567891",
    "digits":"",
    "speech":"",
    "action":"start"
}

To enable a 3rd party webhook, choose Control - Generic from the webhook list when creating a new webhook

image.png

The webhook then needs to be assigned to the call flow using a plugin to reference it.

image.png

Then include the plugin as part of the call flow.

image.png

The Verbs

The following are the set of valid verbs that can be returned as part of an array. The verbs are read sequentially.

Dial

Dial an endpoint

{
    "dial" : {
        "callerId" : "+441234567890",
        "timeout" : 30,
        "timeLimit" : 14400,
        "record" : { ... },
        "targets" : [ ... ]
    }
}
FieldDescriptionRequired
callerIdThe number to present to the called party, if not present or invalid, the account main billing number will be presentedfalse
timeoutHow long to ring before cancelling callfalse
timeLimitIf call connects, how long in seconds before forcibly ending callfalse
recordRecord verb, if present the call will be recordedfalse
targetsArray of type Device , SipURI, PhoneNumber or Extension. Up to 10 targets can be includedtrue

Record Verb

By including an empty Record verb you can opt in to call recording. Adding a URL will stream raw audio to a websocket endpoint

{
    "dial" : {
        ...
        "record" : {
            "url" : "http://www.recordable.io/ws",
            "username" : "user",
            "password" : "password",
        }
    }
}
FieldDescriptionRequired
urlIf present, redirect audio stream to URLfalse
usernameURL - Basic Authentication Userfalse
passwordURL - Basic Authentication Passwordfalse

Dial Targets

Device

Target a static Flow Device Endpoint

{
    "device" : {
        "id" : "3334872eb9991b38efa4d999"
    }
}
FieldDescriptionRequired
idThe uuid of the static devicetrue

SIP URI

Target a SIP URI

{
    "sipURI" : {
        "uri" : "sip:1234@1.1.1.1:5060"
    }
}
FieldDescriptionRequired
uriA valid SIP URItrue

Phone Number

Target a Phone Number, internal routing logic will be applied to this target

{
    "phoneNumber" : {
        "number" : "+441234567891"
    }
}
FieldDescriptionRequired
numberA valid E164+ telephone numbertrue

Extension

*Target an extension/ddi on a Static Flow endpoint, for example sending to extension 600 on a registered client 201 *

{
    "extension" : {
        "extension" : "201",
        "overrideTo" : "600"
    }
}
FieldDescriptionRequired
extensionA static device extension numbertrue
overrideToa number to include in the Request URI to allow for advanced routingfalse

Say

Text to speech

{
    "say" : {
        "text" : [
            "Welcome to callable!",
            "Have a great day!"
        ],
        "loop" : 1,
        "voice" : "en-GB-Standard-A"
    }
}
FieldDescriptionRequired
textArray of text to convert to audiotrue
loopHow many times to loop the text arrayfalse
voiceGoogle voice https://cloud.google.com/text-to-speech/docs/voicestrue

Play

Play an MP3 or WAV

{
    "play" : {
        "url" : "https://recordable.io/sounds/beep.mp3",
        "loop" : 1
    }
}
FieldDescriptionRequired
urlURL of media filetrue
loopHow many times to loop mediatrue

Gather

Wait for input from caller

{
    "gather" :    {
        "input" : ["digits", "speech"],
        "finishOnKey" : "#",
        "numDigits" : 1,
        "timeout" : 10,
        "say" : { ... },
        "play" : { ... },
        "hints" : [ "never" , "eat", "yellow",  "snow" ],
        "language" : "en-GB",
        "redirect" : { ... }
    }
}
FieldDescriptionRequired
inputArray of input can be *digits" or speech or bothtrue
finshOnKeyIf digits, this will end dtmf sequence and send resultsfalse
numDIgitsHow many digits to expect before automatically sending resultfalse
timeoutHow many seconds to wait before ending gatherfalse
sayMutally exclusive Say verbIf no Play
playMutally exclusive Play verbIf no Say
hintsHelp speech recognition with array of text hintsfalse
languageGoogle Speech https://cloud.google.com/speech-to-text/docs/languagestrue if speech input
redirectRedirect Verb, where to direct call after input or timeoutfalse

Redirect

Redirect to a Static Flow component

{
    "device" : {
        "id" : "3334872eb9991b38efa4d999"
    }
}
FieldDescriptionRequired
deviceDevice targettrue

Tag

Tag a call for contextual information

{
    "tag" : {
        "data" :  { "tag1", "hey", "tag2" , "yo"  }
    }
}
FieldDescriptionRequired
datakey value pairstrue

Hangup

Hangup the call

{
    "hangup" : {
        "reason" :  "call completed"
    }
}
FieldDescriptionRequired
reasonreason for the call endingtrue

Hangup

Rejecting the call

{
    "hangup" : {
        "reason" :  "call completed"
    }
}
FieldDescriptionRequired
reasonreason for the call endingtrue

What's Next