Xema

Call record

The call record is the history of every call: who called, which queue and agent took it, and for how long. The recorder, role simplecdr, writes it. A cluster keeps up to three copies of it, each written by its own recorder on its own node:

Copy Where Set up
Primary the server that holds the database by xema init, always
HA a second server at the same place when you want one
DR a server at a disaster-recovery location when you want one

Every call reaches every copy, so each one is complete from the moment its recorder starts. Each copy is held by one node, and each node holds at most one copy.

The primary

There is nothing to do. xema init sets up the primary on the first server's own database, and the reports read it.

To keep it on a different database server, say so before init:

sudo xema cdr setup --server <host> --user <user>
sudo xema init

The password is asked for rather than typed on the command line.

An HA or DR copy

On the server that will keep the copy, once it has joined the cluster:

  1. Give it a recorder. Skip this if it joined with simplecdr among its roles.

bash sudo xema node role add simplecdr sudo xema component install simplecdr # if `xema component list` shows it is not here sudo xema node apply

  1. Set up the copy. By default the copy is kept on this server's own database:

bash sudo xema cdr setup --role ha # or --role dr

To keep it on another database server, add --server <host> --user <user>. This creates the copy's database and its tables there.

  1. Start recording.

bash sudo xema restart simplecdr

The copy records every call from this moment on. It does not yet hold the calls from before.

Filling it with earlier calls

sudo xema cdr fill

This copies the history the primary already holds into this server's copy. It runs while calls go on. Calls the copy already has are kept rather than copied twice, so it can be stopped and run again. It is a separate step on purpose: a copy that only needs to record from today on never needs it.

By default it reads the primary from the cluster's database server. --from-server and --from-user name another one.

Checking the copies

xema cdr

This shows where this node's copy is kept and which role it has. Below that is a table of every copy in the cluster: the node holding it and how it stands.

It says Meaning
up to date the recorder is keeping up
call events waiting the recorder is behind, or catching up after a restart
nobody reading the recorder on that node is not running
readers are splitting its stream two recorders read one copy's calls, so each keeps half; stop one
no node holds it that copy is not set up

Moving a copy to another server

Each role is held by one node, so the old node lets go of it first. On the node giving it up:

sudo xema cdr setup --role <another role>

Then, on the node taking it:

sudo xema cdr setup --role <the role>
sudo xema restart simplecdr

A copy moved to a new server starts empty. Run xema cdr fill on that server to bring its history across.

Servers moved from V1

A server moved from V1 also holds V1's call history. The move itself does not copy that history, so the move stays short. Once V2 is running and has been checked, carry it into this node's copy:

sudo xema v1cdr migrate

It runs while V2 serves, and it can be stopped and run again. Calls already carried are skipped.

xema upgrade mentions V1 history that has not been carried yet, but it never waits for it.

Checking and restarting the recorder

xema logs simplecdr
sudo xema restart simplecdr                       # on this server
sudo xema node restart simplecdr --node <server>  # on another one

A recorder that is stopped loses nothing: its calls wait in its queue until it starts again.