Skip to content

Database Access

The Database Access component connects a call flow to an external database so you can read or change data while a call is in progress. It runs a SQL (Structured Query Language) operation, saves the result in a variable, and makes that value available to the components that follow it, for example, to look up a caller’s record and then branch on what you find.

You can point the component at any of these database engines:

  • Microsoft SQL
  • PostgreSQL
  • MySQL
  • Oracle

Each execution runs one of three statement kinds:

  • Query: returns one or more rows (a SELECT, for instance).
  • NonQuery: changes data without returning rows (INSERT, UPDATE, DELETE).
  • Scalar: returns a single value, such as a COUNT or SUM.
  1. Drag the Database Access component into your call flow, then click it to open its settings.

    The Database Access block placed on the call flow canvas

  2. Choose your database engine from the Database Type drop-down list.

    Selecting a database engine from the Database Type list

  3. Enter the connection details for that database so the component can reach it.

    Connection and authentication fields for the target database

  4. Set up the SQL operation and how long it may run.

    SettingDescription
    Statement TypeThe kind of SQL operation to run: Query (returns rows, e.g. SELECT), NonQuery (modifies data without returning rows, e.g. INSERT, UPDATE, DELETE), or Scalar (returns a single value, e.g. COUNT, SUM).
    Timeout(s)How many seconds to wait for the statement to finish before giving up.
    Timeout DestinationOptional. Turn this on to route the call somewhere specific when the statement times out. After you finish configuring the component, add the follow-on components to its Default Destination and Timeout Destination branches.
    SQL StatementThe SQL to execute.
  5. Click Confirm in the bottom-right corner.

Every time the component runs, it writes its result into variables. You can read these variables from any expression-aware component, Condition, for example, to decide how the call should proceed.

VariableTypeDescriptionExample
$DatabaseAccess{index}.queryResultObjectThe table returned by a Query statement."demo%40cloudvoice.com"
$DatabaseAccess{index}.nonQueryResultIntegerThe number of rows a NonQuery statement affected.99
$DatabaseAccess{index}.scalarResultStringThe single value a Scalar statement returned."10"

A Database Access component leads to one or two downstream components, two when Timeout Destination is enabled, so you can handle the timeout branch separately. Any of the following can follow it:

ComponentPurpose
PromptPlay an audio file or a text-to-speech message to the caller.
Business HoursRoute the call to different destinations depending on the time of day.
MenuOffer callers a set of options and route them by the DTMF (Dual-Tone Multi-Frequency, the tone a phone keypad key sends) key they press.
User InputCollect DTMF digits from the caller, usually paired with Condition to act on what was entered.
LanguageChange the system prompt language for the rest of the flow.
RecordStart recording once the caller connects to another party, with optional notification prompts, or turn recording off for a call that would otherwise be recorded.
Dial by NumberLet callers dial a number directly to reach their destination.
Dial by NameAn end component that lets callers reach a user by typing the first three letters of their name.
TransferAn end component that sends the caller to a chosen destination, with optional prompts announcing the transfer.
Hang Up CallAn end component that disconnects the call.
ConditionRoute the call based on logical expressions.
LoopRepeat a group of components a set number of times or until a condition is met.
Internal Data OpsRead from and write to the Cloud Voice system’s own database. See Get Extension Presence Status, Set Extension Presence Status, Get Queue Agent, Get Queue Info, Get Agent Status, Set Agent Status, Get System Info, Get System Capacity, Get Extension Info, and Get Company Contact Info.
Email SenderSend an email for real-time notifications, alerts, or user-specific information.
Database AccessRun another SQL operation against a database during the call flow.
HTTP RequestSend an HTTP request to an external server to exchange data with a third-party service.