0

我整合twilio點擊呼叫到我的Rails項目XML。Twilio找不到在軌道上

一切正常,但是網址:我twilio控制器不能在Heroku上找到。但是,如果您在瀏覽器中導航到它,可以找到它。電話撥號,但聲音說:「對不起,發生了問題,再見。」如果我更改URL到正常工作的外部XML文件,只是不承認這個特殊的一個。所以我導致相信控制器等工作正常。

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

想通了。需要連接路由進行POST,我也不得不加skip_before_action:verify_authenticity_token到twilio控制器,因爲它是落後的成員門。 –

+0

很高興你把它分類! – philnash

回答

0

在上述意見解決的OP:

想通了。需要連接路由進行POST,我也不得不 添加skip_before_action:verify_authenticity_token到twilio controller,因爲它是後面的成員門。