Reputation: 2633
I have a Twilio phone number which I am using for softphone and that phone I have configured for TaskRouter. So whenever Somebody call to twilio number that call route to available Worker, this is working fine but my question is how Worker can call other non twilio number in live call.
I am reading a docs on https://www.twilio.com/docs/api/taskrouter/handling-assignment-callbacks#redirecting-call where it mentions that
1. Dial the worker in a Conference name by the ReservationSid. This can be done on assignment call back.
2. Utilize Redirect Assignment Instruction to transfer the customer from a Queue to a Conference named by the ReservationSid.
So how can I dial a Worker in conference and how customer redirect to that conference so Agent can dial a non twilio number in live call and redirect that call in conference
means it is like three way communication,
Customer-->Twilio Number--->Worker--->Non Twilio number??
Upvotes: 1
Views: 982
Reputation: 206
in PHP I have manage like this
first set one URL assignment in taskrouter
HERE : TaskRouter->Settings->Event Callbacks
like www.site.com/test/event_status_callback.php
You can use twilio conferece task router :-
https://www.twilio.com/docs/api/taskrouter/reservations
Conference Instruction like this
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;
// Your Account Sid and Auth Token from twilio.com/user/account
$accountSid = "AC1afdf65d5c4e434dc58792456bda940f";
$authToken = "your_auth_token";
$workspaceSid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$taskSid = "WTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$reservationSid = "WRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$client = new Client($accountSid, $authToken);
// Update a Reservation with a Conference instruction
$reservation = $client->taskrouter
->workspaces($workspaceSid)
->tasks($taskSid)
->reservations($reservationSid)
->fetch();
$reservation->update(
array(
'instruction' => 'conference',
'dequeueFrom' => '+18001231234'
)
);
1) call come on twilio number and goes to taskrouter
<Response>
<Enqueue workflowSid="WWXXXXXXXXXXXXXXXXXXXXXXXX">
<Task>{"selected_language": "<?= $language ?>"}</Task>
</Enqueue>
</Response>
2)now call goes to perticuler language wise and dail to avelable workers and here you can redirect your call to other Non Twilio number get call sid
also you can Use Db for manage worker side and call sid
In this event_status_callback.php page you get call_sid
$call = $client
->calls($call_sidss)
->update(
array(
"url" => $url . "test/callredirectonsupport.php",
"method" => "POST"
)
);
echo $call->to;
3) callredirectonsupport.php
now you call redirect to callredirectonsupport.php
here you can write youe dial code
Upvotes: 1