Testingpage: Difference between revisions

From VoIPmonitor.org
No edit summary
Tag: Manual revert
No edit summary
Line 1: Line 1:
=== Investigating Specific Missing Calls ===
=== Testing Database Connection ===


If you have a list of specific phone numbers that should have been recorded but are missing from the CDR database, use this workflow to determine whether the traffic reached the sensor.
If the GUI displays database connectivity errors, verify the connection from the command line using the credentials from the GUI configuration file.


'''Step 1: Capture SIP traffic on the VoIPmonitor server'''
Capture SIP traffic to a PCAP file for analysis:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Capture SIP traffic (adjust interface and port as needed)
# 1. Locate the database configuration file
tcpdump -i any -nn -s0 -w /tmp/sip_capture.pcap port 5060
cat /var/www/html/config/configuration.php


# Let it run during the time when missing calls occur, then stop with Ctrl+C
# Note the values for:
</syntaxhighlight>
# MYSQL_HOST
# MYSQL_DB
# MYSQL_USER
# MYSQL_PASS


'''Step 2: Identify missing numbers and approximate call times'''
# 2. Test the database connection from command line
mysql -h [MYSQL_HOST] -u [MYSQL_USER] [MYSQL_DB] -p[MYSQL_PASS]
</syntax>


From your input list, note the specific phone numbers and their approximate call times that are missing from the database.
If the command line connection succeeds, verify that the PHP environment has the necessary extensions enabled for database connections:


'''Step 3: Use tshark to find Call-IDs for missing numbers'''
Search the capture file for SIP INVITE messages containing the missing numbers:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# Find Call-IDs for a specific missing number
# Check for mysqli extension
tshark -r /tmp/sip_capture.pcap -Y "sip.Method == INVITE && sip contains \"NUMBER\"" -T fields -e sip.Call-ID
php -m | grep mysqli
 
# Replace NUMBER with the actual phone number (e.g., 5551234567)
</syntaxhighlight>
 
This returns the Call-IDs for calls involving that number.
 
'''Step 4: Search for Call-IDs in the VoIPmonitor GUI'''
 
Use the GUI search function to look for each Call-ID found in Step 3:
* Navigate to the CDR view
* Use the search/filter to find calls by Call-ID
* If the Call-ID is found, the call was processed but may be filtered or in a different time range
* If the Call-ID is NOT found, the sensor did not process the call
 
'''Step 5: Determine the root cause'''
 
* '''If packets are NOT found in the capture file''': Traffic is not being delivered to the sensor. Check network topology and port mirroring/SPAN configuration. See [[Sniffing_modes]] for SPAN setup.
* '''If packets ARE found in capture but Call-IDs are NOT in GUI''': Sensor received traffic but did not process the calls. Check [[#Missing id_sensor Parameter|id_sensor configuration]], [[#GUI Capture Rules Blocking|capture rules]], or [[Database_troubleshooting|database issues]].
 
'''Step 6: Verify record counts with SQL query'''
 
To verify the number of CDRs for a specific time range:
<syntaxhighlight lang="sql">
-- Count CDRs for a specific time range
SELECT count(*) FROM cdr
WHERE calldate >= 'YYYY-MM-DD HH:MM:SS'
  AND calldate < 'YYYY-MM-DD HH:MM:SS';


-- For cdr_next table (if using partitioned schema)
# Check for mysqlnd extension
SELECT count(*) FROM cdr_next
php -m | grep mysqlnd
WHERE cdr_ID IN (SELECT ID FROM cdr
</syntax>
                WHERE calldate >= 'YYYY-MM-DD HH:MM:SS'
                  AND calldate < 'YYYY-MM-DD HH:MM:SS');
</syntaxhighlight>


{{Tip|This workflow helps distinguish between network delivery issues (packets never reach sensor) and sensor processing issues (packets arrive but are not recorded).}}
{{Note|The <code>mysql_connect</code> function was deprecated in PHP 5.5 and removed in PHP 7.0. Modern VoIPmonitor GUI versions use <code>mysqli</code> for database connections. If you see <code>mysql_connect</code> errors, upgrade your GUI to a version compatible with your PHP version. See [[Re-install_the_GUI|Re-install the GUI]].}}

Revision as of 02:16, 12 January 2026

Testing Database Connection

If the GUI displays database connectivity errors, verify the connection from the command line using the credentials from the GUI configuration file.

<syntaxhighlight lang="bash">

  1. 1. Locate the database configuration file

cat /var/www/html/config/configuration.php

  1. Note the values for:
  2. MYSQL_HOST
  3. MYSQL_DB
  4. MYSQL_USER
  5. MYSQL_PASS
  1. 2. Test the database connection from command line

mysql -h [MYSQL_HOST] -u [MYSQL_USER] [MYSQL_DB] -p[MYSQL_PASS] </syntax>

If the command line connection succeeds, verify that the PHP environment has the necessary extensions enabled for database connections:

<syntaxhighlight lang="bash">

  1. Check for mysqli extension

php -m | grep mysqli

  1. Check for mysqlnd extension

php -m | grep mysqlnd </syntax>

ℹ️ Note: The mysql_connect function was deprecated in PHP 5.5 and removed in PHP 7.0. Modern VoIPmonitor GUI versions use mysqli for database connections. If you see mysql_connect errors, upgrade your GUI to a version compatible with your PHP version. See Re-install the GUI.