Files
cgrates-radius/pppoe_accounting.json
2025-12-23 19:56:17 +05:00

119 lines
6.4 KiB
JSON

{
"radius_agent": {
"request_processors": [
{
"id": "MikrotikPPPoEAcctOn",
"filters": ["*string:~*req.Acct-Status-Type:Accounting-On"],
"flags": ["*log", "*none"],
"request_fields": [],
"reply_fields": []
},
{
"id": "MikrotikPPPoEAcctOff",
"filters": ["*string:~*req.Acct-Status-Type:Accounting-Off"],
"flags": ["*log", "*none"],
"request_fields": [],
"reply_fields": []
},
{
"id": "MikrotikPPPoEAcctStart",
"filters": ["*string:~*req.Acct-Status-Type:Start"],
"flags": ["*log", "*initiate", "*attributes", "*resources", "*accounts"],
"request_fields": [
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*data"},
{"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"},
{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable",
"value": "~*req.Acct-Session-Id", "mandatory": true},
{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*variable",
"value": "~*req.NAS-IP-Address", "mandatory": true},
{"tag": "Account", "path": "*cgreq.Account", "type": "*variable",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable",
"value": "~*req.User-Name", "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": "CallingStationId", "path": "*cgreq.CallingStationId", "type": "*variable",
"value": "~*req.Calling-Station-Id"},
{"tag": "FramedIPAddress", "path": "*cgreq.FramedIPAddress", "type": "*variable",
"value": "~*req.Framed-IP-Address"},
{"tag": "RemoteAddr", "path": "*cgreq.RemoteAddr", "type": "*variable",
"value": "~*vars.RemoteHost:s/(.*):\\d+/${1}/"}
],
"reply_fields": []
},
{
"id": "MikrotikPPPoEAcctInterim",
"filters": ["*string:~*req.Acct-Status-Type:Interim-Update"],
"flags": ["*log", "*update", "*accounts"],
"request_fields": [
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*data"},
{"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"},
{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable",
"value": "~*req.Acct-Session-Id", "mandatory": true},
{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*variable",
"value": "~*req.NAS-IP-Address", "mandatory": true},
{"tag": "Account", "path": "*cgreq.Account", "type": "*variable",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable",
"value": "~*req.User-Name", "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": "*variable",
"value": "~*req.Acct-Session-Time{*duration_seconds}"},
{"tag": "LastUsed", "path": "*cgreq.LastUsed", "type": "*sum",
"value": "~*req.Acct-Input-Octets;~*req.Acct-Output-Octets"}
],
"reply_fields": []
},
{
"id": "MikrotikPPPoEAcctStop",
"filters": ["*string:~*req.Acct-Status-Type:Stop"],
"flags": ["*log", "*terminate", "*resources", "*accounts", "*cdrs"],
"request_fields": [
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*data"},
{"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "generic"},
{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable",
"value": "~*req.Acct-Session-Id", "mandatory": true},
{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*variable",
"value": "~*req.NAS-IP-Address", "mandatory": true},
{"tag": "Account", "path": "*cgreq.Account", "type": "*variable",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Subject", "path": "*cgreq.Subject", "type": "*variable",
"value": "~*req.User-Name", "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": "*variable",
"value": "~*req.Acct-Session-Time{*duration_seconds}", "mandatory": true},
{"tag": "DataUsed", "path": "*cgreq.DataUsed", "type": "*sum",
"value": "~*req.Acct-Input-Octets;~*req.Acct-Output-Octets"},
{"tag": "CallingStationId", "path": "*cgreq.CallingStationId", "type": "*variable",
"value": "~*req.Calling-Station-Id"},
{"tag": "FramedIPAddress", "path": "*cgreq.FramedIPAddress", "type": "*variable",
"value": "~*req.Framed-IP-Address"},
{"tag": "RemoteAddr", "path": "*cgreq.RemoteAddr", "type": "*variable",
"value": "~*vars.RemoteHost:s/(.*):\\d+/${1}/"}
],
"reply_fields": []
}
]
}
}