From db529892563d945a2cb3f0ff843156f3729ae1da Mon Sep 17 00:00:00 2001 From: DanB Date: Thu, 9 Jun 2016 15:56:01 +0200 Subject: [PATCH] CDRE - remove default configuration for FieldID since it makes no sense there --- config/config_defaults.go | 77 +++++++++++++++++---------------- config/config_json_test.go | 79 ++++++++++++++-------------------- data/conf/cgrates/cgrates.json | 74 +++++++++++++++---------------- 3 files changed, 108 insertions(+), 122 deletions(-) diff --git a/config/config_defaults.go b/config/config_defaults.go index 5b1ea8175..a63292c69 100644 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -133,43 +133,6 @@ const CGRATES_CFG_JSON = ` }, -"cdre": { - "*default": { - "cdr_format": "csv", // exported CDRs format - "field_separator": ",", - "data_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from KBytes to Bytes) - "sms_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from SMS unit to call duration in some billing systems) - "mms_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from MMS unit to call duration in some billing systems) - "generic_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from GENERIC unit to call duration in some billing systems) - "cost_multiply_factor": 1, // multiply cost before export, eg: add VAT - "cost_rounding_decimals": -1, // rounding decimals for Cost values. -1 to disable rounding - "cost_shift_digits": 0, // shift digits in the cost on export (eg: convert from EUR to cents) - "mask_destination_id": "MASKED_DESTINATIONS", // destination id containing called addresses to be masked on export - "mask_length": 0, // length of the destination suffix to be masked - "export_folder": "/var/log/cgrates/cdre", // path where the exported CDRs will be placed - "header_fields": [], // template of the exported header fields - "content_fields": [ // template of the exported content fields - {"tag": "CGRID", "field_id": "CGRID", "type": "*composed", "value": "CGRID"}, - {"tag":"RunID", "field_id": "RunID", "type": "*composed", "value": "RunID"}, - {"tag":"TOR", "field_id": "ToR", "type": "*composed", "value": "ToR"}, - {"tag":"OriginID", "field_id": "OriginID", "type": "*composed", "value": "OriginID"}, - {"tag":"RequestType", "field_id": "RequestType", "type": "*composed", "value": "RequestType"}, - {"tag":"Direction", "field_id": "Direction", "type": "*composed", "value": "Direction"}, - {"tag":"Tenant", "field_id": "Tenant", "type": "*composed", "value": "Tenant"}, - {"tag":"Category", "field_id": "Category", "type": "*composed", "value": "Category"}, - {"tag":"Account", "field_id": "Account", "type": "*composed", "value": "Account"}, - {"tag":"Subject", "field_id": "Subject", "type": "*composed", "value": "Subject"}, - {"tag":"Destination", "field_id": "Destination", "type": "*composed", "value": "Destination"}, - {"tag":"SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, - {"tag":"AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, - {"tag":"Usage", "field_id": "Usage", "type": "*composed", "value": "Usage"}, - {"tag":"Cost", "field_id": "Cost", "type": "*composed", "value": "Cost"}, - ], - "trailer_fields": [], // template of the exported trailer fields - } -}, - - "cdrc": [ { "id": "*default", // identifier of the CDRC runner @@ -187,7 +150,7 @@ const CGRATES_CFG_JSON = ` "cdr_in_dir": "/var/log/cgrates/cdrc/in", // absolute path towards the directory where the CDRs are stored "cdr_out_dir": "/var/log/cgrates/cdrc/out", // absolute path towards the directory where processed CDRs will be moved "failed_calls_prefix": "missed_calls", // used in case of flatstore CDRs to avoid searching for BYE records - "cdr_path": "", // path towards one CDR element in case of XML CDRs + "cdr_path": "", // path towards one CDR element in case of XML CDRs "cdr_source_id": "freeswitch_csv", // free form field, tag identifying the source of the CDRs within CDRS database "cdr_filter": "", // filter CDR records to import "continue_on_success": false, // continue to the next template if executed @@ -211,6 +174,44 @@ const CGRATES_CFG_JSON = ` }, ], + +"cdre": { + "*default": { + "cdr_format": "csv", // exported CDRs format + "field_separator": ",", + "data_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from KBytes to Bytes) + "sms_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from SMS unit to call duration in some billing systems) + "mms_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from MMS unit to call duration in some billing systems) + "generic_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from GENERIC unit to call duration in some billing systems) + "cost_multiply_factor": 1, // multiply cost before export, eg: add VAT + "cost_rounding_decimals": -1, // rounding decimals for Cost values. -1 to disable rounding + "cost_shift_digits": 0, // shift digits in the cost on export (eg: convert from EUR to cents) + "mask_destination_id": "MASKED_DESTINATIONS", // destination id containing called addresses to be masked on export + "mask_length": 0, // length of the destination suffix to be masked + "export_folder": "/var/log/cgrates/cdre", // path where the exported CDRs will be placed + "header_fields": [], // template of the exported header fields + "content_fields": [ // template of the exported content fields + {"tag": "CGRID", "type": "*composed", "value": "CGRID"}, + {"tag":"RunID", "type": "*composed", "value": "RunID"}, + {"tag":"TOR", "type": "*composed", "value": "ToR"}, + {"tag":"OriginID", "type": "*composed", "value": "OriginID"}, + {"tag":"RequestType", "type": "*composed", "value": "RequestType"}, + {"tag":"Direction", "type": "*composed", "value": "Direction"}, + {"tag":"Tenant", "type": "*composed", "value": "Tenant"}, + {"tag":"Category", "type": "*composed", "value": "Category"}, + {"tag":"Account", "type": "*composed", "value": "Account"}, + {"tag":"Subject", "type": "*composed", "value": "Subject"}, + {"tag":"Destination", "type": "*composed", "value": "Destination"}, + {"tag":"SetupTime", "type": "*composed", "value": "SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, + {"tag":"AnswerTime", "type": "*composed", "value": "AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, + {"tag":"Usage", "type": "*composed", "value": "Usage"}, + {"tag":"Cost", "type": "*composed", "value": "Cost"}, + ], + "trailer_fields": [], // template of the exported trailer fields + }, +}, + + "sm_generic": { "enabled": false, // starts SessionManager service: "listen_bijson": "127.0.0.1:2014", // address where to listen for bidirectional JSON-RPC requests diff --git a/config/config_json_test.go b/config/config_json_test.go index 2d84fe02f..dc0070849 100644 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -188,67 +188,52 @@ func TestDfCdreJsonCfgs(t *testing.T) { eFields := []*CdrFieldJsonCfg{} eContentFlds := []*CdrFieldJsonCfg{ &CdrFieldJsonCfg{Tag: utils.StringPointer("CGRID"), - Field_id: utils.StringPointer(utils.CGRID), - Type: utils.StringPointer(utils.META_COMPOSED), - Value: utils.StringPointer(utils.CGRID)}, + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer(utils.CGRID)}, &CdrFieldJsonCfg{Tag: utils.StringPointer("RunID"), - Field_id: utils.StringPointer(utils.MEDI_RUNID), - Type: utils.StringPointer(utils.META_COMPOSED), - Value: utils.StringPointer(utils.MEDI_RUNID)}, + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer(utils.MEDI_RUNID)}, &CdrFieldJsonCfg{Tag: utils.StringPointer("TOR"), - Field_id: utils.StringPointer(utils.TOR), - Type: utils.StringPointer(utils.META_COMPOSED), - Value: utils.StringPointer(utils.TOR)}, + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer(utils.TOR)}, &CdrFieldJsonCfg{Tag: utils.StringPointer("OriginID"), - Field_id: utils.StringPointer(utils.ACCID), - Type: utils.StringPointer(utils.META_COMPOSED), - Value: utils.StringPointer(utils.ACCID)}, + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer(utils.ACCID)}, &CdrFieldJsonCfg{Tag: utils.StringPointer("RequestType"), - Field_id: utils.StringPointer(utils.REQTYPE), - Type: utils.StringPointer(utils.META_COMPOSED), - Value: utils.StringPointer(utils.REQTYPE)}, + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer(utils.REQTYPE)}, &CdrFieldJsonCfg{Tag: utils.StringPointer("Direction"), - Field_id: utils.StringPointer(utils.DIRECTION), - Type: utils.StringPointer(utils.META_COMPOSED), - Value: utils.StringPointer(utils.DIRECTION)}, + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer(utils.DIRECTION)}, &CdrFieldJsonCfg{Tag: utils.StringPointer("Tenant"), - Field_id: utils.StringPointer(utils.TENANT), - Type: utils.StringPointer(utils.META_COMPOSED), - Value: utils.StringPointer(utils.TENANT)}, + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer(utils.TENANT)}, &CdrFieldJsonCfg{Tag: utils.StringPointer("Category"), - Field_id: utils.StringPointer(utils.CATEGORY), - Type: utils.StringPointer(utils.META_COMPOSED), - Value: utils.StringPointer(utils.CATEGORY)}, + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer(utils.CATEGORY)}, &CdrFieldJsonCfg{Tag: utils.StringPointer("Account"), - Field_id: utils.StringPointer(utils.ACCOUNT), - Type: utils.StringPointer(utils.META_COMPOSED), - Value: utils.StringPointer(utils.ACCOUNT)}, + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer(utils.ACCOUNT)}, &CdrFieldJsonCfg{Tag: utils.StringPointer("Subject"), - Field_id: utils.StringPointer(utils.SUBJECT), - Type: utils.StringPointer(utils.META_COMPOSED), - Value: utils.StringPointer(utils.SUBJECT)}, + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer(utils.SUBJECT)}, &CdrFieldJsonCfg{Tag: utils.StringPointer("Destination"), - Field_id: utils.StringPointer(utils.DESTINATION), - Type: utils.StringPointer(utils.META_COMPOSED), - Value: utils.StringPointer(utils.DESTINATION)}, + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer(utils.DESTINATION)}, &CdrFieldJsonCfg{Tag: utils.StringPointer("SetupTime"), - Field_id: utils.StringPointer(utils.SETUP_TIME), - Type: utils.StringPointer(utils.META_COMPOSED), - Value: utils.StringPointer(utils.SETUP_TIME), - Layout: utils.StringPointer("2006-01-02T15:04:05Z07:00")}, + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer(utils.SETUP_TIME), + Layout: utils.StringPointer("2006-01-02T15:04:05Z07:00")}, &CdrFieldJsonCfg{Tag: utils.StringPointer("AnswerTime"), - Field_id: utils.StringPointer(utils.ANSWER_TIME), - Type: utils.StringPointer(utils.META_COMPOSED), - Value: utils.StringPointer(utils.ANSWER_TIME), - Layout: utils.StringPointer("2006-01-02T15:04:05Z07:00")}, + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer(utils.ANSWER_TIME), + Layout: utils.StringPointer("2006-01-02T15:04:05Z07:00")}, &CdrFieldJsonCfg{Tag: utils.StringPointer("Usage"), - Field_id: utils.StringPointer(utils.USAGE), - Type: utils.StringPointer(utils.META_COMPOSED), - Value: utils.StringPointer(utils.USAGE)}, + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer(utils.USAGE)}, &CdrFieldJsonCfg{Tag: utils.StringPointer("Cost"), - Field_id: utils.StringPointer(utils.COST), - Type: utils.StringPointer(utils.META_COMPOSED), - Value: utils.StringPointer(utils.COST)}, + Type: utils.StringPointer(utils.META_COMPOSED), + Value: utils.StringPointer(utils.COST)}, } eCfg := map[string]*CdreJsonCfg{ utils.META_DEFAULT: &CdreJsonCfg{ diff --git a/data/conf/cgrates/cgrates.json b/data/conf/cgrates/cgrates.json index 53e3e8910..65ee76346 100644 --- a/data/conf/cgrates/cgrates.json +++ b/data/conf/cgrates/cgrates.json @@ -112,43 +112,6 @@ // }, -// "cdre": { -// "*default": { -// "cdr_format": "csv", // exported CDRs format -// "field_separator": ",", -// "data_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from KBytes to Bytes) -// "sms_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from SMS unit to call duration in some billing systems) -// "mms_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from MMS unit to call duration in some billing systems) -// "generic_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from GENERIC unit to call duration in some billing systems) -// "cost_multiply_factor": 1, // multiply cost before export, eg: add VAT -// "cost_rounding_decimals": -1, // rounding decimals for Cost values. -1 to disable rounding -// "cost_shift_digits": 0, // shift digits in the cost on export (eg: convert from EUR to cents) -// "mask_destination_id": "MASKED_DESTINATIONS", // destination id containing called addresses to be masked on export -// "mask_length": 0, // length of the destination suffix to be masked -// "export_folder": "/var/log/cgrates/cdre", // path where the exported CDRs will be placed -// "header_fields": [], // template of the exported header fields -// "content_fields": [ // template of the exported content fields -// {"tag": "CGRID", "field_id": "CGRID", "type": "*composed", "value": "CGRID"}, -// {"tag":"RunID", "field_id": "RunID", "type": "*composed", "value": "RunID"}, -// {"tag":"TOR", "field_id": "ToR", "type": "*composed", "value": "ToR"}, -// {"tag":"OriginID", "field_id": "OriginID", "type": "*composed", "value": "OriginID"}, -// {"tag":"RequestType", "field_id": "RequestType", "type": "*composed", "value": "RequestType"}, -// {"tag":"Direction", "field_id": "Direction", "type": "*composed", "value": "Direction"}, -// {"tag":"Tenant", "field_id": "Tenant", "type": "*composed", "value": "Tenant"}, -// {"tag":"Category", "field_id": "Category", "type": "*composed", "value": "Category"}, -// {"tag":"Account", "field_id": "Account", "type": "*composed", "value": "Account"}, -// {"tag":"Subject", "field_id": "Subject", "type": "*composed", "value": "Subject"}, -// {"tag":"Destination", "field_id": "Destination", "type": "*composed", "value": "Destination"}, -// {"tag":"SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, -// {"tag":"AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, -// {"tag":"Usage", "field_id": "Usage", "type": "*composed", "value": "Usage"}, -// {"tag":"Cost", "field_id": "Cost", "type": "*composed", "value": "Cost"}, -// ], -// "trailer_fields": [], // template of the exported trailer fields -// } -// }, - - // "cdrc": [ // { // "id": "*default", // identifier of the CDRC runner @@ -191,6 +154,43 @@ // ], +// "cdre": { +// "*default": { +// "cdr_format": "csv", // exported CDRs format +// "field_separator": ",", +// "data_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from KBytes to Bytes) +// "sms_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from SMS unit to call duration in some billing systems) +// "mms_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from MMS unit to call duration in some billing systems) +// "generic_usage_multiply_factor": 1, // multiply data usage before export (eg: convert from GENERIC unit to call duration in some billing systems) +// "cost_multiply_factor": 1, // multiply cost before export, eg: add VAT +// "cost_rounding_decimals": -1, // rounding decimals for Cost values. -1 to disable rounding +// "cost_shift_digits": 0, // shift digits in the cost on export (eg: convert from EUR to cents) +// "mask_destination_id": "MASKED_DESTINATIONS", // destination id containing called addresses to be masked on export +// "mask_length": 0, // length of the destination suffix to be masked +// "export_folder": "/var/log/cgrates/cdre", // path where the exported CDRs will be placed +// "header_fields": [], // template of the exported header fields +// "content_fields": [ // template of the exported content fields +// {"tag": "CGRID", "type": "*composed", "value": "CGRID"}, +// {"tag":"RunID", "type": "*composed", "value": "RunID"}, +// {"tag":"TOR", "type": "*composed", "value": "ToR"}, +// {"tag":"OriginID", "type": "*composed", "value": "OriginID"}, +// {"tag":"RequestType", "type": "*composed", "value": "RequestType"}, +// {"tag":"Direction", "type": "*composed", "value": "Direction"}, +// {"tag":"Tenant", "type": "*composed", "value": "Tenant"}, +// {"tag":"Category", "type": "*composed", "value": "Category"}, +// {"tag":"Account", "type": "*composed", "value": "Account"}, +// {"tag":"Subject", "type": "*composed", "value": "Subject"}, +// {"tag":"Destination", "type": "*composed", "value": "Destination"}, +// {"tag":"SetupTime", "type": "*composed", "value": "SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, +// {"tag":"AnswerTime", "type": "*composed", "value": "AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, +// {"tag":"Usage", "type": "*composed", "value": "Usage"}, +// {"tag":"Cost", "type": "*composed", "value": "Cost"}, +// ], +// "trailer_fields": [], // template of the exported trailer fields +// }, +// }, + + // "sm_generic": { // "enabled": false, // starts SessionManager service: // "listen_bijson": "127.0.0.1:2014", // address where to listen for bidirectional JSON-RPC requests