【发布时间】:2018-12-26 22:45:36
【问题描述】:
我正在使用 Twilio PHP 帮助程序库。
我有几个存储在数据库中的子帐户凭据。每个子帐户通常有几个与之关联的拨出呼叫者 ID。
我使用每个子帐户的凭据来获取呼出的CallerIds。
从返回的数据中,我获取子账户 SID (AC) 和号码 SID (PN)。
我遵循文档,每次尝试使用子账户中的数字更新主账户时都会收到错误消息。
捕获异常:[HTTP 404] 无法更新记录:请求的 资源 /2010-04-01/Accounts/ACxxxxxxxxxxxxxx/IncomingPhoneNumbers/PNxxxxxxxx.json 没找到
我已经检查了帐户 sids 和 number sids 并且它们是正确的。
知道我哪里出错了吗?
这是我在 foreach 中进行的尝试,每个子帐户都有凭据。
try
{
$client = new Client($sid, $token); //subaccount sid and token from not shown foreach
$caller_ids = $client->outgoingCallerIds->read();
foreach ($caller_ids as $caller_id)
{
$phone_number = $caller_id->phoneNumber;
$friendly_name = $caller_id->friendlyName;
$number_sid = $caller_id->sid;
$account_sid = $caller_id->accountSid;
$incoming_phone_number = $master_account->incomingPhoneNumbers("$number_sid")
->update(
array("accountSid" => "$account_sid")
);
}
}
【问题讨论】: