mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Static fields in CDRC tutorial example, rotate csv files by script provided
This commit is contained in:
@@ -64,17 +64,17 @@ cdr_type = freeswitch_csv # CDR file format <csv>.
|
||||
cdr_in_dir = /var/log/freeswitch/cdr-csv # Absolute path towards the directory where the CDRs are stored.
|
||||
cdr_out_dir = /tmp # Absolute path towards the directory where processed CDRs will be moved.
|
||||
cdr_source_id = freeswitch_csv # Free form field, tag identifying the source of the CDRs within CGRS database.
|
||||
# accid_field = 0 # Accounting id field identifier. Use index number in case of .csv cdrs.
|
||||
# reqtype_field = 1 # Request type field identifier. Use index number in case of .csv cdrs.
|
||||
# direction_field = 2 # Direction field identifier. Use index numbers in case of .csv cdrs.
|
||||
# tenant_field = 3 # Tenant field identifier. Use index numbers in case of .csv cdrs.
|
||||
# tor_field = 4 # Type of Record field identifier. Use index numbers in case of .csv cdrs.
|
||||
# account_field = 5 # Account field identifier. Use index numbers in case of .csv cdrs.
|
||||
# subject_field = 6 # Subject field identifier. Use index numbers in case of .csv CDRs.
|
||||
# destination_field = 7 # Destination field identifier. Use index numbers in case of .csv cdrs.
|
||||
# answer_time_field = 8 # Answer time field identifier. Use index numbers in case of .csv cdrs.
|
||||
# duration_field = 9 # Duration field identifier. Use index numbers in case of .csv cdrs.
|
||||
# extra_fields = 10:supplier,11:orig_ip # Extra fields identifiers. For .csv, format: <index_extrafield_1>:<label_extrafield_1>[,<index_extrafield_n>:<label_extrafield_n>]
|
||||
accid_field = 10 # Accounting id field identifier. Use index number in case of .csv cdrs.
|
||||
reqtype_field = 15 # Request type field identifier. Use index number in case of .csv cdrs.
|
||||
direction_field = ^*out # Direction field identifier. Use index numbers in case of .csv cdrs.
|
||||
tenant_field = ^cgrates.org # Tenant field identifier. Use index numbers in case of .csv cdrs.
|
||||
tor_field = ^call # Type of Record field identifier. Use index numbers in case of .csv cdrs.
|
||||
account_field = 1 # Account field identifier. Use index numbers in case of .csv cdrs.
|
||||
subject_field = 1 # Subject field identifier. Use index numbers in case of .csv CDRs.
|
||||
destination_field = 2 # Destination field identifier. Use index numbers in case of .csv cdrs.
|
||||
answer_time_field = 5 # Answer time field identifier. Use index numbers in case of .csv cdrs.
|
||||
duration_field = 8 # Duration field identifier. Use index numbers in case of .csv cdrs.
|
||||
extra_fields = read_codec:13,write_codec:14 # Extra fields identifiers. For .csv, format: <label_extrafield1>:<index_extrafield_1>
|
||||
|
||||
[mediator]
|
||||
enabled = true # Starts Mediator service: <true|false>.
|
||||
|
||||
@@ -152,11 +152,14 @@ CDR processing
|
||||
--------------
|
||||
|
||||
For every call FreeSWITCH_ will generate CDR records within the *Master.csv* file.
|
||||
In order to avoid double-processing we will use the rotate mechanism built in FreeSWITCH_. We rotate files via *fs_console* command:
|
||||
In order to avoid double-processing we will use the rotate mechanism built in FreeSWITCH_.
|
||||
Once rotated, we will move the resulted files inside the path considered by **CGRateS** *CDRC* component as inbound.
|
||||
|
||||
These steps are automated in a script provided in the */usr/share/cgrates/scripts* location:
|
||||
|
||||
::
|
||||
|
||||
fs_cli -x "cdr_csv rotate"
|
||||
/usr/share/cgrates/scripts/freeswitch_cdr_csv_rotate.sh
|
||||
|
||||
|
||||
On each rotate CGR-CDRC component will be informed via *inotify* subsystem and will instantly process the CDR file. The records end up in **CGRateS**/StorDB inside *cdrs_primary* table via CGR-CDRS. As soon as the CDR will hit CDRS component, mediation will occur, either considering the costs calculated in case of prepaid and postpaid calls out of *cost_details* table or query it's own one from rater in case of *pseudoprepaid* and *rated* CDRs.
|
||||
|
||||
Reference in New Issue
Block a user