Border SIP message modification rule (sipmodrule)
Description
Rule for modifying incoming and outgoing SIP messages at the system borders with the outside world. Used for deep, fine-grained adaptation of SIP messages at borders. In particular, as a result of applying a rule with full-text processing, the received packet can be dropped.
Messages are passed for modification in text, unparsed form. Because applying modification rules is quite resource-intensive, rule application is bound to specific instances of facade SIP message processing microservices (sg and esg). For each of them, a list of codes for filtering rules is specified in the configuration parameters.
Several rules can exist with one code. Rules found by codes are applied in descending priority order (increasing priority field value). Rules are processed up to the last matching one, or the process stops if the next matching rule specifies the apply_last action.
Normal mode uses regular expressions and filters. To speed up processing, a function from a custom Erlang module loaded via a patch can be used. For even deeper customization and going beyond the message, the modification mode using a service script can be used (significantly less performant).
Fields
{
"id": uuid,
"priority": str,
"enabled": intbool,
"code": str,
"dir": str,
"mode": str,
"mode_extension": str,
"extractors": array of str,
"filter": array,
"modifiers": array of str,
"action": str,
"repair_contentlen": intbool,
"opts": {
"title": str,
"comment": str
},
"ext": {
"ct": date,
"lwt": date
}
}
| Specification | Description |
|---|---|
Field: |
Identifier. Can be specified at creation, otherwise generated by the system. |
Field: |
Rule switch |
Field: |
Priority. A lower value means higher priority during traversal. |
SIP message direction
|
|
Field: |
Module or service script name for the module and svcscript modes respectively. |
List of extractor strings. Each string is a regular expression command. Format: Option variants (listed in arbitrary order in concatenation):
If the PATTERN body contains a named capture (?<some_key>...) then the found value is captured and placed under the specified name into the object for further filter application. Extractors may also contain no named groups; in that case they are simply checks. In any case, for the rule to apply, all extractor strings applied to the SIP message text must find matches. |
|
Filter in REST API format applied to the object with extracted values. If the rule was not ignored at the extractor stage, the filter is applied to the extraction result object. The rule applies only if the filter returns true. |
|
List of modifier strings. Each string is a regular expression command. Format: All modifiers are applied to the message sequentially. Modifiers can use special commands in the REPLACEMENT part to substitute values from the extraction result object (for example, to move values from one header to another). To do this, specify '{{some_key}}'. Option variants (listed in arbitrary order in concatenation):
The modifier list may be empty; then the message remains unchanged, but the rule action is applied and can end further traversal of lower-priority rules. |
|
Field: |
|
Field: |
If at least one applied rule has this mode set, the Content-Length header value is automatically recalculated on completion. |
Field: |
|
Field: |
Arbitrary title |
Field: |
Arbitrary comment |
Field: |
Allows extending the compound with arbitrary keys and values |
Field: |
Object creation time |
Field: |
Time of last modification of the object |
Rule application modes
| Value | Description |
|---|---|
|
Normal mode using regular expressions and filters. |
|
Mode of applying a custom Erlang module loaded with a patch.
|
|
Thin mode for applying a special service script created in the master domain. The first parameter is the message; the second parameter is the message direction: incoming | outgoing. (IMPLEMENTATION POSTPONED) |
Actions when applying an incoming or outgoing request modification rule
| Value | Description |
|---|---|
|
Applies the rule and continues processing the following lower-priority rules. |
|
Applies the rule and stops processing subsequent rules. |
|
Drops the message, stops its processing, and ends the rule processing cycle. Makes sense only for the incoming direction and rules that do not modify the message. |