Skip to main content

Call Query Routing (CQR)

Overview

Call Query Routing (CQR) reverses the concept of traditional IVR by moving the decision of how to handle incoming calls from the caller to NethVoice itself. Instead of relying on caller input through an IVR menu, CQR allows NethVoice to query external or internal databases (MySQL or MSSQL) in real-time to obtain information about the caller and route the call accordingly.

By recognizing the caller through their phone number or a customer code, NethVoice can:

  • Query databases for caller-related information
  • Make routing decisions based on the query results
  • Route calls to different destinations based on customer status

This makes CQR a flexible tool that obtains information in real-time and adapts behavior dynamically. As the database information changes, CQR behavior adjusts automatically.

Typical Use Cases

A typical example is using CQR to discriminate whether a caller is a paying customer or not:

  • Paying customers: Route to support queue
  • Outstanding customers: Route to administration
  • Potential customers: Route to sales team

The key requirements for CQR are:

  • Accessible databases from NethVoice
  • Properly configured queries to interrogate the database

Configuration

Prerequisites

For MSSQL database connections, you must first configure the ODBC connection. Refer to the centralized phonebook documentation for ODBC configuration details.

Basic Settings

FieldDescription
NameName of the CQR used by NethVoice in routing destinations
DescriptionDescription of the CQR

Customer Code Resolution

Enable customer code lookup if you want CQR to resolve the customer code from the caller's phone number.

FieldDescription
Use Customer CodeEnable to activate customer code lookup from caller's phone number
DB TypeType of database (MySQL or MSSQL)
DB URLConnection URL (use localhost for NethVoice internal database)
DB NameDatabase name or ODBC DSN name for MSSQL
UsernameDatabase user with query permissions
PasswordDatabase user password
QuerySQL query to retrieve customer code from caller ID; use %CID% placeholder for caller number
Manual Code EntryEnable to request manual customer code if query fails
AnnouncementSystem recording to play when requesting manual code entry
Error AnnouncementSystem recording to play if manual code entry fails
Code LengthExpected length of customer code for validation
Max AttemptsNumber of attempts allowed for manual code entry
Validation QueryQuery to validate manually entered code; use %CODCLI% placeholder for customer code

Customer Code Query Examples

Retrieve customer code from phone number:

SELECT `customer_code` FROM `phonebook` WHERE `caller_id` = '%CID%'

Validate manually entered customer code:

SELECT `customer_code` FROM `phonebook` WHERE `customer_code` = '%CODCLI%'

CQR Options

FieldDescription
AnnouncementMessage played to caller while CQR processes. Duration should match query execution time
DB TypeType of database (MySQL or MSSQL) for main query
DB URLConnection URL for main query
DB NameDatabase name or ODBC DSN name for MSSQL
UsernameDatabase user with query permissions
PasswordDatabase user password
QuerySQL query for routing decision; use %CID% for caller ID or %CUSTOMERCODE% if using customer code lookup
Default DestinationRoute for unmatched conditions or database errors

Query Examples

Query by caller ID:

SELECT `name` FROM `phonebook` WHERE `workphone` = '%CID%'

Query by customer code:

SELECT `name` FROM `phonebook` WHERE `customercode` = '%CUSTOMERCODE%'

Routing Rules

Define conditions and their corresponding destinations. Each rule is evaluated in order based on position.

FieldDescription
PositionOrder in which NethVoice evaluates the result
ConditionPossible query result value (one per line)
DestinationRoute destination if query result matches condition
DeleteRemove this routing rule

How It Works

  1. Incoming call: Caller initiates call to NethVoice
  2. Caller identification: Extract caller phone number
  3. Customer code lookup (optional): If enabled, query database to resolve customer code from caller ID
  4. Manual code entry (if needed): If customer code lookup fails and manual entry is enabled, request code from caller
  5. Main query: Query database using caller ID or customer code
  6. Route decision: Evaluate query result against defined conditions
  7. Call routing: Route call to corresponding destination or default destination if no match

Best Practices

  • Database performance: Ensure database queries are optimized and responsive
  • Announcement duration: Set announcement duration longer than typical query execution time
  • Query placeholders: Always use %CID% or %CUSTOMERCODE% placeholders; never hardcode values
  • Error handling: Always define a default destination for error scenarios
  • Testing: Test database connectivity and query accuracy before deploying to production
  • ODBC configuration: For MSSQL, verify ODBC configuration is properly set up on the NethVoice host
NethVoice 8.0