2016-03-11 115 views
1

我有一個Twilio電話號碼,我正在使用這個電話號碼,並且我爲TaskRouter配置了該電話。所以每當有人打電話給可用工作人員的電話號碼時,這個工作正常,但我的問題是工作人員如何在實時呼叫中調用其他非Twilio號碼。 我上https://www.twilio.com/docs/api/taskrouter/handling-assignment-callbacks#redirecting-call閱讀文檔在那裏提到
1.撥打工人由ReservationSid一個會議名稱。這可以在分配回叫時完成。
2.利用重定向分配指令將客戶從隊列轉移到由ReservationSid命名的會議。Twilio TaskRouter工作人員會議

那麼,如何可以撥打一個工人在會議和客戶如何重定向到該會議使代理可以撥打電話直播非twilio號和重定向呼叫會議 意味着它是像三路通信,
客戶 - - > Twilio號碼--->工作者--->非Twilio號碼?

回答

1
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' => '+180' 
) 
     ); 

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