Php 如何使此代码显示“请稍候”并播放自定义mp3?

Php 如何使此代码显示“请稍候”并播放自定义mp3?,php,twilio,twilio-php,Php,Twilio,Twilio Php,这是一条在主持人加入时开始的会议线路 它工作得很好,只是我不知道如何让它说“请别挂断”,你很快就会接通。欢迎致电 我还想为hold音乐播放一个自定义mp3文件 <?php // Get the PHP helper library from twilio.com/docs/php/install // this line loads the library require_once '/var/www/one/conference/twilio/Twilio/autoload.php';

这是一条在主持人加入时开始的会议线路

它工作得很好,只是我不知道如何让它说“请别挂断”,你很快就会接通。欢迎致电

我还想为hold音乐播放一个自定义mp3文件

<?php
// Get the PHP helper library from twilio.com/docs/php/install

// this line loads the library
require_once '/var/www/one/conference/twilio/Twilio/autoload.php';
use Twilio\Twiml;

// Update with your own phone number in E.164 format
$MODERATOR = '+1347999999';

$response = new Twiml;

// Start with a <Dial> verb

$dial = $response->dial();

// If the caller is our MODERATOR, then start the conference when they
// join and end the conference when they leave
if ($_REQUEST['From'] == $MODERATOR) {
$dial->conference('My conference', array(
            'startConferenceOnEnter' => True,
            'endConferenceOnExit' => True,
            'beep' => True,
            'record' => True

            ));

} else {
// Otherwise have the caller join as a regular participant
$dial->conference('My conference', array(
            'startConferenceOnEnter' => False
            ));
}

print $response;

?>

这里是Twilio开发者福音传道者

为了在通话开始时获得消息,您需要在使用之前使用

要在会议开始前播放自定义音乐,您需要使用标签上的。waitUrl是指向MP3或Wav文件或返回TwiML的URL,TwiML可能包含多个或多个动词

以下是您的代码更新,其中包括开始时的消息和音乐的waitUrl。值得注意的是,主持人在开始会议时不需要waitUrl:

// Get the PHP helper library from twilio.com/docs/php/install

// this line loads the library
require_once '/var/www/one/conference/twilio/Twilio/autoload.php';
use Twilio\Twiml;

// Update with your own phone number in E.164 format
$MODERATOR = '+1347999999';

$response = new Twiml;

// Start with a welcome message
$response->say("Please hold, you'll be connected shortly.");

// Then add the <Dial> verb
$dial = $response->dial();

// If the caller is our MODERATOR, then start the conference when they
// join and end the conference when they leave
if ($_REQUEST['From'] == $MODERATOR) {
$dial->conference('My conference', array(
            'startConferenceOnEnter' => True,
            'endConferenceOnExit' => True,
            'beep' => True,
            'record' => True
            ));

} else {
// Otherwise have the caller join as a regular participant
$dial->conference('My conference', array(
            'startConferenceOnEnter' => False,
            'waitUrl' => 'http://twimlets.com/holdmusic?Bucket=com.twilio.music.classical'
            ));
}

print $response;

让我知道这是否有帮助。

Thank you@philnash我在拨号下的位置放错了,现在可以说了,但我自定义的mp3 waitUrl仍然没有。我把它放在与上面相同的位置,就像这个“waitUrl”=>但是它不起作用。只是想一想,也许我的自定义waitUrl不起作用,因为我在我的主持人来电显示上-我稍后会尝试其他号码。再次感谢@philnash-让话语权发挥作用是一个巨大的帮助!好的,我在我的非主持人手机上进行了测试,得到了想要的维瓦尔第!答案是完美的。