Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Building and installing package from source

voipmointor.spec
Name: voipmonitor
Version: 16.0.2
Release: 1
Summary: A live network packet sniffer which analyze SIP and RTP protocol

Group: Applications/Communications
License: GPLv2
URL: https://www.voipmonitor.org
Source: https://github.com/%{name}/sniffer/archive/b47e0d2.tar.gz

BuildRequires: curl-devel, json-c-devel, fftw-devel, gnutls-devel, libogg-devel
BuildRequires: libpcap-devel, libgcrypt-devel, libpng-devel, libssh-devel
BuildRequires: libxml2-devel, libvorbis-devel, lzo-devel, mariadb-devel
BuildRequires: rrdtool-devel, snappy-devel, unixODBC-devel, zlib-devel
Requires: curl, json-c, mariadb-server, rrdtool, snappy, unixODBC

%description
VoIPmonitor is open source live network packet sniffer which analyze SIP
and RTP protocol. It can run as daemon or analyzes already captured pcap
files. For each detected VoIP call voipmonitor calculates statistics about
loss, burstiness, latency and predicts MOS (Meaning Opinion Score) according
to ITU-T G.107 E-model. These statistics are saved to MySQL database and each
call is saved as pcap dump. Web PHP application (it is not part of open
source sniffer) filters data from database and graphs latency and loss
distribution. Voipmonitor also detects improperly terminated calls when
BYE or OK was not seen. To accuratly transform latency to loss packets,
voipmonitor simulates fixed and adaptive jitterbuffer.

%prep
%autosetup -n sniffer-b47e0d2cd9af01ec029601a4b6dd13d76edd7b91

%build
autoreconf -vfi
%configure
make %{?_smp_mflags}

%install
install -Dm755 %{name} %{buildroot}%{_bindir}/%{name}
install -Dm644 config/%{name}.conf %{buildroot}%{_sysconfdir}/%{name}.conf
install -Dm644 config/systemd/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
install -d %{buildroot}%{_localstatedir}/spool/%{name}

%files
%{_bindir}/%{name}
%{_unitdir}/%{name}.service
%config(noreplace) %{_sysconfdir}/%{name}.conf
%dir %{_localstatedir}/spool/%{name}

%changelog
* Mon Jun 13 2016 Ole Ernst <olebowle@gmx.com> - 16.0.2-1
- Initial RPM release

Download latest voipmonitor release: b47e0d2.tar.gz

# prepare build environment
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
sudo yum group install "Development Tools"
cp voipmonitor.spec ~/rpmbuild/SPECS/
cp b47e0d2.tar.gz ~/rpmbuild/SOURCES/

# install dependencies
yum install -y curl-devel json-c-devel fftw-devel gnutls-devel libogg-devel libpcap-devel libgcrypt-devel libpng-devel libssh-devel libxml2-devel libvorbis-devel lzo-devel mariadb-devel rrdtool-devel snappy-devel unixODBC-devel zlib-devel curl json-c mariadb-server rrdtool snappy unixODBC glib2-devel

 # build rpm
cd ~/rpmbuild/SPECS
rpmbuild -ba voipmonitor.spec # on error install suggested dependencies

# check specfile and rpms
sudo yum install rpmlint
rpmlint voipmonitor.spec ../RPMS/*/voipmonitor-*.rpm ../SRPMS/voipmonitor-*

# install rpm
sudo rpm -iv ../RPMS/x86_64/voipmonitor-16.0-1.x86_64.rpm

# enable and start voipmonitor
systemctl enable voipmonitor.service
systemctl start voipmonitor.service

 

Voipmonitor can either run on the provisioning server itself or on a dedicated server. Only if it is run on a different (dedicated) server one needs to add a mysql user to allow remote access to the voipmonitor DB (which will be created by the Voipmon migration) on the provisioning server. To do so run the following commands on the provisioning server:

-- the wildcard char (%) allows connections from all IP addresses, this should be limited by firewalld
CREATE USER 'voipmonitor'@'%' IDENTIFIED BY 'secret_password';
-- user `voipmonitor` has all privileges on DB voipmonitor, none for the other DBs
GRANT ALL PRIVILEGES ON voipmonitor.* TO 'voipmonitor'@'%';
GRANT ALL PRIVILEGES ON voipmonitor.cdr TO 'nmsprime'@'%';
FLUSH PRIVILEGES;

 

Of course the mysql port needs to be allowed using firewalld on the provisioning server, e.g. only allow 80.243.X.Y (the dedicated voipmonitor server):

  <rule family="ipv4">
    <source address="80.243.X.Y"/>
    <service name="mysql"/>
    <log prefix="mysql" level="info"/>
    <accept/>
  </rule>


Add following entries to .env file of provisioning server (root directory of laravel framework):

.env
VOIPMONITOR_DB_HOST=localhost
VOIPMONITOR_DB_DATABASE=voipmonitor
VOIPMONITOR_DB_USERNAME=voipmonitor
VOIPMONITOR_DB_PASSWORD=secret_password

This is not strictly necessary, as the DB can be access via the root credentials used to access db_lara. But it's nice to divide power and limit access.

 

Lastly voipmonitor needs to be configured to use the remote DB instead of the local one:

--- a/etc/voipmonitor.conf
+++ b/etc/voipmonitor.conf
-mysqlhost = 127.0.0.1
+mysqlhost = 46.167.X.Y
-mysqlusername = root
-mysqlpassword =
+mysqlusername = voipmonitor
+mysqlpassword = secret_password
-interface = eth0
+interface = eno2
-ringbuffer = 50
+ringbuffer = 1000
-#cdronlyrtp = yes
+cdronlyrtp = yes
-savesip = yes
+savesip = no
-savertp = yes
+savertp = no
-savertcp = yes
+savertcp = no
-savegraph = yes
+savegraph = no
-maxpoolsize        = 102400
+maxpoolsize        = 40960

Using voipmonitor

  • to start/stop/enable/disable voipmonitor.service use systemctl
  • voipmonitor can be configured via /etc/voipmonitor.conf
  • to analyze a single captured pcap/pcapng use the following command (debug only):
$ voipmonitor -r test.pcap -P /tmp/voipmonitor.pid --config-file /etc/voipmonitor.conf

 

 

  • No labels