Applies to all VoipNow versions!
HOMER is an open source SIP Capture system which allows you to store and analyze SIP traffic. This article explains how to use Homer to monitor VoipNow.
Photo credits: https://github.com/sipcapture/homer/wiki/Quick-Install
Homer relies on the Capture Node and the Capture Agent.
The Capture Node is where Homer stores the SIP packets. The node comes with a web interface that allows you to filter the calls you need to analyze.
The Capture Agent feeds the capture node with SIP signaling, Logs, RTCP and more, using the HEP protocol (i.e. Homer Encapsulation Protocol). Asterisk and Kamailio natively support HEP through the "res_hep" (Asterisk) and "siptrace" (Kamailio) modules. For the time being, VoipNow's versions of Asterisk or Kamailio are not using these modules. So, for the Capture Agent, you can use port mirroring, Homer's CaptAgent, sngrep or others.
On GitHub, you can find several Homer installation options, but the simplest method is the automated installation. For the time being, the automated install is still listed as "work in progress". This article describes the manual installation successfully tested on CentOS 6 and 7 servers. Here and here you can read more on Homer.
Please note that this is not a copy&paste installation tutorial. Because of the many commands and the installation method which might change over time, it's recommended that you use this article as a guide and check the official website for differences in newer versions.
Cloning repo and installing required rpm's
Clone the Homer repository.
Install the needed rpm's.
Set a root password for mysql:
Check that InnoDB is supported:
Setting up the HTTP server
- Create an Apache virtual host following their example at
DocumentRootline. If it shows up like this:
- In httpd.conf make sure mode rewrite is enabled if
AllowOverrideis set to "All".
Set recursive ownersip to apache on
Setting up MySQL
Create databases, tables and users.
When importing "schema_statistic.sql", you might get this error:
"ERROR 1293 (HY000) at line 181: Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause"
To fix it, change:
`from_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`to_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`from_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`to_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
Correct the error showing on all lines. In this case, the error appears on line 181.
- Check that these files are moved to the webserver location. If you followed all steps the files should already be there.
- $GIT/homer-api/api/preferences_example.php in $WEB/api/preferences.php
- $GIT/homer-api/api/configuration_example.php in $WEB/api/configuration.php
- Check that the database credentials from $WEB/api/configuration.php are the same ones defined in $GIT/homer-api/sql/homer_user.sql
Configuring rotation scripts
Homer stores the captured SIP packets in tables which by default rotate daily.
- Copy the scripts you have in
$GIT/homer-api/scripts/to another location - for example, /usr/local/bin/sipcapture/
- Run chmod +x on the script directory.
- Ensure that the homer_rotate script has the correct database credentials, as set in
$GIT/homer-api/sql/homer_user.sql(defaults are homer_user and homer_password)
- Set the rotate script in a cron:
By default, your database contains old tables. When you're ready to send SIP packets to the Capture Node, run the homer_rotate script manually so that it creates capture tables for the actual day. Otherwise, Kamailio won't be able to insert the logs in the database.
- Install Kamailio and kamailio-mysql rpms from their repository: http://download.opensuse.org/repositories/home:/kamailio:/
- Make sure all required modules are loaded:
db_mysql sipcapture pv textops rtimer xlog sqlops htable sl siputils
Overwrite the default config with the example provided by Homer:
Accessing the Homer web interface
Open Homer-UI at
http://<capture_node_ip> and log in with username: admin and password: test123
Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 4.0 International.