#85 ✓resolved

AMI fails to parse events if colon is contained anywhere in data

Reported by dimas | November 7th, 2009 @ 11:13 AM

My dialplan does three actions in a row:


(note the only difference is a character between 'aaa' and 'bbb'. I make telnet connection to AMI port and see all three events coming through:

Event: UserEvent
Privilege: user,all
UserEvent: Conference!aaa+bbb
Event: UserEvent
Privilege: user,all
UserEvent: Conference!aaa:ccc
Event: UserEvent
Privilege: user,all
UserEvent: Conference!aaa!ddd

However simple event-dumping application usign Adhearsion like this:


require 'adhearsion/events_support'
Adhearsion::Events.register_callback %w[asterisk manager_interface] do |event|
  puts event.inspect

will output:

#<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb7e75510 @headers={"AppData"=>"Conference!aaa+bbb", "Channel"=>"SIP/1001-0a3ac008", "Context"=>"default", "Uniqueid"=>"1257609700.14202", "Application"=>"UserEvent", "Privilege"=>"call,all", "Priority"=>"1", "Extension"=>"111"}, @name="Newexten">
#<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb7e73e54 @headers={"Privilege"=>"user,all", "UserEvent"=>"Conference!aaa+bbb"}, @name="UserEvent">
#<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb7e72b44 @headers={"AppData: Conference!aaa"=>"ccc", "Channel"=>"SIP/1001-0a3ac008", "Context"=>"default", "Uniqueid"=>"1257609700.14202", "Application"=>"UserEvent", "Privilege"=>"call,all", "Priority"=>"2", "Extension"=>"111"}, @name="Newexten">
#<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb7e7180c @headers={"UserEvent: Conference!aaa"=>"ccc", "Privilege"=>"user,all"}, @name="UserEvent">
#<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb7e6f3a4 @headers={"AppData"=>"Conference!aaa!ddd", "Channel"=>"SIP/1001-0a3ac008", "Context"=>"default", "Uniqueid"=>"1257609700.14202", "Application"=>"UserEvent", "Privilege"=>"call,all", "Priority"=>"3", "Extension"=>"111"}, @name="Newexten">
#<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb7e6af20 @headers={"Privilege"=>"user,all", "UserEvent"=>"Conference!aaa!ddd"}, @name="UserEvent">
#<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0xb7e667e0 @headers={"Cause-txt"=>"Unknown", "Cause"=>"0", "Channel"=>"SIP/1001-0a3ac008", "Uniqueid"=>"1257609700.14202", "Privilege"=>"call,all"}, @name="Hangup">

As you see, unlike the first Newexten event which got


the second one yielded

"AppData: Conference!aaa"=>"ccc"

which is totally wrong. I believe this is because a bug in the parser - it thinks that colon ia a valid character for the parameter name so it uses something like regexp


to parse while it should use something like



Comments and changes to this ticket

  • Jay Phillips

    Jay Phillips November 8th, 2009 @ 03:50 PM

    Are you sure you're trying this on master? I remember fixing this a few months ago...

    Here's the relevant code from the Ragel parser:

    Key = ((alnum | print) -- (cr | lf | ":"))+;

    before it was...

    Key = ((alnum | print) -- (cr | lf))+;
  • dimas

    dimas November 8th, 2009 @ 04:14 PM

    Oops. Well, I'm sure I'm NOT trying on master - I'm using 0.8.2 which I got from gem install adhearsion.

    Jay, what are you plans on releasing the new version timewise?
    I currently use Adhersion in a very limited way - in fact I'm only using it as AMI/event interface but I already hit many issues with that part - #84, #83, #82 and #74. As I understand #74 and #85 (this issue) are already fixed but the official Adhersion gem is still 0.8.2 released long time ago still affected by both.

    Honestly, I'm not a big fan of pulling latest development branch just to fix some minor issues because my experience says trunk mmay give you more problems then solutions. So I would prefer released version unless you think it will take months.

    So any plans on 0.8.3?


  • Jay Phillips

    Jay Phillips November 8th, 2009 @ 05:32 PM

    • State changed from “new” to “resolved”

    Just released v0.8.3 to RubyForge. :) Give it a try.

    (closing this ticket. re-open if issue still exists)

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

Referenced by