Step 17. Streaming statistics and call recordings
The system stores information about all calls that occurred. Every call inside the system, regardless of who the subscriber is, is served by the B2BUA role, and one call is served by a single instance of it. The B2BUA role traces the entire workflow of each call. Dozens of CDR events (Call Detail Record) are generated per call. Each event has a large number of context attributes. Here is the list of main CDR events:
-
Incoming call.
-
Routing result in the domain.
-
Dialog initiation.
-
Fork call start.
-
Fork call failure.
-
Fork call success.
-
Fork call cancellation.
-
Incoming call cancellation.
-
Incoming call pickup.
-
Dialog start.
-
Application of the recording rule and storage rule.
-
Hold.
-
Unhold.
-
REFER request forwarding (transfer to a number and transfer with replacement).
-
Binding of the transferring dialog (transfer with replacement).
-
Binding of the replacing transferred dialog (transfer with replacement).
-
Call migration due to media server failure.
-
Dialog end.
-
Dialog failure.
-
Call end.
Each event, at the moment of generation, is sent:
-
to the local cdr log (enabled in the B2B role configuration options);
-
to the Broker role (message queue for system needs);
-
to external subscribers over WebSocket connections (WSSubscr and WebServer roles);
-
to the call context script (master domain, the caller’s working domain).
-
to the external KAFKA broker connected in the master domain.
-
to the CCS module, which prepares aggregated data for the product layer and call center.
-
to the CTI module, which prepares aggregated data for sending to a GRPC connection.
CDR messages can be disabled entirely; this almost halves the server load.
CDR log
The cdr log is a text file associated with a specific date. Each line contains an event and its basic attributes. It is used for quick history analysis by an administrator who has access to the server file system or the monitoring API (for downloading logs). This mode works even when all other modes are not configured or unavailable. Log files are automatically split into 100 MB portions and by date. They are automatically deleted by the system after a short retention period (2 days) or when the number of files in the directory exceeds 20.
Broker, Mixer, RecMover, RecAsr, and CallStore roles
B2B generates the main callevents events. Additional callevents events are also generated by mixer, recmover, and asr.
callevents events are sent to the broker. CallStore takes them from there. It builds a call model, monitors the signaling server and media gateway, and generates fallback events to complete interrupted calls. It fills the master domain model DB with SORM-3 events. Tasks for the mixer are sent to the broker. They are generated by B2B or CallStore. Tasks for recmover are sent to the broker. They are generated by the corresponding mixer that processed the recording. Tasks for asr are sent to the broker. They are generated by recmover.
When completing a task, each of these services generates a callevents event and a task for the next event. callevents is distributed on a general basis to all the destinations mentioned above directly from the generating node.
The recording is mixed if it was made by local services.
Instances of the Mixer role are competing subscribers of the broker to the queue with the "mixer.tasks" pattern, which is filled by instances of the B2B or CallStore roles based on CDR events related to call completion. They sequentially perform:
-
dequeue the next event,
-
find the MG media server that served the call associated with the event,
-
copy files from the MG server to the local disk,
-
audio mixing and packaging into one file using a built-in high-performance application executed at low priority (Nice=12),
-
place the result in the file storage for call recordings,
-
send a packaging-completed event with storage path information as the corresponding callevents event.
-
send a task to recmover to move recordings to the storages of the working domains associated with the call and configured for local recording.
The mixing result is a mono or stereo audio file in MP3, G.711, or G.610 codec; the codec and bitrate are configured in the role options. The target audio (and video) mixing task is resource-intensive. It is easy to put such a load on a site that the amount of traffic to be mixed and packaged exceeds the performance of one server. Therefore, the Mixer role is made redundant and scaled in Active-Active mode. In a heavily loaded system configuration, it is advisable to allocate separate servers for Mixer roles, similar to MG roles.
The file storage for call recordings is an external network disk or S3 storage, whose access point is defined in the storage list. If the file storage becomes unavailable, Mixer continues working and stores results on the local disk. When access to the storage is restored, the files are moved automatically. Therefore, for the Mixer role, in addition to a high-performance processor, free local disk space is important.
The recmover service operates in active-passive mode within a site. It is a broker subscriber and the generator of the callevents.records_moved event. RecMover moves data to storages configured in the working domains: local disk, NFS, or S3.
The operation of the system’s critical communication processes does not depend on the availability and performance of event consumers and databases. However, the event history storage function and related functions depend on them: access to call logs, listening to call recordings, and building reports based on call history.
WSSubscr role
The WSSubscr role contains all WebSocket subscriptions to all event classes. Subscription is performed through the WebSocket API of the WS role. A subscription can only be created for a limited time and is extended. The subscription defines the categories and types of events of interest, as well as a filter by user accounts associated with the event.
For example, an external system can create two subscriptions to callevents events:
-
event types dlg_start and dlg_stop in calls associated with user 102.
-
event types any (all callevents category events) associated with user 102.
As a result, the WSSubscr role notifies the external system about every call of 101 and 102; for calls of 102, the entire series of events is sent, while for calls of 101, only dlg_start and dlg_stop are sent. If a conversation between 101 and 102 occurs, the dlg_start and dlg_stop events are not duplicated.
Subscription is performed within the domain in which the external system is authorized. That is, calls between users of other domains are not sent to the subscriber. However, events for the domain are sent from all sites where the domain is served (although this makes sense only if the domain does not use a product layer that requires a data consistency point).
The event sender contacts WSSubscr for subscriptions and sends events to the web servers serving the discovered and filtered connections.
Call context script
Next to each call on the same site, a call context script can be active, processing all events. This script is created by the master domain administrator. What can the script do? Everything the administrator configured. For example, it can process events itself or initiate context scripts in child domains and then forward events to them. Those, in turn, are created by domain administrators and can, for example, send events to external systems following custom protocols.
A context script can also be configured in a working domain. It receives all callevents events generated in calls initiated by subscribers of the domain (including services).
KAFKA
If there is a need to store all CDR events, it is advisable to configure a connection to an external KAFKA broker in the master domain. Each event is sent directly from the node that generated it to one of the available endpoints.
| Term | Definition |
|---|---|
|
! |
|
! |
|
! |
|
! |
|
! |
|
! |
|
! |
|
! |
|
! |
|
! |
|
! |
-
Next step: Step 18. BLF (Busy Lamp Field)
-
Previous step: Step 16. Calls to external networks