#16 ✓resolved
ronin-9952 (at lighthouseapp)

ami hangs forever on "meetme list" command

Reported by ronin-9952 (at lighthouseapp) | November 20th, 2007 @ 02:19 PM

wwalker@elephant:~/ami$ cat t4.rb

require 'rubygems'

require 'adhearsion'

require 'adhearsion/voip/asterisk/ami'

@ami = Adhearsion::VoIP::Asterisk::AMI.new "wwalker", "purple", "dlsacs01", :port => 5038, :events => true

@ami.connect!

resp = @ami.command :Command => "meetme list"

puts resp[0][:raw]

wwalker@elephant:~/ami$

Running the above script hangs forever. Admittedly, the command is incomplete, so asterisk responds with a Usage message. But after receiving the entire message, ami just sits and hangs.

Comments and changes to this ticket

  • jhosteny

    jhosteny November 20th, 2007 @ 03:12 PM

    • State changed from “new” to “open”

    Hi Wayne,

    I assume you are running from the SVN repo? I just ran your exact test from head and it runs fine for me. Note I have logging turned on (logger in parser.rb).

    Joe

    irb(main):001:0> require 'rubygems'

    => true

    irb(main):002:0> require 'adhearsion'

    ^[[A=> true

    irb(main):003:0> require 'adhearsion/voip/asterisk/ami'

    => []

    irb(main):004:0> ami = Adhearsion::VoIP::Asterisk::AMI.new "user", "password", "localhost", :port => 5038, :events => true

    => #

    irb(main):005:0> ami.connect!

    Got 27 bytes, "Asterisk Call Manager/1.0\r\n"

    P: 0 PE: 27

    Waiting for "1195589416.68969"

    Got 83 bytes, "Response: Success\r\nActionID: 1195589416.68969\r\nMessage: Authentication accepted\r\n\r\n"

    P: 0 PE: 83

    Packet end: 82, Adhearsion::VoIP::Asterisk::AMI::Packet, "1195589416.68969"

    => [{"Message"=>"Authentication accepted"}]

    irb(main):006:0> resp = ami.command :Command => "meetme list"

    Waiting for "1195589435.20422"

    Got 139 bytes, "Response: Follows\r\nPrivilege: Command\r\nActionID: 1195589435.20422\r\nNo such command 'meetme list' (type 'help' for help)\n--END COMMAND--\r\n\r\n"

    P: 0 PE: 139

    Packet end: 138, Adhearsion::VoIP::Asterisk::AMI::FollowsPacket, "1195589435.20422"

    =====>No such command 'meetme list' (type 'help' for help)<=====

    => [{"Privilege"=>"Command", :raw=>"No such command 'meetme list' (type 'help' for help)"}]

    irb(main):007:0> resp = ami.command :Command => "meetme list"

    Waiting for "1195589464.45647"

    Got 139 bytes, "Response: Follows\r\nPrivilege: Command\r\nActionID: 1195589464.45647\r\nNo such command 'meetme list' (type 'help' for help)\n--END COMMAND--\r\n\r\n"

    P: 0 PE: 139

    Packet end: 138, Adhearsion::VoIP::Asterisk::AMI::FollowsPacket, "1195589464.45647"

    =====>No such command 'meetme list' (type 'help' for help)<=====

    => [{"Privilege"=>"Command", :raw=>"No such command 'meetme list' (type 'help' for help)"}]

    irb(main):008:0> resp

    => [{"Privilege"=>"Command", :raw=>"No such command 'meetme list' (type 'help' for help)"}]

    irb(main):009:0>

  • ronin-9952 (at lighthouseapp)

    ronin-9952 (at lighthouseapp) November 20th, 2007 @ 03:37 PM

    Thank you for all your help so far by the way!

    It looks like you don't have the meetme module loaded, so you are getting

    the standard error from core asterisk. I was getting a Usage message

    from the meetme module (I'd've never figured anything out without

    parser.rb's logger :) :

    wwalker@elephant:~/ami$ ruby !$

    ruby t4.rb

    Got 27 bytes, "Asterisk Call Manager/1.0\r\n"

    P: 0 PE: 27

    Waiting for "1195586126.96294"

    Got 83 bytes, "Response: Success\r\nActionID: 1195586126.96294\r\nMessage: Authentication accepted\r\n\r\n"

    P: 0 PE: 83

    Packet end: 82, Adhearsion::VoIP::Asterisk::AMI::Packet, "1195586126.96294"

    Waiting for "1195586127.20448"

    Got 67 bytes, "Response: Follows\r\nPrivilege: Command\r\nActionID: 1195586127.20448\r\n"

    P: 0 PE: 67

    Got 155 bytes, "Usage: meetme (un)lock|(un)mute|kick|list [concise] \n Executes a command for the conference or on a conferee\n--END COMMAND--\r\n\r\n"

    P: 0 PE: 155

    /opt/depot/ruby-1.8.6-p36/lib/ruby/gems/1.8/gems/adhearsion-0.7.999/lib/adhearsion/voip/asterisk/ami/parser.rb:167:in `wait': Interrupt

    from /opt/depot/ruby-1.8.6-p36/lib/ruby/gems/1.8/gems/adhearsion-0.7.999/lib/adhearsion/voip/asterisk/ami/parser.rb:167:in `wait'

    from /opt/depot/ruby-1.8.6-p36/lib/ruby/gems/1.8/gems/adhearsion-0.7.999/lib/adhearsion/voip/asterisk/ami/parser.rb:164:in `loop'

    from /opt/depot/ruby-1.8.6-p36/lib/ruby/gems/1.8/gems/adhearsion-0.7.999/lib/adhearsion/voip/asterisk/ami/parser.rb:164:in `wait'

    from /opt/depot/ruby-1.8.6-p36/lib/ruby/gems/1.8/gems/adhearsion-0.7.999/lib/adhearsion/voip/asterisk/ami/parser.rb:163:in `synchronize'

    from /opt/depot/ruby-1.8.6-p36/lib/ruby/gems/1.8/gems/adhearsion-0.7.999/lib/adhearsion/voip/asterisk/ami/parser.rb:163:in `wait'

    from /opt/depot/ruby-1.8.6-p36/lib/ruby/gems/1.8/gems/adhearsion-0.7.999/lib/adhearsion/voip/asterisk/ami.rb:88:in `execute_ami_command!'

    from /opt/depot/ruby-1.8.6-p36/lib/ruby/gems/1.8/gems/adhearsion-0.7.999/lib/adhearsion/voip/asterisk/ami.rb:56:in `method_missing'

    from t4.rb:9

  • jhosteny

    jhosteny November 20th, 2007 @ 03:56 PM

    I see, sorry about that. I should have looked more closely at the report.

    It probably is just an error in the regex in the ragel state machine code. I'll take a look.

    Joe

  • jhosteny

    jhosteny November 20th, 2007 @ 04:09 PM

    Okay, I know the problem. The parser is a bit simplistic right now in that it looks for key/value pairs separated by a colon. For the immediate and follows command parsing, this is too simplistic.

    In this case, the "Usage: ..." is causing the problem.

    There are probably a few ways to handle this. I need to look at the (minimal) documentation on these commands and figure out which way is best.

  • jhosteny

    jhosteny November 20th, 2007 @ 04:35 PM

    • State changed from “open” to “resolved”

    Closed by change no 610.

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

People watching this ticket

Pages