当呼叫者加入Twilio会议时如何捕获?

时间:2015-04-17 15:04:16

标签: twilio

我们的应用程序将几位参与者聚集到一个会议中。主持人使用twilio客户端,而参与者使用电话线或twilio客户端。

主持人需要知道每个参与者何时加入会议。

是否有办法通过RESTful API实时加入会议?

1 个答案:

答案 0 :(得分: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

您可以修改它以返回$ call-&gt; StartTime。这将让主持人知道谁打电话以及他们何时开始通话。我希望有所帮助。