# Service Failover and Load Balancing

DIDWW provides mechanisms for **failover and load balancing** between its system and customer equipment. These
mechanisms include **DNS SRV** for SIP-based failover and **Trunk Groups** for managing multiple SIP trunks efficiently.

---



## DNS SRV

The [DNS SRV](https://en.wikipedia.org/wiki/SRV_record) mechanism is fully supported by the DIDWW system. Using DNS SRV,
calls can be directed to a customer-defined DNS SRV record, which specifies multiple destinations and their respective
priorities for failover.

### How It Works

For **UDP SIP transport**, the system resolves the following record:

> ```
> _sip._udp.<customer.domain>
> ```

For **TCP SIP transport**, the system resolves the following record:

> ```
> _sip._tcp.<customer.domain>
> ```

For **TLS SIP transport**, the system resolves the following record:

> ```
> _sip._tls.<customer.domain>
> ```

In all cases, **<customer.domain>** corresponds to the trunk
[host](../creating-a-new-sip-trunk.html#user-panel-sip-trunk-host) value.

### Enabling DNS SRV for SIP Trunks

To enable DNS SRV for SIP trunks, leave the [port](../creating-a-new-sip-trunk.html#user-panel-sip-trunk-port) field
**empty**.

> Note
>
> The DNS SRV mechanism operates at the **SIP transaction layer**. If a failover occurs, a **new Call Detail Record (CDR)** is generated for each attempt.

---

## Trunk Groups

Trunk Groups allow customers to bundle multiple SIP trunks, distributing traffic for DID numbers across multiple
gateways. This feature provides flexible configuration options for failover and load balancing.

### Configuration Options

You can configure the following parameters to manage Trunk Groups effectively:

> - **Priority:** Set the order in which trunks in the group are tried. Trunks with lower values are tried first.
> - **Weight:** Control call distribution between trunks that have the same priority. Trunks with higher values are selected more often.
> - **Ringing Timeout:** Set the maximum time to wait for a response from a trunk.
> - **Re-routing Disconnect Codes:** Select the disconnect codes that trigger routing to another trunk in the group.
> - **Capacity Limit:** Limit the number of simultaneous calls per trunk.

### Call Detail Records (CDRs)

For each call termination attempt within a Trunk Group, DIDWW generates a separate **Call Detail Record (CDR)**. Each
CDR represents an individual attempt to route the call to the destination network.

The key attributes related to call attempts while using call events **CDR Streaming** include:

CDR Streaming Call Attempt Attributes






| **Attribute** | **Type** | **Description** | **Example** |
| --- | --- | --- | --- |
| **routing\_attempt** | Integer | Specifies the sequential attempt number for routing the call. The first attempt is recorded as `1`, with each subsequent attempt incrementing this value. | `1` |
| **is\_last\_cdr** | Boolean | Indicates whether this CDR corresponds to the final attempt in the routing process. If set to `true`, no further attempts were made. | `true` |

By utilizing **DNS SRV** records and **Trunk Groups**, DIDWW enables advanced failover and load-balancing strategies for
inbound DID numbers. In scenarios where a call cannot be routed successfully on the first attempt, the system can
attempt alternative destinations based on predefined routing logic.

### Additional information

**Number List Load Balancing**

Learn how to use Number Lists for call load balancing purposes.

[Example 4: Use Number Lists for Load Balancing](../number-list-examples.html#user-panel-voice-in-numberlist-examples-lb)

**Inbound CDR Logs**

For User Interface Call Logs, visit the documentation page.

[Inbound Call Logs](../../../logs-analytics/call-logs/inbound-logs.html#inbound-cdr-logs)

**CDR Streaming Attributes**

For more details about CDR Streaming CDR attributes, visit the documentation page.

[Voice IN CDR Streaming Attributes](../../../call-events/did-cdr.html#voice-in-cdr-streaming-attributes)

On this page
