0

我在我的 Twilio TaskRouter 配置上遇到了一个问题。问题是我需要将传入任务分配给分配给他/她的任务较少的工作人员,而不是最长空闲的工作人员(默认情况下)。

根据Twilio 的多任务处理文档,每个工作人员在其通道内都有一个assigned_tasks 属性。所以,我试图在我的 order_by 子句中使用这个属性,但它似乎不起作用。

{
  "task_routing": {
    "filters": [
      {
        "filter_friendly_name": "Worker Filter",
        "expression": "transferTargetType == 'worker'",
        "targets": [
          {
            "queue": "WQXXXXX",
            "expression": "worker.sid == task.targetSid",
            "timeout": 30,
            "skip_if": "workers.available == 0"
          },
          {
            "queue": "WQXXXXX",
            "timeout": 0,
            "skip_if": "workers.available == 0"
          }
        ]
      },
      {
        "filter_friendly_name": "Ordered",
        "expression": "1==1",
        "targets": [
          {
            "queue": "WQXXXXX",
            "order_by": "worker.channel.chat.assigned_tasks ASC",
            "skip_if": "workers.available == 0"
          }
        ]
      }
    ],
    "default_filter": {
      "queue": "WQXXXXX"
    }
  }
}

重要的是说我的第一个过滤器在这种情况下没有被触发,因为我没有传递 transferTargetType 属性。

知道为什么这不起作用吗?

感谢:D

4

1 回答 1

1

根据 Twilio 的支持,无法按任务分配的数量对我的员工进行排序。取而代之的是,他们建议我根据此工作属性的特定值创建许多过滤器步骤。

所以,这是我现在的工作流程:

{
  "task_routing": {
    "filters": [
      {
        "filter_friendly_name": "Ordered",
        "expression": "1==1",
        "targets": [
          {
            "queue": "WQXXXXXXXXX",
            "expression": "worker.channel.chat.assigned_tasks == 0",
            "skip_if": "1==1"
          },
          {
            "queue": "WQXXXXXXXXX",
            "expression": "worker.channel.chat.assigned_tasks == 1",
            "skip_if": "1==1"
          },
          {
            "queue": "WQXXXXXXXXX",
            "expression": "worker.channel.chat.assigned_tasks == 2",
            "skip_if": "1==1"
          },
          {
            "queue": "WQXXXXXXXXX",
            "expression": "worker.channel.chat.assigned_tasks == 3",
            "skip_if": "1==1"
          },
          {
            "queue": "WQXXXXXXXXX",
            "expression": "worker.channel.chat.assigned_tasks == 4",
            "skip_if": "1==1"
          },
          ...
        ]
      },
      {
        "filter_friendly_name": "Anybody",
        "expression": "1==1",
        "targets": [
          {
            "queue": "WQXXXXXXXXX"
          }
        ]
      }
    ],
    "default_filter": {
      "queue": "WQXXXXXXXXX"
    }
  }
}
于 2021-04-09T14:33:22.660 回答