Twilio在连接设备时获得会议SID

时间:2017-08-22 11:45:33

标签: php symfony twilio

在用PHP连接调用时,有没有办法获得会议SID?

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

在此通话操作后,我无法获得会议ID吗? 或者可以在Twiml上设置会议SID。这可能吗?

2 个答案:

答案 0 :(得分:1)

Twilio开发者传道者在这里。

当您通过REST API创建呼叫时,它尚未与会议关联。我假设您发送的$twimlURL返回<Dial><Conference>some conference name</Conference></Dial>,这是该呼叫与会议相关联的时间。

您可以通过listing conferences using the REST API and filtering by the FriendlyName (the name you used in the TwiML) and by the status in-progress获取会议SID。像这样:

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

让我知道这是否有帮助。

答案 1 :(得分:0)

万一有人在寻找 C# 版本

  TwilioClient.Init(credentials.AccountSID, credentials.AuthToken);

  ResourceSet<ConferenceResource> conferencesResources = await ConferenceResource.ReadAsync(status: "in-progress", friendlyName: "<your conference room name>");

  ConferenceResource conference = conferencesResources.FirstOrDefault();

  Console.WriteLine(conference.Sid);