Condition

Description: Matching criteria for the rule

Syntax: (Action Subject / param) SWS match-type [SWS Action Value] * [ SWS logical-expression SWS Condition ]

Examples:

header.from.url.user == '100'
header.contact.header-param.expires > '3600'
header.to.host contains 'itsp'
param.call.dst.user != '100'
header.john exists
header.john exists AND header.to.host !contains 'john'
header.from.url.user == '100' OR header.from.url.user == '102' OR header.from.url.user == '300'
match-type
Description: Comparison to be made
Syntax:
==: equals
!=: not equals
>: greater than
<: less than
>=: greater than or equal to
<=: less than or equal to
contains: does a string contain a value (relevant only to string fields)
exists: does a certain header exists
!exists: does a certain header not exists
!contains: does a string exclude a value. Relevant only to string fields

When comparing SIP header elements that are strings, the operators '>', '<', and '=' can evaluate the expression using either lexicographical (alphanumeric) comparison or numerical value comparison. For numerical comparion, you need to use the 'num' keyword (num>, num<, num=, num>=, and so on).

For example, if the To header in a SIP message is:

To: sip:100@10.33.40.88;user=phone

and you have two Message Manipulation rules with the following conditions:

Rule 1: Header.to.url.user > '20'
Rule 2: Header.to.url.user num> '20'

Then:

Rule 1 doesn't match because '100' is not lexicographically greater than ‘20’ (i.e., 1 is less than 2).
Rule 2 matches because ’100’ is numerically greater than ‘20’.
logical-expression:
Description: Condition for the logical expression
Syntax:
AND: logical operator AND
OR: logical operator OR
Expressions are evaluated from left to right. For example: "A AND B OR C" is calculated as (A AND B) OR C.
The use of AND and OR is limited to four appearances in a single condition. For example: "A or B and C or D or E" is valid; "A or B and C or D and E or F" is invalid.