Forum: Ruby on Rails RAGI Gem - Running an additional server thread

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Muppet M. (Guest)
on 2006-02-01 17:29
I have RoR running and have configured RAGI (per the new tutorial
provided at ETel http://www.snapvine.com/code/ragi) but I get this:

---
user# script/server
=> Booting WEBrick...
[2006-01-30 14:20:25] INFO RAGI::CallServer: default-handler= port=4573
[2006-01-30 14:20:25] INFO WEBrick 1.3.1
[2006-01-30 14:20:25] INFO ruby 1.8.2 (2004-12-25) [i586-linux]
[2006-01-30 14:20:25] WARN TCPServer Error: Address already in use -
bind(2)
[2006-01-30 14:20:25] INFO WEBrick::GenericServer#start: pid=13375
port=4573
[2006-01-30 14:20:25] INFO RAGI::CallServer: server shutdown port=4573
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2006-01-30 14:20:25] INFO WEBrick 1.3.1
[2006-01-30 14:20:25] INFO ruby 1.8.2 (2004-12-25) [i586-linux]
[2006-01-30 14:20:25] INFO WEBrick::HTTPServer#start: pid=13375
port=3000
---

Nothing is configured to run on (xinetd) or is running on port 4573, and
yet I get this error. Also, I tried to change the default port in:

ragi-1.0.1/ragi # vi config.rb

but I get the same error for any port I try to use. How do I get this to
work?
Guido S. (Guest)
on 2006-02-02 18:15
(Received via mailing list)
Use config.rb for standalone RAGI programs. If you want RAGI to run
from within Rails, instead place something like the following in
environment.rb (not config.rb)

# ragi configuration

require 'webrick'

Dependencies.mechanism = :require # class loading magic

class SimpleThreadServer < WEBrick::SimpleServer
  def SimpleThreadServer.start(&block)
    Thread.new do block.call
    end
  end
end

require 'ragi/call_server'

RAGI::CallServer.new(:ServerType => SimpleThreadServer )

I've found that it works best for me when I place ragi under the lib
directory in the rails project. If you have more problems, please post
more details ... also check that there are no existing instances of
ragi or other asterisk gateway interface programs.

You can always try doing telnet to port 4573 (e.g. telnet localhost
4573) to verify that there's nothing running on that port. If there's
nothing running, you should get connection refused.

-- G.
This topic is locked and can not be replied to.