Routing table expressions

This topic describes the routing table expressions you can use in the gateway routing table.

Pattern matching expressions

The following table provides a description of the regular expressions used for pattern matching in the Incoming Called party and Incoming Calling party fields of the gateway routing table.

Note: Incoming PSTN calls are always represented by TEL URIs. Incoming SIP calls can use either SIP or TEL URIs. You must specify the inbound protocol (SIP, PSTN, Clearmode, any) of the incoming call in the routing profile to differentiate between PSTN calls and SIP calls that use TEL URIs; see General routing profile parameters.

Pattern

Usage

tel:

Prefixes the regular expression to indicate that it applies to TEL URIs.

By default, this prefix indicates that the regular expression applies to inbound PSTN calls and inbound SIP calls that use a TEL URI; however, this setting can be overridden by the routing profile settings.

sip:

Prefixes the regular expression to indicate that it applies to SIP URIs.

By default, this prefix indicates that the regular expression applies to inbound SIP calls and inbound SIP Clearmode calls; however, this setting can be overridden by the routing profile settings.

. (period)

Matches any single character.

\d

Matches any single digit, 0 through 9.

{n}

Matches the preceding character exactly n times.

For example, the pattern \d{7} matches the seven-digit telephone number in 1234567@gateway.dialogic.com and the first seven-digits in the called number 0123456789. It does not match anything in 123456@gateway.dialogic.com.

* (asterisk)

Matches the preceding character zero or more times.

For example, the pattern \d* matches all of the digits in 5082711847@gateway.dialogic.com and also matches user@gateway.dialogic.com, although the matching substring in this case is empty.

+ (plus)

Matches the preceding character one or more times.

For example, the pattern \d+ matches all of the digits in 5082711847@gateway.dialogic.com but does not match user@gateway.dialogic.com.

?

Matches the preceding character 0 or 1 times.

For example, the pattern 1?\d+ matches tel:5082711847 and tel:15082711847.

^ (carat)

Causes the pattern that follows the ^ (carat) sign to match only if the match occurs at the beginning of the string.

For example, the pattern ^847 matches the beginning of number 8479258900 but does not match the beginning of number 5082711847.

$ (dollar)

Causes the pattern preceding the $ (dollar) sign to match only if the match occurs at the end of the string.

For example, the pattern 847$ matches the end of number 5082711847 but does not match the end of number 8479258900.

(pattern)

Causes the pattern in parentheses and the matching substring to be stored in a variable ($1, $2, ….) for subsequent substitution into the outgoing calling/called number or from/to URI.

For example, the pattern 508(\d*) matches 5082711847 and sets the variable $1 = 2711847.

Use multiple enclosed patterns to store multiple matching substrings in different variables.

For example, the pattern sip:(.*)@(.*) matches sip: 5082711847@gateway.dialogic.com and sets the variables $1 = 5082711847 and $2 = gateway.dialogic.com.

Letters, digits, and other characters

Match what they represent.

For example, the pattern 847 matches the area code in the number 8475558900 and also matches the last three digits in 5082711847@gateway.dialogic.com.

Pattern generation expressions

The following table provides a description of the special variables and tokens used for generating routing expressions in the Outgoing Called party and Outgoing Calling party fields of the gateway routing table.

Pattern

Usage

tel:

Prefixes the expression to create a TEL URI outgoing routing expression. By default, routes to a PSTN destination.

sip:

Prefixes the expression to create a SIP URI outgoing routing expression. By default, routes to a SIP destination.

reject

(Valid for the Outgoing Calling party column only.) Rejects calls that match the routing rule.

$n, where n is a numeric value

Inserts substrings into the routing expression, created while pattern matching the associated Incoming Called party and Incoming Calling party fields. For more information, see the row for (pattern) in Pattern matching expressions.

Letters, digits, and other characters

Copied as is to the resulting outgoing routing expression. Use only characters allowed in a SIP or TEL URI.