VoIPmonitor Sniffer

repository·master·Indexed 43 days ago

https://github.com/voipmonitor/sniffer

An open-source network packet sniffer for high-performance VoIP/RTC traffic analysis on Linux. It captures, decodes, and analyzes SIP, RTP, and WebRTC protocols to provide quality metrics and call metadata, outputting data to MySQL/MariaDB, PCAP storage, and audio files.

Tokens
11.6K
Snippets
45
Records
60
Agent score
55%

What's inside VoIPmonitor

  1. How VoIPmonitor architecture works

    master

    VoIPmonitor consists of two main components:

    1. VoIPmonitor Sniffer (GPL): A high-performance engine that captures network traffic (via SPAN, TAP, or mirroring). It performs SIP parsing, RTP decoding, quality analysis, and audio recording. It outputs data to three destinations:

      • MySQL/MariaDB: Stores Call Detail Records (CDRs).
      • PCAP Storage: Stores SIP and RTP packets.
      • Audio Files: Stores recordings in WAV or OGG formats.
    2. VoIPmonitor WEB GUI (Commercial): A frontend that connects to the database and storage to provide real-time dashboards, CDR analysis, SIP ladder diagrams, and quality reports.

  2. Understand Disk I/O Calibration and Profiles

    master

    The sniffer uses automatic calibration to establish a performance baseline for the storage device. This allows the system to detect bottlenecks by comparing current performance against a known 'knee point' (the throughput level where latency begins to increase).

    How Calibration Works

    1. On first run, the sniffer measures baseline latency with minimal I/O.
    2. It progressively increases write load.
    3. It identifies the 'knee point' where latency starts increasing.
    4. The profile is stored in <spool_dir>/.disk_io_calibration.conf.

    Calibration runs in the background and takes approximately 2-3 minutes.

    Calibration Profile Format

    The profile is stored as an INI file in the spool directory. It includes the filesystem UUID, device name, and performance thresholds (baseline latency, knee throughput, etc.).

    Triggering Recalibration

    Recalibration occurs automatically if:

    • No calibration profile exists.
    • The filesystem UUID changes (e.g., disk replacement).

    You can also trigger manual recalibration via the manager or by deleting the .disk_io_calibration.conf file to force a new run.

    [calibration]
    uuid=abc123...
    device=nvme0n1
    filesystem=ext4
    spool_path=/var/spool/voipmonitor
    calibration_time=1706000000
    baseline_latency_ms=0.5
    knee_latency_ms=2.0
    saturation_latency_ms=10.0
    knee_throughput_mbs=800.0
    max_throughput_mbs=1200.0
    baseline_iops=50000
    knee_iops=80000
    max_iops=120000
  3. Install voipmonitor from source on Gentoo

    master

    To install voipmonitor on Gentoo, follow these steps to build from source, install the binaries, and set up the configuration and init scripts:

    1. Navigate to the source directory.
    2. Clean previous builds (optional but recommended).
    3. Compile and install.
    4. Copy the configuration file to /etc/.
    5. Copy the init script to /etc/init.d/.
    6. Edit the configuration file, prepare the MySQL table, and run the service.
    cd /path/to/voipmonitor
    make clean
    make
    make install
    cp config/voipmonitor.conf /etc/
    cp config/init.d/voipmonitor /etc/init.d/
  4. Build the VoIPmonitor sniffer from source

    master

    If you prefer to build from source, follow these steps:

    1. Clone the repository.
    2. Run the ./configure script.
    3. Execute make to build.
    4. Run make install to install the binaries.
    git clone https://github.com/voipmonitor/sniffer.git
    cd sniffer
    ./configure
    make
    make install
  5. Build and install the sniffer from source

    master

    To install the sniffer from source on Debian, clone the repository, run the configuration script, and compile the binary. Note that you may encounter a warning regarding tmpnam being dangerous; you can safely ignore this and proceed with the build.

    After compilation, you must install the binary, copy the default configuration file to /etc/, and set up the init script to manage the service.

    cd /usr/src
    git clone https://github.com/voipmonitor/sniffer.git
    cd sniffer
    ./configure
    make
    # (Ignore 'tmpnam' warnings if they appear)
    make install
    
    # Configuration and Service Setup
    cp config/voipmonitor.conf /etc/
    # Edit /etc/voipmonitor.conf to your needs
    cp config/init.d/voipmonitor /etc/init.d/
    update-rc.d voipmonitor defaults
    /etc/init.d/voipmonitor start
  6. Install libpcap 1.1.1 from source

    master

    To support packet capturing, you must install libpcap 1.1.1. This requires flex and bison as build dependencies. Follow these steps to download, compile, and install the library from source.

    sudo apt-get install flex
    sudo apt-get install bison
    cd /usr/src
    wget http://www.tcpdump.org/release/libpcap-1.1.1.tar.gz
    tar xzf libpcap-1.1.1.tar.gz
    cd libpcap-1.1.1
    ./configure
    make
    make install
    ldconfig
  7. Post-build configuration and setup

    master

    After running make install, you must perform the following steps to finalize the installation:

    1. Copy default configuration: Move the default config from the source directory to /etc/voipmonitor.conf.
    2. Copy init script: Move the init script to /etc/init.d/voipmonitor.
    3. Configure MySQL: Edit /etc/voipmonitor.conf and set the following mandatory options:
      • mysqlhost
      • mysqlport
      • mysqlusername
      • mysqlpassword
    4. Configure Auto-cleaning: Set cleandatabase and maxpoolsize in /etc/voipmonitor.conf.

    Note: If using systemd, refer to the CentOS 7 documentation for systemd init file instructions.

    cp /usr/src/voipmonitor-git/config/voipmonitor.conf /etc/voipmonitor.conf
    cp /usr/src/voipmonitor-git/config/init.d/voipmonitor /etc/init.d/voipmonitor
  8. Install dependencies and libpcap for VoIPmonitor

    master

    Before building VoIPmonitor, you must install mysql-devel and compile libpcap from source. Follow these steps to prepare the environment:

    1. Install MySQL development headers using yum.
    2. Download, configure, compile, and install libpcap.
    3. Run ldconfig to update the shared library cache.
    yum install  mysql-devel
    wget http://www.tcpdump.org/release/libpcap-1.1.1.tar.gz
    tar zxvf libpcap-1.1.1.tar.gz
    cd libpcap-1.1.1
    ./configure
    make
    make install
    ldconfig
    cd ..
  9. Generate graphs via the VoIPmonitor Manager

    master

    You can generate graphs using the creategraph command by connecting to the VoIPmonitor manager via telnet.

    1. Configure Manager Access

    Ensure your voipmonitor.conf is configured to listen for connections. By default, it uses port 5029 and can be restricted to localhost:

    • managerip = 127.0.0.1
    • managerport = 5029

    2. Connect and Execute

    Connect to the manager using telnet:

    telnet 127.0.0.1 5029

    Once connected, you can issue creategraph commands. To verify support, type creategraph and check if the syntax description is returned.

    creategraph PS now-2weeks now 600 400 0 0 - /tmp/graph_PS.png
  10. Set up the Web Interface with Apache

    master

    To enable the web interface, install Apache and the required PHP modules, then start the service:

    yum install httpd php php-gd php-mysql php-process
    chkconfig httpd on
    service httpd start

    After setting up the server, download the manual and GUI from voipmonitor.org/download to complete the installation.

    yum install httpd php php-gd php-mysql php-process
    chkconfig httpd on
    service httpd start
  11. Configure and start MySQL and VoIPmonitor service

    master

    After building, install the MySQL server, configure the VoIPmonitor configuration file, and enable the VoIPmonitor service.

    1. Install and start MySQL:
      yum install mysql-server
      chkconfig mysqld on
      service mysqld start
    2. Install VoIPmonitor configuration and init script:
       ```bash
    cp config/voipmonitor.conf /etc/
    # Edit /etc/voipmonitor.conf as needed
    cp config/init.d/voipmonitor /etc/init.d/
    chkconfig --add voipmonitor
    chkconfig voipmonitor on
    yum install mysql-server
    chkconfig mysqld on
    service mysqld start
    cp config/voipmonitor.conf /etc/
    cp config/init.d/voipmonitor /etc/init.d/
    chkconfig --add voipmonitor
    chkconfig voipmonitor on
  12. Install build dependencies on Debian

    master

    Before building the sniffer from source on a Debian-based system, you must install the required development libraries. This includes core dependencies for MySQL, PCAP, compression, and networking, as well as optional packages for extended functionality like PNG support or FFTW3.

    # Core dependencies
    apt-get install build-essential git libmysqlclient-dev libvorbis-dev libpcap-dev unixodbc-dev libsnappy-dev libcurl4-openssl-dev libssh-dev libjson-c-dev librrd-dev liblzo2-dev liblzma-dev libglib2.0-dev libxml2-dev libzstd-dev liblz4-dev
    
    # Optional packages
    apt-get install libpng-dev libgcrypt-dev libfftw3-dev libgoogle-perftools-dev gnutls-dev