> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# connect

> Transfer or connect the call to another destination.

[functionresult]: /docs/server-sdks/reference/python/agents/function-result

Transfer or connect the call to another destination. Generates a SWML `connect`
verb under the hood.

When `final=True` (the default), the call permanently leaves the agent. When
`final=False`, the call returns to the agent if the far end hangs up first.

## **Parameters**

**`destination`** `str` — required

Where to connect the call. Accepts a phone number in E.164 format (e.g.,
`"+15551234567"`) or a SIP address (e.g., `"support@company.com"`).

---

**`final`** `bool` — default: True

Whether this is a permanent transfer.

* `True` — call exits the agent completely (terminal action)
* `False` — call returns to the agent when the far end hangs up

---

**`from_addr`** `Optional[str]` — default: None

Caller ID override. Phone number or SIP address to show as the caller. When
`None`, the current call's originating address is used.

---

## **Returns**

[`FunctionResult`][functionresult] — self, for chaining.

## **Examples**

### Permanent Transfer

```python {11}
from signalwire import AgentBase
from signalwire import FunctionResult

agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")

@agent.tool(name="transfer_to_sales", description="Transfer caller to the sales team")
def transfer_to_sales(args, raw_data):
    return (
        FunctionResult("Transferring you to sales.")
        .connect("+15551234567", final=True)
    )

agent.serve()
```

### Temporary Transfer

```python {11}
from signalwire import AgentBase
from signalwire import FunctionResult

agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")

@agent.tool(name="consult_specialist", description="Connect to a specialist temporarily")
def consult_specialist(args, raw_data):
    return (
        FunctionResult("Connecting you to a specialist.")
        .connect("+15551234567", final=False)
    )

agent.serve()
```

### Custom Caller ID

```python {11}
from signalwire import AgentBase
from signalwire import FunctionResult

agent = AgentBase(name="my-agent", route="/agent")
agent.set_prompt_text("You are a helpful assistant.")

@agent.tool(name="transfer_with_caller_id", description="Transfer with custom caller ID")
def transfer_with_caller_id(args, raw_data):
    return (
        FunctionResult("Transferring now.")
        .connect(
            "support@company.com",
            final=True,
            from_addr="+15559876543"
        )
    )

agent.serve()
```