Using Regular Expressions to Match Incoming SIP Messages to Policies
You can use regular expressions to match the information in the contact and request URI fields of incoming SIP messages. You configure the regular expressions in the from condition of new call usage policies and new transaction policies.
Table 16 describes the regular expressions supported for policies.
If you use parentheses or spaces in your regular expression, you must enclose the expression in double quotation marks.
Table 16: Regular Expressions Supported for Policies
Operator | Matches |
|---|---|
. | Any single character including a space |
* | 0 or more instances of a character or pattern |
+ | 1 or more instances of a character or pattern |
? | 0 or 1 instances of a character or pattern |
( ) | Group of expressions. |
| | One of the two terms on either side of the pipe |
[start-end] | Range of characters |
[^start-end] | One instance of any character that is not in the range |
[A-Za-z0-9_] | Any alphanumeric character |
Examples of Regular Expressions Used for VoIP Calls
Table 17 provides examples of regular expressions used in the request URI or contact fields of policies.
Table 17: Examples of Regular Expressions Used for VoIP Calls
Type of Information to Match | Example of Traffic to Match | Regular Expression Used |
|---|---|---|
Emergency 911 calls | 911 | “sip:911@.+ | tel:911” |
International calls | 011xxxxxxxx | “+:011[0-9]+@.+ | tel:011[0-9]+” |
Access to outside line | 9 | “sip:9[0-9]+@.+ | tel:9[0-9]+” |
Area code and 1 + dialing | 1 408/506 | “sip:(1(408|506)([0-9]+)@.+) | (tel:1(408|506)([0-9]+))” |
Emergency calls | x11 | “sip:[2-9]11@.+ | tel:[2-9]11” |
Domain name | @juniper.net | .*@juniper.net |