AiPBX can connect to external SQL databases and HTTP endpoints to look up caller information in real time during an incoming call and branch the call flow accordingly.
Store encrypted credentials to query external SQL databases from IVR call flows or custom plugins.
SET SESSION TRANSACTION READ ONLYSET SESSION CHARACTERISTICS AS TRANSACTION READ ONLYSET statement_timeout = 2500 on PostgreSQL; SET SESSION max_statement_time = 2.5 on MariaDB or
max_execution_time = 2500 on MySQL).SELECT or WITH ... SELECT queries are allowed.INTO OUTFILE, INTO DUMPFILE, or LOAD_FILE are
refused.| Setting | Description | Range / Options |
|---|---|---|
| Connection Name | System label | 1–100 characters |
| Driver | Database system | MySQL / MariaDB, PostgreSQL |
| Host / IP Address | Server hostname or IP address | Letters, digits, dots, dashes |
| Port | Listening port | 1–65535 (defaults: MySQL 3306, PostgreSQL 5432) |
| Database Name | Name of the database | Letters, digits, _, $, ., - |
| Username | Database user | 1–128 characters |
| Password | Account password | Encrypted on save; leave empty to keep existing |
| Timeout | Connection timeout | 1–10 seconds (default 3 s) |
| Charset | Character encoding | utf8mb4, utf8, latin1, latin5 |
| SSL Mode | TLS connection security | Prefer, Require, Disable |
Click Test Connection on the form or in the connection list to verify network connectivity,
credentials, and latency. The test runs a lightweight SELECT 1 ping query and displays the round-trip
latency in milliseconds.
A database connection that is currently in use by an IVR data step cannot be deleted.
An IVR data step executes a fast data lookup during an active call, stores the retrieved value in an Asterisk channel variable, and routes the call to different destinations depending on the result.
:input (the collected DTMF digits) and/or :caller_id (the caller’s number)
named parameters.GET or POST request to an external endpoint:
{input} and {caller_id} placeholders in the URL, automatically URL-encoded.POST, sends a JSON payload: {"input": "...", "caller_id": "..."}.value or result).127.0.0.1, RFC 1918 private
ranges, link-local, cloud metadata endpoints) are blocked to prevent Server-Side Request Forgery
(SSRF).The returned result is cleaned to prevent dialplan injection: line breaks, control characters, and pipe
symbols (|) are removed, and the value is truncated to at most 64 characters. It is stored in the
chosen channel variable (default IVR_DATA_VAL), accessible downstream in dialplans, queue scripts, or
CRM popups.
Each data step routes the call to one of three destination branches:
Each branch can route to any destination (extension, ring group, queue, another IVR, announcement, or hang up).
A data step currently selected as a destination in any IVR key, inbound route, time condition, or ring group cannot be deleted.
Look up incoming callers in a CRM database and route VIP customers directly to a priority queue:
CRM Read Replica, choose MySQL / MariaDB, enter the replica server host, database
name crm, and read-only credentials.VIP Customer CheckThe caller's numberExternal databaseCRM Read Replica.SELECT tier FROM customers WHERE phone = :caller_id LIMIT 1
CUSTOMER_TIERVIP SupportGeneral SupportGeneral SupportWhen a customer calls, AiPBX checks their number in the CRM. If their record exists, the call is routed instantly to VIP Support, while new numbers fall back to General Support without caller delay.