我正在将 TaskRouter Twilio 与 Laravel 一起使用。
这就是我现在正在做的事情
我已将 twiml 应用程序附加到电话号码。
向该 twiml 应用程序添加了一个 webhook。
在那个 webhook 上我点击了这段代码 $response = new VoiceResponse();
$taskAttributes = [
'channel' => 'voice', // Specify that it's a voice call
];
$enqueue = $response->enqueue('WSDSupport',['workflowSid' => $workflowSid,
'action' => url('ivr/testQueue')]);
$enqueue->task(json_encode($taskAttributes),['timeout' => 200]);
return response($response)->header('Content-Type', 'text/xml');
现在在前端我收到了预订创建事件(reservation.created)
我收到接受预订的提示。当我这样做时。
if (confirm('Incoming call. Accept?')) {
reservation.accept();
} else {
reservation.reject();
}
选择了 Worker 但没有任何反应。在工作流程回调 URL 上,我运行此代码。
return response()->json([
"instruction"=> "dequeue",
"from"=> $taskAttributes['from'],
"post_work_activity_sid"=> config('services.twilio')['postWorkActivitySid']
]);
我需要通过致电客户来联系我的代理。我到处搜索但没有找到任何帮助。
出队指令需要四个参数。您的代码示例缺少“to”参数:
{
"instruction": "dequeue",
"to": "{the Worker's phone number, sip uri, or client uri. Required.}"
"from": "{the caller ID that you want to send to the Worker. Required.}"
"post_work_activity_sid": "{the ActivitySid that should be assigned to the Worker after the call ends. Optional.}"
}
有关这些字段的更多信息:
指令指定要执行的分配活动。使用 'dequeue' 使对 Worker 的调用出队。获取完整的作业列表 说明,请在此处阅读有关处理分配回调的信息。
to 指定工作人员接收者的电话号码。
from 指定将呼叫延伸至 Worker 时应发送的呼叫者 ID。
post_work_activity_sid指定您想要的ActivitySid 调用完成后分配给 Worker。用它来过渡 您的员工处于对他们的后续呼叫、工作有意义的状态 例如“总结”。
更新代码:
return response()->json([
"instruction"=> "dequeue",
"from"=> $taskAttributes['from'],
"to"=> $workersPhoneNumberInE164,
"post_work_activity_sid"=> config('services.twilio')['postWorkActivitySid']
]);