gpt4 book ai didi

ruby - twilio-ruby gem 在调用时是否采用 'from' 、 'to' 和 'url' 以外的参数?

转载 作者:太空宇宙 更新时间:2023-11-03 17:39:27 25 4
gpt4 key购买 nike

查看https://github.com/twilio/twilio-ruby/blob/master/lib/twilio-ruby/rest/calls.rb ,似乎只使用了“from”、“to”和“url”。如何传递“IfMachine”的值?例如,以下内容似乎不起作用。

# set ACCOUNT_SID and AUTH_TOKEN

twilioClient = Twilio::REST::Client.new(ACCOUNT_SID, AUTH_TOKEN)
twilioAccount = twilioClient.account
twilioAccount.calls.create({
:from => 'from_number',
:to => 'to_number',
:url => '/url',
'IfMachine' => 'Hangup'
})

# IfMachine parameter is not passed in the above request

最佳答案

设置 'IfMachine' => 'hangup' 对我有用。我认为 Twilio API 对参数值区分大小写。所以 'hangup' 会起作用,但 'Hangup' 可能不会。

这是我的 twilio-ruby session ,显示参数已正确传递:

irb(main):002:0> c.account.calls.create :from => '2158377932', :to => '4159334335', :url => 'http://demo.twilio.com/welcome/voice', 'IfMachine' => 'continue'
warning: peer certificate won't be verified in this SSL session
=> <Twilio::REST::Call @uri=/2010-04-01/Accounts/AC8faaf6f7efb9dfd60bc0ff3aa7fa00be/Calls/CA0165c3b35c934ed5a2b7a87f343544ff>
irb(main):003:0> c.last_request
=> #<Net::HTTP::Post POST>
irb(main):004:0> req = c.last_request
=> #<Net::HTTP::Post POST>
irb(main):005:0> req.body
=> "IfMachine=continue&To=4159334335&Url=http%3a%2f%2fdemo.twilio.com%2fwelcome%2fvoice&From=2158377932"

关于ruby - twilio-ruby gem 在调用时是否采用 'from' 、 'to' 和 'url' 以外的参数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8016157/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com