在我的adhearsion拨号方案中,我有以下代码,这些代码会导致立即从呼叫断开连接,但没有任何输出到日志或控制台:
the_flow = CallFlow.where(:dnis => dnis).firstCallFlow是我的rails应用程序( gui / app / model /call_flow.rb)中的一个模型,它位于我的adhearsion应用程序的gui目录中。在我的.ahnrc文件中有:
paths:
# All paths are relative to this file's directory
init: config/startup.rb
dialplan: dialplan.rb
events: events.rb
models: gui/app/models/*.rb这是call_flow.rb:
class CallFlow < ActiveRecord::Base
belongs_to :routable, :polymorphic => true
def dialplan
puts self.routable.description.squeeze("\n").strip
end
def target_route=(params)
self.routable = params[:kind].constantize.new(params.reject {|k,v| k == "kind"})
end
end最后,我在config/Startup.rb中有下面这一行:
config.enable_rails :path => 'gui', :env => :development我知道这个模型是有效的,因为我可以使用rails服务器创建记录。但我甚至不知道如何获得任何信息,当它到达上面的第一行时,拨号方案会断开呼叫。
发布于 2011-08-31 21:31:19
以下是需要检查的内容:
config/startup.rb:debug您已启用Rails集成或数据库集成,而不是同时启用两者。ahn start console /path/to/ahn/app启动Adhearsion控制台。然后,您将拥有一个类似于Rails控制台的控制台,并且应该能够访问所有ActiveRecord模型(假设正确加载了Rails集成)。Adhearsion 1.1.0或更高版本的异常记录器示例。把这个放到你的events.rb里:
events.exception.each do |e|
ahn_log.error e.message
ahn_log.debug e.backtrace.join("\n")
endRails与Adhearsion数据库集成的一般说明:
对于Rails集成,只有一行类似于config.enable_rails :path => '/path/to/rails/app', :env => :production
config.enable_database :adapter => 'mysql', :username => 'root', :password => '', :host => 'localhost'
models/,但可以通过编辑Adhearsion应用程序基目录中的.ahnrc文件进行更改。发布于 2011-08-31 10:51:13
尝试在rails控制台中运行此代码
首先启动控制台
bundle exec rails console然后尝试运行导致问题的代码
CallFlow.where(:dnis => "something").first # replace "something" with something validhttps://stackoverflow.com/questions/7248981
复制相似问题