如何将电话号码从主帐户转移到子帐户

Yvo*_*pez 5 multi-tenant twilio twilio-api

我已经阅读了twilio中的教程,但不太清楚.

有人可以一步一步地制定程序吗?

这是我从twilio得到的:

在帐户之间交换电话号码

您可以在子帐户之间以及主帐户和任何一个子帐户之间传输号码.在发送传输电话号码的API请求时,您必须使用主帐户的凭据.

要在您控制的两个帐户之间传输电话号码,请对IncomingPhoneNumber实例资源URI发出HTTP POST请求.在POST的正文中,将参数"AccountSid"设置为您希望拥有该号码的帐户的AccountSid.这将删除其原始帐户中的电话号码,并在保留所有其他属性的同时在新帐户的IncomingPhoneNumbers列表资源下提供该号码.

请记住,如上所述关闭子帐户将释放该帐户的所有电话号码,因此如果您想保留这些号码,可以考虑事先将所有号码转移到您的主帐户.

Ale*_*ban 6

一行与卷曲https://curl.haxx.se/.

你需要知道:

  • 来自当前电话号码的帐户

    SOURCE-ACCOUNT-SID

    PHONE-NUMBER-SID

  • 来自将转移电话号码的帐户

    DESTINATION-ACCOUNT-SID

  • 来自你的主人Twilio帐户

    MASTER-ACCOUNT-SID

    MASTER-ACCOUNT-TOKEN

这是命令:

curl -XPOST https://api.twilio.com/2010-04-01/Accounts/SOURCE-ACCOUNT-SID/IncomingPhoneNumbers/PHONE-NUMBER-SID.json -d "AccountSid=DESTINATION-ACCOUNT-SID" -u "MASTER-ACCOUNT-SID:MASTER-ACCOUNT-TOKEN"

.

注意:当您替换值时,它看起来像这样

curl -XPOST https://api.twilio.com/2010-04-01/Accounts/AC0123456789abcdefabcdefabcdefabcd/IncomingPhoneNumbers/PN0123456789abcdefabcdefabcdefabcd.json -d "AccountSid=AC0123456789abcdefabcdefabcdefabcd" -u "AC0123456789abcdefabcdefabcdefabcd:0123456789abcdefabcdefabcdefabcd"


Dev*_*der 4

Twilio 传道者在这里。

要将电话号码从主账户转移到子账户,您需要向要转移的 IncomingPhoneNumber 资源发出 POST 请求,将该资源的 AccountSid 设置为您要将账户移入的子账户 SID。使用 PHP 帮助程序,它看起来像这样:

//Create a new instance of the helper library using master accounts credentials
$client = new Services_Twilio($sid, $token);

// Get the phone number that you want to transfer
$number = $client->account->incoming_phone_numbers->get("PN2a0747eba6abf96b7e3c3ff0b4530f6e");

// update the phone number resources with the account sid of the subaccount
$number->update(array(
    "AccountSid" => "ACecb5a0741d3b8570bcb094ea4dd471d4"
));
Run Code Online (Sandbox Code Playgroud)

希望有帮助。