TWILIOオンレイズヘルプ:「桁」パラメータを受信していません
-
15-11-2019 - |
質問
私はRailsとTwilioに新しいもので、Twilioの予約リマインダーサンプルコードを実行しようとしています。私は電話をかけることができますが、発信者によって押された数のキーについてTwilioからのフィードバックを得ることができません。
呼び出しが行われたら、リマインダTWIMLが実行されます。
xml.instruct!
xml.Response do
xml.Gather(:action => @post_to, :numDigits => 1) do
xml.Say "Hello this is a call"
xml.Say "Please press 1 to repeat this menu. Press 2 for directions. Or press 3 if you are done."
end
end
.
桁が押されたら、Twilioはコントローラ内の私の指示に投稿する必要があります:
def directions
if params['Digits'] == '3'
redirect_to :action => 'goodbye'
return
end
if !params['Digits'] or params['Digits'] != '2'
redirect_to :action => 'reminder'
return
end
@redirect_to = BASE_URL + '/reminder'
render :action => "directions.xml.builder", :layout => false
end
.
しかし、私が自分自身を呼び出して番号を入力するたびに、呼び出しは元のメッセージにループバックし続けます。その後、私のログをチェックし、明らかにTwilioから送信されている「数字」パラメータはありません。
誰かがこの問題を遭遇しますか?
解決
Usually what's happening in a case like this is that the URL being posted to immediately issues a redirect because of something like URL rewriting or HTTPS redirection or the like. Twilio follows the redirect and on the subsequent GET request sends along the standard set of parameters which doesn't include the Digits parameter that is only sent on the initial POST to the <Gather>
action URL.
所属していません StackOverflow