Diameter Responses

Diameter Responses

When a Diameter response is received, the N2IWF will parse the message to determine the action(s) to take with the session being processed.

Response configuration may be applied as LogicApp global variables:

A sample Diameter response configuration for CAMEL/INAP calls might be:

<global name="READ_AVPS" type="array">
    <avp name="Cost-Information" type="array">
        <avp name="Unit-Value" type="array">
            <avp name="Value-Digits" to_var="cost_value" />
            <avp name="Exponent" to_var="cost_exp" />
        </avp>
    </avp>
</global>

<global name="RESULT_CODES" type="array">
    <rule code="4011" action="free" />
    <rule code="4012" service.at_terminate="false" action="release" announcement="ann1" />
    <rule code="4012" is_bf="true" action="release" cause="16" />
    <rule from="4000" to="5999" action="release" announcement="ann2" />
</global>

This configuration would parse Diameter answers with the following behaviour when handling CAMEL/INAP calls:

Result-Code Rules

Result-Code rules are described elsewhere as a special case of N2IWF action rules.

Read AVPs

The LogicApp global variable READ_AVPS holds additional AVP definitions that are read from the Diameter response.

This global is an array of AVPs, with each avp definition containing either a source value or other avp definitions.

If a defined AVP (or a parent of a defined AVP) is not sent by the OCS, AVP parsing will not occur.

Note that all AVPs listed for parsing must exist in the N2SVCD Diameter codec or be specified in the Diameter application as custom AVPs.

In addition to the standard IWF selector rule extensions, each avp definition supports additional parameters:

Parameter Type Description
name String [Required] The AVP name for this definition. This name must be present in the default N2SVCD Diameter codec or configured as a custom AVP in the Diameter application.
edr String If provided, the AVP’s populated value will be written to EDRs produced in the field named. EDR population is influenced by the repeat and persist parameters if to_var is also present.
to_var String If provided, the AVP’s populated value will be written to the rule engine variable named. Variable population is influenced by the repeat parameter.
to_bal_units String If provided, the AVP’s populated value will be treated as the unit value for the balance named. This value will be modified by the balance exponent.
Only one of to_bal_units, to_bal_exponent, and to_bal_currency may be specified for a single AVP.
(Default = 0)
to_bal_exponent String If provided, the AVP’s populated value will be treated as the exponent of the unit value for the balance named.
Only one of to_bal_units, to_bal_exponent, and to_bal_currency may be specified for a single AVP.
(Default = 0, no modification of unit value)
to_bal_currency String If provided, the AVP’s populated value will be treated as the currency lookup value for the balance named.
Only one of to_bal_units, to_bal_exponent, and to_bal_currency may be specified for a single AVP.
(Default = no currency translation)
repeat String Control the recording of each incidence via to_var and edr of the AVP being encountered in a single response. Possible values are:
  • overwrite: replace any existing value with the latest version
  • append: write the first instance of the AVP as normal and write any subsequent instances separated by a comma.
  • index: write each instance of the AVP separately with the name of the storage location followed by the instance number. For example, with to_var set to foo, the AVPs encountered would be written to foo1, foo2, etc. Note that this same numbering scheme applies even when the AVP is not repeated.
(Default = repeat)
persist Boolean Controls the behaviour of the to_var parameter if this AVP is not present or does not have a value in a response. When set to true, the rule engine variable will always be set to the last received value of this AVP. If set to false, the named variable will be removed if the AVP value is not present.
Does not modify EDR storage - each DIAMETER or DIAMETER-A EDR will only write the AVP values received for a single response.
(Default: true)
value Array Holds the child AVPs to parse for Grouped AVPs. Note that this must specifically be marked as type="array" in order to be correctly processed as a complex global.

Note that specifying the repeat or persist parameters on a Grouped AVP will cause that behaviour to be applied to all children of that AVP unless specified again against a leaf AVP (in which case the re-specified value will be used for that AVP only) or against a grouped AVP (in which case the re-specified value will be used for all children unless re-re-specified, and so forth).

At least one of to_var, edr, to_bal_units, to_bal_currency, or to_bal_exponent must be present for AVPs that are not Grouped.

Balance Variables

When reading AVP values, the to_bal_* directives may be used to create an internal representation of balance information provided. These balances may be populated dynamically into notifications.

Balance information returned from the OCS may populate any or all of:

Balance information is cleared prior to every request to the OCS.

If balance target name information is repeated within a single response, the balance units will be summed. Note that only the first balance currency will apply to the entire balance.

Balance units and exponents are paired via a depth-first traversal of the AVP structure. If balance target name information is repeated, ensure the returned AVP structure aligns the order of units and exponents accordingly.

Balance Currencies

For currency translation, the CURRENCIES LogicApp service global variable array may be configured to provide a list of translations from the OCS-provided value to the external representation, e.g.:

<global name="CURRENCIES" type="array">
  <currency from="554" to="$"/> <!-- ISO 4217 USD -->
  <currency from="9997" to="minutes"/> <!-- custom code for non-cash type -->
</global>

Each currency can support the following parameters:

Attribute Type Description
from String [Required] The unique value provided by the OCS for balances using this currency.
to String [Required] The display value to use for this currency within notifications.