How to Route Callers to the Last Agent and Provide a Voicemail OptionSo your customer is calling again and wants to talk to the last known agent who helped her. How do you connect them?This article will show you how to create a general voice scenario that * Finds the last known agent (also called same agent routing)* Connects the call to that agent or presents an IVR menu with the option to either leave a voicemail or look for the next available agentBefore proceeding, we recommend that you download and [[5.3:Contact-center-administrator-guide/ScenariosOverview | import]] our example scenario template: [[File:App_FindLastAgentVM_(2).zip]]For instructions on how to import this file into your contact center, see the ''Contact Center Administrator Guide'', section [[Contact-center-administrator-guide/ScenariosOverview#How_to_Export_and_Import_Scenarios|Scenarios Overview > How to Export and Import Scenarios]].Scenarios are made up of ''scenario blocks'' that specify how interactions are processed. Detailed descriptions of Bright Pattern scenario blocks are available in this guide's ''Scenario Block Definitions'' section.The following sequence of actions illustrates one way to organize scenario blocks to route a customer to either the last known agent, an IVR menu with the option to leave a voicemail for that agent, or to the next available agent.Please note this is an example scenario only and not intended for production use. All [[Scenario-builder-reference-guide/ScenarioBuilderOverview#Conditional_Exits|conditional exits]] should be defined with actions for production use.[[File:FindLastAgent-Scenario2-53.png|thumb|800px|center|Example scenario in Scenario Builder]]The [[Scenario-builder-reference-guide/GetUserConfiguration | Get user configuration]] block finds a specific contact center user and returns the user ID of the last known agent, using variable "lastagent."[[File:Find-Last-Agent1-53.PNG|thumb|800px|center|The requested user properties are returned]]The [[Scenario-builder-reference-guide/ExceptionHandler | Exception Handler]] block has two conditional exits: [[Scenario-builder-reference-guide/ExceptionHandler#Try | Try]] and [[Scenario-builder-reference-guide/ExceptionHandler#Try | Catch]].Under Exception Handler's "Try" exit, you should enter the sequence of blocks that you predict might generate an exception, block error, or disconnect. In this example, we did so in the following order.[[Scenario-builder-reference-guide/FindAgent | Find Agent]] looks for the last known agent.[[File:Last-Agent-2-53.PNG|thumb|800px|center]]In Find Agent properties, you must also use a "Specific agent" condition to specify which agent needs to be found.# In the variable value field, enter [[5.3:Scenario-builder-reference-guide/Variables#.24.28item.continuationUserId.29 | [[Scenario-builder-reference-guide/PlayPrompt | Play Prompt]] plays the voicemail option voice segment to the caller (e.g., "To leave a voicemail press 1, to speak with an agent now, press 2").[[File:Last-Agent3-53.PNG|thumb|800px|center]][[Scenario-builder-reference-guide/Menu | Menu]] specifies the two available IVR menu options as given in the Play Prompt block (i.e., 1 for voicemail, and 2 for finding an agent).[[File:Last-Agent4-53.PNG|thumb|800px|center]][[Scenario-builder-reference-guide/Voicemail | Voicemail]] tells the system how to encode the voicemail recording, who to deliver it to, and so forth.[[File:Last-Agent6-53.PNG|thumb|800px|center]][[Scenario-builder-reference-guide/Goto | Goto]] jumps to "Find Agent."[[File:Last-Agent7-53.PNG|thumb|800px|center]]After defining the possible blocks that might start an exception, you work on the [[Scenario-builder-reference-guide/ExceptionHandler#Try | Catch]] exit.Under Exception Handler's "Catch" exit, you should enter the sequence of blocks that you ''want the scenario to execute'' if an exception, block error, or disconnect occurs during the [[Scenario-builder-reference-guide/ExceptionHandler#Try | Try]] conditional exit. In this example, we did so in the following order.[[Scenario-builder-reference-guide/ConnectCall | Connect Call]] connects the customer to the last agent.[[File:Last-Agent8-53.PNG|thumb|800px|center]][[Scenario-builder-reference-guide/FindAgent | Find Agent]] finds the next available skilled agent (not the last known agent). There are no special conditions to add in this Find Agent block.[[File:Last-Agent9-53.PNG|thumb|800px|center]]The [[Scenario-builder-reference-guide/Exit | Exit]] block completes the scenario. Without it, the scenario will loop through this configured flow until the customer ends the call.Be sure to save the scenario with a new name. Closing the browser tab or window will cancel out your work.Now that you have completed your scenario, you need to enable service continuation. This allows your contact center system to return an identified contact (i.e., your caller) to the same agent who last helped the caller.# Enable '''Enable Service continuation for up to __ hours''' and specify the number of hours.[[File:Last-Agent11-53.PNG|thumb|800px|center|Call Center configuration > Identification]]For more information, see the Contact Center Administrator Guide, section [[Contact-center-administrator-guide/Identification | Identification]].'''Note''': It is possible to route additional interaction types from a customer to an agent during an active interaction (e.g., a caller sends an SMS to an agent during the same interaction) using the Find Agent block's wait condition [[Scenario-builder-reference-guide/ScenarioBlocks/FindAgent#Agent_skills_required|Agent currently handling this interaction]].