如果所有工作人员明确拒绝预订,则将 Twilio 呼叫重定向到语音邮件 [英] Redirect Twilio call to voicemail if all Workers explicitly rejected the reservation

查看:28
本文介绍了如果所有工作人员明确拒绝预订,则将 Twilio 呼叫重定向到语音邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Twilio Task Routing 将调用路由到可用的 Workers,其中包含使用 TaskRouting.js 构建的自定义应用程序 UI.

I'm using Twilio Task Routing to route calls to available Workers with a custom app UI built using TaskRouting.js.

假设我有 2 个空闲的工作人员并且有电话进来.

Let's say I have 2 Idle Workers and a call comes in.

  1. UI 在两个工作人员的屏幕上显示接受或拒绝屏幕
  2. 工人 1 命中拒绝
  3. 工人 2 命中拒绝
  4. 此时,任务显然回到了任务路由队列中,并且重复了第 2 步和第 3 步.

所有工作人员拒绝了电话后,如何将其重定向到语音邮件?

After all workers rejected a call, how do I redirect it to voicemail instead?

推荐答案

Twilio 开发人员布道者在这里.

Twilio developer evangelist here.

我会通过为您的任务添加一个 新的数组属性来实现这一点 记录拒绝任务的工人的 SID.然后,当工作人员拒绝保留时,添加到任务的该属性中.

I would achieve this by adding a new array attribute to your Task to record the SIDs of the workers that rejected the task. Then, when a worker rejects the reservation, adding to that attribute on the task.

然后您可以添加到您的目标表达式:>

Then you can add to your target expression:

worker.sid NOT IN task.rejected_workers

一旦任务失败该表达式,将其移动到一个新队列,该队列有一个空闲的工作人员,而不是接受预订,只是将呼叫重定向到某个 TwiML 到 语音邮件.

Once the task fails that expression, move it to a new queue that has one idle worker that rather than accepting reservations, just redirects the call off to some TwiML to <Record> the voicemail.

让我知道这是否有帮助.

Let me know if that helps at all.

编辑

事实证明,这并不是实现这一目标的正确方法,因为即使目标工作人员表达式与任何工作人员都不匹配,任务也会等到他们必须达到的过滤器级别超时.如果您想确保调用不会两次定向到同一个工作人员,我所描述的方式非常有用.

Turned out that wasn't exactly the right way to achieve this as, even if the target worker expression doesn't match any workers the Task will wait until there's a timeout at the filter level they have got to. The way I've described is really useful if you want to ensure that the call isn't directed to the same worker twice.

所以,相反,我建议您仍然保留拒绝任务的工作人员列表,每次有另一个拒绝时,评估队列中的工作人员以及您的任务属性现在是否涵盖所有工作人员,即已被拒绝被大家.如果是这样,请设置另一个属性,例如 "totallyRejected": true.然后,添加到您的原始过滤器表达式:

So, instead I recommend you still keep the list of workers that have rejected the task and each time there is another rejection, evaluate the workers in the queue and whether your Task's attribute now covers all the workers, ie it has been rejected by everyone. If so, set another attribute, something like "totallyRejected": true. Then, add to your original filter expression:

totallyRejected == false

然后,当一个任务被完全拒绝时,它将使表达式失败并继续下一个过滤器.

Then, when a task has been totally rejected it will fail the expression and go on to the next filter.

这篇关于如果所有工作人员明确拒绝预订,则将 Twilio 呼叫重定向到语音邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆