
{

"diameter_agent": {

	"request_processors": [

		{
			"id": "data_init",
			"filters": [
				"*string:~*vars.*cmd:CCR", 
				"*string:~*req.CC-Request-Type:1", 
				"*prefix:~*req.Service-Context-Id:gprs"
			],
			"flags": ["*initiate", "*accounts"],
			"request_fields":[
				{
					"tag": "ToR", "path": "*cgreq.ToR",
					"type": "*constant", "value": "*data"
				},
				{
					"tag": "OriginID", "path": "*cgreq.OriginID",
					"type": "*variable", "mandatory": true, 
					"value": "~*req.Session-Id"
				},
				{
					"tag": "RequestType", "path": "*cgreq.RequestType",
					"type": "*constant", "value": "*prepaid"
				},
				{
					"tag": "Category", "path": "*cgreq.Category",
					"type": "*constant", "value": "data"
				},
				{
					"tag": "Account", "path": "*cgreq.Account",
					"type": "*variable", "mandatory": true, 
					"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(1)]"
				},
				{
					"tag": "Destination", "path": "*cgreq.Destination",
					"type": "*constant", "value": "data"
				},
				{
					"tag": "SetupTime", "path": "*cgreq.SetupTime",
					"type": "*variable", "mandatory": true, 
					"value": "~*req.Event-Timestamp"
				},
				{
					"tag": "AnswerTime", "path": "*cgreq.AnswerTime",
					"type": "*variable", "mandatory": true, 
					"value": "~*req.Event-Timestamp"
				},
				{
					"tag": "Usage", "path": "*cgreq.Usage",
					"type": "*constant", "value": "2048"
				},
			],
			"reply_fields": [
				{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
				{
					"tag": "ResultCodeError",
					"filters": ["*notempty:~*cgrep.Error:"],
					"path": "*rep.Result-Code", "blocker": true,
					"type": "*constant", "value": "5030"
				},
			],
		},

		{
			"id": "data_update_grp1",
			"filters": [
				"*string:~*vars.*cmd:CCR", 
				"*string:~*req.CC-Request-Type:2", 
				"*string:~*req.Multiple-Services-Credit-Control.Rating-Group:1",
				"*prefix:~*req.Service-Context-Id:gprs"
			],
			"flags": ["*update", "*accounts","*continue"],
			"request_fields":[
				{
					"tag": "ToR", "path": "ToR", 
					"type": "*constant", "value": "*data"
				},
				{
					"tag": "InitialOriginID", "path": "InitialOriginID", 
					"type": "*variable", "mandatory": true, 
					"value": "~*req.Session-Id"
				},
				{
					"tag": "OriginID", "path": "OriginID", 
					"type": "*variable", "mandatory": true, 
					"value": "~*req.Session-Id;_grp1"
				},
				{
					"tag": "Account", "path": "Account", 
					"type": "*variable", "mandatory": true, 
					"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"
				},
				{
					"tag": "Usage", "path": "Usage",
					"type": "*constant", "value": "2048"
				},
				{
					"tag": "LastUsed", "path": "LastUsed", "type": "*sum", 
					"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(1)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(1)]"
				},
			],
			"reply_fields": [
				{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
				{
					"tag": "ResultCodeError",
					"filters": ["*notempty:~*cgrep.Error:"],
					"path": "*rep.Result-Code", "blocker": true,
					"type": "*constant", "value": "5030"
				},
			],
		},

		{
			"id": "data_update_grp2",
			"filters": [
				"*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2",
				"*string:~*req.Multiple-Services-Credit-Control.Rating-Group[1]:2",
				"*prefix:~*req.Service-Context-Id:gprs"
			],
			"flags": ["*update", "*accounts"],
			"request_fields":[
				{
					"tag": "ToR", "path": "ToR", 
					"type": "*constant", "value": "*data"
				},
				{
					"tag": "InitialOriginID", "path": "InitialOriginID", 
					"type": "*variable", "mandatory": true, 
					"value": "~*req.Session-Id"
				},
				{
					"tag": "OriginID", "path": "OriginID", 
					"type": "*variable", "mandatory": true, 
					"value": "~*req.Session-Id;_grp2"},
				{
					"tag": "RequestType", "path": "RequestType", 
					"type": "*constant", "value": "*prepaid"
				},
				{
					"tag": "Category", "path": "Category",
					"type": "*constant", "value": "data"
				},
				{
					"tag": "Account", "path": "Account", 
					"type": "*variable", "mandatory": true, 
					"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"
				},
				{
					"tag": "Destination", "path": "Destination", 
					"type": "*constant", "value": "data"
				},
				{
					"tag": "SetupTime", "path": "SetupTime",
					"type": "*variable", "mandatory": true, 
					"value": "~*req.Event-Timestamp"
				},
				{
					"tag": "AnswerTime", "path": "AnswerTime",
					"type": "*variable", "mandatory": true, 
					"value": "~*req.Event-Timestamp"
				},
				{
					"tag": "Usage", "path": "Usage", 
					"type": "*constant", "value": "2048"
				},
				{
					"tag": "LastUsed", "path": "LastUsed", "type": "*sum", 
					"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(2)>;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(2)]"
				},
			],
			"reply_fields": [
				{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
				{
					"tag": "ResultCodeError",
					"filters": ["*notempty:~*cgrep.Error:"],
					"path": "*rep.Result-Code", "blocker": true,
					"type": "*constant", "value": "5030"
				},
			],
		},

		{
			"id": "data_terminate",
			"filters": [
				"*string:~*vars.*cmd:CCR", 
				"*string:~*req.CC-Request-Type:3",
				"*prefix:~*req.Service-Context-Id:gprs"
			],
			"flags": ["*terminate", "*accounts", "*cdrs"],
			"request_fields":[
				{
					"tag": "OriginID", "path": "OriginID", 
					"type": "*variable", "mandatory": true, 
					"value": "~*req.Session-Id"
				},
				{
					"tag": "OriginIDPrefix", "path": "OriginIDPrefix", 
					"type": "*variable", "mandatory": true, 
					"value": "~*req.Session-Id"
				},
				{
					"tag": "LastUsed", "path": "LastUsed", 
					"type": "*handler", "handler_id": "*sum", 
					"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets"
				},
			],
		},
	]
}

}
