From ambervoip at gmail.com Sun Mar 2 07:42:06 2008 From: ambervoip at gmail.com (Andrius) Date: Sun, 2 Mar 2008 14:42:06 +0200 Subject: [Telegraph-users] Rails 2 In-Reply-To: <855e4dcf0802271926v69f35ddcif4595346cebca388@mail.gmail.com> References: <6B3727B1924AC94F915E95DC9063EFFA03F5D9CD@norwalk-ex1.ad.adeptra.com> <855e4dcf0802271926v69f35ddcif4595346cebca388@mail.gmail.com> Message-ID: <20080302124205.GA20938@nc6320.norby.lt> Hello. Evarything went ok for me with Rails 2.0, but i did not generated - just copied my existing application from older version (including all patches to Telegraph). On Thu, Feb 28, 2008 at 04:26:19PM +1300, Tim Uckun wrote: > On Sat, Jan 5, 2008 at 4:19 PM, Patrick Baker wrote: > > This may have been discussed before, so apologies if I'm bringing up an old topic. Has anyone tested telegraph with the recently released Rails 2.0? > > > Just today I tried it with rails 2.0 > > When I went to generate an AMI model I got the following error. > > D:\Source\ruby\telegraph_test_new>ruby script/generate ami_model AMIModel > d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `gem_original_require': no such file to load -- breakpoint > (MissingSourceFile) > from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `require' > from d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in > `require' > from d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in > `new_constants_in' > from d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in > `require' > from D:/Source/ruby/telegraph_test_new/vendor/plugins/telegraph/lib/call_connection.rb:8 > from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `gem_original_require' > from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `require' > from d:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in > `require' > ... 17 levels... > from d:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/generate.rb:1 > from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `gem_original_require' > from d:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `require' > from script/generate:3 > > D:\Source\ruby\telegraph_test_new> > > So looks like something is not right. > _______________________________________________ > Telegraph-users mailing list > Telegraph-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/telegraph-users From Prometheus001 at gmx.net Mon Mar 3 13:49:07 2008 From: Prometheus001 at gmx.net (Peter P GMX) Date: Mon, 03 Mar 2008 19:49:07 +0100 Subject: [Telegraph-users] Added some missing functionality for using Mealy machines Message-ID: <47CC4823.5000508@gmx.net> What impressed me most of this telegraph api was the possiblity to use the model view controller pattern. But some features were missing there to make it really flexible. After some changes now Iam really happy. I would like to share some addons with you. I had the following idea: Why no setup dialplans graphically or via database? What you need therefore is an implementation for a Mealy machine (mean: A machine has a certain state (@params), and the input from a user (or even no input == Moore machine) generates the next state. The most important issue was to render a voice to a certain view. This did not work in Telegraph implementation I had. So I added the new method "render_voice_to(action)" vendor/plugins/telegraph/lib/agi.rb: def render_voice_to(dest) begin #This needs improvement. Rely's too much on defaults f= "#{template_root}/#{default_template_name(dest)}.voice" render_voice do |voice| eval File.read(f) end rescue Errno::EPIPE call_hung_up rescue Errno::ECONNRESET #User hungup. If the hung_up callback exists, call it call_hung_up end @performed_render = true end Now you can render e.g. the method "index" to a method named "dial", e.g. render_voice_to('dial'). The appropriate dial.voice may contain the following: voice.dial @number or voice.dial_link(@actionparams, {:controller=>'dialhandlers', :action => 'index', :sequence => @sequence}) (I added e.g. a sequence number for my Mealy machine) You may also use helpers here!!! This is important if you like to use e.g. menus with dynamic menu items read from the database. I defined voice helpers in application.rb as usual html helpers dont't work here. You may be astonished about the method "voice.dial_link" I used. When you generate a Mealy machine, you have to come back to your current controller or to another controller. So you need to redirect your request, after it has finished. This is not done in current Telegraph implementation. So I modified and added some new methods in vendor/plugins/telegraph/lib/call_connection.rb which enable this behaviour: dial_link # Dial an address and redirect ro link. # \param address - The address to dial e.g. SIP/1234 at foo.com # \param waittime # \param time Maximum time for the call, in sec, or 0 to specify no time limit # \param extraOptions Extra options to pass to asterisk, as a string def dial_link(address, link, waittime=15, time=0, extraOptions="") options = "g#{extraOptions}" if time > 0 options = "#{options}S(#{time})" end exec("Dial", "#{address}|#{waittime.to_s}|#{options}") @request.create_redirect link if link end play_sound_link: # PST: Plays a sound over the channel, synchronously until the end of the sound. # Then redirect to link if available # Your asterisk must have the appropriate codecs installed. # The param "soundName" must be a full path to the sound file on the Asterisk server def play_sound_link(soundName, link=nil) exec("playback", soundName) @request.create_redirect link if link end speak_text_link: # Calls swift.agi to speak some text and redirects to link if available. Sorry, this expects the Cepstral engine. def speak_text_link(texttospeak, link=nil) fixedmessage = texttospeak fixedmessage = fixedmessage.gsub("\r", " ") fixedmessage = fixedmessage.gsub("\n", " ") fixedmessage = fixedmessage.strip exec("AGI", "swiftphp.agi|\"" + fixedmessage + "\"") @request.create_redirect link if link end I will create some new methods in the future. Enjoy! P.S.: My Mealy machine works now. I setup Voice menus via Freemind(nodes with attributes and links), read the file into the database and redirect Asterisk to the Telegraph AGI server. As I have also setup html views in this app, I can test the workflow on the web page and via phone at the same time. Best regards Peter From jlaroff at gmail.com Mon Mar 3 16:21:40 2008 From: jlaroff at gmail.com (Joshua Laroff) Date: Mon, 3 Mar 2008 16:21:40 -0500 Subject: [Telegraph-users] Rails 2.0.2 Message-ID: Hello, I am new to rails. When I try to create an ami_model, I receive this error: can't activate rails (= 1.2.6), already activated rails-2.0.2] (Gem::Exception) What is the best way to solve this? Thanks From djidane41771 at yahoo.fr Mon Mar 31 02:26:15 2008 From: djidane41771 at yahoo.fr (ENG Borei) Date: Mon, 31 Mar 2008 08:26:15 +0200 (CEST) Subject: [Telegraph-users] ami server take 100% of cpu Message-ID: <172557.14211.qm@web25709.mail.ukl.yahoo.com> Hi everyone, I saw the archive message about the problem of memory about ami server. Despite the fix, my ami server takes 100% of cpu but a few hours after starting the server. For information, we make about 50-60 call an hour and we use too ami_event Handler. Does anyone can explain where is the problem in the code or did someone improve it? (maybe I'll have a look) thanks a lot Borei ENG --------------------------------- Envoy? avec Yahoo! Mail. Plus de moyens pour rester en contact. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/telegraph-users/attachments/20080331/d1eb12f5/attachment.html