From Push To Pull: ThinkVoice Revamps Their Phone System And Customer Service With Twilio Queue

January 06, 2014
Written by

thinkvoice

brian
Think of being on hold as being in a waiting room with no receptionist. You sit and wait. Eventually someone greets you. If you’re lucky, this is the person you meant to speak with. If you’re not, you go back into the waiting room while the person you just met with (hopefully) contacts the person you need to speak to. This process seemed absolutely insane to ThinkVoice founder Brian Coyle (pictured right).

Brian wanted to completely reverse how call queuing and holding patterns work to reduce the amount of time ThinkVoice customers spend on hold. He also wanted to reduce the time ThinkVoice employees spend routing customers calls to the right person. He added intelligence to his Twilio powered call queue so the customers call goes to the right person the first time, every time.

Brian detailed how he changed the queue  from a push based system to a pull based system in “Changing the Phone From a Push System to a Pull System” originally published on the ThinkVoice blog. He walks you through building your own Twilio powered call queue system in the code featured below.

Changing the Phone From a Push System to a Pull System

pushpull

Taking calls from customers and leads is challenging when you don’t have a dedicated staff to do so. The problem is we are frequently in meetings or tied up to take calls as they come in and having a lead or customer leave a message is a poor user experience. For ThinkVoice we didn’t want to just put up an email address because we really want to and love to talk to customers and leads. It is the fastest and most effective way to understand our customers and potential customers. So we solved the inherent problem with the phone.

The phone is by nature a push system. When someone dials your phone number that call is pushed to your phone and you have somewhere around four rings to answer or it goes to voicemail. To fix this we created a Twilio app that will change the phone from being a push system to a pull system where calls can be queued and pulled to mobile phones by the person best suited to take the call.

Queues are nothing new for phones but the idea of calls being pulled out of queue rather than being pushed is new. In call centers ACDs are large complex systems that queue calls and push those calls to agents. In order to do this the ACD must monitor each agent in real time via synchronous messaging to deliver a call as soon as that agent is available. If we change that push model to be a pull model then we can have the agent’s system asynchronously pull calls out of queue or they themselves queue up for the next call. Breaking that synchronous communication requirement drastically reduces the complexity of call center technology making it less expensive and more agile.

Here’s How We Did It

The first thing we are going to do is answer the call and immediately send a SMS message. Using the meta data from Twilio we can include a look up of the caller’s name and their location. We then place them in a queue and redirect the app to tell Twilio what to play them while in queue. For our case we will tell the caller we are routing them and play them some music.

get_or_post '/call/?' do
  @caller_number = params[:From]
  @caller_name = params[:CallerName] ||= "Unknown"
  @caller_city = params[:FromCity] ||= "Unkown"
  @caller_state = params[:FromState] ||= "Unknown"
  
  response = Twilio::TwiML::Response.new do |r|
    r.Sms "You have a call from #{@caller_name} in #{@caller_city}, #{@caller_state} Would you like to take the call?",
              :from => settings.twilio_caller_id,
              :to => settings.twilio_mobile_number
    r.Enqueue "pull_q", :waitUrl => '/queue'
  end  
  response.text
end

# While in queue URL
get_or_post '/queue/?' do
  response = Twilio::TwiML::Response.new do |r|
    r.Say 'Thank you for calling.  Please hold for the next available person', :voice => 'Alice'
    r.Play 'http://com.twilio.sounds.music.s3.amazonaws.com/MARKOVICHAMP-Borghestral.mp3'
  end
  response.text
end

When we receive the SMS message we can reply to tell Twilio what to do with the call. We can configure the SMS to take any number of keywords to control different routing behaviors but we are just using a Yes or No to take the call or send it to voicemail. In either case when the SMS is received we are going to pull the call out of queue and redirect the call to the proper instructions.

get_or_post '/sms/?' do
  # check the source of the SMS
  if params[:From] == settings.twilio_mobile_number
    client = Twilio::REST::Client.new settings.twilio_sid, settings.twilio_token
    #pull the call from the front of the queue
    queues = client.account.queues.list()
    queues.each do |queue|
      if queue.friendly_name == "pull_q"
        @call = client.account.queues.get(queue.sid).members.get("Front")
      end
    end
    
    case params[:Body].downcase
    when "no"
      url = base_url + "/message"
    # when "other key words and treatments"
    else
      url = base_url + "/connect"
    end

    @call.update(:url => url)
  end
  #need to respond to sms with blank response block
  response = Twilio::TwiML::Response.new do |r| end
  response.text       
end

If we have decided not to take the call we are simply going to send Twilio instructions to tell the caller to leave a message that will be recorded and stored by Twilio. If we have decided to take the call then we tell Twilio to call our mobile number and bridge the caller.

get_or_post '/message/?' do
  response = Twilio::TwiML::Response.new do |r|
    r.Say 'Sorry but we are unable to take your call right now.  Please leave a message after the beep', 
          :voice => 'alice'
    r.Record :timeout => "10", :transcribe => "false"
    r.Hangup
  end
  response.text  
end

get_or_post '/connect/?' do
  response = Twilio::TwiML::Response.new do |r|
    r.Dial :callerId => settings.twilio_caller_id do |d|
      d.Number settings.twilio_mobile_number
    end
  end
  response.text  
end

The full code for the Pull Phone system is on GitHub. If you need any help setting up your own Pull Phone system please let us know and we would be glad to help.