0

I have a workflow in Twilio which have multiple queues. I need to calculate average wait time for each incoming user based on their position in that specific queue and announce it back to the user.

1 Answer 1

0

Twilio developer evangelist here.

You can grab the information about current and historical queue stats from the workflow statistics api: and generate custom TwiML from that you can then use as the waitUrl on the Enqueue verb.

Note that from the <Enqueue> Docs, some statistics are passed by default to the waitUrl so depending on exactly what you need you may not need to call the statistics API.

avgTaskAcceptanceTime looks like it is of interest to you--it's "The average time (in seconds) from Task creation to reservation acceptance while in this TaskQueue." Or the WaitDurationUntilAccepted ("The wait duration stats (avg, min, max, total) for tasks that were accepted while in this TaskQueue")

Let me know if this helps at all!

Sign up to request clarification or add additional context in comments.

3 Comments

Lets say I have 3 users in the queue first time we announce the avg wait time for all users based on their position. But what if still the users are on hold we again loop and announce the wait time. At this point of time will the Api give correct avg wait time for each user?
It would depend on how many of the tasks have been accepted. If none of the tasks have been accepted, then probably not. Are you using the queue stats API?
It is a multi skill queue based on that the users will be queued. I think the API will not give correct values as there is overflow of queue as well. Is there any API that can consider the above scenario’s or I need to write a new algorithm to determine it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.