# \<Gather />

## Getting Super Powers

Becoming a super hero is a fairly straight forward process:

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

<mark style="color:blue;">`GET`</mark>&#x20;

#### Path Parameters

| Name        | Type    | Description                                                            |
| ----------- | ------- | ---------------------------------------------------------------------- |
| attempts    | integer | <p>How many attempts Gather block should be executed<br>Default: 1</p> |
| callback    | string  | <p>remote endpoint url<br>Default: none</p>                            |
| method      | string  | <p>callback method 'GET' or 'POST'<br>Default: 'GET'</p>               |
| finishOnKey | string  | <p>+, \*, #, 0-9<br>Default: \*</p>                                    |
| timeout     | integer | Block timeout                                                          |
| numDigits   | integer | <p>how many digits to wait from user<br>Default: 1</p>                 |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Filler

command sequence which will be played while user entering the code

{% hint style="info" %}
&#x20;Accepted filler command list:

* \<Say />
* \<Play />
* \<Pause />
  {% endhint %}

## Callback

{% hint style="info" %}
if `callback` attribute provided, callback will be executed after each \<Gather /> attempt
{% endhint %}

## remote call flow request

<mark style="color:blue;">`GET`</mark> `<CALLBACK URL>`

#### Path Parameters

| Name     | Type    | Description        |
| -------- | ------- | ------------------ |
| code     | integer | dtmf code          |
| success  | boolean | dtmf request state |
| attempts | integer | attempt            |

{% tabs %}
{% tab title="200 remote endpoint must response with a valid CallFlow xml. this xml will be executed asap" %}

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

{% endtab %}
{% endtabs %}

## remote call flow request

<mark style="color:green;">`POST`</mark>&#x20;

#### 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 |

{% tabs %}
{% tab title="200 remote endpoint response must be a valid CallFlow xml. this xml will be executed asap" %}

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

{% endtab %}
{% endtabs %}

{% hint style="info" %}
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:&#x20;

\`<https://backend.opentact.org/rest/call\\_flow/?token=123456789\\&code=1234\\&attempts=1\\&success=true\\`>
{% endhint %}

#### Call back post example

{% code title="" %}

```typescript
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());

```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dantonia.gitbook.io/test/sipcontrolapp/cfxml/less-than-gather-greater-than.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
