Copyright © 2002, 2003 FhG FOKUS
Copyright © 2004, 2006 voice-system.ro
early_media
(integer)failed_transaction_flag
(integer)report_ack
(integer)report_cancels
(integer)detect_direction
(integer)multi_leg_info
(string)log_flag
(integer)log_missed_flag
(integer)log_level
(integer)log_extra
(string)radius_config
(string)radius_flag
(integer)radius_missed_flag
(integer)service_type
(integer)radius_extra
(string)db_flag
(integer)db_missed_flag
(integer)db_table_acc
(string)db_table_missed_calls
(string)db_url
(string)acc_method_column
(string)acc_from_tag_column
(string)acc_to_tag_column
(string)acc_callid_column
(string)acc_sip_code_column
(string)acc_sip_reason_column
(string)acc_time_column
(string)db_extra
(string)diameter_flag
(integer)diameter_missed_flag
(integer)diameter_client_host
(string)diameter_client_port
(int)diameter_extra
(string)acc_log_request(comment)
acc_db_request(comment, table)
acc_rad_request(comment)
acc_diam_request(comment)
ACC module is used to account transactions information to different backends like syslog, SQL, RADIUS and DIAMETER (beta version).
To account a transaction and to choose which set of backends to be used, the script writer just has to set some flags (see the module parameters section for flag definitions Section 1.5). If the accouting flag for a specific backend is set, the acc module will then report on completed transaction. 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. Even so, the module allows the script writter to force accouting in special cases via some script functions.
The accouting module will log by default a fixed set of attributes for the transaction - if you customize you accouting by adding more information to be logged, please see the next chapter about extra accouting - Section 1.2.
The fixed minimal accouting information is:
Request Method name
From header TAG parameter
To header TAG parameter
Call-Id
3-digit Status code from final reply
Reason phrase from final reply
Time stamp when transaction was completed
Note that:
A single INVITE may produce multiple accounting reports -- that's due to SIP forking feature
All flags related to accouting need to be set in request processing route - only the "missed-call" flag may be toggeled from other types of routes.
There is no session/dialog accounting (yet)-- OpenSER maintains no sessions. If one needs to correlate INVITEs with BYEs for generating proper CDRs for example for purpose of billing, then it is better done in the entity which collects accounting information.
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 PSTN gateway), which best knows about call status (including media status and PSTN status in case of the gateway).
The SQL backend support is compiled in the moduls. For RADIUS and DIAMETER you need to enable it by recompiling the module with properly set defines: uncomment the RAD_ACC or DDIAM_ACC lines in modules/acc/Makefile. To compile RADIUS support, you need to have radiusclient-ng (only versions higher or equal to 0.5.0) installed on your system which is available from http://developer.berlios.de/projects/radiusclient-ng/. The radius client needs to be configured properly. To do so, use the template at 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 at etc/sip_dictionary). Uses along with FreeRadius ( http://www.freeradius.org/) and Radiator ( http://www.open.com.au/radiator/) servers have been reported to us.
loadmodule "modules/acc/acc.so" modparam("acc", "log_level", 1) modparam("acc", "log_flag", 1) if (uri=~"sip:+40") /* calls to Romania */ { if (!proxy_authorize("sip_domain.net" /* realm */, "subscriber" /* table name */)) { proxy_challenge("sip_domain.net" /* realm */, "0" /* no qop */ ); exit; } if (method=="INVITE" & !check_from()) { log("from!=digest\n"); sl_send_reply("403","Forbidden"); } setflag(1); /* set for accounting (the same value as in log_flag!) t_relay(); /* enter stateful mode now */ };
Along the static default information, ACC modules allows dynamical selection of extra information to be logged. This allows you to log any pseudo-variable (AVPs, parts of the request, etc).
Selection of extra information is done via xxx_extra parameters by specifying the names of additional information you want to log. This information is defined via pseudo-variables and may include headers or AVPs values or other message or system values. The syntax of the parameter is:
xxx_extra = extra_definition (';'extra_definition)*
extra_definition = log_name '=' pseudo_variable
The full list of supported pseudo-variables in OpenSER is availabe at: http://openser.org/dokuwiki/doku.php/pseudovariables:1.2.x
Via log_name you define how/where the data will be logged. Its meaning depends of the accounting support which is used:
LOG accounting - log_name will be just printed along with the data in log_name=data format;
DB accounting - log_name will be the name of the DB column where the data will be stored.IMPORTANT: add in db acc table the columns corresponding to each extra data;
RADIUS accounting - log_name will be the AVP name used for packing the data into RADIUS message. The log_name will be translated to AVP number via the dictionary. IMPORTANT: add in RADIUS dictionary the log_name attribute.
DIAMETER accounting - log_name will be the AVP code used for packing the data into DIAMETER message. The AVP code is given directly as integer, since DIAMETER has no dictionary support yet. IMPORTANT: log_name must be a number.
Some pseudo variables may return more than one value (like headers or AVPs). In this case, the returned values are embedded in a single string in a comma-separated format.
A SIP call can have multiple legs due forwarding actions. For example user A calls user B which forwards the call to user C. There is only one SIP call but with 2 legs ( A to B and B to C). Accounting the legs of a call is required for proper billing of the calls (if C is a PSTN number and the call is billed, user B must pay for the call -as last party modifing the call destination-, and not A -as initiator of the call. Call forwarding on server is only one example which shows the necessity of the having an accounting engine with multiple legs support.
First how it works? The idea is to have a set of AVPs and for each call leg to store another set of values of the AVPs. The meaning the AVP content is stricly decided by the script writter - it can be the origin and source of the leg, its status or any other related imformation. If you have a set of 4 AVPS (AVP1, AVP2, AVP3, AVP4), then, for the A call B and B forwards to C example, the for each leg ([A,B] and [B,C]) you need to set a different set of values for the AVPs. The script writer must take care and properly insert all these AVP from the script (in proper order and with correct type).
When the accouning infomation for the call will be written/sent, all the call-leg pairs will be added (based on found AVP sets).
By default, the multiple call-legs support is disable - it can be
enabled just be setting the per-leg set of AVPs via the
multi_leg_info
module parameter.
For each call, all the values of the AVP set (which defines a call-leg) will be looged. How the information will be actually logged, depends of the data backend:
syslog -- all leg-sets will be added to one record string as AVP1=xxx, AVP2=xxxx ,... sets.
database -- each pair will be separatly logged (due DB data structure constraints); several records will be written, the difference between them being only the fields corresponding to the call-leg info.
You will need to add in your DB (all acc related tables) the colums for call-leg info (a column for each AVP for the set). |
Radius -- all sets will be added to same Radius accounting message as RADIUS AVPs - for each call-leg a set of RADIUS AVPs will be added (corresponding to the per-leg AVP set)
You will need to add in your dictionaty the RADIUS AVPs used in call-leg AVP set definition. |
Diameter same as for RADIUS.
The module depends on the following modules (in the other words the listed modules must be loaded before this module):
tm -- Transaction Manager
a database module -- If SQL support is used.
rr -- Record Route, if "detect_direction" module parameter is enabled.
The following libraries or applications must be installed before running OpenSER with this module loaded:
radiusclient-ng 0.5.0 or higher -- if compiled with RADIUS support. See http://developer.berlios.de/projects/radiusclient-ng/.
failed_transaction_flag
(integer)Per transaction flag which says if the transaction should be accounted also in case of failure (status>=300).
Default value is not-set (no flag).
report_ack
(integer)Shall acc attempt to account e2e ACKs too ? Note that this is really only an attempt, as e2e ACKs may take a different path (unless RR enabled) and mismatch original INVITE (e2e ACKs are a separate transaction).
Default value is 0 (no).
report_cancels
(integer)By default, CANCEL reporting is disabled -- most accounting applications are happy to see INVITE's cancellation status. Turn on if you explicitly want to account CANCEL transactions.
Default value is 0 (no).
detect_direction
(integer)Controlles the direction detection for sequential requests. If enabled (non zero value), for sequential requests with upstream direction (from callee to caller), the FROM and TO will be swapped (the direction will be preserved as in the original request).
It affects all values related to TO and FROM headers (body, URI, username, domain, TAG).
Default value is 0 (disabled).
multi_leg_info
(string)Defines the AVP set to be used in per-call-leg accoutning. See Section 1.3 for a detailed description of the Multi Call-Legs accounting.
If empty, the multi-leg accouting support will be disabled.
Default value is 0 (disabled).
Example 1-6. multi_leg_info example
# for syslog-based accouting, use any text you want to be printed modparam("acc", "multi_leg_info", "text1=$avp(src);text2=$avp(dst)") # for mysql-based accouting, use the names of the columns modparam("acc", "multi_leg_info", "leg_src=$avp(src);leg_dst=$avp(dst)") # for RADIUS-based accouting, use the names of the RADIUS AVPs modparam("acc", "multi_leg_info", "RAD_LEG_SRC=$avp(src);RAD_LEG_SRC=$avp(dst)") # for DIAMETER-based accouting, use the DIAMETER AVP ID (as integer) modparam("acc", "multi_leg_info", "2345=$avp(src);2346=$avp(dst)")
log_flag
(integer)Request flag which needs to be set to account a transaction via syslog.
Default value is not-set (no flag).
log_missed_flag
(integer)Request flag which needs to be set to account missed calls via syslog.
Default value is not-set (no flag).
log_level
(integer)Log level at which accounting messages are issued to syslog.
Default value is L_NOTICE.
radius_config
(string)This parameter is radius specific. Path to radius client configuration file, set the referred config file correctly and specify there address of server, shared secret (should equal that in /usr/local/etc/raddb/clients for freeRadius servers) and dictionary, see etc for an example of config file and dictionary.
If the parameter is set to empty string, the RADIUS accouting support will be disabled (even if compiled).
Default value is "/usr/local/etc/radiusclient/radiusclient.conf ".
radius_flag
(integer)Request flag which needs to be set to account a transaction -- RADIUS specific.
Default value is not-set (no flag).
radius_missed_flag
(integer)Request flag which needs to be set to account missed calls -- RADIUS specific.
Default value is not-set (no flag).
radius_extra
(string)Extra values to be logged via RADIUS - RADIUS specific.
Default value is NULL.
db_flag
(integer)Request flag which needs to be set to account a transaction -- database specific.
Default value is not-set (no flag).
db_missed_flag
(integer)Request flag which needs to be set to account missed calls -- database specific.
Default value is not-set (no flag).
db_table_acc
(string)Table name of accounting successfull calls -- database specific.
Default value is "acc"
db_table_missed_calls
(string)Table name for accounting missed calls -- database specific.
Default value is "missed_calls"
db_url
(string)SQL address -- database specific. If is set to NULL or emty string, the SQL support is disabled.
Default value is "NULL" (SQL disabled).
acc_method_column
(string)Column name in accouting table to store the request's method name as string.
Default value is "method".
acc_from_tag_column
(string)Column name in accouting table to store the From header TAG parameter.
Default value is "from_tag".
acc_to_tag_column
(string)Column name in accouting table to store the To header TAG parameter.
Default value is "to_tag".
acc_callid_column
(string)Column name in accouting table to store the request's Callid value.
Default value is "callid".
acc_sip_code_column
(string)Column name in accouting table to store the final reply's numric code value in string format.
Default value is "sip_code".
acc_sip_reason_column
(string)Column name in accouting table to store the final reply's reason phrase value.
Default value is "sip_reason".
acc_time_column
(string)Column name in accouting table to store the time stamp of the transaction completion in date-time format.
Default value is "time".
db_extra
(string)Extra values to be logged into database - DB specific.
Default value is NULL.
diameter_flag
(integer)Request flag which needs to be set to account a transaction -- DIAMETER specific.
Default value is not-set (no flag).
diameter_missed_flag
(integer)Request flag which needs to be set to account missed calls -- DIAMETER specific.
Default value is not-set (no flag).
diameter_client_host
(string)Hostname of the machine where the DIAMETER Client is running -- DIAMETER specific.
Default value is "localhost".
diameter_client_port
(int)Port number where the Diameter Client is listening -- DIAMETER specific.
Default value is 3000.
diameter_extra
(string)Extra values to be logged via DIAMETER - DIAMETER specific.
Default value is NULL.
acc_log_request(comment)
acc_request
reports on a request,
for example, it can be used to report on missed calls to off-line users
who are replied 404 - Not Found. To avoid multiple reports on UDP
request retransmission, you would need to embed the
action in stateful processing.
Meaning of the parameters is as follows:
comment - Comment to be appended.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
acc_db_request(comment, table)
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.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
acc_rad_request(comment)
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.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
acc_diam_request(comment)
Like acc_log_request
,
acc_diam_request
reports on
a request. It reports to the configured Diameter server.
Meaning of the parameters is as follows:
comment - Comment to be appended.
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE.
The parameter became obsolete with the restructure of the data logged by ACC module (refer to the Overview chapter). For similar behaviour you can use the extra accouting (see the coresponding chapter).
The parameter becaome obsolete by the addition of the new multi_leg_info parameter. The multi-leg accouting is automatically enabled when multi_leg_info is defined.
The parameter was replaced by the more generic new parameter multi_leg_info. This allows logging (per-leg) of more information than just dst and src.
Take a look at http://www.openser-project.org/.
First at all check if your question was already answered on one of our mailing lists:
User Mailing List - http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
Developer Mailing List - http://lists.openser-project.org/cgi-bin/mailman/listinfo/devel
E-mails regarding any stable OpenSER release should be sent to
<users@lists.openser-project.org>
and e-mails regarding development versions
should be sent to <devel@lists.openser-project.org>
.
If you want to keep the mail private, send it to
<team@lists.openser-project.org>
.
Please follow the guidelines provided at: http://sourceforge.net/tracker/?group_id=139143.