{
// CGRateS Configuration file
//
// Used for SessionSv1 integration tests


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


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


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


"rals": {
	"enabled": true,
},


"schedulers": {
	"enabled": true,
},


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


"resources": {
	"enabled": true,
},


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


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


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


"ers": {
	"enabled": true,
	"sessions_conns": ["*localhost"],
	"readers": [
		{
			"id": "file_reader1",
			"run_delay":  "-1",
			"type": "*file_csv",
			"flags": ["*dryrun"],
			"source_path": "/tmp/ers/in",
			"processed_path": "/tmp/ers/out",
		},
		{
			"id": "file_reader2",
			"run_delay":  "-1",
			"type": "*file_csv",
			"source_path": "/tmp/ers2/in",
			"flags": ["*dryrun"],
			"processed_path": "/tmp/ers2/out",
			"opts": {
				"csvFieldSeparator":";"
			},
			"content_fields":[									// import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
				{"tag": "ToR", "path": "ToR", "type": "*variable", "value": "*voice", "mandatory": true},
				{"tag": "OriginID", "path": "OriginID", "type": "*variable", "value": "~*req.0", "mandatory": true},
				{"tag": "RequestType", "path": "RequestType", "type": "*variable", "value": "~*req.1", "mandatory": true},
				{"tag": "Tenant", "path": "Tenant", "type": "*variable", "value": "~*req.2", "mandatory": true},
				{"tag": "Category", "path": "Category", "type": "*variable", "value": "call", "mandatory": true},
				{"tag": "Account", "path": "Account", "type": "*variable", "value": "~*req.3", "mandatory": true},
				{"tag": "Subject", "path": "Subject", "type": "*variable", "value": "~*req.3", "mandatory": true},
				{"tag": "Destination", "path": "Destination", "type": "*variable", "value": "~*req.4:s/0([1-9]\\d+)/+49${1}/", "mandatory": true},
				{"tag": "SetupTime", "path": "SetupTime", "type": "*variable", "value": "~*req.5", "mandatory": true},
				{"tag": "AnswerTime", "path": "AnswerTime", "type": "*variable", "value": "~*req.5", "mandatory": true},
				{"tag": "Usage", "path": "Usage", "type": "*variable", "value": "~*req.6", "mandatory": true},
				{"tag": "HDRExtra3", "path": "HDRExtra3", "type": "*variable", "value": "~*req.6", "mandatory": true},
				{"tag": "HDRExtra2", "path": "HDRExtra2", "type": "*variable", "value": "~*req.6", "mandatory": true},
				{"tag": "HDRExtra1", "path": "HDRExtra1", "type": "*variable", "value": "~*req.6", "mandatory": true},
			],
		},
		{
			"id": "init_session",
			"run_delay":  "-1",
			"type": "*file_csv",
			"source_path": "/tmp/init_session/in",
			"flags": ["*initiate","*accounts","*resources","*attributes","*log"],
			"processed_path": "/tmp/init_session/out",
			"content_fields":[									// import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
				{"tag": "Tenant", "path": "Tenant", "type": "*variable", "value": "~*req.0", "mandatory": true},
				{"tag": "ToR", "path": "ToR", "type": "*variable", "value": "*voice", "mandatory": true},
				{"tag": "OriginID", "path": "OriginID", "type": "*variable", "value": "~*req.2", "mandatory": true},
				{"tag": "RequestType", "path": "RequestType", "type": "*variable", "value": "~*req.3", "mandatory": true},
				{"tag": "Category", "path": "Category", "type": "*variable", "value": "call", "mandatory": true},
				{"tag": "Account", "path": "Account", "type": "*variable", "value": "~*req.4", "mandatory": true},
				{"tag": "Subject", "path": "Subject", "type": "*variable", "value": "~*req.5", "mandatory": true},
				{"tag": "Destination", "path": "Destination", "type": "*variable", "value": "~*req.6", "mandatory": true},
				{"tag": "SetupTime", "path": "SetupTime", "type": "*variable", "value": "~*req.7", "mandatory": true},
				{"tag": "AnswerTime", "path": "AnswerTime", "type": "*variable", "value": "~*req.8", "mandatory": true},
				{"tag": "Usage", "path": "Usage", "type": "*variable", "value": "~*req.9", "mandatory": true},
			],
		},
		{
			"id": "terminate_session",
			"run_delay":  "-1",
			"type": "*file_csv",
			"source_path": "/tmp/terminate_session/in",
			"flags": ["*terminate","*accounts","*resources","*log"],
			"processed_path": "/tmp/terminate_session/out",
			"content_fields":[									// import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
				{"tag": "Tenant", "path": "Tenant", "type": "*variable", "value": "~*req.0", "mandatory": true},
				{"tag": "OriginID", "path": "OriginID", "type": "*variable", "value": "~*req.2", "mandatory": true},
				{"tag": "RequestType", "path": "RequestType", "type": "*variable", "value": "~*req.3", "mandatory": true},
				{"tag": "Usage", "path": "Usage", "type": "*variable", "value": "~*req.9", "mandatory": true},
			],
		},
		{
			"id": "create_cdr",
			"run_delay":  "-1",
			"type": "*file_csv",
			"source_path": "/tmp/cdrs/in",
			"flags": ["*cdrs","*log"],
			"processed_path": "/tmp/cdrs/out",
			"content_fields":[									// import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
				{"tag": "Tenant", "path": "Tenant", "type": "*variable", "value": "~*req.0", "mandatory": true},
				{"tag": "ToR", "path": "ToR", "type": "*variable", "value": "*voice", "mandatory": true},
				{"tag": "OriginID", "path": "OriginID", "type": "*variable", "value": "~*req.2", "mandatory": true},
				{"tag": "RequestType", "path": "RequestType", "type": "*variable", "value": "~*req.3", "mandatory": true},
				{"tag": "Category", "path": "Category", "type": "*variable", "value": "call", "mandatory": true},
				{"tag": "Account", "path": "Account", "type": "*variable", "value": "~*req.4", "mandatory": true},
				{"tag": "Subject", "path": "Subject", "type": "*variable", "value": "~*req.5", "mandatory": true},
				{"tag": "Destination", "path": "Destination", "type": "*variable", "value": "~*req.6", "mandatory": true},
				{"tag": "SetupTime", "path": "SetupTime", "type": "*variable", "value": "~*req.7", "mandatory": true},
				{"tag": "AnswerTime", "path": "AnswerTime", "type": "*variable", "value": "~*req.8", "mandatory": true},
				{"tag": "Usage", "path": "Usage", "type": "*variable", "value": "~*req.9", "mandatory": true},
				{"tag": "ExtraInfo1", "path": "ExtraInfo1", "type": "*constant", "value": "ExtraInfo1", "mandatory": true},
				{"tag": "ExtraInfo2", "path": "ExtraInfo2", "type": "*constant", "value": "ExtraInfo2", "mandatory": true},
			],
		},
		{
			"id": "file_reader_with_filters",
			"run_delay":  "-1",
			"type": "*file_csv",
			"source_path": "/tmp/ers_with_filters/in",
			"processed_path": "/tmp/ers_with_filters/out",
			"flags": ["*cdrs","*log"],
			"filters":["*string:~*req.3:1002"],
			"opts": {
				"csvFieldSeparator":";"
			},
			"content_fields":[									// import content_fields template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value
				{"tag": "ToR", "path": "ToR", "type": "*variable", "value": "*voice", "mandatory": true},
				{"tag": "OriginID", "path": "OriginID", "type": "*variable", "value": "~*req.0", "mandatory": true},
				{"tag": "RequestType", "path": "RequestType", "type": "*variable", "value": "~*req.1", "mandatory": true},
				{"tag": "Tenant", "path": "Tenant", "type": "*variable", "value": "~*req.2", "mandatory": true},
				{"tag": "Category", "path": "Category", "type": "*variable", "value": "call", "mandatory": true},
				{"tag": "Account", "path": "Account", "type": "*variable", "value": "~*req.3", "mandatory": true},
				{"tag": "Source", "path": "Source", "type": "*variable", "value": "ers_csv", "mandatory": true},
				{"tag": "Subject", "path": "Subject", "type": "*variable", "value": "~*req.3", "mandatory": true},
				{"tag": "Destination", "path": "Destination", "type": "*variable", "value": "~*req.4:s/0([1-9]\\d+)/+49${1}/", "mandatory": true},
				{"tag": "SetupTime", "path": "SetupTime", "type": "*variable", "value": "~*req.5", "mandatory": true},
				{"tag": "AnswerTime", "path": "AnswerTime", "type": "*variable", "value": "~*req.5", "mandatory": true},
				{"tag": "Usage", "path": "Usage", "type": "*variable", "value": "~*req.6", "mandatory": true},
				{"tag": "HDRExtra3", "path": "HDRExtra3", "type": "*variable", "value": "~*req.6", "mandatory": true},
				{"tag": "HDRExtra2", "path": "HDRExtra2", "type": "*variable", "value": "~*req.6", "mandatory": true},
				{"tag": "HDRExtra1", "path": "HDRExtra1", "type": "*variable", "value": "~*req.6", "mandatory": true},
			],
		},
	],
},


"apiers": {
	"enabled": true,
	"scheduler_conns": ["*internal"],
},


}
