Revision as of 18:59, July 11, 2017 by Bonniem (talk | contribs) (Threshold Script (Subroutine))
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.

Threshold Script (Subroutine)

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).

For example, you could create a threshold expression such as run[SomeSubroutine, Target, ExtraData]that returns 1 or 0. If SomeSubroutine applied to the provided data returns 1, then the entire threshold expression returns 1 meaning it is OK to route. If SomeSubroute returns 0 then the entire threshold expression also returns 0 meaning 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
  • param2 - name of VQ if known
  • 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 zero (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 parameters 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. 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 be able to execute hundreds/thousands of expressions per seconds, so waiting for data from external services is not possible. The subroutine can still send requests to external services (without waiting for results).

  • As a side effect of the previous limitation, it is not possible for a subroutine to call another subroutine in the usual way.

  • Function run always returns data back as a STRING so you cannot directly compare values of different types. If there is a necessity to interpret returned data as a number, explicityly set this with the type converting functions, such as num or int. For example: 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!