说动词没有执行内部用twilio和rails收集动词

时间:2017-02-14 04:35:13

标签: ruby-on-rails twilio

我使用call_phone拨打电话,然后在接听电话时,我要求用户"请按一下继续"。如果他们在超时前没有按任何数字。我问第二次说'#34;我没有得到任何回复。请按一个继续。"

当用户回答时,

call_phone()可以工作并重定向到communications_digits_path。我听到了#34;请按一下继续"如果我在电话键盘上按一个该调用重定向到communications_menu_path。

问题是,如果我不按任何电话键,而不是播放"我没有得到任何回复。请按一个继续。",电话就会挂断。知道我做错了吗?

def call_phone(phone_number)
  @client = Twilio::REST::Client.new(
    Rails.application.secrets.twilio_voice_sid,
    Rails.application.secrets.twilio_token
  )
  @call = @client.account.calls.create(
    from: Rails.application.secrets.twilio_voice_number,
    to: phone_number,
    url: communications_digits_path,
  )
end

def digits
  twiml_response = Twilio::TwiML::Response.new do |r|
    r.Say "Please press one to continue", voice: 'alice', language: 'an-AU'
    r.Gather numDigits: '1', action: communications_menu_path do |g|
      g.say "I didn't get any response. Please press one to continue."
    end
  end
  render :xml => twiml_response.to_xml
end

1 个答案:

答案 0 :(得分:0)

Twilio开发者传道者在这里。

我认为问题是你的第二个How to center (horizontal and vertical) text along an textPath inside an arc using d3.js?有一个小写的“s”。

但总的来说,我们可以通过一些更改使其更加强大。首先,如果用户在第一条消息仍在播放时按一个,则不会发生任何事情,因为它不在<Say>内。其次,我们可以在两条消息之间<Gather>给用户一个机会。

尝试类似:

def digits
  twiml_response = Twilio::TwiML::Response.new do |r|
    r.Gather numDigits: '1', action: communications_menu_path do |g|
      g.Say "Please press one to continue", voice: 'alice', language: 'an-AU'
      g.Pause length: 5
      g.Say "I didn't get any response. Please press one to continue.", voice: 'alice', language: 'an-AU'
    end
  end
  render :xml => twiml_response.to_xml
end

如果有帮助,请告诉我。