Standard
acc module is used to report on transactionsi [1] to syslog, SQL and RADIUSi [2].
To report on a transactioni [3] using syslog, use "setflag" to mark a transaction you are interested in with a flag, load accounting module and set its "log_flag" to the same flag number. The acc module will then report on completed transaction to syslog. A typical usage of the module takes no acc-specific script command -- the functionality binds invisibly through transaction processing. Script writers just need to mark the transaction for accounting with proper setflag.
Jiri Kuthan
jiri@iptel.org [4]>
Copyright © 2002, 2003 FhG FOKUS
| Revision History | |
|---|---|
| Revision $Revision: 1.1 $ | $Date: 2005/11/15 12:04:05 $ |
i [5] to syslog, SQL and RADIUSi [6].
To report on a transactioni [7] using syslog, use "setflag" to mark a transaction you are interested in with a flag, load accounting module and set its "log_flag" to the same flag number. The acc module will then report on completed transaction to syslog. A typical usage of the module takes no acc-specific script command -- the functionality binds invisibly through transaction processing. Script writers just need to mark the transaction for accounting with proper setflag.
What is printed depends on module's "log_fmt" parameter. It's a string with characters specifying which parts of request should be printed:
-
c = Call-Id
-
d = To tagi [8] (Dst)
-
f = From
-
i = Inbound Request-URIi [9]i [10]
-
m = Method
-
o = Outbound Request-URI
-
r = fRom
-
s = Status
-
t = To
-
u = digest Username
-
p = username Part of inbound Request-URI
If a value is not present in request, "n/a" is accounted instead.
Note
-
A single INVITE may produce multiple accounting reports -- that's due to SIP forkingi [11] feature
-
Subsequent ACKs and other requests do not hit the server and can't be accounted unless record-routing is enforced. The ACKs assert very little useful information anyway and reporting on INVITE's 200 makes most accounting scenarios happy.
-
There is no session accounting -- seri [12] maintains no sessions. If one needs to correlate INVITEs with BYEs for example for purpose of billing, then it is better done in the entity which collects accounting information. Otherwise, SIP server would have to become sessions-statefuli [13], which would very badly impact its scalability.
-
If a UA fails in middle of conversation, a proxy will never learn it. In general, a better practice is to account from an end-device (such as PSTNi [14] gateway), which best knows about call status (including media status and PSTN status in case of the gateway).
Support for SQL and RADIUS works analogously. You need to enable it by recompiling the module with properly set defines. Uncomment the SQL_ACC and RAD_ACC lines in modules/acc/Makefile. To compile SQL support, you need to have mysqlclient package on your system. To compile RADIUS support, you need to have radiusclient installed on your system (version 0.5.0 or higher is required) which is available from http://developer.berlios.de/projects/radiusclient-ng/ [15]. The radius client needs to be configured properly. To do so, use the template in sip_router/etc/radiusclient.conf and make sure that module's radius_config parameter points to its location. In particular, accounting secret must match that one configured in server and proper dictionary is used (one is available in ). Uses along with FreeRADIUS [16] and Radiator [17] servers have been reported to us.
Both mysql and radius libraries must be dynamically linkable. You need to configure your OS so that SERi [18], when started, will find them. Typically, you do so by manipulating LD_LIBRARY_PATH environment variable or configuring ld.so.
Default value is 1.
Meaning of the parameters is as follows:
-
comment - Comment to be appended.
Like acc_log_request, acc_db_request reports on a request. The report is sent to database at "db_url", in the table referred to in the second action parameter
Meaning of the parameters is as follows:
-
comment - Comment to be appended.
-
table - Database table to be used.
Like acc_log_request, acc_rad_request reports on a request. It reports to radius server as configured in "radius_config".
Meaning of the parameters is as follows:
-
comment - Comment to be appended.
Links:
[1] http://www.iptel.org/glossary#term69
[2] http://www.iptel.org/glossary#term171
[3] http://www.iptel.org/glossary#term69
[4] http://www.iptel.org/mailto:jiri@iptel.org
[5] http://www.iptel.org/glossary#term69
[6] http://www.iptel.org/glossary#term171
[7] http://www.iptel.org/glossary#term69
[8] http://www.iptel.org/glossary#term256
[9] http://www.iptel.org/glossary#term81
[10] http://www.iptel.org/glossary#term80
[11] http://www.iptel.org/glossary#term68
[12] http://www.iptel.org/glossary/term/244
[13] http://www.iptel.org/glossary#term71
[14] http://www.iptel.org/glossary#term218
[15] http://developer.berlios.de/projects/radiusclient-ng/
[16] http://www.freeradius.org
[17] http://www.open.com.au/radiator
[18] http://www.iptel.org/glossary/term/244
[19] http://www.iptel.org/glossary#term170
[20] http://www.iptel.org/glossary#term72