Table of Contents

Siremis v3.3.x - Setup Accounting Services

Accounting Panel

This view maps on the records stored by Kamailio's acc module – the event-based accounting, storing the START and STOP records for each call.

You can see these records from Accounting Services ⇒ Accounting List and Accounting Services ⇒ Missed Calls List.

Config file

Changes in file kamailio.cfg

#!define WITH_MYSQL
#!define WITH_ACCDB
modparam("acc", "db_extra",
    "src_user=$fU;src_domain=$fd;src_ip=$si;"
    "dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")

Database

Kamailio database structure and stored procedure were created by Siremis Web Installation Wizard by checking “Update SIP Database” option in Step 2. These DB operations consisted of:

If you want to see the SQL commands used to do above DB operations, see the file:

siremis/modules/ser/mod.install.siremis.sql

Generate CDRs

The stored procedure for generating CDRs was created during installation process. It is named kamailio_cdrs(). You have to execute it periodically from a cron.d job or you can user rtimer and sqlops modules to execute it periodically from Kamailio configuration file.

You can see CDRs in Siremis panel: Accounting Services ⇒ CDR List

Rating CDRs

The stored procedure for rating CDRs was created during installation process. It is named kamailio_rating(). It takes one parameter, rgroup, which corresponds to rate_group column in billing_rates table.

The rules for rating the calls (billing) have to be added in table billing_rates. The rating engine uses the longest prefix matching to select the rate_unit and the time_unit to bill the CDRs. Each rating rule is composed from:

Also, like for CDRs generation, you have to execute it periodically – again from a cron.d job or you can user rtimer and sqlops modules to execute it periodically from Kamailio configuration file.

kamailio.cfg for generating and rating CDRs

Here are the kamailio.cfg snippets to generate and rate CDRs periodically from a running Kamailio instance.

# -- for siremis CDRs --------------
loadmodule "rtimer.so"
loadmodule "sqlops.so"
 
modparam("rtimer", "timer", "name=cdr;interval=300;mode=1;")
modparam("rtimer", "exec", "timer=cdr;route=CDRS")
modparam("sqlops", "sqlcon", "cb=>mysql://openser:openserrw@localhost/openser")
 
 
 
# ======================================================
# Populate CDRs Table of Siremis
# ======================================================
route[CDRS] {
	sql_query("cb","call kamailio_cdrs()","rb");
	sql_query("cb","call kamailio_rating('default')","rb");
 
}