我是twilio的起始人。我已經閱讀快速入門從瀏覽器撥打電話。下面Twilio從瀏覽器傳出的電話
<?php
require 'twilio-php-master/Twilio/autoload.php';
use Twilio\Jwt\ClientToken;
$accountSid = '***************************';
$authToken = '***************************';
$appSid = '****************';
$capability = new ClientToken($accountSid, $authToken);
$capability->allowClientOutgoing($appSid);
$capability->allowClientIncoming('jenny');
$token = $capability->generateToken();
?>
<!DOCTYPE html>
<html>
<head>
<title>Hello Client Monkey 4</title>
<script type="text/javascript"
src="//media.twiliocdn.com/sdk/js/client/v1.3/twilio.min.js"></script>
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js">
</script>
<link href="//static0.twilio.com/resources/quickstart/client.css"
type="text/css" rel="stylesheet" />
<script type="text/javascript">
Twilio.Device.setup("<?php echo $token; ?>");
Twilio.Device.ready(function (device) {
$("#log").text("Ready");
});
Twilio.Device.error(function (error) {
$("#log").text("Error: " + error.message);
});
Twilio.Device.connect(function (conn) {
$("#log").text("Successfully established call");
});
Twilio.Device.disconnect(function (conn) {
$("#log").text("Call ended");
});
Twilio.Device.incoming(function (conn) {
$("#log").text("Incoming connection from " + conn.parameters.From);
// accept the incoming connection and start two-way audio
conn.accept();
});
function call() {
// get the phone number to connect the call to
params = {"PhoneNumber": $("#number").val()};
Twilio.Device.connect(params);
}
function hangup() {
Twilio.Device.disconnectAll();
}
</script>
</head>
<body>
<button class="call" onclick="call();">
Call
</button>
<button class="hangup" onclick="hangup();">
Hangup
</button>
<input type="text" id="number" name="number"
placeholder="Enter a phone number to call"/>
<div id="log">Loading pigeons...</div>
</body>
</html>
TwiML代碼我的代碼被賦予在這裏
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial callerId="+14159426198">
<Number>+91**********</Number>
</Dial>
</Response>
我能夠使呼出。我使用上面的twiML bin創建了TwiML應用程序,但是在twiML中,傳出的電話號碼是靜態的。如何使它在任何數量的撥打電話都是動態的?
請幫忙。
對於來電顯示我有twilio號碼。但我想打電話給任何號碼。我創建了一個twiML應用程序,在其中添加了abiove twiML。在twiML中,我添加了一個數字。我想讓這個號碼變成動態的。 –