0

I'd like to make it so that if a customer hangs up whilst they're waiting in a queue that their place in the queue is preserved. Then, when they come up in the queue, they'd get a call back and an employees phone would ring.

Unfortunately, it is unclear to me how to do this. Quoting https://www.twilio.com/docs/taskrouter/twiml-queue-calls , "If the caller hangs up before being assigned to a worker, the Task is automatically canceled". So it kinda seems like what I'm trying to do might not be possible?

Any ideas?

neubert
  • 15,947
  • 24
  • 120
  • 212

1 Answers1

1

Here is a rough outline for how to achieve this:

  1. Create a new Twilio queue for people who hang-up and then call back. For example, name the queue "someone calling back".
  2. When your app detects that someone has hung-up while in queue, save their information in your local database. All that is really needed is their phone number in E164 format. You can detect when someone hangs up using the action webhook from Enqueue.
  3. If/when that person calls back, use the "From" parameter from the incoming call to check your local database to determine if they are someone who is calling back. If there is a match, add the caller to the "someone calling back" queue.
  4. Use Twilio Taskrouter to make the "someone calling back" queue to be a higher priority than other queues. Taskrouter will then assign the next available worker to someone who has called back.

You will need a database to store information (you could use Twilio Sync or any other database) and a function to check for "someone calling back" (you could use Twilio Functions or any other web application framework).

jassent
  • 529
  • 3
  • 10