DBget AMI command is unusable
-
Jay Phillips
- State changed from new to open
- Tag set to ami
Try adding this to startup.rb:
Adhearsion::VoIP::Asterisk::ManagerInterface::CAUSAL_EVENT_NAMES << "dbget"Does that fix the error?
-
dimas
Either I'm doing something wrong or it does not help.
Here is the test codeAdhearsion::VoIP::Asterisk::Manager::ManagerInterface::CAUSAL_EVENT_NAMES << "dbget" resp = ami.send_action "DBPut", :Family => "Conference", :Key => "36/Locked", :Value => "1" resp = ami.send_action "DBGet", :Family => "Conference", :Key => "36/Locked" p "1: #{resp.text_body}" begin resp = ami.send_action "DBGet", :Family => "Conference", :Key => "XXX/Locked" p "2: #{resp.text_body}" rescue Exception => e p "ERROR" end resp = ami.send_action "DBGet", :Family => "Conference", :Key => "36/Locked" p "3: #{resp.text_body}" p "done"it just hangs.
-
Ben Klang
- Assigned user changed from Jay Phillips to Ben Klang
- Milestone order changed from 0 to 0
The hang is because Causal Events need a terminator defined. I will research this AMI command and see what the proper terminator needs to be.
-
Ben Klang
- State changed from open to fixcommitted
- Milestone set to 0.8.5
- Milestone order changed from 3023 to 0
This one turned out to be quite tricky. There were several problems:
1) For whatever reason, DBGet's return syntax requires causal event processing (though theoretically it should not need that).
2) The DBGet command never returns a causal event terminator, disobeying Asterisk's AMI syntax (though this is fixed in Asterisk's SVN trunk and will be a part of the upcoming 1.8 release).
3) To make things more complicated, if a database entry is nonexistant, AMI returns a Result: Error, which Adhearsion translates into an AsteriskManagerError, which is itself a subclass of Exception. However, subclasses of Exception are not caught by bare "rescue" statements; only StandardError and its subclasses are caught. This could result in the dialplan thread silently dying when trying to DBGet a non-existant entry.
To the original reporter's first point above, it would be nice if we had a get/set wrapper around DBGet/DBSet. However, I'm going to defer that decision until we decide how to abstract AMI with the upcoming 0.9.0 changes. In the meantime, make sure you wrap all DBGet commands in a begin/rescue block.
The original reporter's second point is fixed completely.
Feedback on how this fix works would be appreciated.
- 84e492e (1 files in 1 dirs): Fix handling of DBGet via AMI [#82 DBget AMI command is unusable state:fixcommitted] - http://bit.ly/bawo0f
-
Ben Klang
- State changed from fixcommitted to resolved
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.