#92 ✓resolved

Menu method under JRuby does not appear to work

Reported by jsgoecke | December 2nd, 2009 @ 01:14 PM | in 0.8.5

The menu method of Adhearsion does not appear to work under JRuby, as the menu method never passes to link to evaluate the selection. If I run the same dialplan under MRI, everything works, but once moving to JRuby it does not.

At first I thought it might be related to this patch, but does not appear to be:


Comments and changes to this ticket

  • dilshodm

    dilshodm January 5th, 2010 @ 07:19 PM

    • Tag set to jruby menu jump_to


    The problem exists with jump_to command which is used by menu.
    I did some investigation and see in commands.rb in def jump_to there is following:

    raise Adhearsion::VoIP::DSL::Dialplan::ContextNotFoundException unless context.kind_of?(Adhearsion::DialPlan::DialplanContextProc)

    I check under jruby and see that context.class == 'Proc', but not 'Adhearsion::DialPlan::DialplanContextProc'
    So, as a temporary hack we can use the following:

    raise Adhearsion::VoIP::DSL::Dialplan::ContextNotFoundException unless context.kind_of?(Proc)

    instead of above.

  • Ben Klang

    Ben Klang August 7th, 2010 @ 01:55 PM

    • Tag changed from jruby menu jump_to to jruby menu jump_to, dsl, menu
    • Milestone order changed from “0” to “0”
  • Ben Klang

    Ben Klang August 7th, 2010 @ 01:55 PM

    • Milestone set to 0.8.5
    • Assigned user changed from “Jay Phillips” to “Ben Klang”
    • Milestone order changed from “3033” to “0”
  • Ben Klang

    Ben Klang August 19th, 2010 @ 05:28 PM

    • State changed from “new” to “open”

    I have traced this down to what I believe is a bug in JRuby. As dilshodm observed, the class is incorrectly being reported as a Proc, instead of Adhearsion::Dialplan::DialplanContextProc. I did a couple of quick tests in JRuby:

    module Adhearsion
      class Foo
        def self.new_bar(&block)
        class Bar < Proc
          def initialize(&block)

    With the above code I tried two different ways of getting a Adhearsion::Foo::Bar object:

    x = Adhearsion::Foo::Bar.new { puts "x" }
    puts x.class # => Adhearsion::Foo::Bar
    x = Adhearsion::Foo.new_bar { puts "x" }
    puts x.class # => Proc

    I will file a bug with the JRuby developers. In the meantime I will find a safe workaround to re-enable the menu DSL under JRuby.

  • Ben Klang

    Ben Klang August 19th, 2010 @ 05:41 PM

    • Tag changed from jruby menu jump_to, dsl, menu to dsl, jruby, menu

    Issue reported to JRuby here:

  • Ben Klang

    Ben Klang August 19th, 2010 @ 06:52 PM

    • State changed from “open” to “fixcommitted”

    A workaround has been committed. This effectively addresses the issue.


  • Ben Klang

    Ben Klang August 24th, 2010 @ 01:53 PM

    • State changed from “fixcommitted” to “open”

    The problem is that JRuby is actually not instantiating the class correctly. Because of this the workaround I committed only fixes part of the problem. Using the +context syntax to include another context will still not work in JRuby.

    JRuby has fixed the issue and it will appear in 1.6.0. Until then Menu will only have limited functionality under JRuby. This needs to be documented.

  • Ben Klang

    Ben Klang August 24th, 2010 @ 04:20 PM

    • State changed from “open” to “resolved”

    Charles Nutter has noted in the JRuby bug report that the DialPlanProc class will not properly get initialized. The workaround I committed will make most of the menu work, but I do not consider adding more workarounds for this bug in JRuby to be feasible. A check has been added to the top of dial_plan.rb that will warn users who have an affected version of JRuby. The bugfix in JRuby is currently scheduled to be a part of the 1.6.0 release.

    Based on my testing, the basic menu functionality will work. The only thing I see that will not work is the "+context" functionality to jump from one context to another.

    my_context {
    other_context {
      play "demo-congrats

    A call into "my_context" will result in this type of exception:

    ERROR agi: NoMethodError: undefined method `+@' for #<Proc:0x734d246@/Users/bklang/src/ahn_app/dialplan.rb:33>

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Shared Ticket Bins