first commit

This commit is contained in:
2025-12-23 18:08:31 +05:00
commit a67f3609c4
8 changed files with 1843 additions and 0 deletions

64
accounting.json Normal file
View File

@@ -0,0 +1,64 @@
{
"radius_agent": {
"request_processors": [
{
"id": "KamailioAccountingStart",
"filters": ["*string:~*req.Acct-Status-Type:Start"],
"flags": ["*initiate", "*attributes", "*resources", "*accounts"],
"request_fields":[
{"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;-;~*req.Sip-From-Tag;-;~*req.Sip-To-Tag", "mandatory": true},
{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*composed",
"value": "~*req.NAS-IP-Address", "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": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "RemoteAddr" , "path": "*cgreq.RemoteAddr", "type": "*variable",
"value": "~*vars.RemoteHost:s/(.*):\\d+/${1}/"},
],
"reply_fields":[],
},
{
"id": "KamailioAccountingStop",
"filters": ["*string:~*req.Acct-Status-Type:Stop"],
"flags": ["*terminate", "*resources", "*accounts", "*cdrs"],
"request_fields":[
{"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;-;~*req.Sip-From-Tag;-;~*req.Sip-To-Tag", "mandatory": true},
{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*composed",
"value": "~*req.NAS-IP-Address", "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": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "Usage", "path": "*cgreq.Usage", "type": "*usage_difference",
"value": "~*req.Event-Timestamp;~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "RemoteAddr" , "path": "*cgreq.RemoteAddr", "type": "*variable",
"value": "~*vars.RemoteHost:s/(.*):\\d+/${1}/"},
],
"reply_fields":[],
},
],
},
},

62
authchallenge.json Normal file
View File

@@ -0,0 +1,62 @@
{
"radius_agent": {
"request_processors": [
{
"id": "Challenge",
"filters": ["*string:~*vars.*radReqType:*radAuth", "*string:~*req.Sip-From-Tag:12345678",
"*empty:~*req.User-Password:"],
"flags": ["*none", "*log"],
"reply_fields":[
{"tag": "Code", "path": "*rep.*radReplyCode",
"type": "*constant", "value": "AccessChallenge"},
{"tag": "ReplyMessage", "path": "*rep.Reply-Message",
"type": "*constant", "value": "Missing User-Password"}
],
},
{
"id": "CGRAuth",
"filters": ["*string:~*vars.*radReqType:*radAuth", "*string:~*req.Sip-From-Tag:12345678"],
"flags": ["*authorize", "*attributes", "*accounts", "*continue"],
"request_fields":[
{"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;-;~*req.Sip-From-Tag", "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": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "PasswordFromAttributes", "path": "*cgreq.PasswordFromAttributes", "type": "*constant",
"value": "*attributes"}
],
"reply_fields":[
{"tag": "MaxUsage", "path": "*rep.SIP-AVP", "type": "*composed",
"value": "session_max_time#;~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
],
},
{
"id": "RadiusAuthProcessorChallenge",
"filters": ["*string:~*vars.*radReqType:*radAuth","*string:~*req.Sip-From-Tag:12345678"],
"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"}
]
},
],
}
}

51
authchap.json Normal file
View File

@@ -0,0 +1,51 @@
{
"radius_agent": {
"request_processors": [
{
"id": "CGRCHAPAuth",
"filters": ["*string:~*vars.*radReqType:*radAuth", "*string:~*req.Sip-From-Tag:51585362"],
"flags": ["*authorize", "*attributes", "*accounts", "*continue"],
"request_fields":[
{"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;-;~*req.Sip-From-Tag", "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": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "PasswordFromAttributes", "path": "*cgreq.PasswordFromAttributes", "type": "*constant",
"value": "*attributes"}
],
"reply_fields":[
{"tag": "MaxUsage", "path": "*rep.SIP-AVP", "type": "*composed",
"value": "session_max_time#;~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
],
},
{
"id": "RadiusCHAPAuthProcessor",
"filters": ["*string:~*vars.*radReqType:*radAuth", "*string:~*req.Sip-From-Tag:51585362"],
"flags": ["*radauth", "*chap", "*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"}
]
},
],
}
}

51
authmschapv2.json Normal file
View File

@@ -0,0 +1,51 @@
{
"radius_agent": {
"request_processors": [
{
"id": "CGRMSCHAPV2PAuth",
"filters": ["*string:~*vars.*radReqType:*radAuth", "*string:~*req.Sip-From-Tag:51585363"],
"flags": ["*authorize", "*attributes", "*accounts", "*continue"],
"request_fields":[
{"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;-;~*req.Sip-From-Tag", "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": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "PasswordFromAttributes", "path": "*cgreq.PasswordFromAttributes", "type": "*constant",
"value": "*attributes"}
],
"reply_fields":[
{"tag": "MaxUsage", "path": "*rep.SIP-AVP", "type": "*composed",
"value": "session_max_time#;~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
],
},
{
"id": "RadiusAuthProcessor",
"filters": ["*string:~*vars.*radReqType:*radAuth", "*string:~*req.Sip-From-Tag:51585363"],
"flags": ["*radauth", "*mschapv2", "*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"}
]
},
],
}
}

51
authpapauth.json Normal file
View File

@@ -0,0 +1,51 @@
{
"radius_agent": {
"request_processors": [
{
"id": "CGRPAPAuth",
"filters": ["*string:~*vars.*radReqType:*radAuth", "*string:~*req.Sip-From-Tag:51585361"],
"flags": ["*authorize", "*attributes", "*accounts", "*continue"],
"request_fields":[
{"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;-;~*req.Sip-From-Tag", "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": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "path": "*cgreq.SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "path": "*cgreq.AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "PasswordFromAttributes", "path": "*cgreq.PasswordFromAttributes", "type": "*constant",
"value": "*attributes"}
],
"reply_fields":[
{"tag": "MaxUsage", "path": "*rep.SIP-AVP", "type": "*composed",
"value": "session_max_time#;~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
],
},
{
"id": "RadiusPAPAuthProcessor",
"filters": ["*string:~*vars.*radReqType:*radAuth", "*string:~*req.Sip-From-Tag:51585361"],
"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"}
]
},
],
}
}

81
authvendorwblock.json Normal file
View File

@@ -0,0 +1,81 @@
{
"radius_agent": {
"request_processors": [{
"id": "RadiusMandatoryFail",
"filters": ["*string:~*vars.*radReqType:*radAuth", "*string:~*req.User-Name:10011"],
"flags": ["*log", "*authorize", "*attributes"],
"request_fields": [
{
"tag": "UserName","path": "*cgreq.RadUserName",
"type": "*variable","value": "~*req.User-Name"
},
{
"tag": "Password","path": "*cgreq.RadPassword",
"type": "*variable","value": "~*req.User-Password"
},
{
"tag": "ReplyMessage","path": "*cgreq.RadReplyMessage",
"type": "*constant","value": "*attributes"
}
],
"reply_fields": [
{
"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","blocker": true
},
{
"tag": "ReplyMessage","path": "*rep.Reply-Message",
"type": "*variable","value": "~*cgrep.Attributes.RadReplyMessage",
"mandatory": true
}
]
},
{
"id": "RadiusWithVendor",
"filters": ["*string:~*vars.*radReqType:*radAuth", "*string:~*req.User-Name:10012"],
"flags": ["*log", "*authorize", "*attributes"],
"request_fields": [
{
"tag": "UserName","path": "*cgreq.RadUserName",
"type": "*variable","value": "~*req.User-Name"
},
{
"tag": "Password","path": "*cgreq.RadPassword",
"type": "*variable","value": "~*req.User-Password"
}
],
"reply_fields": [
{
"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","blocker": true
},
{
"tag": "MicrosoftB1","path": "*rep.Microsoft.MS-Service-Class",
"type": "*constant","value": "Class1"
},
{
"tag": "MicrosoftB2","path": "*rep.Microsoft.MS-Service-Class",
"type": "*group","value": "Class2","new_branch": true
},
{
"tag": "MicrosoftB3","path": "*rep.Microsoft.MS-Service-Class",
"type": "*group","value": "Class3","new_branch": true
}
]
}
]
}
}

92
cgrates.json Normal file
View File

@@ -0,0 +1,92 @@
{
// CGRateS Configuration file
//
"general": {
"log_level": 7,
},
"listen": {
"rpc_json": ":2012", // RPC JSON listening address
"rpc_gob": ":2013", // RPC GOB listening address
"http": ":2080", // HTTP listening address
},
"data_db": {
"db_type": "redis",
"db_port": 6379,
"db_name": "10",
},
"stor_db": { // database used to store offline tariff plans and CDRs
"db_password": "CGRateS.org", // password to use when connecting to stordb
},
"filters": {
"apiers_conns": ["*localhost"],
},
"rals": {
"enabled": true,
},
"schedulers": {
"enabled": true,
},
"cdrs": {
"enabled": true,
"rals_conns": ["*internal"],
},
"resources": {
"enabled": true,
},
"attributes": {
"enabled": true,
},
"routes": {
"enabled": true,
},
"chargers": {
"enabled": true,
},
"sessions": {
"enabled": true,
"attributes_conns": ["*localhost"],
"cdrs_conns": ["*localhost"],
"rals_conns": ["*localhost"],
"resources_conns": ["*localhost"],
"chargers_conns": ["*internal"],
"debit_interval": "10s",
},
"radius_agent": {
"enabled": true,
"sessions_conns": ["*localhost"],
"listeners":[
{
"network": "udp",
"auth_address": "0.0.0.0:1812",
"acct_address": "0.0.0.0:1813"
},
{
"network": "tcp",
"auth_address": "0.0.0.0:1812",
"acct_address": "0.0.0.0:1813"
},
],
},
"apiers": {
"enabled": true,
"scheduler_conns": ["*internal"],
},
}

1391
cgrates.json.orig Executable file

File diff suppressed because it is too large Load Diff