Diameter Manipulation Examples

This section contains examples for diameter manipulation rules. The example configurations show the entire list of fields and settings for each ruleset, nested header rules, and nested element rules. If a field does not have any operation within the set, the field is shown with a blank or default setting.

Copying Between Grouped AVPs

This example shows how to copy data from one AVP within a grouped AVP to another, different grouped AVP. It contains the following rules:
  • StoreAVP832: Stores the value of the Called-Party-Address AVP (832). This AVP is located within the IMS-Information grouped AVP (876), which is located within the root-level Service-Information grouped AVP (873).
  • AddStoredAVP: Adds AVP 832 to the Subscription-ID grouped AVP (443), which is located within AVP 873. This path is identified in the avp-path parameter.
diameter-manipulation
        name                                    StoreAndAddGroupedAVPs
        description                             
        diameter-manip-rule
                name                                    StoreAVP832
                avp-code                                832
                avp-type                                octet-string
                action                                  store
                msg-cmd-code                            271
                comparison-type                         pattern-rule
                match-value                             .*
                avp-path                                873,876
        diameter-manip-rule
                name                                    AddStoredAVP
                avp-code                                832
                avp-type                                octet-string
                action                                  add
                msg-type                                request
                msg-cmd-code                            271
                comparison-type                         pattern-rule
                new-value                               $storeAVP832.$0
                avp-path                                873,443

If an instance of AVP 832 already exists within AVP 443, because the rule does not specify an index position, the new instance is added at the end. To add it at the beginning, you would set avp-path to 873,443[0].

Copying Between a Grouped AVP and Root

This example shows how to copy data from one AVP within a grouped AVP to the root level. It contains the following rules:
  • StoreAVP832: Stores the value of the Called-Party-Address AVP (832). This AVP is located within the IMS-Information grouped AVP (876), which is located within the root-level Service-Information grouped AVP (873), as identified in the avp-path parameter.
  • AddStoredAVP: Adds AVP 832 at the root level. This path is identified by leaving the avp-path parameter blank.
diameter-manipulation
        name                                    StoreGroupAndAddRoot
        description                             
        diameter-manip-rule
                name                                    StoreAVP832
                avp-code                                832
                avp-type                                octet-string
                action                                  store
                msg-cmd-code                            271
                comparison-type                         pattern-rule
                match-value                             .*
                avp-path                                873,876
        diameter-manip-rule
                name                                    AddStoredAVP
                avp-code                                832
                avp-type                                octet-string
                action                                  add
                msg-type                                request
                msg-cmd-code                            271
                comparison-type                         pattern-rule
                new-value                               $StoreAVP832.$0
                avp-path   

Adding a New Grouped AVP with Existing Values

This example shows how to create a new root-level grouped AVP containing multiple new AVPs, with values from two instances of an existing AVP within another grouped AVP. It contains the following rules:
  • AddAVPA: Creates new grouped AVP A at root level.
  • StoreAVP832A: Stores the value of the first instance of Called-Party-Address AVP (832), located within the IMS-Information grouped AVP (876), which is located within the root-level Service-Information grouped AVP (873).

    When there are multiple instances of an AVP, you must include the 0-based index number in avp-path. If you do not, the last position is used. In this example, if you did not include [0] in avp-path for this rule, StoreAVP832A and StoreAVP832B would store the same value, and the new AVPs added by later rules would have the same value.

  • StoreAVP832B: Stores the value of the second instance of Called-Party-Address AVP (832).
  • AddAVP832A: Adds Called-Party-Address AVP (832) to grouped AVP A with the value from StoreAVP832A.
  • AddAVP832B: Adds another instance of Called-Party-Address AVP (832) to grouped AVP A, in the second position, with the value from StoreAVP832B.
diameter-manipulation
        name                                    AddGroupStoreAndAdd
        description                             
        diameter-manip-rule
                name                                    AddAVPA
                avp-code                                A
                avp-type                                grouped
                action                                  add
                msg-cmd-code                            
                message-type                            request
                comparison-type                         case-sensitive
                match-value                             
                new-value
                avp-path                                
        diameter-manip-rule
                name                                    StoreAVP832A
                avp-code                                832
                avp-type                                octet-string
                action                                  store
                msg-cmd-code                            271
                comparison-type                         pattern-rule
                match-value                             .*
                avp-path                                873,876[0] 
        diameter-manip-rule
                name                                    StoreAVP832B
                avp-code                                832
                avp-type                                octet-string
                action                                  store
                msg-cmd-code                            271
                comparison-type                         pattern-rule
                match-value                             .*
                avp-path                                873,876[1]
        diameter-manip-rule
                name                                    AddAVP832A
                avp-code                                832
                avp-type                                octet-string
                action                                  add
                msg-cmd-code                            
                message-type                            request
                comparison-type                         case-sensitive
                match-value                             
                new-value                               $StoreAVP832A.$0
                avp-path                                A
        diameter-manip-rule
                name                                    AddAVP832B
                avp-code                                832
                avp-type                                octet-string
                action                                  add
                msg-cmd-code                            
                message-type                            request
                comparison-type                         case-sensitive
                match-value                             
                new-value                               $StoreAVP832B.$0
                avp-path                                A[1]

Replacing a Value in a Grouped AVP with a New Value

This example shows how to replace the value of an AVP within a grouped AVP with a completely new value. Because the new value is not copied from another AVP, you use the group-manip action to make the replacement on the appropriate AVP. The example contains the following rules:

  • In the manipExpRslt diameter-manipulation element:

    expRslt: Runs the rules contained in the expRsltCode diameter-manipulation element on response messages for grouped AVP 297.

  • In the expRsltCode diameter-manipulation element:

    expRsltCode: Searches for the value 5002 in AVP 298, and replaces it with 3002.

diameter-manipulation
        name                           manipExpRslt
        description
        diameter-manipulation-rule
                name                           expRslt
                avp-code                       297
                descr-avp-code
                avp-type                       grouped
                action                         group-manip
                comparison-type                case-sensitive
                msg-type                       response
                msg-cmd-codes                  316,317,318
                match-value
                new-value                      expRsltCode
diameter-manipulation
        name                           expRsltCode
        description
        diameter-manipulation-rule
                name                           expRsltCode
                avp-code                       298
                descr-avp-code
                avp-type                       unsignedint32
                action                         replace
                comparison-type                case-sensitive
                msg-type                       response
                msg-cmd-codes                  316,317,318
                match-value                    5002
                new-value                      3002

Replacing an AVP at the Same Level

This example shows how to replace the value of one AVP within a grouped AVP with another at the same level. It illustrates chaining group-manip actions to move deep within an AVP hierarchy. The example contains the following rules:
  • In the GroupManipAVP876 diameter-manipulation element:

    GroupAVP876: Runs the rules contained in the GroupManipAVP843 diameter-manipulation element on group AVP 876 (specified in avp-code).

  • In the GroupManipAVP843 diameter-manipulation element:

    GroupAVP843: Runs the rules contained in the ReplaceAVP diameter-manipulation element on grouped AVP 843 (specified in avp-code).

  • In the ReplaceAVP diameter-manipulation element:
    • StoreAVP844: Stores the value of the SDP-Media-Name AVP (844).
    • ReplaceAVP845: Replaces the value of the SDP-Media-Description AVP (845) with the value stored in $StoreAvp844$.0.
diameter-manipulation
        name                                    GroupManipAVP876
        description                             
        diameter-manip-rule
                name                                   GroupAVP876
                avp-code                                876
                descr-avp-code
                avp-type                                grouped
                action                                  group-manip
                msg-type                                any
                msg-cmd-code                            
                comparison-type                         case-sensitive
                match-value
                new-value                               GroupManipAVP843
                avp-path
diameter-manipulation
        name                                    GroupManipAVP843
        description                                    
        diameter-manip-rule
                name                                    GroupAVP843
                avp-code                                843
                descr-avp-code
                avp-type                                grouped
                action                                  group-manip
                msg-type                                any
                msg-cmd-code                            271
                comparison-type                         case-sensitive
                match-value
                new-value                               ReplaceAVP
                avp-path
diameter-manipulation
        name                                    ReplaceAVP
        description                             
        diameter-manip-rule
                name                                    StoreAVP844
                avp-code                                844
                descr-avp-code
                avp-type                                utfstring
                action                                  store
                msg-type                                any
                msg-cmd-code                            271
                comparison-type                         case-sensitive
                match-value
                new-value       
                avp-path                        
        diameter-manip-rule
                name                                    ReplaceAVP845
                avp-code                                845
                descr-avp-code
                avp-type                                utfstring
                action                                  replace
                msg-type                                any
                msg-cmd-code                           271
                comparison-type                         case-sensitive
                match-value                             
                new-value                               $StoreAvp844$.0
                avp-path

Adding a Grouped AVP and Child AVPs

This example includes the following rules:

  • In the diamManip1 diameter-manipulation element:
    • rule1: Adds the Supported-Features grouped AVP (628) to request messages.
    • rule2: Runs the rules contained in diamManip2 on the newly-added grouped AVP 628.
  • In the diamManip2 diameter-manipulation element, rules to include the Vendor-Id (266), Feature-List-ID (629), and Feature-List (630) AVPs within the Supported-Features grouped AVP (628) added in diamManip1.
diameter-manipulation                              
        name                                    diamManip1
        description                                       
        diameter-manip-rule                               
                name                                    rule1
                avp-code                                628  
                descr-avp-code                               
                avp-type                                grouped
                action                                  add    
                msg-type                                request
                msg-cmd-code                            265
                comparison-type                         case-sensitive
                match-value
                new-value
        diameter-manip-rule
                name                                    rule2
                avp-code                                628
                descr-avp-code
                avp-type                                grouped
                action                                  group-manip
                msg-type                                any
                msg-cmd-code
                comparison-type                         case-sensitive
                match-value
                new-value                               diamManip2
diameter-manipulation
        name                                    diamManip2
        description
        diameter-manip-rule
                name                                    rule1
                avp-code                                266
                descr-avp-code
                avp-type                                unsignedint32
                action                                  add
                msg-type                                any
                msg-cmd-code
                comparison-type                         case-sensitive
                match-value                             10
                new-value
        diameter-manip-rule
                name                                    rule2
                avp-code                                629
                descr-avp-code
                avp-type                                unsignedint32
                action                                  add
                msg-type                                any
                msg-cmd-code
                comparison-type                         case-sensitive
                match-value                             11
                new-value
        diameter-manip-rule
                name                                    rule3
                avp-code                                630
                descr-avp-code
                avp-type                                unsignedint32
                action                                  add
                msg-type                                any
                msg-cmd-code
                comparison-type                         case-sensitive
                match-value                             124
                new-value