Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 如何使用RubyonRails在twilio调用中发送数字和等待时间_Ruby On Rails 4_Twilio - Fatal编程技术网

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代码。)