Configure Last Agent Routing

Note This script has been replaced by Microsoft Power Automate, Learn More


If you want customers to experience that they have a single point of contact, without actually having a single point of contact, you can configure Last Agent Routing in Anywhere365.

Last Agent Routing makes it possible to route customers to an Agent to which they have spoken before.

The script will do the following:

  1. Triggers when a new item is added to the CallSummary list

  2. If customer is empty or anonymous

    1. Do nothing

  3. If customer already in routing list

    1. Update routing list

  4. If new customer

    1. Create a UCC routing item pointing the customer to a question and skill for the last agent

Step 1: Prepare the UCC for LastAgent Routing

The following steps are required to use Last Agent Routing within a UCC.

Step 1.1: Activate WriteSummaryToSharePoint

  1. In the UCC that should have Last Agent Routing enabled, go to the list “Settings”. Add a new item (or edit the existing item) with title “WriteSummaryToSharePoint” and set the value to “true”.

  2. From now on every call that is managed by the UCC will write a summary of this call to the list“CallSummary”.


Step 1.2: Create Skills

  1. Create a Skill for every single Agent and link this Skill to the specific Agent. It is advised to use an Availability- ,CountDown- or a CountDownAvailability Skill, so an escape is possible if the Agent is not able to answer the call.


Step 1.3: Create IVR Questions

  1. Create an IVRInteractive Voice Response (IVR) is a telephone application to take orders via telephone keypad or voice through a computer. By choosing menu options the caller receives information, without the intervention of a human operator, or will be forwarded to the appropriate Agent. Question for every single Agent with Title “Question sip:<SIP address” and Skill<specific agent skill (as generated in previous step).

    Note that the “WelcomeMessage” has the fallback skill of the individual Agent Skills.

  2. So if a customer calls for the first time one of the three Agents of this UCC will answer the call. If a customer calls for the second time, the call will be forwarded to the IVRQuestion of a specific Agent; if the agent is not able to answer the call itwill be offered to another Agent (using the escape).

Step 2: Change parameters

Note Files can be requested at the Workstreampeople SupportDesk.

  1. Copy the files to the Anywhere365 Server

  2. Edit larOnline.ps1

  3. Configure the following items

    1. $site = ""

    2. $username = ""

    3. $password = ""

    4. $useDefaultNetowrkCredentials = $false #$true/$false


Step 3: Create Scheduled task

Note The task created items in the UCC routing, based on the data in the CallSummary list.

  1. Open Windows Task Scheduler

  2. Choose for ‘Create Task

  3. Give the new task a unique name, make sure that it runs whether the user is logged on or not and that it runs with the highest privileges.

  4. Open the Triggers tab and choose ‘New

  5. Set the parameters as follows:

  6. Go to the Actions tab and select New

  7. Make sure it runs ‘powershell.exe’ with the following argument:

    -file "C:\program files\anywhere365\scripts\LAR\larOnline.ps1"

  8. Finally go to the Settings tab and select Allow task to be run on demand.

  9. Hit OK and you are finished.