<Gather />

prompt a DTMF code

Getting Super Powers

Becoming a super hero is a fairly straight forward process:

<Gather 
  numDigits="4" 
  timeout="30000" 
  finishOnKey="*" 
  callback="https://dev.alucky.dev/test/code" />

GET

Path Parameters

Name
Type
Description

attempts

integer

How many attempts Gather block should be executed Default: 1

callback

string

remote endpoint url Default: none

method

string

callback method 'GET' or 'POST' Default: 'GET'

finishOnKey

string

+, *, #, 0-9 Default: *

timeout

integer

Block timeout

numDigits

integer

how many digits to wait from user Default: 1

Filler

command sequence which will be played while user entering the code

Accepted filler command list:

  • <Say />

  • <Play />

  • <Pause />

Callback

if callback attribute provided, callback will be executed after each <Gather /> attempt

remote call flow request

GET <CALLBACK URL>

Path Parameters

Name
Type
Description

code

integer

dtmf code

success

boolean

dtmf request state

attempts

integer

attempt

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say>Thank you for entering the code</Say>
</Response>

remote call flow request

POST

Path Parameters

Name
Type
Description

code

integer

dtmf code

success

boolean

dtmf request state

attempts

integer

attempt

Headers

Name
Type
Description

Content-Type

string

application/json

Request Body

Name
Type
Description

body

string

Body contain an object with ISIPControlAppCall object and <Gather /> history

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Say>Thank you for entering the code</Say>
</Response>

callback url can contain any query params. code, success, attempts params will be added to existing params list.

For example: url `https://backend.opentact.org/rest/call_flow/?token=123456789` will be changed into:

`https://backend.opentact.org/rest/call_flow/?token=123456789&code=1234&attempts=1&success=true`

Call back post example

import fetch, { RequestInit } from 'node-fetch';


const body = {
  history: [
    {
      success: false,
      payload: {
        success: false,
        command: { command: ''},
        error: { error: 'User input error' },
        message: {}
      }
    },
    {
      success: true,
      payload: {
        success: true,
        command: { command: 'Say'},
        error: {},
        message: { message: 'Success'}
      }
    },
  ],
  call: {
    account_uuid: '',
    from: '15551234567'
    to: 155532165487,
    state: 'started',
    sip_control_app: {
      uuid: '',
      name: '',
      subdomain: '',
    }
  }
};

const reqInit: RequestInit = { 
  method: 'POST', 
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringfy(body),
};
const xml = await fetch(url, reqInit).then(res => res.text());

Last updated

Was this helpful?