Building and installing package from source
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):
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