Numbers translations
Yeti has flexible configuration of numbers modifications - it allows to change source and destination numbers on different call processing stages:
- Before routing, immediately after call authorization at Customers Auth
- Before routing, during Numberlist processing.
- After routing in Dialpeer
- After routing at termination Gateway
In most cases numbers translations implemented using POSIX Regular Expressions. This section describes general principles and examples of using POSIX Regular Expressions in Yeti.
Yeti uses logic similar to PostgreSQL REGEXP_REPLACE(phonenumber, rewrite_rule, rewrite_result) function with following arguments:
- phonenumber
- It is a phone number (source or destination) that replacement should be taken place.
- rewrite_rule
- It is a POSIX regular expression for matching sub-strings that should be replaced.
- rewrite_result
- It is a string that to replace the sub-strings which match the rewrite_rule.
The REGEXP_REPLACE() function returns a new phonenumber with the elements, which match a regular expression pattern, replaced by a new sub-string.
Examples
Some examples of number rewrite configuration are provided below:
| Action | Original Number | rewrite_rule | rewrite_result | Rewrite result |
|---|---|---|---|---|
| Add prefix 0 | 7335255 | ^(.*)$ | 0\1 | 07335255 |
| Add prefix 066 | 2296132 | ^(.*)$ | 066\1 | 0662296132 |
| Add prefix 38048 | 7050460 | ^(.*)$ | 38048\1 | 380487050460 |
| Remove prefix 999# | 999#380487050460 | ^999#(.*)$ | \1 | 380487050460 |
| Add suffix 12345 | 380487050460 | ^(.*)$ | \112345 | 38048705046012345 |
| Replace prefix 123# with 321# | 123#380487050460 | ^123#(.*)$ | 321#\1 | 321#380487050460 |