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

# Receive Inbound Calls on Your Agent

> Route phone calls to your AI agent. Link phone numbers for automatic call routing and handle business hours.

Route incoming phone calls to your agent. Link a phone number to an agent, and calls to that number automatically connect to the agent.

**What you'll learn:** How to link phone numbers for inbound routing and test incoming calls.

***

## How inbound calls work

When a phone number is linked to an agent:

1. Caller dials the phone number
2. Call routes through your SIP provider
3. Agent answers and starts the conversation

***

## Link a phone number for inbound calls

> [tab] Dashboard
>
> 1. Navigate to **Phone Numbers**
> 2. Click on the phone number you want to use
> 3. Select an agent from the **Inbound Agent** dropdown
> 4. Click **Save**

> [tab] API
>
> ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}}
> // Link phone number to agent for inbound calls
> await fetch(
>   `https://blackbox.dasha.ai/api/v1/sip-phone-numbers/${phoneNumberId}/agent-link?agentId=${agentId}&mode=inbound`,
>   {
>     method: 'PUT',
>     headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
>   }
> );
> ```

> [!NOTE]
>
> Each phone number can only be linked to one agent for inbound calls. Linking to a new agent automatically unlinks from the previous one.

***

## Route a whole SIP domain to an agent

If you run your own PBX or carrier trunk, you do not need phone numbers or SIP credentials in BlackBox. Point your telephony at a hostname you own and let one agent answer everything sent to it.

**1. Add and verify the domain**

Go to **Phone Numbers → SIP Domains**, add your hostname (for example `calls.yourcompany.com`), create the DNS records shown in the domain details, and click **Verify**. The DNS setup is described in [Register Call → Use your own domain](https://blackbox.dasha.ai/docs/deploy/register-call.md#use-your-own-domain).

**2. Choose the agent**

> [tab] Dashboard
>
> Open the domain details and pick an agent under **Inbound routing**.

> [tab] API
>
> ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}}
> await fetch(`https://blackbox.dasha.ai/api/v1/sip-domains/${domainId}`, {
>   method: 'PATCH',
>   headers: {
>     'Authorization': 'Bearer YOUR_API_KEY',
>     'Content-Type': 'application/json'
>   },
>   body: JSON.stringify({ defaultAgentId: agentId })
> });
> ```

**3. Send calls to the domain**

Configure your PBX or carrier to send calls to `sip:<anything>@calls.yourcompany.com`, for example `sip:+14155550100@calls.yourcompany.com`. The agent answers, and the caller number from the SIP From header becomes the call endpoint.

> [!NOTE]
>
> Registered calls (`sip:{callId}@calls.yourcompany.com`) always keep the agent they were registered with. The domain agent only handles user parts that are not a registered call id. A domain without an agent rejects such calls with SIP `404`.

***

## Configure greeting

> [card] [Talk First](https://blackbox.dasha.ai/docs/advanced-features/talk-first.md)
>
> Configure the agent's first message when answering calls

***

## Set business hours

Control when your agent accepts inbound calls:

> [tab] Dashboard
>
> 1. Go to **Agents** → Select agent → **Edit**
> 2. Navigate to **Schedule** section
> 3. Set your business hours and timezone
> 4. Click **Save Agent**

> [tab] API
>
> ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}}
> await fetch(`https://blackbox.dasha.ai/api/v1/agents/${agentId}`, {
>   method: 'PUT',
>   headers: {
>     'Authorization': 'Bearer YOUR_API_KEY',
>     'Content-Type': 'application/json'
>   },
>   body: JSON.stringify({
>     schedule: {
>       timezone: "America/New_York",
>       mon: [{ start: { hour: 9, minute: 0 }, end: { hour: 17, minute: 0 } }],
>       tue: [{ start: { hour: 9, minute: 0 }, end: { hour: 17, minute: 0 } }],
>       wed: [{ start: { hour: 9, minute: 0 }, end: { hour: 17, minute: 0 } }],
>       thu: [{ start: { hour: 9, minute: 0 }, end: { hour: 17, minute: 0 } }],
>       fri: [{ start: { hour: 9, minute: 0 }, end: { hour: 17, minute: 0 } }]
>     }
>   })
> });
> ```

**No schedule configured = 24/7 availability.**

> [card] [Scheduling & Availability](https://blackbox.dasha.ai/docs/create/scheduling-availability.md)
>
> Complete guide to business hours, holidays, and timezone configuration

***

## Test inbound calls

**1. Verify setup**

* Agent is enabled (`isEnabled: true`)
* Phone number is linked for inbound
* SIP credentials are valid (check registration status)

**2. Make a test call**

Call the phone number from your mobile phone

**3. Verify connection**

Agent should answer with configured greeting

**4. Review in dashboard**

Go to **Calls** → Verify call appears in history with transcript

***

## Check phone number status

Verify a phone number is correctly linked:

```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}}
const phoneNumber = await fetch(
  `https://blackbox.dasha.ai/api/v1/sip-phone-numbers/${phoneNumberId}`,
  { headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
).then(r => r.json());

console.log('Phone:', phoneNumber.phoneNumber);
console.log('Inbound agent:', phoneNumber.incomingCallsAgentId || 'Not linked');
console.log('Registration:', phoneNumber.registrationStatus);
```

***

## Unlink a phone number

Stop routing calls to an agent:

> [tab] Dashboard
>
> 1. Navigate to **Phone Numbers**
> 2. Click on the phone number
> 3. Clear the **Inbound Agent** dropdown (select "None")
> 4. Click **Save**

> [tab] API
>
> ```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}}
> await fetch(
>   `https://blackbox.dasha.ai/api/v1/sip-phone-numbers/${phoneNumberId}/agent-link?mode=inbound`,
>   {
>     method: 'DELETE',
>     headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
>   }
> );
> ```

After unlinking, calls to this number will not be answered.

***

## Troubleshooting

### Calls not reaching agent

| Symptom | Fix |
| - | - |
| Call goes to voicemail | Verify phone number is linked to an agent |
| "Number not in service" | Check SIP registration status is successful |
| Ring but no answer | Verify agent is enabled |

### Agent not answering correctly

| Symptom | Fix |
| - | - |
| No greeting plays | Set `firstMessage` in agent config |
| Wrong agent answers | Check phone number is linked to correct agent |
| Agent unavailable | Check business hours schedule |

### Registration issues

| Symptom | Fix |
| - | - |
| Status: "Not registered" | Verify SIP credentials are correct |
| Status: "Failed" | Check server address and transport protocol |
| Intermittent failures | Enable registration if your provider requires it |

***

## What's next

> [card] [Outbound Calls](https://blackbox.dasha.ai/docs/deploy/outbound-calls.md)
>
> Make calls via API

> [card] [Phone Numbers](https://blackbox.dasha.ai/docs/deploy/phone-numbers.md)
>
> Add and manage phone numbers

> [card] [Business Hours](https://blackbox.dasha.ai/docs/create/scheduling-availability.md)
>
> Configure availability schedule

> [card] [Call History](https://blackbox.dasha.ai/docs/monitor/call-history.md)
>
> Monitor inbound calls


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