Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

ami strips line separators from raw command output

#15

ami strips line separators from mulit-line command responses. Without line separations, the ugly data returned by most asterisk commands is nearly unparsable.

wwalker@elephant:~/ami$ cat t3.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 => "core show channels verbose"

p resp[0][:raw]

wwalker@elephant:~/ami$ ruby t3.rb

"Channel Context Extension Prio State Application Data CallerID Duration Accountcode BridgedTo 0 active channels0 active calls"

wwalker@elephant:~/ami$

The results should have had 3 \n's

"Channel Context Extension Prio State Application Data CallerID Duration Accountcode BridgedTo \n0 active channels\n0 active calls\n"

Reported by ronin-9952 (at lighthouseapp) · November 20th, 2007 @ 12:23 PM

State: resolved
Milestone: none
Assigned to: jhosteny jhosteny

Activity

  1. ronin-9952 (at lighthouseapp)
    ronin-9952 (at lighthouseapp)

    I've fixed this for my use by adding "\n" as an argument to join in line 137 of lib/adhearsion/voip/asterisk/ami/parser.rb

    @current_packet[:raw] = @__ragel_raw.join("\n") if @current_packet.raw?

    However, I don't understand this well enough to know what unforeseen side effects might come about from application of that change.

    November 20th, 2007 @ 12:30 PM

  2. jhosteny
    jhosteny
    • State changed from new to resolved

    I made the exact same change. This should fix it (change no. 609).

    • Joe

    November 20th, 2007 @ 12:35 PM

  3. jhosteny
    jhosteny

    On Nov 20, 2007, at 12:30 PM, Lighthouse wrote:

    November 20th, 2007 @ 12:35 PM

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.