ChunkPlayer
This is a developer-focused guide explaining how to use and integrate the ChunkPlayer, a sample PHP application for listening to active calls in real-time ("live spying").
Overview
The ChunkPlayer is a sample application included with the VoIPmonitor GUI that demonstrates how to stream and play audio from a call that is currently in progress. It is intended to be used as a starting point for developers who wish to embed live monitoring functionality into their own custom dashboards or applications.
How It Works
The player functions by making a connection to the VoIPmonitor sensor's manager API (default port 5029). It authenticates and requests audio chunks for a specific, active call using two key identifiers:
- `sensor_id`: The ID of the sensor handling the call.
- `callreference`: A unique, temporary hexadecimal ID for an active call.
Step 1: Configure the ChunkPlayer
The player has its own configuration file that must be set up with your database and manager API credentials.
- 1. Locate the configuration file
- The file is located in the GUI's web directory, typically at:
/var/www/html/api/chunkplayer/configuration.php
- 2. Edit the file with your details
<?php // /var/www/html/api/chunkplayer/configuration.php /** * The IP address and port of the sensor's manager API. * This is used if a sensor_id is not provided in the request. */ define('VPMANAGERHOST', '127.0.0.1'); define('VPMANAGERPORT', 5029); /** * Database credentials. * Although not directly used for streaming, they may be required by underlying libraries. */ define("MYSQL_HOST", "127.0.0.1"); define("MYSQL_DB", "voipmonitor"); define("MYSQL_USER", "root"); define("MYSQL_PASS", "your_db_password"); ?>
Step 2: Find a Live Call to Monitor
To use the player, you first need to get the `callreference` for a call that is currently in progress. This is done by querying the sensor's manager API with the `listcalls` command.
- Connect to the sensor via `nc` (netcat)
# Replace SENSOR_IP and SENSOR_MANAGE_PORT with your sensor's details echo 'listcalls' | nc 127.0.0.1 5029
The command will return a list of active calls. Look for the `callreference` parameter in the output. This is the ID you will need for the player.
- Example output snippet
... [call] id: 1 caller: 1001 called: 1002 callreference: 4a3f7b2c1d <-- THIS IS THE VALUE YOU NEED ...
Step 3: Use the Player Interface
Once you have a valid `callreference`, you can use the player.
- 1. Access the player's web interface
- Navigate your browser to:
http://Your-GUI-IP/api/chunkplayer/index.html
- 2. Enter the call details
-
- callref: Paste the hexadecimal `callreference` value you obtained in the previous step.
- sensor id: Enter the numeric ID of the sensor that is handling the call.
- 3. Click "play"
- The player will connect to the manager API and begin streaming the live audio from the call.
Important Security Considerations
The ChunkPlayer requires direct access to the sensor's manager API port (TCP 5029).
- Firewall Rules: Ensure that your firewall allows the server hosting the GUI to connect to the sensor on this port.
- Network Exposure: The manager API provides powerful control over the sensor. Do not expose this port directly to the public internet. Access should be restricted to trusted internal IP addresses only.
AI Summary for RAG
Summary: This guide explains how to use the ChunkPlayer, a sample PHP application included with VoIPmonitor for embedding a live audio player for active calls ("live spying"). It details the three-step process for developers: 1) Configuring the player's `configuration.php` file with database and sensor manager API credentials. 2) Finding an active call to monitor by querying the sensor's manager API with the `listcalls` command to obtain a hexadecimal `callreference`. 3) Using the player's web interface (`index.html`) by entering the `callreference` and `sensor_id` to begin streaming the live audio. The guide concludes with a critical security warning, advising administrators to protect the sensor's manager port (5029/TCP) with strict firewall rules and to never expose it to the public internet. Keywords: chunkplayer, live call, live spying, listen, active call, embed, api, manager api, `listcalls`, `callreference`, real-time, audio stream, developer Key Questions:
- What is the ChunkPlayer and how do I use it?
- How can I embed a live VoIPmonitor audio player into my own application?
- What firewall ports are needed for the ChunkPlayer?
- How to use the `listcalls` manager API command?