# Make Outbound Calls through a Designated 4G Trunk

When your TG400 gateway carries mobile (4G) trunks from more than one carrier, you can control which trunk each outbound call goes out on. Because many carriers offer plans with free or discounted calls to numbers on their own network, sending each call over the matching carrier's trunk can noticeably reduce what you spend on calls. This page shows how to steer outbound calls to a chosen 4G trunk based on the number a user dials.

A 4G trunk is a line backed by a SIM card in the gateway, so calls placed over it use that carrier's mobile network and its calling plan.

:::note
Before you start, this setup assumes the pieces below are already in place:

- The TG400 gateway is connected to Cloud Voice over a SIP (Session Initiation Protocol, the signaling protocol that sets up calls) account trunk, so the two systems can pass calls to each other.
- The gateway has its 4G trunks online, one per carrier (in this example `Trunk1` for Carrier A and `Trunk2` for Carrier B).
:::

## Scenario

The steps below follow this example. Numbers that begin with `92` should leave over Carrier A's trunk, and numbers that begin with `10` should leave over Carrier B's trunk.

| Dialed number | 4G trunk | Carrier |
| --- | --- | --- |
| Begins with `92` | 4G trunk 1 | Carrier A |
| Begins with `10` | 4G trunk 2 | Carrier B |

![Cloud Voice, diagram of calls leaving the PBX through the TG400 gateway and splitting onto two carrier 4G trunks by number prefix](/images/pbx/tg-gateway-p-series-make-calls-ce.png)

Setting this up takes three stages:

1. Add an outbound route on Cloud Voice that hands the calls to the gateway.
2. Add two IP to Mobile routes on the TG400 gateway, one per carrier, that match the dialed number and pick the correct 4G trunk.
3. Place test calls to confirm each prefix uses the trunk you expect.

## Step 1. Create an outbound route on Cloud Voice

An outbound route is the rule that lets your extensions dial out. Add one here so extensions can reach the outside world through the TG400 gateway.

1. Sign in to the Cloud Voice PBX (Private Branch Exchange, your phone system) portal and go to **Call Control > Outbound Route**, then click **Add**.
2. Configure these settings and leave the rest at their defaults:

   - **Name**: A label that helps you recognize the route.
   - **Dial Pattern**: Set the patterns to suit your needs. In this example, set **Pattern** to `X.`, which lets users dial any number with no restriction.

     ![Outbound route dial pattern set to X. so any dialed number matches](/images/pbx/p560-dial-pattern-x..png)

     :::note
     `X.` is deliberately broad. The per-carrier filtering happens later, on the gateway: the two IP to Mobile routes in Step 2 only accept numbers that begin with `92` or `10`. A call that matches neither prefix has no gateway route to take and will not complete.
     :::

   - **Trunk**: Choose the SIP account trunk that connects to the TG400 gateway. In this example, choose the `TG400` trunk.

     ![Outbound route trunk field set to the TG400 gateway account trunk](/images/pbx/p-cloud-edition-outbound-route-tg400.png)

   - **Extension/Extension Group**: Choose which extensions may dial out through this route. In this example, all extensions are selected.

     ![Outbound route listing all extensions as allowed callers](/images/pbx/p560-outbound-route-extension.png)

3. Click **Save**, then **Apply**.

## Step 2. Create two IP to Mobile routes on the gateway

On the TG400 gateway, create one IP to Mobile route for Carrier A and another for Carrier B. Each route matches a number pattern coming from Cloud Voice and sends the call out over the 4G trunk you assign to it.

1. Sign in to the gateway's web interface and go to **Gateway > Route Settings > IP to Mobile**, then click **Add IP to Mobile Route**.
2. In the dialog that opens, configure the route using the values below, then click **Save** and **Apply Changes**.

   | Setting | Description | Carrier A | Carrier B |
   | --- | --- | --- | --- |
   | Simple Mode | Keep the basic settings or expand to show the full set. | No | No |
   | Route Name | A label that helps you recognize the route. | `To-CarrierA` | `To-CarrierB` |
   | Call Source | The SIP register trunk that connects back to Cloud Voice. | SIP Register Trunk - CloudVoice | SIP Register Trunk - CloudVoice |
   | DID Number | The pattern or number that matches the dialed number arriving from Cloud Voice. | `92.` to match numbers with the `92` prefix | `10.` to match numbers with the `10` prefix |
   | Call Destination | The 4G trunk the call goes out on. | Mobile - Trunk1 | Mobile - Trunk2 |

   :::caution
   **Call Source** is the gateway's end of the same SIP link you selected as the **Trunk** in Step 1. Pick the register trunk that faces Cloud Voice on both routes. If it points at the wrong trunk, the calls arriving from the PBX will not match this route and will not go out.
   :::

   :::caution
   The **DID Number** (Direct Inward Dialing) field is what each route uses to match the digits arriving from Cloud Voice, even though the term normally refers to an inbound number. Its pattern must match those digits, or the call has no route to take and the outbound call fails. To make a route accept any dialed number, set **DID Number** to a single dot (`.`).
   :::

   ![IP to Mobile route matching the 92 prefix and sending calls out 4G trunk 1](/images/pbx/ip-to-mobile-route-from-ce-carrier-a.png)

   ![IP to Mobile route matching the 10 prefix and sending calls out 4G trunk 2](/images/pbx/ip-to-mobile-route-from-ce-carrier-b.png)

## Step 3. Place test calls

Dial a couple of numbers from a Cloud Voice extension and confirm each one leaves over the expected trunk:

- Dialing `921234567` sends the call out over 4G trunk 1.
- Dialing `108192837` sends the call out over 4G trunk 2.

:::tip
If a test call does not go through, check that the number's leading digits match one of the gateway's `DID Number` patterns (`92.` or `10.` in this example). A prefix that matches neither route has nowhere to go and the call fails.
:::
