Actions

ProSBC:FreeRadius configuration for Accounting


Introduction

This Configuration Note describes how to set up FreeRadius for accounting with Telcobridges products.


Prerequisites

Configuration Steps

This will provide you the step-by-step configuration for Telcobridges and FreeRadius.

Configuring Telcobridges product for Radius Accounting

FreeRadius Configuration

  • Add access for each Telcobridges device editing the clients.conf file located in the /etc/raddb directory.
   client IPAddressof the Telcobridges {
        secret = server_secret
        shortname = shortname of the device
       }
    • secret = Need to be same as configured in the Telcobridges Radius configuration

Example;

      client 192.168.1.10 {
        secret = Test123
        shortname = LabSystem
       }
  • Copy dictionary.telcobridges file to the /usr/share/freeradius directory. dictionary.telcobridges file located in the /usr/lib/tb/toolpack/pkg/3.1.124.1/web/radius_dictionary/. The file name is dictionary.vendor, after copying to the FreeRadius change this name to dictionary.telcobridges. 3.1.124.1 is the active package of the ProSBC.
  • Add the following line to the dictionary file. If not exist you can create it;
  $INCLUDE dictionary.telcobridges
  • Restart the FreeRadius
  • Make a test call and check the folder /var/log/radius/radacct to see if new logs are created.

Store Telcobridges CDR Attributes in the FreeRadius Database

  • Modify the SQL files to store Telcob attributes in MySQL. In this example, we will be going to add a Remote SIP IP address to the MySQL from the Telcob-RemoteSipIP attribute
  • To create a new column in the radacct table we need to update the schema.sql file which is under the folder /etc/raddb/mods-config/sql/main/mysql. In this example we are adding tbremotesipip in the CREATE Table radacct
 CREATE TABLE radacct (
  radacctid bigint(21) NOT NULL auto_increment,
  acctsessionid varchar(64) NOT NULL default '',
  acctuniqueid varchar(32) NOT NULL default '',
  username varchar(64) NOT NULL default '',
  groupname varchar(64) NOT NULL default '',
  realm varchar(64) default '',
  nasipaddress varchar(15) NOT NULL default '',
  nasportid varchar(15) default NULL,
  nasporttype varchar(32) default NULL,
  acctstarttime datetime NULL default NULL,
  acctupdatetime datetime NULL default NULL,
  acctstoptime datetime NULL default NULL,
  acctinterval int(12) default NULL,
  acctsessiontime int(12) unsigned default NULL,
  acctauthentic varchar(32) default NULL,
  connectinfo_start varchar(50) default NULL,
  connectinfo_stop varchar(50) default NULL,
  acctinputoctets bigint(20) default NULL,
  acctoutputoctets bigint(20) default NULL,
  calledstationid varchar(50) NOT NULL default '',
  callingstationid varchar(50) NOT NULL default '',
  acctterminatecause varchar(32) NOT NULL default '',
  servicetype varchar(32) default NULL,
  framedprotocol varchar(32) default NULL,
  framedipaddress varchar(15) NOT NULL default '',
  tbremotesipip varchar(15) NOT NULL default '', 
  • update the MySQL db with a new schema. run the following command and restart the FreeRadius
 mysql -u username -ppassword -dbname < schema.sql 
  • Under the /etc/raddb/mods-config/sql/main/mysql, update the queries.sql to match attribute and new added column in the schema.sql. In the column_list add tbremotesipip, column_list will become;
  column_list = "\
		acctsessionid,		acctuniqueid,		username, \
		realm,			nasipaddress,		nasportid, \
		nasporttype,		acctstarttime,		acctupdatetime, \
		acctstoptime,		acctsessiontime, 	acctauthentic, \
		connectinfo_start,	connectinfo_stop, 	acctinputoctets, \
		acctoutputoctets,	calledstationid, 	callingstationid, \
		acctterminatecause,	servicetype,		framedprotocol, \
		framedipaddress,  tbremotesipip" 
  • In the same file add the following attribute to Start, Update and Stop segments.
'%{Telcob-RemoteSipIP}'

For example, the start will become like the following;

start {
			#
			#  Insert a new record into the sessions table
			#
			query = "\
				INSERT INTO ${....acct_table1} \
					(${...column_list}) \
				VALUES \
					('%{Acct-Session-Id}', \
					'%{Acct-Unique-Session-Id}', \
					'%{SQL-User-Name}', \
					'%{Realm}', \
					'%{NAS-IP-Address}', \
					'%{%{NAS-Port-ID}:-%{NAS-Port}}', \
					'%{NAS-Port-Type}', \
					FROM_UNIXTIME(%{integer:Event-Timestamp}), \
					FROM_UNIXTIME(%{integer:Event-Timestamp}), \
					NULL, \
					'0', \
					'%{Acct-Authentic}', \
					'%{Connect-Info}', \
					'', \
					'0', \
					'0', \
					'%{Called-Station-Id}', \
					'%{Calling-Station-Id}', \
					'', \
					'%{Service-Type}', \
					'%{Framed-Protocol}', \
					'%{Framed-IP-Address}', \
					'%{Telcob-RemoteSipIP}')"

You can download the schema.sql and queries.sql files modified for all Telcobridges attributes from the following links;

MySQL queries.conf file edited for Telcobridges attributes
MySQL schema.sql file edited for Telcobridges attributes