Regular expressions in Sipelia - Sipelia™ 2.8

Sipelia User Guide 2.8

series
Sipelia™ 2.8
revised_modified
2019-12-23

A regular expression is a sequence of symbols used by a regular expression engine to identify all the strings of characters that match a specific search pattern without having to list all the possible discrete values that must be returned. The Microsoft's .NET Framework Regular Expression engine is the engine used in Sipelia™.

In Sipelia™, regular expressions are used in dial plan rules to do the following:
  • Look for specific SIP extensions from which calls are made.
  • Look for destination SIP extensions to which calls are made.
  • Look for specific prefixes added to SIP extensions.
  • Change SIP extensions from which calls are received.
  • Change SIP extensions to which calls are sent.

Regular expression elements

Regular expressions used in dial plan rules typically include the following elements:
(.*)
Match any value.
  • Use this element in the Source (F) or Destination (G) fields to request Sipelia Server to look for any source or destination extension when calls are made.
  • Use this element in the New source (H) or New destination (I) fields to ensure that the source or destination extension will remain unchanged when routed by Sipelia Server.
\n
Match the value of a capturing group from a previous related field. A capturing group is one or more regular expression elements that are typically specified between parentheses and match a specific pattern.
  • Use this element in the New source (H) field to specify the capturing group from the Source field to be used as the new source value. n represents the ranking of the capturing group (\1; \2; \5, etc.) of the regular expression. For example, if Source contains 550[1-5](.*), enter \2 to use (.*) as the New source value, which in this case will remove the prefix 550 and the following digit.
  • Use this element in the New destination (I) field to specify the capturing group from the Destination field to be used as the new destination value.
n
Match a specific value. In Sipelia, this value generally represents a specific SIP extension.
  • Use this element in the New source (H) field to specify a different extension number from which the calls are made. This is useful if you want calls to come from an extension which differs from the original source extension.
  • Use this element in the New destination (I) field to specify the extension number that will receive the calls. This is useful if you want to forward calls to an extension which differs from the original destination extension.
[first - last]
Match any single character in the range from first to last.
{n}
Match the previous element exactly n times.
^
Match value at the beginning of the string.
\b
Use at the beginning and at the end of a series of regular expression elements to match on whole word only (not only a part of it).
For example, the regular expression \b6[0-9]{2}\b could be used to look for SIP extensions 600 to 699.
Regular expression construct Description
\b SIP extension boundary. Used together with the same \b element at the end of the expression, this requires the whole SIP extension to be matched. Starting or ending characters will not be omitted.
6 Look for a SIP extension that begins with 6.
[0-9] Look for the digits 0 through 9.
{2} Look for 2 occurrences of the above digits following the 6.
\b Match a SIP extension boundary.

For more information on regular expressions, see Microsoft's website.