# Receive Inbound Calls through the Extended FXO Trunks

Once Cloud Voice is linked to a TA810 FXO gateway, the analog lines terminated on the gateway's FXO ports act as extended trunks for your phone system. An FXO (Foreign Exchange Office) port is the analog interface that plugs into a phone line from the traditional phone network, the PSTN (Public Switched Telephone Network). To deliver a call that lands on one of those trunks to an extension, you set up routing in two places: a route on the gateway that forwards the call to Cloud Voice over SIP (Session Initiation Protocol, the signaling used for calls over an IP network), and an inbound route on Cloud Voice that sends the call to a destination.

## Scenario

The diagram below traces how a call travels from the gateway's FXO trunks into Cloud Voice.

![Cloud Voice, call path from an FXO gateway's analog trunks into the phone system](/images/pbx/ta-fxo-gateway-p-series-receive-calls-ce.png)

## Step 1. Create a Port-to-IP route on the gateway

On the TA810 gateway, add a `Port->IP` route so calls arriving on the FXO trunks are forwarded to Cloud Voice.

1. Sign in to the gateway's web interface, go to **Gateway > Route Settings > Port->IP/Port**, and click **Add Port->IP/Port Route**.
2. Configure the route in the window that opens.

   ![Gateway Port-to-IP route using the FXO trunks as the source and the Cloud Voice SIP trunk as the destination](/images/pbx/pce-ta810-to-route.png)

   - **Simple Mode**: Select **Yes**.
   - **Route Name**: Enter a name that is easy to recognize.
   - **Call Source**: Choose the FXO trunk or trunks to route from. This example uses all FXO trunks.
   - **Call Destination**: Choose the SIP trunk that connects to Cloud Voice. This example uses the trunk **CloudVoice-Trunk**.
   - **Hotline**: Enter a hotline number, such as `123456`.

   :::note
   The hotline number is passed to Cloud Voice as the DID (Direct Inward Dialing) number, the digits that tell the phone system which inbound route to use. Because a DID travels with the call, the call reaches the phone system (the PBX, or Private Branch Exchange) in a single stage and callers are never asked to dial a second time (no two-stage dialing).
   :::

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

## Step 2. Create an inbound route on Cloud Voice

Add an inbound route so Cloud Voice accepts the calls arriving from the gateway and points them at a destination.

1. Sign in to the Cloud Voice management portal, go to **Call Control > Inbound Route**, and click **Add**.
2. Complete the fields below, leaving everything else at its default value.

   - **Name**: Enter a name that is easy to recognize.
   - **DID Pattern**: Define how the DID is matched.
     - **DID Matching Mode**: Select **DID Pattern**.
     - **Pattern**: Enter the hotline number you set on the gateway so it matches the incoming calls, `123456` in this example.

     :::caution
     The **Pattern** here must match the **Hotline** number you entered on the gateway in Step 1 exactly. If the two values differ, no inbound route matches the call and it is rejected.
     :::

     ![Inbound route DID pattern set to match the gateway's hotline number](/images/pbx/p560-inbound-route-did.png)

   - **Trunk**: Select the SIP account trunk that connects to the gateway (the Cloud Voice side of the same link the gateway route points at). This example uses the trunk **Connect-to-TA810-Gateway**.

     ![Inbound route Trunk field set to the SIP account trunk that links to the gateway](/images/pbx/pce-outbound-route-trunk-to-fxo.png)

   - **Default Destination**: Choose where matched calls should land. This example points to extension 2000, so any call coming in from the gateway rings that extension.

     ![Inbound route default destination set to extension 2000](/images/pbx/p560-inbound-route-destination.png)

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

## Step 3. Test the FXO trunk

Place a call to the number of an extended FXO trunk to confirm the routing works end to end. For example, if the trunk's number is 505523301, dialing 505523301 rings extension 2000 on Cloud Voice.
