Skip to content

Numbers translations

Yeti has flexible configuration of numbers modifications - it allows to change source and destination numbers on different call processing stages:

  1. Before routing, during Customers Auth processing:

    • Customer Auth SRC/DST rewrite rules
    • Customer Auth DST Numberlist rewrites
    • Customer Auth SRC Numberlist rewrites
  2. Before routing, during Routing Plan Numberlist processing:

    • Routing Plan DST Numberlist rewrites
    • Routing Plan SRC Numberlist rewrites
  3. After routing:

    • Dialpeer SRC Name, SRC Number, DST Number rewrite rules
    • Deferred Numberlist rewrites
  4. After routing at termination Gateway:

    • DST Termination Numberlist rewrites
    • SRC Termination Numberlist rewrites
    • Gateway SRC/DST rewrite rules
    • Gateway to_rewrite_rule( affects only To-Uri userpart)

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:

ActionOriginal Numberrewrite_rulerewrite_resultRewrite result
Add prefix 07335255^(.*)$0\107335255
Add prefix 0662296132^(.*)$066\10662296132
Add prefix 380487050460^(.*)$38048\1380487050460
Add prefix +380487050460^(.*)$+\1+380487050460
Remove prefix 999#999#380487050460^999#(.*)$\1380487050460
Remove prefix ++380487050460^\+(.*)$\1380487050460
Remove first 2 symbols380487050460^.{2}(.*)$\10487050460
Remove last 3 symbols380487050460^(.*).{3}$\1380487050
Add suffix 12345380487050460^(.*)$\11234538048705046012345
Replace prefix 123# with 321#123#380487050460^123#(.*)$321#\1321#380487050460