Please ensure Javascript is enabled for purposes of website accessibility
Five9 and Mindful Integration Guide
  • 30 Nov 2023
  • 30 Minutes to read
  • Dark
    Light
  • PDF

Five9 and Mindful Integration Guide

  • Dark
    Light
  • PDF

Article Summary

This guide provides comprehensive instructions for integrating Mindful with Five9 Virtual Contact Center (VCC). Here, you can learn how to configure Mindful Callback, Scheduler, and Datastore to integrate with Five9 VCC. Each step in the integration process will be demonstrated through examples that can be used as templates for your specific integration.

Overview

  • Step 1: Mindful configuration
  • Step 2: Five9 configuration
    • Configure a secure SIP trunk
    • Modify the Inbound IVR script in VCC Administrator to use Mindful Callback integration logic:
      • Check EWT
      • Check Mindful Callback status
      • Play EWT Announcement
      • Offer callback and collect DTMF input
      • (Optional) Set custom SIP headers to pass to Mindful Callback
      • (Optional) Post data to Mindful Datastore
      • Transfer the call to Mindful Callback with optional custom SIP headers
    • Create the Return Call IVR script in VCC Administrator:
      • (Optional) Retrieve data from Mindful Datastore or SIP headers
      • Send calls to an agent skill at higher priority than inbound calls
  • Step 3: (Optional) Configure Second Chance Callback
    • Modify the Inbound IVR script
NOTES
  • Callback offers are made in the Five9 inbound IVR script, rather than Mindful.
  • The IVR scripts, actions and functions described in this guide are examples that can be used as templates for your specific integration.
  • This guide assumes the use of a secure SIP trunk between both platforms with Secure RTP for voice traffic.  

Components and call flows

Before looking at configuration, you can review key terms and acronyms below.

Definitions and acronyms

TermDescription
ANI (or CLI)Automatic Number Identification is the number of the caller. Also known as Calling Line Identification in some markets.
APIAn Application Programming Interface is a set of functions that allows applications to request service from other applications.
DIDDirect Inward Dialing phone number 
DNISThe Dialed Number Identification Service is the number of the callee (typically the number that is being dialed) in a voice call.
Mindful CallbackA part of the Mindful platform that provides the capability to request and receive callbacks.
DatastoreThis service adds the capability to store and retrieve custom data when registering a callback in Mindful via HTTPS POST and GET calls.
SchedulerA feature of Mindful Callback that allows callbacks to be requested via API from other applications and platforms.
PSTNThe public circuit-switched telephone network
RTP/SRTPReal-time Transport Protocol is a network protocol used to deliver audio and video over IP networks. SRTP is the secure (encrypted) version of RTP.
SIPSession Initiation Protocol is a signaling protocol used in IP communications.
TFNToll-free number
TLSTransport Layer Security is an encryption protocol used for secure SIP signaling between two endpoints.
TTSText-to-speech

Inbound Call Flow

inbound call flow diagram

  1. A customer places a call into the Five9 contact center.
  2. The DNIS is matched to the Campaign associated with the inbound IVR script.
  3. After checking the status of Mindful Callback, including the Estimated Wait Time (EWT) and the caller's preference for the callback option, the inbound IVR script may optionally post the required user data to the Mindful Datastore.
  4. The call is then transferred back to the phone number of the relevant Mindful Call Target via the TLS SIP trunk between Five9 and Mindful Callback, along with optional custom SIP headers.

Note that if any of the following conditions occur, the call will queue to the agent skill at normal priority instead of being transferred to Mindful Callback:

  • The Mindful Callback availability check fails 
  • The EWT is below the configured threshold 
  • The caller declines the callback option 
  • There is another error in the IVR script, such as a query-module or function failure.
NOTE
This section illustrates the process of requesting a callback through an inbound call into Mindful Callback. However, callbacks can also be requested using the Mindful Scheduler APIs, with associated user data sent to the Mindful Datastore via the Datastore API. Regardless of the method used to create the callback, the logic of the callback IVR script will remain the same.

Return-call (Callback) Call Flow

callback call flow diagram

  1. Mindful initiates a call to the customer's callback number. When the customer answers, they can press DTMF 1 to confirm their desire to speak to an agent.
  2. Mindful establishes a call to the contact center number for callbacks through the TLS trunk between Mindful Callback and Five9 VCC.
  3. The DNIS of the agent leg is matched to the Campaign associated with the Callback IVR script.
  4. The Callback IVR script optionally retrieves any custom SIP headers and/or retrieves user data from the Mindful Datastore using a query module, with the caller's ANI passed in as the search key.
  5. The call is queued to the agent skill at a higher priority than inbound calls.
NOTE
This section illustrates a customer-first call flow. Mindful Callback also supports an agent-first call flow, where the agent leg is initiated first. The configuration and IVR scripts remain the same regardless of the method used.

Step 1: Mindful Configuration

Before your ACD can send inbound calls to Mindful, there are a few items that must be configured on the Mindful side:

  • At least one Call Target to register and dial callbacks
  • One Scheduler Widget for each Call Target used in the integration
  • A Data Set Template in Mindful Datastore (if you intend to use Datastore to store custom user data and context)

Call Target configuration

There are a few settings in Callback that must be adjusted to integrate with your ACD.

Registration

Quick access: Callback > Call Targets > Your Call Target > General tab > Registration

  • Offer ASAP Callback: Select this checkbox to offer callbacks to be returned as soon as possible.
  • Offer Scheduled Callback: Select one or both of these checkboxes (Voice and/or Widget/API) if you wish to offer callback scheduling for specific dates and times.

Contact Center

Quick access: Voice > Call Targets > Your Call Target > General tab > Contact Center

  1. Callback Telephony Type: Select SIP.
  2. Callback Number: This will be configured in a later step.

Callback Strategy

Quick access: Voice > Call Targets > Your Call Target > General tab > Callback Strategy

Most of the Callback Strategy settings are not relevant to the integration, and they can be set however you would like. However, there is one notable exception when using the Customer First Callback Strategy.

When using Customer First, enable Wait for live Agent. This will prompt agents to press a digit to accept a callback, which provides an Agent Answer event to Mindful. The Agent Answer events assist in calculating an accurate Estimated Callback Time (ECBT).

screenshot of the wait for live agent setting

Phone Numbers

Quick access: Configuration > Phone Numbers

On the Phone Numbers page, provision as many SIP numbers as needed and assign a number to each Call Target in your Organization. This is the number to use when configuring the SIP endpoint to which to send inbound calls for callback treatment.

Scheduler Widget configuration

Each Call Target used in the integration will require a Scheduler Widget. These Widgets will provide API endpoints that will allow your ACD to check the status of a Call Target before forwarding an inbound call to Mindful. Important points for the Widgets used in this integration are listed below:

  • Template: Select any Scheduler Template. Templates will not be used since this Widget will only be accessed via API, but Mindful Callback requires a Template to be assigned.
  • Call Target: Select the appropriate Call Target. The ACD will check the status of this Call Target (via the Widget) to ensure it is ready to register callbacks before transferring inbound calls to Mindful.

For complete instructions on creating Widgets, see Getting Started with Scheduler Widgets.

Datastore configuration

Mindful Datastore allows you to store user data to maintain call context at critical points in an interaction. If you intend to use Datastore, you will need to perform the next few steps within the Datastore user interface.

A Data Set Template contains a collection of Data Keys that allows the Mindful Datastore to store customer data during the callback request process. This collection includes:

  • The set's name and description
  • How long you want to retain collected data submitted with this Data Set
  • What information you want the set to collect (through configuration of Data Keys)
  • The API token that is used to associate data submitted via POST requests and return information via GET requests

The Mindful Solution Delivery team can assist with setting up a Data Set Template, as well as a unique authentication token. To create one on your own, use the steps below.

Quick access: Datastore > Data Set Templates

  1. On the Data Set Templates page, click Add Data Set Template. This takes you to the New Data Set Template page.

screenshot of the data set templates page

screenshot of the new data set template page

  1. Name: Enter a name that will be recognizable to others in your organization.
  2. Description: Enter a description for the benefit of other Administrators.
  3. Data Retention Period (Hours): Manually enter or use the +/- buttons to customize your Data Retention Period. You can retain data for 1 hour, or for up to 48 hours.
  4. API Token: The system automatically generates your API Token.
IMPORTANT
If your API Token is already plugged into your routing logic, regenerating the token here will break that link. To re-establish the link, update your host with the new API Token. Contact Mindful Support for assistance.
  1. Template Data Keys: You can select from existing Data Keys in your system or add new keys. The selected keys will filter out any submitted data that does not correspond to one of the configured keys, and will only retain submitted data that matches the configured keys.

Add a Data Key

Click Add Template Data Key. This opens the New Template Data Key modal window.

  1. Click in the Manually Enter Data Keys field. 
    1. If your Mindful Datastore instance contains existing Data Keys, select one from the dropdown list that appears.
    2. If not, type the name of a new Data Key here.
  2. When finished, click Add.

Your key now appears in the Template Data Keys list.

EXAMPLE
In our example integration, we set up the following Data Keys for callbacks:
example data keys
  • FirstName
  • LastName
  • AccNum
  • CallId

You can configure Data Keys in the same way for any user data that you need to maintain in your environment.


Step 2: Configure Five9

In this section, you will learn how to customize your Five9 environment to leverage the power of the Mindful integration. The following key areas will be covered:

  • Configure a secure SIP trunk: Learn how to establish a secure connection between Five9 and Mindful using a SIP trunk. This ensures reliable and encrypted communication for your inbound and outbound calls.
  • Modify the inbound IVR script in VCC Administrator: By making the necessary modifications, you can seamlessly incorporate callback options for callers who may decline the initial offer.
  • Create the return-call IVR script in VCC Administrator: This script enables efficient handling of callback requests, ensuring smooth transitions between the inbound and callback stages.

Configure a Secure SIP Trunk

You will need a TLS (secure) SIP trunk between Five9 and Mindful. It is recommended to route voice call traffic between Five9 domains and Mindful Callback through this SIP trunk.

IMPORTANT

To ensure calls are directed over the SIP trunk, inform your Five9 project team to utilize the TLS SIP Trunk for all calls to Mindful Callback. The Mindful Solution Delivery team will provide a range of numbers associated with your Mindful account. Share this number range with the Five9 project team to ensure calls to those numbers are routed to Mindful Callback via the TLS SIP Trunk.

After the project concludes, if additional numbers need to be added to route calls through the SIP trunk, follow the process outlined by Five9 below:

Inbound to Five9 (from Mindful):

  1. Email cases@five9.com to request that the provided numbers be routed via SIP inbound to Five9 and provisioned to this domain. Include the following information in your email:
    1. Account number
    2. Account name
    3. Carrier group. 
  2. Once the numbers are added to the domain, your VCC Admin must assign them to a running campaign or a Five9 agent contact for the desired call routing.

Outbound (from Five9 to Mindful Callback):

  1. Email cases@five9.com and inform them that numbers have been added at the Mindful end of your SIP path. Request Five9 to update DCR with the provided number(s) to ensure they use SIP to route outbound calls.
  2. Provision the numbers at the Mindful end to be routed once received via SIP from Five9.

Modify the Inbound IVR Script

The inbound IVR script used to process inbound calls and queue them to an agent/skill group will need a few modifications. You'll need to add functionality for the following steps:

  • Fetch the EWT and turn it into a phrase to play back to callers
  • Check the EWT to make sure it is above a defined threshold before offering a callback
  • Check Mindful Callback status to ensure it is available and ready to process requests
  • Play the EWT phrase and offer a callback
  • (Optional) Post data to the Mindful Datastore
  • Transfer to Mindful Callback with optional SIP headers

example inbound ivr script

Create the EWT Phrase Function

When utilizing the Estimated Wait Time step in the Inbound IVR script, the EWT is provided in seconds. To convert the EWT into a phrase that can be played back using TTS (such as "Current Wait Time is 15 minutes" for an EWT value of 900 seconds), a function needs to be created in the inbound IVR Script within Five9 VCC Administrator.

To create the function, follow these steps:

  1. Open the inbound IVR script in Five9 VCC Administrator.
  2. Select Script and then Functions from the menu to open the Functions window.

screenshot of a list of functions

  1. Click Add to create a new function.

example convert E.W.T. function

  1. Provide a name for the function, such as convertEWT. Set the type to STRING, as the output will be a string containing the EWT phrase. Add a single function argument named EWT with the type set to Integer, as the input will be the EWT in seconds.
  2. For the JavaScript code, you can use the following sample code as a template. Paste it directly into the "Function implementation (JavaScript)" section. Note that when copying and pasting code between applications, the formatting or syntax may change, so it's important to review the code for any formatting or syntax errors after pasting it into the function.
  {

    var oldestCallWaiting = EWT;
    var waitTime = "";

    if(oldestCallWaiting<60) {

        waitTime = "Current wait time is less than 1 minute."

    } else if(oldestCallWaiting>7200) {
 
	waitTime = "Current wait time may be more than 2 hours."

    } else {

        var hours = Math.floor(oldestCallWaiting/3600);
        var minutes = Math.floor((oldestCallWaiting-(hours * 3600))/60);
        var seconds = oldestCallWaiting - (hours*3600) - (minutes*60);
        var hoursPhrase = "";
        var minutesPhrase = "";

        if(seconds > 0) {
            minutes = minutes + 1;
            if(minutes == 60) {
                hours = hours + 1;
                minutes = 0;
            }
        }

        if(hours == 1) {
            hoursPhrase = "1 hour";
        } else {
            if(hours > 0) {
                hoursPhrase = hours + ' hours';
            }
        }

        if(minutes == 1) {
            minutesPhrase = "1 minute";
        } else {
            if(minutes > 0) {
                minutesPhrase = minutes + ' minutes';
            }
        }

        waitTime = 'Current wait time is approximately '+ hoursPhrase + ' ' + minutesPhrase;

    }

    return waitTime;

};

In the sample code provided above, you can customize the actual phrasing within the lines that set the waitTime variable. There are three lines that handle this:

  • One line sets the minimum announced time. For example, if EWT is less than 120 (two minutes), then waitTime is set to "Current wait time is less than two minutes."
  • Another line sets the maximum announced time. For example, if EWT is greater than 7200 (two hours), then waitTime is set to "Current wait time is more than two hours."
  • A third line sets the announced EWT if it falls between the minimum and maximum values. For example, if EWT is 5400 seconds, then waitTime is set to "Current wait time is approximately one hour, 30 minutes."

Use the test button to ensure the function returns the expected output values based on different inputs. Click OK to save the new function, then again to close the Functions window.

Add Custom Variables

Our example inbound IVR script uses custom variables created directly within the script. You can add custom variables within the IVR Script editor at Script > Variables.  Below is a list of the variables referenced in this section, which we will define along the way:

example list of variables

setVars (Set Variable Module)

The setVars module allows you to assign variables containing data that will be sent to Mindful Callback. This data can be retrieved in the Callback IVR script either by posting it to the Mindful Datastore or by setting it into custom SIP headers included in the SIP INVITE during the transfer of the inbound call to Mindful Callback.

One useful scenario for transferring data between the inbound call and the callback is when using a single Callback IVR script and DNIS for all call types. In the example screenshot below, the skillName variable is set. This variable can be sent to Mindful Callback when the caller is transferred. When the customer is called back and transferred to the queue, the callback script will receive the skillName variable and can target it in the Skill Transfer module.

example setvars module

If you choose to use the Mindful Datastore, the caller's ANI will be used as the index key. It's important to note that Mindful Callback and Mindful Datastore use national numbers (such as 11 digits for North America), while Five9 VCC uses 10-digit numbers. To accommodate this, concatenate the number with the national prefix and store the value in a separate variable, referred to as callANI.

Here's an example of the ANI concatenation process:

example of ani concatenation

getEWT (System Info Module)

Next, you'll need a System Info module to retrieve the Estimated Wait Time in seconds from the Skill Transfer module specified in the Lookup Condition field. The returned parameter is assigned to an Integer variable (in this example, named EWT).

get E.W.T. module

checkEWT (Case Module)

Use a Case Module to check the EWT value returned by the previous System Info module. If the EWT exceeds the configured threshold (120 seconds in this example), continue with the Mindful Callback logic. If the EWT does not exceed this threshold, do not present the caller with the callback offer and instead queue them to skill.

check E.W.T. module

setEWTPhrase (Set Variable Module)

Set a string variable with the EWT phrase to speak to the caller in the Set Variables module. Pass the EWT (seconds) into the Function created earlier, which will return the phrase.

getMindfulStatus (Query Module)

Use the Mindful Callback API in the Query module to retrieve the status of the Mindful Call Target. To retrieve Call Target status, use the Get Widget Status API endpoint for a Scheduler widget assigned to the Call Target. You can obtain the endpoint URLs from the Mindful UI at Scheduler > Widgets > API Endpoints. For more information, see the Check Widget Status documentation.

In the General tab, enter the API endpoint URL into the Base URL path field. Set the Method to GET.get mindful status query module

For the Response tab configuration, add a new response entry using the Add button, then configure it as follows:query module properties

  • HTTP status code: 200 (input as 200 to 200 or 200 to 299).
  • Select Function (not Regular Expression Based).
  • In the variable section, choose the KVList variable to populate with the results of the Mindful Callback status request (such as the mindfulStatus KVList variable as shown in the variables list in this guide).
  • Under Function, select the built-in function TOKVLIST(STRING), then click OK to save the Parsing Parameters. 
  • Click Save to save and close the Query Module.

parsing properties

setWidgetState (Set Variable Module)

Retrieve the essential data from the Mindful Callback status API request using a Set Variable module. Among the various pieces of data returned by the API, the status of the Call Target is the only required information. This status is found in a parameter called widget_state. To isolate this parameter, use a Set Variable module to extract the widget_state value from the KVList used in the Responses section of the previous Query Module (mindfulStatus). Assign this value to a string variable named something like widgetState.example set widget state module

Here is an example of the assignment in the Set Variable module, using the built-in GET(KVLIST,STRING) function:

widgetState = GET(mindfulStatus, "widget_state")

This function extracts the widget_state value from the mindfulStatus KVList variable and assigns it to the widgetState variable.

example widget state variable assignment

checkWidgetState (Case Module)

Ensure that Mindful Callback and the corresponding Call Target are in a suitable state to register callbacks by examining the value of the widgetState variable. For this, you can use a Case Module.

example check widget state moduleThere are two valid values for the widget_state parameter:

  • offer_callback indicates that the system can offer both ASAP and scheduled callbacks.
  • offer_asap_callback indicates that the system can offer ASAP callbacks only.

If the widgetState variable contains either of these values, it signifies that the caller can be presented with the option for a callback. In such cases, both output branches associated with these values will lead to the offerCallback Menu module. If the widgetState variable holds any other value, or no value at all, it implies that there may be an issue with the Call Target or a problem retrieving the status. In these instances, the caller will simply queue to skill.

offerCallback (Menu Module)

In this menu module, the caller will first hear the EWT phrase and then be presented with the choice to either receive a callback or wait for the next available agent.

The configuration takes place in the General tab, where the choices and their corresponding actions are set up based on the DTMF digits provided by callers. These actions are linked to branches defined in the Branches tab.

Two branches are configured: Callback and Queue, with a default No Match branch in case of no matching input.

In the prompts tab, the EWT phrase and callback offer are played to the caller. To add the prompts, click Add and follow the instructions below:

example menu module properties

For the EWT phrase, use TTS prompts. Configure the prompt to play the EWT phrase stored in the ewtPhrase variable. Enable the Interruptible setting to allow callers to provide input without listening to the entire prompt set.

example E.W.T. phrase T.T.S. builderexample E.W.T. phrase T.T.S. builder

For the callback offer, create another set of TTS prompts. Customize the prompt to convey the callback offer, like so:

example callback offer T.T.S. builder

Once all the prompts are added and configured, click OK to save the module configuration.

(Optional) setSIPHeaders (Set Variable Module)

To facilitate data exchange between Five9 VCC and Mindful using custom SIP headers, you can use a Set Variable module. Passing SIP headers serves as an alternative to the Mindful Datastore. In this example, the KVList variable toMindful is populated with three custom SIP headers (one required, two custom).

example of three sip headers

  • Required header: X-Mindful-Routing-Token. This header plays a vital role for the Mindful Callback SIP Router. It ensures the validation and accurate routing of the SIP request from Five9 to Mindful.
  • Custom headers: The example above shows two custom headers used to pass specific user data. One contains the skill name and another contains the Five9 Call ID.

To assign values to the KVList:

  1. Click Add to create a new variable assignment.
  2. Use the PUT(KVLIST, STRING, STRING) function, as demonstrated in this example.

example of the assignment window for a sip header

By implementing this setup, you can establish seamless communication and data transmission between Five9 VCC and Mindful Callback, leveraging the power of custom SIP headers. In this assignment, the variable dropdown is not critical, but a variable must be selected. The built-in __BUFFER __ variable can be chosen for this purpose.

  1. Select Function under Assigned Value.
  2. Use the PUT(KVLIST,STRING,STRING) function. Under function arguments, there are three entries:
    1. toMindful (type Variable): This specifies the KVList to store the custom SIP header.
    2. X-Mindful-Routing-Token (type Constant): This is the name of the custom SIP header. It is advisable to use the "X-" prefix when adding custom SIP headers.
    3. Call.Call_id (type Variable): This represents the value of the custom SIP header. In this example, the X-Mindful-Routing-Token SIP header is being populated with the Mindful Callback routing token provided by the Mindful Solution Delivery team.

By following these steps, you can successfully assign the desired values to the KVList variable, utilizing the PUT(KVLIST,STRING,STRING) function and incorporating the custom SIP header for seamless communication between Five9 VCC and Mindful Callback.

(Optional) dsPost (Query Module)

NOTES
  • This step is an alternative to passing custom user data in SIP headers.
  • Even when utilizing the Mindful Datastore for data transfer between the inbound call and the callback, the Mindful Routing Token must still be passed using a custom SIP header as described in the previous step. 

To transfer user data between Five9 and Mindful, you can utilize the Mindful Datastore rather than SIP headers. This method is suitable when dealing with a substantial amount of data, preventing potential issues that may arise from an excessive number of custom headers in the SIP packets.

To send data to the Mindful Datastore, follow these steps:

  1. Use a Query Module and provide it with a name (such as dsPost).
  2. Enter the Mindful Datastore URL.
  3. Set the Method to POST.

screenshot of the D.S. post module

On the Request tab:

  1. Add a new HTTP header named Authorization and include the Mindful Datastore authorization token, including the "Bearer" string. Your Mindful Solution Delivery team can provide you with this authentication token.
  2. In the body section, select raw and set the Content type to JSON (application/json). This will generate a new HTTP header in the top section.

example request tab of the D.S. post module

EXAMPLE
The body should start with {"customer_contact_number": followed by the ANI variable “&&callANI&&”. The data_values section should contain the data corresponding to the keys in your Mindful Data Set Template. For example, if your template includes the keys FirstName, LastName, AccNum, CallIdand SkillName, the complete text should be:
{"customer_contact_number":"&&callANI&&","data_values":{"FirstName":"&&Contact.first_name&&","LastName":"&&Contact.last_name&&","AccNum":"&&Contact.acc_num&&","CallId":"&&Call.call_id&&","SkillName":"&&skillName&&"}}
Ensure that the format remains the same, but with the appropriate data items inside the data_values section. Each data value should consist of the Mindful Datastore key name (such as FirstName) and the variable that contains the corresponding data (such as &&Contact.first_name&&).

On the Response tab, add a single entry for HTTP status code 200. You do not need to add anything other than the HTTP code (to/from 200).  

example D.S. post module responses tab

Save the Query module when finished.

xferMindful (3rd Party Transfer Module)

To transfer the call to Mindful Callback, you'll need to use the Transfer module and provide the number assigned to the relevant Call Target in Mindful Callback. It's important to note that the numbers used for transferring calls to Mindful Callback should be registered with Five9 to utilize the TLS SIP Trunk for the transfer. Refer to the section "Configure a Secure SIP Trunk" for more information on setting up the SIP trunk.

Follow these steps to enable the transfer of the Mindful Routing Token SIP header (along with any optional custom SIP headers):

  1. Select the Return After 3rd Party Call checkbox.
  2. Select the Send Data to 3rd Party checkbox.
  3. In the dropdown menu next to the checkbox, choose the KVList variable that contains the custom SIP headers. In this case, it would be the toMindful variable mentioned earlier in this guide.

example transfer to mindful moduleSave the configuration of the 3rd Party Transfer Module to finalize the setup.

queueToSkill (Skill Transfer Module)

Upon reaching the Third Party Transfer module, there are two possible exits:

diagram of two possible exits from the inbound script

If the transfer to Mindful Callback is successful, the call will conclude after the caller completes the callback registration. In cases where the call cannot be transferred to Mindful Callback, such as when:

  • The EWT falls below the configured threshold,
  • The Mindful Call Target is unable to register callbacks, or
  • The caller declines the callback offer,

Issues may arise within the flow, resulting in a failed transfer to Mindful Callback.

In such instances, the call should be directed to queue for an agent skill. The call's priority in this scenario should be set as the standard priority for an inbound call to the respective skill, while being lower than the priority assigned to Mindful Callback return calls.

example of call priority assignment

That's it for the inbound IVR script! With these modules in place, you can now successfully test an offer threshold, announce the EWT, offer callbacks to customers in the IVR, and transfer calls to Mindful to register a callback. In the next section, we will detail the required modules for the other side of the interaction--the returned callback.


Create a Callback IVR Script

The return-call (callback) IVR script is typically a new script created to queue return calls from Mindful to an agent/skill group. The key functionality is to:

  • (Optional) Retrieve any inbound call data via custom SIP headers from Mindful Callback.
  • (Optional) Get inbound call data from the Mindful Datastore.
  • Queue to the agent skill at a priority higher than inbound calls for the same skill.

call return ivr script diagram

Set Variables

In this section, we will discuss the custom variables used in this sample callback IVR Script. To add custom variables, follow these steps:

  1. Open the IVR Script editor.
  2. Select the Script menu.
  3. Click Variables to access the variable management section.

Now, let's take a look at the list of variables referenced in this script.

example variables for the return call script

(Optional) getSIPHeaders (Set Variable Module)

In this section, we will focus on the retrieval of custom SIP headers from Mindful Callback using the Set Variable module. These custom SIP headers are sent to Mindful Callback during the inbound call transfer from the Inbound IVR script. Let's take a look at an example of how this is done using a KVList variable called mindfulSIPHeaders and the TOKVLIST function:

example get sip headers module

  1. Assign the mindfulSIPHeaders KVList as the variable to populate.
  2. Use the TOKVLIST(STRING) function as the assigned value.

The function argument is a variable called UUI-XHeaders, which is a Five9 built-in variable responsible for retrieving any custom headers starting with the X- prefix.

example SIP header assignment

(Optional) setANI (Set Variable Module)

If you plan to use the Mindful Datastore to transfer data between the inbound call and the callback, you will need to include this optional Set Variable module. The purpose of this module is to accommodate the different phone number formats used by Mindful Datastore and Five9 IVR scripts.

example set variable module

This module populates a string variable called callANI with the Five9 call ANI concatenated to the national prefix. The national prefix includes the necessary digits (such as 1 for North America) to ensure compatibility with Mindful Datastore's phone number format.

This step is crucial because Five9 IVR scripts typically use numbers without the national code (such as a 10-digit number in North America) while Mindful Datastore requires the full number with the national prefix (which would require an 11-digit number in North America).

(Optional) dsGet (Query Module)

If you intend to utilize the Mindful Datastore for transferring data between the inbound call and the callback, you will need to include this Query module, configured as follows.

example D.S. get module

  • General Tab: Provide a name for the module and enter the URL for the GET method specific to your Mindful Datastore integration. The URL may differ from the example provided, so it's essential to verify it on the Data Set API page (Datastore > Data Set Templates > Data Set API) of the Mindful platform. The URL should include a parameter named customer_contact_number, which will be assigned the value of the ANI variable set in the previous Set Variable module. 
  • Method: Set the method to GET.
  • Request Tab: Configure the Request tab as you see below.

example D.S. get request tab

  • HTTP Headers: Add two HTTP headers: 
    • The first header should contain the Authorization token from the relevant Mindful Data Set Template. This token should be the same token (including 'Bearer ') used in the Datastore Post query module in the inbound IVR Script. 
    • The second header should have the name Content-type and the value application/json.
  • Responses Tab:  

example D.S. get responses tab

  • Parsing the Response: The response should be parsed into a Function. Choose a valid KVList variable name, such as DS_DataValues, and set the Function to TOKVLIST(STRING). This will store all the data from the Datastore lookup in the KVList variable, ready to be used in the IVR Script for routing, screen-pop, or any other use.

example parsing parameters

Once you have configured the General, Request, and Responses tabs, click Save.

(Optional) lookupContactRecord (Lookup Contact Record module)

You can use this module to search the local contact list based on the caller's ANI. If a matching contact is found, you can add any additional contact or custom data from the data passed in SIP headers or the Mindful Datastore to that contact. This allows you to enrich the contact's information with relevant data if it already exists in the local contact list.

example lookup contact record module

(Optional) setContactVars (Set Variables Module)

This Set Variables module is used to populate contact and call information based on the data received from Mindful Callback during the inbound call. The data includes contact information, which can be written to the local Contact record, as well as call information such as the inbound Call ID and the skill name to queue the callback to.

example variable list

Here is an example of how to assign the inboundCallId string variable with the value of the X-five9callid SIP header retrieved in the getSIPHeaders module:

example variable assignmentexample variable assignment

  • Assign the value of the X-five9callid SIP header to the inboundCallId variable using the GET(KVLIST,STRING) function, extracting the value from the mindfulSIPHeaders KVList variable.
  • Similarly, the Contact.first_name contact variable can be populated with a data value from the Mindful Datastore.
  • Assign the value of the FirstName data field (as an example) from the DS_DataValues KVList variable to the Contact.first_name contact variable using the GET(KVLIST,STRING) function.

These assignments allow you to capture and utilize relevant information for further processing in the IVR script. You can capture any additional information you need in this way.

(Optional) contactUpdate (Contact Update Module)

This module is responsible for writing the updated contact record data, such as Contact.first_name, into the local contact record. This step ensures that the contact information is available for display on the agent's desktop or any other relevant systems.

example contact update module

By executing this module, the modified contact data will be saved and synchronized with the local contact record. This allows agents to access up-to-date contact information during interactions, enhancing the overall customer experience and facilitating efficient communication.

queueToSkill (Skill Transfer Module)

This module leverages the skillName variable, which was populated earlier using data passed to Mindful Callback during the inbound call. The skillName variable is crucial in determining the appropriate skill to target for each callback.

skillname variable transfer

It is important to note that callbacks should be queued to the skill at a higher priority than any inbound calls for the same skill. This priority setting ensures that customers who requested a callback are prioritized and connected with the next available agent promptly.

example of priority assignment

In the example above, a priority value of 20 is assigned to the callback, while inbound calls for the same skill have a priority of 10. This prioritization scheme ensures efficient handling of callbacks and provides a seamless experience for both customers and agents.

That's it for the return-call IVR script, and this completes the basic integration of Five9 and Mindful! The final section below presents optional configuration for Second Chance Callback.


Step 3: (Optional) Configure Second Chance Callback

Second Chance Callback offers callers the opportunity to receive a callback after they initially decline the offer in the inbound IVR script. This option is presented while the call is in the queue, as part of the announcements played during the wait. 

IMPORTANT
  • When a caller accepts the second chance callback offer and leaves the queue, it may result in an Abandon statistic for that call. This should be taken into account when generating inbound call reports.
  • The second chance callback IVR script logic ensures that calls exiting the Second Chance Transfer to ACD Skill module due to reaching the Max Queue Time will be transferred to Mindful Callback. To prevent this, it is recommended to set the Max Queue Time to cover contact center queue durations and enable it when agents are unavailable or not logged in.
  • If a caller has accepted a callback offer, whether the initial callback offer or a second chance offer, and the transfer fails, the caller should not be offered another callback. This is reflected in the IVR script logic outlined below.

The diagram below assumes that the inbound IVR script logic is already implemented. This diagram begins at the point where the caller is initially offered a callback.

second chance callback ivr script diagram

NOTES
  • A separate Skill Transfer Module should be included for queueing to a skill with Second Chance Callback only for calls where the caller has declined the initial callback offer.
  • For any other scenarios where the caller is not being transferred to Mindful Callback, such as low Estimated Wait Time (EWT), an invalid response from the Mindful status check, script errors, or transfer errors, the call should be queued to skill using a Skill Transfer Module without the Second Chance offer.
  • Ensure that the appropriate Skill Transfer Modules are used based on the caller's response to the initial callback offer and the specific conditions encountered during the call flow.

Update the Inbound IVR Script for Second Chance Callback

The inbound IVR Script logic must be modified as shown:

I.V.R. script changes for second chance callback

The main change involves the addition of a new Skill Transfer module (named 2CC_skillQueue in this example) that is triggered when the result of the offerCallback Menu module is either Queue or No Match. The output from this new Skill Transfer module is treated as if the caller had accepted the initial offer (the callback output from the offerCallback Menu module).

In the 2CC_skillQueue Skill Transfer module, configure the General tab as follows:

example skill transfer module

Take note of the Termination digit, which is set to 1 in this example. If a caller presses 1 while in the queue, the call will exit the queue and proceed to the next module in the IVR Script.

To provide the second chance callback offer, it should be added to the Announcement tab of the second chance Skill Transfer module.

skill transfer module properties

During the call queueing process, the following sequence is implemented in this example:

  1. The caller will hear hold music for 120 seconds.
  2. After the hold music, a built-in Estimated Wait Time (EWT) announcement will be played.
  3. Following the EWT announcement, the caller will hear a custom Second Chance Callback prompt. For instance, "To receive a callback instead of waiting in line, press 1." This prompt can be added using the Prompts section in Five9, either as a wav file or generated using TTS.

Both announcement lines are enabled and set to loop. In the example, the announcements will repeat every 120 seconds until one of the following conditions is met: 

  • The caller abandons, 
  • The caller is connected with an agent, 
  • The module Max Queue Time expires, or 
  • The caller presses the configured Termination digit. 

If the caller presses the Termination digit, the IVR script can optionally set the SIP headers or data to be posted to the Mindful Datastore and then transfer the call to Mindful Callback.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.