Ruby on rails 4 如何使用RubyonRails在twilio调用中发送数字和等待时间
我想打个电话,发送一些数字。我想要实现的结果是,电话应该从我的业务号码转接到手机号码 我用了下面的代码Ruby on rails 4 如何使用RubyonRails在twilio调用中发送数字和等待时间,ruby-on-rails-4,twilio,Ruby On Rails 4,Twilio,我想打个电话,发送一些数字。我想要实现的结果是,电话应该从我的业务号码转接到手机号码 我用了下面的代码 @call = @client.account.calls.create( :from => 'xxxx', # twilio_number, :to => 'xxxx', # RACF number, :send_digits => "xxxx", # Business number :timeout => "3", :send
@call = @client.account.calls.create(
:from => 'xxxx', # twilio_number,
:to => 'xxxx', # RACF number,
:send_digits => "xxxx", # Business number
:timeout => "3",
:send_digits => "xxxx", # pin
:timeout => "3",
:send_digits => "*xx", # option for forwarding
:timeout => "3",
:send_digits => "xx", # confirm option
:timeout => "3",
:send_digits => "xxxxx", # destination number to which call should be forwarded
:method => "GET"
:url => "http://demo.twilio.com/docs/voice.xml" # Fetch instructions from this URL when the call connects
)
我正在使用超时来暂停。请告诉我如何做到这一点。这里是Twilio开发者福音传道者 就快到了,但是
send_digits
应该有一个长字符串,其中包含数字和表示暂停的字符“w”
根据每个w
表示0.5秒,因此您应该将代码更改为以下内容:
@call = @client.account.calls.create(
:from => 'xxxx', # twilio_number,
:to => 'xxxx', # RACF number,
:send_digits => "+1234567www12345www*123www",
:url => "http://demo.twilio.com/docs/voice.xml" # Fetch instructions from this URL when the call connects
)
其中,+1234567WWW12345WW*123WW
表示:
- 业务编号
- 1.5秒暂停
- 别针
- 再停顿1.5秒
- 转发选项
- 等等
希望这对您有所帮助我也在尝试通过twilio发送数字。当我尝试发送一个连续字符串时,我收到一个错误
Twilio::REST::RequestError:SendDigits的长度必须小于32个字符
。也许我可以使用twiml而不是将文件作为post参数发送。@Saurabh在此处查看Megan的响应:通过使用Megan建议的方式实现了这一点。我在问题中执行的步骤是使用twiml实现的,并在代码的url参数中设置生成的文件@call=@client.account.calls.create(:from=>'xxxx',#twilio_number,:to=>'xxxx',#RACF number,:send_digits=>“+1234567www12345www*123www”,:url=>“url”#此url处的文件具有执行发送数字、输入pin等操作的xml代码。)