ProSBC:FreeRadius configuration for Accounting: Difference between revisions
| (10 intermediate revisions by the same user not shown) | |||
| Line 8: | Line 8: | ||
=Prerequisites= | =Prerequisites= | ||
*[[ProSBC|ProSBC]] devices must be installed as described in their respective with release 3.0.x/3.1.x. [[Product_Installation_SBC|installation guides]]. | *[[ProSBC|ProSBC]] devices must be installed as described in their respective with release 3.0.x/3.1.x. [[Product_Installation_SBC|installation guides]]. | ||
*FreeRadius. For additional information on FreeRadius, visit [https://freeradius.org/ FreeRadius official web site]. | *FreeRadius. Must be installed. For additional information on FreeRadius, visit [https://freeradius.org/ FreeRadius official web site]. | ||
= Configuration Steps = | = Configuration Steps = | ||
| Line 20: | Line 20: | ||
* Add access for each Telcobridges device editing the clients.conf file located in the /etc/raddb directory. | * Add access for each Telcobridges device editing the clients.conf file located in the /etc/raddb directory. | ||
client IPAddressof | client IPAddressof the Telcobridges { | ||
secret = server_secret | secret = server_secret | ||
shortname = shortname of the device | shortname = shortname of the device | ||
} | } | ||
**'''secret = ''' Need to be same as configured in the Telcobridges Radius configuration | **'''secret = ''' Need to be same as configured in the Telcobridges Radius configuration | ||
* 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. | |||
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; | * Add the following line to the dictionary file. If not exist you can create it; | ||
$INCLUDE dictionary.telcobridges | $INCLUDE dictionary.telcobridges | ||
* Restart the FreeRadius | * Restart the FreeRadius | ||
* Make a test call and check the folder /var/log/radius/radacct to see if new logs are created. | * 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=== | ===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 Telcob-RemoteSipIP attribute | * 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 | * 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 | ||
<pre> CREATE TABLE radacct ( | <pre> CREATE TABLE radacct ( | ||
| Line 61: | Line 69: | ||
framedipaddress varchar(15) NOT NULL default '', | framedipaddress varchar(15) NOT NULL default '', | ||
tbremotesipip varchar(15) NOT NULL default '', </pre> | tbremotesipip varchar(15) NOT NULL default '', </pre> | ||
* update the MySQL db with a new schema. run the following command and restart the FreeRadius | |||
<pre> mysql -u username -ppassword -dbname < schema.sql </pre> | |||
* 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; | * 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; | ||
<pre> column_list = "\ | <pre> column_list = "\ | ||
| Line 73: | Line 84: | ||
* In the same file add the following attribute to Start, Update and Stop segments. | * In the same file add the following attribute to Start, Update and Stop segments. | ||
<pre>'%{Telcob-RemoteSipIP}'</pre> | <pre>'%{Telcob-RemoteSipIP}'</pre> | ||
For example, the start will become like the following; | |||
<pre> | |||
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}')" | |||
</pre> | |||
You can download the schema.sql and queries.sql files modified for all Telcobridges attributes from the following links; | |||
[[Media:queries.zip|MySQL queries.conf file edited for Telcobridges attributes]] <br> | |||
[[Media:schema.zip|MySQL schema.sql file edited for Telcobridges attributes]] | |||
Latest revision as of 03:29, 18 October 2021
Introduction
This Configuration Note describes how to set up FreeRadius for accounting with Telcobridges products.
Prerequisites
- ProSBC devices must be installed as described in their respective with release 3.0.x/3.1.x. installation guides.
- FreeRadius. Must be installed. For additional information on FreeRadius, visit FreeRadius official web site.
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