# Provision a Grandstream FXS Gateway with Cloud Voice

Cloud Voice can auto-provision Grandstream FXS (Foreign Exchange Station) gateways, the devices that provide the analog phone jacks, so the analog phones plugged into their ports come online as extensions without manual per-device setup. This page uses a Grandstream HT802 (firmware 1.0.63.3) as the working example, but the same workflow applies to the other supported models.

## Supported models and firmware

Confirm that your gateway is running a supported firmware version before you begin.

| Model | Gateway firmware | Cloud Voice requirement |
|-------|------------------|-------------------------|
| GXW4216 | 1.0.23.4 or later | 84.6.0.24 or later |
| GXW4224 | 1.0.23.4 or later | 84.6.0.24 or later |
| GXW4232 | 1.0.23.4 or later | 84.6.0.24 or later |
| GXW4248 | 1.0.23.4 or later | 84.6.0.24 or later |
| HT801 | 1.0.63.3 or later | 84.6.0.24 or later |
| HT802 | 1.0.63.3 or later | 84.6.0.24 or later |
| HT812 | 1.0.5.10 or later | 84.6.0.24 or later |
| HT814 | 1.0.63.3 or later | 84.6.0.24 or later |
| HT818 | 1.0.63.3 or later | 84.6.0.24 or later |

:::caution
If the firmware on either the gateway or Cloud Voice is older than the versions above, provisioning may fail. Update first.
:::

## Before you start

- Run a third-party DHCP (Dynamic Host Configuration Protocol) server on the same subnet as the gateway so the device can lease an IP address.
  :::caution
  Only one DHCP server may be active on the gateway's subnet. If more than one is present, the gateways may fail to obtain an IP address.
  :::
- Download the auto-provisioning template for your model in advance, under **Auto Provisioning > Resource Repository > Default Templates**.
- If the gateway has been used before, reset it to factory defaults, then give it an IP address.
  :::danger
  A factory reset is unrecoverable. It wipes the gateway's entire configuration, including saved extensions and network settings. Only do this on a device you intend to reprovision, and never on one carrying live calls.
  :::
- Collect the gateway's vendor, model, and MAC (Media Access Control) address. The MAC address is the unique hardware identifier printed on a label on the device.

## How provisioning works

Provisioning takes two stages:

1. Add the Grandstream gateway in Cloud Voice, which builds a configuration file keyed to the device's MAC address.
2. Point the gateway at that configuration by publishing the provisioning link through DHCP option 66.

## Step 1. Add the gateway in Cloud Voice

Adding the gateway generates a configuration file based on its MAC address.

1. Sign in to the PBX (Private Branch Exchange) web portal and open **Auto Provisioning > Phones**.
2. Click **Add > Add**.
3. In the **IP Phone** section, fill in the device details.

   ![Add-device form with vendor, model, and MAC address fields for a Grandstream gateway](/images/pbx/add-gs-gateway.png)

   - **Vendor**: Select **Grandstream**.
   - **Model**: Select your model. This example uses **HT802**.
   - **MAC Address**: Enter the gateway's MAC address.
4. In the **Options** section, set the following.

   
   ![Cloud Voice, Options section showing the template selector and the auto-generated provisioning link](/images/pbx/gs-gw-template.png)

   - **Template**: Choose a template from the drop-down list.
     :::note
     Use the default template for your model, or apply a custom template you have created. A template controls which settings Cloud Voice writes into the gateway's configuration file.
     :::
   - **Provisioning Link**: A link is generated automatically. It points to where the gateway's configuration file is stored.
5. In the **Assign Extension** section, map extensions to the handsets you want to enable. Assigned extensions bind to the gateway's FXS ports, so the analog phones on those ports place and receive calls using those extension numbers.

   - To assign extensions individually, select a handset's checkbox and pick an extension from the **Extension** drop-down.

     ![Assigning a single extension to one handset row via the Extension drop-down](/images/pbx/gs-assign-ext-to-handset-single.png)

   - To assign extensions in bulk, set a range with the **Start Extension** and **End Extension** drop-downs, then click **Assign Extension**. The handsets are enabled automatically and filled with available extensions in order.

     ![Bulk extension assignment using start and end extension range fields](/images/pbx/gs-assign-ext-to-handset-bulk.png)

   :::tip
   If the extension you want is missing from the drop-down, it is already tied to another IP phone. Either release it from that device, or enable concurrent registration for the extension so it can register on more than one endpoint. By default an extension registers with a single SIP (Session Initiation Protocol) endpoint.
   :::
6. Optional: In the **Preference** section, change the value in **Admin Phone Password** if you want a different gateway admin password.

   :::note
   The gateway's default admin password is `admin`.
   :::

   ![Preference section with the Admin Phone Password field](/images/pbx/gs-password.png)
7. Click **Save**.

## Step 2. Configure DHCP option 66

Publish the provisioning link through option 66 on the DHCP server that serves the gateway's subnet.

:::note
Option 66 is the standard DHCP field for a provisioning server address. When the gateway boots and requests an IP address, the DHCP server also hands back this value, which tells the gateway where to download its configuration file.
:::

1. In the PBX web portal, open the gateway's detail page and copy its provisioning link.

   
   ![Cloud Voice, gateway detail page with the provisioning link ready to copy](/images/pbx/gs-gw-template-1.png)
2. On the third-party DHCP server, create option 66 and set its value to the provisioning link. The example below shows a typical configuration.

   
   ![Cloud Voice, DHCP server option 66 configured with the provisioning link value](/images/pbx/gs-dhcp-setting-pce.png)

## Result

- Reboot the gateway manually. On startup it leases an IP address from the DHCP server, pulls its configuration from Cloud Voice over the provisioning link, and applies the settings on its own.
- The extensions register through the gateway. Confirm their status under **Auto Provisioning > Phones** in the PBX web portal.

  ![Auto Provisioning phone list showing the Grandstream gateway provisioned and registered](/images/pbx/gs-gateway-prov-success.png)
