Example 2 - Manipulation based on source and destination number:
• Required manipulation: If the destination number has prefix 6, 7, or 8 (e.g.,
85262146) and the source number has prefix 2001, then remove the first five
digits (e.g., 85262) from the destination number and add 3 as the prefix (e.g.,
3146).
♦ Old header:
From:
<sip:20011234@10.132.10.100;user=phone>;tag=XINPYDPROEOREGE
IHUHF
To: sip:85262146@10.132.10.100;user=phone
♦ New header:
From: <sip:20011234@company246.com;user=phone>;tag=1c13519
To: sip:3146@company244.com
• Manipulation rules:
Table 42-10: Regex-based Message Manipulation Rules - Example2
Index Condition Action Subject Action Type Action Value
1 header.to regex <sip:([6-8][1-
9]{4})(.*)@(.*>)
var.call.dst.0 Modify '3'+$2
2 header.from regex 2001 header.to.url.user Modify var.call.dst.0
• Explanation: These rules are slightly complex as both the To and From headers
are inspected. This rule executes
♦ If the dialed number is prefixed with a number 6-8 (inclusive)
♦ If the calling party number is prefixed with 2001
If these conditions exist, then:
♦ Remove the first five digits of the dialled string.
♦ Prefix the result with the digit 3.
The first rule matches a dialled number that occurs in the To header (e.g.,
85262146). If a match occurs, it uses a variable to store the remaining three digits
and adds the digit 3 as the prefix. The second rule inspects the From header. If it
contains the string 2001, then the user part of the To header is modified with the
prepared variable. For example, the user (at 20011234) dials 85262146, which
generates the following substring from the first rule:
♦ $1 85262
♦ $2 146
♦ $3 10.132.10.100;user=phone>
Note that this configuration isolates the last three digits in the dialled number and
prefixes them with 3. The variable now is set to 3146. The second rule does not
use sub-expressions. It simply searches for 2001 in the From header and if there
is a match the user part of the To header is manipulated using the standard
manipulation syntax.