Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twilio get conference SID when connecting to devices

Is there a way to get the conference SID when connecting the calls in PHP?

$twilio->account->calls->create(
        $from,
        to,
        $twimlURL
    );

Can't I get the conference ID after this call action? Or maybe set the conference SID on the Twiml. Is this possible?

like image 593
Danubio Avatar asked Oct 15 '25 15:10

Danubio


1 Answers

Twilio developer evangelist here.

When you create a call through the REST API like that, it is not yet associated with a conference. I assume the $twimlURL that you send returns <Dial><Conference>some conference name</Conference></Dial> and that is the time that the call is associated with the conference.

You can get the Conference SID by listing conferences using the REST API and filtering by the FriendlyName (the name you used in the TwiML) and by the status in-progress. Like this:

use Twilio\Rest\Client;

$sid = "your_account_sid";
$token = "your_auth_token";
$client = new Client($sid, $token);

$conferences = $client->conferences->read(
    array("status" => "in-progress", "friendlyName" => "MyRoom")
);
foreach ($conferences as $conference) {
    echo $conference->sid;
}

Let me know if that helps at all.

like image 150
philnash Avatar answered Oct 17 '25 04:10

philnash



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!