> For the complete documentation index, see [llms.txt](https://doc.opentact.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.opentact.org/how-to-build-your-opentact-application/call-flow-control/specify-callflow-for-tn/hosted-call-flow-xml-document.md).

# Basic Workflow

Inside Call APP, You can see the following list of entries.

<figure><img src="https://2121537857-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKZg_vajESgcKUZrStK%2Fuploads%2FiXxh5b77uZtBnZrtoZHD%2Fimage.png?alt=media&amp;token=d548805e-8a79-4a6c-ae92-caf71699b38a" alt=""><figcaption></figcaption></figure>

Then, you can click on Call Flow XML button on the top:

<figure><img src="https://2121537857-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKZg_vajESgcKUZrStK%2Fuploads%2FaG68608DWObmazN831mv%2Fimage.png?alt=media&amp;token=7270a276-95f3-4877-a8cd-9120a1d45670" alt=""><figcaption></figcaption></figure>

Each SIP Control APP has a default XML built-in.  This built-in XML document is a basic reference call flow XML that you can use as a base line and start to modify.&#x20;

#### How to test Call Flow

In the Call Control APP, click on "Numbers".

<figure><img src="https://2121537857-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKZg_vajESgcKUZrStK%2Fuploads%2Falg3b8qdBxiCf7OEDD74%2Fimage.png?alt=media&amp;token=d283a5ab-5239-4e61-b37e-cca7a7b57031" alt=""><figcaption></figcaption></figure>

You can specify a number to be associated with this SIP Control APP:

<figure><img src="https://2121537857-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKZg_vajESgcKUZrStK%2Fuploads%2FmTHuvSqN3VDTjjp23t8G%2Fimage.png?alt=media&amp;token=72f544dc-7713-4b1e-8502-dde50de4dc5e" alt=""><figcaption></figcaption></figure>

Then, you can call this number and you should hear an IVR as below:

<figure><img src="https://2121537857-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKZg_vajESgcKUZrStK%2Fuploads%2Fjcu0qIGf884kiKOfj1w2%2Fimage.png?alt=media&amp;token=02102a82-af15-4299-9da0-8a0f5ad00d05" alt=""><figcaption></figcaption></figure>

#### IVR Example with Opentact

To experience an Interactive Voice Response (IVR) system with Opentact, you can call the provided number. Upon calling, you will hear a customized IVR flow outlined in the following XML:

{% code overflow="wrap" %}

```xml
xmlCopy code<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Say>Thank you for calling Opentact.</Say>
    <Record />
    
    <!-- <Gather numDigits="2" attempts="2" timeout="10000" finishOnKey="*" callback="https://webhook.site/8b27856b-b16b-4933-8be2-befcd24932f6"/> -->
    
    <Gather numDigits="1" attempts="2" timeout="10000" finishOnKey="*">
        <Say>Now please enter 1 for man, 2 for woman.</Say>
        
        <Switch>
            <Case dtmf="1">
                <Say>Hi, man</Say>
                <Callback url="https://webhook.site/8b27856b-b16b-4933-8be2-befcd24932f6"/>
            </Case>
            
            <Case dtmf="2">
                <Say>Hi, woman</Say>
                <Dial>
                    <Sip>1000@192.99.10.113:9000</Sip>
                </Dial>
            </Case>
            
            <Default>
                <Say>Hi, nobody</Say>
                <Callback method="post" url="https://webhook.site/8b27856b-b16b-4933-8be2-befcd24932f6" />
            </Default>
            
            <Error>
                <Say>No DTMF code entered.</Say>
            </Error>
        </Switch>
    </Gather>
    
    <Hangup />
    <!--  <Redirect>${url}</Redirect>-->
    <!--  <Reject />-->
</Response>
```

{% endcode %}

**Explanation:**

* The call begins with a greeting, thanking the caller for reaching Opentact.
* A recording feature is initiated, allowing the system to capture any relevant information.
* A `<Gather>` block is employed to collect DTMF input. In this case, the caller is prompted to enter '1' for a man or '2' for a woman.
* A `<Switch>` statement evaluates the entered DTMF code and directs the call accordingly:
  * If '1' is pressed, Opentact responds with "Hi, man" and triggers a callback to a specified webhook.
  * If '2' is pressed, Opentact responds with "Hi, woman" and initiates a SIP call to the specified SIP address.
  * If neither '1' nor '2' is entered, Opentact responds with "Hi, nobody" and sends a callback with a POST request to a webhook.
* An `<Error>` block handles cases where no DTMF code is entered, providing appropriate feedback.
* The call concludes with a `<Hangup>` command.

Feel free to interact with the IVR by entering the specified DTMF codes and observing the corresponding actions.
