#45 ✓resolved

'Channel' improperly parsed in Events

Reported by jsgoecke | December 19th, 2008 @ 11:08 AM

I am storing off Events to a CouchDB instance and noticed the Channel arrives in the hash as follows:

"Channel: IAX2/"=>"4569-9904"

I believe it should be:

"Channel"=> "IAX2/"

More details here, and the CouchDB document attached:


Comments and changes to this ticket

  • Jay Phillips

    Jay Phillips December 23rd, 2008 @ 09:18 PM

    • State changed from “new” to “open”
  • Jay Phillips

    Jay Phillips December 24th, 2008 @ 05:04 AM

    I added some lexer specs to try to reproduce this issue but they pass. For some reason I can't reproduce this. Are you sure this is happening in Adhearsion-land and not CouchDB land? I don't see how the lexer could parse that improperly...


  • jsgoecke

    jsgoecke December 24th, 2008 @ 10:39 AM

    This gist:


    Is simply this in events.rb:


    So, before it even gets to CouchDB I see it mangled (and in fact when not using CouchDB at all and just showing the event). Just did a git pull on the latest ahn master and still able to produce it:


  • Jay Phillips

    Jay Phillips December 25th, 2008 @ 01:20 AM

    For the record, this doesn't seem to be an issue with SIP:

     INFO ahn: #<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0x114278c @headers={"CallerIDNum"=>"jicksta", "Channel"=>"SIP/", "Uniqueid"=>"asterisk-5881-1230185859.0", "State"=>"Down", "Privilege"=>"call,all", "CallerIDName"=>"Jay Phillips"}, @name="Newchannel">

    Testing with IAX next...

  • Jay Phillips

    Jay Phillips December 25th, 2008 @ 01:40 AM

    It seems IAX is parsed properly when using an IAX softphone. I need to test with an IAX trunk (to get the IAX2/trunk/exten format) still...

    #<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0x1a56ad0 @headers={"AppData: agi"=>"//", "Channel"=>"IAX2/jay_desktop-9", "Context"=>"adhearsion", "Uniqueid"=>"asterisk-5881-1230186622.1", "Application"=>"AGI", "Privilege"=>"call,all", "Priority"=>"1", "Extension"=>"h"}, @name="Newexten">
    #<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent:0x1a46cac @headers={"Cause-txt"=>"Unknown", "Cause"=>"0", "Channel"=>"IAX2/jay_desktop-9", "Uniqueid"=>"asterisk-5881-1230186622.1", "Privilege"=>"call,all"}, @name="Hangup">
  • jsgoecke

    jsgoecke December 25th, 2008 @ 04:11 AM

    I was just dialing back to localhost with an IAX2 trunk, did not need a 'real' one for testing.

  • jsgoecke

    jsgoecke February 10th, 2009 @ 12:14 AM

    This error also occurs with the appdata event if it contains an AGI attribute, as follows:

    WARN event_logger: ["AppData: agi", "//localhost"]

    As you may see, it is not parsing correctly. As it should look like this:

    ["AppData", "agi://localhost"]

  • jsgoecke

    jsgoecke February 10th, 2009 @ 12:46 AM

    I wrote a method that may fix this by putting the data back together properly:

    def fix_event_parsing(header)

    first_field = header[0].split(' ')
    header[0] = first_field[0].gsub!(':','')
    header[1] = first_field[1] + ":" + header[1]
    return header


  • Jay Phillips

    Jay Phillips February 10th, 2009 @ 04:44 PM

    Can't really use Ruby string manipulation to fix this bug. This is a bug in the Ragel lexer generator.

  • jsgoecke

    jsgoecke March 13th, 2009 @ 12:22 PM

    Hello, I have a variable in asterisk that store a url as well as other parameters seperated by coma eg


    where urlstring=http://xx.xx.xx.xx/eventmanger

    but in my ami event in adhearsion it replaces ':' with "=>" ideas why?

    INFO ami: #<Adhearsion::VoIP::Asterisk::Manager::ManagerInterfaceEvent: 0xb787b2a4 @name="Newexten", @headers={"AppData: 4504,86,2,2,SIP/ 192.168.x.x-081914c0,http"=>"//192.168.x.x/EventManager", "Channel"=>"SIP/192.168.x.x-081914c0", "Context"=>"cb_emergency_temp", "Uniqueid"=>"1236958200.106", "Application"=>"NoOp", "Privilege"=>"call,all", "Priority"=>"7", "Extension"=>"s"}>

    thanks David L

  • Jay Phillips
  • Jay Phillips

    Jay Phillips March 30th, 2009 @ 08:28 PM

    • State changed from “open” to “resolved”

    Okay, this should be fixed now in master.

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