User's Manual 442 Document #: LTRT-65417
MP-11x & MP-124
Message Type Condition
Action
Subject
Action
Type
Action Value
invite.request header.from.url.host
== ‘company’
var.global.1 Modify header.priority
• Use the stored value: Assigns the same priority as the INVITE request to
SUBSCRIBE requests arriving with 'company' in the host part of the From
header:
Message Type Condition
Action
Subject
Action
Type
Action Value
subscribe.request header.from.url.host
== ‘company’
header.priority Add var.global.1
42.9 Using Regular Expressions (Regex)
You can configure SIP header manipulation rules using regular expressions (regex). Regex
is a special text string pattern matching engine which is used to define the condition that
must exist in order to use a specific manipulation rule. If the SIP header matches the regex
pattern, then the "action" of the manipulation rule is applied to the SIP message. Executing
a regex pattern also creates sub-expressions. The sub-expressions are referenced using
the $n syntax, where n is a digit in the range of 1 to 13 (e.g., $3).
Note that spaces within a regular expression must be enclosed by parenthesis, as shown
in the first example below:
body.sdp regex (AVP 8)
body.sdp regex avp
This feature provides the following main benefits:
The device does not need to know the SIP header name or structure.
The sub-expressions can be used in the manipulation action. All that is required is to
set the action (for example, add, modify, etc.) and then reference the sub-expression
you want to use as the value.
Below are a few examples using regex for SIP message manipulation:
Example 1 - Number range matching and manipulation:
• Required manipulation: When the source number has prefix 30 to 40 and a digit
(e.g., 3122), it needs to be changed to 2312. The last digit of the original phone
number is removed (i.e., 2, leaving the number as 312) and the result is prefixed
with 2.
♦ Old header:
To: <sip:3122@10.132.10.100;user=phone
♦ New header:
To: sip:2312@company244.com
• Manipulation rule:
Table 42-9: Regex-based Message Manipulation Rules - Example 1
Index Condition Action Subject
Action
Type
Action Value
1 header.to regex (<.*)([3-4][0-
9])(.*)(\d)@(.*>)
header.to Modify $1+'2'+$2+$3+'@'+$5