This example shows how to use Twilio's Queue feature to create a simple call queuing system. The application serving as the example shows how to accept an incoming call, place it into a queue. The example then shows how to connect a live caller with the call waiting in the queue.
For this demonstration, we'll use two Twilio phone numbers - one for callers and one for agents. By callers and agents, we mean to create a conceptual distinction between those who enter the queue and those who answer the queue. A caller could be for example a customer of yours looking for customer service. An agent then would be an employee helping the customers that we are placing in the Queue. With this caller/agent distinct, we create one TwiML app for the caller going into the Queue and another for the agent that we want to answer the Queue.
This example shows how to use the Enqueue verb and the Queue noun to manage inbound callers and answering agents.
Twilio receives caller and requests TwiML. When Twilio receives the call to the phone number for customers, Twilio makes a request to the Voice Request URL to place the caller in the Queue.
Web server responds, placing caller into a Queue.
Twilio receives call from agent, and requests TwiML. When Twilio receives the call to the phone number for agents, Twilio makes a POST request to the Voice Request URL to connect the agent with the first caller in the Queue.
Web server responds, connecting agent with the first caller waiting in the Queue.