Table of Contents
List of Examples
Table of Contents
This module implements a generic Diameter Server.
This module translates incoming Diameter Messages into a JSON structure and will pass this on to the routing engine for further operations.
The module expects a reply (again in JSON), which then is translated into a Diameter Response.
Additionally, it allows you to send Diameter-Requests to another peer.
The JSON contains an array with all AVP's in the Diameter-Message and it's attributes. The format is identical for both requests and replies.
[
{
"avpCode":277,
"vendorId":0,
"Flags":64,
"int32":0
},
{
"avpCode":260,
"vendorId":0,
"Flags":64,
"list":[
{
"avpCode":266,
"vendorId":0,
"Flags":64,
"int32":10415
},
{
"avpCode":258,
"vendorId":0,
"Flags":64,
"int32":16777216
}
]
},
{
"avpCode":1,
"vendorId":0,
"Flags":64,
"string":"alice@kamailio.org"
},
{
"avpCode":618,
"vendorId":10415,
"Flags":64,
"list":[
{
"avpCode":621,
"vendorId":10415,
"Flags":64,
"string":"pcscf.kamailio.org"
}
]
},
{
"avpCode":268,
"vendorId":0,
"Flags":64,
"int32":2001
}
]
The module could be used (for example) for:
a Home-Subscriber-Server (it was written do be used as one)
a Charging-Server (Ro/Rf)
for testing Diameter-Applications
a PCRF/PCEF Emulator/Gateway
a Diameter-Routing-Agent (DRA)
...
The Following mouldes must be loaded before this module:
CDP - C Diameter Peer
CDP_AVP - CDP AVP Applications
This method will send a Diameter Request.
Meaning of the parameters is as follows:
peer - send the diameter request directly to a diameter peer [optional]. If this parameter is omitted, the default routing is used (see CDP).
appid - Diameter-Application, e.g.:
Typical App-ID's are:
16777216 - Diameter Cx/Dx
16777217 - Diameter Sh
4 - Diameter Ro (Online Charging)
...
commandcode - Diameter-Command-Code, e.g.:
300 - Diameter Cx/Dx User-Assignment Request (UAR)
301 - Diameter Cx/Dx Server-Assignment Request (SAR)
...
message - the Diameter Message (as JSON), which should be sent.
This function can be used from any route.
This method will send a Diameter Request asynchronously. The Reply to this request will be visible in the event-route "diameter:response".
The meaning of the parameters are identical to the diameter_request function.
This function is only available, if the diameter:response event-route is defined.
This PV provides the requested Diameter Application, for example:
16777216 - Diameter Cx/Dx
16777217 - Diameter Sh
4 - Diameter Ro (Online Charging)
...
This PV provides the requested Diameter Command, for example:
300 - Diameter Cx/Dx User-Assignment Request (UAR)
301 - Diameter Cx/Dx Server-Assignment Request (SAR)
...
This route is called for any incoming Diameter Request
...
event_route[diameter:request] {
$var(res) = http_connect("hss", "/application/$diameter_application/command/$diameter_command", "application/json", "$diameter_request", "$var(response)");
if ($var(res) == 200) {
$diameter_response = $var(response);
}
}
...