Routing

This section describes authentication and routing principles.

General routing algorithm is represented on the picture below:

digraph Routing {

    node [style=filled; fillcolor="#FCF9A5"];
    graph [nodesep=1, ranksep=0.2, mindist=0.5];

    subgraph cluster_DC {
        style=filled;
        color=lightgrey;
        node [style=filled,color=red];

        reason1 [label = "Disconnect Code 110 \n(Can't find Customer or Customer locked)"; shape=box; sides=4 ];
        reason2 [label = "Disconnect code 8000 \n(Not enough customer balance)"; shape=box; sides=4 ];
        reason3 [label = "Disconnect code 8001 \n(Destination blacklisted)"; shape=box; sides=4 ];
        reason4 [label = "Disconnect code 8002 \n(Source blacklisted)"; shape=box; sides=4 ];
        reason5 [label = "Disconnect code 8003 \n(No response from LNP DB)"; shape=box; sides=4 ];
        reason6 [label = "Disconnect Code 111 \n(Can't find destination prefix)"; shape=box; sides=4 ];
        reason7 [label = "Disconnect Code 112 \n(Rejected by destination)"; shape=box; sides=4 ];
        reason8 [label = "Disconnect Code 113 \n(No routes)"; shape=box; sides=4 ];

        reason1->reason2 [style=invis];
        reason2->reason3 [style=invis];
        reason3->reason4 [style=invis];
        reason4->reason5 [style=invis];
        reason5->reason6 [style=invis];
        reason6->reason7 [style=invis];
        reason7->reason8 [style=invis];
        label = "Disconnect Reasons";
    }

    subgraph cluster_DC2 {
        style=filled;
        color=lightgrey;
        node [style=filled,color=red];

        reason9 [label = "Disconnect code 8000 \n(Not enough customer balance)"; shape=box; sides=4 ];

        label = "Disconnect Reasons";
    }

    subgraph cluster_SEMS {
        style=filled;
        color=lightgrey;
        node [style=filled,color=blue];

        block_l0 [label = "List of Call Profiles that is received from routing procedure"; xlabel = "                Step 12"; shape=hexagon];

        block_l1 [label = "Is Disconnect Code for Call Profile initialized?"; xlabel = "           Step 12.1 "; shape=Mdiamond];


        block_l2 [label = "Writing not success CDR + statistic for route/gateway"; xlabel = "Step 12.3a    "; shape=box; sides=4; color = red ];

        block_l4 [label = "Disconnect from Originator"; xlabel = "       Step 12.6   "; shape=box; sides=4; color = red ];

        block_l5 [label = "Trying to connect a call"; xlabel = "\nStep 12.2     "; shape=box; sides=4 ];

        block_l6 [label = "Writing CDR + writing statistic for route/gateway"; xlabel = "Step 12.3b    "; shape=box; sides=4 ];

        block_l7 [label = "Change customer's and vendor's balance at billing subsystem "; xlabel = "Step 12.4    "; shape=box; sides=4 ];


        block_l8 [label = "Call was successful?"; xlabel = "           Step 12.5 "; shape=Mdiamond];


        block_l0 -> block_l1 [color=black];
        block_l1 -> block_l2 [color=green];
        block_l2 -> block_l4 [color=black];

        block_l1 -> block_l5 [color=red];
        block_l5 -> block_l6 [color=black];
        block_l6 -> block_l7 [color=black];
        block_l7 -> block_l8 [color=black];

        block_l8 -> block_l4 [color=green];
        block_l8 -> block_l0 [color=red];

        label = "Yeti/SEMS Node";
    }

    block_wrong1 [label = "Adding Call Profile with initialized Disconnect Code to the Array"; shape=box; sides=4; color=red];

    block_wrong2 [label = "Adding Call Profile with initialized Disconnect Code to the Array"; shape=box; sides=4; color=red];

    block1 [label = "Authentication / Authorization"; xlabel = "Step 1"; shape=box; sides=4 ];
    block2 [label = "Checking balance of Customer"; xlabel = "Step 2   "; shape=box; sides=4 ];
    block3 [label = "Pre-Routing numbers translations"; xlabel = "Step 3   "; shape=box; sides=4 ];
    block4 [label = "DST Numberlist processing"; xlabel = "Step 4  "; shape=box; sides=4 ];
    block5 [label = "SRC Numberlist processing"; xlabel = "Step 5"; shape=box; sides=4 ];
    block6 [label = "Areas and Tag detection"; xlabel = "Step 6"; shape=box; sides=4 ];
    block7 [label = "Routing plan searching"; xlabel = "Step 7"; shape=box; sides=4 ];
    block8 [label = "Make Query to LNP database (if needed)"; xlabel = "Step 8"; shape=box; sides=4 ];
    block9 [label = "Search Destination for a call"; xlabel = "              Step 9"; shape=box; sides=4 ];
    block10 [label = "Search routes for a call on the basis routing algorithm for routing plan"; xlabel = "           Step 10"; shape=box; sides=4 ];

    block11 [label = "List of selected dialpeers that is sorted by chosen routing algorithm"; xlabel = "                Step 11"; shape=hexagon];

    block12 [label = "Search termination gateways for selected Dialpeer"; xlabel = "Step 11.1     "; shape=box; sides=4 ];

    block13 [label = "List of selected gateways (for Dialpeer) that is sorted by priority"; xlabel = "                Step 11.2"; shape=hexagon];

    block14 [label = "Won't min limit on Customer's balance be reached?"; xlabel = "           Step 11.3 "; shape=Mdiamond];

    block15 [label = "Calculating of allowed time for the call"; xlabel = "Step 11.4   "; shape=box; sides=4 ];

    block16 [label = "Won't max limit on Vendors's balance be reached?"; xlabel = "                 Step 11.5"; shape=Mdiamond];

    block17 [label = "Post-routing numbers translations"; xlabel = "Step 11.6    "; shape=box; sides=4 ];

    block18 [label = "Adding Call Profile to the Array"; xlabel = "Step 11.7    "; shape=box; sides=4; color=green ];




    end [shape=Msquare];

    block1 -> block2 [color=green];
    block1 -> reason1 [color=red];

    block2 -> block3 [color=green];
    block2 -> reason2 [color=red];
    block3 -> block4 [color=black];
    block4 -> block5 [color=green];
    block4 -> reason3 [color=red];
    block5 -> block6 [color=green];
    block5 -> reason4 [color=red];
    block6 -> block7 [color=black];
    block7 -> block8 [color=black];
    block8 -> block9 [color=green];
    block8 -> reason5 [color=red];
    block9 -> block10 [color=green];
    block9 -> reason6 [color=red];
    block9 -> reason7 [color=red];
    block10 -> block11 [color=green];
    block10 -> reason8 [color=red];
    block11 -> block12 [color=black];
    block12 -> block13 [color=black];
    block13 -> block14 [color=black];
    block13 -> block11 [color=black];

    block14 -> reason9 [color=red];
    block14 -> block15 [color=green];
    block15 -> block16 [color=black];
    block16 -> block17 [color=green];
    block16 -> block13 [color=red];
    block17 -> block18 [color=black];
    block18 -> block13 [color=black];


    block11 -> block_l0 [color=black];


    block_l0 -> end [color=black];

    reason1 -> block_wrong1 [color=black];
    reason2 -> block_wrong1 [color=black];
    reason3 -> block_wrong1 [color=black];
    reason4 -> block_wrong1 [color=black];
    reason5 -> block_wrong1 [color=black];
    reason6 -> block_wrong1 [color=black];
    reason7 -> block_wrong1 [color=black];
    reason8 -> block_wrong1 [color=black];

    reason9 -> block_wrong2 [color=black];

    block_wrong1 -> block_l0 [color=black];

    block_wrong2-> block13 [color=black];

    block_l4 -> end [color=black];
}

On the first step of general routing algorithm authentication will be made. As a result of this step Customer Auth record will be selected for incoming call or call will be dropped with Disconnect Code 110 (Can’t find Customer or Customer locked).

On the second step of algorithm Yeti will check Customer’s balance if Check account balance flag of selected Customer Auth record is enabled. If current balance is less than 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 using POSIX Regular Expressions) with using Number translation settings of 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 using POSIX Regular Expressions) with using Radius options of Customer Auth record that was selected.

On the fourth step of general routing algorithm Yeti makes processing of destination Numberlist if this Numberlist was setted up in the Customer Auth record. Depending on chosen mode Yeti is going via all related Numberlist items and makes some 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 using POSIX Regular Expressions) with using rewrite rules of Numberlist items record or rewrite rules relevant Numberlist record.

On the fifth step of general routing algorithm Yeti makes processing of source Numberlist if this Numberlist was setted up in the Customer Auth record. Depending on chosen mode Yeti is going via all related Numberlist items and makes some actions. As a result of this step Yeti could drop the call with Disconnect code 8002 (Source blacklisted) or just rewrite (if necessary) Source and Destination numbers (by using POSIX Regular Expressions) with using rewrite rules of Numberlist items record or rewrite rules relevant Numberlist record.

On the sixth step of general routing algorithm Yeti will be looking for Areas (by using Area prefixes) that are related to the Source number (From name) and Destination number (URI name) after them processing and translation on the previous steps. Area records that were found (if any), are used for detecting Routing Tags for the call on the basis Routing Tag detection Rules.

On the seventh step of general routing algorithm Yeti will be selecting Routing Plan that was chosen for Customer Auth record.

On the eighth step of general routing algorithm Yeti (if Use Lnp flag of Routing Plan that was chosen for Customer Auth record is enabled) selects most preferred Routing Plan LNP rule (by longest match prefix of destination number (number B)) and uses this Routing Plan LNP rule for processing ported numbers of call. If required record wasn’t found in the LNP Cache - LNP Database will be requested. In case of failing query Yeti will drop the call with Disconnect code 8003 (No response from LNP DB).

On the ninth step of general routing algorithm Yeti will be searching Destination for the call that is matching ALL following conditions:

  • Prefix of Destination record is in the prefix range of Destination number (URI name);

    Note

    Examples:

    • Prefix of Destination record = ** ; URI name = 0662296132 => TRUE

    • Prefix of Destination record = 066 ; URI name = 0662296132 => TRUE

    • Prefix of Destination record = 066[1-3] ; URI name = 0662296132 => TRUE

    • Prefix of Destination record = 066[1-3] ; URI name = 0665296132 => FALSE

    • Prefix of Destination record = 066[1-3], 0665 ; URI name = 0665296132 => TRUE

    • Prefix of Destination record = 066[1-3], 0665 ; URI name = 0666296132 => FALSE

  • Length of Destination number (URI name) is between Dst number min and max length values of Destination record;

    Note

    Examples:

    • Dst number min length of Destination record = 3 ; Dst number max length of Destination record = 15 ; URI name = 380662296132 => TRUE

    • Dst number min length of Destination record = 7 ; Dst number max length of Destination record = 7 ; URI name = 7050460 => TRUE

    • Dst number min length of Destination record = 0 ; Dst number max length of Destination record = 7 ; URI name = 0487050460 => FALSE

  • Rateplan that is chosen for Destination record is same with Rateplan that is chosen for Customer Auth record;

  • Destination record is enabled;

  • current date&time is more than Valid From value of Destination record;

  • current date&time is less than Valid To value of Destination record;

  • at least one Routing Tag (from the list of Routing Tags that were chosen for the call during the sixth step of general routing algorithm) is included in the set of Routing Tags that are chosen for:ref:Destination <destinations> record.

If more than one record was found during searching of Destination Yeti sorts records with following rules: records with the longest Prefix of Destination on the top; records with biggest amount of Routing Tags that were chosen for the call (during the sixth step of general routing algorithm) and are included in the set of Routing Tags that are chosen for:ref:Destination <destinations> record on the top. Only first record from sorted list will be chosen.

If no records were found during searching of Destination Yeti will drop the call with Disconnect Code 111 (Can’t find destination prefix).

If Reject Calls flag is enabled for the Destination record that was chosen Yeti will drop the call with Disconnect Code 112 (Rejected by destination).

On the tenth step of general routing algorithm Yeti will search routes (Dialpeers) for a call on the basis routing (sorting) algorithm that was chosen for Routing Plan record. If no records were found during searching of Dialpeers Yeti will drop the call with Disconnect Code 113 (No routes).

On the eleventh step of general routing algorithm Yeti will pass through list of selected Dialpeers) that is sorted by chosen routing (sorting) algorithm. For each Dialpeer following actions will be applied:

On the twelfth step of general routing algorithm Yeti/SEMS node will pass through list of Call Profiles that was received on previous step (Step 12). For each Call Profile following actions will be applied:

  • Checking Disconnect Code (Step 12.1). On this step Yeti will check if Disconnect Code for Call Profile was initialized (not NULL). If yes - Yeti will initiate disconnecting (Step 12.6) from Originator (with using received Disconnect Code) after writing CDR & statistic for route/gateway (Step 12.3a);

  • Trying to connect a call (Step 12.2). On this step Yeti will try to make a connection with LegB via Gateway that was selected for current Call Profile. Regardless from call result (successful or not, length of call etc.) Yeti will write CDR & statistic for route/gateway (Step 12.3b) and will change customer’s and vendor’s balance at billing subsystem (in case of successful call with non-zero length) on Step 12.4. After the checking of call result (Step 12.5) Yeti will disconnect from Originator (Step 12.6) in case of successful call or will go the next Call Profile in the list (Step 12). Yeti will exit from the loop only when call had been made successfully or when all Call Profiles had been used;

  • Writing CDR + writing statistic for route/gateway (Step 12.3 (a & b)). Information about call will be stored to the CDR Table and current statistical parameters (count of answered telephone calls, general length of telephone calls) will be updated for Dialpeer record that was selected for this call and for Gateway that was used for this call;

  • Change Customer’s and Vendor’s balance at billing subsystem (if necessary) (Step 12.4). On this step Yeti will change Customer’s and Vendor’s balance in case of successful call with non-zero length. For calculating prices of the call for Customer and Vendor following rules are used:

  • Customer’s price calculation rules. For calculate Customer’s price for the call Yeti will summarize Connect Fee (in currency units) of Destination record that was selected for this call, price of initial interval of call that is calculated as multiplication of Initial Interval (in seconds) of Destination record to the Initial Rate (in currency units per minute) that was divided on length of a minute in seconds (60 seconds), and (in case of calls that are longer than Initial Interval) price of next interval of call that is calculated as multiplication amount of Next Intervals of Destination record that was selected for this call that were placed in the duration of the call after Initial Interval to the Next Rate (in currency units per minute) that was divided on length of a minute in seconds (60 seconds). At the last step Customer’s price that was calculated will be increased on the value of value-added tax (VAT) that was specified for the Customer’s Account.

  • Vendor’s price calculation rules. For calculate Vendor’s price for the call Yeti will summarize Connect Fee (in currency units) of Dialpeer record that was selected for this call, price of initial interval of call that is calculated as multiplication of Initial Interval (in seconds) of Dialpeer record to the Initial Rate (in currency units per minute) that was divided on length of a minute in seconds (60 seconds), and (in case of calls that are longer than Initial Interval) price of next interval of call that is calculated as multiplication amount of Next Intervals of Dialpeer record that was selected for this call that were placed in the duration of the call after Initial Interval to the Next Rate (in currency units per minute) that was divided on length of a minute in seconds (60 seconds);

Note

Important notice:

In normal mode changing Customer’s and Vendor’s balance at billing subsystem will be made by subtraction of the Customer’s price that was calculated on this step from the Customer’s balance and by addition Vendor’s price to the Vendor’s balance. But in case of enabling Reverse billing flag of Destination record that was selected for this call - Yeti will add Customer’s price that was calculated on this step to the Customer’s balance, and in case of enabling Reverse billing flag of Dialpeer record that was selected for this call - Yeti will subtract Vendor’s price from the Vendor’s balance. Following formula is used for calculation both Customer’s and Vendor’s prices:

\[\begin{equation} Price = (CF + II(\frac{IR}{60}) + [\frac{(CD-II)}{NI}]NI(\frac{NR}{60}))(1 + \frac{VAT}{100}) \end{equation}\]
where:
  • Price - Customer’s or Vendor’s price;

  • CF - Connect Fee of Destination (for Customer’s price) or Dialpeer (for Vendor’s price), currency units;

  • II - Initial Interval of Destination (for Customer’s price) or Dialpeer (for Vendor’s price), seconds;

  • IR - Initial Rate of Destination (for Customer’s price) or Dialpeer (for Vendor’s price), currency units per minute;

  • CD - Call duration, seconds;

  • NI - Next Interval of Destination (for Customer’s price) or Dialpeer (for Vendor’s price), seconds;

  • NR - Next Rate of Destination (for Customer’s price) or Dialpeer (for Vendor’s price), currency units per minute;

  • VAT - Value-added tax, percents. VAT = 0 for calculating Vendor’s price.

  • Disconnect from Originator (Step 12.6).

YETI WEB interface - Routing menu description.