2

I have Asterisk and Rails app running on the same server. All inbound calls via Asterisk triggers a "curl" to the rails app's controller to initiate a juggernaut publish, enabling real-time push of inbound calls to the individual logged in user (Pop-up dialog showing caller profile details).

The problem is, the Passenger Spawner of the rails app is running at almost 100% CPU usage when ever calls starts coming in. Each inbound phone call will run:

/usr/bin/curl http://parlo.local/asterisk/inbound_call?exten=8405&src_num=921187888&recordingfilename=q70001-20

In asterisk controller:

def inbound_call
  if params[:src_num].length > 6
    extension = AsteriskUserextension.find_by_extension(params[:exten])
    if extension.present? && extension.user.present?
      @user = extension.user
      customer = Customer.first_match(params[:src_num]).first
      customer_name = customer.present? ? customer.full_name : "Unknown Caller"
      queue = AsteriskQueue.find_by_name(params[:queue])
      @result = Asterisk::Action.response_factory("asterisk_inbound","#{queue.try(:title)}","OK",customer.try(:id))
      publish
    end
  end
  render :nothing => true, :status => :created
end

I believe the high inbound call rate is causing the high CPU usage. What is the best way to remedy this situation? Will pushing all the work to RESQUE help?

Thanks for any guidance!

4

1 回答 1

0

您需要使用 FastCGI 技术。

您还需要在星号中使用 CURL 函数而不是系统应用程序。

对 System 的每次调用都会创建 shell 并创建新的进程。

通过 AMI 而不是 dooign CURL 检查星号事件也是一个好主意。

于 2012-05-08T04:21:16.743 回答