Twilio更新拨出呼叫方ID
问题描述:
尝试更新传出来电,但遇到了以下错误:Twilio更新拨出呼叫方ID
*** Twilio::REST::RestError Exception: Unable to fetch record: The requested resource /2010-04-01/Accounts/AC...../OutgoingCallerIds/CA......json was not found
我下面就Twilio网站上的文档:
https://www.twilio.com/docs/api/voice/outgoing-caller-ids#get-outgoing-caller-id-details
@caller_id = @client.account
.outgoing_caller_ids('PNe905d7e6b410746a0fb08c57e5a186f3')
.fetch
需要将什么字符串传递给.outgoing_caller_ids?
答
Twilio开发人员在这里传播。
Outgoing caller IDs是验证号码,您可以在您通过帐户拨打电话时将其用作来电显示。
我可以用下面的代码来获取传出呼叫方ID:
sid = client.outgoing_caller_ids.list.first.sid
caller_id = client.outgoing_caller_ids(sid).fetch
我的猜测是,你实际上是在寻找Incoming Phone Numbers resource,这是你可以用它来获取和更新号码资源,它你在Twilio平台上购买。
可以调用与数SID这样的:
client.incoming_phone_numbers(sid).fetch
让我知道是否有帮助。
工作,谢谢。你是否也知道如何创建/更新子账户的外拨号码? – JohnSmith
如果您想为子帐户执行操作,您可以获取帐户对象,然后使用它执行操作。 'account = client.accounts(account_sid).fetch; account.validation_requests.create(phone_number:phone_number)'。 – philnash
因此为创建一个子帐户的消息服务,我会做 @client = Twilio :: REST :: Client.new(account_sid,auth_token) sub_account = @ client.api.accounts.create(friendly_name:friendly_name) service = sub_account.messaging.v1.services.create(friendly_name:“#{friendly_name}”)' – JohnSmith