> For the complete documentation index, see [llms.txt](https://docs.dapta.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dapta.ai/ai-voice-agents/agent-actions/transfer-call.md).

# Transfer Call

Route calls to a predefined number or dynamic condition, choose cold or warm transfers, restrict them to business hours and pass context in SIP headers.

The "Transfer Call" function in Dapta allows you to transfer phone calls flexibly and in a personalized manner, either to predefined numbers or based on dynamic conditions according to the context of the conversation. You can choose between cold transfers (without context) or warm transfers (with a previous summary), and configure how the phone number is displayed to the agent receiving the call. This function is ideal for efficiently directing users to the appropriate resource, whether it's a human agent, support, sales, or any other department, ensuring a seamless experience tailored to their needs.

### Step-by-Step Guide

#### Step 1: Select your Agent

* Navigate to the list of agents and select the agent to which you want to add the call transfer instruction.

#### Step 2: Access the Configuration

* Once inside the agent, go to the **Settings** tab.
* Within Settings, click on **Agent Actions** to access the available actions for your agent.

<figure><img src="https://3835013762-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCy5rSNtQmtqYCGzJlNEB%2Fuploads%2Fgit-blob-bb9d4730e3b22c94caeb30d4f40e89955287cdec%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Step 3: Add the Call Transfer Function

* A menu with available options will appear. Click on **Add** and then select **Transfer Call** from the list of options.

<figure><img src="https://3835013762-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCy5rSNtQmtqYCGzJlNEB%2Fuploads%2Fgit-blob-239ce79efc2daa5c9935ab20d5bd619ecacec2ab%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Paso 4: Configura tu Instrucción

* Assign a descriptive name to your function in the "Name" field and write the specific instruction about when to use this function. According to the example, the instructions could be: "When the user is angry or requests a human agent, transfer the call to a human.”

<figure><img src="https://3835013762-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCy5rSNtQmtqYCGzJlNEB%2Fuploads%2Fgit-blob-5e0656a89082a4e08b8d7f6de542cceee64f16d0%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Paso 5: Define la función

* "Predefined Number": Enter the phone number to which the call will be transferred.
* "Dynamic Transfer": Select this option to provide instructions to the AI on how to dynamically transfer the call. In the example, the instructions are: "If the user wants to reach support, transfer to \[number\_1]; if the user wants to reach sales, transfer to \[number\_2].

<figure><img src="https://3835013762-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCy5rSNtQmtqYCGzJlNEB%2Fuploads%2Fgit-blob-e970ca174f07da5f8e8b45b0ac1c0d903c124e8b%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3835013762-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCy5rSNtQmtqYCGzJlNEB%2Fuploads%2Fgit-blob-18456111b0d7c37cd88bd1ce416be92998d51581%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Paso 6: Tipo de Transferencia

Select the type of transfer you want to perform:

* "Cold Transfer": Transfers the call to the next agent without providing a previous summary.
* "Warm Transfer": Provides a summary of the situation to the next agent before transferring the call.

<figure><img src="https://3835013762-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCy5rSNtQmtqYCGzJlNEB%2Fuploads%2Fgit-blob-4f0d55e72abbec5324b0b93e2da9b09ada22d401%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Paso 7: Displayed Phone Number

Choose how the phone number will be displayed to the agent receiving the transferred call:

* "Agent's Number": Displays the number of the agent transferring the call.
* "Transferee's Number": If you use custom telephony, enable SIP REFER and PSTN transfer. Keep in mind that you must configure the following in your telephony provider in order to make it work, because this option is internally simply the transfer via SIP REFER, and some telephony providers have the ability to set the caller ID for SIP REFER.

<figure><img src="https://3835013762-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCy5rSNtQmtqYCGzJlNEB%2Fuploads%2Fgit-blob-c96f0877652c62ef83bcfa3752219af67b1139ff%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Step 8: Restrict to Business Hours (Optional)

If you only want your agent to transfer calls during your team's working hours, enable the **Restrict to business hours** toggle at the bottom of the Transfer Call configuration.

<figure><img src="https://3835013762-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCy5rSNtQmtqYCGzJlNEB%2Fuploads%2Fgit-blob-5a26222235a8b7d00d3f3ecfaee4096f1dc1de29%2Ftransfer-business-hours-toggle.png?alt=media" alt=""><figcaption></figcaption></figure>

When enabled, you can define your availability:

* "Days": Select the days of the week when your team is available to receive transferred calls.
* "Start Time" / "End Time": Set the time window during which transfers are allowed.
* "Timezone": Choose the timezone your schedule refers to.

<figure><img src="https://3835013762-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCy5rSNtQmtqYCGzJlNEB%2Fuploads%2Fgit-blob-074ec6c2c151cb446b4f85a9125ebf4602cba9a3%2Ftransfer-business-hours-expanded.png?alt=media" alt=""><figcaption></figcaption></figure>

During a call, the agent automatically knows whether the current time falls inside your business hours:

* **Within business hours**: transfers work normally.
* **Outside business hours**: the agent will not transfer the call under any circumstances.

If the toggle is off, the agent behaves exactly as before — transfers are available at any time.

{% hint style="info" %}
This option is available for agents using Dapta's native telephony or a connected SIP trunk.
{% endhint %}

***

### Custom SIP headers

Just above **Displayed Phone Number**, the Transfer Call configuration has a **Custom SIP Headers** section: key/value pairs that Dapta adds to the transfer, so the phone system that receives the call gets context along with it, such as a customer ID, a queue name or a summary of the conversation. Click **Add**, type the header name (for example `X-Customer-Id`) in the first field and its content in **Value**. The headers are sent with every transfer type and cold transfer mode.

The value is resolved at the moment of the transfer:

* A value written with double curly braces, such as `{{customer_id}}`, is filled from the call's variables: any dynamic variable of the call, and the reserved ones such as `{{user_number}}`.
* `{{call_summary_transfer}}` is filled with a one-line summary of the conversation so far, generated when the transfer starts.
* A value with no curly braces is read as an instruction for the agent, which must write the header's content itself when it transfers. For example: "The department the caller asked for, in one word".
* A variable the call doesn't have resolves to empty, and a header whose value ends up empty is not sent.

#### Encoded values: `|hex`, `|uui` and `|decode`

Many carriers and PBXs pass call context in the `User-to-User` header and expect its payload encoded. Add a filter after the variable name to encode or decode a value:

* `{{customer_id|hex}}` sends the value as hexadecimal ISDN User-to-User octets: accents are folded to plain letters, other non-ASCII characters are dropped, the value is cut at 127 characters and preceded by the `00` protocol discriminator.
* `{{customer_id|uui}}` sends the same octets followed by `;purpose=isdn-uui;content=isdn-uui;encoding=hex`, the complete User-to-User header value.
* `{{sip_header_user-to-user|decode}}` does the opposite: it turns a hexadecimal or Base64 value back into plain text, following the `encoding=` the value declares (a bare hexadecimal value is decoded as hex), and drops the leading protocol discriminator of an ISDN User-to-User payload. It also removes any `;parameter` suffix. Use `|decode` only on values you know are encoded: a plain value made of an even number of hex characters, such as `1234`, is decoded as hex too.

To encode a value built from several parts, wrap the whole value in `uui( )` or `hex( )`. This example decodes the payload the call arrived with, appends the conversation summary and sends the result encoded again:

```
User-to-User: uui({{sip_header_user-to-user|decode}}|{{call_summary_transfer}})
```

#### Headers received on inbound calls

When a call reaches your agent through a SIP trunk, the custom headers it carries become variables of the call, so you can use them in the prompt or pass them on in a transfer:

* `{{sip_header_<name>}}` holds the value as it arrived. The name is the header name in lowercase: an `X-Customer-Data` header becomes `{{sip_header_x-customer-data}}`. Hyphens in these names are fine; the variable resolves as written.
* If the header is `User-to-User`, or its value declares `encoding=hex` or `encoding=base64`, Dapta also creates `{{sip_header_<name>_decoded}}` with the readable text. A header that doesn't declare its encoding gets no `_decoded` variable, even if its value looks like hex.
* When the decoded text has the form `id|name`, the two parts are also available as `{{sip_header_<name>_id}}` and `{{sip_header_<name>_name}}`.

For example, a call arriving with `X-Customer-Data: 4a55414e7c564950;encoding=hex` gives your agent `{{sip_header_x-customer-data_decoded}}` = `JUAN|VIP`, `{{sip_header_x-customer-data_id}}` = `JUAN` and `{{sip_header_x-customer-data_name}}` = `VIP`. Standard SIP headers such as `From`, `To`, `Via`, `Call-ID`, `Contact` or `User-Agent` are not exposed as variables.

{% hint style="info" %}
Inbound headers are read on calls that arrive over a SIP trunk, so they need a carrier or PBX that adds them. On outbound calls Dapta does not read headers from the carrier; there, `|decode` applies to encoded values you pass in the call's dynamic variables when you create the call. Web calls have no SIP transfer, so custom headers do not apply to them. Whether a header reaches the transfer destination depends on your carrier or PBX passing it through: confirm it with your telephony admin.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.dapta.ai/ai-voice-agents/agent-actions/transfer-call.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
