0

twilioをクリックして私のレールプロジェクトを呼び出すように統合しています。Twilioがレール上にxmlを見つけることができません

すべてがうまく動作しますが、私のtwilioコントローラのherokuではURLが見つかりません。ただし、ブラウザーでそのページに移動すると、それを見つけることができます。電話はダイヤルしますが、声は "残念ながら問題が発生しました、さようなら"と言います私は外部xmlファイルにURLを変更する場合、それは正常に動作し、ちょうどこの特定のものを認識しません。だから私はコントローラなどが正常に動作すると信じてリードしています。

twillio_controller.rb

def call 

     @full_phone = current_user.phone 
     @partial_phone = @full_phone.last(-1) 
     @connected_number = "+61" + @partial_phone 


     @client = Twilio::REST::Client.new @@twilio_sid, @@twilio_token 
     # Connect an outbound call to the number submitted 
     @call = @client.calls.create(
     :from => @@twilio_number, 
     :to => @connected_number, 
     :url => 'http://besttradies.herokuapp.com/mytradies/connect.xml', # Fetch instructions from this URL when the call connects 
    ) 
     @msg = { :message => 'Phone call incoming!', :status => 'ok' } 

    end 

    def connect 
    # Our response to this request will be an XML document in the "TwiML" 
    # format. Our Ruby library provides a helper for generating one 
    # of these documents 
    response = Twilio::TwiML::Response.new do |r| 
     r.Say 'If this were a real click to call implementation, you would be connected to an agent at this point.', :voice => 'alice' 

    end 
    render text: response.text 
    end 
+1

それを実演しました。 connectのルートはPOSTでなければならず、skip_before_action:verify_authenticity_tokenをメンバーシップドアの背後にあるtwilioコントローラに追加する必要がありました。 –

+0

あなたはそれを整理してうれしい! – philnash

答えて

0

上記のコメントで解決OP:

はそれを考え出しました。 connectのルートはPOSTにする必要がありました。また、 skip_before_action:verify_authenticity_tokenをtwilio controllerに追加する必要がありました。

関連する問題