ruby-on-railsrubytwilioinbound

Managing calls with multiple agents Twilio


I'm working in a project with Twilio to make and recieve calls. So, imagine you want to do a call, and in the other side we have 3 agents to take the call, with three twilio numbers. I want to show the inbound call only to one of the agents (randomly).

I'm not sure if to achieve this behaviour I should generate a different response with a different or a different of one of the agents.

For example:

response = Twilio::TwiML::Response.new do |r|
  # Should be your Twilio Number or a verified Caller ID
  r.Dial :callerId => caller_id do |d|
      d.Client <custom_client_name>
  end

or

response = Twilio::TwiML::Response.new do |r|
  # Should be your Twilio Number or a verified Caller ID
  r.Dial :callerId => caller_id do |d|
      d.Number <custom_client_number>
  end

Thank you guys!


Solution

  • Twilio developer evangelist here.

    This sounds like a pretty good use case for our TaskRouter API. TaskRouter allows you to place incoming calls into a queue which will use a workflow to assign those calls to agents when they are available.

    This blog post shows how to build a priority based queueing system using TaskRouter, but if you just follow it up to the point before priorities arrive then you will have a queue in which agents are automatically assigned incoming calls.

    Let me know if this helps at all.