</Dial>

Opentact XML: Dialing SIP Users or Phone Numbers

The <Dial/> tag in Opentact XML allows you to connect a call to a specific SIP user, providing control over the call flow and behavior. Below is an explanation of the <Dial/> tag, along with an example showcasing its usage:

`<Dial/> Tag Overview:**

The <Dial/> tag is used to initiate a call to a specific SIP user. This tag allows you to connect a caller to the desired destination and manage the call behavior, including handling scenarios where multiple calls are initiated.

Basic Usage:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <!-- Dial a call to SIP user with the specified SIP URI -->
    <Dial>
        <To>sip:user@example.com</To>
    </Dial>
    <!-- Additional call flow actions -->
</Response>

In this example, the <Dial/> tag is used to dial a call to the SIP user with the specified SIP URI (Uniform Resource Identifier). You can replace "sip:user@example.com" with the SIP URI of the desired destination.

Dialing SIP Users - Single Connection:

The <Dial/> tag in Opentact supports a single connection, meaning that only one SIP user can be connected. Once the first SIP user answers the call, any other ongoing call attempts are terminated. The call flow then continues based on the behavior specified in the Opentact XML.

In this scenario, the <Dial/> tag initiates a call to the SIP user with the specified SIP URI. Once the first SIP user answers the call, any other ongoing call attempts are automatically terminated.

Handling Call Flow:

The Opentact XML provides seamless handling of the call flow based on the behavior of the source and origin calls.

  • If the source hangs up the call, the origin call will continue executing the call flow.

  • If the origin call is hung up, the source call will be terminated.

In this example, the call flow continues after the <Dial/> operation if the source hangs up. Conversely, if the origin call is hung up, the source call will be terminated automatically.

The <Dial/> tag provides powerful capabilities for connecting calls to SIP users, ensuring a single connection and allowing for flexible call flow management based on source and origin call actions.

Dial a Phone Number:

<Dial>+12014266656</Dial>

Dial a SIP User:

<Dial to="sip:user@domain.sip.opentact.org" />
<Dial>
  user@domain.sip.opentact.org
</Dial>

Call a Group of SIP Users or Numbers:

<Dial from="12014266656" timeout="10000" max_call_duration="120000">
  <To>user1@domain.sip.opentact.org</To>
  <To>user2@domain.sip.opentact.org</To>
  <To>user3@domain.sip.opentact.org</To>
  <To>+12014266656</To>
</Dial>

Rate the Call after Operator Processing Example:

<Dial from="12014266656" timeout="10000" max_call_duration="120000">
  <To>user1@domain.sip.opentact.org</To>
</Dial>
<Say>Now please rate our service</Say>
<Gather url="https://api.opentact.org/rate"/>
<Hangup/>

Add Metadata to a Dial Command:

<Dial>
  <Meta name="abc1" value="123"/>
  <Meta name="abc2">123</Meta>
  <Meta name="number" value="12"/>
  <Meta name="float" value="12.33"/>
  <Meta name="boolean" value="true"/>
  <To>user1@domain.sip.opentact.org</To>
</Dial>

Ask Destination for Call Acceptance Before Connecting:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Say>Say your name please after the beep</Say>

    <Tone/>
    <Record tag="name">
        <Pause length="5000"/>
    </Record>

    <Dial>
        <Play url="https://s3.opentact.org/tts-stage/1.mp3" timeout="600000" tag="music"/>

        <To destination="user@sip.opentact.org">
            <Gather>
                <Say text="Incoming call from"/>
                <Play loop="3" record="name"/>
                <Say text="Click 1 to accept the call"/>
                <DTMF value="1"/>
                <Default>
                    <Hangup/>
                </Default>
            </Gather>
        </To>
    </Dial>

    <!-- Continue execution after Dial bridged call is finished (destination hangup mostly -->

    <Say text="have a nice day"/>

    <Hangup/>

</Response>

These examples showcase various scenarios where the <Dial/> tag is employed to initiate calls to phone numbers, SIP users, or groups, along with additional functionalities like rating calls, adding metadata, and asking for call acceptance before connecting.

Last updated