Order by Phone - Demo CFD Project

Introduction

Combine CFD components to enable easy implementation of a telephone ordering system that can be integrated with a 3CX API compatible CRM. This guide showcases an example project available via the CFD Demo Projects GitHub page.

This usage scenario describes a customer:

  1. Calling an ordering line and is presented with a personalized greeting based on their caller number linked to Salesforce.
  2. Is authenticated via PIN-based on their Salesforce Contact ID.
  3. Gets directed to the ordering process.

Prerequisites

This example application needs these prerequisites:

  1. 3CX PRO Edition PBX v16 Update 4 or later - Pro.
  2. 3CX Call Flow Designer 16.4.26 or later.
  3. Enabled 3CX PBX integration with Salesforce. Follow this guide to set this up.
  4. A MySQL Server to be used for storing customer, item and order information. Download this SQL script to create the database and all the tables required.
  5. An Amazon Web Services account to use Amazon Polly for Text to Speech. Check this guide on how to configure it.

Main

"Order by Phone" Demo CFD Project Main Callflow

This is the entry point of the application. When a call is received, the welcome message is played, and then the caller’s number is checked - if it belongs to a Salesforce contact using the Contact Lookup component.

If the contact is found, a menu is offered to the user, so they can select to:

  • Speak to an operator, i.e. transfer the call to an operator.
  • Start ordering by phone, i.e. authenticate the user via the Authenticate Contact component, before calling the Order Multiple Items component to enable item orders.
  • Check order status, i.e. call the Check Order Status component.

If a contact is not found a suitable prompt is played before transferring the call to an operator.

Contact Look-up

The CRM Lookup component is used to get the contact details in Salesforce, provided that Salesforce integration is already configured in 3CX. It then returns the contact details in variables, i.e. ID, First Name, Last Name, Email.

Authenticate Contact

Authenticate Contact in "Order by Phone" Demo CFD Project

Using the Authentication component in combination with a Database Access component enables validating the PIN entered by the caller against the database.

The database credentials need to be configured in the CFD project. To do this:

  1. Go to the “Project Explorer” and select the project node, i.e. the first node of the tree.
  2. Go to the “Properties” window and click the button on the right of the “Variables” item.

Customize database access variables in 3CX CFD

  1. Change the values for the database server, port, database name, username and password.

When the entered PIN is valid, a success prompt is played and the component returns. Otherwise,a menu is presented to the user, so they can choose to:

  • Contact an operator - transfer the call to an operator.
  • Retry - enter the PIN again.
  • Cancel - end the call.

Check Order Status

Using a Loop component enables checking the order reference number, retrying up to 3 times. Inside the loop:

  1. A User Input component asks the caller for the number.
  2. A Database Access component checks this reference number against the database and:
  • if found, the order status is played back to the user and the call ends.
  • if not found, the try number is incremented, and the loop condition is checked again for another iteration.

Order Multiple Items

Order Multiple Items in "Order by Phone" Demo CFD Project

Executed when the user starts ordering, to:

  1. Create the order in the database and get back the “Order ID”.
  2. A “Loop” component iterates through the item ordering procedure steps:
  1. Initially, the Order Single Item component is called to ask for an Item ID and select the quantity. This component exposes the result in output properties.
  2. Next, it checks the output properties of the previous component to determine if there is an item selected or not. When there is an item selected, it is added to the database, the item counter is incremented, and the item price multiplied by the quantity is added up to the total amount of the order.
  3. Finally, the post item menu offers the user to:
  • Cancel the order - the order status is updated in the database.
  • Add another item - the loop does another iteration.
  • Complete the order:
  • If there are items in the order, the status in the database is set to ready. If the contact has an email address, retrieved from the CRM during the Contact Lookup component, the order details are sent to the user via email using the Send Order By Mail component.
  • If there are no items in the order, the status in the database is set to canceled.

Order Single Item

Order Single Item in "Order by Phone" Demo CFD Project

This process implements these steps:

  1. Requests the 6-digit ID of the item to buy with a “User Input” component.
  2. The entered item ID is checked against the database, and the item details are retrieved (item description, price, available stock). If the database check result is:
  1. No record found - a message is played indicating that the item is invalid, and the component ends.
  2. A record - if the item stock quantity is:
  1. Zero - the caller can choose to get a notification when the item is available via the Item Add Notification component.
  2. More than zero - the item details are played, and the caller can select the order quantity using the Item Change Quantity component.

Item Add Notification

Offers a simple menu so the user can choose to be notified when the item is available. If the user decides to be notified, a record is inserted into the database using a Database Access component.

Item Change Quantity

Asks for the item quantity using a Loop component, retrying as many times as needed until a valid quantity is entered. In the loop:

  1. A User Input component asks for the quantity of items to buy.
  2. When the user enters a quantity, the value is checked against the available stock, and if:
  1. Less than or equal to the available stock - return the selected quantity in an output property, using a zero value to cancel the item.
  2. Greater than the available stock - play a message indicating that stock quantity unavailability, and start another loop iteration.

Send Order By Mail

Uses a Loop component to iterate via the database through all the items in this order to:

  1. Add the corresponding item to a variable that stores the HTML for the mail body.
  2. Retrieve each order item details from the database using a Database Access component.

After iterating through all the order items, the order details are sent to the customer via email, and a relevant message is played back to the caller.

See Also

Last Updated
This document was last updated on 29th April 2021
https://www.3cx.com/docs/cfd-order-by-phone-demo/