diff --git a/cgrates.json b/cgrates.json index 6858467..67e8a03 100644 --- a/cgrates.json +++ b/cgrates.json @@ -82,23 +82,40 @@ }, "request_processors": [ { - "id": "Authorization", + "id": "CGRPAPAuth", "filters": ["*string:~*vars.*radReqType:*radAuth"], - "flags": ["*authorize", "*attributes", "*log"], + "flags": ["*authorize", "*attributes", "*accounts", "*continue"], "request_fields": [ - {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "data"}, + {"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "call"}, {"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid", "mandatory": true}, {"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*composed", "value": "~*req.Acct-Session-Id", "mandatory": true}, {"tag": "Account", "path": "*cgreq.Account", "type": "*composed", "value": "~*req.User-Name", "mandatory": true}, {"tag": "Subject", "path": "*cgreq.Subject", "type": "*composed", "value": "~*req.User-Name", "mandatory": true}, {"tag": "Destination", "path": "*cgreq.Destination", "type": "*constant", "value": "*any", "mandatory": true}, - {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*composed", "value": "~*req.Event-Timestamp;*now", "mandatory": true} + {"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*composed", "value": "~*req.Event-Timestamp;*now", "mandatory": true}, + {"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*composed", "value": "~*req.Event-Timestamp;*now", "mandatory": true}, + {"tag": "PasswordFromAttributes", "path": "*cgreq.PasswordFromAttributes", "type": "*constant", "value": "*attributes"} + ], + "reply_fields": [] + }, + { + "id": "RadiusPAPAuthProcessor", + "filters": ["*string:~*vars.*radReqType:*radAuth"], + "flags": ["*radauth", "*pap", "*log"], + "request_fields": [ + {"tag": "UserPassword", "path": "*vars.UserPassword", "type": "*variable", + "value": "~*cgrep.Attributes.PasswordFromAttributes"} ], "reply_fields": [ + {"tag": "RemoveAddedFields", "filters": ["*notempty:~*cgrep.Error:"], "type": "*removeall", "path": "*rep"}, + {"tag": "Code", "path": "*rep.*radReplyCode", "filters": ["*notempty:~*cgrep.Error:"], + "type": "*constant", "value": "AccessReject"}, {"tag": "ReplyMessage", "path": "*rep.Reply-Message", "filters": ["*notempty:~*cgrep.Error:"], "type": "*variable", "value": "~*cgrep.Error"}, - {"tag": "SessionTimeout", "path": "*rep.Session-Timeout", "type": "*constant", "value": "3600"}, - {"tag": "AcctInterimInterval", "path": "*rep.Acct-Interim-Interval", "type": "*constant", "value": "30"} + {"tag": "SessionTimeout", "path": "*rep.Session-Timeout", "filters": ["*empty:~*cgrep.Error:"], + "type": "*constant", "value": "3600"}, + {"tag": "AcctInterimInterval", "path": "*rep.Acct-Interim-Interval", "filters": ["*empty:~*cgrep.Error:"], + "type": "*constant", "value": "30"} ] } ] diff --git a/tariffplans/pppoe/Attributes.csv b/tariffplans/pppoe/Attributes.csv index ce5d212..13c4167 100644 --- a/tariffplans/pppoe/Attributes.csv +++ b/tariffplans/pppoe/Attributes.csv @@ -3,12 +3,13 @@ # User: test - Test user for MikroTik PPPoE cgrates.org,ATTR_PPPOE_TEST,*any,FLTR_ACCOUNT_TEST,,,,,,false,20 -cgrates.org,ATTR_PPPOE_TEST,,,,,*req.Password,*constant,test,, +cgrates.org,ATTR_PPPOE_TEST,,,,,*cgrep.PasswordFromAttributes,*constant,test,, cgrates.org,ATTR_PPPOE_TEST,,,,,*req.RequestType,*constant,*prepaid,, cgrates.org,ATTR_PPPOE_TEST,,,,,*req.MikrotikRateLimit,*constant,10M/10M,, + # User: pppoe_user1 - 10Mbps plan with static IP cgrates.org,ATTR_PPPOE_USER1,*any,FLTR_ACCOUNT_USER1,,,,,,false,20 -cgrates.org,ATTR_PPPOE_USER1,,,,,*req.Password,*constant,SecurePass123,, +cgrates.org,ATTR_PPPOE_USER1,,,,,*cgrep.PasswordFromAttributes,*constant,SecurePass123,, cgrates.org,ATTR_PPPOE_USER1,,,,,*req.RequestType,*constant,*prepaid,, cgrates.org,ATTR_PPPOE_USER1,,,,,*req.FramedIPAddress,*constant,10.0.0.101,, cgrates.org,ATTR_PPPOE_USER1,,,,,*req.FramedIPNetmask,*constant,255.255.255.0,, @@ -16,7 +17,7 @@ cgrates.org,ATTR_PPPOE_USER1,,,,,*req.MikrotikRateLimit,*constant,10M/10M,, # User: pppoe_user2 - 20Mbps plan with static IP cgrates.org,ATTR_PPPOE_USER2,*any,FLTR_ACCOUNT_USER2,,,,,,false,20 -cgrates.org,ATTR_PPPOE_USER2,,,,,*req.Password,*constant,SecurePass456,, +cgrates.org,ATTR_PPPOE_USER2,,,,,*cgrep.PasswordFromAttributes,*constant,SecurePass456,, cgrates.org,ATTR_PPPOE_USER2,,,,,*req.RequestType,*constant,*prepaid,, cgrates.org,ATTR_PPPOE_USER2,,,,,*req.FramedIPAddress,*constant,10.0.0.102,, cgrates.org,ATTR_PPPOE_USER2,,,,,*req.FramedIPNetmask,*constant,255.255.255.0,, @@ -24,6 +25,6 @@ cgrates.org,ATTR_PPPOE_USER2,,,,,*req.MikrotikRateLimit,*constant,20M/20M,, # User: pppoe_user3 - 50Mbps plan with dynamic IP cgrates.org,ATTR_PPPOE_USER3,*any,FLTR_ACCOUNT_USER3,,,,,,false,20 -cgrates.org,ATTR_PPPOE_USER3,,,,,*req.Password,*constant,SecurePass789,, +cgrates.org,ATTR_PPPOE_USER3,,,,,*cgrep.PasswordFromAttributes,*constant,SecurePass789,, cgrates.org,ATTR_PPPOE_USER3,,,,,*req.RequestType,*constant,*prepaid,, cgrates.org,ATTR_PPPOE_USER3,,,,,*req.MikrotikRateLimit,*constant,50M/50M,,