Php twilio播放保留音乐并重定向到拨号

Php twilio播放保留音乐并重定向到拨号,php,twilio,Php,Twilio,目标:我希望在创建呼叫时,它应该播放音乐而不是铃声,并且没有人可以接听呼叫。演奏完音乐后,它应该说出来。 之后,它应该重定向到反馈页面 现在:当我们选择通话时,通话被创建,mp3被播放,而在拨号时,反馈页面正在运行 所以我想要一个解决方案来处理这个问题 <?php if (($nowtime >= $start_time) && ($nowtime <= $end_time)){ $the_mnum = $con ->load_field(

目标:我希望在创建呼叫时,它应该播放音乐而不是铃声,并且没有人可以接听呼叫。演奏完音乐后,它应该说出来。 之后,它应该重定向到反馈页面

现在:当我们选择通话时,通话被创建,mp3被播放,而在拨号时,反馈页面正在运行

所以我想要一个解决方案来处理这个问题

<?php
  if (($nowtime >= $start_time) && ($nowtime <= $end_time)){
      $the_mnum = $con ->load_field($the_id, 'the_mnum');
      //$m= $the_mnum;
      //echo $the_mnum;
?>     <Say voice="woman"> 
        We are directing your call to the therapist.
      </Say>


<?php
      $check_therapist = true;
      $_SESSION["the_mnum"] = $the_mnum;
      break;
    }
  }

  if ($check_therapist){ 

    $version = '';
  $sid = '';
  $token = '';
  $client = new Services_Twilio($sid, $token, $version); 
  $call = $client->account->calls->create("+1", $the_mnum, "wekaw1.mp3", array());
echo $call->sid;

    ?>
 <Redirect>feedback.php</Redirect>
    <?php } else {?>
    <Say voice="woman"> 
      No listener is available right now. 
      We will give you a call back shortly when we have available listener. 
    </Say>
<?php } ?>
</Response>

我们正在把你的电话转给治疗师。
feedback.php
现在没有可用的侦听器。
当我们有可用的侦听器时,我们将很快给您回电话。

为了在连接两个号码之前播放hold music而不是Ring,您需要使用和组合并通过我们的Rest API启动一个调用

下面是一个例子

您需要将下面的文件分配给您的电话号码。此代码将
呼叫并启动呼叫转接至您的号码。这还将启动对需要创建的第二个文件(modify_leg.php)的请求

在first.php文件中:

$name = $_POST['CallSid'];

echo '<Response><Enqueue>'.$name.'</Enqueue></Response>';

// Make sure to include php-helper library
require('../Services/Twilio.php'); // Loads the library
$account_sid = 'ACxxxxxxxxxxxxxxxxx';
$auth_token = 'aaxxxxxxxxxxx';
$from_number = '+1xxxxxx';
$to_number = '+1xxxxxxxx';
$client = new Services_Twilio($account_sid, $auth_token);
$message = $client->account->calls->create($from_number, $to_number, 'http://Your-FQDN/modify_leg.php?callSid='.$name);
<?php

$who = $_GET['callSid'];

?>
<Response>
<Dial><Queue><?php echo $who ?></Queue></Dial>
</Response>