# Inbound Call Redirection Methods

Inbound calls can be redirected to an external phone number (PSTN) through your account's **Outbound Trunks**. Advanced
routing is achieved by responding to an incoming call with either a **30x Redirect** SIP response or an in-dialog
**REFER** request.

---



## Before You Begin

> - At least one [Outbound Trunk](../../outbound-trunks/how-to-guides/create-outbound-trunk.html#outbound-trunk-create-trunk) is required, with **Authentication method** set to **Credentials & IP-Based**, and DIDWW [SIP/RTP IP addresses allowed](sip.html#service-did-sip).
> - An [Inbound SIP Trunk](../creating-a-new-sip-trunk.html#user-panel-sipin-trunk) is required, with **Max 30x Redirects** or **Max Transfers** set to a value greater than 0 in the [Signalling tab](../creating-a-new-sip-trunk.html#user-panel-sipin-trunk-general-advanced-signaling-settings-timeout).
> - Authorization is required on the [Inbound SIP Trunk](../creating-a-new-sip-trunk.html#user-panel-sipin-trunk-authentication), using the same **Auth User** and **Auth Password** configured on the chosen [Outbound Trunk](../../outbound-trunks/how-to-guides/view-outbound-trunk-credentials.html#view-outbound-trunk-credentials).
> - The SIP destination URI is required in the format `sip:NEW_PSTN_NUMBER@<outbound_endpoint>` and included in the **Contact** header for 30x responses or the **Refer-To** header for REFER requests.

Note

- The full list of outbound endpoints is available at [Signaling Endpoints](../../outbound-trunks/outbound-sip-information.html#voice-out-signaling-endpoints).
- `NEW_PSTN_NUMBER` is the E.164 phone number, and `<outbound_endpoint>` is a DIDWW outbound endpoint (e.g., `out.didww.com`).

---

## 30x Redirect Method

This method redirects an inbound call to a new destination **without answering it**.

> 1. Your system replies to the DIDWW INVITE with a SIP `302 Moved Temporarily` (or another 3xx response), including the new destination in the `Contact` header.
> 2. DIDWW then starts a new outbound call to that SIP URI using your Outbound Trunk, authenticated with the credentials set on your Inbound Trunk.

### Examples

302 SIP Response

Example of a valid `302 Moved Temporarily` response:

```
SIP/2.0 302 Moved Temporarily
Via: SIP/2.0/UDP 192.0.2.5:5060;branch=z9hG4bK-393929
From: <sip:CALLER_NUMBER@46.19.209.14>;tag=123456
To: <sip:DID_NUMBER@example.com>;tag=abcdef
Call-ID: 01-01-35531111-68BE960300095714-69CF836B
CSeq: 1 INVITE
Contact: <sip:NEW_PSTN_NUMBER@out.didww.com>
Content-Length: 0
```

For more details, see [**RFC 3261 Section 21.3**](https://datatracker.ietf.org/doc/html/rfc3261.html#section-21.3).

Call Flow Diagram

```
        %%{init: { "theme": "base", "themeVariables": { "actorBkg": "#e6f7ff", "actorBorder": "#1890ff", "noteBkgColor": "#fff7e6", "noteBorderColor": "#fa8c16" }}}%%
sequenceDiagram
  participant caller as Caller
  participant voice_in as DIDWW Inbound Trunk
  participant pbx as Your System
  participant voice_out as DIDWW Outbound Trunk

  caller->>voice_in: INVITE
  voice_in->>pbx: INVITE to your system<br/>sip:DID_NUMBER@example.com
  pbx-->>voice_in: 302 Redirect<br/>Contact: sip:NEW_PSTN_NUMBER@out.didww.com

  Note over voice_in: Redirect processing<br/>checks MAX_30x_REDIRECTS value
  voice_in->>voice_out: INVITE to your Outbound Trunk<br/>sip:NEW_PSTN_NUMBER@out.didww.com
  voice_out-->>voice_in: 401 Unauthorized + Auth Challenge

  Note over voice_in: Applies AUTH_USER and AUTH_PASSWORD from your Inbound Trunk

  voice_in->>voice_out: INVITE with Auth Header<br/>sip:NEW_PSTN_NUMBER@out.didww.com
  voice_out-->>voice_in: 200 OK
  Note over voice_in, voice_out: Call is established via Outbound Trunk
```

Use Cases

This method is ideal when a routing decision can be made immediately, without answering the call first.

> - Forward calls after hours to a service or mobile phone
> - Instantly route VIP callers to a direct line
> - Redirect desk calls to a mobile phone with follow-me rules

---

## REFER Transfer Method

This method transfers an inbound call to a new destination **after it has been answered**.

> 1. Your system first answers the inbound call, creating an active SIP dialog.
> 2. When a transfer is needed, your system sends an in-dialog SIP `REFER` request with the new destination in the `Refer-To` header.
> 3. DIDWW validates the request against the `MAX_TRANSFERS` setting and replies with `200 OK`.
> 4. Your system then sends a `BYE` to close the original call leg. DIDWW initiates a new outbound call via your Outbound Trunk, authenticated with the credentials from your Inbound Trunk.

### Examples

SIP REFER Request

Example of a valid in-dialog REFER request:

```
REFER sip:CALLER_NUMBER@46.19.209.14 SIP/2.0
Via: SIP/2.0/UDP 192.0.2.5:5060;branch=z9hG4bK-443322
Max-Forwards: 70
From: <sip:USERPART@example.com>;tag=abcdef
To: <sip:CALLER_NUMBER@46.19.209.14>;tag=123456
Call-ID: 01-01-35531111-68BE960300095714-69CF836C
CSeq: 2 REFER
Refer-To: <sip:NEW_PSTN_NUMBER@out.didww.com>
Referred-By: <sip:DID_NUMBER@example.com>
Contact: <sip:DID_NUMBER@192.0.2.5:5060>
Content-Length: 0
```

For more details, see [**RFC 3515**](https://datatracker.ietf.org/doc/html/rfc3515.html).

Call Flow Diagram

[![Porting Request Flow](../../../_images/siprefer-diagram.png)](../../../_images/siprefer-diagram.png)

Use Cases

This method is useful when the call must first be answered before deciding where to route it:

> - Transfer calls after IVR menu selection (e.g., "Press 1 for Sales")
> - Redirect from an AI voicebot to a live agent after intent detection
> - Forward calls from an agent's softphone to an external specialist on the PSTN

---

## Additional Resources

**Configure Call Transfers**

Step-by-step guide on configuring inbound and outbound SIP trunks in DIDWW
to enable call transfers using SIP 30x Redirect or SIP REFER signaling.

[Configure Call Transfers](call-transfers.html#call-transfers-use-cases)

On this page
