Forwarding rule (redirectrule)

Description

Forwarding rule assigned to the numbers (of SIP user accounts).
Applied by the role server B2BUA when making calls to SIP users' internal numbers.

Includes several types of routing: absolute, by no registered devices and various unsuccessful responses from called devices.

Cascade forwarding can be applied sequentially A → B → C → D.

Filtering by call initiator number is supported.

Limitations

  • The collection is not available in the master domain.

  • When using a SIP user account in queues as a resource, simultaneous forwarding can be detrimental to queue principles.

  • Does not apply to forwarding configured on the SIP device itself and initiated by receiving SIP responses with codes `3xx`.

Fields

Entity structure
{
  "id": uuid,
  "type": str,
  "filter_number": str,
  "tran_number": str,
  "priority": int,
  "enabled": intbool,
  "schedule": str,
  "periods": array<object>,
  "opts": {
    "title": str,
    "comment": str
  },
  "ext": {
    "ct": date,
    "lwt": date
  }
}
Table 1. Fields
Specification Description

Field: id
Mode: inout
Type: uuid
Default: generated

Identifier. Can be specified at creation, otherwise generated by the system.

Field: type
Mode: in
Type: str
Default: required

Depending on the type selected, the rule can be applied under different conditions and at different points in the device call process.
Rules for mapping specific SIP responses to types of forwarding rule application conditions occur in general domain settings.
The table summarizes the correspondence that applies by default.

If several account devices are called in parallel, in case of failure, the so-called best result is selected from all received SIP response codes: 603, 486, 6xx, 5xx, 4xx.

Field: filter_number
Mode: in
Type: str
Default: required

Filter mask of the number to which the forwarding rule belongs.
This can be a directly specified SIP user account number, in which case the rule is individualized.
But a search filter mask can also be specified.
Filter operation modes.

Field: filter_fromnumber
Mode: in
Type: str
Default: required

Mask-filter of the number from which the call is being made.
Filter operation modes.

Field: tran_number
Mode: in
Type: str
Default: required

Forwarding number-destination modifier.
By default, any text value assigned to a field is applied without modification, but if it contains special formatting, the result can be dynamically modified.
Modes of modifier operation.

Field: priority
Mode: in
Type: int
Default: required

Priority. A lower value means a higher priority.

Field: enabled
Mode: in
Type: intbool
Default: required

Switch. The rule only applies if it is enabled.

Field: schedule
Mode: in
Type: str
Default: "all"

Specifies the activity schedule of the rule.
Working/non-working hours are defined in the settings of the current domain, or in the parent domains up to the master domain.
Work schedule

Field: periods
Mode: in
Type: array<object>
Default: empty

Activity interval during the week.
Applies in mode schedule = custom.
Each item in the list covers a specific segment within the week: from time on a particular day of the week to time on another particular day of the week.
Based on the aggregate of these segments, an overall schedule is generated.
Weekly schedule list item.

Field: opts
Mode: in
Type: object
Composite field

Field: opts.title
Mode: in
Type: str
Default: empty

Arbitrary header

Field: opts.comment
Mode: in
Type: str
Default: empty

Arbitrary comment

Field: opts.tab
Mode: in
Type: array<object>
Default: []

Tabular data for using filters within a single rule search session.
Each object in the list contains arbitrary fields that can be used in the mask as a string {tab:some_field}.
For more details see Filter operation modes, item 'Table'.

Field: ext
Mode: inout
Type: object
Compound field

Allows you to extend the compound with arbitrary keys and values

Field: ext.ct
Mode: out
Type: date
Default: generated

Object creation time

Field: ext.lwt
Mode: out
Type: date
Default: generated

Time of last modification of the object

Types of conditions for application of forwarding rules

Table 2. Types of conditions for application of forwarding rules
Value Description

"absolute"

The forwarding rule is always valid. It is applied before the call starts.

"unregistered"

The forwarding rule applies if the account has no registered devices at the time of the call. It is applied before the call starts.

"busy"

The forwarding rule takes effect after receiving a response matched in the general settings with the result Busy. Default SIP response code 486 Busy Here.

"timeout"

The call forwarding rule is effective after receiving the expiration of the allowed call time (by default 30 seconds, or set in the settings of the SIP-user account), or receiving a response 408 Timeout.

"decline"

The forwarding rule takes effect after receiving a response matched in the general settings with the result Rejected. Default SIP response code 603 Decline.

"dnd"

The forwarding rule takes effect after receiving a response mapped to DND (Do Not Disturb) in the general settings. The default SIP response codes are as follows 404 Not Found, 480 Temporary Unavailable.

"error"

The forwarding rule is in effect after errors are detected during calls.

"other"

The forwarding rule takes effect after receiving SIP responses that are not matched with other types of results.

Filter operation modes

Table 3. Filter operation modes
Mode Description

Posymbolic

The value to be subjected to the conformance check is passed through the filter character by character.
The following special characters may be used:

  • X – any character;

  • * – all remaining characters;

  • ? - any character (if used for filtering by domain names, any character except dot - domain name separator).

  • $ – any number of characters to the nearest point.

If it is necessary to specify one of the service characters as a target character, it should be enclosed in square brackets, e.g. [X].

For example, XXX is any three-character value.

Table

The {tab:…​} substring can be used. It can be used to select a group of characters in the tested value and match them with the table embedded in the rule (opts.tab).
For example, {tab:a} - select a substring and map it to the a field of all objects/rows in the table.
The table serves as a bundle of several filter fields and modifiers. Based on the sequential check of filters, there are fewer rows in the table, taking into account the detected matches.
The first of the remaining rows is used for application in modifiers. If there are no rows left in the table, the rule is rejected.
Capturing characters from the mask-based value being checked can be done automatically, or with strict specification of the substring length:

  • {tab:KEY} - Automatic capture from the value being tested.

  • {tab:KEY:LENGTH} - Capture the specified number of characters from the value being checked.

Field values in the table can be used as field values:

  • constants;

  • regular expressions (to do this, you must specify a value in the format /reg/EXPRESSION, e.g. /reg/^1[1-4]$);

  • mapping with other fields of the table (for this purpose it is necessary to specify the value in /tab/FIELD format, for example /tab/a). The mode is used to bind values of different fields. For example, to allow calls only to your own voice mailbox. The binding order must be strictly observed: if the referenced table field has not been checked yet and has not been filled with the real value of another entity field, the matching will fail. The order of checking entity fields: filter_number, filter_fromnumber.

  • any value applied without a regular expression (for this purpose /any must be set). The mode is useful only when organizing direct comparisons with values of other fields without additional filters.

The tabular modifier may be used in combination with other character mode control commands.
Multiple specification of fields in one modifier, repetition, specification of non-existent fields are allowed.

For example, {tab:a:3}XXXXX{tab:b} - allows you to highlight the 3-character city code in the number and map it to the a field in the table, and simultaneously highlight the tail starting at the 9th character and map it to the b field in the table.

Regex

The pattern is applied to the original value Pattern.

The structure of a regex pattern value:
/reg/Pattern1.

For example,- significance: "302"
- mask: "/reg/0"
- Result: true.

  • significance: "302"

  • mask: "/reg/^0$"

  • Result: false.

  • significance: "302"

  • mask: "/reg/^302$"

  • Result: true.

  • significance: "302"

  • mask: "/reg/^(301|302|305)$"

  • Result: true.

All standard regular expression rules can be applied when forming Pattern patterns.

Range

The value subject to compliance checking is a numeric integer and is within the specified numeric range.

The structure of the dia-template value:
/dia/FromValue+N - fall under the pattern of N+1 values from FromValue to FromValue+N.

For example,- significance: "302"
- mask: "/dia/300+10"
- Result: true.

Modes of modifier operation

Table 4. Modes of modifier operation
Mode Description

Posymbolic

The initial value is posymbolic with accumulation passes through the specified modifier.
The character modifier does not provide for substitution of values as the result. The specified value is treated as a constant. Characters supported 0-9,*,#.

Table

The {tab:…​} substring can be applied. It can be used to substitute a substring from a specified table field into the modifiable value (opts.tab).
The source is the first remaining row in the table after filtering.
For example, {tab:cccc} - substituting the value from the ccc field of the first remaining row in the table into the appropriate position of the summary result.
If the specified field does not exist in the first row/object, an empty value is substituted.

The table serves as a bundle of several filter fields and modifiers. Based on the sequential check of filters, there are fewer rows in the table, taking into account the detected matches.
The first of the remaining rows is used for application in modifiers. If there are no rows left in the table - the rule is rejected at the filter check stage.

The tabular modifier may be used in combination with other character mode control commands.
Multiple specification of fields in one modifier, repetitions, specification of non-existent fields are allowed.

Regex

The Pattern pattern with Opts options is applied to the original value and the detected block(s) are replaced with the pattern Replace.
The result can be fed again to the next Regex-modification operation, and so on a finite number of times.

The general structure of the regex modifier value:
/reg/Pattern1/Replace1/Opts1 /reg/Pattern2/Replace2/Opts2 …​.

Options may be omitted, or may contain any combination of characters:

  • i – case-insensitive

  • g – global.

For example,- significance: "qwerty,qwerty"
- modifier: "/reg/t/E/g /reg/qwer/a/"
- Result: "aEy,qwerEy".

When forming Pattern and Replace patterns, all standard regular expression rules can be applied, including capture groups, backward lookup, substitution of named groups, etc.

Work schedule

Table 5. Work schedule
Value Description

"all"

The rule is available for use at all times

"disabled"

The rule is not available for use ever

"work"

The rule is available for use only during business hours

"non-work"

The rule is only available for use outside of business hours

"custom"

The rule defines a customized availability schedule in the periods field of the rule

Weekly schedule list item

Table 6. Weekly schedule list item
Field Value Description

daystart

17

Day of the week of the start of the segment (1 - Mon, 7 - Sun)

daystop

17

Day of the week of the end of the segment (1 - Mon, 7 - Sun)

timestart

01440

Intraday segment start time in minutes

timestop

01440

Intraday segment end time in minutes

See also

Logical roles

  • b2b performs routing and application of forwarding rules.

  • mdc and sdc searches for forwarding rules.