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

# Routing SIP Calls to Agents

> Learn how to configure routing rules to direct SIP calls to AI agents in Zero Runtime, including Agent Cloud and self-hosted deployment options.

You can route inbound or outbound SIP calls directly to an AI agent using Zero Runtime's routing rules. This is useful for building automated voice assistants, IVRs, or connecting callers to intelligent agents for support, sales, or other workflows.

### Example Request

```bash theme={null}
curl -X POST 'https://api.videosdk.live/v2/sip/routing-rule' \
  -H 'Authorization: YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Inbound support rule",
    "type": "inbound",
    "agentId": "Your Agent ID",
    "phoneNumbers": ["+14155551234"]
  }'
```

### Example Response

```json theme={null}
{
  "id": "rr_abc123",
  "name": "Inbound support rule",
  "type": "inbound",
  "numbers": ["+14155551234"],
  "room": {
    "type": "dynamic",
    "prefix": "blank"
  },
  "agentId": "agent_xyz",
  "agentMetadata": {
    "team": "support"
  }
}
```

## Deployment Notes for Agent Cloud

When using an Agent Cloud deployment, the agent must read the following environment variables to join the correct Zero Runtime room:

* `ZERORUNTIME_ROOM_ID`: The room ID the agent should join for the call session.
* `ZERORUNTIME_AUTH_TOKEN`: The authentication token for joining the room.

Your agent should read these environment variables at runtime to connect to the correct room and handle the SIP call.

<Tip>
  You can configure agent routing rules via the Zero Runtime dashboard or using the API for automation and CI/CD workflows.
</Tip>

## API Reference

* [Building AI Agent for Telephony](/quickstarts/build-a-telephony-agent)
* [Create Routing Rule API](https://docs.videosdk.live/api-reference/realtime-communication/sip/routing-rules/create-routing-rule)
* [Fetch all Routing Rule API](https://docs.videosdk.live/api-reference/realtime-communication/sip/routing-rules/fetch-all-routing-rule)
* [Fetch a Routing Rule API](https://docs.videosdk.live/api-reference/realtime-communication/sip/routing-rules/fetch-routing-rule)
* [Update Routing Rule API](https://docs.videosdk.live/api-reference/realtime-communication/sip/routing-rules/update-routing-rule)
* [Delete Routing Rule API](https://docs.videosdk.live/api-reference/realtime-communication/sip/routing-rules/delete-routing-rule)
