From 3b54e5b76052f624c7c025f1b2694606e9c16c50 Mon Sep 17 00:00:00 2001 From: Dmitry Sinina Date: Fri, 6 Sep 2024 19:03:32 +0300 Subject: [PATCH] fix structure (#141) * fixed structure * add github links --- en/best-practices/best-practices.rst | 8 -- .../headers-transit.rst} | 11 ++- en/best-practices/numbers-translations.rst | 93 +++++++++++++++++ en/best-practices/using-routing-tags.rst | 8 +- en/conf.py | 9 +- en/index.rst | 5 +- en/quick-start/quick_start.rst | 8 +- en/web-interface/equipment/gateways.rst | 3 +- en/web-interface/general.rst | 4 +- en/web-interface/index.rst | 2 - ...customer_auths.rst => customers-auths.rst} | 2 +- en/web-interface/routing/index.rst | 4 +- en/web-interface/yeti-ui-logout.rst | 11 --- en/web-interface/yeti-ui-regexp_replace.rst | 99 ------------------- 14 files changed, 127 insertions(+), 140 deletions(-) delete mode 100644 en/best-practices/best-practices.rst rename en/{headers-filtering.rst => best-practices/headers-transit.rst} (80%) create mode 100644 en/best-practices/numbers-translations.rst rename en/web-interface/routing/{yeti-ui-routing-customer_auths.rst => customers-auths.rst} (99%) delete mode 100644 en/web-interface/yeti-ui-logout.rst delete mode 100644 en/web-interface/yeti-ui-regexp_replace.rst diff --git a/en/best-practices/best-practices.rst b/en/best-practices/best-practices.rst deleted file mode 100644 index 11bf5d4..0000000 --- a/en/best-practices/best-practices.rst +++ /dev/null @@ -1,8 +0,0 @@ -====================================================== -Best practices -====================================================== - -.. toctree:: - :maxdepth: 2 - - using-routing-tags.rst \ No newline at end of file diff --git a/en/headers-filtering.rst b/en/best-practices/headers-transit.rst similarity index 80% rename from en/headers-filtering.rst rename to en/best-practices/headers-transit.rst index d87a332..cacdaaa 100644 --- a/en/headers-filtering.rst +++ b/en/best-practices/headers-transit.rst @@ -1,13 +1,16 @@ .. :maxdepth: 2 -================= -Headers filtering -================= +=============== +Headers transit +=============== .. _headers_fitering: -Filtering headers allows to configure the transfer of SIP headers from one Leg of the call to another. After the routing, YETI performs filtering twice: for the origination :ref:`Gateway ` and for the termination :ref:`Gateway `. +By default Yeti are not relaying any headers from one call leg to another. Headers transit mechanism allows to configure such relaying. + + +After the routing, YETI performs filtering twice: for the origination :ref:`Gateway ` and for the termination :ref:`Gateway `. Gateway's parameter **Transit headers from origination** describes the transfer of headers from LegA to LegB, the parameter **Transit headers from termination** - from LegB to LegA. For example, an incoming call arrives via the :ref:`Gateway ` **orig_gw** and terminates via the :ref:`Gateway ` **term_gw** with the corresponding settings. diff --git a/en/best-practices/numbers-translations.rst b/en/best-practices/numbers-translations.rst new file mode 100644 index 0000000..cda289d --- /dev/null +++ b/en/best-practices/numbers-translations.rst @@ -0,0 +1,93 @@ + +.. _posix_regular_expressions2: + +.. |br| raw:: html + +
+ +==================== +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 :ref:`Customers Auth `. +#. Before routing, during :ref:`Numberlist ` processing. +#. After routing in :ref:`Dialpeer `. +#. After routing at termination :ref:`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 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 substrings that should be replaced. + +rewrite_result + It is a string that to replace the substrings 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 substring. + + +Examples +======== + +How to add prefix 888 to number +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + **rewrite_rule** = ^(.*)$ + |br| + **rewrite_result** = 888\\1 + + where ^ - matches at the beginning of the phonenumber, $ - matches at the end of the phonenumber, (.*) - regular expression matches a sequence of 0 or more characters, 888 - prefix to add, \\1 - first marked subexpression matched (in our case - it is phone number (source or destination) that replacement should be taken place). Some examples of adding digits to the beginning of the phonenumber with using different arguments are provided below: + + a) **original phone number** = 7335255 ; **rewrite_rule** = ^(.*)$ ; **rewrite_result** = 0\\1 ; **resulting phone number** = 07335255 + b) **original phone number** = 2296132 ; **rewrite_rule** = ^(.*)$ ; **rewrite_result** = 066\\1 ; **resulting phone number** = 0662296132 + c) **original phone number** = 7050460 ; **rewrite_rule** = ^(.*)$ ; **rewrite_result** = 38048\\1 ; **resulting phone number** = 380487050460 + + +How to remove prefix 999# from number +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + **rewrite_rule** = ^999#(.*)$ + |br| + **rewrite_result** = \\1 + + +How to add suffix 1235 to number +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + **rewrite_rule** = ^(.*)$ + |br| + **rewrite_result** = \\11235 + + +How to replace prefix 123# with prefix 321# +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + **rewrite_rule** = ^123#(.*)$ + |br| + **rewrite_result** = 321#\\1 + + +How to add 8 random digits to the end of phonenumber +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + to generate random digits **r(N)** function may be used: + + **rewrite_rule** = ^(.*)$ + |br| + **rewrite_result** = \\1r(8) + +How to replace 4 last digits to random values +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + **rewrite_rule** = ^(.*)(\\d{4})$ + |br| + **rewrite_result** = \\1r(4) + + diff --git a/en/best-practices/using-routing-tags.rst b/en/best-practices/using-routing-tags.rst index 759590e..e5fa23b 100644 --- a/en/best-practices/using-routing-tags.rst +++ b/en/best-practices/using-routing-tags.rst @@ -1,8 +1,8 @@ .. :orphan: -================================================= -Using Routing tags for the routing prioritization -================================================= +================== +Using Routing tags +================== The Yeti Switch has rich abilities for routing traffic. And one of them is tags. Let's imagine that you need to route some calls relying on their A or B numbers (or even both) - that's not a problem. @@ -28,4 +28,4 @@ Now, we may attach our newly created tag to a dialpeer .. image:: images/routing_tags_decision.png So, if any particular call already has a tag than Yeti is going to choose dialpeers having such a tag, than all others dialpeers. -If a call don't have any tags than a routing decision will be based on all dialpeers. \ No newline at end of file +If a call don't have any tags than a routing decision will be based on all dialpeers. diff --git a/en/conf.py b/en/conf.py index e1e1f0e..94a4f18 100644 --- a/en/conf.py +++ b/en/conf.py @@ -113,8 +113,8 @@ # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -# html_theme_options = { -# } +#html_theme_options = { +#} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = ["../themes"] @@ -293,4 +293,9 @@ "languages": [ ("English", "../en"), ], + "display_github": True, + "github_user": 'yeti-switch', + "github_repo": 'doc', + "github_version": 'master', + "conf_py_path": '/en/' } diff --git a/en/index.rst b/en/index.rst index ff7d866..809b255 100644 --- a/en/index.rst +++ b/en/index.rst @@ -31,9 +31,10 @@ Welcome to Yeti's documentation! quick-start/quick_start.rst disconnect-codes - headers-filtering - best-practices/best-practices.rst + best-practices/headers-transit.rst + best-practices/numbers-translations.rst best-practices/teams-direct-routing.rst + best-practices/using-routing-tags.rst .. toctree:: :maxdepth: 2 diff --git a/en/quick-start/quick_start.rst b/en/quick-start/quick_start.rst index 17629b3..d8970c8 100644 --- a/en/quick-start/quick_start.rst +++ b/en/quick-start/quick_start.rst @@ -1,7 +1,9 @@ -================================ -Guideline on Quick start of Yeti -================================ +========================= +Routing quick start guide +========================= + +This document explains how to configure Yeti to route your fist test call. Yeti is user-friendly application and it very easy for configuration. You can see this by looking at the diagram of dependencies between objects :) diff --git a/en/web-interface/equipment/gateways.rst b/en/web-interface/equipment/gateways.rst index c3842fe..6b61eb8 100644 --- a/en/web-interface/equipment/gateways.rst +++ b/en/web-interface/equipment/gateways.rst @@ -275,7 +275,8 @@ Signaling (Termination) **Gateway**'s attributes: Send lnp information If this checkbox is enabled (in case of using Gateway as Terminator of calls) Yeti will include Local number portability information (LNP) to the outgoing INVITE-request (by adding npdi and rn parameters to the R-URI) only in case of availability of this LNP information (it means if LNP information was successfully received from :ref:`LNP Database `). Rules of receiving LNP information from LNP Database are regulated in the :ref:`Routing plan LNP rules `. - + .. _gateways_number_translation: + Translations **Gateway**'s attributes: `````````````````````````````````````` Diversion policy diff --git a/en/web-interface/general.rst b/en/web-interface/general.rst index d3cc2e7..de2991e 100644 --- a/en/web-interface/general.rst +++ b/en/web-interface/general.rst @@ -5,7 +5,7 @@ General Information .. _general_information: - YETI Web interface allows you to manage all possible entities in the system including CDRs, reporting, billing, routing, sytem configuration and others. It was developed using the most poweful and flexible web frameworks such as `Ruby on Rails `_ and `Active Admin `_. + YETI Web interface allows you to manage all possible entities in the system including CDRs, reporting, billing, routing, sytem configuration and others. It was developed using the most powerful and flexible web frameworks such as `Ruby on Rails `_ and `Active Admin `_. General structure of the YETI Web interface includes tree main sections: @@ -26,6 +26,8 @@ Header & Menu line .. figure:: images/header.png :alt: YETI Web interface - header + +**Logout** button is used for exit from Yeti Web Interface. Working Area ============ diff --git a/en/web-interface/index.rst b/en/web-interface/index.rst index 2465f7e..40e6a8e 100644 --- a/en/web-interface/index.rst +++ b/en/web-interface/index.rst @@ -30,6 +30,4 @@ Admin WEB interface and routing logic logs system yeti-ui-userprofile - yeti-ui-logout - yeti-ui-regexp_replace diff --git a/en/web-interface/routing/yeti-ui-routing-customer_auths.rst b/en/web-interface/routing/customers-auths.rst similarity index 99% rename from en/web-interface/routing/yeti-ui-routing-customer_auths.rst rename to en/web-interface/routing/customers-auths.rst index 12520d8..fb91a7b 100644 --- a/en/web-interface/routing/yeti-ui-routing-customer_auths.rst +++ b/en/web-interface/routing/customers-auths.rst @@ -278,7 +278,7 @@ Match condition **Customers Auth**'s options X Yeti Auth It's possible to define the custom SIP-header **X-Yeti-Auth** or array of headers (separated by comma(,)) for the customer's calls and specify its value in YETI. In case they match, YETI passes such calls with using this Customer Auth entity for authentication. - .. _number_translation_settings: + .. _customers_auth_number_translation: Number translation **Customers Auth**'s options ``````````````````````````````````````````````` diff --git a/en/web-interface/routing/index.rst b/en/web-interface/routing/index.rst index 85bd754..af8d12b 100644 --- a/en/web-interface/routing/index.rst +++ b/en/web-interface/routing/index.rst @@ -13,7 +13,7 @@ On the first step of general routing algorithm :ref:`authentication ` flag of selected :ref:`Customer Auth ` record is enabled. If current balance is less than :ref:`Min balance ` call will dropped with **Disconnect code 8000** (No enough customer balance). -On the third step of general routing algorithm Yeti makes pre-Routing numbers translations. Yeti rewrites (if necessary) Name field in the Source-number, Source-number and Destination-number for incoming call (by :ref:`using POSIX Regular Expressions `) with using :ref:`Number translation settings ` of :ref:`Customer Auth ` record that was selected. On this step Yeti also rewrites (if necessary) Source and Destination numbers which will be send to Radius-server if it's required (by :ref:`using POSIX Regular Expressions `) with using :ref:`Radius options ` of :ref:`Customer Auth ` record that was selected. +On the third step of general routing algorithm Yeti makes pre-Routing numbers translations. Yeti rewrites (if necessary) Name field in the Source-number, Source-number and Destination-number for incoming call (by :ref:`using POSIX Regular Expressions `) with using :ref:`Number translation settings ` of :ref:`Customer Auth ` record that was selected. On this step Yeti also rewrites (if necessary) Source and Destination numbers which will be send to Radius-server if it's required (by :ref:`using POSIX Regular Expressions `) with using :ref:`Radius options ` of :ref:`Customer Auth ` record that was selected. On the fourth step of general routing algorithm Yeti makes processing of destination :ref:`Numberlist ` if this :ref:`Numberlist ` was setted up in the :ref:`Customer Auth ` record. Depending on chosen :ref:`mode ` Yeti is going via all related :ref:`Numberlist items ` and makes some :ref:`actions `. As a result of this step Yeti could drop the call with **Disconnect code 8001** (Destination blacklisted) or just rewrite (if necessary) Source and Destination numbers (by :ref:`using POSIX Regular Expressions `) with using :ref:`rewrite rules ` of :ref:`Numberlist items ` record or :ref:`rewrite rules ` relevant :ref:`Numberlist ` record. @@ -138,7 +138,7 @@ YETI WEB interface - Routing menu description. .. toctree:: :maxdepth: 1 - yeti-ui-routing-customer_auths + customers-auths yeti-ui-routing-rateplans yeti-ui-routing-destinations yeti-ui-routing-routing_groups diff --git a/en/web-interface/yeti-ui-logout.rst b/en/web-interface/yeti-ui-logout.rst deleted file mode 100644 index ea6d243..0000000 --- a/en/web-interface/yeti-ui-logout.rst +++ /dev/null @@ -1,11 +0,0 @@ -====== -Logout -====== - - - **Logout** is used for exit from Yeti Web Interface. - - - - - diff --git a/en/web-interface/yeti-ui-regexp_replace.rst b/en/web-interface/yeti-ui-regexp_replace.rst deleted file mode 100644 index c7e073f..0000000 --- a/en/web-interface/yeti-ui-regexp_replace.rst +++ /dev/null @@ -1,99 +0,0 @@ - -.. _posix_regular_expressions2: - -================================== -Using of POSIX Regular Expressions -================================== - -`POSIX Regular Expressions `_ used in many places of Yeti's configurations for changing format of phone numbers. It helps to provide compatibility between different VoIP platforms. This section describes general principles and examples of using POSIX Regular Expressions in Yeti. - -Arguments -~~~~~~~~~ - - -Yeti uses `REGEXP_REPLACE `_ function: - - .. note:: REGEXP_REPLACE(phonenumber, rewrite_rule, rewrite_result) - - - with following arguments: - - -1) **phonenumber** - -It is a phone number (source or destination) that replacement should be taken place. - -2) **rewrite_rule** - -It is a POSIX regular expression for matching substrings that should be replaced. - -3) **rewrite_result** - -It is a string that to replace the substrings 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 substring. - - -Examples -~~~~~~~~ - -1) How to add one or more digits to the beginning of the phonenumber - - For adding one or more digits to the beginning of the phonenumber you should use following arguments: - - **rewrite_rule** = ^(.*)$ - - **rewrite_result** = XXX\\1 - - where ^ - matches at the beginning of the phonenumber, $ - matches at the end of the phonenumber, (.*) - regular expression matches a sequence of 0 or more characters, XXX - digits for adding to the beginning of the phonenumber, \\1 - first marked subexpression matched (in our case - it is phone number (source or destination) that replacement should be taken place). Some examples of adding digits to the beginning of the phonenumber with using different arguments are provided below: - - a) **original phone number** = 7335255 ; **rewrite_rule** = ^(.*)$ ; **rewrite_result** = 0\\1 ; **resulting phone number** = 07335255 - b) **original phone number** = 2296132 ; **rewrite_rule** = ^(.*)$ ; **rewrite_result** = 066\\1 ; **resulting phone number** = 0662296132 - c) **original phone number** = 7050460 ; **rewrite_rule** = ^(.*)$ ; **rewrite_result** = 38048\\1 ; **resulting phone number** = 380487050460 - -2) How to remove one or more digits or symbols from the beginning of the phonenumber - - For removing one or more digits or symbols from the beginning of the phonenumber you should use following arguments: - - **rewrite_rule** = ^XXX(.*)$ - - **rewrite_result** = \\1 - - where ^ - matches at the beginning of the phonenumber, $ - matches at the end of the phonenumber, (.*) - regular expression matches a sequence of 0 or more characters, XXX - digits or symbols for removing from the beginning of the phonenumber, \\1 - first marked subexpression matched (in our case - it is phone number that is following after **XXX**). Some examples of removing digits from the beginning of the phonenumber with using different arguments are provided below: - - a) **original phone number** = 07335255 ; **rewrite_rule** = ^0(.*)$ ; **rewrite_result** = \\1 ; **resulting phone number** = 7335255 - b) **original phone number** = 0662296132 ; **rewrite_rule** = ^066(.*)$ ; **rewrite_result** = \\1 ; **resulting phone number** = 2296132 - c) **original phone number** = 380487050460 ; **rewrite_rule** = ^38048(.*)$ ; **rewrite_result** = \\1 ; **resulting phone number** = 7050460 - - -3) How to replace digits or symbols withing the phonenumber - - For replacing one or more digits or symbols withing the phonenumber you should use following arguments: - - **rewrite_rule** = ^(.*)XXX(.*)$ - - **rewrite_result** = \\1YYY\\2 - - where ^ - matches at the beginning of the phonenumber, $ - matches at the end of the phonenumber, (.*) - regular expression matches a sequence of 0 or more characters, XXX - digits or symbols for removing from the phonenumber, YYY - digits or symbols for adding to the phonenumber on place of XXX, \\1 - first marked subexpression matched (in our case - part of phone number (if any) before XXX), \\2 - second marked subexpression matched (in our case - part of phone number (if any) after XXX). Some examples of replacing one or more digits or symbols withing the phonenumber with using different arguments are provided below: - - a) **original phone number** = 7335255 ; **rewrite_rule** = ^(.*)733(.*)$ ; **rewrite_result** = \\1000\\2 ; **resulting phone number** = 0005255 - b) **original phone number** = 0662296132 ; **rewrite_rule** = ^(.*)229(.*)$ ; **rewrite_result** = \\1999\\2 ; **resulting phone number** = 0669996132 - c) **original phone number** = 380487050460 ; **rewrite_rule** = ^(.*)460(.*)$ ; **rewrite_result** = \\1464\\2 ; **resulting phone number** = 380487050464 - - -4) How to add random digits to the end of phonenumber - - For adding one or more random digits to the end of phonenumber you should use following arguments: - - **rewrite_rule** = ^(.*)$ - - **rewrite_result** = \\1r(NN) - - where ^ - matches at the beginning of the phonenumber, $ - matches at the end of the phonenumber, (.*) - regular expression matches a sequence of 0 or more characters, r(NN) - placeholder that will be replaced to the string (random numeric characters from 0 to 9) with NN length (NN should be within the range from 0 to 64), \\1 - first marked subexpression matched (in our case - it is phone number (source or destination) that replacement should be taken place). Some examples of adding one or more random digits to the end of the phonenumber with using different arguments are provided below: - - a) **original phone number** = 7335255 ; **rewrite_rule** = ^(.*)$ ; **rewrite_result** = \\1#r(3) ; **resulting phone number** = 7335255#456 - b) **original phone number** = 2296132 ; **rewrite_rule** = ^(.*)$ ; **rewrite_result** = \\1##r(1) ; **resulting phone number** = 2296132##5 - c) **original phone number** = 7050460 ; **rewrite_rule** = ^(.*)$ ; **rewrite_result** = \\1-r(5) ; **resulting phone number** = 7050460-53467 - -