ami strips line separators from raw command output
Reported by ronin-9952 (at lighthouseapp) | November 20th, 2007 @ 12:23 PM
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"
Comments and changes to this ticket
-
ronin-9952 (at lighthouseapp) November 20th, 2007 @ 12:30 PM
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.
-
jhosteny November 20th, 2007 @ 12:35 PM
- State changed from new to resolved
I made the exact same change. This should fix it (change no. 609).
- Joe
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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป