メニュー

Expand
ページを評価:

Workerの在席状況に応じたスキップ

By default when a Task is processing through a Workflow, a Task will wait in a routing step until it is matched to a Worker or until a timeout moves it to the next routing step. If there are initially no matching Workers, it may be preferable to skip to the next routing step immediately. To do this, use the Skip Timeout expression:

skip_if: workers.available == 0

options

The following special variables can be used to evaluate against the Activity of Workers. These variables are scoped to the Workers in the TaskQueue associated with the currently processing routing step.

VALUE MEANING
workers.available The number of workers in queue that are in an Available activity state
workers.unavailable The number of workers in queue that are in an Unavailable activity state
workers.WAxx The number of workers in queue that are in the activity state corresponding to WAxx, where WAxx is a valid ActivitySid

Skip Timeout will only be evaluated if a Task cannot be assigned to a Worker immediately. Also, Skip Timeout is only successful if the expression evaluates to true. Therefore, TaskRouter will only skip a routing step in a Workflow if:

  • No Reservations are immediately created when a Task enters the routing step
  • The Skip Timeout expression evaluates to true

Skipping Based on Capacity

The variables mentioned above only relate to the Activity of Workers. In a multitasking Workspace, Tasks are only assigned to Workers if they:

  • match the rules of the routing step (i.e., are part of the selected TaskQueue and match the Workers expression)
  • are in an Available Activity
  • have capacity on the Task's channel

The expression 1==1 is useful here. Because 1==1 will always evaluate to true, it can be used to skip the routing step if no Workers are available that match the above criteria.

Syntax

Example Skip Timeout expressions:

  • 1==1
  • workers.available == 0
  • workers.WAxx < 2
  • workers.WAxx < 2 OR workers.WAyy < 2

Skip Timeout expressions must evaluate to true or false, support equality and comparison, and can be compounded with AND/OR logical operators.

{  
   "task_routing":{  
      "filters":[  
         {  
            "filter_friendly_name":"Sales filter",
            "expression":"type == 'Sales'",
            "targets":[  
               {
                  "queue":"WQ3935a4f744a241c1356c09310c2398e6",
                  "expression":"task.subSection = worker.specializedSubField",
                  "order_by":"worker.english_level ASC",
                  "priority":"1",
                  "skip_if": "workers.available == 0"
               },
               {
                  "priority":"1",
                  "queue":"WQ787b271950e0f7687ec432221e672ffa"
               }
            ]
         }
      ]
   }
}

ページを評価:

ヘルプが必要ですか?

誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。

        
        
        

        フィードバックくださりありがとうございます!

        We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!

        Refer us and get $10 in 3 simple steps!

        ステップ1

        Get link

        Get a free personal referral link here

        ステップ2:

        Give $10

        Your user signs up and upgrade using link

        ステップ3

        Get $10

        1,250 free SMSes
        OR 1,000 free voice mins
        OR 12,000 chats
        OR more