Files
cgrates/data/conf/samples/diam_tutmysql/voice.json

279 lines
10 KiB
JSON

{
"diameter_agent": {
"request_processors": [
{
"id": "VoiceInit",
"filters": [
"*string:~*vars.*cmd:CCR",
"*string:~*req.CC-Request-Type:1",
"*string:~*req.Service-Context-Id:voice"
],
"flags": ["*authorize", "*accounts"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*voice"},
{
"tag": "OriginID", "path": "*cgreq.OriginID",
"type": "*variable", "mandatory": true,
"value": "~*req.Service-Information.IMS-Information.User-Session-Id"
},
{
"tag": "OriginHost", "path": "*cgreq.OriginHost",
"type": "*variable", "mandatory": true,
"value": "~*vars.OriginHost"
},
{
"tag": "Source", "path": "*cgreq.Source",
"type": "*constant", "value": "DiameterAgent"
},
{
"tag": "RequestType", "path": "*cgreq.RequestType",
"type": "*constant", "value": "*prepaid"
},
{
"tag": "Account", "path": "*cgreq.Account",
"type": "*variable", "mandatory": true,
"value": "~*req.Service-Information.IMS-Information.Calling-Party-Address[0]:s/tel:\\+(\\d+)/${1}/"
},
{
"tag": "Account", "path": "*cgreq.Account",
"filters":["*string:~*req.Service-Information.IMS-Information.Role-Of-Node:2"],
"type": "*variable", "mandatory": true,
"value": "~*req.Service-Information.IMS-Information.Requested-Party-Address:s/tel:(\\+?\\d+)/${1}/:s/sip:(\\+?\\d+)/${1}/:s/^\\+49(\\d+)/int${1}/:s/^0049(\\d+)/int${1}/:s/^49(\\d+)/int${1}/:s/^00(\\d+)/+${1}/:s/^[\\+]?(\\d+)/int${1}/:s/int(\\d+)/49${1}/"
},
{
"tag": "Destination", "path": "*cgreq.Destination",
"type": "*variable", "mandatory": true,
"value": "~*req.Service-Information.IMS-Information.Called-Party-Address:s/tel:(\\+?\\d+)/${1}/:s/^\\+49(\\d+)/int${1}/:s/^0049(\\d+)/int${1}/:s/^49(\\d+)/int${1}/:s/^00(\\d+)/+${1}/:s/^[\\+]?(\\d+)/int${1}/:s/int(\\d+)/+49${1}/"
},
{
"tag": "Destination", "path": "*cgreq.Destination",
"filters": [
"*prefix:~*req.Service-Information.IMS-Information.Called-Party-Address:tel:+",
"*notprefix:~*req.Service-Information.IMS-Information.Called-Party-Address:tel:+49"
],
"type": "*variable", "mandatory": true,
"value": "~*req.Service-Information.IMS-Information.Called-Party-Address:s/tel:(\\+?\\d+)/${1}/:s/^\\+(\\d+)/int${1}/:s/^[\\+]?(\\d+)/int${1}/:s/int(\\d+)/+00${1}/"
},
{
"tag": "SetupTime", "path": "*cgreq.SetupTime",
"type": "*variable", "mandatory": true,
"value": "~*req.Event-Timestamp"
},
{
"tag": "SetupTime", "path": "*cgreq.SetupTime",
"type": "*variable", "mandatory": true,
"filters": ["*exists:~*req.Service-Information.IMS-Information.Time-Stamps.SIP-Request-Timestamp:"],
"value": "~*req.Service-Information.IMS-Information.Time-Stamps.SIP-Request-Timestamp"
},
{
"tag": "Usage", "path": "*cgreq.Usage",
"type": "*constant", "mandatory": true,
"value": "10s"
},
{
"tag": "IMSI", "path": "*cgreq.IMSI",
"type": "*variable", "value": "~*req.User-Name"
}
],
"reply_fields":[
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{
"tag": "GrantedUnitsError",
"path": "*rep.Granted-Service-Unit.CC-Time",
"filters": ["*notempty:~*cgrep.Error:"],
"type": "*constant", "blocker": true,
"value": "0"
},
{
"tag": "GrantedUnitsUnlimited",
"path": "*rep.Granted-Service-Unit.CC-Time",
"filters": ["*eq:~*cgrep.MaxUsage:-1"],
"blocker": true,
"type": "*constant", "value": "10"},
{"tag": "GrantedUnits", "path": "*rep.Granted-Service-Unit.CC-Time",
"type": "*variable", "mandatory": true,
"value": "~*cgrep.MaxUsage{*duration_seconds}"}
]
},
{
"id": "VoiceUpdate1",
"filters": [
"*string:~*vars.*cmd:CCR",
"*string:~*req.CC-Request-Type:2",
"*eq:~*req.CC-Request-Number:1",
"*string:~*req.Service-Context-Id:voice",
],
"flags": ["*initiate", "*accounts"],
"request_fields":[
{
"tag": "OriginID", "path": "*cgreq.OriginID",
"type": "*variable", "mandatory": true,
"value": "~*req.Service-Information.IMS-Information.User-Session-Id"},
{
"tag": "OriginHost", "path": "*cgreq.OriginHost",
"type": "*variable", "value": "~*vars.OriginHost"
},
{
"tag": "Source", "path": "*cgreq.Source",
"type": "*constant","value": "DiameterAgent"
},
{
"tag": "RequestType", "path": "*cgreq.RequestType",
"type": "*constant", "value": "*prepaid"
},
{
"tag": "Account", "path": "*cgreq.Account",
"type": "*variable", "mandatory": true,
"value": "~*req.Service-Information.IMS-Information.Calling-Party-Address[0]:s/tel:\\+(\\d+)/${1}/"
},
{
"tag": "Account", "path": "*cgreq.Account",
"filters":["*string:~*req.Service-Information.IMS-Information.Role-Of-Node:2"],
"type": "*variable", "mandatory": true,
"value": "~*req.Service-Information.IMS-Information.Requested-Party-Address:s/tel:(\\+?\\d+)/${1}/:s/sip:(\\+?\\d+)/${1}/:s/^\\+49(\\d+)/int${1}/:s/^0049(\\d+)/int${1}/:s/^49(\\d+)/int${1}/:s/^00(\\d+)/+${1}/:s/^[\\+]?(\\d+)/int${1}/:s/int(\\d+)/49${1}/"
},
{
"tag": "Destination", "path": "*cgreq.Destination",
"type": "*variable", "mandatory": true,
"value": "~*req.Service-Information.IMS-Information.Called-Party-Address:s/tel:(\\+?\\d+)/${1}/:s/^\\+49(\\d+)/int${1}/:s/^0049(\\d+)/int${1}/:s/^49(\\d+)/int${1}/:s/^00(\\d+)/+${1}/:s/^[\\+]?(\\d+)/int${1}/:s/int(\\d+)/+49${1}/"
},
{
"tag": "Destination", "path": "*cgreq.Destination",
"filters": [
"*prefix:~*req.Service-Information.IMS-Information.Called-Party-Address:tel:+",
"*notprefix:~*req.Service-Information.IMS-Information.Called-Party-Address:tel:+49"
],
"type": "*variable", "mandatory": true,
"value": "~*req.Service-Information.IMS-Information.Called-Party-Address:s/tel:(\\+?\\d+)/${1}/:s/^\\+(\\d+)/int${1}/:s/^[\\+]?(\\d+)/int${1}/:s/int(\\d+)/+00${1}/"
},
{
"tag": "SetupTime", "path": "*cgreq.SetupTime",
"filters": ["*exists:~*req.Service-Information.IMS-Information.Time-Stamps.SIP-Request-Timestamp:"],
"type": "*variable", "mandatory": true,
"value": "~*req.Service-Information.IMS-Information.Time-Stamps.SIP-Request-Timestamp"
},
{
"tag": "AnswerTime", "path": "*cgreq.AnswerTime",
"type": "*variable", "mandatory": true,
"value": "~*req.Event-Timestamp"
},
{
"tag": "Usage", "path": "*cgreq.Usage",
"type": "*constant", "value": "10s"
},
{
"tag": "IMSI", "path": "*cgreq.IMSI",
"type": "*variable", "mandatory": true,
"value": "~*req.User-Name"
}
],
"reply_fields":[
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{
"tag": "GrantedUnitsError",
"filters": ["*notempty:~*cgrep.Error:"],
"path": "*rep.Granted-Service-Unit.CC-Time", "blocker": true,
"type": "*constant", "value": "0"
},
{
"tag": "GrantedUnitsUnlimited",
"filters": ["*eq:~*cgrep.MaxUsage:-1"],
"path": "*rep.Granted-Service-Unit.CC-Time", "blocker": true,
"type": "*constant", "value": "10"
},
{
"tag": "GrantedUnits", "path": "*rep.Granted-Service-Unit.CC-Time",
"type": "*variable", "mandatory": true,
"value": "~*cgrep.MaxUsage{*duration_seconds}"
}
]
},
{
"id": "VoiceUpdate2",
"filters": [
"*string:~*vars.*cmd:CCR",
"*string:~*req.Service-Context-Id:voice",
"*string:~*req.CC-Request-Type:2",
"*gte:~*req.CC-Request-Number:2"
],
"flags": ["*update", "*accounts"],
"request_fields":[
{
"tag": "OriginID", "path": "*cgreq.OriginID",
"type": "*variable", "mandatory": true,
"value": "~*req.Service-Information.IMS-Information.User-Session-Id"
},
{
"tag": "OriginHost", "path": "*cgreq.OriginHost",
"type": "*variable", "value": "~*vars.OriginHost"
},
{
"tag": "Usage", "path": "*cgreq.Usage",
"type": "*constant", "value": "10s"
},
],
"reply_fields":[
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{
"tag": "GrantedUnitsOnError",
"filters": ["*notempty:~*cgrep.Error:"],
"path": "*rep.Granted-Service-Unit.CC-Time", "blocker": true,
"type": "*constant", "value": "0"
},
{
"tag": "GrantedUnitsUnlimited",
"filters": ["*eq:~*cgrep.MaxUsage:-1"],
"path": "*rep.Granted-Service-Unit.CC-Time", "blocker": true,
"type": "*constant", "value": "10"
},
{
"tag": "GrantedUnits", "path": "*rep.Granted-Service-Unit.CC-Time",
"type": "*variable", "mandatory": true,
"value": "~*cgrep.MaxUsage{*duration_seconds}"
}
]
},
{
"id": "VoiceTerminate",
"filters": [
"*string:~*vars.*cmd:CCR",
"*string:~*req.Service-Context-Id:voice",
"*string:~*req.CC-Request-Type:3"
],
"flags": ["*terminate", "*accounts", "*cdrs"],
"request_fields":[
{
"tag": "OriginID", "path": "*cgreq.OriginID",
"type": "*variable", "mandatory": true,
"value": "~*req.Service-Information.IMS-Information.User-Session-Id"
},
{
"tag": "OriginHost", "path": "*cgreq.OriginHost",
"type": "*variable", "value": "~*vars.OriginHost"
},
{
"tag": "Usage", "path": "*cgreq.Usage",
"filters": ["*exists:~*req.Service-Information.IMS-Information.Time-Stamps.SIP-Response-Timestamp:"],
"type": "*usageDifference", "mandatory": true,
"value": "~*req.Event-Timestamp;~*req.Service-Information.IMS-Information.Time-Stamps.SIP-Response-Timestamp"},
{
"tag": "Usage", "path": "*cgreq.Usage",
"filters": ["*notexists:~*req.Service-Information.IMS-Information.Time-Stamps.SIP-Response-Timestamp:"],
"type": "*constant", "value": "0s"
},
],
"reply_fields":[
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "filters": ["*notempty:~*cgrep.Error:"],
"path": "*rep.Result-Code", "blocker": true,
"type": "*constant", "value": "5030"},
{"tag": "ResultCode", "path": "*rep.Result-Code",
"type": "*constant", "value": "2001"}
]
},
]
}
}