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


"general": {
	"log_level": 7,
	"reply_timeout": "10s",									// consider connection down for replies taking longer than this value
	"default_timezone": "UTC",
},


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


"data_db": {
	"db_type": "mongo",
	"db_name": "10",
	"db_port": 27017,
},


"stor_db": {
	"db_type": "mongo",
	"db_name": "cgrates",
	"db_port": 27017,
	"db_password": "",
},


"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"],
	"session_cost_retries": 0,
},


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



"ers": {
	"enabled": true,
	"sessions_conns": ["*internal"],
	"partial_cache_ttl": "500ms",
	"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",
			"opts": {
				"csvFieldSeparator":";"
			},
			"type": "*file_csv",
			"source_path": "/tmp/ers2/in",
			"flags": ["*dryrun"],
			"processed_path": "/tmp/ers2/out",
			"fields":[
				{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*voice", "mandatory": true},
				{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.0", "mandatory": true},
				{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.1", "mandatory": true},
				{"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*variable", "value": "~*req.2", "mandatory": true},
				{"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "call", "mandatory": true},
				{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.3", "mandatory": true},
				{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.3", "mandatory": true},
				{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.4:s/0([1-9]\\d+)/+49${1}/", "mandatory": true},
				{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.5", "mandatory": true},
				{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.5", "mandatory": true},
				{"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.6", "mandatory": true},
				{"tag": "HDRExtra3", "path": "*cgreq.HDRExtra3", "type": "*variable", "value": "~*req.6", "mandatory": true},
				{"tag": "HDRExtra2", "path": "*cgreq.HDRExtra2", "type": "*variable", "value": "~*req.6", "mandatory": true},
				{"tag": "HDRExtra1", "path": "*cgreq.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",
			"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": "*cgreq.Tenant", "type": "*variable", "value": "~*req.Tenant", "mandatory": true},
				{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*voice", "mandatory": true},
				{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.OriginID", "mandatory": true},
				{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.RequestType", "mandatory": true},
				{"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "call", "mandatory": true},
				{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.Account", "mandatory": true},
				{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.Subject", "mandatory": true},
				{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.Destination", "mandatory": true},
				{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.SetupTime", "mandatory": true},
				{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime", "mandatory": true},
				{"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.Usage", "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",
			"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": "*cgreq.Tenant", "type": "*variable", "value": "~*req.0", "mandatory": true},
				{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.2", "mandatory": true},
				{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.3", "mandatory": true},
				{"tag": "Usage", "path": "*cgreq.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",
			"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": "*cgreq.Tenant", "type": "*variable", "value": "~*req.0", "mandatory": true},
				{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*voice", "mandatory": true},
				{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.2", "mandatory": true},
				{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.3", "mandatory": true},
				{"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "call", "mandatory": true},
				{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.4", "mandatory": true},
				{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.5", "mandatory": true},
				{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.6", "mandatory": true},
				{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.7", "mandatory": true},
				{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.8", "mandatory": true},
				{"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.9", "mandatory": true},
				{"tag": "ExtraInfo1", "path": "*cgreq.ExtraInfo1", "type": "*constant", "value": "ExtraInfo1", "mandatory": true},
				{"tag": "ExtraInfo2", "path": "*cgreq.ExtraInfo2", "type": "*constant", "value": "ExtraInfo2", "mandatory": true},
			],
		},
		{
			"id": "file_reader_with_filters",
			"run_delay":  "-1",
			"type": "*file_csv",
			"opts": {
				"csvFieldSeparator":";"
			},
			"source_path": "/tmp/ers_with_filters/in",
			"processed_path": "/tmp/ers_with_filters/out",
			"flags": ["*cdrs","*log"],
			"filters":["*string:~*req.3:1002"],
			"fields":[
				{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*voice", "mandatory": true},
				{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.0", "mandatory": true},
				{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.1", "mandatory": true},
				{"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*variable", "value": "~*req.2", "mandatory": true},
				{"tag": "Category", "path": "*cgreq.Category", "type": "*variable", "value": "call", "mandatory": true},
				{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.3", "mandatory": true},
				{"tag": "Source", "path": "*cgreq.Source", "type": "*constant", "value": "ers_csv", "mandatory": true},
				{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.3", "mandatory": true},
				{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.4:s/0([1-9]\\d+)/+49${1}/", "mandatory": true},
				{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.5", "mandatory": true},
				{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.5", "mandatory": true},
				{"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.6", "mandatory": true},
				{"tag": "HDRExtra3", "path": "*cgreq.HDRExtra3", "type": "*variable", "value": "~*req.6", "mandatory": true},
				{"tag": "HDRExtra2", "path": "*cgreq.HDRExtra2", "type": "*variable", "value": "~*req.6", "mandatory": true},
				{"tag": "HDRExtra1", "path": "*cgreq.HDRExtra1", "type": "*variable", "value": "~*req.6", "mandatory": true},
				{"tag": "ReaderId", "type": "*variable", "value": "~*vars.*readerID", "path": "*cgreq.ReaderID"},
			],
		},
		{
			"id": "XmlDryRun",
			"run_delay":  "-1",
			"type": "*file_xml",
			"source_path": "/tmp/xmlErs/in",
			"flags": ["*cdrs","*log"],
			"processed_path": "/tmp/xmlErs/out",
			"opts": {
				"xmlRootPath": "broadWorksCDR.cdrData",
			},
			"fields":[
				{"tag": "ReaderId", "type": "*variable", "value": "~*vars.*readerID", "path": "*cgreq.ReaderID"},
				{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*voice", "mandatory": true},
				{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.broadWorksCDR.cdrData.basicModule.localCallId", "mandatory": true},
				{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*rated", "mandatory": true},
				{"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*variable", "value": "~*req.broadWorksCDR.cdrData.basicModule.userId:s/.*@(.*)/${1}/", "mandatory": true},
				{"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "call", "mandatory": true},
				{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.broadWorksCDR.cdrData.basicModule.userNumber", "mandatory": true},
				{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.broadWorksCDR.cdrData.basicModule.calledNumber", "mandatory": true},
				{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.broadWorksCDR.cdrData.basicModule.startTime", "mandatory": true},
				{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.broadWorksCDR.cdrData.basicModule.answerTime", "mandatory": true},
				{"tag": "Usage", "path": "*cgreq.Usage", "type": "*usage_difference", "value": "~*req.broadWorksCDR.cdrData.basicModule.releaseTime;~*req.broadWorksCDR.cdrData.basicModule.answerTime", "mandatory": true}
			]
		},
		{
			"id": "XML_EmptyRoot",
			"run_delay":  "-1",
			"type": "*file_xml",
			"source_path": "/tmp/xmlErs2/in",
			"flags": ["*cdrs","*log"],
			"processed_path": "/tmp/xmlErs2/out",
			"opts": {
				"xmlRootPath": ""
			},
			"fields":[
				{"tag": "ToR", "path": "*cgreq.ToR", "type": "*variable", "value": "~*req.root.partial_cdr.ToR", "mandatory": true},
				{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*composed", "value": "~*req.root.partial_cdr.TestCase", "mandatory": true},
				{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*composed", "value": "_", "mandatory": true},
				{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*composed", "value": "~*req.root.partial_cdr[1].ID", "mandatory": true},
				{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.root.partial_cdr.RequestType", "mandatory": true},
				{"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*variable", "value": "~*req.root.partial_cdr.Tenant", "mandatory": true},
				{"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "call", "mandatory": true},
				{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.root.partial_cdr.Account", "mandatory": true},
				{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.root.partial_cdr.Destination", "mandatory": true},
				{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.root.partial_cdr.SetupTime", "mandatory": true},
				{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.root.partial_cdr.AnswerTime", "mandatory": true},
				{"tag": "Usage", "path": "*cgreq.Usage", "type": "*usage_difference", "value": "~*req.root.partial_cdr.ReleaseTime;~*req.root.partial_cdr.AnswerTime", "mandatory": true}
			]
		},
		{
			"id": "FWV1",
			"run_delay":  "-1",
			"type": "*file_fwv",
			"source_path": "/tmp/fwvErs/in",
			"processed_path": "/tmp/fwvErs/out",
			"flags": ["*cdrs"],
			"filters": ["*regex:~*req.0-10:^CDR00000|^CDR00001|^CDR00002"],
			"fields": [
				{"tag": "ReaderId", "type": "*variable", "value": "~*vars.*readerID", "path": "*cgreq.ReaderID"},
				{"tag": "FileName", "path": "*cgreq.CdrFileName", "type": "*variable", "value": "~*hdr.95-135", "padding":"*right"},
				{"tag": "FileSeqNr", "path": "*cgreq.FileSeqNr", "type": "*variable", "value": "~*hdr.135-141", "padding":"*zeroleft"},
				{"tag": "AccId1", "path": "*cgreq.AccId1", "type": "*variable", "value": "~*hdr.135-141",  "padding":"*zeroleft"},
				{"tag": "Tor", "path": "*cgreq.ToR", "type": "*constant", "value": "*voice", "mandatory": true},
				{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "rated", "mandatory": true},
				{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.0-10", "padding":"*right", "mandatory": true},
				{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*constant", "value": "0.0.0.0", "mandatory": true},
				{"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*constant", "value": "cgrates.org", "mandatory": true},
				{"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "call", "mandatory": true},
				{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.30-49",  "padding":"*right", "mandatory": true},
				{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.30-49",  "padding":"*right", "mandatory": true},
				{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.52-80", "padding":"*right", "mandatory": true},
				{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.14-30:s/(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/${1}-${2}-${3} ${4}:${5}:${6}/",  "mandatory": true},
				{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.14-30:s/(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/${1}-${2}-${3} ${4}:${5}:${6}/", "mandatory": true},
				{"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.127-135:s/(\\d{2})(\\d{2})(\\d{2})(\\d{2})/${1}h${2}m${3}s/", "mandatory": true},
				{"tag": "DisconnectCause", "path": "*cgreq.DisconnectCause", "type": "*variable", "value": "~*req.138-139",  "mandatory": true},
				{"tag": "RetailAmount", "path": "*cgreq.RetailAmount", "type": "*variable", "value": "~*req.103-111", "padding":"*zeroleft"},
				{"tag": "WholesaleAmount", "path": "*cgreq.RetailAmount", "type": "*variable", "value": "~*req.115-123", "padding":"*zeroleft"},
				{"tag": "AccId1", "path": "*cgreq.AccId1", "type": "*variable", "value": "~*req.3-6", "padding":"*zeroleft", "mandatory": true},
				{"tag": "AccId2", "path": "*cgreq.AccId2", "type": "*variable", "value": "~*req.14-30",  "padding":"*right", "mandatory": true},
				{"tag": "NrOfCdrs", "type": "*variable", "path":"*cgreq.NrOfCdrs", "value": "~*trl.142-150"},
				{"tag": "TotalDuration", "type": "*variable", "path":"*cgreq.TotalDuration", "value": "~*trl.150-162"}
			],
		},
		{
			"id": "PartialCSV1",
			"enabled": true,
			"run_delay":  "-1",
			"type": "*file_csv",
			"source_path": "/tmp/partErs1/in",
			"flags": ["*cdrs"],
			"processed_path": "",
			"opts": {
				"partialCacheAction": "*dump_to_file",
				"partialOrderField": "~*req.AnswerTime",
				"partialPath": "/tmp/partErs1/out",
			},
			"fields":[
				{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*voice", "mandatory": true},
				{"tag": "AccId1", "path": "*cgreq.OriginID", "type": "*composed", "value": "~*req.0"},
				{"tag": "AccId2", "path": "*cgreq.OriginID", "type": "*composed", "value": "_"},
				{"tag": "AccId3", "path": "*cgreq.OriginID", "type": "*composed", "value": "~*req.1"},
				{"tag": "AccId4", "path": "*cgreq.OriginID", "type": "*composed", "value": "_"},
				{"tag": "AccId5", "path": "*cgreq.OriginID", "type": "*composed", "value": "~*req.4"},
				{"tag": "OrderID", "path": "*cgreq.OrderID", "type": "*unix_timestamp", "value": "~*req.3"},
				{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*constant", "value": "127.0.0.1", "mandatory": true},
				{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*rated", "mandatory": true},
				{"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*constant", "value": "cgrates.org", "mandatory": true},
				{"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "call", "mandatory": true},
				{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.0:s/^49([1-9]\\d+)$/0$1/", "mandatory": true},
				{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.1:s/^00(\\d+)$/+$1/", "mandatory": true},
				{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
				{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
				{"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.6:s/^(\\d+)$/${1}s/", "mandatory": true},
				{"tag": "Partial", "path": "*cgreq.Partial", "type": "*constant", "value": "true", "filters":["*string:~*req.10:partial"]},// keep this here for partial cdr field 
				{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "true", "filters":["*string:~*req.10:partial"]},
				{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false", "filters":["*notstring:~*req.10:partial"]},
			],
			"cache_dump_fields": [
				{"tag": "OriginID", "path":"*exp.OriginID", "type": "*variable", "value": "~*req.OriginID"},
				{"tag": "OrderID", "path":"*exp.OrderID", "type": "*variable", "value": "~*req.OrderID"},
				{"tag": "RequestType", "path":"*exp.RequestType", "type": "*variable", "value": "~*req.RequestType"},
				{"tag": "Account", "path":"*exp.Account", "type": "*variable", "value": "~*req.Account"},
				{"tag": "Destination", "path":"*exp.Destination", "type": "*variable", "value": "~*req.Destination"},
				{"tag": "SetupTime", "path":"*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime", "layout": "2006-01-02T15:04:05Z07:00"},
				{"tag": "AnswerTime", "path":"*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"},
				{"tag": "Usage", "path":"*exp.Usage", "type": "*variable", "value": "~*req.Usage"},
			],
		},
		{
			"id": "PartialCSV_PostExpiry",
			"enabled": true,
			"run_delay":  "-1",
			"type": "*file_csv",
			"source_path": "/tmp/partErs2/in",
			"processed_path": "",
			"flags": ["*cdrs"],
			"opts": {
				"partialCacheAction": "*post_cdr",
				"partialOrderField": "~*req.AnswerTime",
				"partialPath": "/tmp/partErs2/out",
			},
			"fields":[
				{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*voice", "mandatory": true},
				{"tag": "AccId1", "path": "*cgreq.OriginID", "type": "*composed", "value": "~*req.0"},
				{"tag": "AccId2", "path": "*cgreq.OriginID", "type": "*composed", "value": "_"},
				{"tag": "AccId3", "path": "*cgreq.OriginID", "type": "*composed", "value": "~*req.1"},
				{"tag": "AccId4", "path": "*cgreq.OriginID", "type": "*composed", "value": "_"},
				{"tag": "AccId5", "path": "*cgreq.OriginID", "type": "*composed", "value": "~*req.4"},
				{"tag": "OrderID", "path": "*cgreq.OrderID", "type": "*unix_timestamp", "value": "~*req.3"},
				{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*constant", "value": "127.0.0.1", "mandatory": true},
				{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*rated", "mandatory": true},
				{"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*constant", "value": "cgrates.org", "mandatory": true},
				{"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "call", "mandatory": true},
				{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.0:s/^49([1-9]\\d+)$/0$1/", "mandatory": true},
				{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.1:s/^00(\\d+)$/+$1/", "mandatory": true},
				{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
				{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.4", "mandatory": true},
				{"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.6:s/^(\\d+)$/${1}s/", "mandatory": true},
				{"tag": "Partial", "path": "*cgreq.Partial", "type": "*constant", "value": "true", "filters":["*string:~*req.10:partial"]},// keep this here for partial cdr field 
				{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "true", "filters":["*string:~*req.10:partial"]},
				{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false", "filters":["*notstring:~*req.10:partial"]}
			],
		},
		{
			"id": "FlatstoreOsips",
			"enabled": true,
			"run_delay":  "-1",
			"type": "*file_csv",
			"opts": {
				"csvFieldSeparator":"|",
				"partialcsvFieldSeparator": "|",
				"partialCacheAction": "*dump_to_file",
				"partialOrderField": "~*opts.order",
				"partialPath": "/tmp/flatstoreErs/out",
			},
			"source_path": "/tmp/flatstoreErs/in",
			"processed_path": "/tmp/flatstoreErs/out",
			"flags": ["*cdrs"],
			"fields":[
				{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*constant","value":"flatStore", "mandatory": true},
				{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable","value":"~*req.3;~*req.1;~*req.2", "mandatory": true},
				{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.7", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
				{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
				{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
				{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.9", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
				{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.6", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
				{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.6", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
				{"tag": "EndTime", "path": "*cgreq.EndTime", "type": "*variable","value": "~*req.6", "mandatory": true, "filters": ["*string:~*req.0:BYE"]}, 
				{"tag": "DisconnectCause", "path": "*cgreq.DisconnectCause", "type": "*variable", "value": "~*req.4; ;~*req.5", "mandatory": true},
				{"tag": "DialogId", "path": "*cgreq.DialogId", "type": "*variable", "value": "~*req.11"},
				{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "true"},
				{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false","filters": ["*prefix:~*vars.*fileName:missed_calls"]},
				{"tag": "Invite", "path": "*opts.invite", "type": "*constant", "value": "true", "filters":["*string:~*req.0:INVITE"]},
				{"tag": "Bye", "path": "*opts.bye", "type": "*constant", "value": "true", "filters":["*string:~*req.0:BYE"]},
				{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "0", "filters":["*string:~*req.0:INVITE"]},
				{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "1", "filters":["*string:~*req.0:BYE"]},
			],
			"partial_commit_fields": [
				{"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant","value": "0", "mandatory": true, "filters": ["*prefix:~*vars.*fileName:missed_calls"]},
				{"tag": "Usage", "path": "*cgreq.Usage", "type": "*usage_difference","value": "~*req.EndTime;~*req.AnswerTime", "mandatory": true, "filters": ["*notprefix:~*vars.*fileName:missed_calls","*exists:~*opts.invite:","*exists:~*opts.bye:"]}, 
				{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false","filters": ["*exists:~*opts.invite:","*exists:~*opts.bye:"]},
			],
			"cache_dump_fields": [
				{"tag": "OriginHost",		"path": "*exp.OriginHost", 		"type": "*variable", "value":"~*req.OriginHost"},
				{"tag": "OriginID",			"path": "*exp.OriginID", 		"type": "*variable", "value":"~*req.OriginID"},
				{"tag": "RequestType",		"path": "*exp.RequestType", 	"type": "*variable", "value":"~*req.RequestType"},
				{"tag": "Account",			"path": "*exp.Account", 		"type": "*variable", "value":"~*req.Account"},
				{"tag": "Subject",			"path": "*exp.Subject", 		"type": "*variable", "value":"~*req.Subject"},
				{"tag": "Destination",		"path": "*exp.Destination", 	"type": "*variable", "value":"~*req.Destination"},
				{"tag": "SetupTime",		"path": "*exp.SetupTime", 		"type": "*variable", "value":"~*req.SetupTime"},
				{"tag": "AnswerTime",		"path": "*exp.AnswerTime", 		"type": "*variable", "value":"~*req.AnswerTime"},
				{"tag": "EndTime",			"path": "*exp.EndTime", 		"type": "*variable", "value":"~*req.EndTime"},
				{"tag": "DisconnectCause",	"path": "*exp.DisconnectCause", "type": "*variable", "value":"~*req.DisconnectCause"},
				{"tag": "DialogId",			"path": "*exp.DialogId", 		"type": "*variable", "value":"~*req.DialogId"},
			],

		},
		{
			"id": "FlatstoreOsipsWithACK",
			"enabled": true,
			"run_delay":  "-1",
			"type": "*file_csv",
			"opts": {
				"csvFieldSeparator":"|",
				"partialcsvFieldSeparator": "|",
				"partialCacheAction": "*dump_to_file",
				"partialOrderField": "~*opts.order",
				"partialPath": "/tmp/flatstoreACKErs/out",
				"csvLazyQuotes": true,
			},
			"source_path": "/tmp/flatstoreACKErs/in",
			"processed_path": "/tmp/flatstoreACKErs/out",
			"flags": ["*cdrs"],
			"fields":[
				{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*constant","value":"flatStoreACK", "mandatory": true},
				{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable","value":"~*req.3;~*req.1;~*req.2", "mandatory": true},
				{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.7", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
				{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
				{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
				{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.9", "mandatory": true,"filters": ["*string:~*req.0:INVITE"]},
				{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.6", "mandatory": true,"filters": ["*string:~*req.0:ACK"]},
				{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.6", "mandatory": true,"filters": ["*string:~*req.0:ACK"]},
				{"tag": "EndTime", "path": "*cgreq.EndTime", "type": "*variable","value": "~*req.6", "mandatory": true, "filters": ["*string:~*req.0:BYE"]}, 
				{"tag": "DisconnectCause", "path": "*cgreq.DisconnectCause", "type": "*variable", "value": "~*req.4; ;~*req.5", "mandatory": true},
				{"tag": "DialogId", "path": "*cgreq.DialogId", "type": "*variable", "value": "~*req.11"},
				{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "true"},
				{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false","filters": ["*prefix:~*vars.*fileName:missed_calls"]},
				{"tag": "Invite", "path": "*opts.invite", "type": "*constant", "value": "true", "filters":["*string:~*req.0:INVITE"]},
				{"tag": "Bye", "path": "*opts.bye", "type": "*constant", "value": "true", "filters":["*string:~*req.0:BYE"]},
				{"tag": "Ack", "path": "*opts.ack", "type": "*constant", "value": "true", "filters":["*string:~*req.0:ACK"]},
				{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "0", "filters":["*string:~*req.0:INVITE"]},
				{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "1", "filters":["*string:~*req.0:ACK"]},
				{"tag": "Order", "path": "*opts.order", "type": "*constant", "value": "2", "filters":["*string:~*req.0:BYE"]},
			],
			"partial_commit_fields": [
				{"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant","value": "0", "mandatory": true, "filters": ["*prefix:~*vars.*fileName:missed_calls"]},
				{"tag": "Usage", "path": "*cgreq.Usage", "type": "*usage_difference","value": "~*req.EndTime;~*req.AnswerTime", "mandatory": true, "filters": ["*notprefix:~*vars.*fileName:missed_calls","*exists:~*opts.invite:","*exists:~*opts.bye:","*exists:~*opts.ack:"]}, 
				{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false","filters": ["*exists:~*opts.invite:","*exists:~*opts.bye:","*exists:~*opts.ack:"]},
			],
			"cache_dump_fields": [
				{"tag": "OriginHost",		"path": "*exp.OriginHost", 		"type": "*variable", "value":"~*req.OriginHost"},
				{"tag": "OriginID",			"path": "*exp.OriginID", 		"type": "*variable", "value":"~*req.OriginID"},
				{"tag": "RequestType",		"path": "*exp.RequestType", 	"type": "*variable", "value":"~*req.RequestType"},
				{"tag": "Account",			"path": "*exp.Account", 		"type": "*variable", "value":"~*req.Account"},
				{"tag": "Subject",			"path": "*exp.Subject", 		"type": "*variable", "value":"~*req.Subject"},
				{"tag": "Destination",		"path": "*exp.Destination", 	"type": "*variable", "value":"~*req.Destination"},
				{"tag": "SetupTime",		"path": "*exp.SetupTime", 		"type": "*variable", "value":"~*req.SetupTime"},
				{"tag": "AnswerTime",		"path": "*exp.AnswerTime", 		"type": "*variable", "value":"~*req.AnswerTime"},
				{"tag": "EndTime",			"path": "*exp.EndTime", 		"type": "*variable", "value":"~*req.EndTime"},
				{"tag": "DisconnectCause",	"path": "*exp.DisconnectCause", "type": "*variable", "value":"~*req.DisconnectCause"},
				{"tag": "DialogId",			"path": "*exp.DialogId", 		"type": "*variable", "value":"~*req.DialogId"},
			],

		},
		{
			"id": "JSONReader",
			"run_delay":  "-1",
			"type": "*file_json",
			"source_path": "/tmp/ErsJSON/in",
			"flags": ["*cdrs"],
			"processed_path": "/tmp/ErsJSON/out",
			"fields":[
				{"tag": "ReaderId", "type": "*variable", "value": "~*vars.*readerID", "path": "*cgreq.ReaderID"},
				{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*voice", "mandatory": true},
				{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.OriginID", "mandatory": true},
				{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.RequestType", "mandatory": true},
				{"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*variable", "value": "~*req.Tenant", "mandatory": true},
				{"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "call", "mandatory": true},
				{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.Account", "mandatory": true},
				{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.Account", "mandatory": true},
				{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.Destination:s/0([1-9]\\d+)/+49${1}/", "mandatory": true},
				{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.SetupTime", "mandatory": true},
				{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime", "mandatory": true},
				{"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.Usage", "mandatory": true},
			],
		},
		{
			"id": "readerWithTemplate",
			"run_delay":  "-1",
			"type": "*file_csv",
			"source_path": "/tmp/readerWithTemplate/in",
			"flags": ["*cdrs","*log"],
			"processed_path": "/tmp/readerWithTemplate/out",
			"fields":[
				{"tag": "reqFields","type": "*template", "value": "reqFields"},
				{"tag": "ExtraInfo1", "path": "*cgreq.ExtraInfo1", "type": "*constant", "value": "ExtraInfo1"},
				{"tag": "ExtraInfo2", "path": "*cgreq.ExtraInfo2", "type": "*constant", "value": "ExtraInfo2"},
			],
		},
		{
			"id": "PartialWithMultipleMethods",
			"enabled": true,
			"run_delay":  "-1",
			"type": "*file_csv",
			"opts": {
				"csvFieldSeparator":",",
				"partialcsvFieldSeparator": ",",
				"partialCacheAction": "*dump_to_file",
				"partialOrderField": "~*opts.orderID",
				"partialPath": "/tmp/flatstoreMMErs/out",
				"csvLazyQuotes": true,
			},
			"source_path": "/tmp/flatstoreMMErs/in",
			"processed_path": "/tmp/flatstoreMMErs/out",
			"flags": ["*cdrs"],
			"fields":[
				{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*constant","value":"flatstoreMMErs", "mandatory": true},
				{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable","value":"~*req.4;~*req.2;~*req.3", "mandatory": true},
				{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*none", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
				{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
				{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.8", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
				{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.14", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
				{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.7", "mandatory": true,"filters": ["*string:~*req.1:INVITE"]},
				{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.7", "mandatory": true,"filters": ["*string:~*req.1:ACK"]},
				{"tag": "EndTime", "path": "*cgreq.EndTime", "type": "*variable","value": "~*req.7", "mandatory": true, "filters": ["*string:~*req.1:BYE"]}, 
				{"tag": "DisconnectCause", "path": "*cgreq.DisconnectCause", "type": "*variable", "value": "~*req.5; ;~*req.6", "mandatory": true},
				{"tag": "DialogId", "path": "*cgreq.DialogId", "type": "*variable", "value": "~*req.12"},
				{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "true", "filters": ["*notstring:~*req.1:CANCEL"]},
				{"tag": "Invite", "path": "*opts.invite", "type": "*constant", "value": "true", "filters":["*string:~*req.1:INVITE"]},
				{"tag": "Bye", "path": "*opts.bye", "type": "*constant", "value": "true", "filters":["*string:~*req.1:BYE"]},
				{"tag": "Ack", "path": "*opts.ack", "type": "*constant", "value": "true", "filters":["*string:~*req.1:ACK"]},
				{"tag": "Order", "path": "*opts.orderID", "type": "*variable", "value": "~*req.0"},

				{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false", "filters": ["*string:~*req.1:CANCEL"]},
				{"tag": "Usage", "path": "*cgreq.Usage", "type": "*constant","value": "0", "mandatory": true, "filters": ["*string:~*req.1:CANCEL"]}, 

			],
			"partial_commit_fields": [
				{"tag": "Usage", "path": "*cgreq.Usage", "type": "*usage_difference","value": "~*req.EndTime;~*req.AnswerTime", "mandatory": true, "filters": ["*exists:~*opts.invite:","*exists:~*opts.bye:","*exists:~*opts.ack:"]}, 
				{"tag": "Partial", "path": "*opts.*partial", "type": "*constant", "value": "false","filters": ["*exists:~*opts.invite:","*exists:~*opts.bye:","*exists:~*opts.ack:"]},
			],
			"cache_dump_fields": [
				{"tag": "OriginHost",		"path": "*exp.OriginHost", 		"type": "*variable", "value":"~*req.OriginHost"},
				{"tag": "OriginID",			"path": "*exp.OriginID", 		"type": "*variable", "value":"~*req.OriginID"},
				{"tag": "RequestType",		"path": "*exp.RequestType", 	"type": "*variable", "value":"~*req.RequestType"},
				{"tag": "Account",			"path": "*exp.Account", 		"type": "*variable", "value":"~*req.Account"},
				{"tag": "Subject",			"path": "*exp.Subject", 		"type": "*variable", "value":"~*req.Subject"},
				{"tag": "Destination",		"path": "*exp.Destination", 	"type": "*variable", "value":"~*req.Destination"},
				{"tag": "SetupTime",		"path": "*exp.SetupTime", 		"type": "*variable", "value":"~*req.SetupTime"},
				{"tag": "AnswerTime",		"path": "*exp.AnswerTime", 		"type": "*variable", "value":"~*req.AnswerTime"},
				{"tag": "EndTime",			"path": "*exp.EndTime", 		"type": "*variable", "value":"~*req.EndTime"},
				{"tag": "DisconnectCause",	"path": "*exp.DisconnectCause", "type": "*variable", "value":"~*req.DisconnectCause"},
				{"tag": "DialogId",			"path": "*exp.DialogId", 		"type": "*variable", "value":"~*req.DialogId"},
			],

		},
	],
},


"templates": {
	"reqFields": [
		{"tag": "Source", "path": "*cgreq.Source", "type": "*constant", "value": "ers_template_combined", "mandatory": true},
		{"tag": "ToR", "path": "*cgreq.ToR", "type": "*variable", "value": "~*req.2", "mandatory": true},
		{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable", "value": "~*req.3", "mandatory": true},
		{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*variable", "value": "~*req.4", "mandatory": true},
		{"tag": "Tenant", "path": "*cgreq.Tenant", "type": "*variable", "value": "~*req.6", "mandatory": true},
		{"tag": "Category", "path": "*cgreq.Category", "type": "*variable", "value": "~*req.7", "mandatory": true},
		{"tag": "Account", "path": "*cgreq.Account", "type": "*variable", "value": "~*req.8", "mandatory": true},
		{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable", "value": "~*req.9", "mandatory": true},
		{"tag": "Destination", "path": "*cgreq.Destination", "type": "*variable", "value": "~*req.10", "mandatory": true},
		{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*variable", "value": "~*req.11", "mandatory": true},
		{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*variable", "value": "~*req.12", "mandatory": true},
		{"tag": "Usage", "path": "*cgreq.Usage", "type": "*variable", "value": "~*req.13", "mandatory": true}
	],
},


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


}
