In the assignment callback endpoint, i have used instruction => 'conference' to convert all incoming call to conference:
return response()->json(array('instruction' => 'conference', 'call_sid' => $attributes->call_sid, 'from' => $attributes->to, 'timeout' => strval($timeout),
'url' => secure_url('/agent-answer?ReservationSid=' . $reservationSid)));
But now, task router is not able to route the call to different workers, if one worker does not receive the call then the call popup is faded and the screen turns into black. None of the other worker gets the call.
If I use 'instruction' => 'call' then everything works fine. But I need to use conference to handle some other functionality like live listen.
How can I fix the above issue by using 'instruction' => 'conference' in assignment callback endpoint.
Thanks for any help in advance.
To convert all incoming call to conference from the beginning: If you guys use the command instruction => 'conference' in the assignment callback endpoint, then its gonna give other issue like task router not being able to route the task to multiple workers etc. So, the another way is as follows:
Set instruction=>'call' in the assignment callback endpoint and in the agent answer method, need to modify the incoming customer call to conference and change the task's reservation status to completed as follows:
Modify customer call to conference and Set the reservation to accepted in the agent answer method:
$this->client->calls($callSid)
->update(array(
'method' => "POST",
"url" => secure_url('/call/modify-customer-call-to-conference?endConferenceOnExit=false&conferenceId=' . $taskSid),
)
);
$this->client->taskrouter
->workspaces($this->workspaceSid)
->tasks($taskSid)
->reservations($reservationSid)
->update(['reservationStatus' => 'accepted']);