{
// CGRateS Configuration file
//


"general": {
	"log_level": 7,
},


"listen": {
	"rpc_json": ":2012",
	"rpc_gob": ":2013",
	"http": ":2080",
},

"data_db": {								// database used to store runtime data (eg: accounts, cdr stats)
	"db_type": "redis",						// data_db type: <redis|mongo>
	"db_port": 6379, 						// data_db port to reach the database
	"db_name": "10", 						// data_db database name to connect to
},

"stor_db": {
	"db_password": "CGRateS.org",
},


"rals": {
	"enabled": true,
	"thresholds_conns": [
		{"address": "*internal"},
	],
},


"scheduler": {
	"enabled": true,
	"cdrs_conns": [
		{"address": "*internal"},
	],
},


"cdrs": {
	"enabled": true,
	"chargers_conns":[
		{"address": "*internal"},
	],
},


"cdre": {
	"TestTutITExportCDR": {
		"content_fields": [
			{"tag": "CGRID", "type": "*composed", "value": "~CGRID"},
			{"tag": "RunID", "type": "*composed", "value": "~RunID"},
			{"tag":"OriginID", "type": "*composed", "value": "~OriginID"},
			{"tag":"RequestType", "type": "*composed", "value": "~RequestType"},
			{"tag":"Tenant", "type": "*composed", "value": "~Tenant"},
			{"tag":"Category", "type": "*composed", "value": "~Category"},
			{"tag":"Account", "type": "*composed", "value": "~Account"},
			{"tag":"Destination", "type": "*composed", "value": "~Destination"},
			{"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", "rounding_decimals": 4},
			{"tag":"MatchedDestinationID", "type": "*composed", "value": "~CostDetails:s/\"MatchedDestId\":.*_(\\w{4})/${1}/:s/\"MatchedDestId\":\"INTERNAL\"/ON010/"},
		],
	},
},

"loaders": [
	{
		"id": "TeoLoader",									// identifier of the Loader
		"enabled": false,									// starts as service: <true|false>.
		"dry_run": false,									// do not send the CDRs to CDRS, just parse them
		"run_delay": 0,										// sleep interval in seconds between consecutive runs, 0 to use automation via inotify
		"lock_filename": ".cgr.lock",						// Filename containing concurrency lock in case of delayed processing
		"caches_conns": [
			{"address": "*internal"},						// address where to reach the CacheS for data reload, empty for no reloads  <""|*internal|x.y.z.y:1234>
		],
		"field_separator": ",",								// separator used in case of csv files
		"tp_in_dir": "/tmp/In",		// absolute path towards the directory where the CDRs are stored
		"tp_out_dir": "/tmp/Out",	// absolute path towards the directory where processed CDRs will be moved
		"data":[	
			{
				"type": "*resources",						// data source type
				"file_name": "Resources.csv",				// file name in the tp_in_dir
				"fields": [
					{"tag": "Tenant", "field_id": "Tenant", "type": "*variable", "value": "~0", "mandatory": true},
					{"tag": "ID", "field_id": "ID", "type": "*variable", "value": "~1", "mandatory": true},
					{"tag": "FilterIDs", "field_id": "FilterIDs", "type": "*variable", "value": "~2"},
					{"tag": "ActivationInterval", "field_id": "ActivationInterval", "type": "*variable", "value": "~3"},
					{"tag": "TTL", "field_id": "UsageTTL", "type": "*variable", "value": "~4"},
					{"tag": "Limit", "field_id": "Limit", "type": "*variable", "value": "~5"},
					{"tag": "AllocationMessage", "field_id": "AllocationMessage", "type": "*variable", "value": "~6"},
					{"tag": "Blocker", "field_id": "Blocker", "type": "*variable", "value": "~7"},
					{"tag": "Stored", "field_id": "Stored", "type": "*variable", "value": "~8"},
					{"tag": "Weight", "field_id": "Weight", "type": "*variable", "value": "~9"},
					{"tag": "ThresholdIDs", "field_id": "ThresholdIDs", "type": "*variable", "value": "~10"},
				],
			},
			{
				"type": "*stats",						// data source type
				"file_name": "Stats.csv",				// file name in the tp_in_dir
				"fields": [
					{"tag": "Tenant", "field_id": "Tenant", "type": "*variable", "value": "~0", "mandatory": true},
					{"tag": "ID", "field_id": "ID", "type": "*variable", "value": "~1", "mandatory": true},
					{"tag": "FilterIDs", "field_id": "FilterIDs", "type": "*variable", "value": "~2"},
					{"tag": "ActivationInterval", "field_id": "ActivationInterval", "type": "*variable", "value": "~3"},
					{"tag": "QueueLength", "field_id": "QueueLength", "type": "*variable", "value": "~4"},
					{"tag": "TTL", "field_id": "TTL", "type": "*variable", "value": "~5"},
					{"tag": "Metrics", "field_id": "Metrics", "type": "*variable", "value": "~6"},
					{"tag": "MetricParams", "field_id": "Parameters", "type": "*variable", "value": "~7"},
					{"tag": "Blocker", "field_id": "Blocker", "type": "*variable", "value": "~8"},
					{"tag": "Stored", "field_id": "Stored", "type": "*variable", "value": "~9"},
					{"tag": "Weight", "field_id": "Weight", "type": "*variable", "value": "~10"},
					{"tag": "MinItems", "field_id": "MinItems", "type": "*variable", "value": "~11"},
					{"tag": "ThresholdIDs", "field_id": "ThresholdIDs", "type": "*variable", "value": "~12"},
				],
			},
			{
				"type": "*thresholds",						// data source type
				"file_name": "Thresholds.csv",				// file name in the tp_in_dir
				"fields": [
					{"tag": "Tenant", "field_id": "Tenant", "type": "*variable", "value": "~0", "mandatory": true},
					{"tag": "ID", "field_id": "ID", "type": "*variable", "value": "~1", "mandatory": true},
					{"tag": "FilterIDs", "field_id": "FilterIDs", "type": "*variable", "value": "~2"},
					{"tag": "ActivationInterval", "field_id": "ActivationInterval", "type": "*variable", "value": "~3"},
					{"tag": "MaxHits", "field_id": "MaxHits", "type": "*variable", "value": "~4"},
					{"tag": "MinHits", "field_id": "MinHits", "type": "*variable", "value": "~5"},
					{"tag": "MinSleep", "field_id": "MinSleep", "type": "*variable", "value": "~6"},
					{"tag": "Blocker", "field_id": "Blocker", "type": "*variable", "value": "~7"},
					{"tag": "Weight", "field_id": "Weight", "type": "*variable", "value": "~8"},
					{"tag": "ActionIDs", "field_id": "ActionIDs", "type": "*variable", "value": "~9"},
					{"tag": "Async", "field_id": "Async", "type": "*variable", "value": "~10"},
				],
			},
			{
				"type": "*suppliers",						// data source type
				"file_name": "Suppliers.csv",				// file name in the tp_in_dir
				"fields": [
					{"tag": "Tenant", "field_id": "Tenant", "type": "*variable", "value": "~0", "mandatory": true},
					{"tag": "ID", "field_id": "ID", "type": "*variable", "value": "~1", "mandatory": true},
					{"tag": "FilterIDs", "field_id": "FilterIDs", "type": "*variable", "value": "~2"},
					{"tag": "ActivationInterval", "field_id": "ActivationInterval", "type": "*variable", "value": "~3"},
					{"tag": "Sorting", "field_id": "Sorting", "type": "*variable", "value": "~4"},
					{"tag": "SortingParamameters", "field_id": "SortingParamameters", "type": "*variable", "value": "~5"},
					{"tag": "SupplierID", "field_id": "SupplierID", "type": "*variable", "value": "~6"},
					{"tag": "SupplierFilterIDs", "field_id": "SupplierFilterIDs", "type": "*variable", "value": "~7"},
					{"tag": "SupplierAccountIDs", "field_id": "SupplierAccountIDs", "type": "*variable", "value": "~8"},
					{"tag": "SupplierRatingPlanIDs", "field_id": "SupplierRatingPlanIDs", "type": "*variable", "value": "~9"},
					{"tag": "SupplierResourceIDs", "field_id": "SupplierResourceIDs", "type": "*variable", "value": "~10"},
					{"tag": "SupplierStatIDs", "field_id": "SupplierStatIDs", "type": "*variable", "value": "~11"},
					{"tag": "SupplierWeight", "field_id": "SupplierWeight", "type": "*variable", "value": "~12"},
					{"tag": "SupplierBlocker", "field_id": "SupplierBlocker", "type": "*variable", "value": "~13"},
					{"tag": "SupplierParameters", "field_id": "SupplierParameters", "type": "*variable", "value": "~14"},
					{"tag": "Weight", "field_id": "Weight", "type": "*variable", "value": "~15"},
				],
			},
		],
	},
	{
		"id": "FilterLoader",									// identifier of the Loader
		"enabled": false,									// starts as service: <true|false>.
		"dry_run": false,									// do not send the CDRs to CDRS, just parse them
		"run_delay": 0,										// sleep interval in seconds between consecutive runs, 0 to use automation via inotify
		"lock_filename": ".cgr.lock",						// Filename containing concurrency lock in case of delayed processing
		"caches_conns": [
			{"address": "*internal"},						// address where to reach the CacheS for data reload, empty for no reloads  <""|*internal|x.y.z.y:1234>
		],
		"field_separator": ",",								// separator used in case of csv files
		"tp_in_dir": "/tmp/FilterIn",		// absolute path towards the directory where the CDRs are stored
		"tp_out_dir": "/tmp/FilterOut",	// absolute path towards the directory where processed CDRs will be moved
		"data":[	
			{
				"type": "*filters",						// data source type
				"file_name": "Filters.csv",				// file name in the tp_in_dir
				"fields": [
					{"tag": "Tenant", "field_id": "Tenant", "type": "*variable", "value": "~0", "mandatory": true},
					{"tag": "ID", "field_id": "ID", "type": "*variable", "value": "~1", "mandatory": true},
					{"tag": "FilterType", "field_id": "FilterType", "type": "*variable", "value": "~2"},
					{"tag": "FilterFieldName", "field_id": "FilterFieldName", "type": "*variable", "value": "~3"},
					{"tag": "FilterFieldValues", "field_id": "FilterFieldValues", "type": "*variable", "value": "~4"},
					{"tag": "ActivationInterval", "field_id": "ActivationInterval", "type": "*variable", "value": "~5"},
				],
			},	
		],
	},
],



"attributes": {
	"enabled": true,
},


"chargers": {
	"enabled": true,
	"attributes_conns": [
		{"address": "*internal"},
	],
},


"resources": {
	"enabled": true,
	"store_interval": "1s",
	"thresholds_conns": [
		{"address": "*internal"}
	],
},


"stats": {
	"enabled": true,
	"store_interval": "1s",
	"thresholds_conns": [
		{"address": "*internal"}
	],
},

"thresholds": {
	"enabled": true,
	"store_interval": "1s",
},


"suppliers": {
	"enabled": true,
	"prefix_indexed_fields":["Destination",],
	"stats_conns": [
		{"address": "*internal"},
	],
},


"sessions": {
	"enabled": true,
	"suppliers_conns": [
		{"address": "*internal"}
	],
	"resources_conns": [
		{"address": "*internal"}
	],
	"attributes_conns": [
		{"address": "*internal"}
	],
	"rals_conns": [
		{"address": "*internal"}
	],
	"cdrs_conns": [
		{"address": "*internal"}
	],
	"chargers_conns": [
		{"address": "*internal"}
	],
},


"migrator":{
	"out_stordb_password": "CGRateS.org",
	"users_filters":["Account"],
},


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


}
