Database structure: Difference between revisions

From VoIPmonitor.org
Jump to navigation Jump to search
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
= cdr =
{{DISPLAYTITLE:CDR Database Table Schema}}
*ID - unique primary key
*id_sensor - match id_sensor in voipmonitor.conf or NULL if not set
*calldate - start of the call (counted from first INVITE
*callend - end of the call (counted from the last seen packet)
*duration - callend - calldate in seconds
*connect_duration - callend - time of 200 OK
*progress_time - time of first 18x/2xx response to INVITE request [[https://www.voipmonitor.org/doc/Glossary#Post_Dial_Delay_.28PDD.29 PDD]]
*first_rtp_time - number of seconds since beginning of the call to first rtp packet
*caller - number part of the caller from "From" sip header
*caller_domain - domain part from "From" sip header
*caller_reverse - reversed caller column used to do index searching %search
*callername - number part of the caller from "From" sip header
*callername_reverse - reversed callername used for index searching %search
*called - number part of the called from "To" sip header
*called_domain - domain part from "To" sip header
*called_reverse - reversed called column
*sipcallerip - source IP address from the first INVITE. Use INET_NTOA() to get string
*sipcalledip - destination IP address from the last INVITE.
*whohanged - indication who sent the BYE first
*bye - indication if the call was successfully terminated with BYE - ACK
*lastSIPresponse_id - last SIP response reference to table cdr_sip_response
*lastSIPresponseNum - last SIP response number
*sighup - indication if the call was written during HUP signal sent to sniffer (incomplete CDR)
*dscp - dscp bits


columns starting with a_ represents information for caller RTP stream (RTP sent from caller). Columns starting with b_ represents informatino for called RTP stream (RTP sent from called)
'''This document provides an overview of the most important tables and columns in the VoIPmonitor database schema. It is intended as a reference for administrators, developers, or anyone directly querying the database.'''


columns which ends with multNN where NN is number 10 or 100 or 1000 represents values which has to be divided by NN to get real number.  
The core of the VoIPmonitor database is the `cdr` (Call Detail Record) table, which stores one primary record for each monitored call. Many other tables are linked to `cdr` to store additional, more detailed information.


*ab_index - index of RTP stream. used to get correct graph file
== Understanding Column Naming Conventions ==
*ab_payload - number representing codec type
Before diving into the columns, it's important to understand these common naming patterns:
*ab_saddr - source IP address of the RTP stream  
*'''`a_` prefix:''' Refers to the "A-leg" or the '''caller's''' media stream (RTP sent from the caller).
*ab_received - number of received RTP packets
*'''`b_` prefix:''' Refers to the "B-leg" or the '''callee's''' media stream (RTP sent from the callee).
*ab_lost - number of lost RTP packets detected by holes in sequence numbers according to rfc3550
*'''`_mult10` / `_mult100` / `_mult1000`:''' Indicates that the stored integer value must be '''divided''' by this number to get the real decimal value. For example, a `jitter_mult10` value of `15` represents a real jitter of `1.5`.
*lost - max (a_lost, b_lost)
*ab_ua_id - useragent reference to table cdr_ua
*ab_avgjitter_mult10 - average jitter calculated according to rfc3550
*ab_maxjitter - maximum jitter
*ab_sl1 - ab_sl10 - number of consecutive packet loss. sl1 - number of one packet loss occurences. sl5 - number of 5 consecutive packet loss occurences.  
*ab_d50-300 - number of delay occurences within delay range. d50: 0-50ms, d70: 50-70ms, etc.
*ab_mos_f1_mult10 - MOS score for fixed jitterbuffer 50ms. Divide it by 10 to get real number.
*ab_mos_f2_mult10 - MOS score for fixed jitterbuffer 200ms. Divide it by 10 to get real number.  
*a_mos_adapt_mult10 - MOS score for adaptive jitterbuffer. Divide it by 10 to get real number.
*ab_rtcp_loss - loss from RTCP
*ab_rtcp_maxfr - max fraction loss from RTCP
*ab_rtcp_avgfr_mult10 - average fraction loss - devidie it by 10 to get real number
*ab_rtcp_maxjitter - maximum jitter from RTCP
*a_rtcp_avgjitter_mult10 - average jitter from RTCP
*payload - codec used for this call
*jitter_mult10 - max(a_jitter, b_jitter)
*mos_min_mult10 - minimum jitter from caller or called stream
*a_mos_min_mult10 - minimum caller jitter  
*b_mos_min_mult10 - maximum called jitter
*packet_loss_perc_mult1000 - maximum packet loss from caller or called
*a_packet_loss_perc_mult1000 - maximum packet loss from caller
*b_packet_loss_perc_mult1000 - maximum packet loss from called
*delay_sum - sum of all delays (PDV) from caller or called
*a_delay_sum - sum of all delays (PDV) from caller
*b_delay_sum - sum of all delays (PDV) from called


*delay_avg_mult100 - max average PDV from caller or called
== The `cdr` Table ==
*a_delay_avg_mult100 - average PDV from caller
This is the main table containing the primary information for every call.
*a_delay_avg_mult100 - average PDV from called


*rtcp_avgfr_mult10 - max(a_avgfr, b_avgfr)
=== General Call Information ===
*rtcp_avgjitter_mult10 - max(a_avgjitter, b_avgjitter)
;`ID`
*delay_cnt -
:The unique primary key for the record.
;`id_sensor`
:The ID of the sensor that processed this call, corresponding to `id_sensor` in `voipmonitor.conf`.
;`calldate`
:The start time of the call, typically measured from the first `INVITE` packet.
;`callend`
:The end time of the call, measured from the last packet associated with the call.
;`bye`
:An indicator of how the call was terminated. `1` typically means a normal termination with a `BYE` request.
;`whohanged`
:Indicates which party sent the `BYE` message first (caller or callee).
;`lastSIPresponse_id`
:A reference to the `cdr_sip_response` table, linking to the last final SIP response for the call.


*a_delay_cnt -  
=== Call Timing & Duration ===
*b_delay_cnt -
;`duration`
:The total length of the call in seconds (`callend` - `calldate`).
;`connect_duration`
:The length of the connected portion of the call in seconds, measured from the first `200 OK` to the `callend`.
;`progress_time`
:The time in seconds from the initial `INVITE` to the first provisional response (e.g., `180 Ringing`). This is often referred to as [[Glossary#Post_Dial_Delay_.28PDD.29|Post-Dial Delay (PDD)]].
;`first_rtp_time`
:The time in seconds from the start of the call to the detection of the very first RTP packet.


= cdr_next =
=== Participant Information ===
;`caller` / `called`
:The user part of the number from the `From` and `To` SIP headers, respectively.
;`caller_domain` / `called_domain`
:The domain part from the `From` and `To` SIP headers.
;`caller_reverse` / `called_reverse`
:Reversed versions of the `caller` and `called` fields, used internally for efficient `LIKE '%search'` queries in the database.
;`callername`
:The display name part from the `From` SIP header.
;`sipcallerip` / `sipcalledip`
:The source and destination IP addresses from the SIP signaling. These are stored as integers; use the `INET_NTOA()` or `INET6_NTOA()` SQL function to convert them to a string representation.
;`a_ua_id` / `b_ua_id`
:A reference to the `cdr_ua` table, linking to the User-Agent string of the caller's and callee's device.


contains additional data for CDR. The relation between cdr and cdr_next is 1:1
=== Network Quality Metrics ===
==== Packet Loss ====
;`a_lost` / `b_lost`
:The total number of RTP packets lost, detected by sequence number gaps.
;`lost`
:The higher value between `a_lost` and `b_lost`.
;`packet_loss_perc_mult1000`
:The maximum packet loss percentage from either stream, multiplied by 1000.
;`a_sl1` - `a_sl10` / `b_sl1` - `b_sl10`
:A distribution of consecutive packet loss events. `a_sl1` counts the number of times a single packet was lost, `a_sl5` counts the number of times 5 packets were lost in a row, etc.


*cdr_ID - reference to cdr.ID table
==== Jitter & Delay (PDV) ====
*calldate - same as cdr.calldate. this is used to partition table
;`a_avgjitter_mult10` / `b_avgjitter_mult10`
*fbasename - string from SIP.Call-ID
:The average jitter calculated according to RFC3550, multiplied by 10.
*GeoPosition - string from sip geo tag
;`a_maxjitter` / `b_maxjitter`
*match_header - see match header in sniffer configuration
:The maximum jitter value observed during the call.
;`jitter_mult10`
:The higher `maxjitter` value between the two streams, multiplied by 10.
;`a_d50` - `a_d300` / `b_d50` - `b_d300`
:A distribution of Packet Delay Variation (PDV). `a_d50` counts packets with a delay between 0-50ms, `a_d70` counts packets with a delay between 50-70ms, etc.


= cdr_rtp =
==== MOS (Mean Opinion Score) ====
;`a_mos_f1_mult10` / `b_mos_f1_mult10`
:The calculated [[Glossary#VoIPmonitor.27s_Parametric_MOS|parametric MOS score]] based on a simulated 50ms fixed jitter buffer, multiplied by 10.
;`a_mos_f2_mult10` / `b_mos_f2_mult10`
:MOS score based on a simulated 200ms fixed jitter buffer, multiplied by 10.
;`a_mos_adapt_mult10` / `b_mos_adapt_mult10`
:MOS score based on a simulated adaptive jitter buffer, multiplied by 10.
;`mos_min_mult10`
:The lowest MOS score recorded between the A and B streams, multiplied by 10.


stores rtp streams statistics which are used to show RTP streams in gui sip history
==== RTCP Reported Metrics ====
These metrics are sourced from RTCP reports sent by the endpoints themselves, as opposed to being calculated by the sniffer.
;`a_rtcp_loss` / `b_rtcp_loss`
:Total packets lost as reported by RTCP.
;`a_rtcp_avgfr_mult10` / `b_rtcp_avgfr_mult10`
:Average fraction loss reported by RTCP, multiplied by 10.
;`a_rtcp_avgjitter_mult10` / `b_rtcp_avgjitter_mult10`
:Average jitter reported by RTCP, multiplied by 10.


= cdr_dtmf =
=== Other Information ===
;`dscp`
:Stores the DSCP values from SIP and RTP packets for Quality of Service (QoS) analysis.
;`payload`
:The codec payload type number used during the call.


stores DTMF key presses if enabled in voipmonitor.conf
== Important Related Tables ==


= cdr_proxy =
; `cdr_next`
:A 1-to-1 extension of the `cdr` table that stores additional data to keep the main `cdr` table smaller and faster.
:*'''fbasename:''' A string derived from the SIP `Call-ID`, used to link PCAP files to the CDR.
:*'''match_header:''' Stores the content of a custom header (defined by `matchheader` in `voipmonitor.conf`) used for linking call legs.


stores all SIP proxies which was used to route the call
; `cdr_rtp`
:Stores detailed statistics for each individual RTP stream within a call, used by the GUI to render stream information in the call history view.


= cdr_sip_response =
; `cdr_dtmf`
:Stores detected DTMF key presses (if `dtmf2db` is enabled).


contains sip reposnes which are referenced in cdr table.  
; `cdr_proxy`
:Stores the IP addresses of all SIP proxies that the call traversed.


= cdr_ua =
; `cdr_sip_response`
:A lookup table storing the text of unique SIP responses (e.g., "404 Not Found"). The `cdr` table references this table by ID to save space.


stores user agents which are referenced in cdr table.
; `cdr_ua`
:A lookup table storing the `User-Agent` strings of SIP devices.
 
== AI Summary for RAG ==
'''Summary:''' This document provides a reference for the VoIPmonitor database schema, focusing on the main `cdr` table and its most important related tables. It explains the column naming conventions, such as the `a_` (caller) and `b_` (callee) prefixes for RTP streams and the `_multNN` suffix indicating a value needs to be divided. The `cdr` table columns are logically grouped into categories: General Call Information (ID, calldate), Call Timing (duration, connect_duration, PDD), Participant Information (caller, called, IPs, User-Agents), and detailed Network Quality Metrics. The quality metrics section details columns for Packet Loss (lost counts, distribution), Jitter (average, max, PDV distribution), Mean Opinion Score (MOS), and RTCP-reported statistics. Finally, it briefly describes the purpose of key related tables like `cdr_next` (for Call-ID), `cdr_rtp`, `cdr_dtmf`, `cdr_proxy`, and the lookup tables `cdr_sip_response` and `cdr_ua`.
'''Keywords:''' database, schema, table, column, cdr, cdr_next, cdr_rtp, database schema, sql, mysql, mariadb, calldate, duration, packet loss, jitter, mos, rtcp, pdd, a_lost, b_lost, a_avgjitter, mos_f1, a_mos_adapt, fbasename, user-agent
'''Key Questions:'''
* What do the `a_` and `b_` prefixes mean in the `cdr` table?
* How are jitter and packet loss stored in the VoIPmonitor database?
* What is the difference between `duration` and `connect_duration`?
* How can I get the Call-ID for a specific call from the database?
* Which table stores the User-Agent of the phone?
* How do I convert the `sipcallerip` integer back to an IP address in SQL?
* What is the purpose of the `cdr_next` table?
* How are MOS scores stored in the database?

Latest revision as of 16:42, 30 June 2025


This document provides an overview of the most important tables and columns in the VoIPmonitor database schema. It is intended as a reference for administrators, developers, or anyone directly querying the database.

The core of the VoIPmonitor database is the `cdr` (Call Detail Record) table, which stores one primary record for each monitored call. Many other tables are linked to `cdr` to store additional, more detailed information.

Understanding Column Naming Conventions

Before diving into the columns, it's important to understand these common naming patterns:

  • `a_` prefix: Refers to the "A-leg" or the caller's media stream (RTP sent from the caller).
  • `b_` prefix: Refers to the "B-leg" or the callee's media stream (RTP sent from the callee).
  • `_mult10` / `_mult100` / `_mult1000`: Indicates that the stored integer value must be divided by this number to get the real decimal value. For example, a `jitter_mult10` value of `15` represents a real jitter of `1.5`.

The `cdr` Table

This is the main table containing the primary information for every call.

General Call Information

`ID`
The unique primary key for the record.
`id_sensor`
The ID of the sensor that processed this call, corresponding to `id_sensor` in `voipmonitor.conf`.
`calldate`
The start time of the call, typically measured from the first `INVITE` packet.
`callend`
The end time of the call, measured from the last packet associated with the call.
`bye`
An indicator of how the call was terminated. `1` typically means a normal termination with a `BYE` request.
`whohanged`
Indicates which party sent the `BYE` message first (caller or callee).
`lastSIPresponse_id`
A reference to the `cdr_sip_response` table, linking to the last final SIP response for the call.

Call Timing & Duration

`duration`
The total length of the call in seconds (`callend` - `calldate`).
`connect_duration`
The length of the connected portion of the call in seconds, measured from the first `200 OK` to the `callend`.
`progress_time`
The time in seconds from the initial `INVITE` to the first provisional response (e.g., `180 Ringing`). This is often referred to as Post-Dial Delay (PDD).
`first_rtp_time`
The time in seconds from the start of the call to the detection of the very first RTP packet.

Participant Information

`caller` / `called`
The user part of the number from the `From` and `To` SIP headers, respectively.
`caller_domain` / `called_domain`
The domain part from the `From` and `To` SIP headers.
`caller_reverse` / `called_reverse`
Reversed versions of the `caller` and `called` fields, used internally for efficient `LIKE '%search'` queries in the database.
`callername`
The display name part from the `From` SIP header.
`sipcallerip` / `sipcalledip`
The source and destination IP addresses from the SIP signaling. These are stored as integers; use the `INET_NTOA()` or `INET6_NTOA()` SQL function to convert them to a string representation.
`a_ua_id` / `b_ua_id`
A reference to the `cdr_ua` table, linking to the User-Agent string of the caller's and callee's device.

Network Quality Metrics

Packet Loss

`a_lost` / `b_lost`
The total number of RTP packets lost, detected by sequence number gaps.
`lost`
The higher value between `a_lost` and `b_lost`.
`packet_loss_perc_mult1000`
The maximum packet loss percentage from either stream, multiplied by 1000.
`a_sl1` - `a_sl10` / `b_sl1` - `b_sl10`
A distribution of consecutive packet loss events. `a_sl1` counts the number of times a single packet was lost, `a_sl5` counts the number of times 5 packets were lost in a row, etc.

Jitter & Delay (PDV)

`a_avgjitter_mult10` / `b_avgjitter_mult10`
The average jitter calculated according to RFC3550, multiplied by 10.
`a_maxjitter` / `b_maxjitter`
The maximum jitter value observed during the call.
`jitter_mult10`
The higher `maxjitter` value between the two streams, multiplied by 10.
`a_d50` - `a_d300` / `b_d50` - `b_d300`
A distribution of Packet Delay Variation (PDV). `a_d50` counts packets with a delay between 0-50ms, `a_d70` counts packets with a delay between 50-70ms, etc.

MOS (Mean Opinion Score)

`a_mos_f1_mult10` / `b_mos_f1_mult10`
The calculated parametric MOS score based on a simulated 50ms fixed jitter buffer, multiplied by 10.
`a_mos_f2_mult10` / `b_mos_f2_mult10`
MOS score based on a simulated 200ms fixed jitter buffer, multiplied by 10.
`a_mos_adapt_mult10` / `b_mos_adapt_mult10`
MOS score based on a simulated adaptive jitter buffer, multiplied by 10.
`mos_min_mult10`
The lowest MOS score recorded between the A and B streams, multiplied by 10.

RTCP Reported Metrics

These metrics are sourced from RTCP reports sent by the endpoints themselves, as opposed to being calculated by the sniffer.

`a_rtcp_loss` / `b_rtcp_loss`
Total packets lost as reported by RTCP.
`a_rtcp_avgfr_mult10` / `b_rtcp_avgfr_mult10`
Average fraction loss reported by RTCP, multiplied by 10.
`a_rtcp_avgjitter_mult10` / `b_rtcp_avgjitter_mult10`
Average jitter reported by RTCP, multiplied by 10.

Other Information

`dscp`
Stores the DSCP values from SIP and RTP packets for Quality of Service (QoS) analysis.
`payload`
The codec payload type number used during the call.

Important Related Tables

`cdr_next`
A 1-to-1 extension of the `cdr` table that stores additional data to keep the main `cdr` table smaller and faster.
  • fbasename: A string derived from the SIP `Call-ID`, used to link PCAP files to the CDR.
  • match_header: Stores the content of a custom header (defined by `matchheader` in `voipmonitor.conf`) used for linking call legs.
`cdr_rtp`
Stores detailed statistics for each individual RTP stream within a call, used by the GUI to render stream information in the call history view.
`cdr_dtmf`
Stores detected DTMF key presses (if `dtmf2db` is enabled).
`cdr_proxy`
Stores the IP addresses of all SIP proxies that the call traversed.
`cdr_sip_response`
A lookup table storing the text of unique SIP responses (e.g., "404 Not Found"). The `cdr` table references this table by ID to save space.
`cdr_ua`
A lookup table storing the `User-Agent` strings of SIP devices.

AI Summary for RAG

Summary: This document provides a reference for the VoIPmonitor database schema, focusing on the main `cdr` table and its most important related tables. It explains the column naming conventions, such as the `a_` (caller) and `b_` (callee) prefixes for RTP streams and the `_multNN` suffix indicating a value needs to be divided. The `cdr` table columns are logically grouped into categories: General Call Information (ID, calldate), Call Timing (duration, connect_duration, PDD), Participant Information (caller, called, IPs, User-Agents), and detailed Network Quality Metrics. The quality metrics section details columns for Packet Loss (lost counts, distribution), Jitter (average, max, PDV distribution), Mean Opinion Score (MOS), and RTCP-reported statistics. Finally, it briefly describes the purpose of key related tables like `cdr_next` (for Call-ID), `cdr_rtp`, `cdr_dtmf`, `cdr_proxy`, and the lookup tables `cdr_sip_response` and `cdr_ua`. Keywords: database, schema, table, column, cdr, cdr_next, cdr_rtp, database schema, sql, mysql, mariadb, calldate, duration, packet loss, jitter, mos, rtcp, pdd, a_lost, b_lost, a_avgjitter, mos_f1, a_mos_adapt, fbasename, user-agent Key Questions:

  • What do the `a_` and `b_` prefixes mean in the `cdr` table?
  • How are jitter and packet loss stored in the VoIPmonitor database?
  • What is the difference between `duration` and `connect_duration`?
  • How can I get the Call-ID for a specific call from the database?
  • Which table stores the User-Agent of the phone?
  • How do I convert the `sipcallerip` integer back to an IP address in SQL?
  • What is the purpose of the `cdr_next` table?
  • How are MOS scores stored in the database?