JSON IVR Design

Click here to see an example IVR.

Creating the flow of an IVR can be done in JSON. There are 8 call states that either trigger the flow or perform an action:

State

Description

Root

Triggers the flow

DataDip

Routing based on data dip.

CallAction

Transfers or ends the call

PlayPrompt

Plays audio prompt

ListenToTone

Play Prompt (optional) and Listen for (DTMF) Tone State

MultiTone

Listens for DTMF until the # and stores it into a variable

Regex

Performs a regex match

TextToSpeech

Plays text

BusinessHours

Routing based on business hour set

HolidayHours

Routing based on holiday hours set

Each flow begins with the code below. States will need to be added in the appropriate location.

{
  "description": "Description of IVR",
  "states": [
    -Add call states here-
  ]
}
  • Each flow begins with the Root State which triggers the flow when there is an incoming call.

  • There can be multiple of the same call states which perform different actions.

  • Each instance of a state has a unique SID.

  • The "next" property specifies the SID of next state that will perform the next action. Some states do not require a next action, e.g. Call Action. In this instance the next property will be "null" because the call has either ended or has been transferred.

  • Commas will need to be added between each state (included in the code examples below). Remove the comma following the last state.

  • The Description and Event properties can be edited with any text as a description or set as null.

  • The Name property can be edited with any text, but should not be null.

  • Variables can be created and referenced in states.

    • Default variables are CallerNumber, CallerName, and ScenarioId.

    • Variables are case sensitive.

    • Only DataDip and MultiTone states can create new variables. The names of the variables created by these states are prefixed by the state name followed by _result, e.g. AccountNumber_result.

Example Code Root State:

    {
      "$type": "Landis.Queues.RootState, Landis.Queues",
      "Name": "RootState",
      "Description": null,
      "transitions": [
        {
          "event": "incomingCall",
          "next": "2"
        }
      ],
      "sid": "1"
    },

Explanation: When there is an incoming call, the next action will be the state with SID 2

Example Code Data Dip State:

If InputParameterNames property is null, the body of the post will include the caller name, caller number, Scenario ID, and IVR name. If variables are specified, only the contents of those variables will be included in the body of the post.

    {
      "$type": "Landis.Queues.DataDipState, Landis.Queues",
      "Url": "https://prod-33.westus.logic.azure.com:443/workflows/5840ca75d8e54ac684f421b672fa0b94/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=jC61DRMbir-z2ngQZyZSNvdTFkdxwY",
      "InputParameterNames": "AccountNumber_result,CallerNumber",
      "Name": "datadip",
      "Description": null,
      "transitions": [
        {
          "event": "nextBlock",
          "next": "3"
        }
      ],
      "sid": "2"
    },

Explanation: A HTTP post is sent to the URL. A Microsoft Flow is triggered by the HTTP post. A decision is made by the Power Automate Flow and the returned response will be stored in the "datadip_result" variable. See IVR Data Dip Power Automate Flow Configuration. The next action will be the state with SID 3.

Example Code Call Action State:

  • ActionToTakeType values:

    • 0 = TransferToInteractionObject

    • 1 = TransferToUser

    • 2 = TransferToVoicemail

    • 3 = EndCall

If transferring, use the ActionTargetId to specify target Object ID of either a user or a resource account associated with a Landis queue or IVR.

{
      "$type": "Landis.Queues.CallActionState, Landis.Queues",
      "ActionTargetId": null,
      "ActionToTakeType": 3,
      "Name": "EndCall",
      "Description": null,
      "transitions": [
        {
          "event": "CallEnded",
          "next": null
        }
      ],
      "sid": "3"
},

Explanation: Disconnect Call.

Example Code Play Prompt State:

A prompt URI can be found by opening the audio prompt in contact center | more button (...) on the audio player | copy audio URL.

{
      "$type": "Landis.Queues.PlayPromptState, Landis.Queues",
      "PromptUri": "https://lccbackendstoragepod01.blob.core.windows.net/tenant-3/QueuePrompts%5C2_11_90539d-59a8-4565-9562-57e16fa86b.wav?sv=208-11-09&sr=b&sig=jqg5Aelo1PMyGsF7teCyUYyMk3QiiUwvfY%3D&st=1520-03-22T15%3A33Z&se=2519-07-23T15%3A26%3&sp=r",
      "Name": "PlayPrompt",
      "Description": null,
      "transitions": [
        {
          "event": "NextState",
          "next": "5"
        }
      ],
      "sid": "4"
    },

Explanation: The audio file will play that is located at the prompt Uri specified. The next action will be the state with SID 5.

Example Code Play Prompt (optional) and Listen for (DTMF) Tone State:

The state will listen for a tone while and after a prompt is played.

  • Prompt URI Values

    • URI

    • null (no prompt)

  • Repeat URI Values

    • URI

    • DoNotPlay (no prompt. Will skip the next timeout period.)

    • null (replays prompt URI or plays default prompt if prompt URI is null)

  • CannotConnect URI Values (Plays only if TimeoutNextID is null)

    • URI

    • DoNotPlay (no prompt)

    • null (plays default prompt)

  • TimeoutNextId

    • Next SID Number

    • null

  • NumberOfRepeats

    • 0-1000

  • RepeatWaitTimeSeconds

    • 0-1000

If the TimeoutNextID is null, the CannotConnectUri will be played before the call is automatically disconnected.

The prompt, repeat, or cannot connect URI can be found by opening the audio prompt in contact center | more button (...) on the audio player | copy audio URL.

  • Tone Type Values:

    • Tone0 = 0

    • Tone1 = 1

    • Tone2 = 2

    • Tone3 = 3

    • Tone4 = 4

    • Tone5 = 5

    • Tone6 = 6

    • Tone7 = 7

    • Tone8 = 8

    • Tone9 = 9

    • Star = 10

    • Pound = 11

{
      "$type": "Landis.Queues.ListenToToneState, Landis.Queues",
      "PromptUri": "https://lccbackendstoragepod01.blob.core.windows.net/tenant-3/QueuePrompts%5C2_10_90539d-59a8-4565-9562-57e16fa86b.wav?sv=208-11-09&sr=b&sig=jqg5Aelo1PMyGsF7teCyUYyMk3QiiUwvfY%3D&s-035%3A33Z&se=T15%3A26%3&sp=r",
      "RepeatUri": "https://lccstagingeastus01.blob.core.windows.net/tenant-3/AudioPrompts%5C0_0_94_0946b9c4-e2c9-42b2-a9c8-3ced10cb6517.wav?sv=2018-11-09&sr=b&sig=rzaIZLnPVsvI9pbyfkJaB98cHd0ZGOOkYKNW8ge0%3D&st=15215%3A51%3A59Z&sp=r",
      "CannotConnectUri": null,
      "TimeoutNextId": "12",
      "NumberOfRepeats": 1,
      "RepeatWaitTimeSeconds": 10,
      "transitions": [
        {
          "ToneType": 0,
          "event": "Tone0",
          "next": "6"
        },
        {
          "ToneType": 1,
          "event": "Tone1",
          "next": "7"
        }
      ],
      "Name": "ListenToTone",
      "Description": null,
      "sid": "5"
    },

Explanation: Audio prompt is played. After 10 seconds the repeat prompt is played if no buttons are pressed . After another 10 seconds the next action will automatically be SID 12 if no buttons are pressed. If 0 is pressed at anytime, the next action will be SID 6. If 1 is pressed, the next action will be SID 7.

Example Code MultiTone State:

 {
      "$type": "Landis.Queues.MultiToneState, Landis.Queues",
      "PauseOnPound": true,
      "PauseTime": "00:00:00",
      "Name": "GatherAccountNumber",
      "Description": null,
      "transitions": [
        {
          "event": "next",
          "next": "8"
        }
      ],
      "sid": "6"
    },

Explanation: State will collect DTMF digits until the pound key is pressed and store the digits in a variable named GatherAccountNumber_result. Next state is SID 8.

Example Code Regex State:

{
      "$type": "Landis.Queues.RegexState, Landis.Queues",
      "Regex": "^\\+?1?222\\d+",
      "ParameterNameToMatch": "CallerNumber",
      "Name": "Match Regex",
      "Description": null,
      "transitions": [
        {
          "RegexMatchType": 0,
          "event": "matched",
          "next": "9"
        },
        {
          "RegexMatchType": 1,
          "event": "notMatched",
          "next": "10"
        }
      ],
      "sid": "8"
    },

Explanation: State will match variable "CallerNumber" with regex specified. If number matches, the next state will be SID 9. If not matching, SID 10.

Example Code Text To Speech:

{
      "$type": "Landis.Queues.TextToSpeechState, Landis.Queues",
      "Text": "Thanks for calling. Your number is {CallerNumber}.",
      "Name": "Playtext",
      "Description": null,
      "transitions": [
        {
          "event": "next",
          "next": "11"
        }
      ],
      "sid": "9"
    },

Explanation: State will play the contents of the Text property. Next state is SID 11.

Example Code Business Hours:

Edit the desired business hours set: Configuration | Business hours Sets. Capture the business hours ID (number) at the end of the URL. Use this number for the BusinessHoursID property. The example below is 1.

Example: https://cc.landis.cloud/app/configuration/businesshourssets/edit/1

The proper Timezone text can be found in Administration | Settings | Timezone

  • Action Type Values

    • During Business Hours = null

    • Default Off = 0

    • Lunch = 1

    • Break = 2

    • Emergency = 3

    • Custom1 = 4

    • Custom2 = 5

    • Custom3 = 6

    • Custom4 = 7

    • Custom5 = 8

    • Custom6 = 9

        {
            "$type": "Landis.Queues.BusinessHoursState, Landis.Queues",
            "BusinessHoursId": 1,
            "Timezone": "Eastern Standard Time",
            "transitions": [
                {
                    "OffHoursType": null,
                    "event": "On Action",
                    "next": "17"
                },
                {
                    "OffHoursType": 0,
                    "event": "DefaultOff",
                    "next": "18"
                },
                {
                    "OffHoursType": 1,
                    "event": "Lunch",
                    "next": "19"
                },
                {
                    "OffHoursType": 2,
                    "event": "Break",
                    "next": "20"
                },
                {
                    "OffHoursType": 3,
                    "event": "Emergency",
                    "next": "21"
                },
                {
                    "OffHoursType": 4,
                    "event": "Custom1",
                    "next": "22"
                }
            ],
            "OffHoursActionSets": null,
            "Name": "BusinessHours",
            "Description": "Business hours",
            "sid": "12"
        },

Explanation: Business hours set with ID "1" will be observed using Eastern Standard Time. On hours next state is 17. DefaultOff action next state is 18. Lunch action next state is 19. Break action next state is 20. Emergency action next state is 21. Custom1 action next state is 22.

Last updated