You might have noticed this feature in the Connect applet. The goal of this feature is to route an equal number of calls to all the agents in a group.


In other words, enabling this option routes the calls in a “round robin” manner among all the agents in a group. Obviously, it also considers the availability of the agents at the moment the call arrives.


Let us say, there are four people in a group Ajay, Bhaskar, Chaitanya and Dev with their numbers being 011xx, 022xx, 033xx and 044xx respectively. When the first call lands on the VN which is supposed to equally distribute between the agents in this group, the system will first stack the agent numbers which are free (in this case all four) in ascending order of agent numbers and route the call to the agent with the first number in the stack, in this example it being Ajay. It will also mark Ajay’s position in the stack as the lastMarkedAgent ie, lastCalledAgent for future reference.


Status of Agents prior to the 1st call


Ajay - 011xx - free

Bhaskar - 022xx - free

Chaitanya - 033xx - free

Dev - 044xx - free

Stack for the 1st call

Ajay - 011xx - the first call routed to Ajay and Ajay is the lastMarkedAgent now

Bhaskar - 022xx - free

Chaitanya - 033xx - free

Dev - 044xx - free


Now when the second call comes in, the stack will rearrange itself with all numbers above the lastMarkedAgent moving to the end of the stack. Please note in case of the lastMarkedAgent number itself being busy, all free agent numbers which come above it when ascendingly arranged in the original stack will move to the end of the stack. In the example here, Ajay will be pushed below Dev and Bhaskar is the agent who the call will be routed to, and Bhaskar is marked as the lastMarkedAgent. Please note, it is now up to Bhaskar whether he answers the call or not which is handled as a standard flow of the connect applet which moves on to the next free agent if Bhaskar does not pick up the call in a while.


Status of Agents prior to the 2nd call


Ajay - 011xx - free - lastMarkedAgent

Bhaskar - 022xx - free

Chaitanya - 033xx - free

Dev - 044xx - free

Stack for the 2nd call

Bhaskar - 022xx - the second call routed to Bhaskar and Bhaskar is the lastMarkedAgent now

Chaitanya - 033xx

Dev - 044xx

Ajay - 011xx


Now let's say after N calls came into the system, the status looks like below:


Status of Agents prior to (N+1)th call


Ajay - 011xx - busy

Bhaskar - 022xx - free

Chaitanya - 033xx - free

Dev - 044xx - free - lastMarkedAgent


When the (N+1)th call lands, Ajay should be marked as the lastMarkedAgent. But here since Ajay is busy, the stack will not consider him. As per the stack, the call will now route to Bhaskar. It's important to remember that the stack only consists of agent numbers which are at that point of time free to receive calls.


Stack for (N+1)th call


Bhaskar - 022xx - (N+1)th call is routed to Bhaskar and Bhaskar marked as lastMarkedAgent

Chaitanya - 033xx

Dev - 044xx


When the (N+2)th call lands, first both Ajay and Bhaskar will be pushed to the end of the stack (since the lastMarkedAgent is Bhaskar), then Chaitanya is marked as the lastMarkedAgent and the call is routed to him.


Status of Agents prior to (N+2)th call


Ajay - 011xx - free

Bhaskar - 022xx - free - lastMarkedAgent

Chaitanya - 033xx - free

Dev - 044xx - free


Stack for (N+2)th call


Chaitanya - 033xx  - lastMarkedAgent - (N+2)th call routed to Chaitanya

Dev - 044xx

Ajay - 011xx

Bhaskar - 022xx


This way the equal distribution logic ensures that the calls are routed in a perfect ‘round robin’ manner, the sorted list keeps moving in a round path. There are a couple of scenarios which needs to be highlighted here


Scenario 1: Agent is in “OFF” state and switches to “ON”


Exotel provides the option to individual agents to mark themselves as not available to receive calls by marking themselves as “OFF”. Agents who have marked themselves as “OFF” will not be considered in the stack itself. So there can be a scenario where an agent was initially in “OFF” state and now marks themselves as ON, then the entry point for the person in the next calculated stack will be the place where they would fit if all the agent numbers were arranged in ascending order. Let us have a look at how this works.


Let us consider the scenario as shown below. Here Chaitanya is OFF. Naturally, the running stack would not have included him. So the current stack at the end of the Nth call looks like below, while Chaitanya is in OFF state.


Dev - 044xx - free - lastMarkedAgent                |             Chaitanya - 033xx - is in “OFF” state currently

Ajay - 011xx - free

Bhaskar - 022xx - free


Let's say now Chaitanya marks themselves as “ON”. He enters the stack on top of the number which is immediately succeeding them in the ascending order. So the stack will now look like.


Chaitanya - 033xx - free

Dev - 044xx - free - lastMarkedAgent        

Ajay - 011xx - free

Bhaskar - 022xx - free


So when the (N+1)th call comes in all the numbers from the top till the lastMarkedAgent are moved to the end of the stack en block. The stack will now look like this:


Ajay - 011xx - free - (N+1) the call routed to Ajay and marked as lastMarkedAgent

Bhaskar - 022xx - free

Chaitanya - 033xx - free

Dev - 044xx - free


Here, both Chaitanya and Dev move to the end of the stack. Ajay is marked as the lastMarkedAgent and call is routed to him.


Scenario 2: “Sticky Agent” option is enabled


Exotel allows to generate call flows which when enabled, every time the end user calls in the VN it will connect them to the agent he has earlier spoken to. In this case, let us go back to the stack that we had at the end of the Nth call.


Dev - 044xx - free - lastMarkedAgent

Ajay - 011xx - free

Bhaskar - 022xx - free

Chaitanya - 033xx - free


Now, the (N+1)th call comes in from a customer whose sticky agent is Chaitanya. In this case, Chaitanya will be promoted to the top when the stack is calculated and the call will be routed to him. However, Dev will still continue to be the lastMarkedAgent.


Chaitanya - 033xx - free - (N+1)th call routed to Chaitanya

Dev - 044xx - free - lastMarkedAgent

Ajay - 011xx - free

Bhaskar - 022xx - free


Just like in scenario 1, when the (N+2)th call would come in, then both Chaitanya and Dev would move to the end of the stack.


In any case, if this doesn't work as expected, please feel free to reach out to Customer Happiness Team at hello@exotel.in or +91-8088919888.