Skip to main content
When a call ends, AppBridge seals its call record. With analytics on, it also writes one row of metrics for that call to your ClickHouse. Fonoster doesn’t run ClickHouse for you: bring your own server or a ClickHouse Cloud service.

Before you begin

You need:
  • Fonoster installed with Docker Compose. See Install with Docker Compose.
  • A ClickHouse server AppBridge container can reach over HTTP or HTTPS (port 8123 or 8443). localhost inside the container is the container itself, not your machine.
  • A ClickHouse user that can run CREATE DATABASE, CREATE TABLE, INSERT, DELETE and SELECT on the database you pick.

Turn on analytics

1

Add the ClickHouse login to .env

In your fonoster folder, add the user and password to .env:
Compose passes these two values to AppBridge container only. Add them before the next step: init stops if config/appbridge.example.yaml names a value that .env doesn’t set.
2

Uncomment the analytics block

Open config/appbridge.example.yaml. Under callRecord, uncomment analytics and set the URL of your ClickHouse HTTP interface:
Edit the example, not config/appbridge.yaml: init writes that file again from the example.
3

Write the config and restart AppBridge

Write config/appbridge.yaml, check it, and recreate AppBridge:
You don’t create the table yourself. The first time AppBridge writes a row, it creates the database and this table:
There is one row per call. When a record changes, its row is replaced (the newest loaded_at wins). When a call is erased, its row is deleted. The metrics come from the redacted copy of the record, so no transcript text reaches ClickHouse.

Check that rows arrive

Make a call and hang up. Then, in ClickHouse, list the latest calls. FINAL returns one row per call:
If no row shows up, look for AppBridge’s warning. A failed load never affects the call or its record:

Load calls made before analytics was on

AppBridge only loads records it seals after you turn analytics on. To fill the table from every record already stored, run analytics rebuild inside AppBridge container. It empties the table first, then loads each sealed record from the bundle’s MinIO bucket:
It prints rebuilt fonoster.call_metrics from <n> records. Add --keep to add rows without emptying the table first. The ClickHouse login comes from the container’s CLICKHOUSE_USER and CLICKHOUSE_PASSWORD, never from the command line.