> ## Documentation Index
> Fetch the complete documentation index at: https://docs.poly.ai/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.poly.ai/feedback

```json
{
  "path": "/integrations/voice/sip/genesys",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Genesys

> Connect your PolyAI agent to Genesys Cloud using BYOC service.

Connect PolyAI to Genesys Cloud's [Bring Your Own Carrier (BYOC) service](https://help.mypurecloud.com/articles/about-byoc-bring-your-own-carrier/) to provide call handling, routing, and handoff capabilities. This guide explains how to integrate your Genesys Cloud instance with the PolyAI app available on the [Genesys AppFoundry](https://appfoundry.genesys.com/filter/genesyscloud/listing/f1d61f31-661b-4ecf-a752-771a66286f51).

<Info> BYOC setups use shared SIP Trunks, so PolyAI connects using a preconfigured multi-tenant trunk with shared IPs and settings. </Info>

## PolyAI configuration

1. **Get connection tokens**:
   * PolyAI will provide you with two tokens:
     * A **UAT Token** to use for testing.
     * A **Production Token** to use for live deployment.
   * Use these tokens to authenticate your SIP trunks with PolyAI.

2. **Enable Handoff API**:
   * If [screen pop](https://all.docs.genesys.com/PEC-GPA/Current/Administrator/GplusScreenPop90) is required, make sure you have configured your project to meet the standards of the [Handoff API](/api-reference/handoff/endpoint/get-handoff).
   * Request an API key from PolyAI for this functionality.

3. **Prepare for SIP INVITE data**:
   * Your Genesys SIP INVITE will include:
     * `x-inin-cnv`: the Genesys [Conversation ID](https://developer.genesys.cloud/commdigital/digital/openmessaging/gettingConversationId).
     * `X-User-to-User`: Custom data in the format `X-User-to-User:{data};encoding=ascii`.

4. **Send data during SIP REFER**:
   * To return data to Genesys, use this format in the SIP REFER message:

     `Refer-To: <sip:{route}@{ip}?User-to-User={pd}{data}%3Bencoding%3Dhex>`

     * Replace `{pd}` with the protocol discriminator (two hex digits).
     * Replace `{data}` with the hex-encoded information.

### Genesys trunk setup

#### Prerequisites

* **PolyAI tokens**: You should have both UAT and Production tokens provided by PolyAI.
* **Admin access**: Ensure your Genesys account has [permissions to manage external SIP trunks](https://help.mypurecloud.com/articles/external-trunk-settings/).

#### Configure the primary trunk

To configure a SIP trunk with Genesys Cloud, follow these steps.

<Tabs>
  <Tab title="US">
    **Configuration steps for the US region:**

    1. Go to `Telephony > Trunks > External Trunks` in Genesys Cloud.
    2. Create a new SIP trunk:
       * Type: **BYOC Carrier**
       * Subtype: **Generic BYOC Carrier**
       * Protocol: **TLS**
    3. SIP server: `kam.us-1.polyai.app`, Port: `5061`
    4. Allow IP: `3.221.248.55`
    5. Media settings: Codec `audio/PCMU`
    6. UUI passthrough:
       * Protocol: `X-User-to-User`
       * Encoding: `Ascii`
    7. Custom SIP headers:
       * Header: `X-PolyAi-Auth-Token`
       * Value: Use the token provided by PolyAI.
  </Tab>

  <Tab title="UK">
    **Configuration steps for the UK region:**

    1. Go to `Telephony > Trunks > External Trunks` in Genesys Cloud.
    2. Create a new SIP trunk:
       * Type: **BYOC Carrier**
       * Subtype: **Generic BYOC Carrier**
       * Protocol: **TLS**
    3. SIP server: `kam1.uk-1.polyai.app`, Port: `5061`
    4. Allow IP: `3.10.92.139`
    5. Media settings: Codec `audio/PCMU`
    6. UUI passthrough:
       * Protocol: `X-User-to-User`
       * Encoding: `Ascii`
    7. Custom SIP headers:
       * Header: `X-PolyAi-Auth-Token`
       * Value: Use the token provided by PolyAI.
  </Tab>

  <Tab title="EU">
    **Configuration steps for the EU region:**

    1. Go to `Telephony > Trunks > External Trunks` in Genesys Cloud.
    2. Create a new SIP trunk:
       * Type: **BYOC Carrier**
       * Subtype: **Generic BYOC Carrier**
       * Protocol: **TLS**
    3. SIP server: `kam.euw-1.polyai.app`, Port: `5061`
    4. Allow IP: `54.77.217.78`
    5. Media settings: Codec `audio/PCMU`
    6. UUI passthrough:
       * Protocol: `X-User-to-User`
       * Encoding: `Ascii`
    7. Custom SIP headers:
       * Header: `X-PolyAi-Auth-Token`
       * Value: Use the token provided by PolyAI.
  </Tab>

  <Tab title="APAC">
    **Configuration steps for the APAC region:**

    1. Navigate to `Telephony > Trunks > External Trunks` in Genesys Cloud.
    2. Create a new SIP trunk:
       * Type: **BYOC Carrier**
       * Subtype: **Generic BYOC Carrier**
       * Protocol: **TLS**
    3. SIP server: `kam1.sg-1.polyai.app`, Port: `5061`
    4. Allow IP: `18.140.207.42`
    5. Media settings: Codec `audio/PCMU`
    6. UUI passthrough:
       * Protocol: `X-User-to-User`
       * Encoding: `Ascii`
    7. Custom SIP headers:
       * Header: `X-PolyAi-Auth-Token`
       * Value: Use the token provided by PolyAI.
  </Tab>
</Tabs>

#### Create the secondary trunk

Repeat the above steps with the secondary PolyAI server and IP for your region:

<Tabs>
  <Tab title="US">
    * US: `kam2.us-1.polyai.app`, `35.170.209.49`.
  </Tab>

  <Tab title="UK">
    * UK: `kam2.uk-1.polyai.app`, `18.168.178.6`.
  </Tab>

  <Tab title="EU">
    * EU: `kam2.euw-1.polyai.app`, `34.255.224.245`.
  </Tab>

  <Tab title="APAC">
    * APAC: `kam2.sg-1.polyai.app`, `13.250.218.51`.
  </Tab>
</Tabs>

#### Set failover routing

1. Go to **Site > Edit Site > Outbound Routes** in Genesys Cloud.
2. Set the distribution pattern to **Sequential** to enable failover from the primary trunk to the secondary trunk.
