> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.agentduet.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.agentduet.com/_mcp/server.

# Trigger Conditions

Optional. By default the server delivers **inbound calls and inbound WhatsApp
messages** to the connector.

Configure trigger conditions to change routing - for example, deliver only
missed calls, stop inbound calls, or stop inbound messages while retaining
outbound capability.

## Setup

Build with `TriggerConditionsBuilder` and send once after connecting:

```python
from agentduet import InboundCallMode, TriggerConditionsBuilder

trigger_config = (
    TriggerConditionsBuilder()
    .inbound_call(InboundCallMode.ALL)   # all incoming calls
    .inbound_message(True)               # inbound WhatsApp
    .build()
)

await sm.setup_trigger_conditions(trigger_config)
```

### `InboundCallMode`

| Mode | Effect |
|---|---|
| `ALL` | Every incoming call |
| `MISSED_ONLY` | Only calls no other destination answered |
| `NO` | Stop inbound call delivery |

### `inbound_message`

`True` delivers incoming WhatsApp to `@on_incoming_message`. `False` stops
delivery. Call and message routing are independent: calls only, messages only,
or both.

## Rules of thumb

1. **Routing only.** Trigger conditions never gate what the SDK can do. Outbound `make_call` / `dial` / `send_message` work regardless.
2. **Absolute replace.** The config you send fully replaces server-side routing. Set every flow you want; defaults are inbound calls `ALL` and inbound messages on.
3. **Send once.** Applied across automatic reconnects; you do not need to re-send.

> Note: Builder toggles for `outbound_call` / `outbound_message` belong to an upcoming “notify me when the subscriber places a call or sends a message” feature and have **no effect yet**.

`VoiceAgent(..., inbound=...)` also sends an absolute trigger config on startup
and resets message-flow toggles to defaults. Pass `inbound=None` to leave the
connector configuration untouched.

## Related

- [Architecture](/concepts/architecture)
- [WhatsApp Messaging](/concepts/whats-app-messaging)
- [VoiceAgent](/concepts/voice-agent)