我正在关注https://www.twilio.com/docs/api/rest/change-call-state#post上的教程我在php中编写了允许您将当前入站呼叫转发到新Twiml URL的部分。如何获得入境呼叫Sid?目前,我正在检索的呼叫Sid将我的浏览器转发到新的Twiml URL并挂断入站呼叫者。我想我可能有错误的调用Sid,因为我想将当前的入站调用者转发到新的Twiml URL。不是浏览器。有人可以给我一些关于检索入站调用Sid的建议,以便在这个php脚本中使用吗?感谢
Twilio.Device.incoming(function (conn) {
callSid = conn.parameters.CallSid;
$("#log").text("Incoming connection from " + conn.parameters.From);
// accept the incoming connection and start two-way audio
conn.accept();
});
这就是我获得Call Sid的方式。如果我将此呼叫Sid输入
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('TwilioAPI/twilio-php-master/Services/Twilio.php'); // Loads the library
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = '';
$token = '';
$client = new Services_Twilio($sid, $token);
// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$call = $client->account->calls->get("THE CALL SID I GOT FROM THE JS GOES HERE");
$call->update(array(
"Url" => "http://twimlets.com/message?Message%5B0%5D=I%20finally%20did%20it&",
"Method" => "POST"
));
echo $call->to;
?>
此代码将接收调用的浏览器转发到新的Twiml URL。不是入站呼叫者。