Routing Formulas

Control Centre 3.6 introduces Routing formulas. The following document describes how to use the formulas to automate your routing generation.
To see all available methods read: Routing formulas – methods

Applying formula

The user can decide whether he wants to apply his formula on a single dial code, multiple dial codes or any destination that matches a pattern defined by the user.
To use a formula for all the dial codes defined in a routing plan the user has just to define an operation to be applied for all the dial codes. For example:


// Block entire Routing Plan
block();

This example can be used when the user would like to create a blocked plan to assign a customer to. It means that all the customer calls will not be terminated. It can be used if for some reason the user would like to block all the incoming calls of a particular customer.


Blocking a dial code with its breakouts

Sometimes the user would like to block a particular destination to avoid phone calls made by customers using the routing plans to a particular part of world. To achieve this goal the user can use the following formula:


// Block all Afghanistan breakouts
if(dialcode.startsWith("93"))
{
    block();
}

The formula blocks all dial codes that starts with 93. Even if new breakout of 93 is introduced by a supplier it is blocked automatically.


Blocking a single dial code

To block a single dial code use the following formula:


// Block a single dial code 9311
if(dialcode.equals("9311"))
{
    block();
}

This blocks only a single dial code 9311. All the existing breakouts as well as all breakouts introduced in the future are not blocked. So this should be used to block rather phone numbers than prefix dial codes.


Blocking destinations that starts with a pattern

The user can also apply a formula to any destination that matches the name pattern defined by user.


// Block destinations starting with Afghanistan
if(destination.startsWith("Afghanistan"))
{
    block();
}

This blocks all destinations that have name starting with Afghanistan so for example Afghanistan Mobile, Afghanistan Kabul, etc.
Although it is very useful it should be used very carefully. If a name of any affected MDL destination changes the formula may not by applied to the destination anymore.


Blocking destinations that match a pattern

The user is also able to block any destination that contains any desired text. For example the user would like to create a routing plan that disallows customers to call mobile numbers. The following formula can be used to block all mobile numbers:


// Block destinations containing Mobile
if(destination.contains("Mobile"))
{
    block();
}

On the other hand the user may be interested in using only mobiles in his plan. This can be achieved by the following formula.


// Allow only mobile destinations
if(!destination.contains("Mobile"))
{
    block();
}

The formula blocks all destinations that have no ‘Mobile’ in their names.


Combination of conditions (OR)

Sometimes the user may need to use combination of different conditions to define which dial codes should be affected by a formula. To define a formula for multiple codes the user can use the || operator. In such case the formula will be applied id any of the conditions is met.


// Block all 93 and 213 breakouts
if(dialcode.startsWith("93") || dialcode.startsWith("213"))
{
    block();
}

The formula blocks all dial codes starting with 93 or 213.


Combination of conditions (AND)

There are situations when the user would like to block some codes that match more than one pattern. In such case the user should use the && operator. This means that the formula should be applied only to the dial codes that met all the conditions.

 

// Block all Afghanistan Mobile dial codes
if(dialcode.startsWith(“93”) && !destination.contains(“Mobile”))
{
    block();
}

The example shows blocking all Afghanistan breakouts that have ‘Mobile’ in their names.


Defining sets

Some operations may require to be applied to multiple dial codes. The user may specify the codes creating a Set and use the Set in his formula. It makes dealing with multiple dial codes easier.


// Block all Afghanistan breakouts
Set dialcodesSet = createSet("93","931","9311","937","9371");
if(dialcodesSet.contains(dialcode))
{
    block();
}

The formula blocks dial codes 93, 931, 9311, 937 and 9371. The user can define any number of dial codes, destination names or numbers in Set as well as any number of different sets.


Overriding supplier position

The following examples show different operations that can be performed using routing formulas.
All the examples are shown for a dial code 93. As previous examples shown any combination of dial codes/destination filters can be used.

Due to an agreement with a supplier or a quality purposes there is a need to use a particular supplier as a first choice.


// Overriding a carrier position
if(dialcode.equals("93"))
{
    setCarrierPosition("Suntel", 1);
}

The formula above makes Suntel the first choice supplier for dial code 93.


Defining percentage routing

A percentage routing with backups can be defined by formulas:


// Configuring percentage routing
if(dialcode.equals("93"))
{
    setCarrierPercentage("BT", 80);
    setCarrierPercentage("Tata", 20);
    setCarrierPosition("Suntel", 1);
}

The formula configures a percentage routing: 80% BT, 20% Tata with a single Backup carrier Suntel for a dial code 93.


Excluding a supplier

In a situation that a supplier should not be used in routing for a particular dial code/destination the supplier can be excluded from routing.


// Excluding suppliers
if(dialcode.equals("93"))
{
    excludeCarrier("Suntel");
}

The formula excludes Suntel from routing of dial code 93.


Exclusive Routing

If for a dial code/destination there is a requirement to use only a single specified supplier then exclusive routing can be defined.


// Exclusive routing
if(dialcode.equals("93"))
{
    makeCarrierExclusive("BT");
}

The formula use exclusively BT for dial code 93.


Exclusive Routing with fixed carriers positions

In some situations a set of carrier should be used exclusively in a fixed order for a dial code.


// Exclusive routing with fixed suppliers order
if(dialcode.equals("93"))
{
    makeCarriersExclusive("BT", "Tata", "Suntel");
}

The formula sets routing of 93 to BT, Tata, Suntel. Only the specified carriers are used in routing for the dial code and their order is fixed.


Excluding a dial code

To make a routing plan less detailed or exclude some dial codes from the routing plan an excluding formula can be used.


// Exclude a dial code
if(dialcode.equals("93"))
{
    exclude();
}

This excludes dial code 93 from the routing plan.


Excluding all carriers above the defined threshold

To remove unprofitable suppliers from routing.


if(dialcode.equals("93"))
{
//-- Exclude carriers above the defined threshold.
    excludeCarrierIfPriceAbove(0.15);
}

The formula excludes from routing all carriers having their prices higher than 0.15.


Excluding all carriers above the floorprice

To remove unprofitable suppliers from routing.


if(dialcode.equals("93"))
{
//-- Exclude carriers above the floorprice.
    excludeCarrierIfPriceAboveOrEqual(floorprice);
}

The formula excludes from routing all carriers having their prices higher than the floorprice.


Dynamic percentage routing example

Creates a dynamic percentage routing.


// The following code assumes that AB&C is present.
// To test if any supplier is present, the user can use getCarrierPosition method. The method returns -1
// if the supplier is not present.

if(dialcode.equals("93"))
{
    // If there is only One supplier choice than its percentage should be set to 100%
    if (carriers.size() == 1)
    {
        // If there is no AB&C among the supplier choices then no percentage will be assigned and
        // the route will use Standard routing.
        setCarrierPercentage("AB&C",100);
    }
    else if (carriers.size() > 1)
    {
        setCarrierPercentage("AB&C",60);
        // Finding the position of AB&C
        int indexOfQSC = getCarrierPosition("AB&C");

        // If there are only two suppliers
        if (carriers.size() == 2)
        {
            // If position of AB&C is 0 assign 40 percents to the supplier at position 1 otherwise assign
            // it to the supplier at position 0
            setCarrierPercentage(carriers.get(indexOfQSC == 0 ? 1 : 0), 40);
        }
        // If there are more than two suppliers
        else
        {
            // If position of AB&C is 0 assign 30 percents to the supplier at position 1 otherwise assign
            // it to the supplier at position 0
            setCarrierPercentage(carriers.get(indexOfQSC == 0 ? 1 : 0), 30);
            setCarrierPercentage(carriers.get(2), 10);
        }
    }
}

The formula creates a dynamic percentage routing.

Similar Posts