Twilio TaskRouter - 按 assigned_tasks 排序工人
Twilio TaskRouter - ordering workers by assigned_tasks
我的 Twilio TaskRouter 配置遇到了一个问题。问题是我需要将传入任务分配给分配给 him/her 较少任务的工作人员,而不是最长空闲工作人员(默认情况下)。
根据 Twilio's multitasking documentation,每个工作人员在其频道内都有一个 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
根据 Twilio 的支持,无法按任务分配数量对我的工作人员进行排序。相反,他们建议我根据这个 worker 属性的特定值创建很多过滤步骤。
所以,这是我现在的工作流程:
{
"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"
}
}
}
我的 Twilio TaskRouter 配置遇到了一个问题。问题是我需要将传入任务分配给分配给 him/her 较少任务的工作人员,而不是最长空闲工作人员(默认情况下)。
根据 Twilio's multitasking documentation,每个工作人员在其频道内都有一个 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
根据 Twilio 的支持,无法按任务分配数量对我的工作人员进行排序。相反,他们建议我根据这个 worker 属性的特定值创建很多过滤步骤。
所以,这是我现在的工作流程:
{
"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"
}
}
}