From 993c5400aabf1b3073b370bc39b129ce8cf77832 Mon Sep 17 00:00:00 2001 From: DanB Date: Mon, 13 Jan 2014 13:47:25 +0100 Subject: [PATCH] Static fields in CDRC tutorial example, rotate csv files by script provided --- .../fs_csv/cgrates/etc/cgrates/cgrates.cfg | 22 +++++++++---------- docs/tut_freeswitch_csv.rst | 7 ++++-- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/data/tutorials/fs_csv/cgrates/etc/cgrates/cgrates.cfg b/data/tutorials/fs_csv/cgrates/etc/cgrates/cgrates.cfg index a5ccac8c6..215fd6513 100644 --- a/data/tutorials/fs_csv/cgrates/etc/cgrates/cgrates.cfg +++ b/data/tutorials/fs_csv/cgrates/etc/cgrates/cgrates.cfg @@ -64,17 +64,17 @@ cdr_type = freeswitch_csv # CDR file format . 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: :[,:] +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: : [mediator] enabled = true # Starts Mediator service: . diff --git a/docs/tut_freeswitch_csv.rst b/docs/tut_freeswitch_csv.rst index 6721cdbf3..80de413e2 100644 --- a/docs/tut_freeswitch_csv.rst +++ b/docs/tut_freeswitch_csv.rst @@ -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.