MESSAGE::field

Description

This command is used for below mentioned operations for a message’s field. This is valid for messages of the following protocols:
  • MQTT
  • SIP

Syntax

MESSAGE::field names
MESSAGE::field exists <field-name>
MESSAGE::field count [<field-name>]
MESSAGE::field value <field-name> [<index>]

MESSAGE::field names

  • Returns a TCL list of all field names present in the current message for the supported protocols listed above. The list may contain pseudo field names such as ‘:uri’ in addition to named fields such as SIP headers.
  • It will fail when called for protocols other than the ones listed above.

MESSAGE::field exists <field-name>

  • Returns True when field exists. False otherwise. Supports pseudo fields when applicable.
  • It will fail when called for protocols other than the ones listed above.

MESSAGE::field count

  • Returns a count of all field names present in the current message for the supported protocols listed above. It includes any pseudo field names such as ‘:uri’ in addition to named fields such as SIP headers.
  • It will fail when called for protocols other than the ones listed above.

MESSAGE::field count [<field-name>]

  • Returns a count of all instances of the given field name if present in the current message for the supported protocols listed above. Pseudo field names such as ‘:uri’ are supported in addition to named fields such as SIP headers.
  • It will fail when called for protocols other than the ones listed above.

MESSAGE::field value <field-name>

  • Get the value of the current message’s field . It will return only one of the values for a multi-instance field. The order of the returned value within multiple instances of the field will be protocol specific. It will be consistent with protocol specific iRule commands, if any.
  • It will fail when called for protocols other than the ones listed above.
  • For protocols that support this command, if the given field name is not found, an empty string will be returned “”.

MESSAGE::field value <field-name> [<index>]

  • Get the value of the current message’s field at the 0-based th index. The order of the returned value within multiple instances of the field will be protocol specific. It will be consistent with protocol specific iRule commands, if any.
  • It will fail when called for protocols other than the ones listed above.
  • For protocols that support this command, if the given field name is not found, an empty string will be returned “”. ===Examples===

when MR_INGRESS {
    switch ( [MESSAGE::proto] ) {
        "SIP" {
           if { [MESSAGE::type] eq "request" } {
              set uri [MESSAGE::field value ':uri']
              log local0. "Message's URI is : $uri"
           }
        }
    }
}