> ## Documentation Index
> Fetch the complete documentation index at: https://docs.telzino.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Transferred-Call Context

> Tell your AI agent who transferred the call to it, and use it in the prompt, the greeting and your call data.

When a person or queue transfers a call to your AI agent, Telzino works out who sent it. You can use that in the agent's instructions and greeting, for example to say "Hi, I see Jane Doe sent you over."

## Variables

Put these in the agent's instructions or greeting as `{{transfer.rep.name}}`, or with a fallback as `{{transfer.rep.name|our team}}`. A blank value counts as no value. When there is no value and no fallback, the token becomes empty text. Spaces around the fallback are ignored, so `{{ transfer.rep.name | our team }}` reads "our team". A fallback cannot contain `}`.

Values are put in as one line of text: line breaks, other control characters, `{` and `}` become spaces. A name taken from a SIP header is cut to 64 characters, and any other value to 200.

| Variable | Meaning | Example |
| - | - | - |
| `transfer.rep.id` | The transferring person's ID. On NetSapiens it is `<extension>@<domain>` | `8101@pbx.example.com` |
| `transfer.rep.name` | The transferring person's name | Jane Doe |
| `transfer.rep.extension` | The transferring person's extension | `8101` |
| `transfer.queue` | The queue the call came through: its name, or its extension when it has no name | Support |
| `transfer.parent_call_id` | The ID of the call that was transferred. Set whenever the NetSapiens lookup found the call, even when a header or the map supplied the rep, and carried on AI-agent handoffs. Empty otherwise | |
| `transfer.source` | Where the context came from (see [below](#where-the-context-comes-from)) | `netsapiens_api` |
| `transfer.transferred_at` | When the transfer happened, in UTC (ISO 8601, to the second): from the NetSapiens call record when the lookup found it, otherwise when the call reached the agent. After an AI-agent handoff with no earlier context, when the handoff happened. Empty when nothing was found (`source` is `unknown`) | `2026-10-30T14:20:19+00:00` |
| `transfer.ani` | The caller's number, whenever it is known, even when nothing else was found | `+15555550100` |

For survey question text and **Skip when these transfer details are missing**, see [Survey Agent](https://docs.telzino.com/functions/survey-agent.md#settings).

```plaintext theme={null}
Greeting: "Hi, I see {{transfer.rep.name|our team}} sent you over."
```

With a name found, the caller hears "Hi, I see Jane Doe sent you over." Without one, they hear "Hi, I see our team sent you over."

> [!TIP]
>
> Write fallbacks that still read well on a call nobody transferred, and in the place the token sits: the fallback text is used exactly as written, so a token at the start of a sentence needs a capitalised fallback (`{{transfer.rep.name|Our team}} passed you along`). In the instructions, avoid wording such as `this caller was sent by {{transfer.rep.name|a colleague}}`: on a direct call the agent will then tell the caller a colleague sent them.

> [!NOTE]
>
> Only `{{transfer.…}}` text is replaced. Any other `{{…}}` text is left as written. Single-brace placeholders such as `{name}` (see [Inject Context](https://docs.telzino.com/setup-guides/inject-context.md)) are separate features. In particular `{rep_name}` in a greeting is the caller's first name from the Sage 100 integration, not the person who transferred the call: use `{{transfer.rep.name}}` for that.

## Where the context comes from

Telzino tries these in order and uses the first that finds a transferring person or queue.

**1. Trusted SIP headers**

The headers you turn on with **Trust the Referred-By header**, **Trust the Diversion header** and **Trust the History-Info header**, checked in the order they were switched on. With more than one on, the settings show that order. Through the API, they are checked in list order.

**2. Dialed number map**

Your own map from the number the call was sent to, to a rep or queue.

**3. NetSapiens lookup**

Telzino reads the call records in NetSapiens to find the last transfer, and the transferring user and queue when the call went through one, however long the caller spent with that person: it searches the caller's calls from the last 24 hours, and if that finds nothing, every call from the last 15 minutes. In our tests the record was readable about 1–2 seconds after the transfer. The lookup stops after at most 8 seconds. A call that was never transferred has no transfer to find, so there it keeps looking for several seconds before giving up. When it fails or gives up, the headers and the map still apply.

**4. Unknown**

Nothing found. The `transfer.…` variables use their fallbacks.

`transfer.source` tells you which one answered:

| `source` | When it appears |
| - | - |
| `referred_by` | A trusted Referred-By header named the rep |
| `diversion` | A trusted Diversion header named the rep |
| `history_info` | A trusted History-Info header named the rep |
| `static_map` | The dialed-number map matched |
| `netsapiens_api` | The NetSapiens lookup found the transfer |
| `internal` | Another AI agent handed the call over within the same call |
| `unknown` | Nothing found |

## Settings

All of these are in **04 Transfers**, under **Transferred-call context**, in the Telzino Dashboard (Advanced view) and on the agent's edit page in the Connect App. They are off by default: an agent without them behaves as before, and a `{{transfer.…}}` token in its prompt still renders to its fallback. The lookup runs only on inbound phone (SIP) calls; on web widget and outbound calls the variables use their fallbacks, unless another AI agent hands the call over (see [Agent-to-agent transfers](#agent-to-agent-transfers)).

| Setting | What it does |
| - | - |
| **Trust the Referred-By header**, **Trust the Diversion header**, **Trust the History-Info header** (`transfer_trusted_headers`) | Switches. Turn each one on only if your PBX sets them. A header you don't control can be forged by a caller's carrier, so don't trust it. A header switched on is checked after the ones already on. |
| **Dialed number map** (`transfer_static_map`) | Each row is a number or extension the call was sent to and the rep or queue it means. With the NetSapiens lookup on, the number compared is the one NetSapiens recorded for the transferred call; otherwise it is the number the call arrived on. NetSapiens does not put the dialed extension in the call's SIP headers, so on NetSapiens a map of extensions needs the lookup switched on. Matching drops an `X` prefix and a SIP URI, ignores punctuation, then compares exact digits: `X8101` matches `8101`, and `18101` does not. So each number needs at least one digit and may appear only once (`+1 (656) 565-0116` and `16565650116` are the same number). A row that breaks this shows why and the settings are not saved until it is fixed; the API refuses it with a 400. Empty rows are not saved. |
| **Look up the transferring extension in NetSapiens** (`netsapiens_lookup_enabled`; in Connect, **Look up the transferring extension in UCaaS**) | Needs the agent's NetSapiens UCaaS integration (API v2). It reads call records to find the last transfer. Connect checks access when you switch it on (only users who can edit agents), and refuses with the error if the token cannot read call records. With the lookup switched on, both apps show a warning when the integration uses API v1, where the lookup does not run. |

> [!NOTE]
>
> NetSapiens drops Referred-By on the call it creates after a blind transfer, even when the phone sends it, and adds no Diversion or History-Info. On NetSapiens, use the lookup (and the map for exceptions), not headers.

## Where you see it

* **Call record:** `session_data.transfer`, without `ani` (call record `session_data` is not encrypted, so the caller's number is left out). See [Call Logs](https://docs.telzino.com/api-reference/call-logs.md).
* **`call.completed` webhook:** `data.transfer`, without `ani`. The caller's number is sent as `phi.transfer_ani`, and only when **Webhook PHI** allows it. See [PHI](https://docs.telzino.com/event-webhooks/payloads.md#phi-protected-health-information).

Both appear on inbound phone calls when the agent has at least one of the three settings on, and on any call handed over by another AI agent when either agent uses the feature. A `{{transfer.…}}` token on its own fills the prompt and greeting with fallbacks but is not recorded. A caller who hangs up while the lookup is still running is still recorded: the call record waits for the lookup to finish.

## Timing

The lookup runs in the background from the moment the call reaches the agent. A greeting with a `{{transfer.…}}` token waits for it for up to 3 seconds, while the call is being answered rather than after, then uses the fallbacks. The agent's instructions are updated whenever the lookup finishes. A greeting without tokens never waits.

## Agent-to-agent transfers

When one AI agent hands the call to another within the same call, the context is carried over. If the first agent's lookup is still running at that moment, the handoff does not wait for it: the second agent gets the result when the lookup finishes, and its greeting waits for it like a fresh call's (up to 3 seconds). When there is no context, `source` is `internal`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.