Revision as of 18:25, July 11, 2017 by Bonniem (talk | contribs) (Run Function)
Jump to: navigation, search

Run Function

Starting with release 8.1.400.??, IRD's Selection object adds the run function to the list of threshold functions available in the General tab. Like the other existing threshold functions, the run function is useful for conditional routing involving strategy logic that cannot be represented with a single expression, and can eliminate the need for complex “looping” in strategies.

Use of Threshold Script

The run function extends skill and threshold expressions with external logic by allowing you to specify a threshold "script" (such as a subroutine) in addition to the regular threshold expression. You can use an existing subroutine or create a new one in IRD (Routing Design > Subroutines).

String run(subroutine, param1, param2) executes the skill/threshold expression logic packed in the provided subroutine and returns a value. For example, a threshold expression such as run[SomeSubroutine, Target, ExtraData] returns 1 (meaning it is Ok to route) if SomeSubroutine applied to provided data returns 1. If the subroutine returns 0 then entire threshold expression also returns 0 (routing is not allowed). The run function allows execution of any logic from a skill/threshold expression – the logic just needs to be packed into the threshold script.

Run Function Samples

Below is a sample threshold expression using the run function:

run[Sub_OpenHoursCheck,ITC_COE_OpenHours,ITC_COE_OpenHoursPlansList] >"0"

In this example, the run subroutine Sub_OpenHoursCheck:

  • Gets as input the name of a List object (ITC_COE_OpenHours), the name of the section within the List object (ITC_COE_OpenHoursPlansList)
  • Gets from this section information about today's open hours and checks the current time – is it or not within open hours boundaries?

Below is a sample of skill expression using the run function. It is assumed that subroutine IsAgentScoreGood will return whether a specific agent is good or bad for caller.

run[IsAgentScoreGood, CallerID, ExtraData] > "0".

The subroutine will have four input parameters and when called ;

  • param1 will be agent name (URS will provide)
  • param2 - name of VQ if known (URS will provide)
  • param3=CallerID
  • param4= ExtraData

URS will apply this subroutine to every agent. URS will consider as valid targets only those for whom the subroutine returns a non 0 value.

Rules/Limitations

The following rules/limitations apply when working with the run function.

Skill Expressions

  • When using the run function for skill expressions, the subroutine must have four input and one output parameter. When invoked, the subroutine will get the following Input parameters:
    • agent name, VQ name, if applicable otherwise empty string, param1, param2.

URS will provide the first (agent name) and second (name of virtual queue) subroutine parameters. You do not specify these when invoking the run function.

  • The Output parameter is what the run function run returns.

Threshold Expressions

  • When using the run function for threshold expressions, the subroutine must have two Input and one Output parameter. When invoked, the subroutine will get the following Input parameters:
    • param1, param2.
  • The Output parameter is what the run function run returns.
  • The subroutine will run in reduced mode so it will not be possible to get data from external services from inside the subroutine. All data must be in URS memory. As a result, the subroutine can get data only from Configuration Server, call data, statistical data, and whatever the strategy puts into the URS in-memory database (with function SetMapValue). URS must execute hundreds/thousands of expressions per second waiting for data from external services during this calculation is not possible. Subroutine still able to send request to external services (without waiting for results).
  • Side effect of previous limitation – it is not possible from subroutine to call anothersubroutine in regular way.
  • function run always returns data back as STRING. As result it should be careful when expression trying to compare returned value with some other value – comparing of values of different types might not work. If there is necessity to interpret returned data as number it should be set explicitly with "type converting functions" num or int, like: num[run[subroutine, param1, param2]] > 0


Existing Threshold Expressions

You can use the following functions in threshold expressions (all lowercase):

[+] sdata



[+] acfgdata



[+] callage



[+] lcfgdata



Comments or questions about this documentation? Contact us for support!