26Aug/20

How to install Homer SIPCapture Server with Kamailio in CentOS 7

Introduction

HOMER is a robust, carrier-grade, scalable SIP Capture system and VoiP Monitoring Application offering HEP/EEP, IP Proto4 (IPIP) encapsulation & port mirroring/monitoring support right out of the box, ready to process & store insane amounts of signaling, logs and statistics with instant search, end-to-end analysis and drill-down capabilities for ITSPs, VoIP Providers and Trunk Suppliers using SIP signaling protocol.

Reference: https://github.com/sipcapture/homer/

Methodology

Following is the step by step guide for installing Homer with Kamailio SIP Proxy.

Step # 1

First of install some of the dependencies of the Homer & Kamailio:

Installing dependencies with yum.

# Dependencies
$ sudo yum -y install epel-release
$ sudo yum update
$ sudo yum -y install httpd mariadb-server mariadb mysql mysql-devel php
php-mysql php5-mysql wireshark bison pcre-devel libpcap-devel flex git

Step # 2

You can skip this step if you have already setup database and Apache Server.

Start Mariadb and set root password for the databases:

$ systemctl start mariadb
$ mysql_secure_installation

Edit Apache Configurations file:

$ sudo vi /etc/httpd/conf/httpd.conf

Update the http.conf file with following contents:

...
<directory html="" var="" www="">

   Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</directory>
...


After making above changes in Mariadb and Apache, you can restart services and enable them to start after boot.

$ sudo systemctl start httpd.service
$ sudo systemctl enable httpd.service
$ sudo systemctl enable mariadb


Step # 3

In this step, we are going to download source of Homer API and UI and place the code at the appropriate locations.

# Homer
$ cd /usr/src/
$ sudo git clone https://github.com/sipcapture/homer-api.git
$ sudo git clone https://github.com/sipcapture/homer-ui.git

$ mkdir /opt/sipcapture
$ sudo cp -rf /usr/src/homer-ui/* /var/www/html/
$ sudo cp -rf /usr/src/homer-api/api/ /var/www/html/
$ sudo cp -rf /usr/src/homer-api/scripts/* /opt/sipcapture/
$ sudo chmod -R a+x /opt/sipcapture/


Step # 4

In this step, we are going to setup Homer Database user, password and tables.

Please make sure that you have changed following file with your desired credentials:

$ sudo vi /usr/src/homer-api/sql/homer_user.sql

Please change db-username and db-password parameters as below:

...
CREATE USER ''@'localhost' IDENTIFIED BY '';
GRANT ALL ON homer_configuration.* TO ''@'localhost';
GRANT ALL ON homer_statistic.* TO ''@'localhost';
GRANT ALL ON homer_data.* TO ''@'localhost';
...

Now save and close the file.

You can install Homer databases schema with following commands:

$ mysql -u root -p < /usr/src/homer-api/sql/homer_user.sql
$ mysql -u root -p homer_data < /usr/src/homer-api/sql/schema_data.sql
$ mysql -u root -p homer_configuration < /usr/src/homer-api/sql/schema_configuration.sql
$ mysql -u root -p homer_statistic < /usr/src/homer-api/sql/schema_statistic.sql


Step # 5

You can setup crontab to rotate sipcapture homer_data database tables after one day.

Change Database username and password in below file:

sudo vi /opt/sipcapture/rotation.ini

Please change db-username and db-password parameters as below:

...
[MYSQL] user=
password=
host=localhost
port=3306
db_data = homer_data
db_stats = homer_statistic
# Extra param
newtables = 2 # Create new tables or partitions for next 2 days
engine = InnoDB #MyISAM or InnoDB
compress=ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8
...

Save and close the file.

$ sudo crontab -e -u root
...
30 3 * * * /opt/sipcapture/homer_rotate > /dev/null 2>&1
...

Save and close the file.

You have to manually run the rotate file as below:

$ sudo /opt/sipcapture/homer_rotate

Make sure that it has created tables with current date in homer_data database otherwise you have to rename the tables.

Step # 6

In this step, we are going to install Kamailio to capture SIP packets.

Download and Install Kamailio from source:

$ cd /usr/src/
$ sudo git clone --depth 1 https://github.com/kamailio/kamailio kamailio
$ cd kamailio
$ sudo make FLAVOUR=kamailio include_modules="db_mysql sipcapture pv textops rtimer xlog sqlops htable sl siputils" cfg
$ sudo make all
$ sudo make install 



In order to configure Kamailio, following actions are required.

$ sudo cp /usr/src/homer-api/examples/sipcapture/sipcapture.kamailio /usr/local/etc/kamailio/kamailio.cfg
$ sudo vi /usr/local/etc/kamailio/kamailio.cfg

Edit kamailio.cfg with database credentials and your Server IP (replace X.X.X.X with your Server IP):

...
#!substdef "!HOMER_DB_USER!!g"
#!substdef "!HOMER_DB_PASSWORD!!g"
#!substdef "!HOMER_LISTEN_PROTO!udp!g"
#!substdef "!HOMER_LISTEN_IF!X.X.X.X!g"
#!substdef "!HOMER_LISTEN_PORT!9060!g"
#!substdef "!HOMER_STATS_SERVER!tcp:HOMER_LISTEN_IF:8888!g"
...

Save and close the file.

Starting Kamailio with following command;

$ sudo kamailio
Listening on
udp: X.X.X.X:9060
Aliases:
udp: sipcatpure.example.com:9060


Step # 7

In this step, we are going to make final configuration changes for Homer UI:

$ cd /var/www/html/api/
$ sudo cp /var/www/html/api/preferences_example.php /var/www/html/api/preferences.php
$ sudo cp /var/www/html/api/configuration_example.php /var/www/html/api/configuration.php
$ sudo chmod 777 /tmp

Determine the executable paths of tshark and egrep for writing in configuration.php.

$ which tshark
/usr/sbin/tshark

$ which egrep
/usr/bin/egrep

Edit the configuration file for Homer UI:

$ sudo vi /var/www/html/api/configuration.php

Change your database credentials and executable paths of tshark and egrep determined as above:

...
if(!defined('HOMER_CONFIGURATION')):
define('HOMER_CONFIGURATION', 1);
/*********************************************************************************/
/* AUTH DB homer. User and Configuration */
define('DB_HOSTNAME', "localhost");
define('DB_PORT', 3306);
define('DB_USERNAME', "");
define('DB_PASSWORD', "");
define('DB_CONFIGURATION', "homer_configuration");
define('DB_STATISTIC', "homer_statistic");
define('DB_HOMER', "homer_data");
define('SINGLE_NODE', 1);

/*********************************************************************************/

/* webHomer Settings
* Adjust to reflect your system preferences
*/

define('PCAPDIR', ROOT."/tmp/");
define('WEBPCAPLOC',"/tmp/");

/* Tshark settings for ISUP analyse */
define('TSHARK_ENABLED',1);
define('TSHARK_PATH','/usr/sbin/tshark');
define('EGREP','/usr/bin/egrep');

/* INCLUDE preferences */

include_once("preferences.php");

endif;

?>
... 



Edit the preferences file needed for configurations.

sudo vi /var/www/html/api/preferences.php

Change X.X.X.X to your Server IP Address and email addresses:

...
define('ALARM_FROMEMAIL',"homer@example.com");
define('ALARM_TOEMAIL',"user01@example.com");
...
define('REMOTE_LOG_URL', "http://X.X.X.X:9200");
...
define('EXTERNAL_AUTH_URI', "http://X.X.X.X/api/request");
...

Step # 8

Now you have successfully installed Homer SIPCapture Server and you can login the server with following credentials and replace X.X.X.X with your server IP.

URL: http://X.X.X.X/
Username: admin
Password: test123

05Aug/20

VoIP Solution for wholesale Business

VoIP Business is moving in a new innovative direction to serve unified communication services and simplifying services using open source solutions. Freeswitch provides almost all required UCM features without the GUI. OV500 is designed to serve wholesale aggregator services.

Freeswitch , Kamailio and RTPProxy are used in the system with simplifying GUI to manager least cost routing, unlimited carrier, resellers and users with custom dialplan options.

21Jun/20

OV500 1.0.1 Release

This is a major bug fix and core enhancement in core release.

Enhancement —

  • [New feature] Bundle (Inbound and outbound calling bundle)
  • [New feature] Monthly DID and Monthly Bundle Billing
  • [New Feature] Customer Account statement
  • [New feature] Auto temporary credit deducting 

Bug —

  • [Fix] Reseller tariff management
  • [Fix] Rates listing
21Jun/20

How to Setup DID monthly charges service

The monthly charges script installation is very simple. Just set up the cron job in server and script will deduct every month DID and other charges such as DID rental, Monthly bundle package charges… etc. 

15 1 * * * /usr/bin/php /home/OV500/portal/api/cronjob.php

This job is ruining every day in the morning 1hour 15 minutes. Scheduler time can modify according to your need. This script is calculating daily usage (Inbound and Outbound call charges) and generating SDR. 1st day of the month it is calculating DID rental charges in advance. Also, deducting bundle charges every month, in the same way, a DID rental.

28Feb/20

Installing and Configuring the Secure OV500 GUI and API

Disable the selinux to reduce and allow DB connectivity with OV500 project PDO connection

sed -i "s#SELINUX=enforcing#SELINUX=disabled#g" /etc/selinux/config
sed -i "s#SELINUX=permissive#SELINUX=disabled#g" /etc/selinux/config
setenforce 0

First, Install the repository of PHP7 and packages

yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm 
yum -y install epel-release yum-utils
yum-config-manager --disable remi-php54
yum-config-manager --enable remi-php73
yum install -y php php-fpm php-mysql php-cli php-json php-readline php-xml php-curl php-gd php-json php-mbstring php-mysql php-opcache php-pdo

Lot of open source web servers are available but recommending to use the NGINX. It is light weight and can handle more request comparing others.  Apache is also good web server but OV500 is recommending to use NGINX and PHP-FPM to get the high performance output.

yum install -y nginx libxml2 libxml2-devel openssl openssl-devel gettext-devel fileutils

#NGINX installation steps

setenforce 0
systemctl start nginx
systemctl enable nginx
systemctl start php-fpm
systemctl enable php-fpm

Now, configure the SSL certificate using OpenSSL package

mkdir -p /etc/nginx/ssl
#Below CMD is to set up the self sign ssl certificate
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt
29Dec/19

How to Secure VoIP Services

VoIP is a future of telecom and some of the telcos are started using OpenSources VoIP solution in his network.  Kamailio and Freeswitch are good to use for scalable and high volume solutions.Kamailio is good to use as a SIP proxy in the VoIP network. Kamailio provides multiple modules from that list “exec” module is providing the option to execute the shell commands. 

IPTABLES is one of network security tool which is filtering the traffic. OV500 is using the “exec” Kamailio module for blocking the unauthorized traffic source and restricting the unwanted traffic. 

27Oct/19

Freeswitch installation in CentOS 7 and RHEL 7

Freeswitch Building from Source

Install base packages

yum install -y https://files.freeswitch.org/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm epel-release
yum-builddep -y freeswitch

yum
install -y yum-plugin-ovl centos-release-scl rpmdevtools yum-utils git
yum install -y devtoolset-4-gcc*
scl enable devtoolset-4 'bash'
Download the freeswitch package
 
cd /usr/local/src
git clone -b v1.10 https:
//github.com/signalwire/freeswitch.git freeswitch
 
Compiled the freeswitch
 
cd /usr/local/src/freeswitch
.
/bootstrap.sh -j
.
/configure --enable-portable-binary --prefix=/home/OV500 --with-gnu-ld --with-python --with-erlang --with-openssl --enable-core-odbc-support --enable-zrtp
make

make
-j install
make
-j cd-sounds-install
make
-j cd-moh-install

Once freeswitch is installed in server, change the freeswitch configuration as required by OV500. Configuration is available in OV500 installation documents.

27Oct/19

Freeswitch Billing Solution

Freeswitch is a SIP server which can use for SBC solution. OV500 solution is designed as SBC solution including freeswitch billing and routing software.  It is designed in the distributed architecture

 

Solution is using kamailio as load balancer to distribute the call in multiple freeswitch servers.  Check the OV500 management portal

Admin Demo access
Portal URL : http://openvoips.org/portal
Username: admin
Password: 123456