> ## 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.

# Setting Up Routing Rules

> Learn how to set up routing rules to control how inbound and outbound SIP calls are routed to rooms or agents in Zero Runtime. This guide covers dashboard and API configuration.

Routing rules in Zero Runtime allow you to control how inbound and outbound SIP calls are routed to specific rooms or agents based on the configurations you define. With routing rules, you can flexibly direct calls according to your business logic, such as sending support calls to a particular room or routing sales calls to a specific agent.

You can configure routing rules using the Zero Runtime dashboard or programmatically via the API.

## Configure routing rules using dashboard

The dashboard provides an intuitive interface to create and manage routing rules:

1. Navigate to the SIP section and select "Routing Rules".
2. Click "Add Routing Rule".
3. Fill in the required details:
   * **Gateway:** Select the SIP gateway (inbound or outbound) for this rule.
   * **Name:** Enter a descriptive name for the rule.
   * **Numbers:** Specify the phone numbers this rule applies to.
   * **Dispatch:** Choose how calls should be routed (to a room or agent).
   * **Room Options:** For room dispatch, select static or dynamic, and configure prefix, room ID, and PIN as needed.
   * **Agent Options:** For agent dispatch, select agent type and provide agent ID and metadata.
   * **Additional Options:** Set tags, metadata, and whether to hide the caller's phone number.
4. Save the rule. The new routing rule will be applied immediately.

<Frame>
  <video autoPlay muted loop controls className="w-full aspect-video rounded-xl" src="https://cdn.videosdk.live/website-resources/docs-resources/sip/routing-rule.mov" />
</Frame>

## Configure routing rules using API

You can also create routing rules using the API for automation or advanced use cases.

**Endpoint Parameters:**

* `gatewayId`: The ID of the gateway this routing rule belongs to.
* `name`: A descriptive name for the routing rule.
* `numbers`: Array of phone numbers associated with this rule.
* `dispatch`: Defines how calls should be dispatched (to a room or agent).
* `hidePhoneNumber`: (Optional) Hide the caller's phone number.
* `metadata`: (Optional) Custom metadata key-value pairs.
* `tags`: (Optional) Custom tags for the rule.

See the [Create Routing Rule API](https://docs.videosdk.live/api-reference/realtime-communication/sip/routing-rules/create-routing-rule) for the full request and response schema.

## API Reference

* [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)
