RADIUS Auth with integration tests

This commit is contained in:
DanB
2017-06-13 17:10:37 +02:00
parent dc812fb30a
commit 7ce514b712
13 changed files with 215 additions and 67 deletions

View File

@@ -78,28 +78,48 @@
"radius_agent": {
"enabled": true,
"sm_generic_conns": [
{"address": "127.0.0.1:2012", "transport": "*json"} // connection towards SMG component for session management
],
"request_processors": [
{
"id": "KamailioAuth",
"request_filter": "*radReqType(*radAuth)",
"request_filter": "*radReqType(*radAuthReq)",
"request_fields":[
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "Acct-Session-Id;^-;Sip-From-Tag", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed", "value": "User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed", "value": "Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed", "value": "Event-Timestamp", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "Acct-Session-Id;^-;Sip-From-Tag", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "Event-Timestamp", "mandatory": true},
],
"reply_fields":[
{"tag": "MaxUsage", "field_id": "Acct-Session-Time", "type": "*composed", "value": "~*cgrMaxUsage:s/(\\d*)\\d{9}$/$1/", "mandatory": true},
{"tag": "MaxUsage", "field_id": "SIP-AVP", "type": "*composed",
"value": "^session_max_time#;~*cgrMaxUsage:s/(\\d*)\\d{9}$/$1/", "mandatory": true},
],
},
{
"id": "KamailioAccountingStart",
"request_filter": "*radReqType(*radAcctStart)",
"request_fields":[
{"tag": "Account", "field_id": "Account", "type": "*composed", "value": "User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed", "value": "Called-Station-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "Acct-Session-Id;^-;Sip-From-Tag;^-;Sip-To-Tag", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "Event-Timestamp", "mandatory": true},
],
"reply_fields":[],
},
@@ -107,8 +127,22 @@
"id": "KamailioAccountingStop",
"request_filter": "*radReqType(*radAcctStop)",
"request_fields":[
{"tag": "Account", "field_id": "Account", "type": "*composed", "value": "User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed", "value": "Called-Station-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "Acct-Session-Id;^-;Sip-From-Tag;^-;Sip-To-Tag", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*composed",
"value": "NAS-IP-Address", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "AnswerTime", "type": "*handler", "handler_id": "*usage_difference",
"value": "Event-Timestamp;^|;Ascend-User-Acct-Time", "mandatory": true},
],
"reply_fields":[],
},