2015-04-17 67 views
0

我們的應用程序彙集了幾個參與者參加會議。主持人使用twilio客戶端,而參與者使用電話線或twilio客戶端。如何捕獲來電者加入Twilio會議?

主持人需要知道每個參與者加入會議的時間。

有沒有辦法通過RESTful API實時獲得誰加入會議?

回答

2

這裏是如何得到與會者的號碼:

<?php 
    // Get the PHP helper library from twilio.com/docs/php/install 
    require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library 

    // Your Account Sid and Auth Token from twilio.com/user/account 
    $sid = "ACXXXXX"; 
    $token = "YYYYY"; 
    $client = new Services_Twilio($sid, $token); 

    $response = new Services_Twilio_Twiml(); 

    if(isset($_REQUEST['ConferenceSid'])){ 
     $participants = $client->account->conferences->get($_REQUEST['ConferenceSid'])->participants; 
     $cnt = count($participants); 
     $response->Say( "There are ".$cnt." callers in this conference"); 
     foreach ($participants as $participant) { 
      $call = $client->account->calls->get($participant->callsid); 
      $response->Say($call->from); 
     } 
    } 

    $response->Redirect("conferencemod.xml"); 
    print $response; 
?> 

來自https://www.twilio.com/blog/2014/09/roll-call-roger-stringer-shows-you-how-to-take-a-headcount-during-a-twilio-conference-call.html

你也許可以修改它以另外返回$呼叫 - >開始時間。這將讓主持人知道誰打來電話,以及他們的電話何時開始。我希望有所幫助。

相關問題