0
votes

Our app brings together several participants into a conference. The Host, uses twilio client, while participants use either phone lines or twilio clients.

The host need to know when each participant joins the conference.

is there a way via the RESTful API to get in real-time who joined the conference?

1

1 Answers

2
votes

Here's how to get the participants' numbers:

<?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;
?>

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

You can probably modify it to return $call->StartTime additionally. That would let the moderator know who called and when their call started. I hope that helps.