Php 分机呼叫拨号板-Twilio

Php 分机呼叫拨号板-Twilio,php,twilio,twilio-api,Php,Twilio,Twilio Api,如何在Twilio中实现拨号板功能?我正在从浏览器拨出电话,拨到与此相关的电话号码 TwiML代码: <?php header('Content-type: text/xml'); // put a phone number you've verified with Twilio to use as a caller ID number $callerId = '+1xxxxxxxxx'; // put your default Twilio Client name here, for

如何在Twilio中实现拨号板功能?我正在从浏览器拨出电话,拨到与此相关的电话号码

TwiML代码:

<?php
header('Content-type: text/xml');

// put a phone number you've verified with Twilio to use as a caller ID number
$callerId = '+1xxxxxxxxx';

// put your default Twilio Client name here, for when a phone number isn't given
$number   = 'Name';

// get the phone number from the page request parameters, if given
if (isset($_REQUEST['PhoneNumber'])) {
    $number = htmlspecialchars($_REQUEST['PhoneNumber']);
}

// wrap the phone number or client name in the appropriate TwiML verb
// by checking if the number given has only digits and format symbols
if (preg_match("/^[\d\+\-\(\) ]+$/", $number)) {
    $numberOrClient = "<Number>" . $number . "</Number>";
} else {
    $numberOrClient = "<Client>" . $number . "</Client>";
}
?>
<Response>
    <Dial callerId="<?php echo $callerId ?>">
          <?php echo $numberOrClient ?>
    </Dial>
</Response>


这里是Twilio福音传道者

查看Twilio Client for JavaScript SDK中的函数。调用此函数告诉SDK播放DTMF音调

function senddigits() {
  if (connection!=null) {
      connection.sendDigits("1");
  }
}

希望对您有所帮助。

这是Javascript SDK(Twilio客户端)的完整动态代码

 Twilio.Device.connect(function(connection) {

          //play DTMF tones
        if(connection!==null){
        $(document).on('click' ,'.numpad', function () {
        var number = $(this).val();
            connection.sendDigits(number);
        });
        }
});