Get Started

Call Queue

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.

Concepts

This example shows how to use the Enqueue verb and the Queue noun to manage inbound callers and answering agents.

Download

callqueue.zip

Implementation

  • 1

    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.

  • 2

    • Web server responds, placing caller into a Queue.

      • howtos/callqueue/caller.xml
        <Response>
            <Enqueue>Queue Demo</Enqueue>
        </Response>
            
  • 3

    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.

  • 4

    • Web server responds, connecting agent with the first caller waiting in the Queue.

      • howtos/callqueue/agent.xml
        <Response>
            <Dial>
                <Queue>Queue Demo</Queue>
            </Dial>
        </Response>