CallerId conversion rule and CalledId (provider_callerid)
Description
CallerId and CalledId conversion rule for SIP telephony provider accounts.
Used as an adapter for external and internal number plans. In particular, when modifying the CallerId of internal subscribers to send to the outside, adaptation to the external number plan takes place, and when modifying the CallerId of external subscribers to send to the inside, adaptation to the internal number plan takes place, i.e. preparation of data for routing.
The detected modification rule is applied to modify both From username (number), and To username (number). If it is necessary to separate modifications to reduce the number of rules, a special "priority" pointer can be applied as a modifier for To special "priority" pointer (first the rule for FromNumber is applied, and then the rule for ToNumber is searched for and applied, but with priority greater than or equal to the original rule and with filtering on the already modified one FromNumber).
The configured set of CallerId conversion rules can be tested via diagnostic API. Note, however, that there is a difference between the application in the test and in the call due to the fact that in the call the To number is taken from Request-Uri, and also if the value matches the username of the entity account, an empty string is substituted as the number to modify.
Fields
{
"id": uuid,
"priority": int,
"dir": str,
"idprovider": uuid,
"providercode": str,
"fromdomain": str,
"fromnumber": str,
"tonumber": str,
"modfromdisplay": str,
"modfromnumber": str,
"modtonumber": str,
"ext": {
"ct": date,
"lwt": date
},
"opts": {
"title": str,
"comment": str
}
}
Specification | Description |
---|---|
Field: |
Identifier. Can be specified at creation, otherwise generated by the system. |
Field: |
Rule Priority. A lower value means a higher priority. |
Field: |
Filter by direction of change. |
Field: |
Filter by identifier SIP telephony provider. To specify a specific provider, clear the mask in the field beforehand 'providercode'. |
Field: |
Filter mask for code SIP telephony provider. |
Field: |
Field: |
Mask-filter number/username of the call initiator (From SIP request header INVITE). |
Field: |
Destination number/username filter mask (To SIP request header INVITE). |
Field: Possible options:
|
Field: |
Field: |
Call initiator number modifier. The result goes to the input of the call routing process. |
Field: |
Call destination number modifier. The result of the application goes to the input of the call routing process. |
Field: |
Service script code for CallerId number modification and CalledId.
Variables must be created in the script with the specified names. According to the ReInvite request forwarding mode selected for the provider account, the script, as well as string modifiers, can be applied when subscriber data changes on either side. As start parameters are passed to the script:
|
Field: |
Field: |
|
Arbitrary header |
Field: |
Arbitrary comment |
Field: |
Tabular data for using filters (and modifiers) within a single rule search session. |
Field: |
Allows you to extend the compound with arbitrary keys and values |
Field: |
Object creation time |
Field: |
Direction of application of the rule
Value | Description |
---|---|
|
In the direction from the internal subscriber to the external subscriber. The rule applies to the internal subscriber’s data when it is transmitted towards the external subscriber. |
|
In the direction from the external subscriber to the internal subscriber. The rule applies to the external subscriber’s data when it is transmitted towards the internal subscriber. |
Filter operation modes
Mode | Description |
---|---|
|
The value to be subjected to the conformance check is passed through the filter character by character.
If it is necessary to specify one of the service characters as a target character, it should be enclosed in square brackets, e.g. |
|
The
Field values in the table can be used as field values: The tabular modifier may be used in combination with other character mode control commands. For example, |
|
The pattern is applied to the original value Pattern. The structure of a regex pattern value: For example,- significance:
All standard regular expression rules can be applied when forming Pattern patterns. |
|
The value subject to compliance checking is a numeric integer and is within the specified numeric range. The structure of the dia-template value: For example,- significance: |
Modes of operation of modifiers
Mode | Description |
---|---|
|
The initial value is posymbolic with accumulation passes through the specified modifier.
For example,- significance: |
|
The 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 tabular modifier may be used in combination with other character mode control commands. |
|
The Pattern pattern with Opts options is applied to the original value and the detected block(s) are replaced with the pattern Replace. The general structure of the regex modifier value: Options may be omitted, or may contain any combination of characters:
For example,- significance: When forming Pattern and Replace patterns, all standard regular expression rules can be applied, including capture groups, backward lookup, substitution of named groups, etc. |
|
The mode is realized in the task #192. (1) The rule R1 is searched by the initial From and To. (2) It is used to apply a modifier to From. (3) If the modifier To is 'priority=X', where X is any non-negative number, then (3.1.1) a new rule R2 is searched by new From and initial To, with priority starting from the specified one X. (3.1.2) modifier To from rule R2 is applied to the initial To. (3.2) otherwise the modifier To of rule R1 is applied to the initial To. The algorithm for constructing a compact set of CallerId and CalledId conversion rules can be as follows: (1) Proceed as usual. (2) If there is a need to reduce M*N rules to M+N, then (2.1) Allocate M From modification rules with high priorities, in them set the values of modifiers To in values 'priority=X'. (2.2) Create N more rules where From filters correspond to the result of modifying From, or (2.3) In the case where From modification is not required for certain values, then either modify To immediately or specify priority=X, where X is greater than the priority of the current rule. |
See also
-
Article: Telephony providers
-
Collection: Telephony provider accounts