> For the complete documentation index, see [llms.txt](https://docs.ilert.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ilert.com/call-routing/call-flows/branch-node.md).

# Branch node

Route calls on who is calling: branch an ilert call flow on the caller's number, country and other call details using conditions.

The **Branch** node sends each call down a different path depending on **who is calling** — for example callers from Germany, Austria and Switzerland to your DACH team, US numbers to the US team, and everyone else to a voicemail. You define a list of branches, each with a condition; the call follows the first branch whose condition matches.

Where the [Support hours](https://docs.ilert.com/call-routing/call-flows/support-hours-node.md) node decides on *when* a call arrives and the [IVR menu](https://docs.ilert.com/call-routing/call-flows/ivr-menu-node.md) node on what the caller *presses*, the Branch node decides on what ilert *knows about the call* before anyone has said a word.

## Add the node

Click a **+** on the canvas and choose **Branch**. The node is inserted with one branch, **Branch 1**, and an **Else** branch that takes over whatever was below the **+** before. The settings open straight away.

1. *(Optional)* In the **Optional title** field, enter a name to label the node on the canvas *(e.g., "Caller region").*
2. Rename **Branch 1** to something that says what it catches *(e.g., `dach`)* — the name is what you will see on the canvas and in the call logs.
3. Build its condition (see below).
4. Click **Add branch** for every further path, up to **8** branches.

Use the arrows on a branch to move it up or down. Deleting a branch asks for confirmation, because it removes everything that was built below it.

{% hint style="info" %}
**Branch names must be unique and must not contain `'` or `\`.** The node cannot be saved while a name is invalid — the field tells you why.
{% endhint %}

## Build a condition

Every branch has a condition, and you can write it in two ways. Switch between them with the icons in the branch's header.

### Builder

The builder covers the questions most flows ask, without writing a condition by hand:

| Field              | You can check whether it…                                                              | Value                     |
| ------------------ | -------------------------------------------------------------------------------------- | ------------------------- |
| **Caller number**  | starts with any of, does not start with any of, is any of, is none of, matches a regex | phone numbers or prefixes |
| **Caller country** | is any of, is none of                                                                  | country codes, e.g. `DE`  |

Rows inside a **filter group** must **all** match (AND). Add another group to offer an alternative — a call matches the branch if **any** group matches (OR).

Enter phone numbers in international format with a leading `+` *(e.g., `+49` for all German numbers, `+4930` for Berlin landlines)*, and countries as two-letter codes *(e.g., `DE`, `AT`, `CH`)*.

### Code

Everything the builder cannot express can be written as an [ICL](https://docs.ilert.com/developer-docs/icl-ilert-condition-language.md) condition — the same condition language used across ilert. The editor suggests the available call fields as you type and checks the condition when you leave the field.

A condition the builder cannot display — for example one that uses the support hours of the call — simply stays in code. Switching such a branch to the builder asks first, because the builder would have to start from scratch.

## Branches

The node adds one branch per condition you define, plus a fallback. Click the **+** under each branch to define what happens next.

| Branch                                     | Taken when                                              |
| ------------------------------------------ | ------------------------------------------------------- |
| One per defined branch (`1. dach`, `2. …`) | Its condition is the first one, from the top, to match. |
| `Else`                                     | No condition matches.                                   |

Branches are evaluated **in order, first match wins**. A broad condition placed early shadows the more specific ones after it — put `berlin office` above `germany`, not below it. A condition that cannot be evaluated for a call counts as not matching, and the call moves on to the next one.

## What ilert knows about a call

These fields are available to every condition. The location fields come from the caller's phone number, so they are **empty when the caller withholds their number** — and a condition on an empty field does not match.

| Field                   | Contains                                                                                       |
| ----------------------- | ---------------------------------------------------------------------------------------------- |
| `context.from`          | The caller's number in international format, e.g. `+4915112345678`                             |
| `context.fromCountry`   | The caller's country as a two-letter code, e.g. `DE`                                           |
| `context.fromState`     | The caller's state or region — mostly available for US and Canadian numbers                    |
| `context.fromCity`      | The caller's city, e.g. `BERLIN` — mostly available for landlines                              |
| `context.fromZip`       | The caller's postal code — mostly available for US numbers                                     |
| `context.forwardedFrom` | The number that forwarded the call to ilert, if it was forwarded                               |
| `context.stirVerstat`   | The caller ID verification result (STIR/SHAKEN), e.g. `TN-Validation-Passed-A` — US calls only |

## ICL in call flows

The full reference is in the [ICL documentation](https://docs.ilert.com/developer-docs/icl-ilert-condition-language.md). What matters most for calls:

**Text and lists.** Text values take **single quotes**, lists take double quotes:

```
context.fromCity matches 'berlin'
context.fromCountry in ["DE", "AT", "CH"]
```

**Comparing values.**

| Operator                                           | Checks                                                     | Example                                          |
| -------------------------------------------------- | ---------------------------------------------------------- | ------------------------------------------------ |
| `in`, `not_in`                                     | the value is one of a list                                 | `context.fromCountry in ["DE", "AT"]`            |
| `starts_with_any`, `ends_with_any`, `contains_any` | the value starts with, ends with or contains any of a list | `context.from starts_with_any ["+49", "+43"]`    |
| `matches`, `contains`, `starts_with`, `ends_with`  | the same for a single value, ignoring upper/lower case     | `context.fromZip starts_with '10'`               |
| `exact_matches`, `exact_contains`                  | the same, but case-sensitive                               | `context.fromCity exact_matches 'BERLIN'`        |
| `regex`                                            | the value matches a regular expression                     | `context.from regex '^\+49(15\|16\|17)\d{7,9}$'` |
| `==`, `!=`                                         | equality                                                   | `context.stirVerstat == 'TN-Validation-Failed'`  |
| `== nil`                                           | the field is empty                                         | `context.forwardedFrom == nil`                   |

**Combining.** `and` binds stronger than `or`; use parentheses to be explicit:

```
(context.fromCountry in ["DE", "AT", "CH"] and context.from not_contains_any ["+49900"])
or (context.forwardedFrom in ["+4930123456"])
```

**Time.** `now is_in` checks a [support hours](https://docs.ilert.com/alerting/configure-alerting/support-hours.md) definition or whether someone is on call in an on-call schedule — useful when the time only matters for *one* of your branches. Use the ID of the support hours or schedule:

```
context.fromCountry in ["DE"] and now is_in {"id":12,"type":"SUPPORT_HOUR"}
context.fromCountry in ["US"] and now not is_in {"id":7,"type":"ON_CALL_SCHEDULE"}
```

When the whole flow should split on time, place a [Support hours](https://docs.ilert.com/call-routing/call-flows/support-hours-node.md) node in front instead — it is easier to read on the canvas.

**Call volume.** `trigger_count.[duration]` counts how often its condition was checked within the duration, `resetting_trigger_count.[duration]` starts over as soon as its limit is reached. Both count **all callers together**, which makes them a flood guard rather than a per-caller limit:

```
trigger_count.5m >= 20
```

{% hint style="warning" %}
**A counter only counts the calls that get as far as its branch.** Calls caught by a branch above it never reach its condition — put a flood guard first. Within its own condition, though, every part is checked, so a counter combined with `or` still counts calls that match through the other part.
{% endhint %}

## Example

A flow that routes by region:

* `1. dach` — **Caller country** is any of `DE`, `AT`, `CH` → [Route call](https://docs.ilert.com/call-routing/call-flows/route-call-node.md) to the DACH on-call schedule.
* `2. us` — **Caller number** starts with any of `+1` → [Route call](https://docs.ilert.com/call-routing/call-flows/route-call-node.md) to the US schedule.
* **Else** → **Voicemail**, then [Create alert](https://docs.ilert.com/call-routing/call-flows/create-alert-node.md).

## See which branch a call took

Open a call under **Call routing** → **Call flow logs**. For the Branch node the log lists the branches it checked, in order, and the branch the call continued with — including **Else**.

## FAQ

**How many branches can one node have?**\
Up to 8, plus **Else**. For more, chain a second Branch node on the **Else** branch.

**Can I use more than one Branch node in a flow?**\
Yes. Each node evaluates its own conditions, so a second Branch node can refine what the first one decided — for example by country first, then by number.

**Why does my condition never match?**\
Most often because the field is empty for that call: city, postal code and state are frequently missing for mobile numbers, caller ID verification is only provided for US calls, and every location field is empty when the number is withheld. Prefer **Caller number** — it is always there unless the number is withheld.

**What happens if I rename a branch?**\
Everything below it stays attached — the branch keeps its path under its new name. Moving a branch up or down keeps its path too.

**Is the order of the branches important?**\
Yes. The first matching branch wins, so place specific conditions above general ones.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ilert.com/call-routing/call-flows/branch-node.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
