如何使用 parentSID 将 childSID 获取到 twilio
How can i get childSID using parentSID into the twilio
我正在我的应用程序中使用 Twilio javascript SDK。
Twilio 连接总是 return 一个 parentSID,但在 childSID 中有可用的实际数据,我如何使用 parentSID 获取 childSID,是否有任何可能的方法来获取 childSID 列表?
提前致谢。
此处为 Twilio 开发人员布道师。
您可以使用 Twilio 的 REST API 来 return 父 SID 的所有子调用。您只需要调用 Calls list resource and pass a parent call SID parameter。在 Node.js 中看起来像这样:
var accountSid = "your_account_sid";
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);
client.calls.list({ parentCallSid: "the_parent_call_sid" }, function(err, data) {
data.calls.forEach(function(call) {
console.log(call.sid);
});
});
编辑
这是您需要的 PHP 版本。您需要下载 Twilio PHP helper library 然后使用此代码:
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);
$calls = $client->calls->read(
array("ParentCallid" => "the_parent_call_sid")
);
// Loop over the list of calls and echo a property for each one
foreach ($calls as $call) {
echo $call->sid;
}
如果这有帮助,请告诉我。
我正在我的应用程序中使用 Twilio javascript SDK。
Twilio 连接总是 return 一个 parentSID,但在 childSID 中有可用的实际数据,我如何使用 parentSID 获取 childSID,是否有任何可能的方法来获取 childSID 列表?
提前致谢。
此处为 Twilio 开发人员布道师。
您可以使用 Twilio 的 REST API 来 return 父 SID 的所有子调用。您只需要调用 Calls list resource and pass a parent call SID parameter。在 Node.js 中看起来像这样:
var accountSid = "your_account_sid";
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);
client.calls.list({ parentCallSid: "the_parent_call_sid" }, function(err, data) {
data.calls.forEach(function(call) {
console.log(call.sid);
});
});
编辑
这是您需要的 PHP 版本。您需要下载 Twilio PHP helper library 然后使用此代码:
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);
$calls = $client->calls->read(
array("ParentCallid" => "the_parent_call_sid")
);
// Loop over the list of calls and echo a property for each one
foreach ($calls as $call) {
echo $call->sid;
}
如果这有帮助,请告诉我。