The Dialogflow CX Phone Gateway feature provides a telephone interface to your
agent. It is used to build conversational IVR (interactive voice response)
solutions that integrate with the rest of your call center network. With the
phone gateway, you can select a telephone number hosted by Google and connect
it to your agent.

For more information, see
[call companion](https://docs.cloud.google.com/dialogflow/cx/docs/concept/call-companion).

## Limitations

The following limitations apply:

- This integration works only with agents created in the `global` [region](https://docs.cloud.google.com/dialogflow/cx/docs/concept/region). If you need a local telephone number hosted in a specific region, contact your Google account team.
- Support is limited to US phone numbers.
- There are [quotas and limits](https://docs.cloud.google.com/dialogflow/quotas) for this feature. If you receive a busy signal or the call drops, you might have exceeded your quota.
- [Partial response](https://docs.cloud.google.com/dialogflow/cx/docs/concept/fulfillment#partial-response) is supported for all routes except the [Default welcome intent](https://docs.cloud.google.com/dialogflow/cx/docs/concept/intent#welcome) route on the [Default start flow](https://docs.cloud.google.com/dialogflow/cx/docs/concept/flow#start)'s start page.
- This integration uses the [`phone_call`](https://docs.cloud.google.com/speech-to-text/docs/speech-to-text-requests#select-model) speech model, even if other speech models are specified in the console or in the conversation profile, unless you enable the [Override request-level speech model](https://docs.cloud.google.com/dialogflow/cx/docs/concept/agent#stt-model-selection) setting.

## Supported languages

The Dialogflow CX Phone Gateway feature supports all
[languages that provide both STT and TTS](https://docs.cloud.google.com/dialogflow/cx/docs/reference/language).

## Set up a phone gateway

To set up your gateway, follow these steps:

1. Go to the [Dialogflow CX console](https://dialogflow.cloud.google.com/cx/projects). Select your Google Cloud project and select your agent.
2. Go to the **Manage** tab on the navigation menu.
3. Select **Integrations** and click **Try it** under **CX Phone Gateway**.
4. Click **+ Create** .
   1. Select the country code for the phone number.
   2. Optional: Select the area codes that you want.
   3. Click **Request**.
5. Select a phone number:
   1. Select a telephony number from the list.
   2. Enter a display name for configuring the conversation profile associated with the phone number.
   3. Optional: Select **Show more settings** and update the settings for the conversation profile.
   4. Click **Save**.
6. Completion:
   1. The gateway is now active.
   2. You can select the phone number on the **Phone Numbers** page to check and update settings.

## Call the phone number

Call the number and follow the voice prompts. If the agent reaches the end
session state, the call ends.

## Retrieve caller phone number

Retrieve the `caller_id` value from the [payload](https://docs.cloud.google.com/dialogflow/cx/docs/concept/integration/phone-gateway#payload) field.

## Play prerecorded audio

Use fulfillment options to
[play prerecorded audio](https://docs.cloud.google.com/dialogflow/cx/docs/concept/fulfillment#audio).
The audio must contain a single channel (mono) of
[μ-law](https://en.wikipedia.org/wiki/%CE%9C-law_algorithm) encoded audio at
8kHz and be hosted on [Cloud Storage](https://docs.cloud.google.com/storage/docs).

## Transfer a call

Use fulfillment options to
[transfer a call](https://docs.cloud.google.com/dialogflow/cx/docs/concept/fulfillment#transfer).

## Webhook request payload

If you have configured a [webhook](https://docs.cloud.google.com/dialogflow/cx/docs/concept/webhook), this
integration populates the `WebhookRequest.payload` field with the caller ID of
the end-user.

The format is as follows:

    "payload": {
      "telephony": {
        "caller_id": "+18558363987"
      }
    }

## Delete a number

You can select the **Delete** icon of a phone number to delete that number.

## Delete an agent

You can delete agents by deleting your Google Cloud project.
If you want to keep using your Google Cloud project, you must delete all
the phone numbers associated with your phone gateway agent before you
[delete the agent](https://docs.cloud.google.com/dialogflow/cx/docs/concept/agent#del).

For more information about deleting a number, see
[Delete a number](https://docs.cloud.google.com/dialogflow/cx/docs/concept/integration/phone-gateway#delete-phone-number).