Set Up SIP Backchannel for Google Dialogflow CX

The following steps are required to set up a SIP backchannel connection between CXone and your Dialogflow CX virtual agent.

  1. Create your Dialogflow CX virtual agent. It must be created on the global level. You can only add a phone number to a virtual agent on the global level, and you cannot change the level after it's created.
  2. Request a phone number from your virtual agent provider.
  3. Copy your GCP project ID from the Google Cloud console. You need this information in the next step.
  4. Add a configuration app to Virtual Agent Hub. Ensure SIP backchannel support is enabled and configured in the app.
  5. Create a virtual agent Studio script using the Voicebot Conversation action.
  6. Assign the configuration app you created in an earlier step to the Voicebot Conversation action.
  7. Create or modify a point of contact (POCClosed State that allows an agent to complete work requirements after finishing an interaction) in CXone. Configure it with the DNISClosed Identifies the number the contact dialed to reach you for inbound voice calls and the number the agent or system dialed on outbound voice calls. you want contacts to call and the script you created for the virtual agent. The DNIS used in the POC is not the same as the SIP number used in the virtual agent setup.

Request a SIP Phone Number

You must obtain a SIP phone number from the management console for your virtual agent provider.

  1. Log in to your Google Cloud Project.
  2. Open the Google Dialogflow CX console.
  3. In the Manage section, select Integrations and then use the CX Phone Gateway section to create a phone number for your virtual agent.
  4. Refer to the Google Dialogflow CX help pageA square with an arrow pointing outside. for more information.
  5. Take note of the phone number. You need to use it to set up the SIP connection in CXone.

Add a Virtual Agent App with SIP Backchannel Support

Permissions Required: View Scripts, Create/Edit Scripts

  1. In Studio, open or create a script and add a virtual agent action, if it doesn't contain one already.
  2. Double-click the virtual agent action to open Virtual Agent Hub.
  3. Click Add Bot.
  4. Enter a Virtual Agent (Bot) Name and select Google Dialogflow CX. You cannot modify the name after creating the app.

  5. On the Add Bot page, verify that Call is selected in the Media Type drop-down in the top right corner of the page.
  6. Click SIP Configured to switch it On.
  7. Enter the Phone Number you obtained from the virtual agent provider in the previous task.

  8. Enter Caller ID details. This field is optional.

  9. Enter the Project ID of the Google Cloud Project that hosts your virtual agent. This ID is used in the header URL for Dialogflow CX. You can find it on the Project Info tile in your Google Cloud Console. This is a required field.

  10. Click Add SIP Headers if you want the virtual agent to be able to transfer contacts to a live agent, then: 
    1. Enter HeaderURL as the Header Name.
    2. Copy and paste the following URL in the Header Value field:

      http://dialogflow.googleapis.com/v2beta1/projects

      CXone modifies the URL to include the Project ID you provided. If you're adding other headers, this URL must be the first one in the list.

  11. If you have other SIP headers to pass when CXone calls the virtual agent, click Add SIP Headers, the enter a Header Name and Header Value. Repeat this step for each header you need to add.

  12. Click Next at the top of the Add Bot page and then click Add.

Create a Studio Script

Permissions Required: View Scripts, Create/Edit Scripts

You need to create a Studio script that routes contacts to the virtual agent. To use a SIP backchannel connection, your script must use the Voicebot Conversation action to connect to the virtual agent.

Complete guidelines for creating virtual agent scripts are available on the Google Dialogflow CX page on this help site. The following are requirements specific to a SIP backchannel connection: 

Add the Live Agent Handoff Snippet

This snippet allows the virtual agent to transfer a call back to CXone so the contact can speak with a live agent. The virtual agent sends the returncustompayloadjson and returnintentinfojson responses to CXone. The snippet code creates dynamic data objects from the REST responses. The IF action checks the returncustompayloadjson response to see if a live agent has been requested. You can see an example of the live agent handoff in the example script in the next section.

  1. In Studio, open the virtual agent script you want to modify.

  2. Add a Snippet action after the Voicebot Conversation action and copy in the following code:

    DYNAMIC returnIntentInformation FROM returnintentinfojson
    DYNAMIC returnCustomPayload FROM returncustompayloadjson
  3. Use the BotSessionComplete branch condition to connect Voicebot Conversation to the Snippet action containing the Live Agent Handoff snippet code.
  4. Add an If action after the Live Agent Handoff Snippet action and connect them using the Default branch condition.
  5. Configure the Expression property of If with this expression:

    returncustompayloadjson = "liveAgentHandoff"	
  6. Add branches from the If action for the True and False branch conditions. The True branch should include the Reqagent action. The False branch should end the script with a Hangup action.

Example Script

The following image shows a basic example of a SIP backchannel script. Additional scripting may be required. For example, you should connect up the other branches of the Voicebot Conversation action, as well as the other actions in the script. You may also want to configure additional behaviors after the Onanswer event action fires.

A basic script for SIP backchannel that uses the Voicebot Conversation action.

Download script.

Assign the Configuration App to a Script Action

When the virtual agentClosed The meaning or purpose behind what a contact says/types; what the contact wants to communicate or accomplish app is set up and configured in Virtual Agent Hub, you need to assign it to the virtual agent actions in your script. This connects the action and the script to your virtual agent provider.

  1. In Studio, open the script you want to modify.
  2. Locate the virtual agent action in the script and double-click it to open Virtual Agent Hub.

  3. In the left column, locate the virtual agent that you want to assign to the action and click the selection option An icon of a circle with a checkmark inside. next to it.
  4. Click Close.