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

# Receive calls on a number

> Create an inbound connection so calls that arrive on your number reach an agent.

An inbound connection routes calls that arrive on a number you own to one agent.
For how connections work and where they live, see
[Connect a phone number](/guides/agents/telephony/overview).

## Prerequisites

Before you begin:

* A number from a carrier, in E.164 format (`+15551234567`).
* Admin access to your SLNG organisation. Creating a connection is a dashboard
  task, and the **Telephony** section is admin only.
* An agent to answer the calls. Keep its ID for the API path. If you do not have
  one, see [Create an agent](/guides/get-started/create-a-project/create-agent).
* An SLNG key for the API path. See
  [How to set up](/guides/get-started/quickstart).

## Create the connection

<Steps>
  <Step title="Open the Telephony section">
    In the dashboard sidebar, open **Telephony**, switch to the **Inbound** tab,
    and click **Add connection**.

    <Frame caption="The Inbound tab of the Telephony section. Add connection starts the inbound setup.">
      <img src="https://mintcdn.com/slng-new-docs/_MURdOw87SJsfVag/heroshots/telephony-inbound-add-connection.png?fit=max&auto=format&n=_MURdOw87SJsfVag&q=85&s=5a513f82bc87407fcc9a0b7f81642667" alt="The Inbound tab of the Telephony section with the Add connection button" width="2560" height="1600" data-path="heroshots/telephony-inbound-add-connection.png" />
    </Frame>
  </Step>

  <Step title="Choose a setup mode">
    Choose **Twilio** to generate a webhook URL. Choose **Manual** to generate
    SIP forwarding targets and optionally restrict source addresses.
  </Step>

  <Step title="Name the connection and add your numbers">
    Give the connection a name you will recognize in the agent picker, such as
    `wayne-enterprises-support`. Add the phone numbers that should reach the
    agent, one per line or comma-separated, each in E.164 format.

    In **Manual** mode you can also set **Allowed addresses** to restrict which
    source addresses may send calls to this connection. Leave it empty to accept
    calls from any address your carrier uses.
  </Step>

  <Step title="Create the connection and wait for it to become active">
    Click **Create connection**. The connection starts as `pending` while
    provisioning finishes, then becomes `active`. If it ends in `error`, open
    the connection to see the reason. You cannot attach it until it is active.
  </Step>
</Steps>

## Route calls from your carrier

Your carrier must route incoming calls to the connection. A Twilio number sends
an HTTP request to the generated webhook URL. Another carrier forwards calls to
the generated SIP target.

```mermaid theme={null}
graph LR
  tw["<span style='display:block;width:30px;height:30px;margin:0 auto 6px;background:url(/images/icons/phone.svg) center/contain no-repeat'></span>Your Twilio number"]
  car["<span style='display:block;width:30px;height:30px;margin:0 auto 6px;background:url(/images/icons/server.svg) center/contain no-repeat'></span>Any SIP carrier"]
  agent["<span style='display:block;width:34px;height:34px;margin:0 auto 6px;background:url(/images/icon.svg) center/contain no-repeat'></span>SLNG agent"]
  tw -- "TwiML webhook URL" --> agent
  car -- "forward to SIP target" --> agent
  classDef slng stroke:#fbe566,stroke-width:2.5px;
  class agent slng
```

<Tabs>
  <Tab title="Twilio" icon="phone">
    Open the connection's **View setup** and copy the webhook URL. In the Twilio
    console, open the number's **Voice configuration**. Under **A call comes
    in**, choose **Webhook**, paste the URL, and select **HTTP POST**.

    <Frame caption="A Twilio inbound connection shows one webhook URL to paste into the number's voice settings.">
      <img src="https://mintcdn.com/slng-new-docs/_MURdOw87SJsfVag/heroshots/telephony-inbound-webhook.png?fit=max&auto=format&n=_MURdOw87SJsfVag&q=85&s=a4d7625b972e297994d23536cac730c7" alt="The inbound connection detail in Twilio mode, showing the webhook URL and a copy button" width="2560" height="1600" data-path="heroshots/telephony-inbound-webhook.png" />
    </Frame>

    <Frame caption="In the Twilio console, set the number's voice webhook to the SLNG URL, with HTTP POST.">
      <img src="https://mintcdn.com/slng-new-docs/fgzHSTXC7k7AhIuF/images/telephony/twilio-voice-config.png?fit=max&auto=format&n=fgzHSTXC7k7AhIuF&q=85&s=6f81f47d0ffdc66bed3526c73ae469f6" alt="Twilio Edit voice configuration screen with the voice webhook set to the SLNG inbound URL and HTTP POST" width="2558" height="1734" data-path="images/telephony/twilio-voice-config.png" />
    </Frame>

    The URL carries a token that identifies the connection, so treat it like a
    credential and do not publish it. If the connection shows no webhook URL
    yet, it has not finished provisioning.
  </Tab>

  <Tab title="Any SIP carrier" icon="server">
    Open the connection's **View setup** and copy the **Forwarding targets**.
    Configure your SIP provider to forward each number to the target listed next
    to it.

    <Frame caption="A manual inbound connection lists a forwarding target for each number you added.">
      <img src="https://mintcdn.com/slng-new-docs/_MURdOw87SJsfVag/heroshots/telephony-inbound-forwarding.png?fit=max&auto=format&n=_MURdOw87SJsfVag&q=85&s=951704deba056af0aaf0cb383565a319" alt="The inbound connection detail in manual mode, listing each phone number with its forwarding target" width="2560" height="1600" data-path="heroshots/telephony-inbound-forwarding.png" />
    </Frame>

    If you set **Allowed addresses**, they appear here too. Calls from any other
    source address are rejected.
  </Tab>
</Tabs>

## Attach the connection to an agent

An inbound connection belongs to one agent at a time, because a call arriving on
the number has to reach a single destination.

<Tabs>
  <Tab title="Dashboard" icon="monitor">
    Open the project, go to its **Telephony** section, and pick the connection
    under **Inbound calls**. Connections you cannot pick are disabled and marked
    **(Unavailable)** with the reason.

    <Frame caption="The project's Telephony section, with the inbound connection picker open.">
      <img src="https://mintcdn.com/slng-new-docs/_MURdOw87SJsfVag/heroshots/telephony-attach-inbound.png?fit=max&auto=format&n=_MURdOw87SJsfVag&q=85&s=92438c61306e8337e804dfcda924b3ca" alt="The project Telephony section with the inbound connection dropdown open" width="2560" height="1600" data-path="heroshots/telephony-attach-inbound.png" />
    </Frame>
  </Tab>

  <Tab title="API" icon="code">
    List the connections available to the agent.

    ```bash Request theme={null}
    curl https://api.agents.slng.ai/v1/agents/$AGENT_ID/sip-trunk-options \
      -H "Authorization: Bearer $SLNG_API_KEY"
    ```

    ```json Response expandable theme={null}
    {
      "inbound": [
        {
          "id": "3f9c1b4e-5a27-4f8d-9c11-7b2e6d4a8c05",
          "name": "wayne-enterprises-support",
          "livekit_trunk_id": "ST_b6TUc5Q7bZMD",
          "numbers": ["+15551234567"],
          "status": "active",
          "selectable": true,
          "is_current": false,
          "unavailable_reason": null
        }
      ],
      "outbound": []
    }
    ```

    Copy the `id` of a connection where `selectable` is `true`, then set
    `sip_inbound_trunk_id` on the agent.

    ```bash Request theme={null}
    curl -X PATCH https://api.agents.slng.ai/v1/agents/$AGENT_ID \
      -H "Authorization: Bearer $SLNG_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{ "sip_inbound_trunk_id": "3f9c1b4e-5a27-4f8d-9c11-7b2e6d4a8c05" }'
    ```

    A successful response returns the updated agent with
    `sip_inbound_trunk_id` set to the connection ID. Sending `null` detaches the
    connection and leaves it free for another agent.
  </Tab>
</Tabs>

### When a connection cannot be attached

The dashboard disables unavailable connections. The API returns the reason in
`unavailable_reason`. See
[When a connection cannot be attached](/guides/agents/telephony/overview#when-a-connection-cannot-be-attached).

## Verify inbound calls

Call one of the connection's numbers from another phone. The agent should answer
and use `inbound_greeting` when you have set one. If the call does not reach the
agent, confirm that the connection is `active`, attached to the agent, and using
the carrier settings shown under **View setup**.

## Greet inbound callers differently

With a connection attached, the agent can use `inbound_greeting` instead of its
default `greeting`, so a caller who dials in hears something different from
someone the agent called. Directional greetings need at least one connection
attached, inbound or outbound, and the agent fails to save without one. See
[Create an agent](/guides/get-started/create-a-project/create-agent#update-an-agent)
for the update mechanic.

## Change or replace the credentials

Manual connections authenticate with a SIP username and password, shown under
**View setup**. To change them, open **Edit** and update both values together.
Configure your carrier to use the same pair. Coordinate the change because calls
can fail while the two sides use different credentials.

Twilio inbound connections do not use a SIP username and password. The webhook
URL contains the connection token, and the dashboard cannot rotate that token in
place. If the URL is exposed, contact SLNG support to replace the connection.
Replacing it may briefly interrupt inbound calls.

## Next steps

* [Place calls from an agent](/guides/agents/telephony/outbound) if the agent
  also needs to dial out or transfer callers to a person.
* [Watch the calls](/guides/usage-and-billing) as they arrive.
