我在使用 Twilio 会议时遇到了一个小问题。当我运行代码时,它会调用参与者号码。当参与者接听电话时,会播放“出现应用程序错误,抱歉”的音频。我想在拿起电话时播放等待的 URL 音频。这是我用过的代码。
require_once('Services/Twilio.php');
$API_VERSION = '2010-04-01';
$ACCOUNT_SID = 'ACf4c0952bf89b57ce2a600b6f6b388c9';
$AUTH_TOKEN = '{{ auth token }}';
$client = new TwilioRestClient($ACCOUNT_SID, $AUTH_TOKEN);
$participants = array('+917201990754');
foreach ($participants as $participant)
{
$vars = array(
'From' => '+1 510-491-0176',
'To' => $participant,
'Url' => 'http://192.168.0.19/twilio/conference.xml');
$response = $client->request("/$API_VERSION/Accounts/$ACCOUNT_SID/Calls", "POST", $vars);
if ($response->isError)
{
echo "Something went terribly wrong. {$response->ErrorMessage}";
}
else {
echo '<ul>';
foreach ($response->ResponseXml->Conferences->Conference as $conference)
{
echo '<li>'.$conference->FriendlyName.'</li>';
$response2 = $client->request("/$API_VERSION/Accounts/$ACCOUNT_SID/Conferences/{$conference->Sid}/Participants", "GET");
echo '<ul>';
foreach ($response2->ResponseXml->Participants->Participant as $participant)
{
echo '<li>'.$participant->CallSid.'</li>';
}
echo '</ul>';
}
echo '</ul>';
}
}
下面是我使用的 xml 代码。
<Response>
<Dial hangupOnStar="true">
<Conference>YourConference</Conference>
</Dial>
<Gather action="http://example.com/processConferenceMenu?confName=YourConference" numDigits="1">
<Say>To mute all participants, press one</Say>
<Say>To leave the conference, press two</Say>
</Gather>
自从 10 天以来,我一直在谷歌上搜索它,但没有得到任何适当的解决方案。请您提供带有等待网址的电话会议的工作示例吗?