{

"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": "*usageDifference",
            "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":[],
      },
    ],
  },

},