{
// CGRateS Configuration file
//
// Used in mediator_local_test
// Starts rater, cdrs and mediator connecting over internal channel

"stor_db": {								// database used to store offline tariff plans and CDRs
	"db_password": "CGRateS.org",			// password to use when connecting to stordb
},

"rals": {
	"enabled": true,						// enable Rater service: <true|false>
},

"scheduler": {
	"enabled": true,						// start Scheduler service: <true|false>
},

"cdrs": {
	"enabled": true,						// start the CDR Server service:  <true|false>
},

"chargers": {
	"enabled": true,
},

"cdrc": [
	{
		"id": "CDRC-CSV1",
		"enabled": true,							// enable CDR client functionality
		"cdr_in_path": "/tmp/cgrates/cdrc1/in",		// absolute path towards the directory where the CDRs are stored
		"cdr_out_path": "/tmp/cgrates/cdrc1/out",	// absolute path towards the directory where processed CDRs will be moved
		"cdr_source_id": "csv1",					// free form field, tag identifying the source of the CDRs within CDRS database
	},
	{
		"id": "CDRC-CSV2",
		"enabled": true,							// enable CDR client functionality
		"cdr_in_path": "/tmp/cgrates/cdrc2/in",		// absolute path towards the directory where the CDRs are stored
		"cdr_out_path": "/tmp/cgrates/cdrc2/out",	// absolute path towards the directory where processed CDRs will be moved
		"cdr_source_id": "csv2",					// free form field, tag identifying the source of the CDRs within CDRS database
		"content_fields":[								// import template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
			{"cdr_field_id": "tor", "value": "~7:s/^(voice|data|sms|generic)$/*$1/"},
			{"cdr_field_id": "accid", "value": "0"},
			{"cdr_field_id": "reqtype", "value": "^rated"},
			{"cdr_field_id": "direction", "value": "^*out"},
			{"cdr_field_id": "tenant", "value": "^cgrates.org"},
			{"cdr_field_id": "category", "value": "~7:s/^voice$/call/"},
			{"cdr_field_id": "account", "value": "3"},
			{"cdr_field_id": "subject", "value": "3"},
			{"cdr_field_id": "destination", "value": "~5:s/^0([1-9]\\d+)$/+49$1/"},
			{"cdr_field_id": "setup_time", "value": "1"},
			{"cdr_field_id": "answer_time", "value": "1"},
			{"cdr_field_id": "usage", "value": "~9:s/^(\\d+)$/${1}s/"},
		],
	},
	{
		"id": "CDRC-CSV3",
		"enabled": true,							// enable CDR client functionality
		"field_separator": ";",						// separator used in case of csv files
		"cdr_in_path": "/tmp/cgrates/cdrc3/in",		// absolute path towards the directory where the CDRs are stored
		"cdr_out_path": "/tmp/cgrates/cdrc3/out",	// absolute path towards the directory where processed CDRs will be moved
		"cdr_source_id": "csv3",					// free form field, tag identifying the source of the CDRs within CDRS database
		"content_fields":[								// import template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
			{"cdr_field_id": "tor", "value": "^*voice"},
			{"cdr_field_id": "accid", "value": "~3:s/^(\\d{2})\\.(\\d{2})\\.(\\d{4})\\s{2}(\\d{2}):(\\d{2}):(\\d{2})$/$1$2$3$4$5$6/"},
			{"cdr_field_id": "reqtype", "value": "^rated"},
			{"cdr_field_id": "direction", "value": "^*out"},
			{"cdr_field_id": "tenant", "value": "^cgrates.org"},
			{"cdr_field_id": "category", "value": "^call"},
			{"cdr_field_id": "account", "value": "~0:s/^([1-9]\\d+)$/+$1/"},
			{"cdr_field_id": "subject", "value": "~0:s/^([1-9]\\d+)$/+$1/"},
			{"cdr_field_id": "destination", "value": "~1:s/^([1-9]\\d+)$/+$1/"},
			{"cdr_field_id": "setup_time", "value": "4"},
			{"cdr_field_id": "answer_time", "value": "4"},
			{"cdr_field_id": "usage", "value": "~6:s/^(\\d+)$/${1}s/"},
		],
	}
],

"cdre": {
	"CDRE-FW1": {
		"export_format": "*file_fwv",
		"field_separator": "",
		"header_fields": [
			{"tag": "ToR", "type": "constant", "value": "10", "width": 2},
			{"tag": "Filler1", "type": "filler", "width": 3},
			{"tag": "FileType", "type": "constant", "value": "SIP", "width": 3},
			{"tag": "FileSeqNr", "type": "metatag", "value": "export_id", "padding": "zeroleft", "width": 5},
			{"tag": "LastCdr", "type": "metatag", "value": "last_cdr_atime", "layout": "020106150405", "width": 12},
			{"tag": "FileCreationfTime", "type": "metatag", "value": "time_now", "layout": "020106150405", "width": 12},
			{"tag": "FileVersion", "type": "constant", "value": "01", "width": 2},
			{"tag": "Filler2", "type": "filler", "width": 105},
		],							// template of the exported header fields
		"content_fields": [								// template of the exported content fields
			{"tag": "ToR", "type": "constant", "value": "20", "width": 2},
			{"tag": "Subject", "type": "cdrfield", "value": "subject", "width": 12, "padding": "right", "mandatory": true},
			{"tag": "ConnectionNumber", "type": "constant", "value": "00000", "width": 5},
			{"tag": "CallerId", "type": "cdrfield", "value": "~callerid:s/\\+(\\d+)/00$1/", "strip": "xright", "width": 15, "padding": "right"},
			{"tag": "Destination", "type": "cdrfield", "value": "~destination:s/^\\+311400(\\d+)/$1/:s/^\\+311412\\d\\d112/112/:s/^\\+31(\\d+)/0$1/:s/^\\+(\\d+)/00$1/",
				"strip": "xright", "width": 24, "padding": "right", "mandatory": true},
			{"tag": "TypeOfService", "type": "constant", "value": "00", "width": 2},
			{"tag": "ServiceId", "type": "constant", "value": "11", "width": 4, "padding": "right"},
			{"tag": "AnswerTime", "type": "cdrfield", "value": "answer_time", "layout": "020106150405", "width": 12, "mandatory": true},
			{"tag": "Usage", "type": "cdrfield", "value": "usage", "layout": "seconds", "width": 6, "padding": "right", "mandatory": true},
			{"tag": "DataCounter", "type": "filler", "width": 6},
			{"tag": "VatCode", "type": "constant", "value": "1", "width": 1},
			{"tag": "NetworkId", "type": "constant", "value": "S1", "width": 2},
			{"tag": "DestinationSubId", "type": "cdrfield", "value": "~cost_details:s/MatchedDestId:.+_(\\w{5})/$1/:s/(\\w{6})/$1/", "width": 5},
			{"tag": "NetworkSubtype", "type": "constant", "value": "3", "width": 1, "padding": "left"},
			{"tag": "CgrId", "type": "cdrfield", "value": "cgrid", "strip": "xleft", "width": 16, "padding": "right", "mandatory": true},
			{"tag": "FillerVolume1", "type": "filler", "width": 8},
			{"tag": "FillerVolume2", "type": "filler", "width": 8},
			{"tag": "DestinationSubId", "type": "cdrfield", "value": "~cost_details:s/MatchedDestId:.+_(\\w{5})/$1/:s/(\\w{6})/$1/", "width": 5},
			{"tag": "Cost", "type": "cdrfield", "value": "cost", "padding": "zeroleft", "width": 9},
			{"tag": "MaskDestination", "type": "metatag", "value": "mask_destination", "width": 1},
		],
		"trailer_fields": [
			{"tag": "ToR", "type": "constant", "value": "90", "width": 2},
			{"tag": "Filler1", "type": "filler", "width": 3},
			{"tag": "FileType", "type": "constant", "value": "SIP", "width": 3},
			{"tag": "FileSeqNr", "type": "metatag", "value": "export_id", "padding": "zeroleft", "width": 5},
			{"tag": "TotalRecords", "type": "metatag", "value": "cdrs_number", "padding": "zeroleft", "width": 6},
			{"tag": "TotalDuration", "type": "metatag", "value": "cdrs_duration", "padding": "zeroleft", "width": 8},
			{"tag": "FirstCdrTime", "type": "metatag", "value": "first_cdr_atime", "layout": "020106150405", "width": 12},
			{"tag": "LastCdrTime", "type": "metatag", "value": "last_cdr_atime", "layout": "020106150405", "width": 12},
			{"tag": "Filler1", "type": "filler", "width": 93},
		],							// template of the exported trailer fields
	}
},


"apier": {
	"scheduler_conns": [					// connections to SchedulerS for reloads
		{"address": "*internal"},
	],
},


}
