
{

"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", 
					"value": "~*req.Session-Id", 
					"mandatory": true
				},
				{
					"tag": "RequestType",
					"path": "*cgreq.RequestType",
					"type": "*constant",
					"value": "*prepaid"
				},
				{
					"tag": "Category",
					"path": "Category",
					"type": "*constant",
					"value": "generic"
				},
				{
					"tag": "Account",
					"path": "*cgreq.Account",
					"type": "*variable", 
					"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(1)]",
					"mandatory": true
				},
				{
					"tag": "Destination",
					"path": "*cgreq.Destination",
					"type": "*constant",
					"value": "data"
				},
				{
					"tag": "SetupTime",
					"path": "*cgreq.SetupTime",
					"type": "*variable", 
					"value": "~*req.Event-Timestamp",
					"mandatory": true
				},
				{
					"tag": "AnswerTime",
					"path": "*cgreq.AnswerTime",
					"type": "*variable", 
					"value": "~*req.Event-Timestamp",
					"mandatory": true
				},
				{
					"tag": "Usage",
					"path": "*cgreq.Usage",
					"type": "*constant",
					"value": "2048"
				},
			],
			"reply_fields": [
				{
					"tag": "CCATemplate",
					"type": "*template",
					"value": "*cca"
				},
				{
					"tag": "ResultCode",
					"filters": ["*notempty:~*cgrep.Error:"], 
					"path": "*rep.Result-Code",
					"type": "*constant",
					"value": "5030",
					"blocker": true
				},
			],
		},

		{
			"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": "*cgreq.ToR",
					"type": "*constant",
					"value": "*data"
				},
				{
					"tag": "InitialOriginID",
					"path": "*cgreq.InitialOriginID",
					"type": "*variable", 
					"value": "~*req.Session-Id",
					"mandatory": true
				},
				{
					"tag": "OriginID",
					"path": "*cgreq.OriginID",
					"type": "*variable", 
					"value": "~*req.Session-Id",
					"mandatory": true
				},
				{
					"tag": "OriginID",
					"path": "*cgreq.OriginID",
					"type": "*variable",
					"value": "_grp1"
				},
				{
					"tag": "RequestType",
					"path": "*cgreq.RequestType", 
					"type": "*constant",
					"value": "*prepaid"
				},
				{
					"tag": "Category",
					"path": "*cgreq.Category",
					"type": "*contant",
					"value": "generic"
				},
				{
					"tag": "Account",
					"path": "*cgreq.Account",
					"type": "*variable", 
					"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"
				},
				{
					"tag": "Destination",
					"path": "*cgreq.Destination",
					"type": "*constant",
					"value": "data"
				},
				{
					"tag": "SetupTime",
					"path": "*cgreq.SetupTime",
					"type": "*variable", 
					"value": "~*req.Event-Timestamp",
					"mandatory": true
				},
				{
					"tag": "AnswerTime",
					"path": "*cgreq.AnswerTime",
					"type": "*variable", 
					"value": "~*req.Event-Timestamp",
					"mandatory": true
				},
				{
					"tag": "Usage",
					"path": "*cgreq.Usage",
					"type": "*constant",
					"value": "2048"
				},
				{
					"tag": "LastUsed",
					"path": "*cgreq.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": "ResultCode",
					"filters": ["*notempty:~*cgrep.Error:"], 
					"path": "*rep.Result-Code",
					"type": "*constant",
					"value": "5030",
					"blocker": true
				},
			],
		},

		{
			"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": "*cgreq.ToR",
					"type": "*constant",
					"value": "*data"
				},
				{
					"tag": "InitialOriginID",
					"path": "*cgreq.InitialOriginID",
					"type": "*variable", 
					"value": "~*req.Session-Id",
					"mandatory": true
				},
				{
					"tag": "OriginID",
					"path": "OriginID",
					"type": "*variable", 
					"value": "~*req.Session-Id",
					"mandatory": true
				},
				{
					"tag": "OriginID",
					"path": "*cgreq.OriginID",
					"type": "*constant",
					"value": "_grp2"
				},
				{
					"tag": "RequestType",
					"path": "*cgreq.RequestType",
					"type": "*constant",
					"value": "*prepaid"
				},
				{
					"tag": "Category",
					"path": "*cgreq.Category",
					"type": "*constant",
					"value": "generic"
				},
				{
					"tag": "Account",
					"path": "*cgreq.Account",
					"type": "*variable",
					"mandatory": true, 
					"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"
				},
				{
					"tag": "Destination",
					"path": "*cgreq.Destination",
					"type": "*constant",
					"value": "data"
				},
				{
					"tag": "SetupTime",
					"path": "*cgreq.SetupTime",
					"type": "*variable", 
					"value": "~*req.Event-Timestamp",
					"mandatory": true
				},
				{
					"tag": "AnswerTime",
					"path": "*cgreq.AnswerTime",
					"type": "*variable", 
					"value": "~*req.Event-Timestamp",
					"mandatory": true
				},
				{
					"tag": "Usage",
					"path": "*cgreq.Usage",
					"type": "*constant",
					"value": "2048"
				},
				{
					"tag": "LastUsed",
					"path": "*cgreq.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": "ResultCode",
					"filters": ["*notempty:~*cgrep.Error:"], 
					"path": "*rep.Result-Code",
					"type": "*constant",
					"value": "5030",
					"blocker": true
				},
			],
		},

		{
			"id": "data_terminate",
			"filters": [
				"*string:~*vars.*cmd:CCR",
				"*string:~*req.CC-Request-Type:3",
				"*prefix:~*req.Service-Context-Id:gprs"
			],
			"flags": ["*terminate", "*accounts"],
			"request_fields":[
				{
					"tag": "ToR",
					"path": "*cgreq.ToR",
					"type": "*constant",
					"value": "*data"
				},
				{
					"tag": "OriginID",
					"path": "*cgreq.OriginID",
					"type": "*variable", 
					"value": "~*req.Session-Id",
					"mandatory": true
				},
				{
					"tag": "OriginIDPrefix",
					"path": "*cgreq.OriginIDPrefix",
					"type": "*variable", 
					"value": "~*req.Session-Id",
					"mandatory": true
				},
				{
					"tag": "RequestType",
					"path": "*cgreq.RequestType",
					"type": "*constant",
					"value": "*prepaid"
				},
				{
					"tag": "Category",
					"path": "*cgreq.Category",
					"type": "*constant",
					"value": "generic"
				},
				{
					"tag": "Account",
					"path": "*cgreq.Account",
					"type": "*variable",
					"mandatory": true, 
					"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"
				},
				{
					"tag": "Destination",
					"path": "*cgreq.Destination",
					"type": "*constant",
					"value": "data"
				},
				{
					"tag": "SetupTime",
					"path": "*cgreq.SetupTime",
					"type": "*variable", 
					"value": "~*req.Event-Timestamp",
					"mandatory": true
				},
				{
					"tag": "AnswerTime",
					"path": "*cgreq.AnswerTime",
					"type": "*variable", 
					"value": "~*req.Event-Timestamp",
					"mandatory": true
				},
				{
					"tag": "LastUsed",
					"path": "*cgreq.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"
				},
			],
		},
	]
}

}
